Skip to contentSkip to conversation

perf tools: Remove unused is_executable_file

PATCH In review [email protected] 2 participants 6 messages Dec 22, 2024 – Dec 23, 2024 perf events

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perf tools: Remove unused is_executable_file

From: "Dr. David Alan Gilbert" <[email protected]>

is_executable_file() has been unused since 2022's
commit 7391db645938 ("perf test: Refactor shell tests allowing subdirs")

Remove it.

---
 tools/perf/util/path.c | 12 ------------
 tools/perf/util/path.h |  1 -
 2 files changed, 13 deletions(-)
tools/perf/util/path.c +0 -12
index 00adf872bf00..e923e2d9e8ad 100644
@@ -67,15 +67,3 @@ bool is_directory(const char *base_path, const struct dirent *dent)
 
 	return S_ISDIR(st.st_mode);
 }
-
-bool is_executable_file(const char *base_path, const struct dirent *dent)
-{
-	char path[PATH_MAX];
-	struct stat st;
-
-	snprintf(path, sizeof(path), "%s/%s", base_path, dent->d_name);
-	if (stat(path, &st))
-		return false;
-
-	return !S_ISDIR(st.st_mode) && (st.st_mode & S_IXUSR);
-}
tools/perf/util/path.h +0 -1
index d94902c22222..083429b7efa3 100644
@@ -12,6 +12,5 @@ int path__join3(char *bf, size_t size, const char *path1, const char *path2, con
 
 bool is_regular_file(const char *file);
 bool is_directory(const char *base_path, const struct dirent *dent);
-bool is_executable_file(const char *base_path, const struct dirent *dent);
 
 #endif /* _PERF_PATH_H */
Signature · 1 line
2.47.1
#1 lore raw
Quoted 6 lines · On Sun, Dec 22, 2024 at 09:58:31PM +0000, [email protected] wrote:

From: "Dr. David Alan Gilbert" <[email protected]>

is_executable_file() has been unused since 2022's
commit 7391db645938 ("perf test: Refactor shell tests allowing subdirs")

Remove it.

Did you patch this on:

https://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git perf-tools-next

?

That function is still there, so I'll fixup your patch, keep your credits and test it all.

Thanks,

- Arnaldo

⬢ [acme@toolbox perf-tools-next]$ b4 am -ctsl --cc-trailers [email protected] Grabbing thread from lore.kernel.org/all/[email protected]/t.mbox.gz Checking for newer revisions
Grabbing search results from lore.kernel.org
Analyzing 1 messages in the thread
Looking for additional code-review trailers on lore.kernel.org
Checking attestation on all messages, may take a moment...
---
✓ [PATCH] perf tools: Remove unused is_executable_file
+ Link: https://lore.kernel.org/r/[email protected]
+ Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
---
✓ Signed: DKIM/treblig.org
---
Total patches: 1
---

Base: not specified

       git am ./20241222_linux_perf_tools_remove_unused_is_executable_file.mbx

⬢ [acme@toolbox perf-tools-next]$ git am ./20241222_linux_perf_tools_remove_unused_is_executable_file.mbx
Applying: perf tools: Remove unused is_executable_file
error: patch failed: tools/perf/util/path.h:12
error: tools/perf/util/path.h: patch does not apply
Patch failed at 0001 perf tools: Remove unused is_executable_file
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config advice.mergeConflict false" ⬢ [acme@toolbox perf-tools-next]$

#2 lore raw
Quoted 8 lines · Arnaldo Carvalho de Melo
Quoted 6 lines · On Sun, Dec 22, 2024 at 09:58:31PM +0000, [email protected] wrote:

From: "Dr. David Alan Gilbert" <[email protected]>

is_executable_file() has been unused since 2022's
commit 7391db645938 ("perf test: Refactor shell tests allowing subdirs")

Remove it.

Quoted 8 lines

Did you patch this on:

https://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git perf-tools-next

?

That function is still there, so I'll fixup your patch, keep your credits and test it all.

FYI, it fails on the .h file:

⬢ [acme@toolbox perf-tools-next]$ patch -p1 < ./20241222_linux_perf_tools_remove_unused_is_executable_file.mbx patching file tools/perf/util/path.c
Hunk #1 succeeded at 77 (offset 10 lines).
patching file tools/perf/util/path.h
Hunk #1 FAILED at 12.
1 out of 1 hunk FAILED -- saving rejects to file tools/perf/util/path.h.rej
⬢ [acme@toolbox perf-tools-next]$ git diff

tools/perf/util/path.c +0 -12
index 9712466c51e2f30e..2e62f272fda8671a 100644
@@ -77,15 +77,3 @@ bool is_directory_at(int dir_fd, const char *path)
 
        return S_ISDIR(st.st_mode);
 }
