Skip site navigation (1) Skip section navigation (2)

Re: [PATCHES] initdb in C

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: PostgreSQL Win32 port list <pgsql-hackers-win32(at)postgresql(dot)org>,"Patches (PostgreSQL)" <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [PATCHES] initdb in C
Date: 2003-11-10 23:02:32
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackerspgsql-hackers-win32pgsql-patches
Patch applied.  We now have a C version of initdb!


Andrew Dunstan wrote:
> Bruce Momjian wrote:
> >Here is a slightly modified version of Andrew's great work in making a C
> >version of initdb.  Other than minor cleanups, the only big change was
> >to remove rmdir handling because we using rm -r and rmdir /s in
> >commands/dbcommands.c, so we might as use the same thing for initdb.c
> >rather than having code that traverses the directory tree doing 'rm'.
> >
> >The other change was to remove the unlink code and instead use
> >port/dirmod.c's version.
> >
> >It passes all the regression tests.  I have also included a diff against
> >Andrew's version so you can see my changes.  It seems Andrew had a very
> >current version of initdb.  The only update he missed was the change to
> >test the number of connections before shared buffers --- I made that
> >change myself.
> >
> >I would like to apply this in the next few days to HEAD before
> >drifts.  We are no longer using the WIN32_DEV branch because all our
> >work is now in 7.5 head.
> >  
> >
> 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.
> Regarding the #endif comments you removed - Peter had asked me to put 
> them in. See 
> You put a comment on canonicalise_path() asking if it is needed. The 
> short answer is very much "yes". The Windows command processor will 
> accept suitably quoted paths with forward slashes, but barfs badly with 
> mixed forward and back slashes. (See recent discussion on 
> hackers-win32).Removing the trailing slash on a path means we never get 
> ugly double slashes. Feel free to put that info in as a comment if you 
> think it is needed.
> 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.
> (Getting the path and slash thing working portably was by far the 
> biggest headache in this project - the rest was just grunt work for the 
> most part, although I learned a few interesting things.)
> Otherwise I'm fine with this.
> cheers
> andrew
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?

  Bruce Momjian                        |
  pgman(at)candle(dot)pha(dot)pa(dot)us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

In response to

pgsql-hackers by date

Next:From: Tom LaneDate: 2003-11-10 23:06:15
Subject: Re: Lack of RelabelType is causing me pain
Previous:From: Bruce MomjianDate: 2003-11-10 22:26:18
Subject: Re: Annotated release notes

pgsql-patches by date

Next:From: Bruce MomjianDate: 2003-11-11 00:48:02
Subject: Re: [HACKERS] Proposal: psql force prompting on notty
Previous:From: Bruce MomjianDate: 2003-11-10 19:41:34
Subject: Re: $PostgreSQL$ header -- Post 7.4 Release

pgsql-hackers-win32 by date

Next:From: Bruce MomjianDate: 2003-11-10 23:45:13
Subject: Re: status?
Previous:From: Joshua D. DrakeDate: 2003-11-10 22:58:11
Subject: Re: Committing Resources to Win32

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group