From owner-freebsd-bugs Fri Nov 24 11:20:06 1995 Return-Path: owner-bugs Received: (from root@localhost) by freefall.freebsd.org (8.6.12/8.6.6) id LAA14679 for bugs-outgoing; Fri, 24 Nov 1995 11:20:06 -0800 Received: (from gnats@localhost) by freefall.freebsd.org (8.6.12/8.6.6) id LAA14640 ; Fri, 24 Nov 1995 11:20:02 -0800 Resent-Date: Fri, 24 Nov 1995 11:20:02 -0800 Resent-Message-Id: <199511241920.LAA14640@freefall.freebsd.org> Resent-From: gnats (GNATS Management) Resent-To: freebsd-bugs Resent-Reply-To: FreeBSD-gnats@freefall.FreeBSD.org, norm@frosty.cs.ubc.ca Received: from frosty.cs.ubc.ca (frosty.cs.ubc.ca [142.103.10.53]) by freefall.freebsd.org (8.6.12/8.6.6) with ESMTP id LAA14287 for ; Fri, 24 Nov 1995 11:14:05 -0800 Received: (from norm@localhost) by frosty.cs.ubc.ca (8.6.11/8.6.9) id LAA10827; Fri, 24 Nov 1995 11:15:11 -0800 Message-Id: <199511241915.LAA10827@frosty.cs.ubc.ca> Date: Fri, 24 Nov 1995 11:15:11 -0800 From: Norm Hutchinson Reply-To: norm@frosty.cs.ubc.ca To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.2 Subject: bin/837: test -h evaluates to false on symlink to nonexistant file Sender: owner-bugs@freebsd.org Precedence: bulk >Number: 837 >Category: bin >Synopsis: test -h evaluates to false on symlink to nonexistant file >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri Nov 24 11:20:01 PST 1995 >Last-Modified: >Originator: Norm Hutchinson >Organization: UBC Computer Science >Release: FreeBSD 2.0-BUILT-19950603 i386 >Environment: N/A >Description: /bin/test -h foo evaluates to false if foo is a symlink that points to a file that does not exist. The test script in /src/bin/test/TEST.csh doesn't check this case. >How-To-Repeat: ln -s /dev/null/nonexistant foo /bin/test -h foo echo $status The result is 1, but should be 0 since foo is a symlink >Fix: Patch for /src/bin/test/test.c and TEST.csh diff -c test/TEST.csh mtest/TEST.csh *** test/TEST.csh Fri Sep 23 19:59:11 1994 --- mtest/TEST.csh Fri Nov 24 09:46:29 1995 *************** *** 86,91 **** --- 87,105 ---- t -z "" echo 't -z "foo"' t -z "foo" + + echo 't -h link to nonexistant file' + ln -s nonexistant foo + t -h "foo" + rm foo + echo 't -h link to existant file' + ln -s test.c foo + t -h "foo" + rm foo + echo 't -h noexist' + t -h noexist + echo 't -h test.c' + t -h test.c echo 't "foo"' t "foo" diff -c test/test.c mtest/test.c *** test/test.c Mon May 29 17:07:29 1995 --- mtest/test.c Fri Nov 24 09:38:32 1995 *************** *** 388,394 **** goto filetype; case ISSYMLINK: i = S_IFLNK; ! (void)lstat(sp->u.string, &fs->stat); goto filetype; case ISFIFO: i = S_IFIFO; --- 388,394 ---- goto filetype; case ISSYMLINK: i = S_IFLNK; ! fs->rcode = lstat(sp->u.string, &fs->stat); goto filetype; case ISFIFO: i = S_IFIFO; >Audit-Trail: >Unformatted: