Perl regex weirdness and memory corruption?

S

svetlana.strunjas

I'm having a problem with Perl 5.8.0 on Linux and a regular expression
that should work. I think there is memory corruption going on
somewhere
From the debugger:
print $safewps;
gives me:
entity#n#1

print $safewps =~ /^([^\s])/;
gives me back 'e' which is expected.

However, print $safewps =~ /^([^\s]*)/;
gives me back nothing.

Moreoever, if I assign $foo = "entity#n#1" and then try the regex's on
$foo, they work as expected. (The first one returns 'e', and the
second one returns 'entity#n#1').
Even stranger, if I try print ($foo eq $safewps) I get back 1, so they
are equal. The length of $foo and $safewps are both equal to 10, so
there are no control or space characters in there. Also, $safewps =~
/^([^\f\t\r\r ]*)/ works.


How can I debug this problem? If it's a memory error, how do I find
it?

Thank you,

~Svetlana
 
G

Gunnar Hjalmarsson

I'm having a problem with Perl 5.8.0 on Linux and a regular expression
that should work. I think there is memory corruption going on
somewhere
From the debugger:
print $safewps;
gives me:
entity#n#1

print $safewps =~ /^([^\s])/;
gives me back 'e' which is expected.

However, print $safewps =~ /^([^\s]*)/;
gives me back nothing.

Not surprisingly, it works for me.
How can I debug this problem?

Are you using strictures and warnings?

If you want help here, please post a short but *complete* program that
gives the claimed result.
 
S

svetlana.strunjas

I'll try to create a complete program example -- right now there are a
lot of dependencies and the code would be too large to post.

However, I did turn on all the strictures & warnings -- and tainting.
When I turned on taint checks with -T, the program worked fine!!
Without the taint checks, the program behaves strangely (as described
in my post above).

Before I post the source, does anyone have a inkling why a program
would behave differently with taint checks vs. without taint checks?
This seems like one of those memory corruption Heisenbugs to me....

Thanks in advance,

~Svetlana
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top