Re: spurious use of %m format in pg_upgrade - Mailing list pgsql-hackers

From Tom Lane
Subject Re: spurious use of %m format in pg_upgrade
Date
Msg-id 19760.1310012529@sss.pgh.pa.us
Whole thread Raw
In response to spurious use of %m format in pg_upgrade  (Peter Eisentraut <peter_e@gmx.net>)
Responses Re: spurious use of %m format in pg_upgrade
List pgsql-hackers
Peter Eisentraut <peter_e@gmx.net> writes:
> pg_upgrade's pg_scandir_internal() makes use of the non-standard %m
> format:
>
>     pg_log(PG_FATAL, "could not open directory \"%s\": %m\n", dirname);
>
> Is this an oversight, or is there an undocumented assumption that this
> code will only be used on platforms where %m works?

Surely an oversight; everywhere else in frontend code, we take care to
use strerror instead.  Is there a way to persuade gcc to complain about
such extensions when used in contexts where we don't know they work?

> (Which platforms don't have scandir() anyway?)

Hmmm ... my neolithic HPUX box has it, but OTOH the Open Group specs
seem to have added it only in Issue 7 (2008), so I'd not want to bet
money that any random Unix has got it.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: spurious use of %m format in pg_upgrade
Next
From: Radosław Smogura
Date:
Subject: Re: Crash dumps