From owner-cvs-all Mon Jun 21 20: 4:10 1999 Delivered-To: cvs-all@freebsd.org Received: from overcee.netplex.com.au (overcee.netplex.com.au [202.12.86.7]) by hub.freebsd.org (Postfix) with ESMTP id 39CBA14F93; Mon, 21 Jun 1999 20:03:48 -0700 (PDT) (envelope-from peter@netplex.com.au) Received: from netplex.com.au (localhost [127.0.0.1]) by overcee.netplex.com.au (Postfix) with ESMTP id 622EA75; Tue, 22 Jun 1999 11:03:46 +0800 (WST) (envelope-from peter@netplex.com.au) X-Mailer: exmh version 2.0.2 2/24/98 To: "Brian F. Feldman" Cc: Kris Kennaway , Jean-Marc Zucconi , hoek@FreeBSD.org, cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/kern imgact_gzip.c In-reply-to: Your message of "Mon, 21 Jun 1999 22:27:11 -0400." Date: Tue, 22 Jun 1999 11:03:46 +0800 From: Peter Wemm Message-Id: <19990622030346.622EA75@overcee.netplex.com.au> Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk "Brian F. Feldman" wrote: > On Tue, 22 Jun 1999, Peter Wemm wrote: > > > Kris Kennaway wrote: > > > On Tue, 22 Jun 1999, Jean-Marc Zucconi wrote: > > > > > > > > Use gzexe. I recently fixed some filename guessing weaknesses in the scr > > ipt, > > > > > so it should be quite safe to use. > > > > > > > > gzexe is not an option when you boot from a floppy and when all must > > > > fit in 1.44MB :-) > > > > > > Why not? gzexe is a once-off compression step which encapsulates the > > > executable into a shell script, and has no other space overheads other th an > > > decompression space on /tmp at run-time. > > > > Yes, but you don't *have* /tmp at that time for the boot floppies.. You > > have memory etc but not disk space. > > > > > Kris > > > > Cheers, > > -Peter > > > > AHEM! > /tmp is part of an MFS, so how is that disk space? Ahh yes, I forgot that / was read-write for MFS boots. However: #!/bin/sh skip=18 if /usr/bin/tail +$skip $0 | gzip -cd > /tmp/gztmp$$; then chmod 700 /tmp/gztmp$$ prog="`echo $0 | sed 's|^.*/||'`" if /bin/ln /tmp/gztmp$$ "/tmp/$prog" 2>/dev/null; then trap '/bin/rm -f /tmp/gztmp$$ "/tmp/$prog"; exit $res' 0 (/bin/sleep 5; /bin/rm -f /tmp/gztmp$$ "/tmp/$prog") 2>/dev/null & /tmp/"$prog" ${1+"$@"}; res=$? else trap '/bin/rm -f /tmp/gztmp$$; exit $res' 0 (/bin/sleep 5; /bin/rm -f /tmp/gztmp$$) 2>/dev/null & /tmp/gztmp$$ ${1+"$@"}; res=$? fi else echo Cannot decompress $0; exit 1 fi; exit $res Now, if tail, sh, gzip, chmod, ln, sleep, rm, etc are all in the gzexe'd crunched linked binary, how is it supposed to decompress itself? "sh" itself is part of the crunched binary, so what is going to decode sh when sh itself is a shell script? [..] 1152 -r-xr-xr-x 19 root bin 1167360 Feb 23 1998 sh* 1152 -r-xr-xr-x 19 root bin 1167360 Feb 23 1998 slattach* 1152 -r-xr-xr-x 19 root bin 1167360 Feb 23 1998 sysinstall* 1152 -r-xr-xr-x 19 root bin 1167360 Feb 23 1998 zcat* [..] ^^ Cheers, -Peter To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message