Subject: bin/5094: "gzip -f" messes up permission of hard linked files
To: None <gnats-bugs@gnats.netbsd.org>
From: Matthias Scheler <tron@lyssa.owl.de>
List: netbsd-bugs
Date: 03/02/1998 10:58:07
>Number:         5094
>Category:       bin
>Synopsis:       "gzip -f" messes up permission of hard linked files
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Mar  2 02:05:01 1998
>Last-Modified:
>Originator:     Matthias Scheler
>Organization:
Matthias Scheler                                http://home.owl.de/~tron/
>Release:        970226
>Environment:
System: NetBSD lyssa 1.3D NetBSD 1.3D (LYSSA) #0: Sat Feb 28 18:39:27 MET 1998 tron@lyssa:/usr/src/sys/arch/i386/compile/LYSSA i386

>Description:
Normally "gzip" refuses to compress files with a link count larger than 1.
If somebody uses "-f" to override this behavior the file will be compressed
and removed as expected but the permissions of the remaining links of the
files are set to 777.

>How-To-Repeat:
tron@lyssa:~>cp /netbsd .
/netbsd -> ./netbsd
tron@lyssa:~>ln netbsd vmlinuz
tron@lyssa:~>ls -l netbsd* vmlinuz
-rwxr-xr-x  2 tron  krull  1402711 Mar  2 10:55 netbsd
-rwxr-xr-x  2 tron  krull  1402711 Mar  2 10:55 vmlinuz
tron@lyssa:~>gzip -f netbsd
tron@lyssa:~>ls -l netbsd* vmlinuz
-rwxr-xr-x  1 tron  krull   683861 Mar  2 10:55 netbsd.gz
-rwxrwxrwx  1 tron  krull  1402711 Mar  2 10:55 vmlinuz

>Fix:
Sorry, no idea.

>Audit-Trail:
>Unformatted: