The following commit has been merged in the master branch:
commit e43fd15f616001727dcc1645a4bbe05ddf639874
Author: Guillem Jover <[email protected]>
Date: Mon Jun 24 01:52:50 2013 +0200
dpkg-name: Require at least one filename after --
This splits the code to first record the arguments to use as filenames,
and then to act on them in a single step, so that we can check if we got
the required filenames.
diff --git a/debian/changelog b/debian/changelog
index 8489a35..dd843e7 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -103,6 +103,7 @@ dpkg (1.17.0) UNRELEASED; urgency=low
* Move the exit call out from usage() in dpkg-scansources so that usageerr()
gives a correct exit code. Thanks to Bernhard R. Link <[email protected]>.
* Print correct error message on unknown dpkg-name options before --.
+ * Require at least one filename on dpkg-name after --.
[ Updated programs translations ]
* Fix typo in Spanish translation of update-alternatives.
diff --git a/scripts/dpkg-name.pl b/scripts/dpkg-name.pl
index b01b2ba..85f1d4f 100755
--- a/scripts/dpkg-name.pl
+++ b/scripts/dpkg-name.pl
@@ -3,7 +3,7 @@
# dpkg-name
#
# Copyright © 1995,1996 Erick Branderhorst <[email protected]>.
-# Copyright © 2006-2010,2012 Guillem Jover <[email protected]>
+# Copyright © 2006-2010,2012-2013 Guillem Jover <[email protected]>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -215,7 +215,7 @@ sub move($)
}
}
-@ARGV || usageerr(_g('need at least a filename'));
+my @files;
while (@ARGV) {
$_ = shift(@ARGV);
@@ -239,15 +239,19 @@ while (@ARGV) {
} elsif (m/^-a|--no-architecture$/) {
$options{architecture} = 0;
} elsif (m/^--$/) {
- foreach (@ARGV) {
- move($_);
- }
- exit 0;
+ push @files, @ARGV;
+ last;
} elsif (m/^-/) {
usageerr(_g("unknown option \`%s'"), $_);
} else {
- move($_);
+ push @files, $_;
}
}
+@files or usageerr(_g('need at least a filename'));
+
+foreach my $file (@files) {
+ move($file);
+}
+
0;
--
dpkg's main repository
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]