Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 9 Jul 2002 10:38:01 -0700 (PDT)
From:      Chet Ramey <chet@po.cwru.edu>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   bin/40386: Parsing problem with /bin/sh
Message-ID:  <200207091738.g69Hc1i0046273@www.freebsd.org>

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

>Number:         40386
>Category:       bin
>Synopsis:       Parsing problem with /bin/sh
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jul 09 10:40:02 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Chet Ramey
>Release:        4.6-RELEASE, 5.0-CURRENT
>Organization:
Case Western Reserve University
>Environment:
FreeBSD quartz.ins.cwru.edu 5.0-CURRENT FreeBSD 5.0-CURRENT #3: Tue Jul  2 09:13:32 EDT 2002     chet@quartz.ins.cwru.edu:/usr/obj/usr/src/sys/CNS-OPTIPLEX  i386

>Description:
     There is a parsing problem with /bin/sh.  The attached script should not work without a backslash at the end of the first line, but sh accepts it nevertheless.

This faulty syntax is used in /usr/libexec/locate.mklocatedb
(/usr/src/usr.bin/locate/locate/mklocatedb.sh).
>How-To-Repeat:
quartz(2)# cat x1
awk '{print 12345}' </dev/null
        || exit 1
quartz(2)# ./sh ./x1
quartz(2)# /bin/bash ./x1
./x1: line 2: syntax error near unexpected token `||'
./x1: line 2: ` || exit 1'


>Fix:
The patch for mklocatedb.sh is obvious; lines 79 and 87.


>Release-Note:
>Audit-Trail:
>Unformatted:

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?200207091738.g69Hc1i0046273>