Wrap any extra (user) arguments appended to the pbuilder command with

quotation marks, when needed (LP: #398989).
This commit is contained in:
Siegfried-Angel Gevatter Pujals 2010-09-21 21:25:33 +02:00
parent 4ca97770da
commit 8fda1ebdc1
2 changed files with 17 additions and 1 deletions

2
debian/changelog vendored
View File

@ -16,6 +16,8 @@ ubuntu-dev-tools (0.103) UNRELEASED; urgency=low
* pbuilder-dist: * pbuilder-dist:
- Do not show a warning when "experimental" is used; there is no - Do not show a warning when "experimental" is used; there is no
debootstrap file for it but it should just work anyway. debootstrap file for it but it should just work anyway.
- Wrap any extra (user) arguments appended to the pbuilder command with
quotation marks, when needed (LP: #398989).
* bash_completion/pbuilder-dist: * bash_completion/pbuilder-dist:
- Enable auto-completion for "pbuilder-experimental". - Enable auto-completion for "pbuilder-experimental".

View File

@ -245,8 +245,22 @@ class pbuilder_dist:
if remaining_arguments: if remaining_arguments:
arguments.extend(remaining_arguments) arguments.extend(remaining_arguments)
def quote(argument):
""" quote(argument) -> string
Try to guess any missing quotes around the arguments so that
their meaning doesn't get lost (see LP: #398989).
"""
if argument.startswith('--'):
if '=' in argument:
return '%s="%s"' % tuple(argument.split('=', 1))
return argument
return '"%s"' % argument
return '%s /usr/sbin/%s %s' % (self.auth, self.builder, return '%s /usr/sbin/%s %s' % (self.auth, self.builder,
' '.join(arguments)) ' '.join(map(quote, arguments)))
def ask(question): def ask(question):
""" ask(question) -> string """ ask(question) -> string