Bug 78235

Summary: function 'split' affects value of variable '$1' when pattern is being used as a delimiter
Product: [Retired] Red Hat Linux Reporter: Andrey <andreypozdeev>
Component: perlAssignee: Warren Togami <wtogami>
Status: CLOSED CURRENTRELEASE QA Contact: David Lawrence <dkl>
Severity: high Docs Contact:
Priority: medium    
Version: 8.0CC: perl-devel
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: 5.8.5-12.FC3 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2005-05-28 15:32:56 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 Flags
test script
none
test data none

Description Andrey 2002-11-20 14:44:41 UTC
From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0; T312461)

Description of problem:
I tried to match the pattern and the then split up found subpattern by 'split' 
function with pattern as a delimiter.
Function 'split' affects value of variable '$1'. This doesn't take the place on 
Red Hat 7.3 and Windows.


Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1. execute q.pl
	

Actual Results:  MakefileData.result.dat contains '0085\000uilder.h', where 
\000 after 0085 is zero byte

Expected Results:  MakefileData.result.dat should contain 'artsbuilder.h'

Additional info:

if copy value of $1 to another variable after doing pattern match and use that 
varible in 'split' function instead of $1 then all will be correct.
##
....
if ($MakefileData =~ m/\nlibartsbuilder_la_COMPILE_FIRST\s*=\s*(.*)\n/) {
    my @compilefirst = split(/[\s\034]+/, $1); 	# @compilefirst should 
contain 'artsbuilder.h'
    print "compilefirst=@compilefirst\n";	# but contain 0085\000uilder.h, 
where \000 after 0085 is zero byte
...
###

Comment 1 Andrey 2002-11-20 14:47:19 UTC
Created attachment 85667 [details]
test script

Comment 2 Andrey 2002-11-20 14:49:23 UTC
Created attachment 85668 [details]
test data

Comment 3 Warren Togami 2005-05-28 07:29:26 UTC
Can someone test the script & data provided in this report and verify if this is
still an issue?


Comment 4 Ville Skyttä 2005-05-28 15:32:56 UTC
perl-5.8.5-12.FC3 and perl-5.8.6-15 produce the expected results.