[PATCH] maint: update tests/init.sh from gnulib

2021-12-20 Thread Bernhard Voelker
Patch attached.

Additionally, it may be worth adding a syntax-check rule to ensure the files
physically copied from gnulib stay in sync.
WDYT?

Have a nice day,
Berny

diff --git a/cfg.mk b/cfg.mk
index 6d6c37dc2..f06223f2e 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -138,6 +138,14 @@ sc_ensure_gl_diffs_apply_cleanly:
 'make refresh-gnulib-patches' >&2; exit 1; }   \
done

+# Ensure all physically copied files from gnulib are in sync
+sc_ensure_copied_gnulib_files_are_in_sync:
+   @diff -u $(srcdir)/gnulib/doc/COPYINGv3 $(srcdir)/COPYING \
+ && diff -u $(srcdir)/gnulib/build-aux/bootstrap $(srcdir)/bootstrap \
+ && diff -u $(srcdir)/gnulib/tests/init.sh $(srcdir)/tests/init.sh \
+ || { echo '$(ME): please update copied files from gnulib' 1>&2; \
+  exit 1; }\
+
 # Avoid :>file which doesn't propagate errors
 sc_prohibit_colon_redirection:
@cd $(srcdir)/tests && GIT_PAGER= git grep -En ': *>.*\|\|' \From 1435e8e5c51a9d7bb38b7a337058d80a8b78d79a Mon Sep 17 00:00:00 2001
From: Bernhard Voelker 
Date: Mon, 20 Dec 2021 23:13:36 +0100
Subject: [PATCH] maint: update tests/init.sh from gnulib

* tests/init.sh: Sync from gnulib/tests/init.sh.
A recent gnulib update (4f497bf3c) missed this.
---
 tests/init.sh | 17 +
 1 file changed, 17 insertions(+)

diff --git a/tests/init.sh b/tests/init.sh
index 9ef834888..a975592ff 100755
--- a/tests/init.sh
+++ b/tests/init.sh
@@ -426,6 +426,23 @@ setup_ ()
   for sig_ in 1 2 3 13 15; do
 eval "trap 'Exit $(expr $sig_ + 128)' $sig_"
   done
+
+  # Remove relative and non-accessible directories from PATH, including '.'
+  # and Zero-length entries.
+  saved_IFS="$IFS"
+  IFS=:
+  new_PATH=
+  sep_=
+  for dir in $PATH; do
+case "$dir" in
+  /*) test -d "$dir/." || continue
+  new_PATH="${new_PATH}${sep_}${dir}"
+  sep_=':';;
+esac
+  done
+  IFS="$saved_IFS"
+  PATH="$new_PATH"
+  export PATH
 }
 
 # This is a stub function that is run upon trap (upon regular exit and
-- 
2.34.1



fix two syntax-check failures

2021-12-20 Thread Jim Meyering
A few syntax-check failures snuck in, so I've just fixed them with
these two just-pushed commits.


sc.diff
Description: Binary data