Date: Sat, 7 Aug 2004 23:26:30 +0200 (CEST) From: Per Hedeland <per@hedeland.org> To: FreeBSD-gnats-submit@FreeBSD.org Subject: bin/70147: [PATCH] Globbing bug in /bin/sh Message-ID: <200408072126.i77LQU3I078015@pluto.hedeland.org> Resent-Message-ID: <200408072130.i77LUK7x096644@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 70147 >Category: bin >Synopsis: [PATCH] Globbing bug in /bin/sh >Confidential: no >Severity: serious >Priority: high >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sat Aug 07 21:30:20 GMT 2004 >Closed-Date: >Last-Modified: >Originator: Per Hedeland >Release: FreeBSD 5.2-RELEASE i386 >Organization: >Environment: System: FreeBSD pluto.hedeland.org 5.2-RELEASE FreeBSD 5.2-RELEASE #1: Sun Jan 18 13:02:43 CET 2004 per@pluto.hedeland.org:/usr/src/sys/i386/compile/PLUTO i386 >Description: Globbing in /bin/sh fails to match a dangling symlink. I don't know if there is a spec that says that the match should succeed, but this behaviour differs from at least FreeBSD /bin/[t]csh, bash 2.05b (invoked as 'bash' or 'sh'), Solaris 8 /bin/sh and ditto /bin/ksh, and definitely violates the principle of least surprise - i.e. there's no doubt that it should be considered a bug in my opinion. >How-To-Repeat: $ mkdir /tmp/foo $ ln -s baz /tmp/foo/bar $ ls -l /tmp/*/bar ls: /tmp/*/bar: No such file or directory $ >Fix: --- /usr/src/bin/sh/expand.c.ORIG Sun Aug 3 06:28:10 2003 +++ /usr/src/bin/sh/expand.c Sat Aug 7 23:14:13 2004 @@ -1166,7 +1166,7 @@ if (*p == '\0') break; } - if (metaflag == 0 || stat(expdir, &statb) >= 0) + if (metaflag == 0 || lstat(expdir, &statb) >= 0) addfname(expdir); return; } >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200408072126.i77LQU3I078015>