From 5c63111aab69aea2904f2e0a472f65792fff4f1e Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Tue, 24 Nov 2026 18:00:00 +0200 Subject: [PATCH] Quote the remaining justfile paths with `quote()` Plain double quotes handle spaces, but not characters like `$` or backticks, and the path to `just` itself was not quoted at all. Follow-up to https://github.com/spantaleev/matrix-docker-ansible-deploy/pull/5820 Co-Authored-By: Claude Opus 5.5 --- justfile | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/justfile b/justfile index fb492f57d..7137f08bf 100644 --- a/justfile +++ b/justfile @@ -17,7 +17,7 @@ installed_roles_file_path := justfile_directory() / "run/installed-roles.yml" # Shows help default: - @{{ just_executable() }} --list --justfile "{{ justfile() }}" + @{{ quote(just_executable()) }} --list --justfile {{ quote(justfile()) }} # Adds a new host to the inventory, creating the inventory files if necessary (e.g. `just add-inventory-host example.com 1.2.3.4`) add-inventory-host domain server_address: @@ -26,7 +26,7 @@ add-inventory-host domain server_address: # Pulls external Ansible roles (--force also replaces roles with local changes) roles *flags: @echo "[NOTE] This command just updates the roles, but if you want to update everything at once (playbook, roles, etc.) - use 'just update'" - @{{ just_executable() }} --justfile "{{ justfile() }}" _install-roles {{ flags }} + @{{ quote(just_executable()) }} --justfile {{ quote(justfile()) }} _install-roles {{ flags }} # Updates the playbook and installs the necessary Ansible roles pinned in requirements.yml. If a -u flag is passed, also updates the requirements.yml file with new role versions (if available) update *flags: @@ -41,14 +41,14 @@ update *flags: exit 1 fi - {{ just_executable() }} --justfile "{{ justfile() }}" update-playbook-only + {{ quote(just_executable()) }} --justfile {{ quote(justfile()) }} update-playbook-only if [ "{{ flags }}" = "-u" ]; then # Only updates the versions pinned in requirements.yml. The roles are installed below. echo "Pinning new role versions in requirements.yml…" agru -p roles/galaxy/ -no-tui -i=false -u fi - {{ just_executable() }} --justfile "{{ justfile() }}" _install-roles + {{ quote(just_executable()) }} --justfile {{ quote(justfile()) }} _install-roles # Updates the playbook without installing/updating Ansible roles update-playbook-only: @@ -60,29 +60,29 @@ update-playbook-only: # Invokes mise with the project-local data directory mise *args: _ensure_mise_data_directory #!/bin/sh - export MISE_DATA_DIR="{{ mise_data_dir }}" - export MISE_TRUSTED_CONFIG_PATHS="{{ mise_trusted_config_paths }}" + export MISE_DATA_DIR={{ quote(mise_data_dir) }} + export MISE_TRUSTED_CONFIG_PATHS={{ quote(mise_trusted_config_paths) }} export MISE_YES=1 - export PREK_HOME="{{ prek_home }}" + export PREK_HOME={{ quote(prek_home) }} mise {{ args }} # Runs prek (pre-commit hooks manager) with the given arguments prek *args: _ensure_mise_tools_installed - @{{ just_executable() }} --justfile "{{ justfile() }}" mise exec -- prek {{ args }} + @{{ quote(just_executable()) }} --justfile {{ quote(justfile()) }} mise exec -- prek {{ args }} # Runs pre-commit hooks on staged files prek-run-on-staged *args: _ensure_mise_tools_installed - @{{ just_executable() }} --justfile "{{ justfile() }}" prek run {{ args }} + @{{ quote(just_executable()) }} --justfile {{ quote(justfile()) }} prek run {{ args }} # Runs pre-commit hooks on all files prek-run-on-all *args: _ensure_mise_tools_installed - @{{ just_executable() }} --justfile "{{ justfile() }}" prek run --all-files {{ args }} + @{{ quote(just_executable()) }} --justfile {{ quote(justfile()) }} prek run --all-files {{ args }} # Installs the git pre-commit hook prek-install-git-pre-commit-hook: _ensure_mise_tools_installed #!/usr/bin/env sh set -eu - {{ just_executable() }} --justfile "{{ justfile() }}" mise exec -- prek install + {{ quote(just_executable()) }} --justfile {{ quote(justfile()) }} mise exec -- prek install # The installed git hooks run later under Git, outside this just/mise environment, # so they need to be told how to find their tooling: # @@ -97,7 +97,7 @@ prek-install-git-pre-commit-hook: _ensure_mise_tools_installed # # Which hook files prek installs depends on `default_install_hook_types` in # .pre-commit-config.yaml, so patch every hook file that prek generated. - for hook in "{{ justfile_directory() }}"/.git/hooks/*; do + for hook in {{ quote(justfile_directory()) }}/.git/hooks/*; do [ -f "$hook" ] || continue grep -q 'generated by prek' "$hook" || continue grep -q '^export PREK_HOME=' "$hook" || sed -i '2iexport PREK_HOME="{{ prek_home }}"' "$hook" @@ -111,7 +111,7 @@ install-all *extra_args: (run-tags "install-all,ensure-matrix-users-created,star # Runs installation tasks for a single service install-service service *extra_args: - {{ just_executable() }} --justfile "{{ justfile() }}" run \ + {{ quote(just_executable()) }} --justfile {{ quote(justfile()) }} run \ --tags=install-{{ service }},start-group \ --extra-vars=group={{ service }} {{ extra_args }} @@ -124,7 +124,7 @@ run +extra_args: (_install-roles "--quiet") # Runs the playbook with the given list of comma-separated tags and optional arguments run-tags tags *extra_args: - {{ just_executable() }} --justfile "{{ justfile() }}" run --tags={{ tags }} {{ extra_args }} + {{ quote(just_executable()) }} --justfile {{ quote(justfile()) }} run --tags={{ tags }} {{ extra_args }} # Lists all playbook tags, one per line list-tags: (_install-roles "--quiet") @@ -142,14 +142,14 @@ start-all *extra_args: (run-tags "start-all" extra_args) # Starts a specific service group start-group group *extra_args: - @{{ just_executable() }} --justfile "{{ justfile() }}" run-tags start-group --extra-vars="group={{ group }}" {{ extra_args }} + @{{ quote(just_executable()) }} --justfile {{ quote(justfile()) }} run-tags start-group --extra-vars="group={{ group }}" {{ extra_args }} # Stops all services stop-all *extra_args: (run-tags "stop-all" extra_args) # Stops a specific service group stop-group group *extra_args: - @{{ just_executable() }} --justfile "{{ justfile() }}" run-tags stop-group --extra-vars="group={{ group }}" {{ extra_args }} + @{{ quote(just_executable()) }} --justfile {{ quote(justfile()) }} run-tags stop-group --extra-vars="group={{ group }}" {{ extra_args }} # Runs a role's Molecule scenario locally (no argument lists the roles that have one) molecule *args: @@ -169,9 +169,9 @@ _install-roles *flags: # Internal - ensures var/mise and var/prek directories exist _ensure_mise_data_directory: - @mkdir -p "{{ mise_data_dir }}" - @mkdir -p "{{ prek_home }}" + @mkdir -p {{ quote(mise_data_dir) }} + @mkdir -p {{ quote(prek_home) }} # Internal - ensures mise tools are installed _ensure_mise_tools_installed: _ensure_mise_data_directory - @{{ just_executable() }} --justfile "{{ justfile() }}" mise install --quiet + @{{ quote(just_executable()) }} --justfile {{ quote(justfile()) }} mise install --quiet