Skip to content

llvm-objcopy is deleting a file when overwriting a file mounted in Docker #145129

Open
@DVLP

Description

@DVLP

Here's the discovery process
emscripten-core/emsdk#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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions