Skip to content

Commit

Permalink
likwid: Fix the perms script (spack#48666)
Browse files Browse the repository at this point in the history
* likwid: Fix the perms script

The script loops over the path (which includes the prefix), but
additionally adds the prefix up front which results in duplicate paths
and a double "/" in the command like in the following one:

    chown root:root /opt/csg/spack/opt/spack/linux-debian12-zen2/gcc-12.2.0/likwid-5.4.1-xfc6quebnf2kosydl3ospaeoskxnxwhn//opt/csg/spack/opt/spack/linux-debian12-zen2/gcc-12.2.0/likwid-5.4.1-xfc6quebnf2kosydl3ospaeoskxnxwhn/sbin/likwid-accessD

Additionally the path is currently not quoted which can potentially
result in word splitting for weird paths.

Signed-off-by: Christian Heusel <christian@heusel.eu>

* likwid: Make the perm scripts' name unique

Also move it into the proper binary folder as per the Filesystem
Hierarchy Standard.

Signed-off-by: Christian Heusel <christian@heusel.eu>

---------

Signed-off-by: Christian Heusel <christian@heusel.eu>
  • Loading branch information
christian-heusel authored Feb 18, 2025
1 parent 9c5b3cc commit 1601193
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
4 changes: 2 additions & 2 deletions var/spack/repos/builtin/packages/likwid/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,8 @@ def install(self, spec, prefix):
@run_after("install")
def caveats(self):
if self.spec.satisfies("accessmode=accessdaemon"):
perm_script = "spack_perms_fix.sh"
perm_script_path = join_path(self.spec.prefix, perm_script)
perm_script = "spack_likwid_fix_perms.sh.j2"
perm_script_path = join_path(self.spec.prefix.bin, perm_script)
daemons = glob.glob(join_path(self.spec.prefix, "sbin", "*"))
with open(perm_script_path, "w") as f:
env = spack.tengine.make_environment(dirs=self.package_dir)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
#!/bin/sh -eu

{% for cf in chowns %}
chown root:root {{ prefix }}/{{ cf }}
chown root:root "{{ cf }}"
{% endfor %}

{% for sf in chmods %}
chmod 4755 {{ prefix }}/{{ sf }}
chmod 4755 "{{ sf }}"
{% endfor %}

# end

0 comments on commit 1601193

Please sign in to comment.