Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to disable unix path translation? #229

Open
realyukii opened this issue Oct 22, 2024 · 11 comments
Open

How to disable unix path translation? #229

realyukii opened this issue Oct 22, 2024 · 11 comments

Comments

@realyukii
Copy link

some program like msiexec.exe only understand Windows path, thus it cause trouble when python program tried to spawn msiexec.exe:

Unpacking msi files...
Traceback (most recent call last):
  File "/home/ACER/portable-msvc.py", line 285, in <module>
    subprocess.check_call(["msiexec.exe", "/a", m, "/quiet", "/qn", f"TARGETDIR={OUTPUT.resolve()}"])
  File "/usr/lib/python3.12/subprocess.py", line 413, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['msiexec.exe', '/a', PosixPath('downloads/Universal CRT Headers Libraries and Sources-x86_en-us.msi'), '/quiet', '/qn', 'TARGETDIR=/home/ACER/msvc']' returned non-zero exit status 103.

I have tried this solution, but it just show another error that I'm not sure that I fully understand the error:

Unpacking msi files...
This installation package could not be opened.  Verify that the package exists and that you can access it, or contact the application vendor to verify that this is a valid Windows Installer package.
Traceback (most recent call last):
  File "/home/ACER/portable-msvc.py", line 285, in <module>
    subprocess.check_call(["msiexec.exe", "/a", m, "/quiet", "/qn", f"TARGETDIR={OUTPUT.resolve()}"])
  File "/usr/lib/python3.12/subprocess.py", line 413, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['msiexec.exe', '/a', PosixPath('downloads/Universal CRT Headers Libraries and Sources-x86_en-us.msi'), '/quiet', '/qn', 'TARGETDIR=/home/ACER/msvc']' returned non-zero exit status 83.
@realyukii
Copy link
Author

realyukii commented Oct 22, 2024

the python program originated from this gist

@Biswa96
Copy link
Member

Biswa96 commented Oct 23, 2024

This may help https://www.msys2.org/docs/filesystem-paths/

@realyukii
Copy link
Author

I'm not sure if that link would help, I already tried what mentioned there but it still translate the path with PosixPath

@dscho
Copy link
Collaborator

dscho commented Oct 23, 2024

@Biswa96 that page does not describe the new MSYS_NO_PATHCONV variable, maybe it should? It does not allow for as fine-grained configuration as MSYS2_ENV_CONV_EXCL/MSYS2_ARG_CONV_EXCL, but on the upside it is much, much easier to use.

@dscho
Copy link
Collaborator

dscho commented Oct 23, 2024

I'm not sure if that link would help, I already tried what mentioned there but it still translate the path with PosixPath

Maybe you can provide some sort of detail, such as a small reproducer, detailed output, etc? It is hard to solve a problem when forced to guess.

@realyukii
Copy link
Author

realyukii commented Oct 23, 2024

I'm not sure if that link would help, I already tried what mentioned there but it still translate the path with PosixPath

Maybe you can provide some sort of detail, such as a small reproducer, detailed output, etc? It is hard to solve a problem when forced to guess.

Well... I do apologize for not provide enough details explicitly, here's the way to reproduce the issue:

pacman -S python libopenssl
curl -LOJ https://gist.githubusercontent.com/mmozeiko/7f3162ec2988e81e56d5c4e22cde9977/raw/9f8555326867d4ecba70ee07f105f159f5d8afd5/portable-msvc.py
python portable-msvc.py

@dscho
Copy link
Collaborator

dscho commented Oct 23, 2024

curl -LOJ https://gist.githubusercontent.com/mmozeiko/7f3162ec2988e81e56d5c4e22cde9977/raw/9f8555326867d4ecba70ee07f105f159f5d8afd5/portable-msvc.py

@RealYukiSan are you really calling this a small reproducer?

Please revisit https://stackoverflow.com/help/mcve, in particular this part:

Your code examples should be…

  • Minimal: Use as little code as possible that still produces the same problem

Also, you may want to zone in on the PosixPath() function, which is not even in your reproducer (probably only via yet a different asset that makes the reproducer even less minimal). I bet that the use of PosixPath() is the problem, as you clearly want to use this on Windows and hence might need Windows paths, not POSIX paths?

@realyukii
Copy link
Author

are you really calling this a small reproducer?
which is not even in your reproducer

I can't reproduce in a small reproducer, the problem is I don't even know why the PosixPath function was printed on CalledProcessError stack, it's not even called in the python script

as you clearly want to use this on Windows and hence might need Windows paths, not POSIX paths?

indeed, maybe I should post the issue on msys2-package repository instead? as it's related to specific python package installed from msys

@dscho
Copy link
Collaborator

dscho commented Oct 23, 2024

maybe I should post the issue on msys2-package repository instead?

I don't think that it is a good idea to reflexively try to throw this issue over the wall, without even analyzing it properly yourself.

I mean, you know where in the script it is stuck, and it's likely around this line, and you could then call that command individually (and have a much, much more minimal reproducer already).

Then dig into what this .msi does, where it is defined, where that PosixPath() function is used within that definition. The dig deeper. And deeper.

It's really good idea to ask people for help after doing these first steps and being able to present a much more concise problem description. Otherwise, those exact people who could help you, like me, may decide that they do not want to deal with the problem altogether because all the analysis is expected from them.

@realyukii
Copy link
Author

You're right, and I do apologize for not having searched more carefully. I'm grateful for your prompt response and your civility in the face of my impatience!

I will try to debug the issue and provide any details if I found something useful to share.

@Zsar
Copy link

Zsar commented Jan 13, 2025

Possibly related: The documented environment variables seem to have no effect in a fresh MSYS2 installation from last thursday.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants