Re: [PATCH 1/2] rust: suppress error messages from CONFIG_{RUSTC,BINDGEN}_VERSION_TEXT

From: Masahiro Yamada
Date: Sun Jul 28 2024 - 04:03:37 EST


On Sun, Jul 28, 2024 at 2:05 AM Miguel Ojeda
<miguel.ojeda.sandonis@xxxxxxxxx> wrote:
>
> On Sat, Jul 27, 2024 at 4:03 PM Masahiro Yamada <masahiroy@xxxxxxxxxx> wrote:
> >
> > The successful execution of 'command -v rustc' does not necessarily mean
> > that 'rustc --version' will succeed.
>
> +1, it could also be e.g. non-executable.
>
> By the way, I was checking recently `pahole-version.sh` for a series I
> will send about `RUSTC_VERSION` and I saw that one has a `[ ! -x`
> check after the `command -v` for the non-executable case. But taking
> into account what you say here, I wonder if something needs to be done
> there too, e.g.
>
> $ echo 'bad' > bad-pahole
> $ chmod u+x bad-pahole
> $ make PAHOLE=./bad-pahole defconfig
> ...
> ./bad-pahole: 1: bad: not found
> init/Kconfig:112: syntax error
> init/Kconfig:112: invalid statement
>
> So perhaps we can put in pahole-version.sh something like:
>
> if output=$("$@" --version 2>/dev/null); then
> echo $output | sed -E 's/v([0-9]+)\.([0-9]+)/\1\2/'
> else
> echo 0
> exit 1
> fi
>
> i.e. similar to what you do here for `rustc`/`bindgen`.



Agree.
pahole-version.sh should be fixed too.




>
> > However, I did not understand the necessity of 'command -v $(RUSTC)'.
>
> I agree, I don't think it is needed.
>
> If you want to take it through your tree:
>
> Acked-by: Miguel Ojeda <ojeda@xxxxxxxxxx>
> Tested-by: Miguel Ojeda <ojeda@xxxxxxxxxx>
>
> Otherwise, I can take it too.


Yes, please take this to your tree. Thanks.






--
Best Regards
Masahiro Yamada