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
Odd behavior of regex match against in-memory file #11874
Comments
From jwdevel@gmail.comThis is a bug report for perl from jwdevel@gmail.com, When I run the following code, I get 'no' printed out, which is not my $memory_file; This issue is discussed in more detail online: http://stackoverflow.com/questions/8649916/perl-writing-to-a-memory-file-plays-tricks-with-pattern-matching/8650519 Some builds of perl 5.14.1 do not have this issue, others do (see Flags: Site configuration information for perl 5.14.1: Configured by jrw at Wed Sep 14 07:30:00 PDT 2011. Summary of my perl5 (revision 5 version 14 subversion 1) configuration: Platform: Locally applied patches: @INC for perl 5.14.1: Environment for perl 5.14.1: |
From @jkeenanOn Mon Jan 16 17:09:30 2012, jwdevel@gmail.com wrote:
My results: Darwin/PPC, Perl 5.14.2: yes Since Darwin/PPC is bigendian (per my Parrot %PConfig) while Linux/i386 Thank you very much. |
The RT System itself - Status changed from 'new' to 'open' |
From @cpansproutOn Mon Jan 16 18:16:49 2012, jkeenan wrote:
I get yes on little-endian darwin. -- Father Chrysostomos |
From @TuxOn Mon, 16 Jan 2012 20:25:10 -0800, "Father Chrysostomos via RT"
It is not *just* the endianness: --8<--- perl-5.12.2 on hpux 11.31 IA64.ARCHREV_0-LP64-ld (cc) : no And all perls on one box. Note the 5.13.1 result perl-5.6.0 on linux 2.6.31.12-0.2-default i686-linux-64int (cc) : yes -- |
From PeterCMartini@GMail.comOn Mon, Jan 16, 2012 at 9:16 PM, James E Keenan via RT
Curious: while "abc" gets me a "no", "abcd" gets me a yes! |
From Eirik-Berg.Hanssen@allverden.noA clue: The regex engine seems to be advancing pos way beyond the end of sidhekin@bluebird[10:08:59]~$ perl -w my $memory_file; if ( $memory_file =~ m#^(?:.(?{ print pos, " $memory_file __END__ Eirik |
From @iabynOn Tue, Jan 17, 2012 at 10:14:19AM +0100, Eirik Berg Hanssen wrote:
Looks like the regex engine isn't coping with a string that isn't my $memory_file; use Devel::Peek; __END__ -- |
From @nwc10On Tue, Jan 17, 2012 at 12:23:35PM +0000, Dave Mitchell wrote:
That's a shame. It would be nice if the regex engine didn't do anything (Still, arguably ill-formed, but it's unlikely that such scalars are going Nicholas Clark |
From @LeontOn Tue, Jan 17, 2012 at 10:14 AM, Eirik Berg Hanssen
Indeed. This is most clearly shown in #73542, which actually causes a Leon |
From 2bfjdsla52kztwejndzdstsxl9athp@gmail.comPatching PerlIO::scalar to supply a terminating NUL is easy, /Bo Lindbergh |
From @cpansproutOn Tue Jan 17 11:20:13 2012, 2bfjdsla52kztwejndzdstsxl9athp@gmail.com wrote:
XS::APItest, perhaps? -- Father Chrysostomos |
From @khwilliamsonOn 01/17/2012 05:36 AM, Nicholas Clark wrote:
A quick and dirty fix to the regex engine would be to redefine the BTW running valgrind on the sample program shows |
From @nwc10On Tue, Jan 17, 2012 at 12:50:25PM -0800, Father Chrysostomos via RT wrote:
It *might* be easier to parse the output of Devel::Peek. As for Dave's earlier example, without his annotation: $ perl use Devel::Peek; __END__ it should match qr/^ *PV = ".*"\\0$/ I don't think that there's a way to do this with B. Nicholas Clark |
From @ikegamiOn Wed, Jan 18, 2012 at 7:51 AM, Nicholas Clark <nick@ccl4.org> wrote:
use B qw( svref_2object ); sub has_trailing_nul(\$) { my $cur = $sv->CUR; my my $x = "abc"; - Eric |
From @ikegamiUsing the code from my last message, my $x = "abc"; open (my $fh, '>', \my say has_trailing_nul($memory_file) ?1:0; # 0 - Eric |
From @cpansproutOn Wed Jan 18 13:27:59 2012, ikegami@adaelis.com wrote:
Well, no *documented* way.
Interesting. I searched for those in B’s docs, but didn’t find them, I’ve documented them in commit 5c14042. -- Father Chrysostomos |
From @cpansproutOn Tue Jan 17 11:20:13 2012, 2bfjdsla52kztwejndzdstsxl9athp@gmail.com wrote:
Thank you. Applied as 8af8844. -- Father Chrysostomos |
@cpansprout - Status changed from 'open' to 'resolved' |
From @cpansproutOn Wed Jan 18 13:27:59 2012, ikegami@adaelis.com wrote:
Thank you. I’ve added your function to ext/PerlIO-scalar/t/scalar.t -- Father Chrysostomos |
Migrated from rt.perl.org#108398 (status was 'resolved')
Searchable as RT108398$
The text was updated successfully, but these errors were encountered: