Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [pushed 1/2] [gdb/doc] Fix makeinfo-wrapper.sh for non-GNU sed
@ 2026-11-04  9:14 Tom de Vries
  2026-11-04  9:14 ` [pushed 2/2] [gdb/doc] Improve error handling in makeinfo-wrapper.sh Tom de Vries
  2026-11-04  9:35 ` [pushed 1/2] [gdb/doc] Fix makeinfo-wrapper.sh for non-GNU sed Andreas Schwab
  0 siblings, 2 replies; 3+ messages in thread
From: Tom de Vries @ 2026-11-04  9:14 UTC (permalink / raw)
  To: gdb-patches

PR build/34943 reports a failure when building on macos:
...
gdb/doc/makeinfo-wrapper.sh 5 0 makeinfo --split-size=5000000 \
  -DHAVE_MAKEINFO_CLICK -I gdb/doc -o annotate.info gdb/doc/annotate.texinfo
gdb/doc/makeinfo-wrapper.sh: line 37: [: texi2any (GNU texinfo) 7.3: \
  integer expression expected
gdb/doc/makeinfo-wrapper.sh: line 38: [: texi2any (GNU texinfo) 7.3: \
  integer expression expected
gdb/doc/makeinfo-wrapper.sh: line 37: [: texi2any (GNU texinfo) 7.3: \
  integer expression expected
gdb/doc/makeinfo-wrapper.sh: line 38: [: texi2any (GNU texinfo) 7.3: \
  integer expression expected
...

The problem is that makeinfo-wrapper.sh uses some non-POSIX sed support.  I
can reproduce the problem on x86_64-linux using "sed --posix".

Fix this by dropping the '\?' part.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=34943
---
 gdb/doc/makeinfo-wrapper.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gdb/doc/makeinfo-wrapper.sh b/gdb/doc/makeinfo-wrapper.sh
index 7ad63bca3bc..b6abbc4e6ea 100755
--- a/gdb/doc/makeinfo-wrapper.sh
+++ b/gdb/doc/makeinfo-wrapper.sh
@@ -24,10 +24,10 @@ shift 3
 
 major=$("$prog" --version \
 	    | grep "GNU texinfo" \
-	    | sed 's/^.* \([0-9][0-9]*\)\.[0-9][0-9]*\(.*\)\?$/\1/')
+	    | sed 's/^.* \([0-9][0-9]*\)\.[0-9][0-9]*.*$/\1/')
 minor=$("$prog" --version \
 	    | grep "GNU texinfo" \
-	    | sed 's/^.* [0-9][0-9]*\.\([0-9][0-9]*\)\(.*\)\?$/\1/')
+	    | sed 's/^.* [0-9][0-9]*\.\([0-9][0-9]*\).*$/\1/')
 
 if [ "$major" = "" ] || [ "$major" = "" ]; then
     echo "Cannot determine makeinfo version for $prog.  Info documentation will not be build."

base-commit: 3d186a654a2f4f51c765eb54d2ceffbf09a9d9ee
-- 
2.51.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [pushed 2/2] [gdb/doc] Improve error handling in makeinfo-wrapper.sh
  2026-11-04  9:14 [pushed 1/2] [gdb/doc] Fix makeinfo-wrapper.sh for non-GNU sed Tom de Vries
@ 2026-11-04  9:14 ` Tom de Vries
  2026-11-04  9:35 ` [pushed 1/2] [gdb/doc] Fix makeinfo-wrapper.sh for non-GNU sed Andreas Schwab
  1 sibling, 0 replies; 3+ messages in thread
From: Tom de Vries @ 2026-11-04  9:14 UTC (permalink / raw)
  To: gdb-patches

In gdb/doc/makeinfo-wrapper.sh, we try to get the major and minor version
number from makeinfo, and if that doesn't work (which is determined by
checking for an empty string), we bail out.

There are three problems related to the error handling:
- instead of checking both major and minor, we check major twice
- if the sed pattern fails to match, major and minor are set to the entire
  version line instead of the empty string
- there's a grammar nit in the error messages

Fix this by:
- checking for both major and minor
- using sed -n 's/.../p'
- "will not be build" -> "will not be built"
---
 gdb/doc/makeinfo-wrapper.sh | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/gdb/doc/makeinfo-wrapper.sh b/gdb/doc/makeinfo-wrapper.sh
index b6abbc4e6ea..4e928776710 100755
--- a/gdb/doc/makeinfo-wrapper.sh
+++ b/gdb/doc/makeinfo-wrapper.sh
@@ -24,20 +24,20 @@ shift 3
 
 major=$("$prog" --version \
 	    | grep "GNU texinfo" \
-	    | sed 's/^.* \([0-9][0-9]*\)\.[0-9][0-9]*.*$/\1/')
+	    | sed -n 's/^.* \([0-9][0-9]*\)\.[0-9][0-9]*.*$/\1/p')
 minor=$("$prog" --version \
 	    | grep "GNU texinfo" \
-	    | sed 's/^.* [0-9][0-9]*\.\([0-9][0-9]*\).*$/\1/')
+	    | sed -n 's/^.* [0-9][0-9]*\.\([0-9][0-9]*\).*$/\1/p')
 
-if [ "$major" = "" ] || [ "$major" = "" ]; then
-    echo "Cannot determine makeinfo version for $prog.  Info documentation will not be build."
+if [ "$major" = "" ] || [ "$minor" = "" ]; then
+    echo "Cannot determine makeinfo version for $prog.  Info documentation will not be built."
     exit
 fi
 
 if [ "$major" -lt "$required_major" ] \
        || { [ "$major" -eq "$required_major" ] \
 		&& [ "$minor" -lt "$required_minor" ]; }; then
-    echo "$prog is too old, have $major.$minor, require $required_major.$required_minor.  Info documentation will not be build."
+    echo "$prog is too old, have $major.$minor, require $required_major.$required_minor.  Info documentation will not be built."
     exit
 fi
 
-- 
2.51.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [pushed 1/2] [gdb/doc] Fix makeinfo-wrapper.sh for non-GNU sed
  2026-11-04  9:14 [pushed 1/2] [gdb/doc] Fix makeinfo-wrapper.sh for non-GNU sed Tom de Vries
  2026-11-04  9:14 ` [pushed 2/2] [gdb/doc] Improve error handling in makeinfo-wrapper.sh Tom de Vries
@ 2026-11-04  9:35 ` Andreas Schwab
  1 sibling, 0 replies; 3+ messages in thread
From: Andreas Schwab @ 2026-11-04  9:35 UTC (permalink / raw)
  To: Tom de Vries; +Cc: gdb-patches

On Nov 04 2026, Tom de Vries wrote:

> +	    | sed 's/^.* \([0-9][0-9]*\)\.[0-9][0-9]*.*$/\1/')

aka                 /^.* \([0-9][0-9]*\)\.[0-9].*$/

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-11-04  9:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-04  9:14 [pushed 1/2] [gdb/doc] Fix makeinfo-wrapper.sh for non-GNU sed Tom de Vries
2026-11-04  9:14 ` [pushed 2/2] [gdb/doc] Improve error handling in makeinfo-wrapper.sh Tom de Vries
2026-11-04  9:35 ` [pushed 1/2] [gdb/doc] Fix makeinfo-wrapper.sh for non-GNU sed Andreas Schwab

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox