[buildd-tools-devel] Bug#782672: patch

Dima Kogan dima at secretsauce.net
Tue Apr 21 19:38:48 UTC 2015


retitle 782672 [PATCH] sbuild: Extra command parsing is overly-complex and broken
tags 782672 patch
thanks

I made a patch to address this. It's attached. The patch says that it's
2/3 in a series, but this is the only one relevant to this issue.

Notes:

when handling external commands (--starting-build-commands and others),
I now keep the input string as is, and pass it to the shell, instead of
splitting it on whitespace and then reassembling it. This reassembling
was being done improperly, with shell internals such as < being
erroneously escaped (doing it right is way more work than simply keeping
the original string). Keeping the string as is allows the user to give
the command they want.

This is implemented by keeping the COMMAND and INTCOMMAND keys same as
they were (array-refs of strings), but adds additional COMMAND_STR and
INTCOMMAND_STR keys that have the string representation. The non-STR
versions are always populated, and the external command options populate
the _STR ones as well. When running the commands, we use the _STR
options if we have them, otherwise, we recombine as before.

Since the old array-ref-based code path is still there, old commandlines
and configurations remain working.

The big win so far is that I can get an interactive shell going. It's
not ideal yet since I have to manually redirect the pty, and there's
some stdout buffering thing I haven't tried to fix, but it's already
super useful:

    $ ls -l /dev/stdin(:A)
    crw------- 1 dkogan tty 136, 1 Apr 21 12:42 /dev/pts/1

    $ sbuild .... --starting-build-commands 'sh -i < /dev/pts/1 >
    /dev/pts/1'

    +------------------------------------------------------------------------------+
    | Starting Timed Build Commands                                                |
    +------------------------------------------------------------------------------+


    sh -i < /dev/pts/1 > /dev/pts/1
    -------------------------------

    pwd
    /build/cross-gcc-4.9-i386-uMV_ms



-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-external-commands-are-now-unparsed-strings.patch
Type: text/x-diff
Size: 13603 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/buildd-tools-devel/attachments/20150421/d605fd75/attachment.patch>


More information about the Buildd-tools-devel mailing list