Bug 34623 - getopt_long: unintended change of error message breaks third party tests
Summary: getopt_long: unintended change of error message breaks third party tests
Status: ASSIGNED
Alias: None
Product: Sisyphus
Classification: Development
Component: glibc-core (show other bugs)
Version: unstable
Hardware: all Linux
: P3 normal
Assignee: placeholder@altlinux.org
QA Contact: qa-sisyphus
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-03-08 12:44 MSK by Alexey Gladkov
Modified: 2018-03-08 17:52 MSK (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alexey Gladkov 2018-03-08 12:44:59 MSK
Current getopt_long from the glibc-2.27-alt1 output:

$ 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 before 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'.

Do I have to correct tests for a new message everywhere?
Comment 1 Dmitry V. Levin 2018-03-08 16:35:51 MSK
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 Alexey Gladkov 2018-03-08 16:50:30 MSK
Will the error message be fixed ?
Comment 3 Alexey Gladkov 2018-03-08 16:59:45 MSK
It was easy to miss that prefix variable does not always contain `--'.
It looks like glibc doesn't have enough tests for getopt_long. :))
Comment 4 Dmitry V. Levin 2018-03-08 17:52:55 MSK
Forwarded to https://sourceware.org/bugzilla/show_bug.cgi?id=22939