Bug 2417867
| Summary: | json_pp complains about duplicate command-line option specs. ignores -v (verbose) flag | ||
|---|---|---|---|
| Product: | [Fedora] Fedora | Reporter: | "FeRD" (Frank Dana) <ferdnyc> |
| Component: | perl-JSON-PP | Assignee: | Paul Howarth <paul> |
| Status: | NEW --- | QA Contact: | Fedora Extras Quality Assurance <extras-qa> |
| Severity: | low | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 43 | CC: | paul, perl-devel |
| Target Milestone: | --- | ||
| Target Release: | --- | ||
| Hardware: | All | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | --- | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | Type: | --- | |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
I've opened PR #1 in the package source repo, to apply upstream commit 7052740e as a patch. https://src.fedoraproject.org/rpms/perl-JSON-PP/pull-request/1 |
With perl-JSON-PP-4.16-521.fc43.noarch, running any `json_pp` command produces a warning message: Duplicate specification "V" for option "v". In addition, it will not accept its verbose option flag (-v), treating it the same as the version flag (-V) Reproducible: Always Steps to Reproduce: 1. json_pp --help 2.echo '{"one": 1}' | json_pp -v Actual Results: First command: Duplicate specification "V" for option "v" Unknown option: help Usage: /usr/bin/json_pp [-V] [-f from_format] [-t to_format] [-json_opt options_to_json1[,options_to_json2[,...]]] Second command: Duplicate specification "V" for option "v" 4.16 Expected Results: First command: Unknown option: help Usage: /usr/bin/json_pp [-V] [-f from_format] [-t to_format] [-json_opt options_to_json1[,options_to_json2[,...]]] Second command: { "one" : 1 } (possibly with verbose processing messages included) Additional Information: The issue occurs because JSON::PP uses Perl Getopt::Long, which has an option 'ignore_case' which is default *enabled*. This option causes the option specs for 'v' (verbose) and 'V' (version) to be interpreted the same, and for the version spec to override the previous verbose spec. Getopt::Long can be made case-sensitive by passing the configuration option 'no_ignore_case' when importing the module. Changing the 'use' statement from: use Getopt::Long; to: use Getopt::Long qw(:config no_ignore_case); Will make the option processing case-sensitive, and restore processing of the verbose (-v) flag as separate from the version (-V) flag. (Note that JSON::PP doesn't appear to _have_ any verbose output, and never actually checks the `$opt_verbose` flag even if set, so in practical terms this change has no effect except to disable a warning message.) This change was already made upstream via PR 93 (https://github.com/makamaka/JSON-PP/pull/93), in this commit: https://github.com/makamaka/JSON-PP/commit/7052740e158491666e4f27d75241617a16170102