From d94b4e0ec19d24535ad9b5a477704ffac097c1e9 Mon Sep 17 00:00:00 2001 From: chrysn Date: Sat, 16 Apr 2022 10:02:56 +0200 Subject: [PATCH] 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 --- dist/tools/buildsystem_sanity_check/check.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/dist/tools/buildsystem_sanity_check/check.sh b/dist/tools/buildsystem_sanity_check/check.sh index a7ebe0f18c..d152251381 100755 --- a/dist/tools/buildsystem_sanity_check/check.sh +++ b/dist/tools/buildsystem_sanity_check/check.sh @@ -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() {