Re: permissions not honoured by /bin/pwd aka getcwd

From: Jesse Pollard (pollard@tomcat.admin.navo.hpc.mil)
Date: Thu Feb 24 2000 - 11:02:16 EST


Anton Ivanov <aivanov@eu.level3.net>:
...
>mkdir -p /tmp/crap/crap1 ; ln -s /tmp/crap /tmp/crap2 ; cd /tmp/crap2/crap1 ;
>pwd
>
>on linux it returns /tmp/crap2/crap1
>on solaris it returns /tmp/crap/crap1
>
>If permissions on crap are 000 solaris bummersm, linux does not. This is on
>debian-potato and sol 2.6 respectively.
>
>And this is gnu fileutils not linux as such.
>
>In btw1: at least in some slackware (2.?) long ago pwd was working properly if
>sol's behaviour is considered proper.
>

Both are proper - if the command given is "pwd" and a pwd command happens
to be implemented in the shell (bash/csh). The shell "pwd" outputs tracks of
the "cd" command and just displays what is seen in this track. Each cd
command replaces/appends to the list depending on how the parameter specifies
the path. This was done to optimize a frequently used (in shell scripts
anyway) command to eliminate the multiple directory open/close cycles needed
to implement a generic "pwd" utility. BTW, when the shell version is used,
there is no file access checks made

The program /bin/pwd gives the expected answer by reading the current directory
to find .., then reading it to locate the inode reference to the current
unnamed directory (well, known as . -> alias is looked up in .. by searching
for the inode number). This cycle repeats until /bin/pwd reaches the root
directory.

Both are avilable in Slackware and Red Hat. The behaviour is correct.
-------------------------------------------------------------------------
Jesse I Pollard, II
Email: pollard@navo.hpc.mil

Any opinions expressed are solely my own.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Tue Feb 29 2000 - 21:00:10 EST