show-utils.sh: stop probing realpath with GNU-only options - #14906
Conversation
1b428ad to
1e40d76
Compare
The Code Coverage job on macOS logged "realpath: illegal option -- m" on every run: the script probed with GNU-only flags, then recovered via `||`. The repo root always exists, so `cd` and `pwd -P` give the same physical path with no dependency on GNU coreutils.
1e40d76 to
cc7ccd1
Compare
The utility names are all in `.vscode/cspell.dictionaries/workspace.wordlist.txt`, so the per-file list is redundant. The `OSTYPE` line has been dead since the `$OSTYPE` check was replaced with a `command -v grealpath` lookup.
`set -e` alone is a no-op here: the two commands that can fail both sit in pipelines whose rightmost stage succeeds, so the pipeline status is 0 even when `sed` or `cargo` failed. `set -eo pipefail` propagates that. Computing `default_utils` moves into the branch that uses it. It read `Cargo.toml` relative to the caller's directory and ran before the `cd`, so from outside the repository it produced an empty list, and under `pipefail` it would abort a run that otherwise succeeds.
ME_parent_dir_abs and project_main_dir existed only to be passed to cd, so five steps computed a directory the script immediately changed into.
The regex selecting the coreutils package id matches the space, pipe, at and hash separators that cargo has used across versions; without the comment the pattern is not obvious.
|
GNU testsuite comparison: |
Reading the feature list out of Cargo.toml needed tr, which Gentoo's portage had to account for. cargo is already required to build the project, so this drops an external tool without adding a dependency. Output is unchanged: the same 78 utilities, verified against the previous implementation on cargo 1.88, 1.93 and 1.95.
show-utils.sh emits the fallback list one utility per line, which split(' ')
would leave as a single element. The tr-based pipeline it replaced left two
spaces between names, so the same call already produced 77 empty entries
whenever jq was missing.
|
Thanks for your PR |
|
Can we drop |
Agreed on dropping |
|
We need to switch to Rust for Windows soon. But I drop it #14955 . |
|
Where is the place *BSD.yml depend on GNU coreutils? Or did this PR remove such dep? |
coreutils in the BSD style job: openbsd.yml:50, freebsd.yml:44. It was only there for show-utils.sh (openbsd.yml:83, freebsd.yml:73), which Didn't touch the workflows though, so the install line is still in place. Also, the second half of that comment ("bash to use inline shell string |
|
I tried to write in Rust. But it was too pain to maintain. But it seems It is needed for #8152 , but I'd like to keep |
util/show-utils.shresolved the repository root withrealpath -mPandrecovered with a plain
realpathon failure. On macOSrealpathis the BSDone, which takes no options, so the probe printed "realpath: illegal option
-- m" on every run before the fallback quietly did the right thing. That is
what the macOS Code Coverage job logs, and what a macOS contributor sees when
running
./util/show-utils.shorcargo run --bin uudoc.The root always exists, so
cdandpwd -Pgive the same physical path withno dependency on GNU coreutils. The test stubs a BSD-like
realpathon PATH,so the failure is caught on every platform, not only on macOS runners.
Closes #6607