diff mbox series

scripts: dtc-version: Don't show error messages

Message ID aebd96be57ec59ace348287094ab919ce82711c9.1707191569.git.dsimic@manjaro.org
State Superseded
Delegated to: Tom Rini
Headers show
Series scripts: dtc-version: Don't show error messages | expand

Commit Message

Dragan Simic Feb. 6, 2024, 3:56 a.m. UTC
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 <dsimic@manjaro.org>
---
 scripts/dtc-version.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Quentin Schulz Feb. 6, 2024, 10:25 a.m. UTC | #1
Hi Dragan,

On 2/6/24 04:56, Dragan Simic wrote:
> [You don't often get email from dsimic@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 <dsimic@manjaro.org>
> ---
>   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 <quentin.schulz@theobroma-systems.com>

Thanks,
Quentin
Dragan Simic Feb. 6, 2024, 10:37 a.m. UTC | #2
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 <dsimic@manjaro.org>
>> ---
>>   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 <quentin.schulz@theobroma-systems.com>

Thanks for your review.
Quentin Schulz Feb. 6, 2024, 10:41 a.m. UTC | #3
Hi Dragan,

On 2/6/24 11:37, Dragan Simic wrote:
> [You don't often get email from dsimic@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 <dsimic@manjaro.org>
>>> ---
>>>   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 <<END | $@ -Werror -fstack-usage -x c - 
-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
Dragan Simic Feb. 6, 2024, 10:43 a.m. UTC | #4
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 <dsimic@manjaro.org>
>>>> ---
>>>>   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 <<END | $@ -Werror -fstack-usage -x c -
> -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?

Obviously. :)  I'll send the v2.
diff mbox series

Patch

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
 	echo "Error: Cannot find dtc: $dtc"
 	exit 1
 fi