I came across a weird issue with cp
in Git Bash, and same for Msys2 shell. When copying an exe
file (e.g., some-file.exe
) along with a file with the same name but no extension (e.g., some-file
), it will only copy some-file
but as the name some-file.exe
. Here are the steps to reproduce.
mkdir a-new-tmp-folder
cd a-new-tmp-folder
mkdir tmp
echo "file" >file
echo "file.exe" >file.exe
cp -t tmp file.exe file
ls tmp # only `file.exe' there
cat tmp/file.exe # shows `file' instead of expected `file.exe'
However, if swap the last 2 arguments of cp (cp -t tmp file file.exe
), there won't be any issue. Could anyone please help explain?
As mentioned in Msys2 todo list, this is a known issue because the runtime emulates extension-less executables by also looking for
.exe
on various FS calls.It seems that there is currently no solution or workaround for this issue.