From 99a388adc289619ed9d58b10839ea9ec2edb0cff Mon Sep 17 00:00:00 2001 From: "E. G. Patrick Bos" Date: Wed, 9 Sep 2026 12:33:37 +0200 Subject: [PATCH 1/2] Resolve a get_* install path that does not exist yet tools/get_socrates.sh resolves its optional install-path argument through portable_realpath, which rejects a path with a missing leaf (BSD realpath, so every macOS host) or a missing parent (GNU realpath). set -euo pipefail is enabled only further down the script, so the empty result travelled on and surfaced as "could not create work tree dir ''" from git clone. Creating the directory beforehand was the only way to pass a new destination. The helper now falls through to its python3 resolver whenever realpath refuses the path, so a destination that does not exist yet resolves lexically; git clone then creates it, parents included. The helper is duplicated across the nine get_*.sh scripts and every copy carries the same change, pinned by a test that compares the copies as text. get_socrates.sh additionally stops with a named error if the resolution is empty, instead of handing an empty string to git, and its usage header now lists the positional argument. --- tests/tools/test_install_scripts.py | 154 +++++++++++++++++++++++++--- tools/get_aragog.sh | 10 +- tools/get_boreas.sh | 10 +- tools/get_lavatmos.sh | 10 +- tools/get_petsc.sh | 10 +- tools/get_socrates.sh | 21 +++- tools/get_spider.sh | 10 +- tools/get_thermoenginelite.sh | 10 +- tools/get_vulcan.sh | 10 +- tools/get_zalmoxis.sh | 10 +- 10 files changed, 207 insertions(+), 48 deletions(-) diff --git a/tests/tools/test_install_scripts.py b/tests/tools/test_install_scripts.py index f876704f6..fd37083e4 100644 --- a/tests/tools/test_install_scripts.py +++ b/tests/tools/test_install_scripts.py @@ -4,7 +4,6 @@ Reusable shell logic replicated inline from ``tools/get_petsc.sh`` and ``tools/get_spider.sh``: -- ``portable_realpath()``: cross-platform path resolution - ERR trap: exit-code and step-name capture - Platform detection: PETSC_ARCH assignment - Homebrew prefix fallback: architecture-aware default @@ -13,9 +12,13 @@ Blocks lifted out of the shipped scripts at run time, so that rewording a script re-runs its cases against the new text: +- ``portable_realpath()``: cross-platform path resolution, including a + destination that does not exist yet, plus the invariant that every + ``get_*.sh`` copy of the helper carries the same text - ``tools/get_aragog.sh``: the dirty-checkout guard shared across ``get_*.sh`` - ``tools/get_socrates.sh``: the portable-flag rewrite, its post-build flag - check, and the conditional AGNI-wrapper rebuild note + check, the install-path resolution, and the conditional AGNI-wrapper + rebuild note Also pins invariants that live in checked-in configuration and documentation rather than in shell, each of which fails silently when its counterpart moves: @@ -48,17 +51,22 @@ # --------------------------------------------------------------------------- # Helper: extract portable_realpath function from a script # --------------------------------------------------------------------------- +def _extract_shell_function(script: str, name: str) -> str: + """Return the shipped bash source of ``name`` in ``tools/