-
-bool is_executable_file(const char *base_path, const struct dirent *dent)
-{
-       char path[PATH_MAX];
-       struct stat st;
-
-       snprintf(path, sizeof(path), "%s/%s", base_path, dent->d_name);
-       if (stat(path, &st))
-               return false;
-
-       return !S_ISDIR(st.st_mode) && (st.st_mode & S_IXUSR);
-}

⬢ [acme@toolbox perf-tools-next]$

⬢ [acme@toolbox perf-tools-next]$ cat tools/perf/util/path.h.rej

perf/util/path.h +0 -1
@@ -12,6 +12,5 @@ int path__join3(char *bf, size_t size, const char *path1, const char *path2, con
 
 bool is_regular_file(const char *file);
 bool is_directory(const char *base_path, const struct dirent *dent);
-bool is_executable_file(const char *base_path, const struct dirent *dent);
 
 #endif /* _PERF_PATH_H */

⬢ [acme@toolbox perf-tools-next]$

Fixed up, thanks.

- Arnaldo

#3 lore raw
Quoted 11 lines · Arnaldo Carvalho de Melo
Quoted 10 lines · Arnaldo Carvalho de Melo
Quoted 6 lines · On Sun, Dec 22, 2024 at 09:58:31PM +0000, [email protected] wrote:

From: "Dr. David Alan Gilbert" <[email protected]>

is_executable_file() has been unused since 2022's
commit 7391db645938 ("perf test: Refactor shell tests allowing subdirs")

Remove it.

Did you patch this on:

Quoted 8 lines
Quoted 6 lines

https://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git perf-tools-next

?

That function is still there, so I'll fixup your patch, keep your credits and test it all.

FYI, it fails on the .h file:

I also added Carsten to the CC list, since he is the author of the mentioned commit where that function stopped being used.

- Arnaldo

#4 lore raw
In reply to Arnaldo Carvalho de Melo
Quoted 11 lines · * Arnaldo Carvalho de Melo ([email protected]) wrote:
Quoted 10 lines · Arnaldo Carvalho de Melo
Quoted 6 lines · On Sun, Dec 22, 2024 at 09:58:31PM +0000, [email protected] wrote:

From: "Dr. David Alan Gilbert" <[email protected]>

is_executable_file() has been unused since 2022's
commit 7391db645938 ("perf test: Refactor shell tests allowing subdirs")

Remove it.

Did you patch this on:

Quoted 8 lines
Quoted 6 lines

https://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git perf-tools-next

?

That function is still there, so I'll fixup your patch, keep your credits and test it all.

FYI, it fails on the .h file:

Ah, it's because of the new 'is_directory_at' is added just above.

Dave

Quoted 45 lines

⬢ [acme@toolbox perf-tools-next]$ patch -p1 < ./20241222_linux_perf_tools_remove_unused_is_executable_file.mbx patching file tools/perf/util/path.c
Hunk #1 succeeded at 77 (offset 10 lines).
patching file tools/perf/util/path.h
Hunk #1 FAILED at 12.
1 out of 1 hunk FAILED -- saving rejects to file tools/perf/util/path.h.rej
⬢ [acme@toolbox perf-tools-next]$ git diff

tools/perf/util/path.c +0 -12
index 9712466c51e2f30e..2e62f272fda8671a 100644
@@ -77,15 +77,3 @@ bool is_directory_at(int dir_fd, const char *path)
 
        return S_ISDIR(st.st_mode);
 }
