Re: Inconsistent printf placeholders

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Inconsistent printf placeholders
Date: 2024-03-14 13:02:46
Message-ID: c8be6f11-b67e-48d5-b770-b27a863d8976@eisentraut.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 14.03.24 05:20, Kyotaro Horiguchi wrote:
> A recent commit 6612185883 introduced two error messages that are
> identical in text but differ in their placeholders.
>
> - pg_fatal("could not read file \"%s\": read only %d of %d bytes",
> - filename, (int) rb, (int) st.st_size);
> + pg_fatal("could not read file \"%s\": read only %zd of %lld bytes",
> + filename, rb, (long long int) st.st_size);
> ...
> - pg_fatal("could not read file \"%s\": read only %d of %d bytes",
> + pg_fatal("could not read file \"%s\": read only %d of %u bytes",
> rf->filename, rb, length);
>
> I'd be happy if the two messages kept consistency. I suggest aligning
> types instead of making the messages different, as attached.

If you want to make them uniform, then I suggest the error messages
should both be "%zd of %zu bytes", which are the actual types read()
deals with.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jelte Fennema-Nio 2024-03-14 13:03:19 Re: Flushing large data immediately in pqcomm
Previous Message Heikki Linnakangas 2024-03-14 13:00:49 Re: BitmapHeapScan streaming read user and prelim refactoring