Bug 13729

Summary: strip(1) exits with an error on script file - causes severe portability problems
Product: Base System Reporter: papowell
Component: gnuAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Unspecified   
Hardware: Any   
OS: Any   

Description papowell 1999-09-13 17:30:01 UTC
strip(1) fails with an error when asked to strip shell
scripts.  This behavior is documented as follows:

DESCRIPTION
       GNU strip discards all symbols from the object files
       objfile.  The list of object files may include archives.
       At least one object file must be given.


       strip modifies the files named in its argument, rather
       than writing modified copies under different names.

In many install scripts for code you have:
  $(INSTALL) -s .... 
              ^^^ -s specified for ALL installable executable
              objects including perl scripts, shell, scripts,
              etc.


This requires a huge amount of effort when porting to FreeBSD because
you now have to determine which executables can or cannot be stripped.

I strongly recommend you do a test in the strip code for ALLOWABLE
magic numbers,  strip those,  and ignore the rest.I

Fix: 

1. modify man page to indicate that strip only works on object
    files or executable files,  and ignores others
2. modify action so that it checks to see if it has an allowable
     item to strip and then does it.

In the strip code,  find the place where it checks for 'magic numbers'
of allowable executables,  and rather than exiting with a non-zero
error code, simply exit with a 0 error code or continue to the
next file to strip.
How-To-Repeat: strip a shell script - you get an error.
More seri
Comment 1 cpiazza freebsd_committer freebsd_triage 1999-09-13 19:17:37 UTC
Responsible Changed
From-To: freebsd-ports->freebsd-bugs

Misfiled PR 
Comment 2 Mike Barcroft freebsd_committer freebsd_triage 2001-07-21 02:07:02 UTC
State Changed
From-To: open->feedback


Does this problem still occur in newer versions of FreeBSD, 
such as 4.3-RELEASE?
Comment 3 Mike Barcroft freebsd_committer freebsd_triage 2001-07-21 04:47:41 UTC
State Changed
From-To: feedback->closed


After taking a closer look it appears this is expected behaviour 
and furthermore is documented in the strip(1) man page.