develooper Front page | perl.perl5.porters | Postings from July 2013

[perl #117265] [PATCH] e213661 no warnings 'safesyscalls', fatal nul checks

Thread Previous | Thread Next
Tony Cook via RT
July 17, 2013 02:12
[perl #117265] [PATCH] e213661 no warnings 'safesyscalls', fatal nul checks
Message ID:
On Sat Jul 06 16:10:49 2013, wrote:
> * Father Chrysostomos via RT <> [2013-06-
> 28T02:56:27]
> > And mine, too.  Just to be clear, in case we misunderstand each
> other,
> > that means no warnings, just a failed system call, which will be
> > detected by the existing error checking code.  (You *do* check the
> > return values of your system calls, right? :-)
> Exactamo.
> Here is the only thing that gives me a little pause:  I check those
> return
> values and say something like:
>   open ... or die "couldn't open <$filename>: $!";
> And if $filename is "foo.txt\0" then the error message is confusing...
> ...but I don't think it would be in practice, because trailing NULs
> are just
> ignored, rather than cause for a ENOENT.  They're used in 2-arg open
> to
> clear up ambiguity with files ending in a pipe, and we can keep
> allowing and
> ignoring them.  In any other case, the error message will contain non-
> nuls
> after the nuls, and we're good.  (In the unlikely event of $realname .
> $nul .
> $zerowidth, well, the programmer will have to debug.)

The warning would help in diagnosing this.

I'm considering the following changes before applying this:

- modify the CHECK_SAFESYSCALLS/CHECK_PATHNAME macros to only check the
path name and optionally warn, rather than hiding the control flow for
the function return (this may need a helper function)

- make the warning off by default, but can be enabled explicitly with
use warnings 'safesyscalls';


via perlbug:  queue: perl5 status: open

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About