This service will be undergoing maintenance at 00:00 UTC, 2016-09-28. It is expected to last about 1 hours
Bug 431005 - parse_long_options doesn't respect "--"
parse_long_options doesn't respect "--"
Status: CLOSED NOTABUG
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: coreutils (Show other bugs)
4.8
All Linux
low Severity low
: rc
: ---
Assigned To: Ondrej Vasik
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2008-01-30 20:49 EST by A. Non
Modified: 2010-02-22 07:35 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2010-02-22 07:35:52 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description A. Non 2008-01-30 20:49:02 EST
Description of problem:
I think that parse_long_options() in long-options.c is broken in a few very
minor ways.

There appears to be no way for echo to print out the string "-n" or "--help" or
the other things that happen to be options because it doesn't respect "--" like
most other things do.

The fact that parse_long_options() looks at argc when deciding whether to parse
options is also kind of strange and leads to this funny error:
% sleep --help --version
sleep: unrecognized option `--help'
Try `sleep --help' for more information.

The fact that I can't get yes to repeatedly print out "--help" is odd but not a
huge issue.  The fact that echo can't print out a literal "-n" seems like it
might be a (minor) problem, though.


Version-Release number of selected component (if applicable):
GNU coreutils 5.2.1
The unnecessary argc check seems to still be in the source code for coreutils 6.10.

How reproducible:
Always reproducible via "sleep --help --version" or "echo -- -n"

Actual results:
"echo -- -n" prints out "-- -n" instead of "-n"

Expected results:
"-n"
Comment 1 Ondrej Vasik 2008-01-31 11:56:20 EST
Fixed and built as coreutils-6.10-4.fc9 in fedora RAWHIDE branch. 
Comment 2 Ondrej Vasik 2008-03-13 07:00:06 EDT
Well, echo change was not accepted by upstream (as not justified and potentially
breaking scripts), so I will remove that functionality from Fedora in next
coreutils builds. In fact you could use POSIXLY_CORRECT env.variable or printf 
command for such things. POSIX says do not use any options in echo. So that one
part is NOTABUG (full thread on upstream mailing list is
http://lists.gnu.org/archive/html/bug-coreutils/2008-03/msg00111.html)...
Comment 3 Michael Cronenworth 2008-03-28 10:40:41 EDT
Thanks for reverting this. This did break scripts, at least for me.

The only reason I knew this was changed was from the RPM changelog. I didn't see
any mention of you reverting this in the changelog, but my scripts work now.

Note You need to log in before you can comment on or make changes to this bug.