On 2024-01-27 08:39, Bruno Haible wrote:
Here is a reworked patch and ChangeLog based on your advices/ideas.
In my tests quotes, *, ? and spaces are now accepted in file names, but
not backslashes.

Thanks! Applied.

In reviewing that I found an opportunity to allow even odder situations, by passing the need to use 'ls', and installed the attached followup.
From daeabcd8d6e73b254273559b1e4251a1498fceb9 Mon Sep 17 00:00:00 2001
From: Paul Eggert <[email protected]>
Date: Sat, 27 Jan 2024 12:44:25 -0800
Subject: [PATCH] gendocs: allow other chars in source file names
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* build-aux/gendocs.sh: Generalize to also allow leading ‘-’
and newlines (!) in source file names.  Exit if there
is an error creating the tarball.
---
 ChangeLog            |  7 +++++++
 build-aux/gendocs.sh | 24 ++++++++++++++++++------
 2 files changed, 25 insertions(+), 6 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 7f40b7c6b9..58fd6e5d4c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2024-01-27  Paul Eggert  <[email protected]>
+
+	gendocs: allow other chars in source file names
+	* build-aux/gendocs.sh: Generalize to also allow leading ‘-’
+	and newlines (!) in source file names.  Exit if there
+	is an error creating the tarball.
+
 2024-01-27  Patrice Dumas  <[email protected]>
 
 	gendocs: allow spaces, metacharacters and quotes in source file names
diff --git a/build-aux/gendocs.sh b/build-aux/gendocs.sh
index 605c7e3194..9b601010a1 100755
--- a/build-aux/gendocs.sh
+++ b/build-aux/gendocs.sh
@@ -2,7 +2,7 @@
 # gendocs.sh -- generate a GNU manual in many formats.  This script is
 #   mentioned in maintain.texi.  See the help message below for usage details.
 
-scriptversion=2024-01-01.00
+scriptversion=2024-01-27.12
 
 # Copyright 2003-2024 Free Software Foundation, Inc.
 #
@@ -66,7 +66,7 @@ generate_html=true
 generate_info=true
 generate_tex=true
 outdir=manual
-source_extra=
+unset source_extra
 split=node
 srcfile=
 texarg="-t @finalout"
@@ -416,11 +416,23 @@ fi # end html
 printf "\nMaking .tar.gz for sources...\n"
 d=`dirname $srcfile`
 (
-  cd "$d"
-  ls -d *.texinfo *.texi *.txi *.eps "$source_extra" 2>/dev/null \
-     | tar -czhf "$abs_outdir/$PACKAGE.texi.tar.gz" -T-
+  cd "$d" || exit
+
+  # Set PATS to a list of globbing patterns that expand to
+  # file names to be put into the .tar.gz for sources.
+  # Omit patterns that do not expand to file names.
+  pats=
+  for pat in '*.texinfo' '*.texi' '*.txi' '*.eps'; do
+    for file in $pat; do
+      test "$file" = "$pat" && test ! -e "$file" || pats="$pats $pat"
+      break
+    done
+  done
+
+  tar -czhf "$abs_outdir/$PACKAGE.texi.tar.gz" \
+    -- $pats ${source_extra-"$source_extra"} &&
   ls -l "$abs_outdir/$PACKAGE.texi.tar.gz"
-)
+) || exit
 texi_tgz_size=`calcsize "$outdir/$PACKAGE.texi.tar.gz"`
 
 # 
-- 
2.40.1

Reply via email to