First of all I have already asked about this in the scripts/perl forum but the advice I got did not do the trick.
A script I have to use unzips some xxx.tar.gz files and then tries to tar -xvf them. on the tar -xvf I get the following:-
tar: code/sql: Cannot utime: Operation not permitted
tar: code/scripts: Cannot utime: Operation not permitted
tar: code/maestro: Cannot utime: Operation not permitted
tar: code: Cannot utime: Operation not permitted
It was suggested to me that the OS was not happy with the tar file (maybe created under another flavour of UNIX). Accordingly, I have now got the tar files created under the same unix flavour
It looks like an issue with permissions? Does the directory and the files that you untar belong to the user that invokes the script? Try to use the option --no-overwrite-dir.
I have opened up the permissions on the target dir (definied via a -C switch in the tar command) and it still moans about utime (tar: code: Cannot utime: Operation not permitted).
Can anyone give me an idea about what permissions are expected for utime to be happy?
This only occurred for me when overwriting files by extracting the tarball. The -m (or m) option tells tar not to 'touch' the files and there by not calling utime to update the timestamp.
There is no such thing as "full rights" to a file you do not own unless you are root. Invoking utime() is not reading, nor writing, nor executing a file. You must own the file or you do not have the right to invoke utime(). This is a posix mandated restriction.
Other things you can't do to a file you don't own even if the permissions are 777: chmod, chgrp, and chown. Many OS's won't allow chown even by the non-root owner, but allowing a non-root non-owner to chown a file is a posix violation. All of these things affect the inode, not the data. You can have full right to the data in a file you don't own, but not to the metadata that describes the file. The metadata belongs only to the file owner.
Yes, I understand this. When I said full-rights, I only meant rwx. Interestingly enough, tar extraction will chown the file to the extractor if the extractor has write rights to the file to affect a replace.
I was merely citing a work-around to the initial poster.