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

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

Thread Next
From:
slaven@rezic.de via RT
Date:
September 11, 2018 07:03
Subject:
[perl #133505] open() dies for invalid modes, instead of returningundef, as documented
Message ID:
rt-4.0.24-22218-1536649385-1000.133505-15-0@perl.org
Dana Mon, 10 Sep 2018 23:07:47 -0700, tonyc reče:
> 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

So I stand corrected. In this case the equivalent would be to set $! to something like EINVAL. But probably not needed, we already have the exception.


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

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