Re: Enabling shell error handling in configure.ac

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

 



Or is there any way to enable such automatic error handling?

[...]
be a useful project for someone to do, although it would take some time

Like Paul I do not have time to pursue this any further myself, but I'd be happy to guide anyone (you?) who wanted to work on it. If you're interested in doing more complex projects in the future, it would be a good way to get accustomed to how Autoconf's innards are put together.


Let's do the first step. It does not actually touch anything user facing or important, but it should serve as a signal (as an example) that it's actually the way to go in Autoconf:

From 4f0ee11990ad794b61c8499f0a4e3777c9edc282 Mon Sep 17 00:00:00 2001
From: R. Diez <rdiez-2006@xxxxxxx>
Date: Sat, 30 Nov 2024 21:55:05 +0100
Subject: [PATCH] Enable "set -u" in bootstrap.

Signed-off-by: R. Diez <rdiez-2006@xxxxxxx>
---
 bootstrap | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/bootstrap b/bootstrap
index 700ec25d..9dee92af 100755
--- a/bootstrap
+++ b/bootstrap
@@ -28,6 +28,9 @@
 set -e
 (set -o pipefail 2> /dev/null) && set -o pipefail
+# Error on undefined variables.
+set -u
+
 # Avoid problems due to various shell wrinkles.
 # We assume we have a shell new enough to implement unset correctly.
 (set -o posix 2> /dev/null) && set -o posix
@@ -109,7 +112,7 @@ fi
 # Override SHELL.  This is required on DJGPP so that Perl's system()
 # uses bash, not COMMAND.COM which doesn't quote arguments properly.
 # It's not used otherwise.
-if test -n "$DJDIR"; then
+if test -n "${DJDIR-}"; then
   BOOTSTRAP_SHELL=/dev/env/DJDIR/bin/bash.exe
 else
   BOOTSTRAP_SHELL=/bin/sh
--
2.47.0


Please copy me an any replies, as I am not subscribed to this mailing list.

Best regards,
  rdiez





[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux