]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
elf: Fix ambiguous error message for --f in sotruss [BZ #25257]
authorAvinal Kumar <avinal.xlvii@gmail.com>
Mon, 5 Jan 2026 13:29:27 +0000 (18:59 +0530)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Mon, 2 Feb 2026 17:37:03 +0000 (14:37 -0300)
The sotruss utility printed an incomplete error message when the
ambiguous option --f was used.  The message did not list the possible
matching options, making it unclear how to resolve the ambiguity.

This commit corrects the error message to report all valid alternatives.

Example after this change:

$ sotruss --f /bin/true
sotruss: option '--f' is ambiguous; possibilities: '--from' '--follow'
Try `sotruss --help' or `sotruss --usage' for more information.

This fixes BZ #25257.

Signed-off-by: Avinal Kumar <avinal.xlvii@gmail.com>
Suggested-by: Carlos Santos <casantos@redhat.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
elf/sotruss.sh

index 06216e612f50d078d1a99ba2bbc9fea936924cd6..c90abaaed923e8737f9a150bbf5ee2426770330d 100755 (executable)
@@ -58,7 +58,8 @@ do_missing_arg() {
 }
 
 do_ambiguous() {
-  printf >&2 $"%s: option is ambiguous; possibilities:"
+  printf >&2 $"%s: option '%s' is ambiguous; possibilities:" "sotruss" "$1"
+  shift
   while test $# -gt 0; do
     printf >&2 " '%s'" $1
     shift
@@ -124,7 +125,7 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     SOTRUSS_EXIT=1
     ;;
   --f)
-    do_ambiguous '--from' '--follow'
+    do_ambiguous '--f' '--from' '--follow'
     ;;
   --)
     shift