Re: Unquoted file name in an error message

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Álvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Unquoted file name in an error message
Date: 2025-04-07 13:10:12
Message-ID: a6b25f86-db83-468b-bd01-3ddf9b7c51b0@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On 2025-04-07 Mo 6:13 AM, Álvaro Herrera wrote:
> On 2025-Apr-07, Kyotaro Horiguchi wrote:
>
>> Hello.
>>
>> While translating error messages related to pg_dumpall (1495eff7bdb),
>> I noticed that one message lacks double quotes around the file name:
>>
>> could not open map file: %s
>>
>> Since this placeholder appears standalone and not embedded in a
>> sentence, I initially thought it might fall outside the usual
>> convention of quoting file names.
> Hello, I think the problem here is that the %s is not the file name, but
> the string from strerror. So the lack of quotes there would seem to be
> correct. The real problem is that the file name isn't mentioned in the
> error message. A secondary issue might be that instead of using %s for
> strerror(), maybe they should be using %m.
>
>
>> + pg_fatal("could not open global.dat file: \"%s\"", strerror(errno));
> Maybe we should do something like
>
> pg_fatal("could not open "%s" file: %m", map_file_path);
>

Yeah. Here's a more thorough error message cleanup.

cheers

andrew

--
Andrew Dunstan
EDB: https://www.enterprisedb.com

Attachment Content-Type Size
errmsg-cleanup.patch text/x-patch 3.2 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexander Korotkov 2025-04-07 13:11:55 Re: Removing unneeded self joins
Previous Message Alexander Korotkov 2025-04-07 13:08:49 Re: pgsql: Convert 'x IN (VALUES ...)' to 'x = ANY ...' then appropriate