The following commit has been merged in the master branch:
commit 5ddae0e36402c8694ed63b7caf5018e311129047
Author: Bill Allombert <[email protected]>
Date: Sun Mar 22 12:22:22 2009 +0100
dpkg: separate arguments with "--" when calling dpkg-{deb,query}
This is needed because any user-supplied argument separator is stripped by
the option parser such as "dpkg -S -- -pic" ends up calling "dpkg-query
--search -pic" which fails. With this patch, it calls "dpkg-query --search
-- -pic" and works as expected.
diff --git a/debian/changelog b/debian/changelog
index 66ae3cf..c4555f2 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -38,6 +38,11 @@ dpkg (1.15.1) UNRELEASED; urgency=low
even when some symbols are associated with a (fake) version "0". Such a
version means that the symbol has always existed in all versions of the
package.
+ * When dpkg delegates to dpkg-query or dpkg-deb to do the actual work, add
+ the "--" marker to explicitely document the end of options so that
+ arguments starting with a dash are not interpreted as options.
+ Closes: #293163
+ Thanks to Bill Allombert for the patch.
[ Guillem Jover ]
* Fix typo in dpkg output (‘unexecpted’ → ‘unexpected’). Closes: #519082
diff --git a/src/main.c b/src/main.c
index c892af3..3debe13 100644
--- a/src/main.c
+++ b/src/main.c
@@ -499,7 +499,7 @@ void execbackend(const char *const *argv) {
pass_admindir = 1;
}
- nargv = m_malloc(sizeof(char *) * (argc + 2));
+ nargv = m_malloc(sizeof(char *) * (argc + 3));
nargv[i] = m_strdup(cipaction->parg);
i++, offset++;
@@ -515,6 +515,11 @@ void execbackend(const char *const *argv) {
strcat(nargv[i], cipaction->olong);
i++, offset++;
+ /* Exlicitely separate arguments from options as any user-supplied
+ * separator got stripped by the option parser */
+ nargv[i] = "--";
+ i++, argc++, offset++;
+
/* Copy arguments from argv to nargv. */
for (; i <= argc; i++)
nargv[i] = m_strdup(argv[i - offset]);
--
dpkg's main repository
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]