From hsu@clinet.fi  Sun Jun 16 18:13:28 1996
Received: from hauki.clinet.fi (root@hauki.clinet.fi [194.100.0.1])
          by freefall.freebsd.org (8.7.5/8.7.3) with ESMTP id SAA03096
          for <FreeBSD-gnats-submit@freebsd.org>; Sun, 16 Jun 1996 18:13:25 -0700 (PDT)
Received: from katiska.clinet.fi (root@katiska.clinet.fi [194.100.0.4]) by hauki.clinet.fi (8.7.5/8.6.4) with ESMTP id EAA29512 for <FreeBSD-gnats-submit@freebsd.org>; Mon, 17 Jun 1996 04:13:19 +0300 (EET DST)
Received: (hsu@localhost) by katiska.clinet.fi (8.7.5/8.6.4) id EAA20317; Mon, 17 Jun 1996 04:13:17 +0300 (EET DST)
Message-Id: <199606170113.EAA20317@katiska.clinet.fi>
Date: Mon, 17 Jun 1996 04:13:17 +0300 (EET DST)
From: Heikki Suonsivu <hsu@clinet.fi>
Reply-To: hsu@clinet.fi
To: FreeBSD-gnats-submit@freebsd.org
Subject: install silently removes target if strip is unexecutable
X-Send-Pr-Version: 3.2

>Number:         1328
>Category:       bin
>Synopsis:       install silently removes target if strip is unexecutable
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:
>Keywords:
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Jun 16 18:20:01 PDT 1996
>Closed-Date:    Sun Jun 23 05:59:40 PDT 1996
>Last-Modified:  Sun Jun 23 06:01:44 PDT 1996
>Originator:     Heikki Suonsivu
>Release:        FreeBSD 2.2-CURRENT i386
>Organization:
Clinet, Espoo, Finland
>Environment:

	-current (probably applies to other versions?)

>Description:

	I had a panic when the system was compiling strip, and
unfortunately I did not notice that strip binary had become a 0-size
file with 644 modes.  After I retried make world, it said

install ... -s ...
strip: permission denied

for all programs and removed the targets!

Fortunately make stopped after removing things like echo and cp, when
it tried to ln -s something to something else, so with 10 minutes of
figuring out what was going on and manual installing I got the
binaries back where they belong.

>How-To-Repeat:

make strip 0-sized file with 644 permissions and do a make world
(probably just doing install is enough).

>Fix:

Files should not get removed if strip fails.

If install fails, it should return non-zero exit value so that make
will stop before serious damage gets done.

>Release-Note:
>Audit-Trail:

From: Bruce Evans <bde@zeta.org.au>
To: FreeBSD-gnats-submit@freebsd.org, hsu@clinet.fi
Cc:  Subject: Re: bin/1328: install silently removes target if strip is unexecutable
Date: Mon, 17 Jun 1996 12:29:27 +1000

 >>Synopsis:       install silently removes target if strip is unexecutable
 
 It actually removes the target if almost any error occurs, unless the -C
 option is used, and the usual error for stripping unexecutables is
 unsilent but results in `install' exiting with status 0.
 
 >>Fix:
 
 >Files should not get removed if strip fails.
 
 No, strip might have left junk in the file.  Strip shouldn't even be
 attempted on the final file.  The -C option avoids touching the final
 file as a side effect.  Someday all installs should be atomic.  -C is
 atmic now except for some cases involving immutable flags (immutable
 files can't be renamed atomically).
 
 >If install fails, it should return non-zero exit value so that make
 >will stop before serious damage gets done.
 
 Yes.
 
 Bruce
State-Changed-From-To: open->closed 
State-Changed-By: bde 
State-Changed-When: Sun Jun 23 05:59:40 PDT 1996 
State-Changed-Why:  
Fixed in rev.1.8 of xinstall.c.  Errors in strip are now fatal for 
install.  Not removing the target will have to wait for a more general 
fix. 
>Unformatted:
