From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [pushed 2/2] [gdb/doc] Improve error handling in makeinfo-wrapper.sh
Date: Wed, 4 Nov 2026 10:14:28 +0100 [thread overview]
Message-ID: <20261104091428.3709971-2-tdevries@suse.de> (raw)
In-Reply-To: <20261104091428.3709971-1-tdevries@suse.de>
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
next prev parent reply other threads:[~2026-11-04 9:14 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2026-11-04 9:35 ` Andreas Schwab
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261104091428.3709971-2-tdevries@suse.de \
--to=tdevries@suse.de \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox