From 6617aca341dd39f18e0ed847fcba7b72ea3814d1 Mon Sep 17 00:00:00 2001 From: Claus Lohmar Date: Thu, 23 Jul 2026 10:36:03 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20purge=20all=20old=20staging=20path=20ref?= =?UTF-8?q?erences=20=E2=80=94=20full=20code=20review=20cleanup?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bugs found and fixed: - converter.py: STAGING_IN.iterdir() → extract_base.iterdir() (checked wrong dir when source was in session subdir) - vm-bench.service: TMPDIR=/mnt/converter/in → /mnt/converter/tmp (old path poisoned all temp file writes) - backend/app.py: removed unused STAGING_IN constant - converter.py: removed unused STAGING_OUT constant - install.sh: removed creation of old /in and /out dirs --- backend/app.py | 1 - backend/converter.py | 3 +-- backend/install.sh | 2 -- frontend/vm-bench.service | 2 +- 4 files changed, 2 insertions(+), 6 deletions(-) diff --git a/backend/app.py b/backend/app.py index a751001..18df0ff 100644 --- a/backend/app.py +++ b/backend/app.py @@ -54,7 +54,6 @@ logger.info("Backend starting — log file: %s", LOG_DIR / "vm-bench-backend.log # --------------------------------------------------------------------------- # Constants # --------------------------------------------------------------------------- -STAGING_IN = "/mnt/converter/in" API_PREFIX = "/api/v1" # --------------------------------------------------------------------------- diff --git a/backend/converter.py b/backend/converter.py index 070ba1d..48e9e5f 100644 --- a/backend/converter.py +++ b/backend/converter.py @@ -17,7 +17,6 @@ from typing import Optional STAGING_ROOT = Path("/mnt/converter/tmp") STAGING_IN = STAGING_ROOT / "in" -STAGING_OUT = STAGING_ROOT / "out" logger = logging.getLogger("backend.converter") @@ -108,7 +107,7 @@ def extract_if_needed(filename: str) -> Path: raise RuntimeError(f"{tool} failed: {result.stderr.strip()[:500]}") # Determine what was created - after = set(STAGING_IN.iterdir()) + after = set(extract_base.iterdir()) new_items = after - before # If the archive had a single top-level directory matching the stem, use it diff --git a/backend/install.sh b/backend/install.sh index c2f4d63..18a0492 100755 --- a/backend/install.sh +++ b/backend/install.sh @@ -58,8 +58,6 @@ echo "[1/6] Creating directory structure..." for d in \ "$CONVERTER_ROOT" \ - "$CONVERTER_ROOT/in" \ - "$CONVERTER_ROOT/out" \ "$CONVERTER_ROOT/logs" \ "$CONVERTER_ROOT/tmp" \ "$CONVERTER_ROOT/backend" \ diff --git a/frontend/vm-bench.service b/frontend/vm-bench.service index f03ccfa..37facb6 100644 --- a/frontend/vm-bench.service +++ b/frontend/vm-bench.service @@ -8,7 +8,7 @@ User=root WorkingDirectory=/mnt/converter/frontend Environment=PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin Environment=BACKEND_URL=http://10.2.0.2:9000 -Environment=TMPDIR=/mnt/converter/in +Environment=TMPDIR=/mnt/converter/tmp ExecStart=/usr/bin/python3 -m uvicorn app:app --host 0.0.0.0 --port 5000 --timeout-keep-alive 300 Restart=always RestartSec=3