diff options
author | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2019-05-26 10:50:23 +0100 |
---|---|---|
committer | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2019-05-26 11:11:38 +0100 |
commit | d28467db161d0590469b5f8e1115f84858d66e06 (patch) | |
tree | 7a9ae9a05a7ed734f03ffc20c3e5619b2a3ad75e /README.md | |
parent | 4615f2d1c695caf9b04719f51d57dfae539bb712 (diff) |
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>
Diffstat (limited to 'README.md')
0 files changed, 0 insertions, 0 deletions