1 From: Jean Delvare <jdelvare@suse.de>
2 Subject: compat/getopt: Allow non-digit parameter embedded in short option
4 The compatibility getopt script allows only digit parameters to be
5 embedded in short options. Util-linux's getopt implementation does
6 not have such a restriction and allows any parameter to be embedded
7 in short options. As a consequence, using the compatibility getopt
8 script would choke for example on "-pab", which is a legal option
9 of the "quilt refresh" command.
11 Remove the limitation on digits so that the compatibility getopt
12 script allows what util-linux allows. This fixes the second half
14 https://savannah.nongnu.org/bugs/index.php?54772
16 As a side note, this feature of the compatibility script was broken
17 anyway, as it would output the digits in reverse order.
19 Signed-off-by: Jean Delvare <jdelvare@suse.de>
21 compat/getopt.in | 13 ++++---------
22 1 file changed, 4 insertions(+), 9 deletions(-)
24 --- quilt.orig/compat/getopt.in 2018-10-03 16:05:56.818667040 +0200
25 +++ quilt/compat/getopt.in 2018-10-03 16:12:17.624841732 +0200
26 @@ -108,15 +108,10 @@ foreach my $word (@words) {
27 if (scalar(@letters) == 0) {
28 $need_param = $letter;
30 - # short options can have numerical args
31 - # embedded in the short option list: -UO
32 - die "unexpected character after option $letter"
33 - if ($letters[$#letters] !~ /[0-9]/);
35 - while (scalar(@letters) && ($letters[$#letters] =~ /[0-9]/)) {
36 - push @digits, pop @letters;
38 - push @options, quote_word(join('', reverse @digits));
39 + # short options can have args
40 + # embedded in the short option list
41 + push @options, quote_word(join('', reverse @letters));