chiark / gitweb /
Replace `confess $!' with `confess "$!"', to actually print errno
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 26 May 2019 09:50:23 +0000 (10:50 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 26 May 2019 10:11:38 +0000 (11:11 +0100)
commitd28467db161d0590469b5f8e1115f84858d66e06
tree7a9ae9a05a7ed734f03ffc20c3e5619b2a3ad75e
parent4615f2d1c695caf9b04719f51d57dfae539bb712
Replace `confess $!' with `confess "$!"', to actually print errno

  $ perl -e 'use Carp; open X, ">/dev/eacces" or die $!'
  Permission denied at -e line 1.
  $ perl -e 'use Carp; open X, ">/dev/eacces" or confess $!'
   at -e line 1.
  $ perl -e 'use Carp; open X, ">/dev/eacces" or confess "$!"'
  Permission denied at -e line 1.
  $

confess will get references to its arguments in @_.  Its documentation
says it saves/restores $!.  I conjecture that these interact as we see
here:
  $ perl -e '$!=1; sub x { print ">@_<\n"; }  x $!;'
  >Operation not permitted<
  $ perl -e '$!=1; sub x { local $!; print ">@_<\n"; }  x $!;'
  ><

Quoting "$!" averts the reference (and it will also ensure that we
get the string value of $!, in case confess were to do anything in the
future which would mess that up).

This commit was made like this:

  perl -i -pe 's/confess \$!/confess "\$!"/g' dgit
  perl -i -pe 's/confess \$!/confess "\$!"/g' git-debrebase
  perl -i -pe 's/confess \$!/confess "\$!"/g' Debian/Dgit.pm

I have manually reviewed each hunk and it all looks good to me.

Closes: #929549
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Debian/Dgit.pm
dgit
git-debrebase