bugzilla-daemon at mindrot.org
2013-May-10 04:27 UTC
[Bug 1448] Report wrong command-line options
https://bugzilla.mindrot.org/show_bug.cgi?id=1448 Darren Tucker <dtucker at zip.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |dtucker at zip.com.au --- Comment #4 from Darren Tucker <dtucker at zip.com.au> --- whatever it is, it doesn't seem to be gnu-getopt specific. or if it is, it's not enabled with the default set of defines. #include <stdio.h> #include <unistd.h> int main(int argc, char **argv) { int ch; while ((ch = getopt(argc, argv, "abc:")) != -1) { printf("opt %c optarg %s\n", ch, optarg ? optarg : "(null)"); } } gives me: $ ./a.out --foo ./a.out: invalid option -- '-' opt ? optarg (null) ./a.out: invalid option -- 'f' opt ? optarg (null) ./a.out: invalid option -- 'o' opt ? optarg (null) ./a.out: invalid option -- 'o' opt ? optarg (null) whatever it is, I think it's in our compat library: $ nm scp | grep -i getop 08051710 T BSDgetopt -- You are receiving this mail because: You are watching the assignee of the bug. You are watching someone on the CC list of the bug.
bugzilla-daemon at mindrot.org
2013-May-10 04:32 UTC
[Bug 1448] Report wrong command-line options
https://bugzilla.mindrot.org/show_bug.cgi?id=1448 --- Comment #5 from Darren Tucker <dtucker at zip.com.au> --- sure looks like something of ours: $ gcc getopt-test.c -Dgetopt=BSDgetopt openbsd-compat/libopenbsd-compat.a $ ./a.out -a opt a optarg (null) $ ./a.out --foo $ -- You are receiving this mail because: You are watching the assignee of the bug. You are watching someone on the CC list of the bug.
bugzilla-daemon at mindrot.org
2013-May-10 05:20 UTC
[Bug 1448] Report wrong command-line options
https://bugzilla.mindrot.org/show_bug.cgi?id=1448 --- Comment #6 from Darren Tucker <dtucker at zip.com.au> --- ok, so it turns out the original upstream source in OpenBSD's getopt.c had the same behaviour, but was replaced in 2004 with getopt_long.c which doesn't. For long-term maintainability I think we should switch. What I'm going to do is 1) factor out the portability changes in getopt.c 2) add getopt_long.c to openssh and remove getopt.c 3) pull the portability changes into getopt_long.c -- You are receiving this mail because: You are watching the assignee of the bug. You are watching someone on the CC list of the bug.
bugzilla-daemon at mindrot.org
2013-May-10 06:09 UTC
[Bug 1448] Report wrong command-line options
https://bugzilla.mindrot.org/show_bug.cgi?id=1448 --- Comment #7 from Darren Tucker <dtucker at zip.com.au> --- Created attachment 2257 --> https://bugzilla.mindrot.org/attachment.cgi?id=2257&action=edit Factor out portability changes in getopt.c -- You are receiving this mail because: You are watching the assignee of the bug. You are watching someone on the CC list of the bug.
bugzilla-daemon at mindrot.org
2013-May-10 06:10 UTC
[Bug 1448] Report wrong command-line options
https://bugzilla.mindrot.org/show_bug.cgi?id=1448 --- Comment #8 from Darren Tucker <dtucker at zip.com.au> --- Created attachment 2258 --> https://bugzilla.mindrot.org/attachment.cgi?id=2258&action=edit import getopt_long.c from openbsd -- You are receiving this mail because: You are watching the assignee of the bug. You are watching someone on the CC list of the bug.
bugzilla-daemon at mindrot.org
2013-May-10 06:11 UTC
[Bug 1448] Report wrong command-line options
https://bugzilla.mindrot.org/show_bug.cgi?id=1448 --- Comment #9 from Darren Tucker <dtucker at zip.com.au> --- Created attachment 2259 --> https://bugzilla.mindrot.org/attachment.cgi?id=2259&action=edit apply portability changes to getopt_long.c switch over to it and remove getopt.c -- You are receiving this mail because: You are watching the assignee of the bug. You are watching someone on the CC list of the bug.
bugzilla-daemon at mindrot.org
2013-May-10 06:29 UTC
[Bug 1448] Report wrong command-line options
https://bugzilla.mindrot.org/show_bug.cgi?id=1448 Darren Tucker <dtucker at zip.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|REOPENED |RESOLVED Resolution|--- |FIXED Blocks| |2076 --- Comment #10 from Darren Tucker <dtucker at zip.com.au> --- With these changes I get the following for your testcase: $ touch a; ./scp --foobarbaz a b unknown option -- - usage: scp [-12346BCpqrv] [-c cipher] [-F ssh_config] [-i identity_file] [-l limit] [-o ssh_option] [-P port] [-S program] [[user@]host1:]file1 ... [[user@]host2:]file2 Thanks for the report (and patience :-). These changes will be in the 6.3p1 release. -- You are receiving this mail because: You are watching the assignee of the bug. You are watching someone on the CC list of the bug.
bugzilla-daemon at mindrot.org
2013-May-10 09:30 UTC
[Bug 1448] Report wrong command-line options
https://bugzilla.mindrot.org/show_bug.cgi?id=1448 --- Comment #11 from bonniot at gmail.com --- Thank you for the fix :) Any chance the portability fixes could be applied upstream? -- You are receiving this mail because: You are watching the assignee of the bug. You are watching someone on the CC list of the bug.
bugzilla-daemon at mindrot.org
2013-May-10 10:07 UTC
[Bug 1448] Report wrong command-line options
https://bugzilla.mindrot.org/show_bug.cgi?id=1448 --- Comment #12 from Darren Tucker <dtucker at zip.com.au> --- It's already as upstream as it gets. The file with the bug in openbsd is dead, and the current version of the current file is fine. -- You are receiving this mail because: You are watching the assignee of the bug. You are watching someone on the CC list of the bug.
Apparently Analagous Threads
- [Bug 1448] New: Report wrong command-line options
- multiple definition of `optind'
- [PATCH] No extern declarations of optarg & co if getopt.h is available
- [nbdkit PATCH] main: More idiomatic use of getopt_long
- [PATCH] New '-o' option to configure server or hosts from command line