On Tue, 23 Jun 2009 19:59:10 +0100
Neil Williams <codehelp@debian.org> wrote:
> What goes wrong is with:
>
> $ emdebuild build-dep
>
> I'll investigate that one. Please file a bug so that I don't forget.
>
> (emdebuild should only pass on arguments after ' -- ')
The only fix is to look for a space (i.e. new argument in @ARGV)
without a following dash. We're lucky here, dpkg-buildpackage currently
insists that every option that requires an argument must *NOT* have a
space between the last character of the option name and the first
character of the argument value:
e.g. -aarmel is valid, -a armel is not.
Whether this kind of issue is the reason why dpkg-buildpackage does
this when *so* many other perl scripts (including quite a few dpkg
ones) do not, I have no idea. It has been an annoyance over the years
because dpkg-buildpackage -a armel is not valid but emdebuild -a armel
is and vice-versa. Turns out, it's just as well that the two can work
differently so that it is easier to tell the option sets apart.
Trapping this would also prevent:
$ emdebuild -- build-dep
Now, currently, that isn't a problem but it does tend to assume that
dpkg-buildpackage will continue to operate as now.
$ emdebuild -- -e foobar
is (luckily for us) wrong for dpkg-buildpackage, it would need to be:
$ emdebuild -- -efoobar
which does work (with and without the trap in place).
Patch to implement a trap for invalid options to dpkg-buildpackage:
Index: emdebuild
===================================================================
--- emdebuild (revision 6528)
+++ emdebuild (working copy)
@@ -175,6 +175,8 @@
$dpkg_extra = "-us -uc ";
foreach my $dopt (@ARGV)
{
+ die (RED, "invalid option for dpkg-buildpackage: $dopt", RESET, "\n")
+ if ($dopt !~ /^\-/);
next if ($dopt =~ /-a(.*)/);
$dpkg_extra .= $dopt . " ";
}
I'll probably change that to a warn, followed by &usageversion; and
exit (2) or something.
--
Neil Williams
=============
http://www.data-freedom.org/
http://www.nosoftwarepatents.com/
http://www.linux.codehelp.co.uk/
Attachment:
pgpVzvaBDhiXp.pgp
Description: PGP signature