[bpf-next,v2,01/10] samples/bpf: Don't try to remove user's homedir on clean
diff mbox series

Message ID 157909756981.1192265.5504476164632952530.stgit@toke.dk
State New
Headers show
Series
  • tools: Use consistent libbpf include paths everywhere
Related show

Commit Message

Toke Høiland-Jørgensen Jan. 15, 2020, 2:12 p.m. UTC
From: Toke Høiland-Jørgensen <toke@redhat.com>

The 'clean' rule in the samples/bpf Makefile tries to remove backup
files (ending in ~). However, if no such files exist, it will instead try
to remove the user's home directory. While the attempt is mostly harmless,
it does lead to a somewhat scary warning like this:

rm: cannot remove '~': Is a directory

Fix this by using find instead of shell expansion to locate any actual
backup files that need to be removed.

Fixes: b62a796c109c ("samples/bpf: allow make to be run from samples/bpf/ directory")
Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
---
 samples/bpf/Makefile |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jesper Dangaard Brouer Jan. 15, 2020, 3:21 p.m. UTC | #1
On Wed, 15 Jan 2020 15:12:49 +0100
Toke Høiland-Jørgensen <toke@redhat.com> wrote:

> From: Toke Høiland-Jørgensen <toke@redhat.com>
> 
> The 'clean' rule in the samples/bpf Makefile tries to remove backup
> files (ending in ~). However, if no such files exist, it will instead try
> to remove the user's home directory. While the attempt is mostly harmless,
> it does lead to a somewhat scary warning like this:
> 
> rm: cannot remove '~': Is a directory
> 
> Fix this by using find instead of shell expansion to locate any actual
> backup files that need to be removed.
> 
> Fixes: b62a796c109c ("samples/bpf: allow make to be run from samples/bpf/ directory")
> Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>

Kind of scary make clean command!

Acked-by: Jesper Dangaard Brouer <brouer@redhat.com>


> ---
>  samples/bpf/Makefile |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile
> index 5b89c0370f33..f86d713a17a5 100644
> --- a/samples/bpf/Makefile
> +++ b/samples/bpf/Makefile
> @@ -254,7 +254,7 @@ all:
>  
>  clean:
>  	$(MAKE) -C ../../ M=$(CURDIR) clean
> -	@rm -f *~
> +	@find $(CURDIR) -type f -name '*~' -delete

Patch
diff mbox series

diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile
index 5b89c0370f33..f86d713a17a5 100644
--- a/samples/bpf/Makefile
+++ b/samples/bpf/Makefile
@@ -254,7 +254,7 @@  all:
 
 clean:
 	$(MAKE) -C ../../ M=$(CURDIR) clean
-	@rm -f *~
+	@find $(CURDIR) -type f -name '*~' -delete
 
 $(LIBBPF): FORCE
 # Fix up variables inherited from Kbuild that tools/ build system won't like