_cygtls::handle_exceptions and segmentation fault while running bash script

pw p.willis@telus.net
Thu Dec 20 00:36:00 GMT 2007


pw: wrote
> An input file mock up script is as follows (tested/works):
> 
> #!/bin/bash
> #mockup_input_files.sh
> 
> mkdir final
> mkdir sunshine
> 
> for FNUM in `seq 1 26`;do
>     OFILE=`echo $FNUM| awk '{print "./final/test_file_" $1 ".final.txt"}'`;
>     echo 
> "HEADER|HEADER|HEADER|HEADER|HEADER|HEADER|HEADER|HEADER|HEADER" > $OFILE
> 
>     for L in `seq 1 992`; do
>         LINE=`echo 9|awk '{for(i=1;i<=$1;i++){printf("%d000", 
> i);if(i<9){printf("|");}} printf("\n");}'`;
>         echo "$LINE" >> $OFILE;
>     done
> done
> 
>  find -type f -iname '*.final.txt' | awk -F "/" '{print $NF 
> "|73.056977|6986" }'>latitudes.txt
> 
> #END OF SCRIPT


This script only produces 9 columns of data. Running the
problem script against this mocked up data didn't cause any
exceptions.

I modified the script as follows to allow easier adjustment of
the number of columns in the mock up input data:

#!/bin/bash

mkdir final
mkdir sunshine

export COLUMNS=16

for FNUM in `seq 1 26`;do
	OFILE=`echo $FNUM| awk '{print "./final/test_file_" $1 ".final.txt"}'`;
	
	LINE=`echo $COLUMNS|awk 
'{for(i=1;i<=$1;i++){printf("HEADER_%d",i);if(i<$1){printf("|");}} 
printf("\n");}'`;
	echo "$LINE" > $OFILE;

	for L in `seq 1 992`; do
		LINE=`echo $COLUMNS|awk 
'{for(i=1;i<=$1;i++){printf("%d000",i);if(i<$1){printf("|");}} 
printf("\n");}'`;
		echo "$LINE" >> $OFILE;
	done
	unix2dos $OFILE;
done
#END OF SCRIPT

Using 9 columns didn't cause an exception or segfault.
I increased the number of columns to 16 and ran the other
problematic script again and again no exception or segfault.
(??) I am wondering if the Windows XP system is actually
violating the stack and not cygwin.


Peter

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list