perf: don't install headers with x permissions
PATCH v2 1/2 perf: don't install headers with x permissions
install(1), by default, installs with rwxr-xr-x permissions. Modify perf's Makefile to pass '-m 644' when installing:
* perf_dlfilter.h header
* trace/strace/groups/*
* scripts/perl/Perf-Trace-Util/lib/Perf/Trace/*
* scripts/perl/*.pl
* perf-completion.sh
* Documentation/tips.txt
* tests/attr.py
* tests/attr/*
* tests/shell/lib/*.sh
All those are supposed to be non-executable. Either they are not scripts at all, or they don't have shebang.
The fixes line below is only for the perf_dlfilter.h header addition...
---
[v2] extend to more than perf_dlfilter.h.
tools/perf/Makefile.perf | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
tools/perf/Makefile.perf +9 -9
@@ -925,7 +925,7 @@ install-tools: all install-gtk $(INSTALL) $(OUTPUT)perf '$(DESTDIR_SQ)$(bindir_SQ)'; \ $(LN) '$(DESTDIR_SQ)$(bindir_SQ)/perf' '$(DESTDIR_SQ)$(bindir_SQ)/trace'; \ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(includedir_SQ)/perf'; \ - $(INSTALL) util/perf_dlfilter.h -t '$(DESTDIR_SQ)$(includedir_SQ)/perf' + $(INSTALL) -m 644 util/perf_dlfilter.h -t '$(DESTDIR_SQ)$(includedir_SQ)/perf' ifndef NO_PERF_READ_VDSO32 $(call QUIET_INSTALL, perf-read-vdso32) \ $(INSTALL) $(OUTPUT)perf-read-vdso32 '$(DESTDIR_SQ)$(bindir_SQ)';
@@ -960,13 +960,13 @@ endif ifndef NO_LIBAUDIT $(call QUIET_INSTALL, strace/groups) \ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(STRACE_GROUPS_INSTDIR_SQ)'; \ - $(INSTALL) trace/strace/groups/* -t '$(DESTDIR_SQ)$(STRACE_GROUPS_INSTDIR_SQ)' + $(INSTALL) trace/strace/groups/* -m 644 -t '$(DESTDIR_SQ)$(STRACE_GROUPS_INSTDIR_SQ)' endif ifndef NO_LIBPERL $(call QUIET_INSTALL, perl-scripts) \ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/Perf-Trace-Util/lib/Perf/Trace'; \ - $(INSTALL) scripts/perl/Perf-Trace-Util/lib/Perf/Trace/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/Perf-Trace-Util/lib/Perf/Trace'; \ - $(INSTALL) scripts/perl/*.pl -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl'; \ + $(INSTALL) scripts/perl/Perf-Trace-Util/lib/Perf/Trace/* -m 644 -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/Perf-Trace-Util/lib/Perf/Trace'; \ + $(INSTALL) scripts/perl/*.pl -m 644 -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl'; \ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/bin'; \ $(INSTALL) scripts/perl/bin/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/bin' endif
@@ -980,22 +980,22 @@ ifndef NO_LIBPYTHON endif $(call QUIET_INSTALL, perf_completion-script) \ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(sysconfdir_SQ)/bash_completion.d'; \ - $(INSTALL) perf-completion.sh '$(DESTDIR_SQ)$(sysconfdir_SQ)/bash_completion.d/perf' + $(INSTALL) perf-completion.sh -m 644 '$(DESTDIR_SQ)$(sysconfdir_SQ)/bash_completion.d/perf' $(call QUIET_INSTALL, perf-tip) \ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(tip_instdir_SQ)'; \ - $(INSTALL) Documentation/tips.txt -t '$(DESTDIR_SQ)$(tip_instdir_SQ)' + $(INSTALL) Documentation/tips.txt -m 644 -t '$(DESTDIR_SQ)$(tip_instdir_SQ)' install-tests: all install-gtk $(call QUIET_INSTALL, tests) \ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests'; \ - $(INSTALL) tests/attr.py '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests'; \ + $(INSTALL) tests/attr.py -m 644 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests'; \ $(INSTALL) tests/pe-file.exe* '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests'; \ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/attr'; \ - $(INSTALL) tests/attr/* '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/attr'; \ + $(INSTALL) tests/attr/* -m 644 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/attr'; \ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell'; \ $(INSTALL) tests/shell/*.sh '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell'; \ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell/lib'; \ - $(INSTALL) tests/shell/lib/*.sh '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell/lib' + $(INSTALL) tests/shell/lib/*.sh -m 644 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell/lib' install-bin: install-tools install-tests install-traceevent-plugins
Signature · 1 line
2.32.0
PATCH 2/2 perf: remove shebang from scripts/{perl,python}/*.{pl,py}
The scripts cannot be executed on their own. The python ones were always installed without x permissions, the perl ones fail anyway:
BEGIN failed--compilation aborted at /usr/lib/perf-core/scripts/perl/rw-by-pid.pl line 18.
so there is no point to have a shebang in them. This causes rpmlint to complain too:
W: non-executable-script /usr/lib/perf-core/scripts/perl/rw-by-file.pl 644 /usr/bin/perl -w
Hence drop shebangs in them all and remove x permissions in the repository. If anyone wants some of them executable, they need to fix the install scripts first.
--- tools/perf/scripts/perl/rw-by-file.pl | 1 - tools/perf/scripts/perl/rw-by-pid.pl | 1 - tools/perf/scripts/perl/rwtop.pl | 1 - tools/perf/scripts/perl/wakeup-latency.pl | 1 - tools/perf/scripts/python/exported-sql-viewer.py | 1 - tools/perf/scripts/python/flamegraph.py | 0 tools/perf/scripts/python/libxed.py | 1 - tools/perf/scripts/python/net_dropmonitor.py | 0 tools/perf/scripts/python/stackcollapse.py | 0 9 files changed, 6 deletions(-) mode change 100755 => 100644 tools/perf/scripts/python/exported-sql-viewer.py mode change 100755 => 100644 tools/perf/scripts/python/flamegraph.py mode change 100755 => 100644 tools/perf/scripts/python/net_dropmonitor.py mode change 100755 => 100644 tools/perf/scripts/python/stackcollapse.py
tools/perf/scripts/perl/rw-by-file.pl +0 -1
@@ -1,4 +1,3 @@ -#!/usr/bin/perl -w # SPDX-License-Identifier: GPL-2.0-only # (c) 2009, Tom Zanussi <[email protected]>
tools/perf/scripts/perl/rw-by-pid.pl +0 -1
@@ -1,4 +1,3 @@ -#!/usr/bin/perl -w # SPDX-License-Identifier: GPL-2.0-only # (c) 2009, Tom Zanussi <[email protected]>
tools/perf/scripts/perl/rwtop.pl +0 -1
@@ -1,4 +1,3 @@ -#!/usr/bin/perl -w # SPDX-License-Identifier: GPL-2.0-only # (c) 2010, Tom Zanussi <[email protected]>
tools/perf/scripts/perl/wakeup-latency.pl +0 -1
@@ -1,4 +1,3 @@ -#!/usr/bin/perl -w # SPDX-License-Identifier: GPL-2.0-only # (c) 2009, Tom Zanussi <[email protected]>
tools/perf/scripts/python/exported-sql-viewer.py +0 -1
@@ -1,4 +1,3 @@ -#!/usr/bin/env python # SPDX-License-Identifier: GPL-2.0 # exported-sql-viewer.py: view data from sql database # Copyright (c) 2014-2018, Intel Corporation.
tools/perf/scripts/python/flamegraph.py +0 -0
tools/perf/scripts/python/libxed.py +0 -1
@@ -1,4 +1,3 @@ -#!/usr/bin/env python # SPDX-License-Identifier: GPL-2.0 # libxed.py: Python wrapper for libxed.so # Copyright (c) 2014-2021, Intel Corporation.
tools/perf/scripts/python/net_dropmonitor.py +0 -0
tools/perf/scripts/python/stackcollapse.py +0 -0
Signature · 1 line
2.32.0
Adrian Hunter
reviewerRe: [PATCH 2/2] perf: remove shebang from scripts/{perl,python}/*.{pl,py}
Quoted 22 lines · Jiri Slaby
The scripts cannot be executed on their own. The python ones were always installed without x permissions, the perl ones fail anyway:
BEGIN failed--compilation aborted at/usr/lib/perf-core/scripts/perl/rw-by-pid.plline 18.
so there is no point to have a shebang in them. This causes rpmlint to complain too:
W: non-executable-script/usr/lib/perf-core/scripts/perl/rw-by-file.pl644/usr/bin/perl-wHence drop shebangs in them all and remove x permissions in the repository. If anyone wants some of them executable, they need to fix the install scripts first.
Signed-off-by Jiri Slaby <[email protected]>Cc Adrian Hunter <[email protected]>Cc Andi Kleen <[email protected]>Cc Ingo Molnar <[email protected]>Cc Jiri Olsa <[email protected]>Cc Kan Liang <[email protected]>Cc Leo Yan <[email protected]>Cc Mark Rutland <[email protected]>Cc Namhyung Kim <[email protected]>Cc Peter Zijlstra <[email protected]>Cc Arnaldo Carvalho de Melo <[email protected]>
Quoted 6 lines
--- tools/perf/scripts/perl/rw-by-file.pl | 1 - tools/perf/scripts/perl/rw-by-pid.pl | 1 - tools/perf/scripts/perl/rwtop.pl | 1 - tools/perf/scripts/perl/wakeup-latency.pl | 1 - tools/perf/scripts/python/exported-sql-viewer.py | 1 -
exported-sql-viewer.py is a standalone executable
Quoted 76 lines
tools/perf/scripts/python/flamegraph.py | 0 tools/perf/scripts/python/libxed.py | 1 - tools/perf/scripts/python/net_dropmonitor.py | 0 tools/perf/scripts/python/stackcollapse.py | 0 9 files changed, 6 deletions(-) mode change 100755 => 100644 tools/perf/scripts/python/exported-sql-viewer.py mode change 100755 => 100644 tools/perf/scripts/python/flamegraph.py mode change 100755 => 100644 tools/perf/scripts/python/net_dropmonitor.py mode change 100755 => 100644 tools/perf/scripts/python/stackcollapse.pytools/perf/scripts/perl/rw-by-file.pl +0
-1@@ -1,4 +1,3 @@ -#!/usr/bin/perl -w # SPDX-License-Identifier: GPL-2.0-only # (c) 2009, Tom Zanussi <[email protected]>tools/perf/scripts/perl/rw-by-pid.pl +0
-1@@ -1,4 +1,3 @@ -#!/usr/bin/perl -w # SPDX-License-Identifier: GPL-2.0-only # (c) 2009, Tom Zanussi <[email protected]>tools/perf/scripts/perl/rwtop.pl +0
-1@@ -1,4 +1,3 @@ -#!/usr/bin/perl -w # SPDX-License-Identifier: GPL-2.0-only # (c) 2010, Tom Zanussi <[email protected]>tools/perf/scripts/perl/wakeup-latency.pl +0
-1@@ -1,4 +1,3 @@ -#!/usr/bin/perl -w # SPDX-License-Identifier: GPL-2.0-only # (c) 2009, Tom Zanussi <[email protected]>tools/perf/scripts/python/exported-sql-viewer.py +0
-1@@ -1,4 +1,3 @@ -#!/usr/bin/env python # SPDX-License-Identifier: GPL-2.0 # exported-sql-viewer.py: view data from sql database # Copyright (c) 2014-2018, Intel Corporation.tools/perf/scripts/python/flamegraph.py +0
-0tools/perf/scripts/python/libxed.py +0
-1@@ -1,4 +1,3 @@ -#!/usr/bin/env python # SPDX-License-Identifier: GPL-2.0 # libxed.py: Python wrapper for libxed.so # Copyright (c) 2014-2021, Intel Corporation.tools/perf/scripts/python/net_dropmonitor.py +0
-0tools/perf/scripts/python/stackcollapse.py +0
-0
Re: [PATCH 2/2] perf: remove shebang from scripts/{perl,python}/*.{pl,py}
Quoted 30 lines · Adrian Hunter
Quoted 22 lines · Jiri Slaby
The scripts cannot be executed on their own. The python ones were always installed without x permissions, the perl ones fail anyway:
BEGIN failed--compilation aborted at/usr/lib/perf-core/scripts/perl/rw-by-pid.plline 18.
so there is no point to have a shebang in them. This causes rpmlint to
complain too:
W: non-executable-script/usr/lib/perf-core/scripts/perl/rw-by-file.pl644/usr/bin/perl-wHence drop shebangs in them all and remove x permissions in the repository. If anyone wants some of them executable, they need to fix the install scripts first.
Signed-off-by Jiri Slaby <[email protected]>Cc Adrian Hunter <[email protected]>Cc Andi Kleen <[email protected]>Cc Ingo Molnar <[email protected]>Cc Jiri Olsa <[email protected]>Cc Kan Liang <[email protected]>Cc Leo Yan <[email protected]>Cc Mark Rutland <[email protected]>Cc Namhyung Kim <[email protected]>Cc Peter Zijlstra <[email protected]>Cc Arnaldo Carvalho de Melo <[email protected]>Quoted 6 lines
--- tools/perf/scripts/perl/rw-by-file.pl | 1 - tools/perf/scripts/perl/rw-by-pid.pl | 1 - tools/perf/scripts/perl/rwtop.pl | 1 - tools/perf/scripts/perl/wakeup-latency.pl | 1 - tools/perf/scripts/python/exported-sql-viewer.py | 1 -
Quoted 1 line
exported-sql-viewer.pyis a standalone executable
That's great, but in fact noone can run it when make-installed as I stated above:
Quoted 2 lines
Quoted 2 lines
If anyone wants some of them executable, they need to fix the install scripts first.
See:
$(INSTALL) scripts/python/*.py -m 644 -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python';
thanks,
Signature · 2 lines
js suse labs