-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Remove which
from shell invocations
#16776
Remove which
from shell invocations
#16776
Conversation
Checking Ubuntu versions, |
|
||
pathspec+=('**/Makefile*') | ||
git -C "${RIOTBASE}" grep -n "${patterns[@]}" -- "${pathspec[@]}" \ | ||
| error_with_message "Don't push PKG_SOURCE_LOCAL definitions upstream" |
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.
Wrong error message ;-)
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.
In-very-deed. Thanks, fixed. (And tests generally improved, and one for the redirects of #16775 added for good measure.)
git -C "${RIOTBASE}" grep -n "${patterns[@]}" -- "${pathspec[@]}" \ | ||
| error_with_message "Redirecting stderr and stdout to /dev/null is \`>/dev/null 2>&1\`; the other way round puts the old stderr to the new stdout." |
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 am not sure this can be generally assumed. I myself, actually, sometimes use 2>&1 > /dev/null
where one would use &> /dev/null
in bash
(which is a bashism that does not work in every shell, such as dash
)
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.
2>&1 >/dev/null
sends the old stderr to the original stdout.
>/dev/null 2>&1
does as &>/dev/null
and sends both to /dev/null.
This is what caused the errors in #16776 when output to stderr was suddenly misdirected into a stdout where it was to be compared to echo $?
's "0" output.
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, gotcha!
please rebase @chrysn |
c8dcc28
to
a91d870
Compare
The Python error looks like there's a stray redirect somewhere, investigating... |
I think https://github.com/RIOT-OS/RIOT/pull/16776/checks?check_run_id=3445443625#step:7:47 tells the truth. RIOT/.github/workflows/tools-test.yml Line 27 in 719a18c
|
I deem this out of scope of this PR though ;-). |
curl and wget not being found are the typical symptoms of a failing |
Yeah, I noticed that as well, that's why I removed the comment ;-) |
taken care in #16784, lets see if no unexpected things blow up. |
As the POSIX documentation[1] of `command -v` guarantees that on error there will be no output (and there will be output in the other cases), the tests in Makefiles were simplified to test for output equality to the empty string. Redirects swallowing error outputs were removed, as the command produces no error output there (as recommended at [2]). Existing uses of `command` are simplified as well. [1]: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/command.html [2]: https://salsa.debian.org/debian/debianutils/-/blob/master/debian/NEWS
... as that command is deprecated at least on Debian, and a good replacement is available in the form of `command -v`.
While this could theoretically be desired, it's usually just a mishap. It is unlikely that legitimate cases will be needed in the build system; if so, they can exclude themselves. See-Also: RIOT-OS#16775
... because even though it looks like a subshell, it apparently is not evaluated through a shell but passed right into exec.
cea69d1
to
8664eb8
Compare
For reasons I can't fathom (might be #16784, but I don't see how), the spurious errors in the Python checks are now gone. Good to go? |
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.
ACK!
That's how: #16776 (comment) |
Something went wrong :-/ #16020 |
Why were compile tests skipped on a build system change? |
Revert WIP, explaining later. |
Alternatively, there is the hard way here #16803 |
#16804 is up now to fix the immediate fallout. |
Contribution description
The
which
command is being deprecated in Debian (see references below).This moves all invocations in the build system from
which
to the successorcommand -v
.Testing procedure
Try building anything on a recent Debian sid system. While it'll fail on master, after #16775 you'll get several lines of
that are gone after this patch sequence.
Any attempt to reintroduce
$(shell which ...)
in the Makefiles should also trigger the sanity checks of dist/tools/buildsystem_sanity_check/check.sh.Issues/PRs references
This is a follow-up of (and based on) #16775. It was split out after some build process spew errors for not knowing
command
. As #16775 is blocking my workflows and I'd have to keep it around on each of my branches, I'd like to make that mergable quickly, and keep this for discussions of whether all of our users are now on platforms where command is available. (It has already been in use in some places in the build system, but these seem not to have been covered in that particular build platform).debianutils' which, in its changelog, states:
Note that this PR does not change which to command, it just fixes the fallout of ill-sequenced redirects. That change is probably good to do, but right now this should be minimal enough to get merged quickly, and I don't want it held up in the question of whether everyone and their dog already implement POSIX
command
.