Re: [PATCH] scripts: dtc-version: Don't show error messages
On 2024-02-06 11:41, Quentin Schulz wrote: On 2/6/24 11:37, Dragan Simic wrote: On 2024-02-06 11:25, Quentin Schulz wrote: On 2/6/24 04:56, Dragan Simic wrote: Prevent the error messages produced by which(1), such as the one quoted below, from being visible in the build outputs. which: no dtc in (./scripts/dtc) This makes the build outputs look a tiny bit cleaner. Signed-off-by: Dragan Simic --- scripts/dtc-version.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/dtc-version.sh b/scripts/dtc-version.sh index 53ff868bcdce..6d3d7b68fdfa 100755 --- a/scripts/dtc-version.sh +++ b/scripts/dtc-version.sh @@ -15,7 +15,7 @@ if [ ${#dtc} -eq 0 ]; then exit 1 fi -if ! which $dtc >/dev/null ; then +if ! which $dtc >/dev/null 2>/dev/null ; then What about which $dtc > /dev/null 2>&1 instead? That's exactly what I intended to use, but IIRC some shells or some older versions of some shells may not recognize that, so I went with a more verbose, but slightly safer option. $ git -c core.pager='' grep "2>&1" scripts scripts/Kbuild.include: if (which $(strip $(c))$(CC)) > /dev/null 2>&1 ; then \ scripts/Kbuild.include: if ($(1)) >/dev/null 2>&1;\ scripts/Kbuild.include:cc-name = $(shell $(CC) -v 2>&1 | grep -q "clang version" && echo clang || echo gcc) scripts/Kconfig.include:if-success = $(shell,{ $(1); } >/dev/null 2>&1 && echo "$(2)" || echo "$(3)") scripts/checkpatch.pl: $maintained_status{$filename} = `perl $root/scripts/get_maintainer.pl --status --nom --nol --nogit --nogit-fallback -f $filename 2>&1`; scripts/checkpatch.pl: my $output = `${git_command} log --no-color --format='%H %s' -1 $commit 2>&1`; scripts/coccicheck:echo $SPFLAGS | grep -Ee "--profile|--show-trying" 2>&1 > /dev/null scripts/decodecode: ${CROSS_COMPILE}as $AFLAGS -o $1.o $1.s > /dev/null 2>&1 scripts/decodecode: grep -v "/tmp\|Disassembly\|\.text\|^$" > $1.dis 2>&1 scripts/gcc-stack-usage.sh:cat &1 \ scripts/get_maintainer.pl: my $output = `git ls-remote --exit-code -h "$url" $branch > /dev/null 2>&1`; scripts/get_maintainer.pl:$cmd .= " 2>&1"; scripts/kernel-doc: open IN, "$cmd --version 2>&1 |"; So we're probably fine? Obviously. :) I'll send the v2.
Re: [PATCH] scripts: dtc-version: Don't show error messages
Hi Dragan, On 2/6/24 11:37, Dragan Simic wrote: [You don't often get email from dsi...@manjaro.org. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ] Hello Quentin, On 2024-02-06 11:25, Quentin Schulz wrote: On 2/6/24 04:56, Dragan Simic wrote: Prevent the error messages produced by which(1), such as the one quoted below, from being visible in the build outputs. which: no dtc in (./scripts/dtc) This makes the build outputs look a tiny bit cleaner. Signed-off-by: Dragan Simic --- scripts/dtc-version.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/dtc-version.sh b/scripts/dtc-version.sh index 53ff868bcdce..6d3d7b68fdfa 100755 --- a/scripts/dtc-version.sh +++ b/scripts/dtc-version.sh @@ -15,7 +15,7 @@ if [ ${#dtc} -eq 0 ]; then exit 1 fi -if ! which $dtc >/dev/null ; then +if ! which $dtc >/dev/null 2>/dev/null ; then What about which $dtc > /dev/null 2>&1 instead? That's exactly what I intended to use, but IIRC some shells or some older versions of some shells may not recognize that, so I went with a more verbose, but slightly safer option. $ git -c core.pager='' grep "2>&1" scripts scripts/Kbuild.include: if (which $(strip $(c))$(CC)) > /dev/null 2>&1 ; then \ scripts/Kbuild.include: if ($(1)) >/dev/null 2>&1;\ scripts/Kbuild.include:cc-name = $(shell $(CC) -v 2>&1 | grep -q "clang version" && echo clang || echo gcc) scripts/Kconfig.include:if-success = $(shell,{ $(1); } >/dev/null 2>&1 && echo "$(2)" || echo "$(3)") scripts/checkpatch.pl: $maintained_status{$filename} = `perl $root/scripts/get_maintainer.pl --status --nom --nol --nogit --nogit-fallback -f $filename 2>&1`; scripts/checkpatch.pl: my $output = `${git_command} log --no-color --format='%H %s' -1 $commit 2>&1`; scripts/coccicheck:echo $SPFLAGS | grep -Ee "--profile|--show-trying" 2>&1 > /dev/null scripts/decodecode: ${CROSS_COMPILE}as $AFLAGS -o $1.o $1.s > /dev/null 2>&1 scripts/decodecode: grep -v "/tmp\|Disassembly\|\.text\|^$" > $1.dis 2>&1 scripts/gcc-stack-usage.sh:cat <-c -o $TMP >/dev/null 2>&1 \ scripts/get_maintainer.pl: my $output = `git ls-remote --exit-code -h "$url" $branch > /dev/null 2>&1`; scripts/get_maintainer.pl:$cmd .= " 2>&1"; scripts/kernel-doc: open IN, "$cmd --version 2>&1 |"; So we're probably fine? Cheers, Quentin
Re: [PATCH] scripts: dtc-version: Don't show error messages
Hello Quentin, On 2024-02-06 11:25, Quentin Schulz wrote: On 2/6/24 04:56, Dragan Simic wrote: Prevent the error messages produced by which(1), such as the one quoted below, from being visible in the build outputs. which: no dtc in (./scripts/dtc) This makes the build outputs look a tiny bit cleaner. Signed-off-by: Dragan Simic --- scripts/dtc-version.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/dtc-version.sh b/scripts/dtc-version.sh index 53ff868bcdce..6d3d7b68fdfa 100755 --- a/scripts/dtc-version.sh +++ b/scripts/dtc-version.sh @@ -15,7 +15,7 @@ if [ ${#dtc} -eq 0 ]; then exit 1 fi -if ! which $dtc >/dev/null ; then +if ! which $dtc >/dev/null 2>/dev/null ; then What about which $dtc > /dev/null 2>&1 instead? That's exactly what I intended to use, but IIRC some shells or some older versions of some shells may not recognize that, so I went with a more verbose, but slightly safer option. Reviewed-by: Quentin Schulz Thanks for your review.
Re: [PATCH] scripts: dtc-version: Don't show error messages
Hi Dragan, On 2/6/24 04:56, Dragan Simic wrote: [You don't often get email from dsi...@manjaro.org. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ] Prevent the error messages produced by which(1), such as the one quoted below, from being visible in the build outputs. which: no dtc in (./scripts/dtc) This makes the build outputs look a tiny bit cleaner. Signed-off-by: Dragan Simic --- scripts/dtc-version.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/dtc-version.sh b/scripts/dtc-version.sh index 53ff868bcdce..6d3d7b68fdfa 100755 --- a/scripts/dtc-version.sh +++ b/scripts/dtc-version.sh @@ -15,7 +15,7 @@ if [ ${#dtc} -eq 0 ]; then exit 1 fi -if ! which $dtc >/dev/null ; then +if ! which $dtc >/dev/null 2>/dev/null ; then What about which $dtc > /dev/null 2>&1 instead? In any case, Reviewed-by: Quentin Schulz Thanks, Quentin