[prev in list] [next in list] [prev in thread] [next in thread]
List: busybox-cvs
Subject: [Bug 9861] New: Posix 12.2 Guideline 9 violation: options parsed after operands (found on awk)
From: bugzilla () busybox ! net
Date: 2017-05-11 19:19:59
Message-ID: bug-9861-161 () https ! bugs ! busybox ! net/
[Download RAW message or body]
https://bugs.busybox.net/show_bug.cgi?id=9861
Bug ID: 9861
Summary: Posix 12.2 Guideline 9 violation: options parsed after
operands (found on awk)
Product: Busybox
Version: 1.23.x
Hardware: All
OS: Linux
Status: NEW
Severity: normal
Priority: P5
Component: Standard Compliance
Assignee: unassigned@busybox.net
Reporter: camerisdump@gmail.com
CC: busybox-cvs@busybox.net
Target Milestone: ---
busybox, at least its awk utility, does not conform to Posix 12.2 Guideline 9
(http://pubs.opengroup.org/onlinepubs/9699919799/), options come before
operands, hence arguments after the first operand should not tried to be parsed
as options:
$ awk 'BEGIN { for(i=1; i<ARGC; ++i) { print i ": " ARGV[i] }}' -some --args
awk: invalid option -- s
$ gawk 'BEGIN { for(i=1; i<ARGC; ++i) { print i ": " ARGV[i] }}' -some --args
1: -some
2: --args
the awk-program clearly is the first operand. another example:
$ awk 'BEGIN { for(i=1; i<ARGC; ++i) { print i ": " ARGV[i] }}' -- -some
--args
1: -some
2: --args
$ gawk 'BEGIN { for(i=1; i<ARGC; ++i) { print i ": " ARGV[i] }}' -- -some
--args
1: --
2: -some
3: --args
workaround, explicitly declare end of options before the program:
$ awk -- 'BEGIN { for(i=1; i<ARGC; ++i) { print i ": " ARGV[i] }}' -some
--args
1: -some
2: --args
$ gawk -- 'BEGIN { for(i=1; i<ARGC; ++i) { print i ": " ARGV[i] }}' -some
--args
1: -some
2: --args
In other words, the first argument that is not an option or option-argument
should have the same effect as encountering the -- argument.
Unfortunatley I can't think of any other utility that could also be affected by
this.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
busybox-cvs mailing list
busybox-cvs@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox-cvs
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic