Skip to content
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

Error with util/show-utils.sh script if main directory != coreutils #6242

Closed
lcheylus opened this issue Apr 15, 2024 · 1 comment · Fixed by #6300
Closed

Error with util/show-utils.sh script if main directory != coreutils #6242

lcheylus opened this issue Apr 15, 2024 · 1 comment · Fixed by #6300

Comments

@lcheylus
Copy link
Contributor

util/show-utils.sh shell script is used in CI and other scripts to get the list of tools built depending on the features chosen.

If the main directory of the project is coreutils, util/show-utils.sh script works as expected:

$ util/show-utils.sh --features 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 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 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

With my personal fork, I have a different name for the main directory (local Git clone) => rust-coreutils. In this case, results from util/show-utils.sh script is void:

util/show-utils.sh --features unix
(No result)

In util/show-utils.sh, the resulting list is created via cargo metadata (JSON output) then parsed with jq. In the jq query, .*coreutils pattern is used for parsing => this request must be fixed to use parent directory != coreutils.

lcheylus added a commit to lcheylus/rust-coreutils that referenced this issue May 1, 2024
In jq query, the correct regex to select .id is ".*#coreutils[ |@]\\d+\\.\\d+\\.\\d+"

- with cargo v1.76.0, id = 'coreutils 0.0.26 (path+file://<coreutils local directory>)'
- with cargo v1.77.0, id = 'path+file://<coreutils local directory>#coreutils@0.0.26'

Fix uutils#6242

Signed-off-by: Laurent Cheylus <foxy@free.fr>
@lcheylus
Copy link
Contributor Author

lcheylus commented May 1, 2024

Current state of my debug for this issue

  • my local repository is rust-coreutils.git => path = /home/user/dev/rust-coreutils.git
  • in script util/show-utils.sh, jq request is used to find id for coreutils package then names selected for uu_ utils.

Tests with different versions of cargo (used to dump metadata):

  • with cargo v1.76.0: id for coreutils package = coreutils 0.0.26 (path+file:///home/user/dev/rust-coreutils.git)
  • with cargo v1.77.0: id for coreutils package = path+file:///home/user/dev/rust-coreutils.git#coreutils@0.0.26

The regexp used in the jq request (current = .*coreutils#\\d+\\.\\d+\\.\\d+) is wrong and must be fixed to parse every case => .*coreutils[ |@]\\d+\\.\\d+\\.\\d+

With this regexp, my tests are OK on OpenBSD (cargo v1.76.0) and FreeBSD (cargo v1.77.0) : show-utils.sh script gets correctly the list of utils/tools according to --features flag (tested with --features "unix").

I will send a PR to fix the util/show-utils.sh script.

lcheylus added a commit to lcheylus/rust-coreutils that referenced this issue May 4, 2024
In jq query, the correct regex to select .id is ".*coreutils[ |@]\\d+\\.\\d+\\.\\d+"

- with cargo v1.76, id = "coreutils 0.0.26 (path+file://<coreutils local directory>)"
- with cargo v1.77, id = "path+file://<coreutils local directory>#coreutils@0.0.26"

Fix uutils#6242

Signed-off-by: Laurent Cheylus <foxy@free.fr>
BenWiederhake pushed a commit that referenced this issue May 4, 2024
In jq query, the correct regex to select .id is ".*coreutils[ |@]\\d+\\.\\d+\\.\\d+"

- with cargo v1.76, id = "coreutils 0.0.26 (path+file://<coreutils local directory>)"
- with cargo v1.77, id = "path+file://<coreutils local directory>#coreutils@0.0.26"

Fix #6242

Signed-off-by: Laurent Cheylus <foxy@free.fr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant