From 098b8e91615a72f359b2b94dca89e949d342fe55 Mon Sep 17 00:00:00 2001 From: ddidderr Date: Wed, 2 Sep 2026 22:31:51 +0200 Subject: [PATCH] fix(build): keep catalog arguments out of shell source The Just recipes rendered LANSPREAD_GAMES_DIR, LANSPREAD_UNRAR, and recipe parameters directly into shell command text. Double quotes around those interpolations protected whitespace but still allowed command substitution and other shell expansion before the called tool received its arguments. Export Just variables and recipe parameters, then expand them only as quoted shell parameters at execution time. Fixed repository paths remain Just interpolations, while package roots, game IDs, output directories, and the selected unrar executable are now passed as data. This preserves the existing recipe interface and supports paths containing spaces or literal shell syntax. Test Plan: - `just --fmt --check` -- passed. - dry-run with a command-substitution-shaped path stayed literal. -- rendered a quoted shell variable and did not execute the substitution. - `git diff --cached --check` -- passed. --- justfile | 56 +++++++++++++++++++++++++++++--------------------------- 1 file changed, 29 insertions(+), 27 deletions(-) diff --git a/justfile b/justfile index 4fcb358..59ab90d 100644 --- a/justfile +++ b/justfile @@ -2,6 +2,8 @@ export RUSTFLAGS := "-C target-cpu=native" export WEBKIT_DISABLE_COMPOSITING_MODE := "1" export DOCKER_CONFIG := env_var_or_default("DOCKER_CONFIG", ".lanspread-peer-cli/docker-config") +set export + default: run FIXTURE_CATALOG_SOURCE := "crates/lanspread-tauri-deno-ts/src-tauri/game.db" @@ -20,8 +22,8 @@ setup: cd crates/lanspread-tauri-deno-ts && deno install --frozen=true run: - if [ -n "{{ GAMES_DIR }}" ]; then \ - just run-production "{{ GAMES_DIR }}"; \ + if [ -n "$GAMES_DIR" ]; then \ + just run-production "$GAMES_DIR"; \ else \ just run-fixture; \ fi @@ -30,19 +32,19 @@ run-fixture: fixture-catalog-check {{ TAURI_FIXTURE_ENV }} cargo tauri dev --config crates/lanspread-tauri-deno-ts/src-tauri/tauri.dev.conf.json --release run-production GAMES_DIR: - just catalog-generate-production "{{ GAMES_DIR }}" + just catalog-generate-production "$GAMES_DIR" just catalog-check-production cargo tauri dev --config crates/lanspread-tauri-deno-ts/src-tauri/tauri.production.conf.json --release build: - just build-production "{{ GAMES_DIR }}" + just build-production "$GAMES_DIR" build-fixture: fixture-catalog-check {{ TAURI_FIXTURE_ENV }} cargo tauri build --config crates/lanspread-tauri-deno-ts/src-tauri/tauri.dev.conf.json --no-bundle #-- --profile dev build-production GAMES_DIR="": - if [ -n "{{ GAMES_DIR }}" ]; then \ - just catalog-generate-production "{{ GAMES_DIR }}"; \ + if [ -n "$GAMES_DIR" ]; then \ + just catalog-generate-production "$GAMES_DIR"; \ else \ just catalog-check-production; \ fi @@ -75,7 +77,7 @@ fixture-catalogs: cargo run -p lanspread-compat --bin lanspread-fixture-catalog -- \ --source-catalog-db {{ FIXTURE_CATALOG_SOURCE }} \ --output-dir {{ FIXTURE_CATALOG_ROOT }}/default \ - --unrar {{ CATALOG_UNRAR }} \ + --unrar "$CATALOG_UNRAR" \ --game-root crates/lanspread-peer-cli/fixtures/fixture-alpha/alienswarm \ --game-root crates/lanspread-peer-cli/fixtures/fixture-alpha/bf1942 \ --game-root crates/lanspread-peer-cli/fixtures/fixture-alpha/ggoo \ @@ -89,33 +91,33 @@ fixture-catalogs: cargo run -p lanspread-compat --bin lanspread-fixture-catalog -- \ --source-catalog-db {{ FIXTURE_CATALOG_SOURCE }} \ --output-dir {{ FIXTURE_CATALOG_ROOT }}/solid \ - --unrar {{ CATALOG_UNRAR }} \ + --unrar "$CATALOG_UNRAR" \ --game-root crates/lanspread-peer-cli/fixtures/fixture-solid/cnctw cargo run -p lanspread-compat --bin lanspread-fixture-catalog -- \ --source-catalog-db {{ FIXTURE_CATALOG_SOURCE }} \ --output-dir {{ FIXTURE_CATALOG_ROOT }}/multi \ - --unrar {{ CATALOG_UNRAR }} \ + --unrar "$CATALOG_UNRAR" \ --game-root crates/lanspread-peer-cli/fixtures/fixture-multi/cnctw cargo run -p lanspread-compat --bin lanspread-fixture-catalog -- \ --source-catalog-db {{ FIXTURE_CATALOG_SOURCE }} \ --output-dir {{ FIXTURE_CATALOG_ROOT }}/unknown \ - --unrar {{ CATALOG_UNRAR }} \ + --unrar "$CATALOG_UNRAR" \ --game-root crates/lanspread-peer-cli/fixtures/fixture-unknown/cod2 fixture-catalog OUTPUT GAME_ROOT: cargo run -p lanspread-compat --bin lanspread-fixture-catalog -- \ --source-catalog-db {{ FIXTURE_CATALOG_SOURCE }} \ - --output-dir "{{ OUTPUT }}" \ - --unrar {{ CATALOG_UNRAR }} \ - --game-root "{{ GAME_ROOT }}" + --output-dir "$OUTPUT" \ + --unrar "$CATALOG_UNRAR" \ + --game-root "$GAME_ROOT" fixture-download-only-catalog OUTPUT GAME_ID GAME_ROOT: cargo run -p lanspread-compat --bin lanspread-fixture-catalog -- \ --source-catalog-db {{ FIXTURE_CATALOG_SOURCE }} \ - --output-dir "{{ OUTPUT }}" \ - --unrar {{ CATALOG_UNRAR }} \ - --game-root "{{ GAME_ROOT }}" \ - --no-stream-install "{{ GAME_ID }}" + --output-dir "$OUTPUT" \ + --unrar "$CATALOG_UNRAR" \ + --game-root "$GAME_ROOT" \ + --no-stream-install "$GAME_ID" fixture-catalog-check: cargo run -p lanspread-compat --bin lanspread-catalog-publisher -- check \ @@ -138,24 +140,24 @@ catalog-check-production: # Generate the complete production authority from PACKAGES_DIR//. catalog-generate-production PACKAGES_DIR: - @if [ "{{ CATALOG_FORCE }}" = "1" ] || ! python3 tools/catalog_source_cache.py check \ + @if [ "$CATALOG_FORCE" = "1" ] || ! python3 tools/catalog_source_cache.py check \ --stamp {{ CATALOG_CACHE_STAMP }} \ - --packages-dir "{{ PACKAGES_DIR }}" \ + --packages-dir "$PACKAGES_DIR" \ --catalog-db {{ PRODUCTION_CATALOG_DB }} \ --manifests-dir {{ PRODUCTION_MANIFEST_ROOT }} \ - --unrar "{{ CATALOG_UNRAR }}"; then \ + --unrar "$CATALOG_UNRAR"; then \ cargo run --release -p lanspread-compat --bin lanspread-catalog-publisher -- generate \ --catalog-db {{ PRODUCTION_CATALOG_DB }} \ - --packages-dir "{{ PACKAGES_DIR }}" \ + --packages-dir "$PACKAGES_DIR" \ --manifests-dir {{ PRODUCTION_MANIFEST_ROOT }} \ - --unrar "{{ CATALOG_UNRAR }}" \ + --unrar "$CATALOG_UNRAR" \ --all && \ python3 tools/catalog_source_cache.py record \ --stamp {{ CATALOG_CACHE_STAMP }} \ - --packages-dir "{{ PACKAGES_DIR }}" \ + --packages-dir "$PACKAGES_DIR" \ --catalog-db {{ PRODUCTION_CATALOG_DB }} \ --manifests-dir {{ PRODUCTION_MANIFEST_ROOT }} \ - --unrar "{{ CATALOG_UNRAR }}"; \ + --unrar "$CATALOG_UNRAR"; \ else \ echo "catalog generation skipped: source metadata matches {{ CATALOG_CACHE_STAMP }}"; \ fi @@ -164,10 +166,10 @@ catalog-generate-production PACKAGES_DIR: catalog-generate-production-game PACKAGES_DIR GAME_ID: cargo run -p lanspread-compat --bin lanspread-catalog-publisher -- generate \ --catalog-db {{ PRODUCTION_CATALOG_DB }} \ - --packages-dir "{{ PACKAGES_DIR }}" \ + --packages-dir "$PACKAGES_DIR" \ --manifests-dir {{ PRODUCTION_MANIFEST_ROOT }} \ - --unrar "{{ CATALOG_UNRAR }}" \ - --game-id "{{ GAME_ID }}" + --unrar "$CATALOG_UNRAR" \ + --game-id "$GAME_ID" frontend-test: cd crates/lanspread-tauri-deno-ts && deno test --unstable-sloppy-imports tests