Saturday, 8 June 2013

Permissions tar extraction to nfs share from a Perl script

Permissions tar extraction to nfs share from a Perl script

As part of an installation procedure of a piece of software, I use:
curl -s <url-to-targz> | tar -p -x -z -C /
inside a Perl script (I use qx($command) or system($command), either will do.All goes well, and the tar ball is installed to the / of my system, but when I do the same thing to an nfs share:
curl -s <url-to-targz> | tar -p -x -z -C /my-nfs/opt
Then the following occurs:
When I do this on the prompt, this goes well (i.e. all my permissions that I saved in the tar ball are still in place).
When I do this from withing the Perl script (or a shell script, for that matter), either qx($command) or system($command) leaves me in with the situation that the permissions are changed (for example, what was executable, is no longer executable).
I am suspecting this has to do with umask (which is 022 on my system), and normally the -p flag should take care of that, but still no joy in this case. Does anyone have any suggestions for me (other than read the manpage :-))?
I have also tried something like system("umask xyz; $command"), but (probably because the $command is using a fork of my process, which gets the umask 022): also no joy.

No comments:

Post a Comment