pg.ddx.io pgsql-hackers@postgresql.org mailing list archive
help / color / mirror / Atom feed From: Tom Lane <tgl@sss.pgh.pa.us>
To: Robert Haas <robertmhaas@gmail.com>
Cc: Amul Sul <sulamul@gmail.com>
Cc: Sravan Kumar <sravanvcybage@gmail.com>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Subject: Re: pg_verifybackup: TAR format backup verification
Date: Sat, 28 Sep 2024 18:59:02 -0400
Message-ID: <1115881.1727564342@sss.pgh.pa.us> (raw )
In-Reply-To: <CA+TgmoZBPKaonc=rE0d7YUm3fzeQTftP6o=8vqFDe1AY2nmbrw@mail.gmail.com >
References: <CAAJ_b94StvLWrc_p4q-f7n3OPfr6GhL8_XuAg2aAaYZp1tF-nw@mail.gmail.com >
<CA+=NbjjkFADANQoyvgTQfKH8ZerxpmsJD70R17V8ZtfaoyRYwg@mail.gmail.com >
<CAAJ_b96xU5fOOvWhJyMvvDCirJEZZdjieZZbyf0PnYukFQCy+Q@mail.gmail.com >
<CA+Tgmoa0FVRbC9EG5GDaXORqMsoj8AnEDV4FVXwbLENKqwQqaA@mail.gmail.com >
<CAAJ_b96Gwh=6zwpqsD-sVNOeYcU=9rfBygVtuXmU3qFAiNr2Hw@mail.gmail.com >
<CA+Tgmobmi7qiu8HDQECwuy-JrAH0zcYbzGnhnKjurqv44DHtxg@mail.gmail.com >
<CAAJ_b94sxUN73kNZ_Z5sP0GDEZGAxKgW0PvS5CBJXiH212+Fww@mail.gmail.com >
<CA+Tgmoboyugvh0C-QWfzQK0nNgOHrxGnQQiOROjaa--+Aqr2xg@mail.gmail.com >
<CAAJ_b975Pyo53P-zvkTPjVFErEANuRP9+K=2Qnifiy6BJBtwfw@mail.gmail.com >
<CA+Tgmobt6=v-jE4iJ2kBGQ=jfubX_7fdOe4Uf9TWhKn+cfjGfw@mail.gmail.com >
<CAAJ_b95rXAsyuetre9Wc-W6uHW-=ivVj56F8-w4gfrTGsnRRSA@mail.gmail.com >
<CA+TgmoZw9dc6w-FFFJvuFMEfB11c+tDRyW+BjWD89+NG8bV=iA@mail.gmail.com >
<CAAJ_b95mcGjkfAf1qduOR97CokW8-_i-dWLm3v6x1w2-OW9M+A@mail.gmail.com >
<CA+TgmoZTJzUyzDkdo6K7TTM2ePP0EMXTwxGhJN1Ymx3qNHvevQ@mail.gmail.com >
<CAAJ_b94MR! uQbNRa0DSgQM1r8sZO+S6nw58fheUORrVy76T=cCA@mail.gmail.com >
<CA+TgmoYOQex-MuAfh+Fe1dRKT+O=nH+fPYJ6bKpHfUxgZpumew@mail.gmail.com >
<CA+TgmoZnG5DT1jo=9xgFztiLX4tU7+wr3D9HbhH_vPc+C5M0iA@mail.gmail.com >
<CA+TgmoYkXG1mvc4kc=fid8Sn-k4M1a4T_m4nN1_1Ed9afKg2KQ@mail.gmail.com >
<CAAJ_b95e9oNpQ+EdLgKX+aLJXwpWAy2EZsLBFSB9=XSPs4hhFg@mail.gmail.com >
<CAAJ_b972EmWT+a63wtTAwfGF3QpYZkzwov5UPh=JPmgJY=dW8A@mail.gmail.com >
<CA+TgmobUiaquaz7CTzDDpJu5e6XYuvxEc4e+HXEvUqn7PD4byw@mail.gmail.com >
<CAAJ_b976LwbmzJLDLTw6ScAVbH7mtxWhj12MWtyRYSkCSjOcfw@mail.gmail.com >
<CA+TgmoZ-fwQ0aWUs_40oXkEpF7JAn4D9SnKj8dj=qGLtO0VSRw@mail.gmail.com >
<CA+Tgmobs-gbRUMGPpzVZnPPP=cgeEO7hnzV2yKmM0BQ=MGQSMg@mail.gmail.com >
<CAAJ_b955y7NrkTUGtiyoGkPBs-OgYMv32iW0WTSpVfpFpezxdQ@mail.gmail.com >
<CA+Tgmob3zhdDM=ggw-NrV-jrvLP7a-otWFn5F+5oOputiFdhmQ@mail.gmail.com >
<CAAJ_b96RBwBMkgK3gzzm+94m6jvdbMi--8RzxaQLu-2+52Nj6g@mail.gmail.com >
<CA+TgmoZBPKaonc=rE0d7YUm3fzeQTftP6o=8vqFDe1AY2nmbrw@mail.gmail.com >
The 32-bit buildfarm animals don't like this too much [1]:
astreamer_verify.c: In function 'member_verify_checksum':
astreamer_verify.c:297:68: error: format '%zu' expects argument of type 'size_t', but argument 6 has type 'uint64' {aka 'long long unsigned int'} [-Werror=format=]
297 | "file \\"%s\\" in \\"%s\\" should contain %zu bytes, but read %zu bytes",
| ~~^
| |
| unsigned int
| %llu
298 | m->pathname, mystreamer->archive_name,
299 | m->size, mystreamer->checksum_bytes);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| uint64 {aka long long unsigned int}
Now, manifest_file.size is in fact a size_t, so %zu is the correct
format spec for it. But astreamer_verify.checksum_bytes is declared
uint64. This leads me to question whether size_t was the correct
choice for manifest_file.size. If it is, is it OK to use size_t
for checksum_bytes as well? If not, your best bet is likely
to write %lld and add an explicit cast to long long, as we do in
dozens of other places. I see that these messages are intended to be
translatable, so INT64_FORMAT is not usable here.
Aside from that, I'm unimpressed with expending a five-line comment
at line 376 to justify casting control_file_bytes to int, when you
could similarly cast it to long long, avoiding the need to justify
something that's not even in tune with project style.
regards, tom lane
[1] https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=mamba&dt=2024-09-28%2006%3A03%3A02
view thread (51+ messages) latest in thread
Message-ID: <1115881.1727564342@sss.pgh.pa.us>
Permalink: ../1115881.1727564342@sss.pgh.pa.us/
Also on: postgresql.org/message-id/1115881.1727564342@sss.pgh.pa.us
copy link · copy postgr.es
reply Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: tgl@sss.pgh.pa.us, robertmhaas@gmail.com, sulamul@gmail.com, sravanvcybage@gmail.com
Subject: Re: pg_verifybackup: TAR format backup verification
In-Reply-To: <1115881.1727564342@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox