From daa5459b6aaa059ca16cb98a1cc16b6fb9964cc6 Mon Sep 17 00:00:00 2001 From: Giulio Benetti Date: Sun, 25 Jul 2021 23:00:54 +0200 Subject: [PATCH] package/nfs-utils: fix printfs format build failure on 64-bits platforms Add 2 upstream patches from nfs-utils that fix build failures 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 Cc: Petr Vorel Reviewed-by: Petr Vorel Signed-off-by: Thomas Petazzoni --- ...nfsdcltrack-sqlite-Fix-printf-format.patch | 52 +++++++++++++++++++ ...rack-nfsdcltrack.c-Fix-printf-format.patch | 48 +++++++++++++++++ 2 files changed, 100 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..14894602c4 --- /dev/null +++ b/package/nfs-utils/0001-nfsdcltrack-sqlite-Fix-printf-format.patch @@ -0,0 +1,52 @@ +From d05ba5335e869bcd68c0def795c55fd5037914e3 Mon Sep 17 00:00:00 2001 +From: Petr Vorel +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 +Upstream: http://git.linux-nfs.org/?p=steved/nfs-utils.git;a=commit;h=4f2a5b64386600430ec6b71e57b88c5efaa70aed +Signed-off-by: Giulio Benetti +--- + 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 + #include + #include ++#include + #include + #include + #include +@@ -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..0893959460 --- /dev/null +++ b/package/nfs-utils/0002-nfsdcltrack-nfsdcltrack.c-Fix-printf-format.patch @@ -0,0 +1,48 @@ +From 14eb2cae4fca95609ae4efde2444fd0a5ddfca04 Mon Sep 17 00:00:00 2001 +From: Petr Vorel +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 +Upstream: http://git.linux-nfs.org/?p=steved/nfs-utils.git;a=commit;h=5a53426c0f4e84f6644c11e4f01015597d3bb82c +Signed-off-by: Giulio Benetti +--- + 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 + #include + #include ++#include + #include + #include + #include +@@ -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.30.2