[Bug binutils/3001] New: incorrect exit status from strip (and other errors introduced 2003-11-07)

View: New views
4 Messages — Rating Filter:   Alert me  

[Bug binutils/3001] New: incorrect exit status from strip (and other errors introduced 2003-11-07)

by Bugzilla from sourceware-bugzilla@sourceware.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

So, first I noticed:

[cgd@vader binutils]$ ./strip-new foobar
./strip-new: 'foobar': No such file
[cgd@vader binutils]$ echo $?
0

That didn't seem right.  8-)

I originally noticed this on RHEL4u3, but verified it exists in current head.

I then tracked this down to changes made on 2003-11-07, specifically objcopy.c
rev 1.56 and the related changes.

To verify that previously it would have returned a non-zero exit status, I
downloaded and tested binutils 2.14.  (keep reading 8-)

Going from there and a quick M-x grep get_file_size, I noticed the following
exit status errors.  I've provided comparison results from binutils 2.14 for
reference:

 * ./strip-new nonex -> exit status 0.  (was 127)
 * ./objcopy --add-section foo=nonex -> exit status 0.  (was 1)
 * ./objcopy --keep-symbols nonex file.o file_new.o -> exit status 0 (was 1).
   (I suspect other symbol-file-related flags would have similar issues, i.e.,
    all callers of add_specific_symbols().)
 * ./addr2line nonex -> exit status 0 (was 1)
 * ./ranlib nonex -> exit status 0 (was 9)
 * ./ranlib -t nonex -> exit status 0 (was 1)
 * ./objdump -x nonex -> exit status 0 (was 1)
 * ./size nonex -> exit status 0 (was 1)

The following still exit with an error status:
 * ./nm nonex
 * ./objcopy nonex nonex2 -- but this reports that input file 'nonex' is
   empty... right after saying that there's no such file.


These issues seem to have been introduced in the commits on 2003-11-07 around
12:19 UTC.  Specific revisions:
 * objcopy.c 1.56
 * addr2line.c 1.20

etc., i.e., the commits with the ChangeLog entry:

2003-11-07  Jonathan R. Grant  <jg-binutils@...>

        * bucomm,c (get_file_size): New function.  Returns the size of a
          file.
        * bucomm.h: Add prototype for get_file_size.
        * addr2line.c (process_file): Use new function.
        * ar.c (main, ranlib_only, ranlib_touch): Likewise.
        * nm.c (display_file): Likewise.
        * objcopy.c (add_specific_symbols, copy_file, strip_main,
          copy_main): Likewise.
        * objdump.c (display_file): Likewise.
        * size.c (display_file): Likewise.
        * strings.c (strings_file): Likewise.
        * readelf.c (process_file): Use similar code to get_file_size.

(committed by nickc).


Sorry, I don't have patches.  (I've got other fish to fry at the moment, and I
can't use a patched binutils in my project anyway.  I also don't have a valid
assignment on file at this point, either.)

Hopefully I've at least provided enough info to make it easy for somebody else
to resolve these issues quickly/easily...

--
           Summary: incorrect exit status from strip (and other errors
                    introduced 2003-11-07)
           Product: binutils
           Version: 2.18 (HEAD)
            Status: NEW
          Severity: normal
          Priority: P2
         Component: binutils
        AssignedTo: unassigned at sources dot redhat dot com
        ReportedBy: c dot g dot demetriou at gmail dot com
                CC: bug-binutils at gnu dot org,c dot g dot demetriou at
                    gmail dot com
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


http://sourceware.org/bugzilla/show_bug.cgi?id=3001

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


_______________________________________________
bug-binutils mailing list
bug-binutils@...
http://lists.gnu.org/mailman/listinfo/bug-binutils

[Bug binutils/3001] incorrect exit status from strip (and other errors introduced 2003-11-07)

by Bugzilla from sourceware-bugzilla@sourceware.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


------- Additional Comments From nickc at redhat dot com  2006-08-06 15:47 -------
Created an attachment (id=1205)
 --> (http://sourceware.org/bugzilla/attachment.cgi?id=1205&action=view)
Fix exit codes from binutils programs which have been given a non-existant file
as an argument


--


http://sourceware.org/bugzilla/show_bug.cgi?id=3001

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


_______________________________________________
bug-binutils mailing list
bug-binutils@...
http://lists.gnu.org/mailman/listinfo/bug-binutils

[Bug binutils/3001] incorrect exit status from strip (and other errors introduced 2003-11-07)

by Bugzilla from sourceware-bugzilla@sourceware.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


------- Additional Comments From nickc at redhat dot com  2006-08-06 15:48 -------
Hi,

  Thanks for reporting this problem.  You are correct, since the introduction of
the get_file_size() function the various binutils utlities have not been
returning proper exit codes when provided with a non-existant filename as an
argument.  I have uploaded a patch which fixes this and I shall be applying it
shortly.

Cheers
  Nick


--
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


http://sourceware.org/bugzilla/show_bug.cgi?id=3001

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


_______________________________________________
bug-binutils mailing list
bug-binutils@...
http://lists.gnu.org/mailman/listinfo/bug-binutils

[Bug binutils/3001] incorrect exit status from strip (and other errors introduced 2003-11-07)

by Bugzilla from sourceware-bugzilla@sourceware.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



--
           What    |Removed                     |Added
----------------------------------------------------------------------------
OtherBugsDependingO|                            |10321
              nThis|                            |


http://sourceware.org/bugzilla/show_bug.cgi?id=3001

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


_______________________________________________
bug-binutils mailing list
bug-binutils@...
http://lists.gnu.org/mailman/listinfo/bug-binutils