public inbox for linux-perf-users@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] perf tools: Fix perf object dir symbolic link
@ 2025-02-28 21:48 Charlie Jenkins
  2025-02-28 21:58 ` Charlie Jenkins
  0 siblings, 1 reply; 2+ messages in thread
From: Charlie Jenkins @ 2025-02-28 21:48 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
	Ian Rogers, Adrian Hunter, Andi Kleen
  Cc: Arnaldo Carvalho de Melo, linux-perf-users, linux-kernel,
	Charlie Jenkins

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")
---
 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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] perf tools: Fix perf object dir symbolic link
  2025-02-28 21:48 [PATCH] perf tools: Fix perf object dir symbolic link Charlie Jenkins
@ 2025-02-28 21:58 ` Charlie Jenkins
  0 siblings, 0 replies; 2+ messages in thread
From: Charlie Jenkins @ 2025-02-28 21:58 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
	Ian Rogers, Adrian Hunter, Andi Kleen
  Cc: Arnaldo Carvalho de Melo, linux-perf-users, linux-kernel

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
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-02-28 21:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-28 21:48 [PATCH] perf tools: Fix perf object dir symbolic link Charlie Jenkins
2025-02-28 21:58 ` Charlie Jenkins

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox