* [Buildroot] [PATCH] package/nfs-utils: fix printfs format build failure on 64-bits platforms
@ 2021-07-25 21:00 Giulio Benetti
2021-07-25 21:11 ` Petr Vorel
2021-07-28 20:01 ` Thomas Petazzoni
0 siblings, 2 replies; 4+ messages in thread
From: Giulio Benetti @ 2021-07-25 21:00 UTC (permalink / raw)
To: buildroot; +Cc: Giulio Benetti
Add 2 pending upstream patches that have been pointed to nfs-utils
maintainer to be committed soon. They both fix the build failure on 64-bits
where time_t is assumed to be a long long when passed to printf("%ld"), but
that is not always true, so in these patches the author(Petr) uses PRIu64
tag.
Fixes:
http://autobuild.buildroot.net/results/9bc1d43a588338b7395af7bc97535ee16a6ea2d9/
Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
Cc: Petr Vorel <petr.vorel@gmail.com>
---
...nfsdcltrack-sqlite-Fix-printf-format.patch | 51 +++++++++++++++++++
...rack-nfsdcltrack.c-Fix-printf-format.patch | 47 +++++++++++++++++
2 files changed, 98 insertions(+)
create mode 100644 package/nfs-utils/0001-nfsdcltrack-sqlite-Fix-printf-format.patch
create mode 100644 package/nfs-utils/0002-nfsdcltrack-nfsdcltrack.c-Fix-printf-format.patch
diff --git a/package/nfs-utils/0001-nfsdcltrack-sqlite-Fix-printf-format.patch b/package/nfs-utils/0001-nfsdcltrack-sqlite-Fix-printf-format.patch
new file mode 100644
index 0000000000..85ca33a4fd
--- /dev/null
+++ b/package/nfs-utils/0001-nfsdcltrack-sqlite-Fix-printf-format.patch
@@ -0,0 +1,51 @@
+From d05ba5335e869bcd68c0def795c55fd5037914e3 Mon Sep 17 00:00:00 2001
+From: Petr Vorel <petr.vorel () gmail ! com>
+Date: Thu, 22 Jul 2021 16:15:44 +0000
+Subject: [PATCH] nfsdcltrack/sqlite: Fix printf format
+
+sqlite.c: In function 'sqlite_remove_unreclaimed':
+sqlite.c:547:71: error: format '%ld' expects argument of type 'long int', but argument 4 has type 'time_t' {aka 'long long int'} [-Werror=format=]
+ 547 | ret = snprintf(buf, sizeof(buf), "DELETE FROM clients WHERE time < %ld",
+ | ~~^
+ | |
+ | long int
+ | %lld
+ 548 | grace_start);
+ | ~~~~~~~~~~~
+ | |
+ | time_t {aka long long int}
+
+Found in Buildroot riscv32 build.
+
+Link: http://autobuild.buildroot.net/results/9bc1d43a588338b7395af7bc97535ee16a6ea2d9/build-end.log
+
+Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
+Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
+---
+ utils/nfsdcltrack/sqlite.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/utils/nfsdcltrack/sqlite.c b/utils/nfsdcltrack/sqlite.c
+index f79aebb3..cea4a411 100644
+--- a/utils/nfsdcltrack/sqlite.c
++++ b/utils/nfsdcltrack/sqlite.c
+@@ -46,6 +46,7 @@
+ #include <sys/stat.h>
+ #include <sys/types.h>
+ #include <fcntl.h>
++#include <inttypes.h>
+ #include <unistd.h>
+ #include <sqlite3.h>
+ #include <linux/limits.h>
+@@ -544,7 +545,7 @@ sqlite_remove_unreclaimed(time_t grace_start)
+ int ret;
+ char *err = NULL;
+
+- ret = snprintf(buf, sizeof(buf), "DELETE FROM clients WHERE time < %ld",
++ ret = snprintf(buf, sizeof(buf), "DELETE FROM clients WHERE time < %"PRIu64,
+ grace_start);
+ if (ret < 0) {
+ return ret;
+--
+2.25.1
+
diff --git a/package/nfs-utils/0002-nfsdcltrack-nfsdcltrack.c-Fix-printf-format.patch b/package/nfs-utils/0002-nfsdcltrack-nfsdcltrack.c-Fix-printf-format.patch
new file mode 100644
index 0000000000..acfc6ed71f
--- /dev/null
+++ b/package/nfs-utils/0002-nfsdcltrack-nfsdcltrack.c-Fix-printf-format.patch
@@ -0,0 +1,47 @@
+From 14eb2cae4fca95609ae4efde2444fd0a5ddfca04 Mon Sep 17 00:00:00 2001
+From: Petr Vorel <petr.vorel () gmail ! com>
+Date: Thu, 22 Jul 2021 16:15:45 +0000
+Subject: [PATCH] nfsdcltrack/nfsdcltrack.c: Fix printf format
+
+nfsdcltrack.c: In function 'cltrack_gracedone':
+nfsdcltrack.c:528:47: error: format '%ld' expects argument of type 'long int', but argument 4 has type 'time_t' {aka 'long long int'} [-Werror=format=]
+ 528 | xlog(D_GENERAL, "%s: grace done. gracetime=%ld", __func__, gracetime);
+ | ~~^ ~~~~~~~~~
+ | | |
+ | long int time_t {aka long long int}
+ | %lld
+
+Found in Buildroot riscv32 build.
+
+Link: http://autobuild.buildroot.net/results/9bc1d43a588338b7395af7bc97535ee16a6ea2d9/build-end.log
+
+Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
+Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
+---
+ utils/nfsdcltrack/nfsdcltrack.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/utils/nfsdcltrack/nfsdcltrack.c b/utils/nfsdcltrack/nfsdcltrack.c
+index e926f1c0..0b37c094 100644
+--- a/utils/nfsdcltrack/nfsdcltrack.c
++++ b/utils/nfsdcltrack/nfsdcltrack.c
+@@ -33,6 +33,7 @@
+ #include <sys/stat.h>
+ #include <sys/types.h>
+ #include <fcntl.h>
++#include <inttypes.h>
+ #include <unistd.h>
+ #include <libgen.h>
+ #include <sys/inotify.h>
+@@ -525,7 +526,7 @@ cltrack_gracedone(const char *timestr)
+ if (*tail)
+ return -EINVAL;
+
+- xlog(D_GENERAL, "%s: grace done. gracetime=%ld", __func__, gracetime);
++ xlog(D_GENERAL, "%s: grace done. gracetime=%"PRIu64, __func__, gracetime);
+
+ ret = sqlite_remove_unreclaimed(gracetime);
+
+--
+2.25.1
+
--
2.25.1
_______________________________________________
buildroot mailing list
buildroot@busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [Buildroot] [PATCH] package/nfs-utils: fix printfs format build failure on 64-bits platforms
2021-07-25 21:00 [Buildroot] [PATCH] package/nfs-utils: fix printfs format build failure on 64-bits platforms Giulio Benetti
@ 2021-07-25 21:11 ` Petr Vorel
2021-07-25 21:15 ` Giulio Benetti
2021-07-28 20:01 ` Thomas Petazzoni
1 sibling, 1 reply; 4+ messages in thread
From: Petr Vorel @ 2021-07-25 21:11 UTC (permalink / raw)
To: Giulio Benetti; +Cc: buildroot
Hi Giulio,
> Add 2 pending upstream patches that have been pointed to nfs-utils
> maintainer to be committed soon. They both fix the build failure on 64-bits
> where time_t is assumed to be a long long when passed to printf("%ld"), but
> that is not always true, so in these patches the author(Petr) uses PRIu64
> tag.
> Fixes:
> http://autobuild.buildroot.net/results/9bc1d43a588338b7395af7bc97535ee16a6ea2d9/
> Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
> Cc: Petr Vorel <petr.vorel@gmail.com>
Reviewed-by: Petr Vorel <petr.vorel@gmail.com>
Although I'd wait till Monday, when Steve merges them and then add
upstream commit hashes.
Or at least add links from lore.
https://lore.kernel.org/linux-nfs/20210722161545.26923-1-petr.vorel@gmail.com/
https://lore.kernel.org/linux-nfs/20210722161545.26923-2-petr.vorel@gmail.com/
Kind regards,
Petr
_______________________________________________
buildroot mailing list
buildroot@busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [Buildroot] [PATCH] package/nfs-utils: fix printfs format build failure on 64-bits platforms
2021-07-25 21:11 ` Petr Vorel
@ 2021-07-25 21:15 ` Giulio Benetti
0 siblings, 0 replies; 4+ messages in thread
From: Giulio Benetti @ 2021-07-25 21:15 UTC (permalink / raw)
To: Petr Vorel; +Cc: buildroot
Hi Petr,
On 7/25/21 11:11 PM, Petr Vorel wrote:
> Hi Giulio,
>
>> Add 2 pending upstream patches that have been pointed to nfs-utils
>> maintainer to be committed soon. They both fix the build failure on 64-bits
>> where time_t is assumed to be a long long when passed to printf("%ld"), but
>> that is not always true, so in these patches the author(Petr) uses PRIu64
>> tag.
>
>> Fixes:
>> http://autobuild.buildroot.net/results/9bc1d43a588338b7395af7bc97535ee16a6ea2d9/
>
>> Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
>> Cc: Petr Vorel <petr.vorel@gmail.com>
>
> Reviewed-by: Petr Vorel <petr.vorel@gmail.com>
>
> Although I'd wait till Monday, when Steve merges them and then add
> upstream commit hashes.
Oh, usually here they accept pending patches, so I don't think that SHA1
is that important. At least this is what I've experienced until now.
> Or at least add links from lore.
> https://lore.kernel.org/linux-nfs/20210722161545.26923-1-petr.vorel@gmail.com/
> https://lore.kernel.org/linux-nfs/20210722161545.26923-2-petr.vorel@gmail.com/
But yes, I've forgotten to mention that they are pending there ^^^.
Let's see what Buildroot maintainers answer. Otherwise I send a v2 with
update commit log pointint the links where those patches are committed
or pending.
Thanks a lot for reviewing
Kind regards
--
Giulio Benetti
Benetti Engineering sas
_______________________________________________
buildroot mailing list
buildroot@busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Buildroot] [PATCH] package/nfs-utils: fix printfs format build failure on 64-bits platforms
2021-07-25 21:00 [Buildroot] [PATCH] package/nfs-utils: fix printfs format build failure on 64-bits platforms Giulio Benetti
2021-07-25 21:11 ` Petr Vorel
@ 2021-07-28 20:01 ` Thomas Petazzoni
1 sibling, 0 replies; 4+ messages in thread
From: Thomas Petazzoni @ 2021-07-28 20:01 UTC (permalink / raw)
To: Giulio Benetti; +Cc: buildroot
On Sun, 25 Jul 2021 23:00:54 +0200
Giulio Benetti <giulio.benetti@benettiengineering.com> wrote:
> Add 2 pending upstream patches that have been pointed to nfs-utils
> maintainer to be committed soon. They both fix the build failure on 64-bits
> where time_t is assumed to be a long long when passed to printf("%ld"), but
> that is not always true, so in these patches the author(Petr) uses PRIu64
> tag.
>
> Fixes:
> http://autobuild.buildroot.net/results/9bc1d43a588338b7395af7bc97535ee16a6ea2d9/
>
> Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
> Cc: Petr Vorel <petr.vorel@gmail.com>
> ---
> ...nfsdcltrack-sqlite-Fix-printf-format.patch | 51 +++++++++++++++++++
> ...rack-nfsdcltrack.c-Fix-printf-format.patch | 47 +++++++++++++++++
> 2 files changed, 98 insertions(+)
> create mode 100644 package/nfs-utils/0001-nfsdcltrack-sqlite-Fix-printf-format.patch
> create mode 100644 package/nfs-utils/0002-nfsdcltrack-nfsdcltrack.c-Fix-printf-format.patch
Applied to master after adding a reference to the upstream commits.
Thanks!
Thomas
--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-07-28 20:01 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-07-25 21:00 [Buildroot] [PATCH] package/nfs-utils: fix printfs format build failure on 64-bits platforms Giulio Benetti
2021-07-25 21:11 ` Petr Vorel
2021-07-25 21:15 ` Giulio Benetti
2021-07-28 20:01 ` Thomas Petazzoni
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox