-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
Fixes for shellcheck warnings, part 1 #10586
Conversation
de00b7e
to
2d99157
Compare
2d99157
to
d54e4f0
Compare
RUN_STEPS=$(seq 2 "$STEPS" | circleci tests split | xargs) | ||
fi | ||
else | ||
RUN_STEPS=$(seq "$STEPS") | ||
RUN_STEPS=$(seq "$STEPS" | xargs) | ||
fi | ||
|
||
# turn newlines into spaces | ||
RUN_STEPS=$(echo $RUN_STEPS) | ||
|
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.
So we ended up with #9421 (comment) anyway...
@cameel why is it a draft? |
scripts/check_style.sh
Outdated
preparedGrep "[a-zA-Z0-9_]\s*[*][a-zA-Z_]" | egrep -v -e "return [*]" -e "^* [*]" -e "^*//.*" | ||
) | egrep -v -e "^[a-zA-Z\./]*:[0-9]*:\s*\/(\/|\*)" -e "^test/" | ||
preparedGrep "[a-zA-Z0-9_]\s*[*][a-zA-Z_]" | grep -E -v -e "return [*]" -e "^* [*]" -e "^*//.*" | ||
) | grep -E -v -e "^[a-zA-Z\./]*:[0-9]*:\s*\/(\/|\*)" -e "^test/" |
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.
Does this work on MacOS as well? I think we had some problems in the past because of grep -E
, but might be imagining that
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 haven't checked that yet. This is the reason why this and #10585 are still drafts - I need to test this stuff a bit more because we have very little coverage for shell scripts but I want to finish the bytecode compare PRs first.
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 should be fine on macOS. -E
is one of the options that work the same way between Linux and macOS. AFAIK -P
(--perl-regexp
) that we're using in get_version.sh
is the problematic one.
|
||
mkdir -p build | ||
cd build || 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.
Why were these removed?
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.
Because I added set -eu
at the top of the script so it will fail automatically if cd
fails.
Basically, I'm not yet 100% confident that this does not break anything and I want to test it manually a bit more but I'm stuck in the bytecode compare PRs at the moment and I want to finish them first. |
I think you could definitely merge without hesitation the |
echo "Obtained:" | ||
echo "$(cat ./obtained.json)" | ||
cat ./obtained.json |
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.
Also this is pretty clearly not breaking anything?
@axic Yeah, that sounds like a good idea. I'm going to split this PR into smaller ones and get it merged in smaller pieces to make it more manageable. The changes you mentioned will go in first. |
d54e4f0
to
5cda31d
Compare
c61aefa
to
d075ffd
Compare
d075ffd
to
cde45fc
Compare
37b0f80
to
cba6e68
Compare
1585d01
to
1e5f0e5
Compare
@@ -93,6 +93,6 @@ for (var optimize of [false, true]) | |||
} | |||
EOF | |||
chmod +x solc | |||
./solc *.sol > /tmp/report.txt | |||
./solc -- *.sol > /tmp/report.txt |
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 --?
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 you have a file that's named like a command line option, *
will match it. For example if there's a file called -rf
and you do rm *
, you're actually doing rm -rf *
:) To avoid this the convention in many programs is that stuff after --
is never interpreted as an option. So rm -- *
is safe even if you have a file called -rf
.
Another way to avoid that is to use ./*
instead of *
because for most programs the difference between x.txt
and ./x.txt
does not matter. Unfortunately for solc
it does (though it might change soon: #4702). I used ./*
in most places that shellcheck pointed out becuase that's more universal but I could not do it here. Fortunately boost::program_options
does support --
so that's the workaround I used.
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.
Ah ok!
…r do not have a shebang at all
2806eb8
to
09c9591
Compare
… like command-line options
…leFull - This is a global variable and would be better to just make it a parameter. At least this makes shellcheck shut up
09c9591
to
cf94c3f
Compare
Looks good, can you squash? I'll approve then |
Why squash though? It's not a pile of random fixup commits :) Each commit deals with a different warning and the description says what is being fixed. It's just that there were quite a few different things to fix. It would be a jumbled mess if I squashed that so I'd rather not. |
Hmmm ok, it's quite a lot of commits though. I'll approve it anyway, if anyone doesn't like it blame @cameel ! |
Yeah, I know. But do we have a rule against that? No one is being paid by the commit anyway :) I thought that it's more about whether it appropriate for the situation. I do see that there's a tendency towards bigger commits in Solidity so I mostly try to do that too and only have a few per PR even though personally I prefer smaller ones. Especially in PRs like this one where the fix consists of many independent parts that are better off viewed separately, I think smaller ones make more sense. There are bigger and smaller changes here and I think that without separating them the smaller ones can easily get lost in the noise. |
That's fine with me |
Depends on #10877.It's ondevelop
now.This PR fixes most of shellcheck warnings in our scripts. Those are only the ones that were not actual errors (those are covered by #10584, #10583) or just missing quotes (#10585, #10877).
These are not all fixes, just the ones that I could easily put in an independent branch. I have a few more but they depend on all the other branches so I'd like to get these here merged first. When we're done with them I'll submit the rest and another PR that removes all the scripts (now warning-free) from shellcheck ignore list.EDIT: I decided to just put it on top of the other PRs and just get them all through review one by one. So this will remain a draft until all the PRs below are merged.EDIT: Ready for review.