[Buildroot] [PATCH 1/1] package/nfs-utils: Backport yet another printf fix

Petr Vorel petr.vorel at gmail.com
Mon Aug 2 22:06:46 UTC 2021


Hi Thomas,

> On Mon, 2 Aug 2021 21:17:12 +0200
> Petr Vorel <petr.vorel at gmail.com> wrote:

> > > And thank you for fixing this :-)  
> > Yw. I see time_t printf format is more tricky than I expected, your traditional
> > approach with casting to long long would not require this change to uint64_t :).

> Actually, we have this printf() / time_t issue on other packages, on
> 32-bit architectures where time_t is a 64-bit value (RISC-V 32-bit for
> example). What is the correct solution in the end?
I believe all 3 patches (2 already merged + this one) should fix the problem.
But I was not able to verify it, because ./utils/test-pkg didn't catch even
this error (I tested all available toolchains), IMHO -Werror=format=2 and other
-Werror are probably only on http://autobuild.buildroot.net/ (not in Buildroot
config for users). It'd be great if ./utils/test-pkg had the same CFLAGS.
Or have I (again) overlooked something?

> Apparently, the really standard solution is simply to *not* print a
> time_t, as it's supposed to be an opaque type, which can be different
> things depending on the underlying implementation. But in practice, a
> lot of packages do printf() time_t values.
Yep, convert it to string is recommended, but as you noted, many people do.

> Thomas

Kind regards,
Petr


More information about the buildroot mailing list