| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The bug, present since 4.4BSD, was that a trailing dash in an option
group, when the dash is not permitted as an option letter, resulted
in the whole option group being returned as an argument, even though
the previous option in the group was already parsed as an option:
OPTS=abc ./getopt-test -a- -c arg ===>> OPT(a)ARG(-a-)ARG(-c)ARG(arg).
Instead, treat the dash as an invalid option and continue parsing
options: ===>> OPT(a)ERR(?-)OPT(c)ARG(arg).
The undesirable behaviour was that allowing the dash as an option
letter only allowed isolated dashes ("-") and trailing dashes in
groups ("-a-"), but neither middle dashes in groups ("-a-b"), even
though that already partially worked in 4.4BSD, nor leading dashes
in groups ("--a"), even though that works on all other BSDs and on
glibc. Also, while POSIX does not require that the dash can be
used as an option letter at all, arguably, it encourages that letters
either be fully supported or not supported at all. It is dubious
whether supporting an option letter in some positions but not in
others can be considered conforming.
This patch makes OpenBSD behaviour identical to FreeBSD and NetBSD,
improves compatibility with glibc (except that glibc does not support
isolated "-"), improves compatibility with DragonFly (except that
DragonFly is buggy when the dash option letter can take an optional
argument but that argument is not present), improves compatibility
with Illumos and Solaris 11 (except those do not support "-" and
mishandle "--a"), and restores 4.4BSD behaviour for "-a-b". In no
respect i'm aware of is compatibility with any other systems reduced.
For the full rationale, see my mail to tech@
on 30 Mar 2020 14:26:41 +0200.
Part of the problem was originally reported by an anonymous coward
on tech@ on 12 Mar 2020 03:40:24 +0200, additional analysis was
contributed by martijn@, and then the OP sent the final version of
the patch i'm now committing on 17 Mar 2020 19:17:56 +0200.
No licensing problem here because after the commit, the file does
not contain a single word written by the OP. Also, the OP told me
in private mail that he intends to publish the patch under the ISC
license already contained in the file and that he wishes to be known
by the pseudonym "0xef967c36".
OK martijn@, and no objection when shown on tech@,
but commit delayed to stay clear of the release.
|
|
|
|
| |
OK schwarze@
|
| |
|
|
|
|
|
|
|
| |
case, by deleting some useless '& of an array' we also eliminate the need
for the casts which prompted the original lint warnings
ok deraadt@
|
|
|
|
|
|
| |
on arm and m88k
problems with optind observed by jsg@
|
|
|
|
| |
variables go direct. (Common variables cannot be aliased.)
|
|
|
|
| |
From FreeBSD. OK miod@
|
|
|
|
|
|
|
|
| |
argv and don't suppress the handling of leading '-' in optstring when
POSIXLY_CORRECT is set.
Based on patch from Eric Blake.
ok and manpage update from millert@, manpage ok jmc@
|
|
|
|
|
|
| |
the REPLACE_GETOPT macro, at long last
ok millert@
|
|
|
|
|
|
| |
"suggest parentheses around && within ||"
ok millert@
|
|
|
|
|
|
| |
Log Message:
Switch from 4-clause to 2-clause BSD license.
Ok dillo@, board@.
|
|
|
|
|
|
|
|
|
| |
flag from its optional argument if permutation is disabled. The
idea was that since "r:" would match "-r foo" then "r::" should
match "-r foo" too as long as we know that things have not been
reshuffled. Unfortunately, this causes incompatibilities with GNU
getopt_long when the POSIXLY_CORRECT environment variable is set.
OK deraadt@
|
|
|
|
| |
from ray lai;
|
|
|
|
|
|
| |
Kill old files that are no longer compiled.
okay theo
|
|
|
|
| |
ok otto deraadt
|
|
|
|
| |
disabled. Magne Oestlyngen.
|
|
|
|
|
|
|
|
| |
this can cause confusion when a user tries to use a long option with
a program that only supports short options. Furthermore, it appears
to be in violation of POSIX, which states that "--" shall indicate
the end of argument processing, not any string that begins with "--".
OK otto@ and closes PR 3666.
|
|
|
|
|
|
| |
is set), we can accept an optional arg separated by whitespace. Previously,
the optional arg needed to be adjacent to the option character.
deraadt@ OK
|
|
|
|
| |
where applicable.
|
| |
|
|
|
|
| |
getopt.c is no longer compiled and will eventually be removed.
|
|
|
|
| |
in optstring. Problem noticed by Theo.
|
| |
|
|
|
|
| |
return -1 like POSIX requires.
|
|
|
|
| |
This is used by a few programs such as man and su.
|
| |
|
|
|
|
|
| |
as shortcuts for long ones, but only if this would not conflict with
a short option in optstring. Now binutils gas works.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
o Check for long options even when not at the beginning of an option.
For instance, if -a is a short option w/o an arg and -static is a
boolean long option then -astatic is valid for getopt_long_only().
o If a potential long argument does not match longopts and the first
character is not a short option, print a warning and skip the rest
of the argument.
Also clean up some trailing whitespace and change return value of
parse_long_options() from -2 to -1 when unmatched and in long_only mode.
With these fixes the binutils ld seems happy with our getopt_long_only()
|
|
|
|
| |
is in optstring.
|
|
|
|
|
|
|
|
| |
In order for getopt_only_only() to work we need to check for long
options before short ones. I have merged getopt_internal and
getopt_long_internal into a single function with the actual long
args parsing broken out into a separate function.
This also simplifies the flow of control.
|
| |
|
|
getopt_long_only(). At some point this should replace the BSD
getopt(3) but we are not there yet.
While I am here add protection from the multiple getopt() definitions
due to conflicting standards.
|