Bug#279408: [Buildd-tools-devel] Bug#279408: dchroot still does not work well with spaces in arguments

Roger Leigh rleigh at whinlatter.ukfsn.org
Mon Sep 11 21:41:25 UTC 2006


Timo Juhani Lindfors <timo.lindfors at iki.fi> writes:

> although dchroot does not use su(1) anymore I think this bug is still
> present.

This is correct.  It was fixed, but due to breaking backward
compatibility, the broken behaviour was restored in order not to cause
problems to existing users (after a number of bug reports were filed
about it, and there was a lot of confusion on the user mailing list).
If you want proper quoting, you need to quote within quotes with
e.g. \".

From the current dchroot(1) manual page:

       The command is one or more arguments which will be run in the
       user¡Çs default shell using its -c option.  As a result, shell
       code may be embedded in this argument.  If multiple command
       options are used, they are concatenated together, separated by
       spaces.  Users should be aware of the shell quoting issues this
       presents, and should use schroot if necessary, which does not
       have any quoting issues.

To avoid the quoting issues, schroot(1) behaves exactly as you want:

dchroot -c unstable -q -- /tmp/printargs normal a spaces "b c" dash - dashletter -v dashes -- normalagain ee
argv[0] = "/tmp/printargs"
argv[1] = "normal"
argv[2] = "a"
argv[3] = "spaces"
argv[4] = "b"
argv[5] = "c"
argv[6] = "dash"
argv[7] = "-"
argv[8] = "dashletter"
argv[9] = "-v"
argv[10] = "dashes"
argv[11] = "--"
argv[12] = "normalagain"
argv[13] = "ee"

$ schroot -c unstable -q -- /tmp/printargs normal a spaces "b c" dash - dashletter -v dashes -- normalagain ee
argv[0] = "/tmp/printargs"
argv[1] = "normal"
argv[2] = "a"
argv[3] = "spaces"
argv[4] = "b c"
argv[5] = "dash"
argv[6] = "-"
argv[7] = "dashletter"
argv[8] = "-v"
argv[9] = "dashes"
argv[10] = "--"
argv[11] = "normalagain"
argv[12] = "ee"

With schroot, we didn't have to worry about backward compatibility,
and so we could fix this correctly.


Regards,
Roger

-- 
  .''`.  Roger Leigh
 : :' :  Debian GNU/Linux             http://people.debian.org/~rleigh/
 `. `'   Printing on GNU/Linux?       http://gutenprint.sourceforge.net/
   `-    GPG Public Key: 0x25BFB848   Please GPG sign your mail.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 188 bytes
Desc: not available
Url : http://lists.alioth.debian.org/pipermail/buildd-tools-devel/attachments/20060911/359fd601/attachment.pgp


More information about the Buildd-tools-devel mailing list