[systemd-devel] [PATCH 0/9] Allow \: escapes in nspawn command line

Ronny Chevalier chevalier.ronny at gmail.com
Thu May 28 05:31:18 PDT 2015


On Thu, May 28, 2015 at 2:02 PM, Richard Maw
<richard.maw at codethink.co.uk> wrote:
> File paths may contain : characters, and the nspawn command-line argument
> parser had no way of being able to tell which were part of the paths, or used
> to separate paths.
>
> This is fixable by introducing an escaping mechanism.
>
> The --overlay option had a related problem, as it would still fail if the paths
> contained : characters or , characters, as they are used as path separators for
> the lowerdir union, and as the option separator.
>
> In this case overlayfs has an escaping mechanism, so we just needed to escape
> the paths correctly.
>
>
> This re-uses the existing escaping and parsing logic as much as possible.
> I couldn't find anything that was an exact fit, but unquote_first_word was the
> closest, so I extended the flags a bit and added a variant that accepted a set
> of separator characters, rather than always using whitespace.
>
> I've been running these patches on my system for a day, and tested that I could
> nspawn a system using the changed arguments, but I couldn't get the test suite
> to run, so I may have missed something.

Hi,

Apart from the test suite there is also all the unit tests, it would
be great if you could add unit tests for unescape_first_word and
strv_split_escaped functions (src/test/test-unit.c and
src/test/test-strv.c).

Thanks

>
> Richard Maw (9):
>   util: Add unescape_first_word()
>   nspawn: Allow : characters in --tmpfs path
>   man: Document \: escapes in nspawn's --tmpfs option
>   strv: Add strv_split_escaped
>   nspawn: Allow : characters in nspawn --bind paths
>   man: Document \: escapes in nspawn's --bind option
>   nspawn: escape paths in overlay mount options
>   nspawn: Allow : characters in overlay paths
>   man: Document \: escapes in nspawn's --overlay option
>
>  man/systemd-nspawn.xml |  13 +++++-
>  src/nspawn/nspawn.c    | 119 ++++++++++++++++++++++++++++++++++++++-----------
>  src/shared/strv.c      |   8 +++-
>  src/shared/strv.h      |   1 +
>  src/shared/util.c      |  35 ++++++++++-----
>  src/shared/util.h      |   7 ++-
>  6 files changed, 142 insertions(+), 41 deletions(-)
>
> --
> 1.9.1
>
> _______________________________________________
> systemd-devel mailing list
> systemd-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/systemd-devel


More information about the systemd-devel mailing list