[PATCH] perf evsel: display dmesg command of showing a hardcoded path

Masum Reza posted 1 patch 2 months, 1 week ago
tools/perf/util/evsel.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] perf evsel: display dmesg command of showing a hardcoded path
Posted by Masum Reza 2 months, 1 week ago
In non-FHS compliant distros like NixOS, nothing resides in `/bin`
and `/usr/bin`. Instead dynamically symlinked into
`/run/current-system/sw/bin/`, the executable resides in `/nix/store`.

With this patch,`/bin` prefix from the dmesg command in the error
message is stripped.

Link: https://github.com/NixOS/nixpkgs/pull/258027

Signed-off-by: Masum Reza <masumrezarock100@gmail.com>

---
 tools/perf/util/evsel.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index bc603193c477..7a06b7cfdc7e 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -3342,7 +3342,7 @@ int evsel__open_strerror(struct evsel *evsel, struct target *target,
 
 	return scnprintf(msg, size,
 	"The sys_perf_event_open() syscall returned with %d (%s) for event (%s).\n"
-	"/bin/dmesg | grep -i perf may provide additional information.\n",
+	"\"dmesg | grep -i perf\" may provide additional information.\n",
 			 err, str_error_r(err, sbuf, sizeof(sbuf)), evsel__name(evsel));
 }
 
-- 
2.46.0
Re: [PATCH] perf evsel: display dmesg command of showing a hardcoded path
Posted by Namhyung Kim 2 months ago
On Sun, 22 Sep 2024 16:56:16 +0530, Masum Reza wrote:

> In non-FHS compliant distros like NixOS, nothing resides in `/bin`
> and `/usr/bin`. Instead dynamically symlinked into
> `/run/current-system/sw/bin/`, the executable resides in `/nix/store`.
> 
> With this patch,`/bin` prefix from the dmesg command in the error
> message is stripped.
> 
> [...]

Applied to perf-tools-next, thanks!

Best regards,
Namhyung