On 05/03/19 14:52, Assaf Gordon wrote:
> On 2019-03-05 2:17 p.m., Assaf Gordon wrote:
>> On 2019-03-04 3:18 a.m., Pádraig Brady wrote:
>>> We plan to release coreutils-8.31 in the coming week
>>
> 
> On OpenSolaris, 5.10/5.11, both x86 and sparc,
> compilation fails with:
> 
> ====
> CCLD     src/echo
> CC       src/env.o
> src/env.c:62:25: error: variably modified 'signals' at file scope
> static enum SIGNAL_MODE signals[SIGNUM_BOUND + 1];
> ^
> make[2]: *** [src/env.o] Error 1
> ====

So SIGNUM_BOUND is not a constant. Interesting.
For now we can deal with this using the attached.

thanks!
Pádraig

>From 4bbbe49074c996e90e19903dddd858ff8a2bf648 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <p...@draigbrady.com>
Date: Wed, 6 Mar 2019 08:58:13 -0800
Subject: [PATCH] build: fix env build where SIGNUM_BOUND is not constant

* src/env.c (initialize_signals): A new function to initialize
the signals array on the heap, to avoid a build failure on
opensolaris, where SIGNUM_BOUND is not a constant.
---
 src/env.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/src/env.c b/src/env.c
index 5adc7d9..c816135 100644
--- a/src/env.c
+++ b/src/env.c
@@ -59,7 +59,7 @@ enum SIGNAL_MODE {
   IGNORE,        /* Set to ignore (SIG_IGN). */
   IGNORE_NOERR   /* ditto, but ignore sigaction(2) errors.  */
 };
-static enum SIGNAL_MODE signals[SIGNUM_BOUND + 1];
+static enum SIGNAL_MODE *signals;
 
 /* Set of signals to block.  */
 static sigset_t block_signals;
@@ -783,6 +783,17 @@ list_signal_handling (void)
     }
 }
 
+static void
+initialize_signals (void)
+{
+  signals = xmalloc ((sizeof *signals) * (SIGNUM_BOUND + 1));
+
+  for (int i = 0 ; i <= SIGNUM_BOUND; i++)
+    signals[i] = UNCHANGED;
+
+  return;
+}
+
 int
 main (int argc, char **argv)
 {
@@ -800,6 +811,8 @@ main (int argc, char **argv)
   initialize_exit_failure (EXIT_CANCELED);
   atexit (close_stdout);
 
+  initialize_signals ();
+
   while ((optc = getopt_long (argc, argv, shortopts, longopts, NULL)) != -1)
     {
       switch (optc)
-- 
2.9.3

Reply via email to