Bug#550462: libautodie-perl: does not die on errors from chmod()

Damyan Ivanov dmn at debian.org
Sun Oct 11 19:20:18 UTC 2009


-=| Jonathan Yu, Sat, Oct 10, 2009 at 11:23:11AM -0400 |=-
> On Sat, Oct 10, 2009 at 5:01 AM, Damyan Ivanov <dmn at debian.org> wrote:
> > $ cat <<EOF > test.pl
> > #!/usr/bin/perl
> > use autodie qw(:all);
> >
> > chmod 0755, "/non-existent/file" or warn $!;
> >
> > print "I'm alive!\n";
> > EOF
> >
> > $ perl test.pl
> > No such file or directory at test.pl line 4.
> > I'm alive
> >
> > Expected result: script should die.
> I suspect this isn't really a bug, but is by design. What happens if
> you do the chmod without checking the return value?

Nothing. No warning, no death. This is how the code was in the first 
place and I was relying on autodie to catch the possible typo in the 
file name :)

> The point of autodie is to make checking/warning as you do
> unnecessary; if you do check it yourself, the calling context is
> different (scalar context vs void context), which can make all the
> difference.
> 
> What happens if you do the same thing, but drop the "or warn $!" part?
> Does it die then? If not, then we should forward the bug upstream.

Nothing happens.

-- 
dam
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.alioth.debian.org/pipermail/pkg-perl-maintainers/attachments/20091011/f8b5bce2/attachment.pgp>


More information about the pkg-perl-maintainers mailing list