This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: deletion of output files


"Jan Beulich" <JBeulich@novell.com> writes:

> Other than gcc, all binutils utilities (or at least all I checked)
> carelessly delete their supposed output file on various error
> conditions, no matter whether this is a regular file or something else.
> Is this intended behavior? This is especially annoying when running some
> installation script (obviously as root in almost all cases) which tests
> functionality of one of these utilities (perhaps just because the script
> does so in all modes of operation) and thus directs the output to
> /dev/null.
> 
> If this is something that is deemed to need correction, then if I
> wanted to prepare a patch I'd want to put the functionality in a single
> place (rather than in each utility). The question, however, would be
> what the right place would be: libiberty doesn't formally belong to
> binutils (and thus seems a bad candidate) and bfd shouldn't normally be
> concerned with non-bfd operations (and even if to be placed there, I'm
> uncertain whether gas in non-BFD_ASSEMBLER mode actually may link
> against libbfd).

It is intended behaviour for gas to delete its output file on error.
That normally gives the best result when using gas in a Makefile;
there is no temporary file left around to cause the next invocation of
make to think that the assembly succeeded.  While it's true that some
versions of make will delete the target if the commands fail, not all
make programs work that way, and not all Makefiles are written in a
manner which permits that operation to work.

The same argument has generally applied to ld and the other utilities.

I suppose we could make that deletion happen only if the file were a
regular file.  It seems like a strange exception, and it seems like it
would be easy for your script to use a temporary file, but I guess I
don't really know for sure how it should work.  I see that gcc does
check whether temporary files are regular files before deleting them
(DELETE_IF_ORDINARY in gcc.c), which argues that the binutils should
do the same.

I think that libiberty is the right place for such a function.

Ian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]