From e65a9722d96117ea74d2ee8aa33f22d5e47416f3 Mon Sep 17 00:00:00 2001 From: dingo Date: Mon, 10 Aug 2026 18:25:36 +0700 Subject: [PATCH] packages: give rustup a default, and run steps under bash Both failures on run 31383204572, all three distributions, in the same step, before anything was compiled. --default-toolchain none was copied from the two fork workflows, where it is correct: their checkout root is the crate, so rust-toolchain.toml sits in it and rustup reads the pin. This repository's root has no pin -- it is in cosmic-comp/, one level down, and the other 27 components have none at all -- so `none` left no default and the first cargo invocation at the root failed with "could not choose a version of cargo to run". stable does not weaken the pin. rustup applies a directory-local rust-toolchain.toml on entering that directory and installs it on demand, so cosmic-comp still gets the 1.93 it asks for. The same logs showed `shell: sh -e {0}`, which is the container default and is dash on Debian. Two later steps use brace expansion, which dash lacks and bash-as-sh disables, so the RPM build would have created a directory literally named rpmbuild/{BUILD,RPMS,...} and failed further along. Declared bash for the job rather than rewriting around a constraint none of the three images impose. Worth recording why this was not caught before pushing: the run blocks were syntax-checked with bash, which is not what was going to run them. Checking with dash would not have caught it either -- brace expansion failing is runtime behaviour, not a parse error. Declaring the shell is the fix; there is no static check that substitutes for it. --- .github/workflows/packages.yml | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/.github/workflows/packages.yml b/.github/workflows/packages.yml index b6481a4..d04e6eb 100644 --- a/.github/workflows/packages.yml +++ b/.github/workflows/packages.yml @@ -49,6 +49,15 @@ jobs: name: ${{ matrix.distro }} runs-on: ubuntu-latest container: ${{ matrix.image }} + # GitHub defaults `run:` to `sh -e {0}` inside a container, and on Debian + # that is dash. Several steps below use brace expansion and process + # substitution, which dash does not have and which bash-invoked-as-sh + # disables. Naming bash once here is better than writing POSIX around a + # constraint no target actually imposes -- all three images ship bash. + defaults: + run: + shell: bash + strategy: # One distribution failing on a package name is worth seeing on its own, # and the other two artifacts are still worth having. @@ -133,14 +142,24 @@ jobs: with: submodules: recursive - # --default-toolchain none, then let cosmic-comp's rust-toolchain.toml - # choose. Naming a version here would create a second place to update it - # and a way for the packages to be compiled by something the project does - # not otherwise use. + # stable as the default, not `none`. + # + # The two fork workflows use --default-toolchain none and let + # rust-toolchain.toml decide, which is right there because the checkout + # root is the crate and the pin sits in it. Here it does not: the pin is + # cosmic-comp/rust-toolchain.toml, one level down, and this job's other 27 + # components have no pin at all. With `none` there is no default to fall + # back to and the first cargo invocation at the repository root fails + # before anything is built. + # + # Naming stable does not weaken the pin. rustup applies a directory-local + # rust-toolchain.toml whenever it enters that directory and installs it on + # demand, so cosmic-comp still compiles with the 1.93 it asks for while + # everything else uses stable. - name: Install Rust run: | curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs \ - | sh -s -- -y --default-toolchain none --profile minimal + | sh -s -- -y --default-toolchain stable --profile minimal echo "$HOME/.cargo/bin" >> "$GITHUB_PATH" - name: Show toolchain