Re: [pgsql-hackers-win32] initdb in C - Mailing list pgsql-patches
From | Andrew Dunstan |
---|---|
Subject | Re: [pgsql-hackers-win32] initdb in C |
Date | |
Msg-id | 3FAD1F01.7030308@dunslane.net Whole thread Raw |
In response to | Re: [pgsql-hackers-win32] initdb in C (Bruce Momjian <pgman@candle.pha.pa.us>) |
Responses |
Re: [pgsql-hackers-win32] initdb in C
|
List | pgsql-patches |
Bruce Momjian wrote: >Andrew Dunstan wrote: > > >> >> >>My comments: >> >>I have no problem with shelling out to rmdir - although my goal was to >>avoid shelling out to anything other than postgres itself. I think >>recreating the datadir if we didn't create it initially should be OK in >>that case, and it makes the code simpler. Not handling dot files in the >>Unix case should also be fine, as we know the directory was empty to >>start with and we don't create any. >> >> > >Good. I can do rmdir() in C in port/dirmod.c if we need it. Right now >we are doing system(rm/rmdir) in dbcommands.c so we should consistent. >Let's stay with system(rm/rmdir) and if it doesn't work as we expect, we >can add your rmdir() code and put it in port/dirmod.c. > > In view of Peter's email of a few minutes ago I think we need to do that. >>The changes you made for the final message are not going to work for >>Windows - if pgpath or pg_data contain spaces we need quotes (even on >>Unix, although there most people know better than to put spaces in >>names). Also see above about mixed slashes. Also, putting a \ before >>pg_data will be nasty if it starts with a drive or network specifier - >>or even without (you might turn a directory specifier into a network >>drive specifier). It's just a message, though, and we shouldn't hold up >>for that - we can patch it to get it right. >> >> > >I am confused. The only change I made was to have the quotes appear >only on WIN32. > > #ifndef WIN32 > #define QUOTE_PATH "" > #else > #define QUOTE_PATH "\"" > #endif > > ... > > printf("\n" > "Success. You can now start the database server using:\n\n" > " %s/postmaster -D %s%s%s\n" > "or\n" > " %s/pg_ctl -D %s%s%s -l logfile start\n\n", > pgpath, QUOTE_PATH, pg_data, QUOTE_PATH, > pgpath, QUOTE_PATH, pg_data, QUOTE_PATH); > >(I also merged multiple \n into a single line.) My logic was that >spaces in directory names are much more common on WIN32, so we should >display the quotes only on WIN32. Perhaps you read "\"" as "\\"? > > Yes, I did. Sorry about that. But we also need to quote the path (the most obvious place to put it after all is "C:\Program Files\PostgreSQL"). In fact, that's more important than the data location. Unfortunately, the Windows command processor barfs on multiple quotes strings ;-( cheers andrew
pgsql-patches by date: