[systemd-devel] [PATCH 0/9] Allow \: escapes in nspawn command line
richard.maw at codethink.co.uk
Thu May 28 05:02:06 PDT 2015
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.
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(-)
More information about the systemd-devel