bin/146378: sh(1) can't path expand foo/*"/baz" patterns

Peer Stritzinger peer at stritzinger.com
Fri May 7 16:30:07 UTC 2010


>Number:         146378
>Category:       bin
>Synopsis:       sh(1) can't path expand  foo/*"/baz" patterns
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri May 07 16:30:06 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator:     Peer Stritzinger
>Release:        FreeBSD 8.0-RELEASE i386
>Organization:
Dipl.Phys. Peer Stritzinger GmbH
>Environment:
FreeBSD xxx.xxx.xxx 8.0-RELEASE FreeBSD 8.0-RELEASE #0: Sat Nov 21 15:48:17 UTC 2009     root at almeida.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  i386
>Description:
sh(1) does not path expand correctly if the combination *"/ appears in the path.

Paths like foo/*/"baz"  work and also path like fo*"bar".  Also "foo/"*/baz works.

But not paths like foo/*"/baz"

This occurs e.g. in the configure scripts of the latest rtems embedded operating system, this was seen "in the wild":

for bsp_cfgs in `ls "$srcdir/$RTEMS_TOPdir/c/src/lib/libbsp/$RTEMS_CPU/"*"/make/custom/$1.cfg" 2>/dev/null`; do

When the port in the ports collection is updated this problem might arise.

I tested this also under other BSDis systems especially an older version of FreeBSD:

FreeBSD 6.1-RELEASE-p3 i386 -> works
OpenBSD 4.2 i386 -> works


>How-To-Repeat:
in an empty directory:

Preparation:

$ mkdir -p foo/bar/baz

Test using /bin/sh:

$ echo foo/*"/baz"
foo/*/baz

-> correct would be the output foo/bar/baz


>Fix:


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


More information about the freebsd-bugs mailing list