Subject: Re: pwd returning duplicate directory in path
To: matthew green <mrg@eterna.com.au>
From: Manuel Bouyer <bouyer@antioche.lip6.fr>
List: tech-kern
Date: 02/13/2004 14:58:19
On Sat, Feb 14, 2004 at 12:41:14AM +1100, matthew green wrote:
> 
> 
> can you ktrace this and see what getcwd() is returning?

How do you do this with ktrace ?
With the defauls, I get:
  8464 pwd      CALL  __getcwd(0x12002a000,0x3fc)
  8464 pwd      RET   __getcwd 19/0x13
  8464 pwd      CALL  __fstat13(0x1,0x1fffff590)
  8464 pwd      RET   __fstat13 0
  8464 pwd      CALL  break(0x12003e000)
  8464 pwd      RET   break 0
  8464 pwd      CALL  ioctl(0x1,TIOCGETA,0x1fffff5e0)
  8464 pwd      RET   ioctl 0
  8464 pwd      CALL  write(0x1,0x12002e000,0x13)
  8464 pwd      GIO   fd 1 wrote 19 bytes
       "/rootroot/.ssh.ssh
       "
  8464 pwd      RET   write 19/0x13
  8464 pwd      CALL  exit(0)

ktruss gives
  8556 pwd      break(0x12002c000)                 = 0
  8556 pwd      break(0x12002e000)                 = 0
  8556 pwd      __getcwd(0x12002a000, 0x3fc)       = 19
  8556 pwd      __fstat13(0x1, 0x1fffff590)        = 0
  8556 pwd      break(0x12003e000)                 = 0
  8556 pwd      ioctl(0x1, TIOCGETA, 0x1fffff5e0)  = 0
/rootroot/.ssh.ssh
  8556 pwd      write(0x1, 0x12002e000, 0x13)      = 19
       "/rootroot/.ssh.ssh\n"
  8556 pwd      exit(0)


Trying to rebuild /bin/pwd with -g I found another misbehavior:
disco:/root/.ssh#cd /home/srcold/bin/pwd/
disco:/home/srcold/bin/pwd#ls
.depend   CVS       Makefile  pwd       pwd.1     pwd.c     pwd.cat1  pwd.o
disco:/home/srcold/bin/pwd#make cleandir
make: /homehome/srcold/binbin/pwdpwd: No such file or directory.
disco:/home/srcold/bin/pwd#pwd
/homehome/srcold/binbin/pwdpwd
disco:/home/srcold/bin/pwd#which pwd
/bin/pwd

I tried to track it with gdb, but this pwd problem confuse it enouth to make
it unusable :(

-- 
Manuel Bouyer <bouyer@antioche.eu.org>
     NetBSD: 26 ans d'experience feront toujours la difference
--