summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--debian/changelog5
-rw-r--r--src/main.c7
2 files changed, 11 insertions, 1 deletions
diff --git a/debian/changelog b/debian/changelog
index 66ae3cf20..c4555f272 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 c892af322..3debe1308 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]);