msys2-runtime icon indicating copy to clipboard operation
msys2-runtime copied to clipboard

Cannot create symlink to file with non-latin letters in its name

Open me21 opened this issue 4 years ago • 5 comments

Describe the issue

ln -s Äfoo.go afoo.go command fails, even though the file named Äfoo.go exists.

Steps to Reproduce the Problem

  1. touch Äfoo.go
  2. ln -s Äfoo.go afoo.go
  3. The command fails with message "no such file or directory"

A symlink should be created instead.

Additional Context: Operating System, Screenshots

  • OS: Windows 10 Pro 21H1 with October 2021 cumulative update

It also fails with cyrillic letters in file name, and I suspect it will fail with any non-ASCII letters.

Setting MSYS=winsymlinks:nativestrict is a workaround, no such error is raised then.

me21 avatar Oct 21 '21 09:10 me21

There was some commentary (I think on #56) that the code that handles symlinks by copying doesn't use the Unicode APIs.

jeremyd2019 avatar Oct 21 '21 17:10 jeremyd2019

Okay then, it's good it's known where it should be fixed 🙂

me21 avatar Oct 21 '21 18:10 me21

I believe that that's not the correct place, https://github.com/msys2/msys2-runtime/blob/b671a59da80fa1db6115e3275149f9639681453a/winsup/cygwin/path.cc#L2297-L2366 should be the correct one. But I am seeing CopyFile() being called with wide-character strings...

dscho avatar Oct 22 '21 14:10 dscho

But I am seeing CopyFile() being called with wide-character strings...

https://github.com/msys2/msys2-runtime/blob/b671a59da80fa1db6115e3275149f9639681453a/winsup/cygwin/path.cc#L2343-L2344

The w_ prefix is a lie. (or maybe it's w for "Windows paths").

jeremyd2019 avatar Oct 22 '21 17:10 jeremyd2019

The w_ prefix is a lie.

It fooled me!

dscho avatar Oct 23 '21 08:10 dscho