[clang] [clang-format] convert path to Windows path if user is using a MSYS2 shell (PR #111526)

Gary Wang via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 8 21:27:21 PDT 2024


BLumia wrote:

> I personally use Cygwin and it's git understands unix paths is that not the case for msys2

Git can understand (and will return a) unix path, but it seems MSYS2's python won't accept unix path. It fails at `os.chdir(toplevel)`, and `toplevel` is a unix path.

> are you mixing msys2 with windows based git

I guess no:

```shell
Gary at legion-laptop ~/Source/elisa % which python
/ucrt64/bin/python
Gary at legion-laptop ~/Source/elisa % which git
/usr/bin/git
```

> won't this have the potential to break others?

`MSYSTEM` and `cygpath` are checked to avoid breaking others but I'm not sure if there are other potential cases. `MSYSTEM` is a MSYS-only environment which cygwin doesn't use, btw.

> Can you please log an issue for this to show what you see and a reproducer

See https://github.com/msys2/MINGW-packages/issues/2457, simply starting a MSYS2 shell (if using Windows Terminal, you can use something like `C:/msys64/msys2_shell.cmd -defterm -here -no-start -ucrt64 -shell=zsh`, shell can also be `bash`), `cd` into a git repo with any valid clang-format configuration, and then execute `git clang-format` would be able to reproduce the issue. Or do I need to create a new issue in this repo?

https://github.com/llvm/llvm-project/pull/111526


More information about the cfe-commits mailing list