Bug 2073743
Summary: | getopt_long: manual clarification: getopt_long long option names may be abbreviated | ||
---|---|---|---|
Product: | Red Hat Enterprise Linux 9 | Reporter: | Abdul Rehman Quadri <aquadri> |
Component: | glibc | Assignee: | glibc team <glibc-bugzilla> |
Status: | CLOSED ERRATA | QA Contact: | Sergey Kolosov <skolosov> |
Severity: | medium | Docs Contact: | |
Priority: | medium | ||
Version: | 9.0 | CC: | aboscatt, ashankar, codonell, cww, dj, fweimer, ipedrosa, mnewsome, pbrezina, pfrankli, sipoyare |
Target Milestone: | rc | Keywords: | Bugfix, Patch, Triaged |
Target Release: | --- | ||
Hardware: | All | ||
OS: | Linux | ||
URL: | http// | ||
Whiteboard: | |||
Fixed In Version: | glibc-2.34-35.el9 | Doc Type: | No Doc Update |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2022-11-15 11:11:50 UTC | Type: | Bug |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: | |||
Bug Depends On: | 2091541 | ||
Bug Blocks: | 2010412 |
Description
Abdul Rehman Quadri
2022-04-10 05:46:06 UTC
*** Bug 2069680 has been marked as a duplicate of this bug. *** As mentioned in https://bugzilla.redhat.com/show_bug.cgi?id=2069680#c1 the good option is "badnames", so the other ones shouldn't work. As you are playing around, can you try "--ba" and "--badnamesblablabla" options? (In reply to Iker Pedrosa from comment #2) > As mentioned in https://bugzilla.redhat.com/show_bug.cgi?id=2069680#c1 the > good option is "badnames", so the other ones shouldn't work. > Thank you for the comment. > As you are playing around, can you try "--ba" and "--badnamesblablabla" > options? > Yeah, Tried that and it is not working, "--ba" and "--badnamesblablabla" both the options are showing invalid. shadow-utils is using the getopt_long() API to parse the command line arguments. I would expect this API to only match the exact string with an option, but it is matched even if some characters are missing (--bad, --badn, --badna, etc.). I don't see any reference to this in the man page. Siddhesh could you please clarify if this is intentional? (In reply to Iker Pedrosa from comment #4) > shadow-utils is using the getopt_long() API to parse the command line > arguments. I would expect this API to only match the exact string with an > option, but it is matched even if some characters are missing (--bad, > --badn, --badna, etc.). I don't see any reference to this in the man page. > Siddhesh could you please clarify if this is intentional? There is no reference to this behaviour in the glibc manual, but there is in the man page and in code comments. Excerpt from the `man getopt_long` on F35: getopt_long() and getopt_long_only() ... Long option names may be abbreviated if the abbreviation is unique or is an exact match for some defined option. ... (In reply to Siddhesh Poyarekar from comment #5) > (In reply to Iker Pedrosa from comment #4) > > shadow-utils is using the getopt_long() API to parse the command line > > arguments. I would expect this API to only match the exact string with an > > option, but it is matched even if some characters are missing (--bad, > > --badn, --badna, etc.). I don't see any reference to this in the man page. > > Siddhesh could you please clarify if this is intentional? > > There is no reference to this behaviour in the glibc manual, but there is in > the man page and in code comments. Excerpt from the `man getopt_long` on > F35: > > getopt_long() and getopt_long_only() > ... > Long option names may be abbreviated if the abbreviation is unique or is > an exact match for some defined option. > ... ... and to close the gap, I've posted a glibc patch upstream to also document this behaviour in the glibc manual: https://patchwork.sourceware.org/project/glibc/patch/20220503045743.2887439-1-siddhesh@sourceware.org/ Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory (glibc bug fix and enhancement update), and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHBA-2022:8272 |