bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Stopping myself


From: erich . freunberger
Subject: Stopping myself
Date: Mon, 12 May 2003 11:25:43 +0200 (CEST)

Configuration Information [Automatically generated, do not change]:
Machine: alpha
OS: osf1
Compiler: cc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='alpha' 
-DCONF_OSTYPE='osf1' -DCONF_MACHTYPE='alpha-dec-osf1' -DCONF_VENDOR='dec' 
-DSHELL -DHAVE_CONFIG_H   -I.  -I. -I./include -I./lib -I/usr/local/include -g
uname output: OSF1 mank.aui.cpqcorp.net V5.1 1885 alpha
Machine Type: alpha-dec-osf1

Bash Version: 2.05
Patch Level: 0
Release Status: release

Description:
        bash core dumps when executing a script, but only if started by
        an application - not if started interactively.

        it only happens on tru64 unix 5.1a Patchkit 3 and above (also with 
5.1b).

        the output of our application contains:

                reader_loop: bad jump: 14
                Stopping myself...SERVER: SIGNAL <SIGCLD> CAUGHT: 20
                DCS+: ret=134,errno=1,cmd=(wp_dcs 
/appl/wart2/files/spool/203_CAAfjdplN 'auiprnt01' '01AT' '01AT' 1)

        the script is the following:

#!/usr/local/bin/bash

#
#       DCS-Datenfile an DCS-Server schicken
#       Aufruf : wp_dcs <filename> <queue>
#       Parameter 1: DCS-Datenfile
#       Parameter 2: Servername
#       Parameter 3: Druckername
#       Parameter 4: Sharename (Freigabename)
#       Parameter 5: Output Modus: 1..Drucker, 2..PDF-Datei erzeugen, 
3..PCL-Datei erzeigen
#                               (bei 2 und 3 ist Sharename der Dateiname der 
PDF/PCL-Output-Datei)
#

dfile="/tmp/wp_dcs.$$"
LOGX=${DECBANK}/log/wp_dcs.log


PATH=$PATH:/usr/sbin:/sbin
export PATH


if [ $# != 5 ]
then
        echo "Usage: $0 <filename> <servername> <druckername> <sharename> 
<output>"
        echo "Usage: $0 <filename> <servername> <druckername> <sharename> 
<output>" >>$LOGX

        echo "Parameter 1: DCS-Datenfile"
        echo "Parameter 2: Servername"
        echo "Parameter 3: Druckername"
        echo "Parameter 4: Sharename (Freigabename)"
        echo "Parameter 5: Output Modus: 1..Drucker, 2..PDF-Datei erzeugen, 
3..PCL-Datei erzeigen"
        echo "             (bei 2 und 3 ist Sharename der Dateiname der 
PDF/PCL-Output-Datei)"
        exit 1
fi

if [ ! -f $1 ]
then
        echo "File $1 nicht gefunden"
        echo "File $1 nicht gefunden" >>$LOGX
        exit 1
fi

if [ "$CONFIG_FILE" = "" ]
then
        echo "Environment Variable CONFIG_FILE nicht gefunden"
        echo "Environment Variable CONFIG_FILE nicht gefunden" >>$LOGX
        exit 1
fi

. $CONFIG_FILE 1>/dev/null 2>&1 

FILENAME=$1
SERVER_NAME=$2
DRUCKER_NAME=$3
SHARE_NAME=$4
OUTPUT_MODE=$5

# Konvert Servername (PRT001.raibakwt.com -> PRT001)

if [ $OUTPUT_MODE = 1 ]
then
        SERVER_NAME=`echo $SERVER_NAME|sed 's/\..*$//'`
        #IFSSAV=$IFS
        #IFS="."
        #export IFS
        #VAR1=`echo $SERVER_NAME`
        #IFS=" "

        #set `echo $VAR1`
        #SERVER_NAME=$1
        #IFS=$IFSSAV
fi

NTRESULT='WINDRV:"\\'$SERVER_NAME'\'$DRUCKER_NAME'"|'
UNIXRESULT='\\'$SERVER_NAME'\'$SHARE_NAME'|'

