FreeBSD added sig2str which makes tests/timeout/timeout.sh from
coreutils fail with the following:
+ compare_ exp err
+ LC_ALL=C diff -u exp err
--- exp 2025-12-01 21:18:13.335894000 -0800
+++ err 2025-12-01 21:18:13.790449000 -0800
@@ -1,2 +1,2 @@
-timeout: sending signal EXIT to command 'sleep'
+timeout: sending signal 0 to command 'sleep'
timeout: sending signal KILL to command 'sleep'
POSIX states [1]:
If signum is equal to 0, the behavior is unspecified.
This seems like an uncommon use of this function, so I am tempted to
push this change to coreutils:
diff --git a/src/timeout.c b/src/timeout.c
index 7634323d4..cea997161 100644
--- a/src/timeout.c
+++ b/src/timeout.c
@@ -226,7 +226,9 @@ cleanup (int sig)
if (verbose)
{
char signame[MAX (SIG2STR_MAX, INT_BUFSIZE_BOUND (int))];
- if (sig2str (sig, signame) != 0)
+ if (sig == 0)
+ strcpy (signame, "EXIT");
+ else if (sig2str (sig, signame) != 0)
snprintf (signame, sizeof signame, "%d", sig);
error (0, 0, _("sending signal %s to command %s"),
signame, quote (command));
However, I figured it was best to get others opinions first. Is it worth
replacing the system sig2str in this case?
Collin
[1] https://pubs.opengroup.org/onlinepubs/9799919799/functions/sig2str.html