From owner-freebsd-bugs@FreeBSD.ORG Sat Aug 7 21:30:21 2004 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 33ED916A4CF for ; Sat, 7 Aug 2004 21:30:21 +0000 (GMT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0AAA943D46 for ; Sat, 7 Aug 2004 21:30:21 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.11/8.12.11) with ESMTP id i77LUKZ4096645 for ; Sat, 7 Aug 2004 21:30:20 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.11/8.12.11/Submit) id i77LUK7x096644; Sat, 7 Aug 2004 21:30:20 GMT (envelope-from gnats) Resent-Date: Sat, 7 Aug 2004 21:30:20 GMT Resent-Message-Id: <200408072130.i77LUK7x096644@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Per Hedeland Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5FD4916A4CE for ; Sat, 7 Aug 2004 21:26:33 +0000 (GMT) Received: from pluto.hedeland.org (1-1-1-13a.mal.sth.bostream.se [82.182.84.27]) by mx1.FreeBSD.org (Postfix) with ESMTP id 50BC443D1D for ; Sat, 7 Aug 2004 21:26:32 +0000 (GMT) (envelope-from per@hedeland.org) Received: from pluto.hedeland.org (localhost [127.0.0.1]) by pluto.hedeland.org (8.13.0/8.13.0) with ESMTP id i77LQUQa078016 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Sat, 7 Aug 2004 23:26:30 +0200 (CEST) Received: (from per@localhost) by pluto.hedeland.org (8.13.0/8.13.0/Submit) id i77LQU3I078015; Sat, 7 Aug 2004 23:26:30 +0200 (CEST) Message-Id: <200408072126.i77LQU3I078015@pluto.hedeland.org> Date: Sat, 7 Aug 2004 23:26:30 +0200 (CEST) From: Per Hedeland To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: bin/70147: [PATCH] Globbing bug in /bin/sh X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Per Hedeland List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Aug 2004 21:30:21 -0000 >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: