Bug#1067829: nfs-utils: FTBFS on arm{el,hf}: export-cache.c:110:51: error: format ‘%ld’ expects argument of type ‘long int’, but argument 4 has type ‘time_t’ {aka ‘long long int’} [-Werror=format=]

2024-03-28 Thread Thorsten Glaser
Emanuele Rocca dixit:

>The attached patch by Vladimir Petko was sent upstream and fixes the
>FTBFS on armhf/armel.

The patch is catastrophically wrong.

+-  snprintf(flushtime, sizeof(flushtime), "%ld\n", now);
++  snprintf(flushtime, sizeof(flushtime), "%lld\n", now);

Change that to:

++  snprintf(flushtime, sizeof(flushtime), "%lld\n", (long long)now);

time_t is not guaranteed to be 64-bit (or even integer, by ISO C),
it must always be coerced into the expected type for printf.

Please forward this upstream as well.

Might as well want to check that flushtime is large enough, too.

bye,
//mirabilos
-- 
When he found out that the m68k port was in a pretty bad shape, he did
not, like many before him, shrug and move on; instead, he took it upon
himself to start compiling things, just so he could compile his shell.
How's that for dedication. -- Wouter, about my Debian/m68k revival



Bug#1067829: nfs-utils: FTBFS on arm{el,hf}: export-cache.c:110:51: error: format ‘%ld’ expects argument of type ‘long int’, but argument 4 has type ‘time_t’ {aka ‘long long int’} [-Werror=format=]

2024-03-28 Thread Emanuele Rocca
Control: tags -1 + patch

Hi,

On 2024-03-27 11:02, Sebastian Ramacher wrote:
> export-cache.c: In function ‘junction_flush_exports_cache’:
> export-cache.c:110:51: error: format ‘%ld’ expects argument of type ‘long 
> int’, but argument 4 has type ‘time_t’ {aka ‘long long int’} [-Werror=format=]
>   110 | snprintf(flushtime, sizeof(flushtime), "%ld\n", now);
>   | ~~^ ~~~
>   |   | |
>   |   | time_t {aka 
> long long int}
>   |   long int
>   | %lld

The attached patch by Vladimir Petko was sent upstream and fixes the
FTBFS on armhf/armel.

  Emanuele
