Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 18 Oct 1997 00:10:11 -0700 (PDT)
From:      dan@math.berkeley.edu
To:        freebsd-gnats-submit@FreeBSD.ORG
Subject:   bin/4795: glitch in /bin/sh cd command
Message-ID:  <199710180710.AAA01895@hub.freebsd.org>
Resent-Message-ID: <199710180720.AAA02260@hub.freebsd.org>

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

>Number:         4795
>Category:       bin
>Synopsis:       glitch in /bin/sh cd command
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Oct 18 00:20:01 PDT 1997
>Last-Modified:
>Originator:     Daniel R. Strick
>Organization:
U.C. Berkeley
>Release:        2.2-970930-RELENG
>Environment:
FreeBSD miwok.berkeley.edu 2.2-970930-RELENG FreeBSD 2.2-970930-RELENG #0: Sun Oct  5 01:29:45 GMT 1997     root@miwok.berkeley.edu:/usr/src/sys/compile/MIWOK  i386

>Description:
The cd command built into /bin/sh breaks if the shell cannot determine
the path leading to the current working directory.  This bug can be
really nasty because it doesn't teminate the current command, causing
shell scripts to run in the wrong directory.

Example:

miwok% cd /tmp
miwok% mkdir -p topdir topdir/middir topdir/middir/botdir
miwok% chmod 111 topdir
miwok% cd topdir/middir
miwok% ls -ls
total 1
1 drwxr-xr-x  2 dan  bin  512 Oct 17 23:57 botdir
miwok% sh
sh: cannot determine working directory
$ ls -ls
total 1
1 drwxr-xr-x  2 dan  bin  512 Oct 17 23:57 botdir
$ cd botdir; ls -ls
cd: can't cd to botdir
total 1
1 drwxr-xr-x  2 dan  bin  512 Oct 17 23:57 botdir
$ 

>How-To-Repeat:
see the example in the "Full Description"
>Fix:

>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199710180710.AAA01895>