Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 15 Feb 2003 21:23:48 +0000
From:      "How Can ThisBe" <howcanthisbe300@hotmail.com>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   bin/48318: Segmentation fault in sh with attached script
Message-ID:  <F114T5jR7oZvo0GRF4j00035ddb@hotmail.com>

next in thread | raw e-mail | index | archive | help

>Number:         48318
>Category:       bin
>Synopsis:       Segmentation fault in sh with attached script
>Confidential:   yes
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Feb 15 13:30:06 PST 2003
>Closed-Date:
>Last-Modified:
>Originator:     tigger
>Release:        FreeBSD 5.0-RELEASE-p1 i386
>Organization:
Confidential:  no Synopsis:      Segmentation fault in sh 
>Environment:
System: FreeBSD piglet.l--v--l.net 5.0-RELEASE-p1 FreeBSD 5.0-RELEASE-p1 #0:
Tue Feb 4 23:45:23 CET 2003 
tigger@piglet.l--v--l.net:/usr/obj/usr/src/sys/PIGLET i386

>Description:
I was working a simple sh script when I was suprised that I was able to
produce a Segmentation fault (core dumped) crash of /bin/sh

>How-To-Repeat:
The following script will repeat the crash on my system every time with
the following command line

sh $0 -Drv
-- start script --
#!/bin/sh
while getopts ":Ddhrv:" COMMAND_LINE_ARGUMENT
do
        case "${COMMAND_LINE_ARGUMENT}" in
                D)
                        d="YES"
                        f="NO" ;;
                d)
                        shift 1
                        d="YES" ;;
                h)
                        shift 1
                        h="YES" ;;
                r)
                        shift 1
                        r="YES" ;;
                v)
                        shift 1
                        v="v" ;;
        esac
done
exit 0
-- end script --

Commenting out the 'shift 1' on the -r will prevent the crash - strange.
There is a good chance that my syntax is wrong, but I'm teaching my self
:]

>Fix:

Comment out the 'shift 1' on the -r section, not sure why that prevents
the crash


_________________________________________________________________
Hotmail now available on Australian mobile phones. Go to  
http://ninemsn.com.au/mobilecentral/hotmail_mobile.asp

>Release-Note:
>Audit-Trail:
>Unformatted:
 >with attached script

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?F114T5jR7oZvo0GRF4j00035ddb>