Operating System - HP-UX
1843263 Members
3079 Online
110214 Solutions
New Discussion

compress -c fails on file with hard links

 
Francesco Ricciardi
New Member

compress -c fails on file with hard links

Hi All,

here's a nice problem.

When compress is called with the -c option on a file with hard links, it fails ("-- has 1 other links: unchanged") even if the original file is not changed because of option -c.

Example:

> ln this_file new_file
> compress -c new_file > new_file_compressed.Z

I expected compress not to fail, but indeed it does.

I'm running HPUX 11.00.

I've looked for a patch, but couldn't find one that fixes this problem. PHCO_26897 fixes a couple of problems with compress, but it says nothing about my problem.

Thanks,

Francesco
3 REPLIES 3
Jairo Campana
Trusted Contributor

Re: compress -c fails on file with hard links

see:

ompress(1) compress(1)

2 Last file is larger after (attempted) compression.
1 An error occurred.

DIAGNOSTICS
Usage: compress [-f|-z] [-dvcV] [-b maxbits] [file ...]
Invalid options were specified on the command line.

Missing maxbits
maxbits must follow -b.

file: not in compressed format
The file specified to uncompress has not been compressed.

file: compressed with xxbits, can only handle yybits
file was compressed by a program that could deal with a higher
value of maxbits than the compress code on this machine.
Recompress the file with a lower value of maxbits.

file: already has .Z suffix -- no change
The file is assumed to be already compressed. Rename the file
and try again.

file: filename too long to tack on .Z
The output file name, which is the source file name with a .Z
extension, is too long for the file system on which the source
file resides. Make the source file name shorter and try again.

file already exists; do you wish to overwrite (y or n)?
Respond y if you want the output to replace the existing file;
otherwise, respond n.

uncompress: corrupt input
A SIGSEGV violation was detected which usually means that the
input file has been corrupted.

Compression: xx.xx%
Percentage of the input saved by compression. (Relevant only for
-v.)

-- not a regular file: unchanged
When the input file is not a regular file (a directory for
example), it is left unaltered.

-- has xxother links: unchanged
The input file has links which are not symbolic links and has
been left unchanged. See ln(1) for more information.

-- has symbolic links: unchanged
The input file has symbolic links and has been left unchanged.
See ln(1) for more information.

Hewlett-Packard Company - 4 - HP-UX Release 11.00: October 1997

compress(1) compress(1)

-- file unchanged
No savings is achieved by compression. The input remains
unaltered.
legionx
Rodney Hills
Honored Contributor

Re: compress -c fails on file with hard links

How about if you reformat the command like-

compress -c new_file_compressed.Z

HTH

-- Rod Hills
There be dragons...
Francesco Ricciardi
New Member

Re: compress -c fails on file with hard links

Works!

Great,

Thanks,

Francesco