Lmod
Lmod copied to clipboard
installed files have wrong permissions
Describe the bug Installation seems to use cp in some places resulting in installation that is influenced by installer's environment/umask
To Reproduce set umask to 077 and run ./configure --prefix=/... && make install check permissions on libexec/term/colors.lua, ... init/fish_tab_completion/module.fish
Expected behavior The assumption is that the install is usable by everyone.
Desktop (please complete the following information):
- Linux distribution: Red Hat Enterprise Linux 7
- Lmod Version: 8.7.4
Additional context Add any other context about the problem here.
I'm not sure that this should be "fixed". I am willing to add a test that is part of make install that says that the permissions are not useable by everyone. But I can see cases where some site might test Lmod that way.
Comments?
Also many times a user installs Lmod in their own account and a umask 077 should definitely be allowed in that case.
Having the installer's umask
control the final permissions of the installed files does make sense, especially in the context of user-specific installations.
But it may also be counter-intuitive compared to things like make install
, which often use install
to deploy compiled files with pre-defined permissions and ownership.
I believe that the problem I had is because my umask was 077 when I extracted the tar ball but 022 when I performed the install but inside the install there may be a 'cp -p'. When using the install command permissions are usually explicit and the end result is not impacted by the environment.
Lmod 8.7.10 now has the following feature. It uses the user's umask as long as the id -u is greater or equal to 500. For user id's less than 500 it uses a umask of 022. Sites can override this default value by configuring with: --with-mode=MODE where MODE is the permissions with the execute bit set. So setting MODE to 755, or 750 or 700 would be appropriate. Lmod strips the execute bit off to set permissions on non-executable files.
This change should allow regular users to know what they are getting when doing personal installed and system installs should work like many sysadmin's expect.
Please test Lmod 8.7.10 to see if this change works for you.
There were some issues with Lmod 8.7.10 that I fixed. Please test Lmod 8.7.11 instead.
Note that adds a build requirement on bc
which I guess I'll need to add to the Fedora package.
While this goes above and beyond my original observation it appears to install files with appropriate permissions by default. I did not test the --with-mode option.
I am closing this issue. Feel free to re-open if there is a problem.