Re: BUG #5267: initdb fails on AIX: could not identify current directory
От | Robert Haas |
---|---|
Тема | Re: BUG #5267: initdb fails on AIX: could not identify current directory |
Дата | |
Msg-id | 603c8f071001070725u67446582vb2745793be30fbc1@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: BUG #5267: initdb fails on AIX: could not identify current directory (Michael Felt <mamfelt@gmail.com>) |
Ответы |
Re: BUG #5267: initdb fails on AIX: could not identify current
directory
Re: BUG #5267: initdb fails on AIX: could not identify current directory |
Список | pgsql-bugs |
On Thu, Jan 7, 2010 at 10:00 AM, Michael Felt <mamfelt@gmail.com> wrote: > michael@x054:[/data/prj/postgresql-8.4.2/src]grep cwd */*.c > Well, unless you redefine it... > port/exec.c:#define getcwd(cwd,len) GetCurrentDirectory(len, cwd) If you look at the context of this #define you'll see that it only applies to Windows. > port/exec.c:=A0=A0=A0 char=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 cwd[MAXPGPATH= ], > port/exec.c:=A0=A0=A0 if (!getcwd(cwd, MAXPGPATH)) > port/exec.c:=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 joi= n_path_components(retpath, cwd, argv0); > port/exec.c:=A0=A0=A0 join_path_components(retpath, cwd, argv0); > port/exec.c:=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0 join_path_components(retpath, cwd, > test_path); > port/exec.c:=A0=A0=A0=A0 * getcwd() to figure out where the heck we're at. > port/exec.c:=A0=A0=A0=A0 * getcwd() to give us an accurate, symlink-free = path. > port/exec.c:=A0=A0=A0 if (!getcwd(orig_wd, MAXPGPATH)) > port/exec.c:=A0=A0=A0 if (!getcwd(path, MAXPGPATH)) > > > Now I have no idea what is being called. I hope you do. It looks to me like bin/initdb/initdb.c:main() is calling port/exec.c:find_other_exec() which is calling port/exec.c:find_my_exec() which is calling getcwd(). So it's probably the directory you were in when you ran initdb that is the problem. For example: cd $HOME mkdir delete-me cd delete-me rmdir $HOME/delete-me initdb Produces: could not identify current directory: No such file or directory could not identify current directory: No such file or directory could not identify current directory: No such file or directory The program "postgres" is needed by initdb but was not found in the same directory as "initdb". Check your installation. This is very similar to what you got except that for you it's complaining about permissions rather than existence. I would try running initdb from someplace like / or /tmp and see if that works. I have to say that the error message that is produced by the above test case could easily send one looking in the wrong direction, and could perhaps stand to be improved. Could we just do getcwd() once, bail out if it fails, and then stash the results, rather than continuing on and eventually producing a misleading error message? ...Robert
В списке pgsql-bugs по дате отправления: