Argel has asked for the wisdom of the Perl Monks concerning the following question:

Is there a way to force cpan to use a different umask? I'm installing modules as root and running into the typical permissions issues (root's umask is set to 027). I'm using Perl 5.10.1 on Solaris 10 SPARC. I Googled and Super Searched for "cpan install umask" but surprisingly nothing useful turned up.

Update: Just to clarify, I'm aware the problem is cpan shelling out to run make. Actually, I suppose it's make shelling out to run commands (otherwise I could set the make command to "umask 022; make" in myConfig.pm and have it work). So, is there a trick to get around this or do I have to override root's umask (e.g. in a local .bashrc or .cshrc file)? I'm surprised there isn't a better solution!

Elda Taluta; Sarks Sark; Ark Arks

Replies are listed 'Best First'.
Re: cpan and installing as root
by zentara (Cardinal) on Feb 13, 2010 at 12:33 UTC
Re: cpan and installing as root
by youlose (Scribe) on Feb 13, 2010 at 15:18 UTC
      I saw that link but it won't work. The problem is that perl shells out to run make and then the make command shells out to do it's stuff. This mean the umask for the shell is reset because we have it hardcoded in the global bashrc and cshrc files here. I'm really surprised there isn't a way to tell cpan what the permission should be (and have it added tot he makefile somehow) or that e.g. GNU install isn't used to deal with this issue. I ended up overriding it by setting the umask in my local .cshrc file, but that defeats the purpose of setting a more restricted (and saner) umask for root. And if I remove it later on I will likely forget to add it back in later on. I suppose I could just do a chmod -R on the directories and files under lib afterwards, but that sure feels like a kludge. Thanks for the help!!

      Elda Taluta; Sarks Sark; Ark Arks