Re: initdb error: "could not identify current directory" (or,

From: OpenMacNews <pgsql-general(dot)20(dot)openmacnews(at)spamgourmet(dot)com>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: initdb error: "could not identify current directory" (or,
Date: 2004-12-04 02:24:43
Message-ID: 84639935BB4ECF0DC801F8A6@tiedgar.internal.presence-group.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)%m]`dirs`> " ;\\
if (`dirs` == "~") set prompt = "[$myUser(at)%m]~ > "'

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

alias pwd '/bin/pwd ;\\
set prompt = "[$myUser(at)%m]_Dirs`> " ;\\
if (`dirs` == "~") set prompt = "[$myUser(at)%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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Marc G. Fournier 2004-12-04 04:18:03 PostgreSQL 8.0.0 Release Candidate 1
Previous Message Bruce Momjian 2004-12-04 02:16:11 Re: [ANNOUNCE] pgsql.* USENET hierarchy has hit Google ...