Problems using the gzip and gunzip file compression/decompression utilities on sesfs.stanford.edu file shares mounted on the CEES cluster computers.
Last revision September 20, 2010
gzip and gunzip are used to compress and decompress individual files. Do not confuse them with the zip command that makes compressed archives of entire directory trees.
When compressing a file, gzip normally replaces the original file with the new compressed one, and adds the suffix .gz to the file name. Conversely, when asked to decompress a file that has the .gz suffix, gunzip normally replaces it with the uncompressed version and removes the .gz suffix from the filename. These operations require write permission in the directory where the file is located.
The problem
Running either gzip or gunzip in their normal mode (giving them a filename to work on) results in a Permission denied error message and no action on the file. In both cases, the program creates a zero-length file of the other type (.gz file when running gzip, plain file without the .gz suffix when running gunzip) but then fails. The original file is not modified or removed.
The problem appears to be related to this sentence from the gzip online manual page:
Whenever possible, each file is replaced by one with the extension .gz, while keeping the same ownership modes, access and modification times.
Apparently, one of the system calls being used by gzip (and also gunzip, going the other way) to set ownership mode or time stamps is failing because of the mis-match between the Linux permissions model on CEES and the underlying NTFS ACLs on the sesfs file server.
The workaround
The workaround for both gzip and gunzip is to use the -c option, read the file via standard input, and save the result via standard output. Here are sample commands:
gzip -c < file > file.gz
gunzip -c < file.gz > file
Side effects
The -c option prevents gzip and gunzip from overwriting the input file with the output one, so you end up with both versions in the directory. You should remove the unwanted version.