perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Torsten Förtsch <torsten.foert...@gmx.net>
Subject Re: Unsuccessful stat on filename containing newline in RegistryCooker.pm
Date Thu, 28 Feb 2013 10:59:51 GMT
On 02/14/2013 02:39 AM, Michael A. Capone wrote:
> [Wed Feb 13 16:27:33 2013] [error] [client 192.168.254.21] Unsuccessful
> stat on filename containing newline at
> /usr/local/lib64/perl5/ModPerl/RegistryCooker.pm line 787.\n
> 
> ... which in turn results in a 500 Server Error.

The culprit here is only partly modperl. Line 787 reads

  stat ...

This is the plain perl stat function. Nothing to do with modperl.

The reason why it throws an exception is line 26 which reads:

  use warnings FATAL => 'all';

See:

$ perl -le 'stat "fritz\r\n"; print "no exception"'
no exception

$ perl -Mwarnings -le 'stat "fritz\r\n"; print "no exception"'
Unsuccessful stat on filename containing newline at -e line 1.
no exception

$ perl -Mwarnings=FATAL,all -le 'stat "fritz\r\n"; print "no exception"'
Unsuccessful stat on filename containing newline at -e line 1.



Only the last one dies. Perl itself explains:

$ perl -Mdiagnostics -Mwarnings=FATAL,all \
       -le 'stat "fritz\r\n"; print "no exception"'
Unsuccessful stat on filename containing newline at -e line 1 (#1)
    (W newline) A file operation was attempted on a filename, and that
    operation failed, PROBABLY because the filename contained a newline,
    PROBABLY because you forgot to chomp() it off.  See perlfunc/chomp.

Uncaught exception from user code:
        Unsuccessful stat on filename containing newline at -e line 1.
 at -e line 1



It also shows a way how to prevent it:

$ perl -Mwarnings=FATAL,all \
       -le '{no warnings "newline"; stat "fritz\r\n";}
            print "no exception"'
no exception



I agree with you that the behavior is unexpected. Also, the XXX comment
in line 783 points out that my_finfo() is a temporary solution. So,
perhaps it would be best to use APR::Finfo here. If family allows it
I'll fix it over the weekend.

Torsten

Mime
View raw message