<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/145129>145129</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
llvm-objcopy is deleting a file when overwriting a file mounted in Docker
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
DVLP
</td>
</tr>
</table>
<pre>
Here's the discovery process
https://github.com/emscripten-core/emsdk/issues/1568
Given `file.wasm` mounted in a Docker volume in windows
Running
`/emsdk/upstream/bin/llvm-objcopy file.wasm file.wasm`
causes: `/emsdk/upstream/bin/llvm-objcopy: error: No such file or directory`
and it also deletes the original file
Providing a different name to the output file allows the process to complete successfully. This works:
/emsdk/upstream/bin/llvm-objcopy file.wasm file2.wasm
Copying the file to /tmp allows llvm-objcopy to process the file without changing its name. This may mean that this is a filesystem race condition due to working in a mounted Docker directory. Perhaps llvm-objcopy should wait for the file deleting operation to complete before writing the modified version.
This happens in multiple versions. I.e. version 17
```
root@273b84dcb718:/code/builds# /emsdk/upstream/bin/llvm-objcopy --version
llvm-objcopy, compatible with GNU objcopy
LLVM (http://llvm.org/):
LLVM version 17.0.0git
Optimized build.
```
also tested in version 19
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJycVE2P4zYM_TXKhRhDUb4PPqS7yLbAdDso2r3LEh1zRxYNSU6Q_vpCcjyZ2UPRFvDBoqTHR_Lp6Rjp7BFrsflJbD4v9Jg6DvXnb88vi4btrf4ZAwq1i5A6BEvR8AXDDYbABmMU8tilNESxOgp1Eup0ptSNTWW4F-qEfTSBhoT-yXCGyRH7KtSJYhwxCnVabrZ7IY9CHr_QBT2IrWzJYXXVsRdbCT2PPqEF8qDhM5tXDHBhN_aYQ1fylq-Zxe-j9-TPGWor3yUah5gC6symIS_UyblL_8TNd8PDDd5SwfukQh6NHiPmquA_wOXjGAKH_POVIY6mK8DAASwFN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