[PATCH] elf: Fix ambiguous error message for --f in sotruss [BZ #25257]

Adhemerval Zanella Netto adhemerval.zanella@linaro.org
Tue Dec 23 13:25:43 GMT 2025



On 23/12/25 08:21, Avinal Kumar wrote:
> 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
> --f: option 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>

LGTM, thanks.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>

> ---
> Please refer: https://sourceware.org/bugzilla/show_bug.cgi?id=25257#c0
> 
>  elf/sotruss.sh | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/elf/sotruss.sh b/elf/sotruss.sh
> index 8944645df9..689b3f48e0 100755
> --- a/elf/sotruss.sh
> +++ b/elf/sotruss.sh
> @@ -58,7 +58,8 @@ do_missing_arg() {
>  }
>  
>  do_ambiguous() {
> -  printf >&2 $"%s: option is ambiguous; possibilities:"
> +  printf >&2 $"%s: option is ambiguous; possibilities:" "$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



More information about the Libc-alpha mailing list