lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Zuws_qal2uJs0B2V@l-nschier-nb>
Date: Thu, 19 Sep 2024 15:54:06 +0200
From: Nicolas Schier <n.schier@....de>
To: Masahiro Yamada <masahiroy@...nel.org>
Cc: linux-kbuild@...r.kernel.org, Miguel Ojeda <ojeda@...nel.org>,
	rust-for-linux@...r.kernel.org, linux-kernel@...r.kernel.org,
	Nathan Chancellor <nathan@...nel.org>
Subject: Re: [PATCH 08/23] kbuild: simplify find command for rustfmt

On Tue, Sep 17, 2024 at 11:16:36PM +0900, Masahiro Yamada wrote:
> The current 'find' command does not prune the rust/test directory
> itself, requiring an additional 'grep -Fv' command to exclude it.
> This is cumbersome.
> 
> The correct use of the -prune option can be seen in the 'make clean'
> rule.
> 
> [Current command]
> 
>   $ find . -type f -name '*.rs' -o -path ./rust/test -prune | wc
>        70      70    1939
>   $ find . -type f -name '*.rs' -o -path ./rust/test -prune | grep rust/test
>   ./rust/test
> 
> [Improved command]
> 
>   $ find . -path ./rust/test -prune -o -type f -name '*.rs' -print | wc
>        69      69    1927
>   $ find . -path ./rust/test -prune -o -type f -name '*.rs' -print | grep rust/test
> 
> With the improved 'find' command, the grep command is no longer needed.
> 
> There is also no need to use the absolute path, so $(abs_srctree) can be
> replaced with $(srctree).
> 
> The pruned directory rust/test must be prefixed with $(srctree) instead
> of $(objtree). Otherwise, 'make O=... rustfmt' would visit the stale
> rust/test directory remaining in the source tree.
> 
> Signed-off-by: Masahiro Yamada <masahiroy@...nel.org>
> ---
> 
>  Makefile | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/Makefile b/Makefile
> index 5b16e0605a77..4992b2895dd5 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -1740,9 +1740,8 @@ PHONY += rustfmt rustfmtcheck
>  # when matching, which is a problem when e.g. `srctree` is `..`.
>  # We `grep` afterwards in order to remove the directory entry itself.
>  rustfmt:
> -	$(Q)find $(abs_srctree) -type f -name '*.rs' \
> -		-o -path $(abs_objtree)/rust/test -prune \
> -		| grep -Fv $(abs_objtree)/rust/test \
> +	$(Q)find $(srctree) -path $(srctree)/rust/test -prune \
> +		-o -type f -name '*.rs' -print \
>  		| grep -Fv generated \

Is there a reason for keeping the grep for generated instead of turning
it also into a find prune argument?

Reviewed-by: Nicolas Schier <n.schier@....de>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