summaryrefslogtreecommitdiffstats
path: root/compat
diff options
context:
space:
mode:
authorJean Delvare <jdelvare@suse.de>2018-10-09 10:04:55 +0200
committerJean Delvare <jdelvare@suse.de>2018-10-09 10:04:55 +0200
commit26c0978cfa51d8810b240b2de768bc53d209733a (patch)
tree981ef6fbe1b3d2dfb5accd111ef83cf69d98f9ed /compat
parent59f1977e03b0515c5fc0bc52c1fc46061d158831 (diff)
downloadquilt-26c0978cfa51d8810b240b2de768bc53d209733a.tar.gz
compat/getopt: Allow non-digit parameter embedded in short option
The compatibility getopt script allows only digit parameters to be embedded in short options. Util-linux's getopt implementation does not have such a restriction and allows any parameter to be embedded in short options. As a consequence, using the compatibility getopt script would choke for example on "-pab", which is a legal option of the "quilt refresh" command. Remove the limitation on digits so that the compatibility getopt script allows what util-linux allows. This fixes the second half of bug #54772: https://savannah.nongnu.org/bugs/index.php?54772 As a side note, this feature of the compatibility script was broken anyway, as it would output the digits in reverse order. Signed-off-by: Jean Delvare <jdelvare@suse.de>
Diffstat (limited to 'compat')
-rw-r--r--compat/getopt.in13
1 files changed, 4 insertions, 9 deletions
diff --git a/compat/getopt.in b/compat/getopt.in
index 678e355..8bb60e8 100644
--- a/compat/getopt.in
+++ b/compat/getopt.in
@@ -108,15 +108,10 @@ foreach my $word (@words) {
if (scalar(@letters) == 0) {
$need_param = $letter;
} else {
- # short options can have numerical args
- # embedded in the short option list: -UO
- die "unexpected character after option $letter"
- if ($letters[$#letters] !~ /[0-9]/);
- my @digits;
- while (scalar(@letters) && ($letters[$#letters] =~ /[0-9]/)) {
- push @digits, pop @letters;
- }
- push @options, quote_word(join('', reverse @digits));
+ # short options can have args
+ # embedded in the short option list
+ push @options, quote_word(join('', reverse @letters));
+ @letters = ();
}
}
}