<feed xmlns='http://www.w3.org/2005/Atom'>
<title>wireguard-openbsd/lib/libc/stdlib/getopt_long.c, branch jd/queueboosts</title>
<subtitle>WireGuard implementation for the OpenBSD kernel</subtitle>
<id>https://git.zx2c4.com/wireguard-openbsd/atom/lib/libc/stdlib/getopt_long.c?h=jd%2Fqueueboosts</id>
<link rel='self' href='https://git.zx2c4.com/wireguard-openbsd/atom/lib/libc/stdlib/getopt_long.c?h=jd%2Fqueueboosts'/>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-openbsd/'/>
<updated>2020-05-27T22:25:09Z</updated>
<entry>
<title>This patch fixes one bug and one instance of undesirable behaviour.</title>
<updated>2020-05-27T22:25:09Z</updated>
<author>
<name>schwarze</name>
<email>schwarze@openbsd.org</email>
</author>
<published>2020-05-27T22:25:09Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-openbsd/commit/?id=0025f5bb9c9be650004db9e38ab09eea44e2b392'/>
<id>urn:sha1:0025f5bb9c9be650004db9e38ab09eea44e2b392</id>
<content type='text'>
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  ===&gt;&gt;  OPT(a)ARG(-a-)ARG(-c)ARG(arg).
Instead, treat the dash as an invalid option and continue parsing
options:  ===&gt;&gt;  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.
</content>
</entry>
<entry>
<title>"eventually" came and went back in 2004.</title>
<updated>2020-03-30T12:52:58Z</updated>
<author>
<name>martijn</name>
<email>martijn@openbsd.org</email>
</author>
<published>2020-03-30T12:52:58Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-openbsd/commit/?id=54774e4694bc26372e6c6c209aa4755f3d0c4c36'/>
<id>urn:sha1:54774e4694bc26372e6c6c209aa4755f3d0c4c36</id>
<content type='text'>
OK schwarze@
</content>
</entry>
<entry>
<title>I am retiring my old email address;  replace it with my OpenBSD one.</title>
<updated>2019-01-25T00:19:25Z</updated>
<author>
<name>millert</name>
<email>millert@openbsd.org</email>
</author>
<published>2019-01-25T00:19:25Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-openbsd/commit/?id=bf198cc6eba0ca1f6d79f71e8e2243d386241fa8'/>
<id>urn:sha1:bf198cc6eba0ca1f6d79f71e8e2243d386241fa8</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Eliminate the last of the LINTEDn and PRINTFLIKEn comments.  In one</title>
<updated>2015-10-01T02:32:07Z</updated>
<author>
<name>guenther</name>
<email>guenther@openbsd.org</email>
</author>
<published>2015-10-01T02:32:07Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-openbsd/commit/?id=9d9553bd2d73b47a1e6c954c7538bf7cd6b06ea5'/>
<id>urn:sha1:9d9553bd2d73b47a1e6c954c7538bf7cd6b06ea5</id>
<content type='text'>
case, by deleting some useless '&amp; of an array' we also eliminate the need
for the casts which prompted the original lint warnings

ok deraadt@
</content>
</entry>
<entry>
<title>Don't wrap initialized variables: binutils appears to be mishandling them</title>
<updated>2015-09-19T04:02:21Z</updated>
<author>
<name>guenther</name>
<email>guenther@openbsd.org</email>
</author>
<published>2015-09-19T04:02:21Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-openbsd/commit/?id=14437dc7d7f86aaf2122120902dad7bca8962f63'/>
<id>urn:sha1:14437dc7d7f86aaf2122120902dad7bca8962f63</id>
<content type='text'>
on arm and m88k

problems with optind observed by jsg@
</content>
</entry>
<entry>
<title>Wrap &lt;getopt.h&gt; to make the functions weak and make access to the initialized</title>
<updated>2015-09-12T14:48:14Z</updated>
<author>
<name>guenther</name>
<email>guenther@openbsd.org</email>
</author>
<published>2015-09-12T14:48:14Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-openbsd/commit/?id=0efd2def317b9301899bd5f4b4036505346a77ee'/>
<id>urn:sha1:0efd2def317b9301899bd5f4b4036505346a77ee</id>
<content type='text'>
variables go direct.  (Common variables cannot be aliased.)
</content>
</entry>
<entry>
<title>Fix parsing of ambiguous options, the whole loop must be processed.</title>
<updated>2013-06-08T22:47:56Z</updated>
<author>
<name>millert</name>
<email>millert@openbsd.org</email>
</author>
<published>2013-06-08T22:47:56Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-openbsd/commit/?id=009fd0113f45a5878b44fabb6589b78cfe4a3a1b'/>
<id>urn:sha1:009fd0113f45a5878b44fabb6589b78cfe4a3a1b</id>
<content type='text'>
From FreeBSD.  OK miod@
</content>
</entry>
<entry>
<title>Fix PR 6267: recheck POSIXLY_CORRECT each time getopt_long() starts a new</title>
<updated>2011-03-05T22:10:11Z</updated>
<author>
<name>guenther</name>
<email>guenther@openbsd.org</email>
</author>
<published>2011-03-05T22:10:11Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-openbsd/commit/?id=ebb4ed69e98da281c0adb4141a4d2f42eeae3ce8'/>
<id>urn:sha1:ebb4ed69e98da281c0adb4141a4d2f42eeae3ce8</id>
<content type='text'>
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@
</content>
</entry>
<entry>
<title>getopt_long.c replaced getopt.c 6+ years ago; we can retire</title>
<updated>2010-07-22T19:31:53Z</updated>
<author>
<name>blambert</name>
<email>blambert@openbsd.org</email>
</author>
<published>2010-07-22T19:31:53Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-openbsd/commit/?id=aa61a0bc07da61e0481789c71dd03290ea337872'/>
<id>urn:sha1:aa61a0bc07da61e0481789c71dd03290ea337872</id>
<content type='text'>
the REPLACE_GETOPT macro, at long last

ok millert@
</content>
</entry>
<entry>
<title>Add parentheses to avoid warning:</title>
<updated>2007-10-31T12:34:57Z</updated>
<author>
<name>chl</name>
<email>chl@openbsd.org</email>
</author>
<published>2007-10-31T12:34:57Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-openbsd/commit/?id=9f3012680dae2b5d7842256f324c96a5ec75265d'/>
<id>urn:sha1:9f3012680dae2b5d7842256f324c96a5ec75265d</id>
<content type='text'>
"suggest parentheses around &amp;&amp; within ||"

ok millert@
</content>
</entry>
</feed>
