[PATCH] perf tools: Fix perf object dir symbolic link

Charlie Jenkins posted 1 patch 11 months, 1 week ago
tools/perf/Makefile.perf | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Re: [PATCH] perf tools: Fix perf object dir symbolic link
Posted by Charlie Jenkins 11 months, 1 week ago
On Fri, Feb 28, 2025 at 01:48:32PM -0800, Charlie Jenkins wrote:
> The -n flag is needed as an argument to ln to avoid recursively setting
> the symbolic link when OUTPUT is the same as $(srctree)/tools/perf.
> 
> Without this flag, the perf binary at $(srctree)/tools/perf/perf will
> become overwritten with a symbolic link to the parent directory.
> 
> Additionally, remove the forward slash after $(OUTPUT) since $(OUTPUT)
> implicitly includes a forward slash.
> 
> Signed-off-by: Charlie Jenkins <charlie@rivosinc.com>
> Fixes: 890a1961c812 ("perf tools: Create source symlink in perf object dir")

I should have double checked that this patch didn't exist already, I see
there is another thread here:

https://lore.kernel.org/lkml/Z5aiWiqJbkNaVG2Y@google.com/T/

- Charlie

> ---
>  tools/perf/Makefile.perf | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
> index 55d6ce9ea52fb2a57b8632cc6d0ddc501e29cbfc..0b6f9de6f222da1181402aa33e41ec3b05f9189e 100644
> --- a/tools/perf/Makefile.perf
> +++ b/tools/perf/Makefile.perf
> @@ -158,7 +158,7 @@ ifneq ($(OUTPUT),)
>  VPATH += $(OUTPUT)
>  export VPATH
>  # create symlink to the original source
> -SOURCE := $(shell ln -sf $(srctree)/tools/perf $(OUTPUT)/source)
> +SOURCE := $(shell ln -sfn $(srctree)/tools/perf $(OUTPUT)source)
>  endif
>  
>  # Beautify output
> 
> ---
> base-commit: 0ad2507d5d93f39619fc42372c347d6006b64319
> change-id: 20250228-b4-fix_perf_symbolic_link-8cc373a195ac
> -- 
> - Charlie
>