https://bugzilla.redhat.com/show_bug.cgi?id=2417867
Bug ID: 2417867
Summary: json_pp complains about duplicate command-line option
specs. ignores -v (verbose) flag
Product: Fedora
Version: 43
Hardware: All
OS: Linux
Status: NEW
Component: perl-JSON-PP
Severity: low
Assignee: [email protected]
Reporter: [email protected]
QA Contact: [email protected]
CC: [email protected], [email protected]
Target Milestone: ---
Classification: Fedora
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
--
You are receiving this mail because:
You are on the CC list for the bug.
https://bugzilla.redhat.com/show_bug.cgi?id=2417867
Report this comment as SPAM:
https://bugzilla.redhat.com/enter_bug.cgi?product=Bugzilla&format=report-spam&short_desc=Report%20of%20Bug%202417867%23c0
--
_______________________________________________
perl-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]
Fedora Code of Conduct:
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives:
https://lists.fedoraproject.org/archives/list/[email protected]
Do not reply to spam, report it:
https://pagure.io/fedora-infrastructure/new_issue