New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
3-arg open of undef for read #11910
Comments
From @ysthCreated by @ysthopen(FH, "<", undef) triggers special behavior to open a temporary file To keep open(FH, "<", $hash{typoedkey}) from quietly succeeding, this Crude patch from avar in irc: Inline Patchdiff --git a/perlio.c b/perlio.c
index a985dcc..09e415d 100644
--- a/perlio.c
+++ b/perlio.c
@@ -1601,6 +1601,8 @@ PerlIO_openn(pTHX_ const char *layers, const
Perl Info
|
From @avarOn Fri, Jan 27, 2012 at 02:25, Yitzchak Scott-Thoennes
Two points: * That patch is probably in completely the wrong place, it should * With that patch all of perl's tests pass, which means that we have And also: * Did this just slip between the cracks when in-memory file support As a special case the three-argument form with a open(my $tmp, "+>", undef) or die ... opens a filehandle to an anonymous temporary file. Is this used for anything else? * What do we actually get on `open(FH, "<", undef)`? It seems to me |
The RT System itself - Status changed from 'new' to 'open' |
From @nwc10On Thu, Jan 26, 2012 at 05:25:56PM -0800, Yitzchak Scott-Thoennes wrote:
I think that a comprehensive fix should be possible. Note that XS can tell $ ./perl -Ilib -MDevel::Peek -e 'Dump undef' Quite a big difference. And that the case of a simple undefined variable is already spotted: $ ./perl -e 'open $fh, "<", $a or die' So I think that there's something more subtly amis here, probably due to Nicholas Clark |
From zefram@fysh.orgNicholas Clark wrote:
Better to distinguish at compile time. Literal "undef" is a different -zefram |
From @nwc10On Fri, Jan 27, 2012 at 11:02:38AM +0000, Nicholas Clark wrote:
Bother. I suspect I'm not correct here. XS can tell the difference because Nicholas Clark |
From @cpansproutOn Fri Jan 27 03:31:29 2012, zefram@fysh.org wrote:
Please don’t add more special-cased parsing to open(). It’s complex -- Father Chrysostomos |
From @ysthOn Fri, Jan 27, 2012 10:58:00 +0100, Ævar Arnfjörð Bjarmason wrote:
It does open a temporary file, the same as the read-write modes would |
From @ap* Zefram <zefram@fysh.org> [2012-01-27 12:35]:
Does that mean that a wrapper for `open` would have to do this in order defined $name ? $name : undef Ugh. Or would even that not work because that’s an expression more complex Please, no. -- |
From @rjbs* Ævar Arnfjörð Bjarmason <avarab@gmail.com> [2012-01-27T04:58:00]
That's what I would think. -- |
From @davidnicolopening $hash{wrong} makes sense when you don't want to have to |
Migrated from rt.perl.org#109146 (status was 'open')
Searchable as RT109146$
The text was updated successfully, but these errors were encountered: