[Bug libfortran/89020] close(status='DELETE') does not remove file

kargl at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Jan 24 00:17:00 GMT 2019


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89020

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kargl at gcc dot gnu.org

--- Comment #1 from kargl at gcc dot gnu.org ---
(In reply to Luke Robison from comment #0)
> Version: GNU Fortran (Ubuntu 7.2.0-8ubuntu3.2) 7.2.0
> OS: Guest Ubuntu running inside Host Windows 10 using VirtualBox
> 
> Problem:
> 
> CLOSE(status='DELETE',iostat=stat) does not delete some files, and still
> returns iostat == 0.
> 
> In order to delete files, I use the OPEN(file=..) followed by
> CLOSE(...,status='DELETE') pattern.  Normally this works, but
> it fails on VirtualBox's shared folders.  Running strace shows
> that the unlink syscall happens while the file is still open,
> and returns ETXTBSY, but the close then proceeds as usual.
>  Testing shows that other programs are unable to unlink the
> file while the fortran program has it open either, although
> they can safely unlink it after a CLOSE call.
> 

If virtualbox's shared folders are doing strange things with
files or is broken, not much that the gfortran developers
can do about that.

Work around for virtualbox might 

call execute_command_line("rm -f " // filename)


More information about the Gcc-bugs mailing list