Subject: Re: pwd returning duplicate directory in path
To: None <tech-kern@NetBSD.org>
From: Michael L. Hitch <mhitch@lightning.msu.montana.edu>
List: tech-kern
Date: 02/13/2004 09:13:42
On Fri, 13 Feb 2004, Manuel Bouyer wrote:

> Hi,
> has anyone else seen this, or has an idea about this bug ?
> disco:/#pwd
> /
> disco:/#cd /root/
> disco:/root#pwd
> /root
> disco:/root#cd .ssh/
> disco:/root/.ssh#pwd
> /root/.ssh.ssh
> disco:/root/.ssh#cd /root/.ssh.ssh
> /root/.ssh.ssh: No such file or directory.

  I noticed this on my PC164 recently (two to three weeks ago, mabye).

  My first thought was that it was something with the old version of
NetBSD I was running, or maybe how long my system had been up:

alpha$ uname -v
NetBSD 1.5.3_ALPHA (PC164) #0: Mon Feb 11 01:25:05 MST 2002
mhitch@alpha.msu.montana.edu:/usr/cvsroot/src/sys/arch/alpha/compile/PC164

alpha$ uptime
 9:05AM  up 521 days, 21:30, 13 users, load averages: 1.15, 1.14, 1.09

  The duplication of the path seems to eventually go away after some time.

  In my case, pwd usually shows the correct path, but getcwd(3) returns
the bad path:

alpha$ cd /usr/xsrc/xfree/xc/programs/Xserver
alpha$ pwd
/usr/xsrc/xfree/xc/programs/Xserver
alpha$ /tmp/getcwd
cwd = /usr/xsrcxsrc/xfreexfree/xcxc/programsprograms/XserverXserver
alpha$ pwd
/usr/xsrc/xfree/xc/programs/Xserver
alpha$ cd /usr/xsrc/xfree/xc/programs/Xserver/hw/netbsd/amiga
alpha$ pwd
/usr/xsrc/xfree/xc/programs/Xserver/hw/netbsd/amiga
alpha$ /tmp/getcwd
cwd = /usr/xsrcxsrc/xfreexfree/xcxc/programsprograms/XserverXserver/hwhw/netbsdnetbsd/amigaamiga

  I looked through the kernel code and noticed that the directory names
can come from cache, so I was thinking something was going on with the
cached data.  I haven't proceeded any further yet.  I was thinking of
writing a kernel groveler to try to dump out the cached directory names to
see if the cache data was somehow corrupted, but I haven't had time to do
that yet.

--
Michael L. Hitch			mhitch@montana.edu
Computer Consultant
Information Technology Center
Montana State University	Bozeman, MT	USA