From Bugzilla Helper: User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.1) Gecko/20021201 Description of problem: Perl segfaults when given the script below. Whatever is happening is quite strange 'cos it depends on the "split(...)" line, which shouldn't have any interesting side effects. 22:45:graves 153% cat test.pl #!/usr/bin/perl format = ^<<<<<< $blah . %test = (1 => 2); foreach $blah (keys %test) { split(/\n/, $test{$data}); write; } 22:45:graves 154% perl test.pl 1 Segmentation fault (core dumped) Version-Release number of selected component (if applicable): How reproducible: Always Steps to Reproduce: 1.Try the above script. Actual Results: As shown. Expected Results: 22:48:gonzo 12% perl test.pl 1 Additional info: This test script does something similar to the rdistcf.pl script which is used to sumarise rdist output.The version of perl we have is 22:48:graves 156% rpm -q perl perl-5.8.0-55 it worked OK with the privious version. As a workaround you can do "$blah .= '';" as the first statement in the foreach loop!
Hello, I am seeing similar behavior with perl-5.8.0-88. However, the description states the problem is related to the split command. I ran the test script and got the segmentation fault. I commented out the split command and still got the segmentation fault, so I'm not sure if split is related to the problem or not. The script that I have, that has worked on previous versions, also segmentation faults. It appears, however, that the problem is with the write command. My script is formatting text for a report. Where multiple lines are displayed for a variable, the write command appears to miss the end of the string and keep going into undefined memory. I was able to reformat the variable using an sprintf and force the size of the variable to be greater than the maximum the write command would output. This stopped the segmentation fault. Even with the padded variable, the write command woudl still not format the text correctly. It appears to miss word breaks and it is splitting lines incorrectly. Oddly enough, the same script run on the same version of Perl (5.8.0), but on a Sun Solaris 9 system, does not segmentation fault and produces the correct output. Below is my test script, sample data that it formats, output from the RedHat system and output from the Sun system. ------------------- Perl Script ------------------ #!/usr/bin/perl format STDOUT_TOP= DAILY OPERATIONS LOG DATE @|||||||| PAGE @>>>$dt,$FORMAT_PAGE_NUMBER ================================================================================ . format STDOUT = @<<<<<<<< @<<<<< ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< @<<< @<<< @<<< $dt,$tm,$ac,$su,$op1,$op2 ~ ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $ac ~ ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $ac ~ ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $ac ~ ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $ac ~ ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $ac ~ ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $ac ~ ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $ac ~ ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $ac ~ ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $ac ~ ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $ac ~ ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $ac ~ ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $ac ~ ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $ac ~ ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $ac ~ ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $ac ~ ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $ac ~ ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $ac ~ ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $ac ________________________________________________________________________________ . #Open the file. open (INPUT, "log2.dat") || die "Could not open data file: $!\n"; #Start reading form the file. while ($inline = <INPUT>) { chomp ($inline); next if $inline == ""; ($dt,$tm,$su,$op1,$op2,$ac) = split (/\|/, $inline, 6); write; } #close the file close (INPUT); exit (0); -------------------- log2.dat data file (one entry per line) ----------------- 08/11/03|0000|JMM|TFF|RAP|ALL XXXX XXX XXXX SYSTEMS ARE AVAILABLE TO USERS. 08/11/03|0001|JMM|TFF|RAP|Started level 0 backups on WWW. 08/11/03|0100|JMM|TFF|RAP|ALL XXXX XXX XXXX SYSTEMS ARE AVAILABLE TO USERS. 08/11/03|0132|JMM|TFF|RAP|Completed Level 0 backups on WWW. 08/11/03|0200|JMM|TFF|RAP|ALL XXXX XXX XXXX SYSTEMS ARE AVAILABLE TO USERS. 08/11/03|0300|JMM|TFF|RAP|ALL XXXX XXX XXXX SYSTEMS ARE AVAILABLE TO USERS. 08/11/03|0400|JMM|TFF|RAP|ALL XXXX XXX XXXX SYSTEMS ARE AVAILABLE TO USERS. 08/11/03|0500|JMM|TFF|RAP|ALL XXXX XXX XXXX SYSTEMS ARE AVAILABLE TO USERS. 08/11/03|0600|JMM|TFF|RAP|ALL XXXX XXX XXXX SYSTEMS ARE AVAILABLE TO USERS. 08/11/03|0700|BMC|JRV|BR|ALL XXXX XXX XXXX SYSTEMS ARE AVAILABLE TO USERS. 08/11/03|0800|BMC|JRV|BR|ALL XXXX XXX XXXX SYSTEMS ARE AVAILABLE TO USERS. 08/11/03|0805|BMC|JRV|BR|XXXXX, XXXXXXX and XXXXXXX 100% idle from 0000 - 0800 is 0 minutes. 08/11/03|0850|BMC|JRV|BR|XXX XXXXX (X. XXXXXX/X. XXXXXXXX) arrived to do daily checks in 800 Ton Chiller Farm. 08/11/03|0858|BMC|JRV|BR|XXX XXXX. completed daily checks and departed area. 08/11/03|0900|BMC|JRV|BR|ALL XXXX XXX XXXX SYSTEMS ARE AVAILABLE TO USERS. 08/11/03|0940|BMC|JRV|BR|XXX XXXX X. XXXXX and XXX XX X. XXXXXXXX investigating SSA1 DISK OPERATION - RESOURCE UNAVAILABLE error messages on XXXXXXXXX Frame 23 & 24 Partition 1. 08/11/03|1000|BMC|JRV|BR|ALL XXXX XXX XXXX SYSTEMS ARE AVAILABLE TO USERS. 08/11/03|1010|BMC|JRV|BR|XXX XXXX X. XXXXX and XXX XX X. XXXXXXXX replaced SSA1 disk on XXXXXXXXX Frame 23 & 24 Partition 1. Frames available for use. 08/11/03|1100|BMC|JRV|BR|ALL XXXX XXX XXXX SYSTEMS ARE AVAILABLE TO USERS. 08/11/03|1200|BMC|JRV|BR|ALL XXXX XXX XXXX SYSTEMS ARE AVAILABLE TO USERS. 08/11/03|1300|BMC|JRV|BR|ALL XXXX XXX XXXX SYSTEMS ARE AVAILABLE TO USERS. 08/11/03|1400|BMC|JRV|BR|ALL XXXX XXX XXXX SYSTEMS ARE AVAILABLE TO USERS. 08/11/03|1500|CRB|MJW|HE|ALL XXXX XXX XXXX SYSTEMS ARE AVAILABLE TO USERS. 08/11/03|1600|CRB|MJW|HE|ALL XXXX XXX XXXX SYSTEMS ARE AVAILABLE TO USERS. 08/11/03|1605|CRB|MJW|HE|XXXXX, XXXXXXX and XXXXXXX 100% idle from 0800 - 1600 is 0 minutes. 08/11/03|1700|CRB|MJW|HE|ALL XXXX XXX XXXX SYSTEMS ARE AVAILABLE TO USERS. 08/11/03|1800|CRB|MJW|HE|ALL XXXX XXX XXXX SYSTEMS ARE AVAILABLE TO USERS. 08/11/03|1900|CRB|MJW|HE|ALL XXXX XXX XXXX SYSTEMS ARE AVAILABLE TO USERS. 08/11/03|2000|CRB|MJW|HE|ALL XXXX XXX XXXX SYSTEMS ARE AVAILABLE TO USERS. 08/11/03|2100|CRB|MJW|HE|ALL XXXX XXX XXXX SYSTEMS ARE AVAILABLE TO USERS. -------------------------- RedHat output (segmentation fault) -------------- bash-2.05b$ ./t7.pl DAILY OPERATIONS LOG DATE 08/11/03 PAGE ================================================================================ 08/11/03 0000 ALL XXXX XXX XXXX SYSTEMS ARE AVAILABLE JMM TFF RAP TO ________________________________________________________________________________ 08/11/03 0001 Started level 0 backups on WWW. JMM TFF RAP AILABLE TO USERS. STDOUT_TOP :utf8 :utf8 1 Â$ BÂ$ B DAILY OPERATIONS LOG DATE 08/11/03 PAGE ========================== =============================== ======================= a Ã# # BÃ# B  à #Bà #B 0 h ^<<<<<< <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< <<< ) h i ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< <<<<<<<<<< ) ! 0¦ @ f ________________________________________________________________________________ 08/11/03 0100 ALL XXXX XXX XXXX SYSTEMS ARE AVAILABLE JMM TFF RAP TO ________________________________________________________________________________ 08/11/03 0132 Completed Level 0 backups on WWW. JMM TFF RAP <<<<<<< ) ` i ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< <<<<<<<< ) i ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< <<<<<<<< ) ! 0¦ @ f ! 0¦ @ f i ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< TEMS ARE AVAILABLE TO <<<<<<<< ) i ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< <<<<<<<< ) q _________________ _________________________________ ______________________________ ________________________________________________________________________________ 08/11/03 0200 ALL XXXX XXX XXXX SYSTEMS ARE AVAILABLE JMM TFF RAP TO 08/11/03 0300 ALL XXXX XXX XXXX SYSTEMS ARE AVAILABLE JMM TFF RAP TO 08/11/03 0400 ALL XXXX XXX XXXX SYSTEMS ARE AVAILABLE JMM TFF RAP TO Segmentation fault -------------------------- Sun output (correct) ---------------------- DAILY OPERATIONS LOG DATE 08/11/03 PAGE ================================================================================ 08/11/03 0000 ALL XXXX XXX XXXX SYSTEMS ARE AVAILABLE JMM TFF RAP TO USERS. ________________________________________________________________________________ 08/11/03 0001 Started level 0 backups on WWW. JMM TFF RAP________________________________________________________________________________ 08/11/03 0100 ALL XXXX XXX XXXX SYSTEMS ARE AVAILABLE JMM TFF RAP TO USERS. ________________________________________________________________________________ 08/11/03 0132 Completed Level 0 backups on WWW. JMM TFF RAP________________________________________________________________________________ 08/11/03 0200 ALL XXXX XXX XXXX SYSTEMS ARE AVAILABLE JMM TFF RAP TO USERS. ________________________________________________________________________________ 08/11/03 0300 ALL XXXX XXX XXXX SYSTEMS ARE AVAILABLE JMM TFF RAP TO USERS. ________________________________________________________________________________ 08/11/03 0400 ALL XXXX XXX XXXX SYSTEMS ARE AVAILABLE JMM TFF RAP TO USERS. ________________________________________________________________________________ 08/11/03 0500 ALL XXXX XXX XXXX SYSTEMS ARE AVAILABLE JMM TFF RAP TO USERS. ________________________________________________________________________________ 08/11/03 0600 ALL XXXX XXX XXXX SYSTEMS ARE AVAILABLE JMM TFF RAP TO USERS. ________________________________________________________________________________ 08/11/03 0700 ALL XXXX XXX XXXX SYSTEMS ARE AVAILABLE BMC JRV BR TO USERS. ________________________________________________________________________________ 08/11/03 0800 ALL XXXX XXX XXXX SYSTEMS ARE AVAILABLE BMC JRV BR TO USERS. ________________________________________________________________________________ 08/11/03 0805 XXXXX, XXXXXXX and XXXXXXX 100% idle from BMC JRV BR 0000 - 0800 is 0 minutes. ________________________________________________________________________________ 08/11/03 0850 XXX XXXXX (X. XXXXXX/X. XXXXXXXX) arrived BMC JRV BR to do daily checks in 800 Ton Chiller Farm. ________________________________________________________________________________ 08/11/03 0858 XXX XXXX. completed daily checks and BMC JRV BR departed area. ________________________________________________________________________________ DAILY OPERATIONS LOG DATE 08/11/03 PAGE ================================================================================ 08/11/03 0900 ALL XXXX XXX XXXX SYSTEMS ARE AVAILABLE BMC JRV BR TO USERS. ________________________________________________________________________________ 08/11/03 0940 XXX XXXX X. XXXXX and XXX XX X. XXXXXXXX BMC JRV BR investigating SSA1 DISK OPERATION - RESOURCE UNAVAILABLE error messages on XXXXXXXXX Frame 23 & 24 Partition 1. ________________________________________________________________________________ 08/11/03 1000 ALL XXXX XXX XXXX SYSTEMS ARE AVAILABLE BMC JRV BR TO USERS. ________________________________________________________________________________ 08/11/03 1010 XXX XXXX X. XXXXX and XXX XX X. XXXXXXXX BMC JRV BR replaced SSA1 disk on XXXXXXXXX Frame 23 & 24 Partition 1. Frames available for use. ________________________________________________________________________________ 08/11/03 1100 ALL XXXX XXX XXXX SYSTEMS ARE AVAILABLE BMC JRV BR TO USERS. ________________________________________________________________________________ 08/11/03 1200 ALL XXXX XXX XXXX SYSTEMS ARE AVAILABLE BMC JRV BR TO USERS. ________________________________________________________________________________ 08/11/03 1300 ALL XXXX XXX XXXX SYSTEMS ARE AVAILABLE BMC JRV BR TO USERS. ________________________________________________________________________________ 08/11/03 1400 ALL XXXX XXX XXXX SYSTEMS ARE AVAILABLE BMC JRV BR TO USERS. ________________________________________________________________________________ 08/11/03 1500 ALL XXXX XXX XXXX SYSTEMS ARE AVAILABLE CRB MJW HE TO USERS. ________________________________________________________________________________ 08/11/03 1600 ALL XXXX XXX XXXX SYSTEMS ARE AVAILABLE CRB MJW HE TO USERS. ________________________________________________________________________________ 08/11/03 1605 XXXXX, XXXXXXX and XXXXXXX 100% idle from CRB MJW HE 0800 - 1600 is 0 minutes. ________________________________________________________________________________ 08/11/03 1700 ALL XXXX XXX XXXX SYSTEMS ARE AVAILABLE CRB MJW HE TO USERS. ________________________________________________________________________________ DAILY OPERATIONS LOG DATE 08/11/03 PAGE ================================================================================ 08/11/03 1800 ALL XXXX XXX XXXX SYSTEMS ARE AVAILABLE CRB MJW HE TO USERS. ________________________________________________________________________________ 08/11/03 1900 ALL XXXX XXX XXXX SYSTEMS ARE AVAILABLE CRB MJW HE TO USERS. ________________________________________________________________________________ 08/11/03 2000 ALL XXXX XXX XXXX SYSTEMS ARE AVAILABLE CRB MJW HE TO USERS. ________________________________________________________________________________ 08/11/03 2100 ALL XXXX XXX XXXX SYSTEMS ARE AVAILABLE CRB MJW HE TO USERS. ________________________________________________________________________________
the original example breakage seems fixed with the perl in rawhide. can you test there, and/or produce a smaller test case (and please attach as a file, don't paste into a comment). thanks.
Created attachment 93643 [details] Sample perl script & data file to demonstrate write command segfault Sample script and data file that shows the write command segmentation fault.
this works in the perl in rawhide, so it looks like it was fixed upstream