Skip Menu |

This queue is for tickets about the bareword-filehandles CPAN distribution.

Report information
The Basics
Id: 127073
Status: resolved
Priority: 0/
Queue: bareword-filehandles

People
Owner: Nobody in particular
Requestors: chohag [...] jtan.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 0.007



Subject: Somehow, the lack of bareword filehandles causes a -e test to fail
Date: Sat, 8 Sep 2018 16:38:49 -0000
To: bug-bareword-filehandles [...] rt.cpan.org
From: "Matthew King" <chohag [...] jtan.com>
bareword::filehandles causes stacked file test operators to fail. perl is 5.26.1. Script: BEGIN { print "First thing:\n"; -d '/' and print "Everything is a directory\n"; -e -d '/' and print "Fine so far\n"; } use bareword::filehandles; print "\nWith [out] bareword::filehandles:\n"; -d '/' and print "Everything is a directory\n"; -e -d '/' and print "Can't see me!\n"; no bareword::filehandles; print "\nWithout bareword::filehandles:\n"; -d '/' and print "Everything is a directory\n"; -e -d '/' and print "Nothing works now\n"; Output: First thing: Everything is a directory Fine so far With [out] bareword::filehandles: Everything is a directory Without bareword::filehandles: Everything is a directory Matthew
Subject: Re: [rt.cpan.org #127073] Somehow, the lack of bareword filehandles causes a -e test to fail
Date: Sat, 08 Sep 2018 19:17:07 +0100
To: bug-bareword-filehandles [...] rt.cpan.org
From: ilmari [...] ilmari.org (Dagfinn Ilmari Mannsåker)
"chohag@jtan.com via RT" <bug-bareword-filehandles@rt.cpan.org> writes: Show quoted text
> bareword::filehandles causes stacked file test operators to fail. perl is > 5.26.1.
This is because the code that sets the flags on the stacked filetest ops uses `PL_check[kidtype] == Perl_ck_ftst` to see if the child op is another filetest op, so any hooking of the check function breaks that. Looks like I'll just have to disable the protection for filetest ops :( - ilmari -- - Twitter seems more influential [than blogs] in the 'gets reported in the mainstream press' sense at least. - Matt McLeod - That'd be because the content of a tweet is easier to condense down to a mainstream media article. - Calle Dybedahl
Subject: [rt.cpan.org #127073] Somehow, the lack of bareword filehandles causes a -e test to fail
Date: Tue, 21 May 2019 14:20:23 +0000
To: "bug-bareword-filehandles [...] rt.cpan.org" <bug-bareword-filehandles [...] rt.cpan.org>
From: Lukas Mai <Lukas.Mai [...] jochen-schweizer.de>
I just ran into this bug in a bigger application. It was a little annoying to track down because the breakage doesn't respect lexical scoping. Even if some other module elsewhere loads bareword::filehandles, it still breaks stacked file tests in other files. Quick reproducer: % perl -e '{ use bareword::filehandles (); } -d -r "." or die' Died at -e line 1. Given that this breaks (otherwise working) code in quite sneaky ways, I'd much prefer imperfect protection from bareword filehandles if it keeps file tests working. The difference can be seen in the generated optrees: % perl -MO=Concise -e '{ use bareword::filehandles (); } -d -r "." or die' d <@> leave[1 ref] vKP/REFC ->(end) 1 <0> enter ->2 2 <;> nextstate(main 168 -e:1) v:{ ->3 5 <2> leaveloop vK/2 ->6 3 <{> enterloop(next->5 last->5 redo->4) v ->4 4 <0> stub v ->5 6 <;> nextstate(main 168 -e:1) v:{ ->7 - <1> null vK/1 ->d a <|> or(other->b) vK/1 ->d 9 <1> ftdir sK/1 ->a 8 <1> fteread sK/1 ->9 7 <$> const(PV ".") s ->8 c <@> die[t1] vK ->d b <0> pushmark s ->c -e syntax OK What it should be: % perl -MO=Concise -e '{ ; } -d -r "." or die' d <@> leave[1 ref] vKP/REFC ->(end) 1 <0> enter ->2 2 <;> nextstate(main 2 -e:1) v:{ ->3 5 <2> leaveloop vK/2 ->6 3 <{> enterloop(next->5 last->5 redo->4) v ->4 4 <0> stub v ->5 6 <;> nextstate(main 2 -e:1) v:{ ->7 - <1> null vK/1 ->d a <|> or(other->b) vK/1 ->d 9 <1> ftdir sK/FTSTACKED,1 ->a 8 <1> fteread sK/FTSTACKING,1 ->9 7 <$> const(PV ".") s ->8 c <@> die[t1] vK ->d b <0> pushmark s ->c -e syntax OK -- Lukas Mai (Software Developer) Jochen Schweizer Technology Solutions GmbH, München Amtsgericht München, HRB 203111 Geschäftsführer: Lars Brinkmann; Prokurist: Herbert Leitz
Thanks for the report. I've fixed perl core for 5.31.1 (https://perl5.git.perl.org/perl.git/commitdiff/1d31efef7dd4388fd606972e67bda3318e8838fe), but on versions before that I've had to disable checking of the filetest operators (https://github.com/ilmari/bareword-filehandles/commit/29114ca9c2ea9665180c033169c64608d192030d) - ilmari