Tom Lane wrote:
> Andreas Pflug <pgadmin@pse-consulting.de> writes:
>
>> what issues might arise if the output is redirected to a legal tmp file?
>>
>
> Well, (1) finding a place to put the temp file, ie a writable directory;
> (2) ensuring the file is removed afterwards; (3) not exposing the user
> to security hazards due to unsafe use of a temp file (ye olde
> overwrite-a-symlink risk). Perhaps a few more I didn't think of.
>
AFAICS all DEVNULL usages result from redirecting postmaster's output,
which usually goes to $DATADIR/serverlog at runtime. If this would be
used here too, (1) is as safe as any $DATADIR, (2) is as safe as
cleaning up after failure usually is, (3) can't happen because the
directory is checked to be empty before initdb anyway. Additionally,
there's might be cases when a meaningful logfile from initdb is
desirable too. So why no redirection to initlog or so?
Regards,
Andreas