From: Daan De Meyer Date: Wed, 20 Sep 2023 21:30:11 +0000 (+0200) Subject: qemu: Make sure virtiofsd sock name is unique X-Git-Tag: v18~48^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5866decb92cb248cf302dd66a4e2544838605770;p=thirdparty%2Fmkosi.git qemu: Make sure virtiofsd sock name is unique We use the socket name as the tag for the virtiofs so it has to be unique. We keep it within 36 bytes though as that's the max tag size. --- diff --git a/mkosi/qemu.py b/mkosi/qemu.py index 77c5187ac..476a2a7a3 100644 --- a/mkosi/qemu.py +++ b/mkosi/qemu.py @@ -168,7 +168,9 @@ def start_virtiofsd(directory: Path) -> Iterator[Path]: # Make sure virtiofsd is allowed to create its socket in this temporary directory. os.chown(state, uid, gid) - sock = Path(state) / Path("sock") + # Make sure we can use the socket name as a unique identifier for the fs as well but make sure it's not too + # long as virtiofs tag names are limited to 36 bytes. + sock = Path(state) / f"sock-{uuid.uuid4().hex}"[:35] virtiofsd = shutil.which("virtiofsd") if virtiofsd is None: