From 17c1f7f89dfd0ba6f5637f5217371fef1acf8e39 Mon Sep 17 00:00:00 2001 From: Mark Street Date: Mon, 5 Aug 2024 21:25:44 +0100 Subject: [PATCH] Try creating 'Temp' dir for wine --- backend/coreapp/sandbox.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/backend/coreapp/sandbox.py b/backend/coreapp/sandbox.py index 13b61ce1..02eb7ae3 100644 --- a/backend/coreapp/sandbox.py +++ b/backend/coreapp/sandbox.py @@ -6,6 +6,7 @@ from pathlib import Path from tempfile import TemporaryDirectory from typing import Any, Dict, List, Optional, Union +import getpass from django.conf import settings @@ -46,10 +47,15 @@ def sandbox_command(self, mounts: List[Path], env: Dict[str, str]) -> List[str]: return [] settings.SANDBOX_CHROOT_PATH.mkdir(parents=True, exist_ok=True) - settings.WINEPREFIX.mkdir(parents=True, exist_ok=True) assert ":" not in str(self.path) assert ":" not in str(settings.WINEPREFIX) + + wine_temp_dir = ( + settings.WINEPREFIX / "drive_c" / "users" / getpass.getuser() / "Temp" + ) + wine_temp_dir.mkdir(parents=True, exist_ok=True) + # fmt: off wrapper = [ str(settings.SANDBOX_NSJAIL_BIN_PATH), @@ -57,6 +63,7 @@ def sandbox_command(self, mounts: List[Path], env: Dict[str, str]) -> List[str]: "--chroot", str(settings.SANDBOX_CHROOT_PATH), "--bindmount", f"{self.path}:/tmp", "--bindmount", f"{self.path}:/run/user/{os.getuid()}", + "--bindmount", f"{self.path}:{wine_temp_dir}", "--bindmount_ro", "/dev", "--bindmount_ro", "/bin", "--bindmount_ro", "/etc/alternatives",