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

From: Paul Slootman (paul@wau.mis.ah.nl)
Date: Thu Feb 24 2000 - 11:20:27 EST


To: aivanov@eu.level3.net
Subject: Re: permissions not honoured by /bin/pwd aka getcwd
X-Newsgroups: ahwau.linux-kernel
In-Reply-To: <XFMail.20000224145311.aivanov@eu.level3.net>
References: <Pine.LNX.3.95.1000224085639.12285A-100000@chaos.analogic.com>
Organization: Albert Heijn Winkelautomatisering
Cc:
Bcc:

In article <XFMail.20000224145311.aivanov@eu.level3.net>
aivanov@eu.level3.net wrote:

>Richard, I think the question is different. It is not root vs user.
>
>It is the behaviour of linux pwd. It does not go over the directory tree like
>solaris pwd and others. It reads '.' and prints it. F.e. sol reads and tries to
>resolve symlinks. And bummers.
>
>Try the following:
>
>mkdir -p /tmp/crap/crap1 ; ln -s /tmp/crap /tmp/crap2 ; cd /tmp/crap2/crap1 ;
>pwd
>
>on linux it returns /tmp/crap2/crap1

That's because `pwd' is a bash builtin, and it simply displays the
cached pwd (you just did "cd /tmp/crap2/crap1", so it knows for sure
that's the directory you're in). To eliminate cached answers, do
"sh -c pwd".

>on solaris it returns /tmp/crap/crap1

Don't talk to me about solaris.

I just did a lot of digging on a solaris system to find out why "find .
-name bla" always gave the error "find: cannot open .: Permission denied".

   $ id
   uid=2245(mqm) gid=203(mqm)
   $ ls -ld .
   drwxrwxr-x 3 mqm mqm 512 Feb 22 11:11 .
   $ find . -name bla
   find: cannot open .: Permission denied
   $ pwd
   /var/mqm/log
   $ sh -c pwd
   sh: cannot determine current directory
   $ ls -ld / /var /var/mqm /var/mqm/log
   drwxr-xr-x 40 root root 1024 Feb 18 16:27 /
   drwxr-xr-x 27 root root 512 Feb 18 16:35 /var
   drwxrwxr-x 10 mqm mqm 512 Feb 22 11:11 /var/mqm
   drwxrwxr-x 3 mqm mqm 512 Feb 22 11:11 /var/mqm/log

The problem was finally tracked down to /var/mqm being mounted on top of
a directory with mode 664. Make sense?
I just checked, 2.2.15pre7 doesn't say "permission denied" in the same
situation.

>And this is gnu fileutils not linux as such.

?

Paul Slootman

-- 
home:       paul@wurtel.demon.nl http://www.wurtel.demon.nl/
work:       paul@murphy.nl       http://www.murphy.nl/
debian:     paul@debian.org      http://www.debian.org/
isdn4linux: paul@isdn4linux.de   http://www.isdn4linux.de/

- 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