Thread: getcwd failing suddenly

getcwd failing suddenly

From
"D'Arcy" "J.M." Cain
Date:
Recently I have started seeing this error when starting the server.

shell-init: could not get current directory: getcwd: cannot access parent directories

Here is the command I use to start PostgreSQL.

su postgres -c "/usr/local/pgsql/bin/postmaster -S -D /usr/local/pgsql/data"

Did something change recently to cause this?  I find I can get around it
by changing the command to the following.

su postgres -c "cd /usr/local/pgsql; /usr/local/pgsql/bin/postmaster -S -D /usr/local/pgsql/data"

-- 
D'Arcy J.M. Cain <darcy@{druid|vex}.net>   |  Democracy is three wolves
http://www.druid.net/darcy/                |  and a sheep voting on
+1 416 424 2871     (DoD#0082)    (eNTP)   |  what's for dinner.


Re: [HACKERS] getcwd failing suddenly

From
Tom Lane
Date:
"D'Arcy" "J.M." Cain <darcy@druid.net> writes:
> Recently I have started seeing this error when starting the server.
> shell-init: could not get current directory: getcwd: cannot access parent directories
> Did something change recently to cause this?

A quick glimpse scan shows no such error message in the Postgres
sources.  This must be coming out of your shell.  Protection change
on one of the ancestors of your home directory, maybe?
        regards, tom lane


Re: [HACKERS] getcwd failing suddenly

From
"D'Arcy" "J.M." Cain
Date:
Thus spake Tom Lane
> > shell-init: could not get current directory: getcwd: cannot access parent directories
> 
> A quick glimpse scan shows no such error message in the Postgres
> sources.  This must be coming out of your shell.  Protection change
> on one of the ancestors of your home directory, maybe?

I forgot to mention that this happens on 3 different machines as I
upgrade to the latest PostgreSQL and each machine has a different
version of the OS.  I can't recall changing anything to do with
directory permissions but I certainly didn't change all 3.

-- 
D'Arcy J.M. Cain <darcy@{druid|vex}.net>   |  Democracy is three wolves
http://www.druid.net/darcy/                |  and a sheep voting on
+1 416 424 2871     (DoD#0082)    (eNTP)   |  what's for dinner.


Re: [HACKERS] getcwd failing suddenly

From
Vince Vielhaber
Date:
On Fri, 22 Jan 1999, D'Arcy J.M. Cain wrote:

> Thus spake Tom Lane
> > > shell-init: could not get current directory: getcwd: cannot access parent directories
> > 
> > A quick glimpse scan shows no such error message in the Postgres
> > sources.  This must be coming out of your shell.  Protection change
> > on one of the ancestors of your home directory, maybe?
> 
> I forgot to mention that this happens on 3 different machines as I
> upgrade to the latest PostgreSQL and each machine has a different
> version of the OS.  I can't recall changing anything to do with
> directory permissions but I certainly didn't change all 3.

Dumb question but I got bit by it before.  Is there a makefile.custom
nearby?  When I was cleaning up the docbook tags I put one in and it
had a couple of directories that didn't exist on my machine.  They 
probably existed on Tom Lockhart's machine, tho.  :)   I never noticed
it till the next time I built PostgreSQL.

Vince.
-- 
==========================================================================
Vince Vielhaber -- KA8CSH   email: vev@michvhf.com   flame-mail: /dev/null      # include <std/disclaimers.h>
       TEAM-OS2  Online Searchable Campground Listings    http://www.camping-usa.com      "There is no outfit less
entitledto lecture me about bloat              than the federal government"  -- Tony Snow
 
==========================================================================





Re: [HACKERS] getcwd failing suddenly

From
Taral
Date:
On Fri, 22 Jan 1999, you wrote:
>Recently I have started seeing this error when starting the server.
>
>shell-init: could not get current directory: getcwd: cannot access parent directories

You're starting it from a directory which user postgres does not have access
to. Therefore reading '..' (which the shell that su launched uses to determine
current directory) fails. It doesn't matter, although your solution works.
Other solution: Just use 'cd' instead of 'cd /usr/local/pgsql'

Taral