bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Use the translation domain "gnulib"


From: Bruno Haible
Subject: Re: Use the translation domain "gnulib"
Date: Tue, 17 Dec 2024 18:21:47 +0100

2024-12-10, I wrote:
> The change to openat-die.c triggers a new warning in gzip, from the gcc 13
> options
>   -Wformat -Wformat-security
> Since this package's "make distcheck" enables -Werror, it even triggers an 
> error:
> 
> $ make distcheck
> ...
>   CC       libgzip_a-openat-die.o
> openat-die.c: In function 'openat_save_fail':
> openat-die.c:37:3: error: format not a string literal and no format arguments 
> [-Werror=format-security]
>    37 |   error (exit_failure, errnum,
>       |   ^~~~~
> 
> The warning is pointless, since the gettext tools make sure that the localized
> variant of the string will not access nonexistent format arguments. Thus, it's
> only a code style warning, misplaced under the umbrella of "security".

Similarly with the change to xstdopen.c. It triggers a new warning in diffutils,
from the gcc 13 options
  -Wformat -Wformat-security
Since this package's "make distcheck" enables -Werror, it even triggers an 
error:

$ make distcheck
...
  CC       libdiffutils_a-xstdopen.o
xstdopen.c: In function 'xstdopen':
xstdopen.c:34:5: error: format not a string literal and no format arguments 
[-Werror=format-security]
   34 |     error (exit_failure, stdopen_errno, _("standard file descriptors"));
      |     ^~~~~
xstdopen.c:34:5: error: format not a string literal and no format arguments 
[-Werror=format-security]
cc1: all warnings being treated as errors
make[5]: *** [Makefile:6560: libdiffutils_a-xstdopen.o] Error 1

Again, the warning is pointless, since the gettext tools make sure that the 
localized
variant of the string will not access nonexistent format arguments. Thus, it's
only a code style warning, misplaced under the umbrella of "security".

Additionally, the error message that would be printed is
  standard file descriptors: No space left on device
which is more confusing than helpful. Let me, at the same time, improve the 
error
message.


2024-12-17  Bruno Haible  <bruno@clisp.org>

        xstdopen: Improve error message.
        * lib/xstdopen.c (xstdopen): Improve error message. Ignore the errno
        value.

diff --git a/lib/xstdopen.c b/lib/xstdopen.c
index 678c2a9d9f..b82f44f0a8 100644
--- a/lib/xstdopen.c
+++ b/lib/xstdopen.c
@@ -31,5 +31,9 @@ xstdopen (void)
 {
   int stdopen_errno = stdopen ();
   if (stdopen_errno != 0)
-    error (exit_failure, stdopen_errno, _("standard file descriptors"));
+    /* Ignore stdopen_errno in the error message, since it may be misleading
+       (see stdopen.c).  */
+    error (exit_failure, 0,
+           _("failed to open all three standard file descriptors; maybe %s or 
%s are not working right?"),
+           "/dev/null", "/dev/full");
 }






reply via email to

[Prev in Thread] Current Thread [Next in Thread]