diff options
author | Bill Allombert <ballombe@debian.org> | 2009-03-22 12:22:22 +0100 |
---|---|---|
committer | Raphael Hertzog <hertzog@debian.org> | 2009-03-22 12:48:48 +0100 |
commit | 5ddae0e36402c8694ed63b7caf5018e311129047 (patch) | |
tree | e57b0265e4dfedce248a0b2610f9920e25e97681 | |
parent | cb4288636728df2a9187d042eea8f57f24790d29 (diff) | |
download | dpkg-5ddae0e36402c8694ed63b7caf5018e311129047.tar.gz |
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.
-rw-r--r-- | debian/changelog | 5 | ||||
-rw-r--r-- | src/main.c | 7 |
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]); |