On Thu, Jan 7, 2010 at 10:00 AM, Michael Felt <mamf...@gmail.com> wrote: > mich...@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: char cwd[MAXPGPATH], > port/exec.c: if (!getcwd(cwd, MAXPGPATH)) > port/exec.c: join_path_components(retpath, cwd, argv0); > port/exec.c: join_path_components(retpath, cwd, argv0); > port/exec.c: join_path_components(retpath, cwd, > test_path); > port/exec.c: * getcwd() to figure out where the heck we're at. > port/exec.c: * getcwd() to give us an accurate, symlink-free path. > port/exec.c: if (!getcwd(orig_wd, MAXPGPATH)) > port/exec.c: 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 -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs