-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
optparse: fix incorrect error message when invalid short option is grouped with valid short options #1183
Conversation
This error is popping up in travis, in unrelated code. Not sure what to make of it.
|
they did just update the trusty images recently, so perhaps a new warning in a small compiler update? Actually this is a real error, apparently passing any value with a default type promotion before the ellipsis in a variadic function is a no-no. E.g. in this case the enum is promoted to an integer type and I guess isn't exactly defined what the size of the type would be. Will have to find a quick fix. |
Codecov Report
@@ Coverage Diff @@
## master #1183 +/- ##
==========================================
- Coverage 77.82% 77.78% -0.04%
==========================================
Files 158 158
Lines 29255 29257 +2
==========================================
- Hits 22768 22758 -10
- Misses 6487 6499 +12
|
Emit the correct unrecognized option character on error when short options are used and grouped on the commandline. Fixes flux-framework#1179.
Add test that the correct unrecognized short option is displayed in the optparse error messages when getopt calls out unknown option.
Rebased on current master, so we should make it through travis this time. |
One build hit a variant of #1169. Restarting. |
Thanks! |
As described in #1179, optparse error message for unrecognized option is not correct when an invalid short option is used and grouped with one or more valid options.
Fix this by assuming an invalid short option when
optopt != '\0'
and use the char inoptopt
as the unrecognized option in the error output. Otherwise, assume a long option and useargv [optind-1]
as the invalid option to display.Simple tests were also added to ensure valid error messages for unrecognized short options, grouped and ungrouped.