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

Re: [perl #117265] [PATCH] e213661 no warnings 'safesyscalls', fatalnul checks

Thread Previous | Thread Next
From:
Ricardo Signes
Date:
July 6, 2013 23:10
Subject:
Re: [perl #117265] [PATCH] e213661 no warnings 'safesyscalls', fatalnul checks
Message ID:
20130706230952.GG1225@cancer.codesimply.com
* Father Chrysostomos via RT <perlbug-followup@perl.org> [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.)

-- 
rjbs

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About