Re: spurious use of %m format in pg_upgrade

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: spurious use of %m format in pg_upgrade
Date: 2011-07-07 04:22:09
Message-ID: 19760.1310012529@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Peter Eisentraut <peter_e(at)gmx(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Radosław Smogura 2011-07-07 06:00:15 Re: Crash dumps
Previous Message Peter Eisentraut 2011-07-07 04:03:12 spurious use of %m format in pg_upgrade