Skip to contentSkip to conversation

docs/system: Clarify local filename escaping in device URLs

PATCH New nanliu 1 participant 1 message Nov 20, 2025

lore
Share & tools
lore

nanliu

author
#0 lore raw

PATCH 1/1 docs/system: Clarify local filename escaping in device URLs

The documentation currently lacks explicit information on how to escape a local filename if it contains characters that cause it to be parsed as a protocol (e.g., containing a ':').

Use two methods to avoid this:
1. use the explicit prefix ``file:`` (e.g. ``-cdrom file:foo:bar.iso``).
2. use a path with ``./`` in it (e.g. ``-cdrom ./foo:bar.iso``)

---
 docs/system/device-url-syntax.rst.inc | 8 ++++++++
 1 file changed, 8 insertions(+)
docs/system/device-url-syntax.rst.inc +8 -0
index 43b5c2596b..e7aa2be721 100644
@@ -43,6 +43,14 @@ These are specified using a special URL syntax.
       LIBISCSI_CHAP_PASSWORD="password" \\
       |qemu_system| -drive file=iscsi://192.0.2.1/iqn.2001-04.com.example/1
 
+   Note on path parsing: If a local filename used with a device
+   option (e.g., ``-cdrom``) contains a colon (``:``), QEMU may
+   interpret it as a URL protocol; use the explicit prefix ``file:``
+   (e.g. ``-cdrom file:foo:bar.iso``) or a path with ``./`` in it
+   (e.g. ``-cdrom ./foo:bar.iso``) to ensure correct local file
+   resolution, and avoid using ``file://`` which may lead to
+   incorrect path resolution.
+
 ``NBD``
    QEMU supports NBD (Network Block Devices) both using TCP protocol as
    well as Unix Domain Sockets. With TCP, the default port is 10809.
Signature · 1 line
2.51.1