Bug#864544: libgetopt-long-descriptive-perl: option value : and :+ processing are very broken
Graham Cobb
g+debian at cobb.uk.net
Sat Jun 10 11:35:55 UTC 2017
Package: libgetopt-long-descriptive-perl
Version: 0.100-1
Severity: important
Dear Maintainer,
I have just realised that a long-established cron job is not doing what it should as
Getopt::Long processing of option values is broken. I do not know when this happened.
It used to work but it no longer does so, and I notice that Getopt::Long in debian
seems to have been replaced by Getopt::Long::Descriptive. I assume that
Getopt::Long::Descriptive is the problem but I have not gone back and tested with the
CPAN version of Getopt::Long to be sure.
The problem is that the implementation of ":i" and ":+" is wrong, compared with the
documentation of (and earlier behaviour of) Getopt::Long.
The examples below use the following test script (getopt-test.pl):
#!/usr/bin/perl
use strict;
use warnings;
use Getopt::Long 2.33 qw(:config gnu_getopt auto_help auto_version);
my $VERBOSITY = 0;
my $HISTORY = 0;
GetOptions(
"verbose|v:+" => \$VERBOSITY,
"history|h:1" => \$HISTORY
);
print "VERBOSITY = $VERBOSITY\n";
print "HISTORY = $HISTORY\n";
The first problem is that ":1" does not allow the value to be set except using "=".
For example, none of the following commands set the value of $HISTORY:
getopt-test.pl -h
getopt-test.pl -h 2
getopt-test.pl -h2
getopt-test.pl --history
getopt-test.pl --history 2
The second problem is that ":+" does not increment the value.
For example, none of the following commands set the value of $VERBOSITY:
getopt-test.pl -v
getopt-test.pl -vvvv
getopt-test.pl -v3
getopt-test.pl --verbose
getopt-test.pl --verbose 2
Extracts from the documentation of Getopt::Long:
: number [ desttype ]
Like :i, but if the value is omitted, the number will be assigned.
: + [ desttype ]
Like :i, but if the value is omitted, the current value for the option will be incremented.
If this bug is in the upstream version of Getopt::Long::Descriptive and cannot be fixed,
then debian should revert to packaging Getopt::Long.
-- System Information:
Debian Release: 9.0
APT prefers testing
APT policy: (500, 'testing')
Architecture: amd64
(x86_64)
Foreign Architectures: i386
Kernel: Linux 4.9.0-3-amd64 (SMP w/8 CPU cores)
Locale: LANG=en_IE.utf8, LC_CTYPE=en_IE.utf8 (charmap=UTF-8) (ignored: LC_ALL set to en_IE.utf8)
Shell: /bin/sh linked to /bin/bash
Init: systemd (via /run/systemd/system)
Versions of packages libgetopt-long-descriptive-perl depends on:
ii libio-stringy-perl 2.111-2
ii libparams-validate-perl 1.26-1
ii libsub-exporter-perl 0.986-1
ii perl 5.24.1-2
libgetopt-long-descriptive-perl recommends no packages.
libgetopt-long-descriptive-perl suggests no packages.
-- no debconf information
More information about the pkg-perl-maintainers
mailing list