1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

makefiles: Reject 2>&1 > /dev/null

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: https://github.com/RIOT-OS/RIOT/pull/16775
This commit is contained in:
chrysn 2022-04-16 10:02:56 +02:00
parent 12758b94fc
commit d94b4e0ec1

View File

@ -349,6 +349,19 @@ check_no_riot_config() {
| error_with_message "Don't push RIOT_CONFIG_* definitions upstream. Rather define configuration via Kconfig"
}
check_stderr_null() {
local patterns=()
local pathspec=()
patterns+=(-e '2>[[:blank:]]*&1[[:blank:]]*>[[:blank:]]*/dev/null')
pathspec+=('Makefile*')
pathspec+=('**/Makefile*')
pathspec+=('**/*.mk')
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."
}
error_on_input() {
! grep ''
}
@ -369,6 +382,7 @@ all_checks() {
check_no_usemodules_in_makefile_include
check_no_pkg_source_local
check_no_riot_config
check_stderr_null
}
main() {