Bug 4220 - gzexe does not detect all dependencies
Summary: gzexe does not detect all dependencies
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: gnu (show other bugs)
Version: 2.2.1-RELEASE
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 1997-08-03 21:50 UTC by Dag-Erling Coidan Smørgrav
Modified: 1997-08-09 16:37 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dag-Erling Coidan Smørgrav 1997-08-03 21:50:01 UTC
	The gzexe shell script, which is used to create self-extracting
	compressed executables, does not detect its own dependency on
	/bin/sh, and will attempt to compress it if asked. It does however
	detect dependency on chmod, rm, sleep etc. and refuses to compress
	them.

	If you attempt to compress /bin/* to conserve space on a system
	with a small disk (in my case, a printer server with a 120 MB
	disk), gzexe will trash sh, which makes it impossible to uncom-
	press and use any other compressed binary (e.g. cp, in order to
	'cp sh~ sh')

	It is also possible that the same problem exists for echo and sed
	(which are used by the decompression script, but not checked for
	by gzexe)

Fix: 

Run this shell script as root:
	
#!/bin/sh
patch -n `which gzexe` - <<EOF
77c77
<   gzip | tail | chmod | ln | sleep | rm)
---
>   sh | gzip | tail | chmod | ln | sleep | rm)
EOF

	This will cause gzexe to check if you are trying to compress sh.
How-To-Repeat: 
	# gzexe /bin/sh
	Segmentation fault - core dumped
Comment 1 Peter Wemm freebsd_committer freebsd_triage 1997-08-09 16:35:22 UTC
State Changed
From-To: open->closed

Suggested fix applied, thanks! src/gnu/usr.bin/gzip/gzexe rev 1.5