Bug 429531
Summary: | perl incorrect calculation | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | [Fedora] Fedora | Reporter: | Need Real Name <mal> | ||||||
Component: | perl | Assignee: | Marcela Mašláňová <mmaslano> | ||||||
Status: | CLOSED NOTABUG | QA Contact: | Fedora Extras Quality Assurance <extras-qa> | ||||||
Severity: | low | Docs Contact: | |||||||
Priority: | low | ||||||||
Version: | 8 | CC: | jpazdziora, kasal, perl-devel, rc040203, tcallawa | ||||||
Target Milestone: | --- | Keywords: | Reopened | ||||||
Target Release: | --- | ||||||||
Hardware: | All | ||||||||
OS: | Linux | ||||||||
Whiteboard: | |||||||||
Fixed In Version: | perl-5.8.8-33.fc8 | Doc Type: | Bug Fix | ||||||
Doc Text: | Story Points: | --- | |||||||
Clone Of: | Environment: | ||||||||
Last Closed: | 2008-03-13 13:58:08 UTC | Type: | --- | ||||||
Regression: | --- | Mount Type: | --- | ||||||
Documentation: | --- | CRM: | |||||||
Verified Versions: | Category: | --- | |||||||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||||
Cloudforms Team: | --- | Target Upstream Version: | |||||||
Embargoed: | |||||||||
Attachments: |
|
Description
Need Real Name
2008-01-21 12:41:29 UTC
Created attachment 292361 [details]
test program
perl -w test.pl
then comment
my($tmpbname)=$a=~m@<DATA>([^<>]*)@isg;
and uncomment
my $x=$a;
my($tmpbname)=$x=~m@<DATA>([^<>]*)@isg;
and perl -w test.pl
again
Created attachment 292362 [details]
simplified test
output 1
my($tmpbname)=$a=~m@<DATA>([^<>]*)@isg;
Use of uninitialized value in concatenation (.) or string at test2.pl line 28.
TBN= A=<DATA>J1</END>
Use of uninitialized value in concatenation (.) or string at test2.pl line 28.
TBN= A=<DATA>J2</END>
Use of uninitialized value in concatenation (.) or string at test2.pl line 28.
TBN= A=<DATA>J3</END>
Use of uninitialized value in concatenation (.) or string at test2.pl line 28.
TBN= A=<DATA>J4</END>
Use of uninitialized value in concatenation (.) or string at test2.pl line 28.
TBN= A=<DATA>J5</END>
output 2
my $x=$a;
my($tmpbname)=$x=~m@<DATA>([^<>]*)@isg;
TBN=J1 A=<DATA>J1</END>
TBN=J2 A=<DATA>J2</END>
TBN=J3 A=<DATA>J3</END>
TBN=J4 A=<DATA>J4</END>
TBN=J5 A=<DATA>J5</END>
The test program from comment 2 works on on Fedora 8 with $ rpm -q perl perl-5.8.8-33.fc8.x86_64 Proposing to close with CURRENTRELEASE. On F7 it does not produce correct output. I did not try yet on F8. # rpm -q perl perl-5.8.8-28.fc7 # perl -w test2.pl Use of uninitialized value in concatenation (.) or string at attachment.cgi line 28. TBN= A=<DATA>J1</END> Use of uninitialized value in concatenation (.) or string at attachment.cgi line 28. TBN= A=<DATA>J2</END> Use of uninitialized value in concatenation (.) or string at attachment.cgi line 28. TBN= A=<DATA>J3</END> Use of uninitialized value in concatenation (.) or string at attachment.cgi line 28. TBN= A=<DATA>J4</END> Use of uninitialized value in concatenation (.) or string at attachment.cgi line 28. TBN= A=<DATA>J5</END> The probles IS NOT FIXED IN rpm -q perl perl-5.8.8-33.fc8 # perl -w test2.pl Use of uninitialized value in concatenation (.) or string at attachment.cgi line 28. TBN= A=<DATA>J1</END> Use of uninitialized value in concatenation (.) or string at attachment.cgi line 28. TBN= A=<DATA>J2</END> Use of uninitialized value in concatenation (.) or string at attachment.cgi line 28. TBN= A=<DATA>J3</END> Use of uninitialized value in concatenation (.) or string at attachment.cgi line 28. TBN= A=<DATA>J4</END> Use of uninitialized value in concatenation (.) or string at attachment.cgi line 28. TBN= A=<DATA>J5</END> The output IS INCORRECT (In reply to comment #5) > The probles IS NOT FIXED IN > rpm -q perl > perl-5.8.8-33.fc8 > > # perl -w test2.pl > Use of uninitialized value in concatenation (.) or string at attachment.cgi line 28. > TBN= A=<DATA>J1</END> > Use of uninitialized value in concatenation (.) or string at attachment.cgi line 28. > TBN= A=<DATA>J2</END> > Use of uninitialized value in concatenation (.) or string at attachment.cgi line 28. > TBN= A=<DATA>J3</END> > Use of uninitialized value in concatenation (.) or string at attachment.cgi line 28. > TBN= A=<DATA>J4</END> > Use of uninitialized value in concatenation (.) or string at attachment.cgi line 28. > TBN= A=<DATA>J5</END> > > The output IS INCORRECT Hmm, I missed that -w -- we really should have use warnings in the source file. By the way, how come that the warning message talks about attachment.cgi when you run perl on test2.pl. BTW, I've reproduced the problem on 5.8.5 and also on perl-5.8.0-88.7 in RHEL 3. >By the way, how come that the warning message talks about attachment.cgi when you run perl on test2.pl. It is copy/paste error of the first line. The file with the perl program is attachment.cgi - the one called "simplified test" attached to this report: https://bugzilla.redhat.com/attachment.cgi?id=292362 The correct output, when I comment the line # my($tmpbname)=$a=~m@<DATA>([^<>]*)@isg; and uncomment the lines my $x=$a; my($tmpbname)=$x=~m@<DATA>([^<>]*)@isg; should be this: #perl -w attachment.cgi TBN=J1 A=<DATA>J1</END> TBN=J2 A=<DATA>J2</END> TBN=J3 A=<DATA>J3</END> TBN=J4 A=<DATA>J4</END> TBN=J5 A=<DATA>J5</END> The difference is the TBN= one of strings J1,J2,J3,J4,J5 while with the another code it produces TBN= value of undef same problem with perl-5.8.8-36.fc8 # rpm -q perl ; perl -w attachment.cgi perl-5.8.8-36.fc8 Use of uninitialized value in concatenation (.) or string at attachment.cgi line 28. TBN= A=<DATA>J1</END> Use of uninitialized value in concatenation (.) or string at attachment.cgi line 28. TBN= A=<DATA>J2</END> Use of uninitialized value in concatenation (.) or string at attachment.cgi line 28. TBN= A=<DATA>J3</END> Use of uninitialized value in concatenation (.) or string at attachment.cgi line 28. TBN= A=<DATA>J4</END> Use of uninitialized value in concatenation (.) or string at attachment.cgi line 28. TBN= A=<DATA>J5</END> FWIW, the test cases also fail on 5.10.0. We may want to file this upstream. Indeed, when looking at that ticket, I agree with the assessment of the p5p commenter, this "bug" is being caused by the /g. Changing: my($tmpbname)=$a=~m@<DATA>([^<>]*)@isg; to my($tmpbname)=$a=~m@<DATA>([^<>]*)@is; Resolves this issue. Closing as NOTABUG. If the original poster disagrees, I suggest that it be directed at upstream, where the ticket is still open. I just followed the link and read explanations. What I can say. For functions to have a side effect - this happens and sometimes unavoidable. But for OPERATORS to have a side effect is ugly and wrong. But it may be too late to change in perl. Using /g in your scalar-context match in the if() explicitly requests the side effect. If you don't want it, don't do that then. |