-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Clean up scripts with shellcheck #77376
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @Mark-Simulacrum (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
I'm going to r? @pietroalbini in the hopes that you have time to take a look at this, I personally do not feel like I can dedicate bandwidth to being comfortable approving this |
That should be all changes necessary, as far as I know. |
src/ci/docker/host-x86_64/disabled/dist-x86_64-dragonfly/build-toolchain.sh
Outdated
Show resolved
Hide resolved
@@ -31,35 +31,35 @@ exit 1 | |||
# First up, build a cross-compiler | |||
git clone --depth=1 https://git.haiku-os.org/haiku | |||
git clone --depth=1 https://git.haiku-os.org/buildtools | |||
cd $BUILDTOOLS/jam | |||
cd "$BUILDTOOLS/jam" |
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.
Hmm, don't you also need to change lines 7 and 9 for this to do anything?
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.
Hi @pta2002, you marked this as resolved but didn't change the lines. If they don't need to be changed, can you explain why?
src/ci/docker/host-x86_64/disabled/dist-x86_64-haiku/build-toolchain.sh
Outdated
Show resolved
Hide resolved
src/ci/docker/host-x86_64/disabled/dist-x86_64-haiku/build-toolchain.sh
Outdated
Show resolved
Hide resolved
src/tools/clippy/.github/driver.sh
Outdated
@@ -28,14 +28,14 @@ diff normalized.stderr tests/ui/cstring.stderr | |||
|
|||
|
|||
# make sure "clippy-driver --rustc --arg" and "rustc --arg" behave the same | |||
SYSROOT=`rustc --print sysroot` | |||
SYSROOT=$(rustc --print sysroot) | |||
diff <(LD_LIBRARY_PATH=${SYSROOT}/lib ./target/debug/clippy-driver --rustc --version --verbose) <(rustc --version --verbose) |
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.
diff <(LD_LIBRARY_PATH=${SYSROOT}/lib ./target/debug/clippy-driver --rustc --version --verbose) <(rustc --version --verbose) | |
diff <(LD_LIBRARY_PATH="${SYSROOT}"/lib ./target/debug/clippy-driver --rustc --version --verbose) <(rustc --version --verbose) |
src/tools/clippy/.github/driver.sh
Outdated
diff <(LD_LIBRARY_PATH=${SYSROOT}/lib ./target/debug/clippy-driver --rustc --version --verbose) <(rustc --version --verbose) | ||
|
||
|
||
echo "fn main() {}" > target/driver_test.rs | ||
# we can't run 2 rustcs on the same file at the same time | ||
CLIPPY=`LD_LIBRARY_PATH=${SYSROOT}/lib ./target/debug/clippy-driver ./target/driver_test.rs --rustc` | ||
RUSTC=`rustc ./target/driver_test.rs` | ||
CLIPPY=$(LD_LIBRARY_PATH=${SYSROOT}/lib ./target/debug/clippy-driver ./target/driver_test.rs --rustc) |
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.
CLIPPY=$(LD_LIBRARY_PATH=${SYSROOT}/lib ./target/debug/clippy-driver ./target/driver_test.rs --rustc) | |
CLIPPY=$(LD_LIBRARY_PATH="${SYSROOT}"/lib ./target/debug/clippy-driver ./target/driver_test.rs --rustc) |
src/tools/clippy/.github/driver.sh
Outdated
CLIPPY=`LD_LIBRARY_PATH=${SYSROOT}/lib ./target/debug/clippy-driver ./target/driver_test.rs --rustc` | ||
RUSTC=`rustc ./target/driver_test.rs` | ||
CLIPPY=$(LD_LIBRARY_PATH=${SYSROOT}/lib ./target/debug/clippy-driver ./target/driver_test.rs --rustc) | ||
RUSTC=$(rustc ./target/driver_test.rs) | ||
diff <($CLIPPY) <($RUSTC) |
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.
This ... does not look right. Also this is a change to submodule so I'm not sure you should make it here, but clippy uses subtree
so it might be special.
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.
Is there any difference between `` and $()? I changed it because shellcheck warned about it and as far as I know they do the same thing.
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.
Oh no your change is fine, I mean running eval on dynamically generated code. Normally I'd suggest to add quotes around the $(...)
but since I don't understand this code I'm afraid to change it.
I think this might be because you made the PR from the master branch? Not sure what's going on here. |
r? @jyn514 I'm positive that pietro doesn't have time ;) |
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.
I added suggestions.
No idea either, the only thing I added to that file was #!/usr/bin/env bash, don't know how it could've made it fail. |
I'll get to work on these suggestions once I get home by the way, can probably finish this today still |
Alright, done - I still have no idea why CI is failing with .git being read only |
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
Hmm, not sure what would cause this, let me take another look at the changes. |
@@ -31,35 +31,35 @@ exit 1 | |||
# First up, build a cross-compiler | |||
git clone --depth=1 https://git.haiku-os.org/haiku | |||
git clone --depth=1 https://git.haiku-os.org/buildtools | |||
cd $BUILDTOOLS/jam | |||
cd "$BUILDTOOLS/jam" |
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.
Hi @pta2002, you marked this as resolved but didn't change the lines. If they don't need to be changed, can you explain why?
src/ci/docker/host-x86_64/disabled/dist-x86_64-dragonfly/build-toolchain.sh
Outdated
Show resolved
Hide resolved
src/ci/init_repo.sh
Outdated
modules="$(git config --file .gitmodules --get-regexp '\.path$' | cut -d' ' -f2)" | ||
modules=($modules) | ||
read -ra modules <<< "$(git config --file .gitmodules --get-regexp '\.path$' | cut -d' ' -f2)" | ||
use_git="" | ||
urls="$(git config --file .gitmodules --get-regexp '\.url$' | cut -d' ' -f2)" | ||
urls=($urls) | ||
for i in ${!modules[@]}; do | ||
module=${modules[$i]} | ||
read -ra urls <<< "$(git config --file .gitmodules --get-regexp '\.url$' | cut -d' ' -f2)" | ||
|
||
for i in "${!modules[@]}"; do |
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 had to guess, this is what's causing CI to fail. I would revert the changes for now I think.
Let's see if this works |
Seems like now it's failing due to not finding a cached build |
Hm from what I can tell, somewhere a .tar.gz got dropped in that URL, but where I have no idea, because I didn't remove any in my changes. |
src/ci/run.sh
Outdated
CARGO_INCREMENTAL=0 $PYTHON ../x.py check | ||
rm -f config.toml | ||
rm -rf build | ||
fi | ||
|
||
$SRC/configure $RUST_CONFIGURE_ARGS | ||
"$SRC"/configure "$RUST_CONFIGURE_ARGS" |
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.
This doesn't look correct. This used to be many different arguments, like --set x --set y
; now it's one argument all at once. I think you should change it back to how it was before. If you want to silence the shellcheck warning you could trying using an array instead but I'd revert it for now just to make sure it works.
Oh you're right, I didn't catch that! I'll revert it.
A sábado, 3/10/2020, 04:58, Joshua Nelson <notifications@github.com>
escreveu:
… ***@***.**** commented on this pull request.
------------------------------
In src/ci/run.sh
<#77376 (comment)>:
> CARGO_INCREMENTAL=0 $PYTHON ../x.py check
rm -f config.toml
rm -rf build
fi
-$SRC/configure $RUST_CONFIGURE_ARGS
+"$SRC"/configure "$RUST_CONFIGURE_ARGS"
This doesn't look correct. This used to be many different arguments, like --set
x --set y; now it's one argument all at once. I think you should change
it back to how it was before. If you want to silence the shellcheck warning
you could trying using an array instead but I'd revert it for now just to
make sure it works.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#77376 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABYZLTEWI2WSNTXLD74U4IDSI2OOBANCNFSM4R7SWJQQ>
.
|
Well that took a while, looks like it's fixed now though, at least CI has gone off to actually compile rust. |
@Mark-Simulacrum I'm reasonably happy with the current code, but I wouldn't stake my life on there being no regressions. How do you want to move forward? |
oh and while we're at it, let's try and catch more issues early @bors try |
⌛ Trying commit c640a44 with merge a8d42c75c152f5994caaffca294da2b534eade44... |
I don't have the time/bandwidth to invest in figuring out the shell script changes here, it's very error prone (as you have already seen) and I have no good ideas on avoiding regressions. IMO, it is questionable whether the improvements in this PR are worth it given the possibility of regressions and likelihood of reintroducing shellcheck-warned code over time. Largely I just don't know that we get value out of this that outweighs the downsides. That said, we have already branched beta, so it's as early in the cycle as it's going to get. |
src/etc/cat-and-grep.sh
Outdated
@@ -59,7 +58,7 @@ if command -v "g${GREPPER}"; then | |||
fi | |||
|
|||
LOG=$(mktemp -t cgrep.XXXXXX) | |||
trap "rm -f $LOG" EXIT | |||
trap 'rm -f $LOG' EXIT |
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.
Please revert this change in behavior.
src/tools/clippy/.github/driver.sh
Outdated
CLIPPY=`LD_LIBRARY_PATH=${SYSROOT}/lib ./target/debug/clippy-driver ./target/driver_test.rs --rustc` | ||
RUSTC=`rustc ./target/driver_test.rs` | ||
CLIPPY=$(LD_LIBRARY_PATH=${SYSROOT}/lib ./target/debug/clippy-driver ./target/driver_test.rs --rustc) | ||
RUSTC=$(rustc ./target/driver_test.rs) | ||
diff <($CLIPPY) <($RUSTC) | ||
|
||
# TODO: CLIPPY_CONF_DIR / CARGO_MANIFEST_DIR |
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.
I would suggest that clippy CI changes are not done in this PR, as you really can't test them without running Clippy's CI. It should be fairly easily to port these to a Clippy PR though.
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.
That makes sense, I'll take these off and submit them to clippy separately
Closing this as it doesn't look likely it will be approved in this state. If you have a better way of handling this, you can submit a new pull request. Thanks |
Should take care of #77290, but since there's a good chance I'll do a second pass through the scripts, I'm leaving this here to check with CI.