mr: trust errors cause "Use of uninitialized value" warnings

Adam Spiers vcs-home at adamspiers.org
Thu Dec 22 12:49:11 CET 2011


The trust error handling code expects five parameters:

	my $trusterror = sub {
		my $msg=shift;
		my ($err, $file, $lineno, $url)=@_;

but it is only ever invoked with one, e.g.

		if (! $trusted && /[[:cntrl:]]/) {
			$trusterror->("illegal control character");
		}

For me, this results in a mess when I have an untrusted file:

    Use of uninitialized value $err in concatenation (.) or string at
/home/adam/bin/mr line 1295.
    Use of uninitialized value $file in concatenation (.) or string at
/home/adam/bin/mr line 1295.
    Use of uninitialized value $lineno in concatenation (.) or string
at /home/adam/bin/mr line 1295.
    mr:  in untrusted  line
    (To trust this file, list it in ~/.mrtrust.)

Ideally there would be a test suite to catch things like this.


More information about the vcs-home mailing list