Bug 22939 - unintended change of getopt_long_only error message breaks third party tests
Summary: unintended change of getopt_long_only error message breaks third party tests
Status: NEW
Alias: None
Product: glibc
Classification: Unclassified
Component: argparse (show other bugs)
Version: 2.26
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL: https://bugzilla.altlinux.org/34623
Keywords:
Depends on:
Blocks:
 
Reported: 2018-03-08 14:49 UTC by Dmitry V. Levin
Modified: 2018-03-20 17:02 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:
ldv: security-


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dmitry V. Levin 2018-03-08 14:49:41 UTC
This is downstream bug report https://bugzilla.altlinux.org/34623:

"The current getopt_long output from glibc >= 2.26 is:

$ LANG=C getopt -a -n TEST -o 'a,b,c' -l 'caa:,cba:' -- -c='AAA' 
TEST: option '-c=AAA' is ambiguous; possibilities: '-caa' '-cba'

but in glibc <= 2.25 the output was:

$ LANG=C getopt -a -n TEST -o 'a,b,c' -l 'caa:,cba:' -- -c='AAA' 
TEST: option '-c=AAA' is ambiguous; possibilities: '--caa' '--cba'

Some tests in libshell and util-linux compare the output of getopt command to
the reference output. These tests broke.

The new error output does not look correct because the variants are searched
among the long options. Also the `-cba' is more like a shortened `-c -b -a'."
Comment 1 Dmitry V. Levin 2018-03-08 14:51:43 UTC
The change of error output is a side effect of commit glibc-2.26~634:
https://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=glibc-2.25.90-191-gaeacb9f

The commit message does not look as if the side effect was intended.
Comment 2 Andreas Schwab 2018-03-20 17:02:38 UTC
On the other hand, the new message follows the spelling of the argument:

$ getopt -a -n TEST -o 'a,b,c' -l 'caa:,cba:' -- --c='AAA'
TEST: option '--c=AAA' is ambiguous; possibilities: '--caa' '--cba'

-caa is a completion of -c and --caa is a completion of --c, but not the other way round.