Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 14 Mar 1995 14:00:01 +1000
From:      Bruce Evans <bde@zeta.org.au>
To:        freebsd-hackers@freefall.cdrom.com, kargl@troutmask.apl.washington.edu, phk@freefall.cdrom.com
Subject:   Re: install compressed binary patch
Message-ID:  <199503140400.OAA09807@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
>***************
>*** 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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199503140400.OAA09807>