]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Limit ephemeral filename length
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Fri, 23 Feb 2024 11:08:56 +0000 (12:08 +0100)
committerJörg Behrmann <behrmann@physik.fu-berlin.de>
Fri, 23 Feb 2024 12:45:17 +0000 (13:45 +0100)
mkosi/qemu.py

index c0350032201e7dd3bfde76a8a6d2224d5d714f83..6efcdff9da83956157175b3921f2a233e192b912 100644 (file)
@@ -438,8 +438,9 @@ def vsock_notify_handler() -> Iterator[tuple[str, dict[str, str]]]:
 def copy_ephemeral(config: Config, src: Path) -> Iterator[Path]:
     src = src.resolve()
     # tempfile doesn't provide an API to get a random filename in an arbitrary directory so we do this
-    # instead.
-    tmp = src.parent / f"{src.name}-{uuid.uuid4().hex}"
+    # instead. Limit the size to 16 characters as the output name might be used in a unix socket path by vmspawn and
+    # needs to fit in 108 characters.
+    tmp = src.parent / f"{src.name}-{uuid.uuid4().hex[:16]}"
 
     try:
         def copy() -> None: