Skip to content

Commit

Permalink
qemu-options: Clarify handling of commas in options parameters
Browse files Browse the repository at this point in the history
Provide explicit guidance on dealing with option parameters as arbitrary
strings containing commas, such as in "file=my,file" and "string=a,b". The
updated documentation emphasizes the need to double commas when they
appear within such parameters.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1839
Signed-off-by: Yihuan Pan <xun794@gmail.com>
Message-ID: <20231213141706.629833-2-xun794@gmail.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
  • Loading branch information
Xunop authored and huth committed Dec 20, 2023
1 parent 81c2c9d commit fd49b21
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
5 changes: 5 additions & 0 deletions docs/system/invocation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ Invocation
disk_image is a raw hard disk image for IDE hard disk 0. Some targets do
not need a disk image.

When dealing with options parameters as arbitrary strings containing
commas, such as in "file=my,file" and "string=a,b", it's necessary to
double the commas. For instance,"-fw_cfg name=z,string=a,,b" will be
parsed as "-fw_cfg name=z,string=a,b".

.. hxtool-doc:: qemu-options.hx

Device URL Syntax
Expand Down
5 changes: 5 additions & 0 deletions docs/system/qemu-manpage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ Options
disk_image is a raw hard disk image for IDE hard disk 0. Some targets do
not need a disk image.

When dealing with options parameters as arbitrary strings containing
commas, such as in "file=my,file" and "string=a,b", it's necessary to
double the commas. For instance,"-fw_cfg name=z,string=a,,b" will be
parsed as "-fw_cfg name=z,string=a,b".

.. hxtool-doc:: qemu-options.hx

.. include:: keys.rst.inc
Expand Down
4 changes: 4 additions & 0 deletions qemu-options.hx
Original file line number Diff line number Diff line change
Expand Up @@ -4086,9 +4086,13 @@ DEF("fw_cfg", HAS_ARG, QEMU_OPTION_fwcfg,
SRST
``-fw_cfg [name=]name,file=file``
Add named fw\_cfg entry with contents from file file.
If the filename contains comma, you must double it (for instance,
"file=my,,file" to use file "my,file").

``-fw_cfg [name=]name,string=str``
Add named fw\_cfg entry with contents from string str.
If the string contains comma, you must double it (for instance,
"string=my,,string" to use file "my,string").

The terminating NUL character of the contents of str will not be
included as part of the fw\_cfg item data. To insert contents with
Expand Down

0 comments on commit fd49b21

Please sign in to comment.