if [ $OUTPUT_MODE = 3 ]
then
        FILERESULT='PCL|FILE:"'$SHARE_NAME'"|'
else
        FILERESULT='PDF|FILE:"'$SHARE_NAME'"|'
fi
export NTRESULT UNIXRESULT FILERESULT

echo "------------------------------------------------------------------------" 
>>$LOGX
echo "*** $0 started `date`: $FILENAME" >>$LOGX
echo "DRUCKER: ($SERVER_NAME)/($DRUCKER_NAME|$SHARE_NAME)" >>$LOGX
echo "FILE   : $FILENAME" >>$LOGX
echo "DCSSERVERS=$DCSSERVERS" >>$LOGX

rm -f $dfile
touch $dfile

cp $FILENAME /tmp/hofer.txt



if [ "$DCSSERVERS" != "__UNIX__" ]
then
        for dserver in $DCSSERVERS
        do
                ping -c 1 -q $dserver > /dev/null 2>&1 && echo $dserver >> 
$dfile
        done

        nservers=`cat $dfile | wc -l | sed 's/ *//'`

        if [ "$nservers" == "0" ]
        then
                echo "Keine DCS Server erreichbar."
                echo "Keine DCS Server erreichbar." >>$LOGX
                exit 1
        fi

        case "$nservers" in
                1 )
                        DCSQUEUE="dcs_`cat $dfile`"
                        ;;
                * )
                        index=`date "+%S"`
                        if [ $index = "08" -o $index = "09" ]
                        then
                                # mit "08" und "09" kommt fehler bei bit-befehl
                                index="07"
                        fi
                        let bit="$index % $nservers"+1
                        DCSQUEUE="dcs_`cat $dfile | head -n $bit | tail -n -1`"
                        ;;
        esac

        rm -f $dfile

        echo "*** $0 using DCS queue $DCSQUEUE" >>$LOGX

        if [ $OUTPUT_MODE = 1 ]
        then
                cat $FILENAME | awk 'BEGIN {c=0}
                {
                c += 1;
                if (c == 1)
                  print $0",DEVICE";
                else if (c == 2)
                  print $0 ENVIRON["NTRESULT"];
                else
                  print $0;
                }' | lpr -P $DCSQUEUE
        else
                cat $FILENAME | awk 'BEGIN {c=0}
                {
                c += 1;
                if (c == 1)
                  print $0",QUEUE,DESTINATION";
                else if (c == 2)
                  print $0 ENVIRON["FILERESULT"];
                else
                  print $0;
                }' | lpr -P $DCSQUEUE
        fi
else
        if [ $OUTPUT_MODE = 1 ]
        then
                cat $FILENAME | awk 'BEGIN {c=0}
                {
                c += 1;
                if (c == 1)
                  print $0",DRUCKER";
                else if (c == 2)
                  print $0 ENVIRON["UNIXRESULT"];
                else
                  print $0;
                }' > $dfile

                (
                cd /usr/local/dcs2000
                typeset -i p
                p=`psrinfo|wc -l`-1
                (
                 runon $p dcs2000 /DATA=$dfile /INF=YES /LOG=DEFAULT /OUT=SMBNET
                 rm -f $dfile 
                ) &
                )

        else
                cat $FILENAME | awk 'BEGIN {c=0}
                {
                c += 1;
                if (c == 1)
                  print $0",QUEUE,DESTINATION";
                else if (c == 2)
                  print $0 ENVIRON["FILERESULT"];
                else
                  print $0;
                }' > $dfile

                (
                cd /usr/local/dcs2000
                typeset -i p
                p=`psrinfo|wc -l`-1
                (
                 runon $p dcs2000 /DATA=$dfile /INF=YES /LOG=DEFAULT /OUT=SMBNET
                 rm -f $dfile 
                )
                )
        fi

fi

exit 0

Repeat-By:
        every time the application starts the script with system() the bash
        core dumps

Fix:
        maybe this has something to do with signal handling or child processes.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]