From 2e344c2119c5a55a3180ddd61c67f8a657520ceb Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Sat, 16 Sep 2017 13:43:52 +0200 Subject: Dpkg::Getopt: Do not normalize args past a passthrough stop word Some commands pass some arguments through to another command, and those must not be normalized as that might break their invocation. Reported-by: Helmut Grohne Stable-Candidate: 1.17.x 1.18.x --- scripts/t/Dpkg_Getopt.t | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'scripts/t') diff --git a/scripts/t/Dpkg_Getopt.t b/scripts/t/Dpkg_Getopt.t index 186679636..32edeec53 100644 --- a/scripts/t/Dpkg_Getopt.t +++ b/scripts/t/Dpkg_Getopt.t @@ -16,7 +16,7 @@ use strict; use warnings; -use Test::More tests => 3; +use Test::More tests => 4; BEGIN { use_ok('Dpkg::Getopt'); @@ -24,12 +24,17 @@ BEGIN { my @expect_argv; -@ARGV = normalize_options(qw(-a -bfoo -c var)); +@ARGV = normalize_options(args => [ qw(-a -bfoo -c var) ]); @expect_argv = qw(-a -b foo -c var); is_deeply(\@ARGV, \@expect_argv, 'unbundle short options'); -@ARGV = normalize_options(qw(--option-a --option-b value --option-c=value)); +@ARGV = normalize_options(args => [ qw(--option-a --option-b value --option-c=value) ]); @expect_argv = qw(--option-a --option-b value --option-c value); is_deeply(\@ARGV, \@expect_argv, 'unbundle long options'); +@ARGV = normalize_options(args => [ qw(-aaa -bbb --option-a=oa -- --opt=arg -dval) ], + delim => '--'); +@expect_argv = qw(-a aa -b bb --option-a oa -- --opt=arg -dval); +is_deeply(\@ARGV, \@expect_argv, 'unbundle options with delimiter'); + 1; -- cgit v1.2.3