Re: initdb mkdir_p() doesn't work

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: initdb mkdir_p() doesn't work
Date: 2003-11-24 01:16:29
Message-ID: 3FC15BED.7020608@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Tom Lane wrote:

>Andrew Dunstan <andrew(at)dunslane(dot)net> writes:
>
>
>>Tom Lane wrote:
>>
>>
>>>AFAICS mkdatadir() shouldn't consider subdir == NULL as a reason to
>>>fail rather than trying mkdir_p.
>>>
>>>
>
>
>
>>Right. In fact, I can't see any good reason to call mkdir and then
>>mkdir_p at all. See my patch from this afternoon.
>>
>>
>
>I'm unsure about that. I liked the original idea of only trying mkdir_p
>when plain mkdir() had failed with ENOENT. I am not convinced your
>proposed patch will behave desirably under all error cases. In
>particular, mkdir_p seems rather dependent on knowing just which errno
>codes will get returned --- which is okay for its heritage as BSD-only
>code, but how well will it port? Better to only invoke it when we have
>reason to think it can help.
>

OK, then the simple thing to do would be either to change the test on
subdir or to remove it altogether and just check for ENOENT. I'd be
surprised if the code weren't fairly portable, though.

>
>
>
>>Sure. Of course, the reason I put this on my web site and asked for
>>eyeballs was to try to catch some of this sort of stuff before the
>>program went into the tree :-)
>>
>>
>
>We have a whole development cycle to shake these issues out. Don't
>panic.
>
>
>

<alfred.e.newman-mode>What, me panic?</alfred.e.newman-mode>

I started with 2 goals: have initdb work on Unix with "make check", and
have the Win32/Cygwin issues sorted out as far as possible, so when we
get a working w32 postmaster we can actually use it :-). There are 2500
lines of C here - the odd bug isn't surprising.

cheers

andrew

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Christopher Kings-Lynne 2003-11-24 01:26:33 Re: pg_dump dependency / physical hot backup
Previous Message Philip Yarra 2003-11-24 00:50:55 Re: Executable files in CVS

Browse pgsql-patches by date

  From Date Subject
Next Message Anjan Dave 2003-11-24 03:51:10 file too large, segmentation fault
Previous Message Tom Lane 2003-11-24 00:04:48 Re: initdb mkdir_p() doesn't work