Bug 110531

Summary: /bin/sh: sh cd updates current directory even when cd fails
Product: Base System Reporter: David Sanderson <dws>
Component: binAssignee: Stefan Farfeleder <stefanf>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 6.2-RELEASE   
Hardware: Any   
OS: Any   

Description David Sanderson 2007-03-19 19:30:03 UTC
In sh on FreeBSD 6.2, a failed cd command updates the shell's
notion of the current directory as if the cd succeeded.

I tried this on a FreeBSD 4.3 system and the sh there did not
have this problem.  I'm not sure when the regression appeared.

How-To-Repeat: : freebsd6; cd /
: freebsd6; cd /tmp
: freebsd6; env | grep PWD
OLDPWD=/
PWD=/tmp
: freebsd6; pwd
/tmp
: freebsd6; cd /var/crash
cd: can't cd to /var/crash
: freebsd6; pwd
/var/crash                            <-- this is incorrect
: freebsd6; env | grep PWD
OLDPWD=/tmp
PWD=/var/crash
: freebsd6; /bin/pwd
/tmp                                  <-- /bin/pwd is correct
: freebsd6; echo $0
-sh
Comment 1 Remko Lodder freebsd_committer freebsd_triage 2007-03-19 19:32:13 UTC
Responsible Changed
From-To: freebsd-bugs->stefanf

Assign to maintainer
Comment 2 le freebsd_committer freebsd_triage 2007-03-30 17:59:46 UTC
State Changed
From-To: open->closed

Duplicate of bin/101316.