-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
util/show-utils: fix script not working as intended #4560
Conversation
GNU testsuite comparison:
|
63fa231
to
ac181b9
Compare
Should |
ac181b9
to
bac4ecb
Compare
I don't really understand. Why would it be better to remove the features? If we remove it could won't be able to catch problems in unix-only utils, right? |
Doesn't $ ./util/show-utils.sh --features feat_os_unix
arch base32 base64 basename basenc cat chgrp chmod chown chroot cksum comm cp csplit cut date dd df dir dircolors dirname du echo env expand expr factor false fmt fold groups hashsum head hostname id install join kill link ln logname ls mkdir mkfifo mknod mktemp more mv nice nl nohup nproc numfmt od paste pathchk pinky pr printenv printf ptx pwd readlink realpath relpath rm rmdir seq shred shuf sleep sort split stat stdbuf stty sum sync tac tail tee test timeout touch tr true truncate tsort tty uname unexpand uniq unlink uptime users vdir wc who whoami yes
$ ./util/show-utils.sh --features feat_os_windows
arch base32 base64 basename basenc cat cksum comm cp csplit cut date dd df dir dircolors dirname du echo env expand expr factor false fmt fold hashsum head hostname join link ln ls mkdir mktemp more mv nl nproc numfmt od paste pr printenv printf ptx pwd readlink realpath relpath rm rmdir seq shred shuf sleep sort split sum sync tac tail tee test touch tr true truncate tsort uname unexpand uniq unlink vdir wc whoami yes
$ ./util/show-utils.sh --features feat_os_macos
arch base32 base64 basename basenc cat chgrp chmod chown chroot cksum comm cp csplit cut date dd df dir dircolors dirname du echo env expand expr factor false fmt fold groups hashsum head hostid hostname id install join kill link ln logname ls mkdir mkfifo mknod mktemp more mv nice nl nohup nproc numfmt od paste pathchk pinky pr printenv printf ptx pwd readlink realpath relpath rm rmdir seq shred shuf sleep sort split stat stdbuf stty sum sync tac tail tee test timeout touch tr true truncate tsort tty uname unexpand uniq unlink uptime users vdir wc who whoami yes |
bac4ecb
to
8ecc651
Compare
8ecc651
to
04f1b31
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You seem to have included some irrelevant changes in other files. In the future it's probably better to include those in another PR, but since they're in separate commits, I suppose it's fine for now.
You're right about the feature list, it should indeed not be necessary :)
@@ -206,7 +206,7 @@ jobs: | |||
# target-specific options | |||
# * CARGO_FEATURES_OPTION | |||
CARGO_FEATURES_OPTION='--all-features' ; | |||
if [ -n "${{ matrix.job.features }}" ]; then CARGO_FEATURES_OPTION='--features "${{ matrix.job.features }}"' ; fi | |||
if [ -n "${{ matrix.job.features }}" ]; then CARGO_FEATURES_OPTION='--features ${{ matrix.job.features }}' ; fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why remove the quotes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I didn't remove the quotes, the CI is failing to get utilities, as you can see here. https://github.com/miles170/coreutils/actions/runs/4516836207/jobs/7955560726 (Initialize workflow variables
)
steps.vars.outputs.CARGO_FEATURES_OPTION=--features "feat_os_unix"
Updating crates.io index
error: none of the selected packages contains these features: "feat_os_unix", did you mean: feat_os_unix?
UTILITY_LIST=
steps.vars.outputs.CARGO_UTILITY_LIST_OPTIONS=
I'm assuming the error is because cargo is treating "feat_os_unix"
as a feature instead of feat_os_unix
.
@@ -319,7 +319,7 @@ jobs: | |||
# target-specific options | |||
# * CARGO_FEATURES_OPTION | |||
CARGO_FEATURES_OPTION='--all-features' ; | |||
if [ -n "${{ matrix.job.features }}" ]; then CARGO_FEATURES_OPTION='--features "${{ matrix.job.features }}"' ; fi | |||
if [ -n "${{ matrix.job.features }}" ]; then CARGO_FEATURES_OPTION='--features ${{ matrix.job.features }}' ; fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same question here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I didn't remove the quotes, the CI is failing to get utilities, as you can see here. https://github.com/miles170/coreutils/actions/runs/4516836207/jobs/7955561283 (Initialize workflow variables
)
steps.vars.outputs.CARGO_FEATURES_OPTION=--features "feat_os_unix"
Updating crates.io index
error: none of the selected packages contains these features: "feat_os_unix", did you mean: feat_os_unix?
UTILITY_LIST=
steps.vars.outputs.CARGO_UTILITY_LIST_OPTIONS=
I'm assuming the error is because cargo is treating "feat_os_unix"
as a feature instead of feat_os_unix
.
@@ -22,6 +23,6 @@ cd "${project_main_dir}" && | |||
echo "WARN: missing \`jq\` (install with \`sudo apt install jq\`); falling back to default (only fully cross-platform) utility list" 1>&2 | |||
echo "$default_utils" | |||
else | |||
cargo metadata "$*" --format-version 1 | jq -r "[.resolve.nodes[] | { id: .id, deps: [.deps[] | { name:.name, pkg:.pkg }] }] | .[] | select(.id|startswith(\"coreutils\")) | [.deps[] | select((.name|startswith(\"uu_\")) or (.pkg|startswith(\"uu_\")))] | [.[].pkg | match(\"^\\\w+\";\"g\")] | [.[].string | sub(\"^uu_\"; \"\")] | sort | join(\" \")" | |||
# cargo metadata "$*" --format-version 1 | jq -r "[.resolve.nodes[] | { id: .id, deps: [.deps[] | { name:.name, pkg:.pkg }] }] | .[] | select(.id|startswith(\"coreutils\")) | [.deps[] | select((.name|startswith(\"uu_\")) or (.pkg|startswith(\"uu_\")))] | [.[].pkg | match(\"^\\\w+\";\"g\")] | [.[].string] | sort | join(\" \")" | |||
cargo metadata "$@" --format-version 1 | jq -r "[.resolve.nodes[] | { id: .id, deps: [.deps[] | { name:.name, pkg:.pkg }] }] | .[] | select(.id|startswith(\"coreutils\")) | [.deps[] | select((.name|startswith(\"uu_\")) or (.pkg|startswith(\"uu_\")))] | [.[].pkg | match(\"^\\\w+\";\"g\")] | [.[].string | sub(\"^uu_\"; \"\")] | sort | join(\" \")" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$*
expands to a single argument, which results in an error. ($@
expands to multiple arguments)
$ sh ./util/show-utils.sh --features feat_os_unix
error: unexpected argument '--features feat_os_unix' found
note: argument '--features' exists
Usage: cargo metadata --features <FEATURES>
For more information, try '--help'.
The reason why I corrected those two errors is that the original lint task was not functioning properly, which resulted in those errors not being detected. After fixing the lint task, those two errors were successfully identified. If not corrected, it would lead to the failure of the lint task. |
That makes sense! Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, I'm convinced :) So we've been running a faulty CI this whole time? @sylvestre you know bash better than me, does it look good to you?
Looks good |
-mP
arguments are not available.error: unexpected argument "--features 'feat_os_unix'" found
The current script doesn't work well since it produces no result but errors.
Check
Style/lint -> Initialize workflow variables
step on any CICD task.And
cargo clippy --all-targets --features "feat_os_unix" -pXX
seems not to work on Ubuntu or FreeBSD.But
cargo clippy --all-targets -pXX
works well.