From owner-freebsd-hackers Mon Mar 13 20:00:16 1995 Return-Path: hackers-owner Received: (from majordom@localhost) by freefall.cdrom.com (8.6.10/8.6.6) id UAA08905 for hackers-outgoing; Mon, 13 Mar 1995 20:00:16 -0800 Received: from godzilla.zeta.org.au (godzilla.zeta.org.au [203.2.228.34]) by freefall.cdrom.com (8.6.10/8.6.6) with ESMTP id UAA08891; Mon, 13 Mar 1995 20:00:06 -0800 Received: (from bde@localhost) by godzilla.zeta.org.au (8.6.9/8.6.9) id OAA09807; Tue, 14 Mar 1995 14:00:01 +1000 Date: Tue, 14 Mar 1995 14:00:01 +1000 From: Bruce Evans Message-Id: <199503140400.OAA09807@godzilla.zeta.org.au> To: freebsd-hackers@freefall.cdrom.com, kargl@troutmask.apl.washington.edu, phk@freefall.cdrom.com Subject: Re: install compressed binary patch Sender: hackers-owner@FreeBSD.org Precedence: bulk >*************** >*** 246,251 **** >--- 250,261 ---- > err("%s: chflags: %s", to_name, strerror(serrno)); > } > >+ /* >+ * The file has been installed. We now compress and create sym link >+ */ >+ if (dogzip) >+ gzip(to_name); >+ > (void)close(to_fd); > if (!docopy && !devnull && unlink(from_name)) > err("%s: %s", from_name, strerror(errno)); The gzip step should be done earlier, after the strip step. Otherwise gzip may lose some of the file attributes. It _will_ lose special flags (those set by fchflags()) and it will fail if an immutable flag is set. gzip is a non-BSD4.4 program and doesn't understand the special flags. >*************** >*** 317,322 **** >--- 327,388 ---- > } > > /* >+ * gzip -- >+ * use gzip(1) to compress target file, then create a sym link >+ */ >... >+ case 0: >+ execl(_PATH_GZIP, "gzip", "-f", to_name, NULL); >+ err("%s: %s", _PATH_STRIP, strerror(errno)); The gzip step should look like the strip step, but not this much like it :-). The strip step should look better. It doesn't handle errors from strip(1) very well. >... >+ /* >+ * Compression must have been successful, if we get here. >+ * So, build a filename for the gzipped file >+ */ >+ if (strlen(to_name) < MAXPATHLEN - 3) >+ strcpy(gz_name, to_name); >+ strcat(gz_name, ".gz"); >... I wish gzip handled this directly. `gzip -S suffix' requires a nonempty suffix. Bruce