-
-bool is_executable_file(const char *base_path, const struct dirent *dent)
-{
-       char path[PATH_MAX];
-       struct stat st;
-
-       snprintf(path, sizeof(path), "%s/%s", base_path, dent->d_name);
-       if (stat(path, &st))
-               return false;
-
-       return !S_ISDIR(st.st_mode) && (st.st_mode & S_IXUSR);
-}

⬢ [acme@toolbox perf-tools-next]$

⬢ [acme@toolbox perf-tools-next]$ cat tools/perf/util/path.h.rej

perf/util/path.h +0 -1
@@ -12,6 +12,5 @@ int path__join3(char *bf, size_t size, const char *path1, const char *path2, con
 
 bool is_regular_file(const char *file);
 bool is_directory(const char *base_path, const struct dirent *dent);
-bool is_executable_file(const char *base_path, const struct dirent *dent);
 
 #endif /* _PERF_PATH_H */

⬢ [acme@toolbox perf-tools-next]$

Fixed up, thanks.

- Arnaldo

Signature · 4 lines
 -----Open up your eyes, open up your mind, open up your code -------   
/ Dr. David Alan Gilbert    |       Running GNU/Linux       | Happy  \ 
\        dave @ treblig.org |                               | In Hex /
 \ _________________________|_____ http://www.treblig.org   |_______/
#5 lore raw
In reply to Arnaldo Carvalho de Melo
Quoted 6 lines · * Arnaldo Carvalho de Melo ([email protected]) wrote:
Quoted 5 lines · On Sun, Dec 22, 2024 at 09:58:31PM +0000, [email protected] wrote:

From: "Dr. David Alan Gilbert" <[email protected]>

is_executable_file() has been unused since 2022's
commit 7391db645938 ("perf test: Refactor shell tests allowing subdirs")

Quoted 7 lines
Quoted 1 line

Remove it.

Did you patch this on:

https://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git perf-tools-next

?

Apologies, this is on 6.13-rc4 (ish - it might have been slightly further back when I sent it).

Quoted 3 lines

That function is still there, so I'll fixup your patch, keep your credits and test it all.

Thanks!

Dave

Quoted 34 lines

Thanks,

- Arnaldo

⬢ [acme@toolbox perf-tools-next]$ b4 am -ctsl --cc-trailers [email protected] Grabbing thread from lore.kernel.org/all/[email protected]/t.mbox.gz Checking for newer revisions
Grabbing search results from lore.kernel.org
Analyzing 1 messages in the thread
Looking for additional code-review trailers on lore.kernel.org
Checking attestation on all messages, may take a moment...
---
✓ [PATCH] perf tools: Remove unused is_executable_file
+ Link: https://lore.kernel.org/r/[email protected]
+ Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
---
✓ Signed: DKIM/treblig.org
---
Total patches: 1
---

Base: not specified

       git am ./20241222_linux_perf_tools_remove_unused_is_executable_file.mbx

⬢ [acme@toolbox perf-tools-next]$ git am ./20241222_linux_perf_tools_remove_unused_is_executable_file.mbx
Applying: perf tools: Remove unused is_executable_file
error: patch failed: tools/perf/util/path.h:12
error: tools/perf/util/path.h: patch does not apply
Patch failed at 0001 perf tools: Remove unused is_executable_file
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config advice.mergeConflict false" ⬢ [acme@toolbox perf-tools-next]$

Signature · 4 lines
 -----Open up your eyes, open up your mind, open up your code -------   
/ Dr. David Alan Gilbert    |       Running GNU/Linux       | Happy  \ 
\        dave @ treblig.org |                               | In Hex /
 \ _________________________|_____ http://www.treblig.org   |_______/