This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: PATCH: Return NULL on NULL bfd (Problem with linker with binutils-040414)
- From: Nick Clifton <nickc at redhat dot com>
- To: Dave Korn <dk at artimi dot com>
- Cc: binutils at sources dot redhat dot com
- Date: Wed, 21 Apr 2004 11:57:46 +0100
- Subject: Re: PATCH: Return NULL on NULL bfd (Problem with linker with binutils-040414)
- References: <NUTMEGRphjXB3KMqXLV00000529@NUTMEG.CAM.ARTIMI.COM>
Hi Dave,
Well, there's *two* errors here; one is an error that is predictable and
handled gracefully by bfd, which tries to display a message; the other is an
internal coding error in the bfd library, which can't be handled. So rather
than saying that the 'actual' error message isn't displayed, I'd rather
suggest that in the abort case it is the 'most serious' error message that
gets displayed.
Well except that in the abort case no real error message is displayed.
(I discount the abort message because that does not tell the user
anything about what is going wrong, other than the fact that the BFD
library is broken).
And I'd also point out that if you return a 'bogus'
filename, what subsequently gets displayed is *not* the 'actual' error, but
a mangled and misleading misrepresentation of whatever the original error
was actually trying to say.....
Well we can argue this back and forth all day. :-) I would say that the
error message is not mangled but improved, coping not only with the
detected error but also gracefully handling an internal error whilst
still giving the user some informative output.
Perhaps the best compromise would be for bfd_archive_filename() to
display its own error message (using _bfd_error_handler) when it is
given a NULL input, but then to continue on and return NULL. That way
the error handler will (presumably) stop the output from being
generated, but bfd_archive_filename() will still execute so that the
calling function will be able to display its error/warning message,
which will further help to locate the problem that is plaguing the library.
Cheers
Nick