Bug 17994 - `dlltool -l` leaves temporary file in case of error
Summary: `dlltool -l` leaves temporary file in case of error
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: binutils (show other bugs)
Version: 2.26
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-02-17 22:28 UTC by Alexander Cherepanov
Modified: 2015-03-05 15:15 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Cherepanov 2015-02-17 22:28:13 UTC
`dlltool -l` doesn't remove a temporary file in case of an error. Illustration:

$ ./dlltool -l /dev/null /dev/null
dndibh.s: Assembler messages:
dndibh.s:5: Error: cannot represent relocation type BFD_RELOC_RVA
dndibh.s:10: Error: cannot represent relocation type BFD_RELOC_RVA
dndibh.s:11: Error: cannot represent relocation type BFD_RELOC_RVA
./dlltool: as exited with status 1
./dlltool: failed to open temporary head file: dndibh.o: No such file or directory

$ ls *.s
dndibh.s

The same when a malformed regular file is used for input instead of /dev/null.
Comment 1 Sourceware Commits 2015-03-05 15:14:56 UTC
The master branch has been updated by Nick Clifton <nickc@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=81fb971a3d8626d7e051ff5df807442c8d233329

commit 81fb971a3d8626d7e051ff5df807442c8d233329
Author: Nick Clifton <nickc@redhat.com>
Date:   Thu Mar 5 15:13:08 2015 +0000

    Fixes PR 17994 - which reported that dlltool was not deleting temporary files if it encounters a fatal error.
    
    	PR binutils/17994
    	* dlltool.c (temp_file_to_remove): New local array.
    	(unlink_temp_files): New functions - unlinks any file in the
    	temp_file_to_remove array, unless dotdeltemps is set.
    	(gen_exp_file): Add temp files to array.
    	(make_head): Likewise.
    	(make_delay_head): Likewise.
    	(make_tail): Likewise.
    	(gen_lib_file): Call unlink_temp_files.
Comment 2 Nick Clifton 2015-03-05 15:15:59 UTC
Hi Alexander,

  Thanks for reporting this problem.  I have checked in a patch to fix it.  If you find any other ways to make dlltool leave a temporary file, please let me know via this PR.

Cheers
  Nick