Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

autodie should exit($!) [rt.cpan.org #93716] #101

Open
toddr opened this issue Jan 16, 2020 · 0 comments
Open

autodie should exit($!) [rt.cpan.org #93716] #101

toddr opened this issue Jan 16, 2020 · 0 comments

Comments

@toddr
Copy link
Collaborator

toddr commented Jan 16, 2020

Migrated from rt.cpan.org#93716 (status was 'open')

Requestors:

From felipe@felipegasper.com on 2014-03-10 19:12:14
:

==================
root@felipe 14:08:36 case88745 /usr/local/cpanel
 > perl -e'open FH, "<", "yglzdfvxbfg" or die;'
Died at -e line 1.

ENOENT (2)
==================
root@felipe 14:06:08 case88745 /usr/local/cpanel
 > cat | perl -Mautodie
`perl -Mautodie -e'open FH, "<", "yglzdfvxbfg"'`;
print 0+$? . $/;
print $? . $/;
Can't open 'yglzdfvxbfg' for reading: 'No such file or directory' at -e 
line 1
65280
65280

OK
==================

When an exception from autodie causes perl to exit(), the exit code 
should correspond to the value of $! as perl �natively� does as in the 
first example above.


-Felipe Gasper
cPanel, Inc.


From niels@thykier.net on 2014-03-10 19:22:20
:

On 2014-03-10 20:12, felipe@felipegasper.com via RT wrote:
> Mon Mar 10 15:12:14 2014: Request 93716 was acted upon.
> Transaction: Ticket created by felipe@felipegasper.com
>        Queue: autodie
>      Subject: autodie should exit($!)
>    Broken in: (no value)
>     Severity: (no value)
>        Owner: Nobody
>   Requestors: felipe@felipegasper.com
>       Status: new
>  Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=93716 >
> 
> 
> [...]
> 
> When an exception from autodie causes perl to exit(), the exit code 
> should correspond to the value of $! as perl �natively� does as in the 
> first example above.
> 
> 
> -Felipe Gasper
> cPanel, Inc.
> 

Hi Felipe,

What version of autodie are you using?  Namely, I suspect that the
problem would be fixed in autodie 2.21 due to:

"""
        * INTERNAL : $" and $! are no longer arbitrarily messed with
          for no reason via autodie.  (They're still messed with when
          using Fatal.)
"""

Which would ensure that "$!" is (still) set to 2 and die should DTRT
from there.  Previously, $! would be "protected" by a local, causing it
to be reset to (in your example above) 0.

~Niels




From felipe@felipegasper.com on 2014-03-10 19:30:46
:

On 10.3.14, 2:22 PM, Niels Thykier via RT wrote:
> <URL: https://rt.cpan.org/Ticket/Display.html?id=93716 >
>
> On 2014-03-10 20:12, felipe@felipegasper.com via RT wrote:
>> Mon Mar 10 15:12:14 2014: Request 93716 was acted upon.
>> Transaction: Ticket created by felipe@felipegasper.com
>>         Queue: autodie
>>       Subject: autodie should exit($!)
>>     Broken in: (no value)
>>      Severity: (no value)
>>         Owner: Nobody
>>    Requestors: felipe@felipegasper.com
>>        Status: new
>>   Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=93716 >
>>
>>
>> [...]
>>
>> When an exception from autodie causes perl to exit(), the exit code
>> should correspond to the value of $! as perl �natively� does as in the
>> first example above.
>>
>>
>> -Felipe Gasper
>> cPanel, Inc.
>>
>
> Hi Felipe,
>
> What version of autodie are you using?  Namely, I suspect that the
> problem would be fixed in autodie 2.21 due to:
>
> """
>          * INTERNAL : $" and $! are no longer arbitrarily messed with
>            for no reason via autodie.  (They're still messed with when
>            using Fatal.)
> """
>
> Which would ensure that "$!" is (still) set to 2 and die should DTRT
> from there.  Previously, $! would be "protected" by a local, causing it
> to be reset to (in your example above) 0.
>

Hm. I was using 2.12. That sounds like it would fix the issue, but I 
tried updating my laptop�s autodie version to 2.22, to no avail:

felipe@Macintosh-19 14:25:15 /
 > perl -Mautodie -e'print $autodie::VERSION'
2.22
OK
felipe@Macintosh-19 14:26:53 /
 > cat | perl -Mautodie
`perl -Mautodie -e'open FH, "<", "yglzdfvxbfg"'`;
print ($? >> 8) . $/;
Can't open 'yglzdfvxbfg' for reading: 'No such file or directory' at -e 
line 1
255

-F


From toddr@cpan.org on 2020-01-08 15:48:53
:

Current Behavior:

$>perl -Ilib -Mautodie -e'open FH, "<", "qweqweqerwr"; print "Should not reach here\n"'; echo $?
Can't open 'qweqweqerwr' for reading: 'No such file or directory' at -e line 1
255

Felipe believes it should ext 2: "Normally Perl uses $! as the exit value when an exception ends the program."

#> perl -e'open FH, "<", "qweqweqerwr" or die'; echo $?
Died at -e line 1.
2



Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant