Re: initdb error: "could not identify current directory" (or, - Mailing list pgsql-general

From OpenMacNews
Subject Re: initdb error: "could not identify current directory" (or,
Date
Msg-id 84639935BB4ECF0DC801F8A6@tiedgar.internal.presence-group.net
Whole thread Raw
In response to Re: initdb error: "could not identify current directory" (or, what have i done now?)  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: initdb error: "could not identify current directory" (or,  (Joel <rees@ddcom.co.jp>)
List pgsql-general
hi tom,

>> % ls -ald /Volumes/data/pgsql
>>     drwxrwxr-x  12 testuser testuser 408 Nov 25 09:12 /Volumes/data/pgsql
>
> Huh?  Why didn't the rm -rf remove both of those?  Or are you skipping
> some steps?

oops, sorry, copy-n-paste-itis:

   % rm -rf /var/data/pgsql/* /Volumes/data/pgsql/*

>> % cd /var/data/pgsql
>> % pwd
>>     /Volumes/data/pgsql
>
> This is odd ... when I do pwd I see the path as it was told to cd.  I
> have to say /bin/pwd to get what you're showing.

my pwd is aliased to:

    alias pwd   '/bin/pwd ;\\
                set prompt = "[$myUser@%m]`dirs`> " ;\\
                if (`dirs` == "~") set prompt = "[$myUser@%m]~ > "'

checking in my ~/.cshrc, tho', it had -- apparently -- been munged in a
copy-n-paste to:

    alias pwd   '/bin/pwd ;\\
                set prompt = "[$myUser@%m]_Dirs`> " ;\\
                if (`dirs` == "~") set prompt = "[$myUser@%m]~ > "'

so,

(a) i corrected the alias

% sudo -u testuser /usr/local/pgsql/bin/initdb --pgdata=/var/data/pgsql
--username=testuser
--> still WORKS  if cd to /var first
--> still CHOKES if cd to cd /var/data/pgsql first

% cd /var/data/pgsql
still reports the absolute path
--> /Volumes/data/pgsql

(b) i unaliased pwd

checking

% alias pwd
% which pwd
    /bin/pwd

same results



hmmmm .... why are you getting different results for 'pwd' and '/bin/pwd'

what does YOUR 'which pwd' tell you?

> Couldn't reproduce this, using fully up-to-date 10.3.6.

my gut sez this has GOT to do with my symlinks, etc. ...

> The man page for getcwd does say that it will fail with EACCES (ie,
> "permission denied") if any component of the path is unreadable.
> You didn't show us all the steps of the paths /private/var/data and
> /Volumes/data ... maybe there's a non-world-readable directory involved?

methinks you're on to something ...

after cd-int to /var, and inidb'ing ... tho' it DOES create the dirs/data, i
caught:

    getcwd: cannot access parent directories: Permission denied


so, per reuqest, here are the steps to the path:

    % unalias pwd
    % which pwd
        /bin/pwd


    % ls -ald /private/var
        drwxr-xr-x  24 root     wheel    816  /private/var
    % ls -ald /var
        lrwxr-xr-x   1 root     admin     11  /var -> private/var
    % ls -ald /var/data
        lrwxr-xr-x   1 root     wheel     27  /var/data -> /Volumes/data
    % ls -ald /var/data/pgsql
        drwx------  12 testuser testuser 408  /var/data/pgsql

(i)
    % cd /private/var
    % pwd
        /private/var

(ii)
    % cd /var
    % pwd
        /private/var

(iii)
    % cd /var/data
    % pwd
        /Volumes/data


(iv)
    % cd /var/data/pgsql
    % pwd
        /Volumes/data/pgsql


those 'pwd' results have me a bit confused ... sumthin's not right.

(iii) & (iv) are 'pwd's IN a symlinked dir, and result in the full path.

(i) is a 'pwd' in an absolute dir, and returns the absolute path

BUT, (i) is a pwd IN a symlinked path, yet returns the absolute path, unlike
(iii)/(iv)


i need to stare some more, and dig a little on getcwd.

again, i think pwd's, and perhaps getcwd's, behavior in _my_ symlinked
dirs/path + perms scenario may be the culprit ...

thoughts?

richard

pgsql-general by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [ANNOUNCE] pgsql.* USENET hierarchy has hit Google ...
Next
From: "Marc G. Fournier"
Date:
Subject: PostgreSQL 8.0.0 Release Candidate 1