diff -Nru nfs-utils-2.6.4/debian/changelog nfs-utils-2.6.4/debian/changelog
--- nfs-utils-2.6.4/debian/changelog	2023-12-03 14:58:30.0 +0100
+++ nfs-utils-2.6.4/debian/changelog	2024-03-28 16:56:19.0 +0100
@@ -1,3 +1,10 @@
+nfs-utils (1:2.6.4-3.1) unstable; urgency=medium
+
+  * Non-maintainer upload.
+  * Apply upstream patch to fix FTBFS on armhf/armel (Closes: #1067829) 
+
+ -- Emanuele Rocca   Thu, 28 Mar 2024 16:56:19 +0100
+
 nfs-utils (1:2.6.4-3) unstable; urgency=medium
 
   [ Salvatore Bonaccorso ]
diff -Nru nfs-utils-2.6.4/debian/patches/flushtime-long-long-int.patch nfs-utils-2.6.4/debian/patches/flushtime-long-long-int.patch
--- nfs-utils-2.6.4/debian/patches/flushtime-long-long-int.patch	1970-01-01 01:00:00.0 +0100
+++ nfs-utils-2.6.4/debian/patches/flushtime-long-long-int.patch	2024-03-28 16:56:19.0 +0100
@@ -0,0 +1,17 @@
+Author: Vladimir Petko
+Origin: https://bugzilla.kernel.org/show_bug.cgi?id=218540
+Bug-Debian: https://bugs.debian.org/1067829
+
+Index: nfs-utils-2.6.4/support/junction/export-cache.c
+===
+--- nfs-utils-2.6.4.orig/support/junction/export-cache.c
 nfs-utils-2.6.4/support/junction/export-cache.c
+@@ -107,7 +107,7 @@ junction_flush_exports_cache(void)
+ 		xlog(D_GENERAL, "%s: time(3) failed", __func__);
+ 		return FEDFS_ERR_SVRFAULT;
+ 	}
+-	snprintf(flushtime, sizeof(flushtime), "%ld\n", now);
++	snprintf(flushtime, sizeof(flushtime), "%lld\n", now);
+ 
+ 	for (i = 0; junction_proc_files[i] != NULL; i++) {
+ 		retval = junction_write_time(junction_proc_files[i], flushtime);
diff -Nru nfs-utils-2.6.4/debian/patches/series nfs-utils-2.6.4/debian/patches/series
--- nfs-utils-2.6.4/debian/patches/series	2023-12-03 14:58:30.0 +0100
+++ nfs-utils-2.6.4/debian/patches/series	2024-03-28 16:56:19.0 +0100
@@ -1,3 +1,4 @@
 multiarch-kerberos-paths.patch
 always-run-generator.patch
 fsidd-call-anonymous-sockets-by-their-name-only-don-.patch
+flushtime-long-long-int.patch


Bug#1067829: nfs-utils: FTBFS on arm{el,hf}: export-cache.c:110:51: error: format ‘%ld’ expects argument of type ‘long int’, but argument 4 has type ‘time_t’ {aka ‘long long int’} [-Werror=format=]

2024-03-27 Thread Sebastian Ramacher
Source: nfs-utils
Version: 1:2.6.4-3
Severity: serious
Tags: ftbfs
Justification: fails to build from source (but built successfully in the past)
X-Debbugs-Cc: sramac...@debian.org

https://buildd.debian.org/status/fetch.php?pkg=nfs-utils=armel=1%3A2.6.4-3%2Bb2=1711452552=0

libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I../../support/include 
-I/usr/include/tirpc -I/usr/include/libxml2 -D_LARGEFILE_SOURCE 
-D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64 -Wdate-time -D_FORTIFY_SOURCE=2 
-D_GNU_SOURCE -pipe -Wall -Wextra -Werror=strict-prototypes 
-Werror=missing-prototypes -Werror=missing-declarations -Werror=format=2 
-Werror=undef -Werror=missing-include-dirs -Werror=strict-aliasing=2 
-Werror=init-self -Werror=implicit-function-declaration -Werror=return-type 
-Werror=switch -Werror=overflow -Werror=parentheses -Werror=aggregate-return 
-Werror=unused-result -fno-strict-aliasing -Werror=format-overflow=2 
-Werror=int-conversion -Werror=incompatible-pointer-types 
-Werror=misleading-indentation -Wno-cast-function-type -g -O2 
-Werror=implicit-function-declaration -ffile-prefix-map=/<>=. 
-fstack-protector-strong -fstack-clash-protection -Wformat 
-Werror=format-security -c xml.c  -fPIC -DPIC -o .libs/xml.o
export-cache.c: In function ‘junction_flush_exports_cache’:
export-cache.c:110:51: error: format ‘%ld’ expects argument of type ‘long int’, 
but argument 4 has type ‘time_t’ {aka ‘long long int’} [-Werror=format=]
  110 | snprintf(flushtime, sizeof(flushtime), "%ld\n", now);
  | ~~^ ~~~
  |   | |
  |   | time_t {aka 
long long int}
  |   long int
  | %lld
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I../../support/include 
-I/usr/include/tirpc -I/usr/include/libxml2 -D_LARGEFILE_SOURCE 
-D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64 -Wdate-time -D_FORTIFY_SOURCE=2 
-D_GNU_SOURCE -pipe -Wall -Wextra -Werror=strict-prototypes 
-Werror=missing-prototypes -Werror=missing-declarations -Werror=format=2 
-Werror=undef -Werror=missing-include-dirs -Werror=strict-aliasing=2 
-Werror=init-self -Werror=implicit-function-declaration -Werror=return-type 
-Werror=switch -Werror=overflow -Werror=parentheses -Werror=aggregate-return 
-Werror=unused-result -fno-strict-aliasing -Werror=format-overflow=2 
-Werror=int-conversion -Werror=incompatible-pointer-types 
-Werror=misleading-indentation -Wno-cast-function-type -g -O2 
-Werror=implicit-function-declaration -ffile-prefix-map=/<>=. 
-fstack-protector-strong -fstack-clash-protection -Wformat 
-Werror=format-security -c display.c -o display.o >/dev/null 2>&1
cc1: some warnings being treated as errors
make[3]: *** [Makefile:489: export-cache.lo] Error 1
make[3]: *** Waiting for unfinished jobs

Cheers
-- 
Sebastian Ramacher