develooper Front page | perl.perl5.porters | Postings from September 2018

[perl #133505] open() dies for invalid modes, instead of returningundef, as documented

Thread Previous | Thread Next
From:
Tony Cook via RT
Date:
September 11, 2018 06:08
Subject:
[perl #133505] open() dies for invalid modes, instead of returningundef, as documented
Message ID:
rt-4.0.24-31839-1536646067-907.133505-15-0@perl.org
On Mon, 10 Sep 2018 22:38:48 -0700, slaven@rezic.de wrote:
> (Also there's no way to set $! in this case, because no system call is
> executed, so errno is not set at all)

I don't have strong opinions either way with the base issue here, but this statement is incorrect.

There's plenty of code in core that sets errno and hence $! on error without a system call, for example:

 $ perl -le 'print $!; tell(*FOO); print $!'
 
 Bad file descriptor
 $ perl -Wle 'print $!; unlink "abc\0def"; print $!'
 
 Invalid \0 character in pathname for unlink: abc\0def at -e line 1.
 No such file or directory

Tony

---
via perlbug:  queue: perl5 status: open
https://rt.perl.org/Ticket/Display.html?id=133505

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