Skip to contentSkip to conversation

docs: Give advice on dealing with quoting special characters

PATCH In review George Dunlap 2 participants 3 messages Apr 23, 2014 – Apr 24, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 docs: Give advice on dealing with quoting special characters

The man page mentions passing config snippets key=val in xl create. Unfortunately, the config syntax contain characters which are interpreted (and often discarded) by the shell before getting passed in, resulting in a parsing error.

For example:

xl create hvm.cfg cpus="0-3"

The shell will eat the quotes and pass 'cpus=0-3' to xl, which won't parse properly without the quotes.

Mention this in the man page, and recommend the use of single quotes, as well as separating multiple arguments with a semicolon, thus:

xl create hvm.cfg 'cpus="0-3"; pci=["1.0","1.1"]'

---
CC: Ian Campbell <[email protected]>
CC: Ian Jackson <[email protected]>

---
 docs/man/xl.pod.1 |   21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)
docs/man/xl.pod.1 +18 -3
index 7c03de6..30bd4bf 100644
@@ -152,6 +152,12 @@ It is possible to pass I<key=value> pairs on the command line to provide
 options as if they were written in the configuration file; these override
 whatever is in the I<configfile>.
 
+NB: Many config options require characters such as quotes or brackets
+which are interpreted by the shell (and often discarded) before being
+passed to xl, resulting in xl being unable to parse the value
+correctly.  A simple work-around is to put all extra options within a
+single set of quotes, separated by semicolons.  (See below for an example.)
+
 =back
 
 B<EXAMPLES>
@@ -165,6 +171,13 @@ B<EXAMPLES>
 This creates a domain with the file /etc/xen/DebianLenny, and returns as
 soon as it is run.
 
+=item I<with extra parameters>
+
+  xl create hvm.cfg 'cpus="0-3"; pci=["01:05.1","01:05.2"]'
+
+This creates a domain with the file hvm.cfg, but additionally pins it to
+cpus 0-3, and passes through two PCI devices.
+
 =back
 
 =item B<config-update> B<domid> [I<configfile>] [I<OPTIONS>]
@@ -186,9 +199,11 @@ Use the given configuration file.
 
 =item B<key=value>
 
-It is possible to pass I<key=value> pairs on the command line to provide
-options as if they were written in the configuration file; these override
-whatever is in the I<configfile>.
+It is possible to pass I<key=value> pairs on the command line to
+provide options as if they were written in the configuration file;
+these override whatever is in the I<configfile>.  Please see the note
+under I<create> on handling special characters when passing
+I<key=value> pairs on the command line.
 
 =back
 
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 2/2 docs: Mention the semicolon as a valid statenment end

---
CC: Ian Campbell <[email protected]>
CC: Ian Jackson <[email protected]>

---
 docs/man/xl.cfg.pod.5 |    8 ++++++++
 1 file changed, 8 insertions(+)
docs/man/xl.cfg.pod.5 +8 -0
index a6663b9..c8ce6c1 100644
@@ -48,6 +48,14 @@ not nested.
 
 The semantics of each C<KEY> defines which form of C<VALUE> is required.
 
+Pairs may be separated either by a newline or a semicolon.  Both
+of the following are valid:
+
+  name="h0"
+  builder="hvm"
+
+  name="h0"; builder="hvm"
+
 =head1 OPTIONS
 
 =head2 Mandatory Configuration Items
Signature · 1 line
1.7.9.5
Acked-by on v1 1/2
#2 lore raw
In reply to George Dunlap

George Dunlap writes ("[PATCH 1/2] docs: Give advice on dealing with quoting special characters"):

Quoted 4 lines

The man page mentions passing config snippets key=val in xl create. Unfortunately, the config syntax contain characters which are interpreted (and often discarded) by the shell before getting passed in, resulting in a parsing error.

Both of these:

Thanks,
Ian.