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

From: Anton Ivanov (aivanov@eu.level3.net)
Date: Thu Feb 24 2000 - 11:25:10 EST


-----BEGIN PGP SIGNED MESSAGE-----

On 24-Feb-2000 Jesse Pollard wrote:
> 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.

My goof off this time. I did forgot to use /bin/pwd one of the times... Ufhh...

Still, the strange fact that when using /bin/pwd solaris returns an error and
linux returns a full path is still there.

pwd (GNU sh-utils) 2.0

strace on linux shows a call to getcwd (3). Return is correct path and no
errors.

truss on solaris shows exactly what you describe.

Cheers ;-)

- ----------------------------------
Anton R. Ivanov
IP Engineer Level3 Communications
RIPE: ARI2-RIPE E-Mail: Anton Ivanov <aivanov@eu.level3.net>
@*** Clarke's Law of Revolutionary Ideas ***
      1) "The check is in the mail."
      2) "I'm from the government and I'm here to help you."
      3) "Of course I'll respect you in the morning."

- ----------------------------------
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.0 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iQEVAwUBOLVbZClWAw/bM84zAQE/AQgAjWDyap2J2Or+b86wltUsb3Zhf9LREQdT
JDSmWmrKOI9Dr9fyYAiqFNyax5lJNr0W1Zoqkt9rYjk7ah2znpHIpsNUMjLqEGXy
e06aJLZBYEle9dskoztcRtSHUJKwLDuSSpcHm8VccJnf8k/o/eZM1mY9Yc5XbFqQ
6riSzmz4cplE7IU+uHy8EdWj1vdcBn+dqdmfZ7mA6ZUiHOJLTiBLpREIUOii/zad
j5rgEBCdKn403dhdMi1yvT1B0lz5QwqjC4I4+oefPTzX9aFFeR+ggEeQ+6cWp3f3
mCNXSXef0kBdnsiowHwILszkXVLzQGRhXMXtnXfkH6GIZgwj4ox3sg==
=6yAd
-----END PGP SIGNATURE-----

-
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