-
Notifications
You must be signed in to change notification settings - Fork 38
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
Regression from pathconv changes #208
Comments
Seems like this is caused by 9944652 For example, this works:
But this doesn't:
|
@dscho It seems as your commit 9944652 broke the pathconv rules as described here. Unfortunately, the rules are not complete w.r.t. relative paths. The official documentation says: $ python3 -c "import sys; print(sys.argv)" --dir=/foo
['-c', '--dir=C:/msys64/foo']
$ python3 -c "import sys; print(sys.argv)" --dir=/foo:/bla
['-c', '--dir=C:\\msys64\\foo;C:\\msys64\\bla'] Relative paths have not been mentioned so far, but the expected behavior should be something like this: $ python3 -c "import sys; print(sys.argv)" --dir=/foo:./bla
['-c', '--dir=C:\\msys64\\foo;.\\bla'] With the current pathconv rules, we get a different - flawed - picture $ python3 -c "import sys; print(sys.argv)" --dir=/foo:./bla
['-c', '--dir=/foo:./bla'] Note, that we get something completely different, if we do the following: $ python3 -c "import sys; print(sys.argv)" --dir=./foo:/bla
['-c', '--dir=.\\foo;C:\\msys64\\bla'] The change seems to be incomplete and hence break some packages, such as mentioned here msys2/MINGW-packages#19921 Any thought how we could fix this again? |
Just wanted to add that MSYS2 already provides a mechanism to exclude specific command line arguments (and environment variables) from the path conversion, as is also described in the MSYS2 documentation under the same link that @reneparis posted (see |
Not completely. As stated in the commit message of 9944652, the idea is to not confuse Git's Now, in your examples, the path lists all start with either |
The way I'd do that is by initializing something like @reneparis wanna give it a whirl? It might be a couple of days until I get back to this... |
Sorry, but this does not work, 'cause the example I gave was arbitrary. The broken package uses the following variable The conversion skipping mechanism is not specific enough and in my opinion introduces a lot of unexpected behavior. The two requirements, git path resolution and arbitrary path conversion, do not go well together unless the converter knows that it is in the context of |
Well, the prefix |
At the moment, I don't think that the path conversion is privy of the information that it operates on a given command, in particular because it also operates on environment variables. It is an interesting idea, though. |
@dscho I'd be interested in the original intention of the change in 9944652. Was it to satisfy the test suite? Or are there real world examples (e.g. of broken packages in MSYS2)? Also, the commit message states
which is directly related to our problem here. What is this statement based on? I find it to be quite common to use relative paths in path lists, especially in (C/C++) build systems.
The exact point where this information is already available is when calling the command. Thus, as stated previously, I'd give Maybe we can work out another solution for that together? In my opinion the current situation is not acceptable as the change breaks more things than it fixes and thus should be reverted (if we cannot come up with a better solution rather soon). btw, even though this is IMO the wrong approach (as is just catches a special case): the code snippet from above has a bug in the expression and should maybe be: |
@lazka - what is your opinion on that? |
While it does satisfy Git's test suite, the underlying reason for that fix is that it does address a class of real-world problems, as users such as myself use Git to inspect
Back when the change was originally made (in 2015), the package builds I sampled all used absolute paths in order to avoid problems when, say, setting the
Oh, let me clarify a misunderstanding: I addressed the problem mentioned in the referenced commit not for me, but for all of Git for Windows' users. Judging by the download count (which I have to use in lieu of more reliable data that I however cannot collect because that would cause High Drama In The Open Source World), the number of those users is in the millions. So: no, I cannot simply use
Well, in the spirited words of The Dude: 😁 Don't get me wrong (and especially please understand that I say this in good humor, not to offend you or something): I understand where you are coming from, I also understand, though, that we're dealing with an ill-posed problem here. Basically only a human can tell with certainty whether a given command-line option or environment variable is supposed to contain a path list that needs to be translated from Unix-style to Windows-style, or whether it contains something different that distinctly does not refer to a Windows path. And to be truthful: I would expect most humans to fail on that task, too, if provided sufficiently hairy corner cases (think of a script that is called with an argument that eventually is appended to
Again, please appreciate that at this moment, this is just an opinion, and I cannot really tell how much experience you really have in the space. As I said, I am building MSYS2 packages on a regular basis since 2015, so I would contend that I have a little bit of experience here that should count for something.
Hah! The entire path conversion is a special case. It is a gift that keeps on giving!
I concur. And I never claimed that it was correct. I said "something like", and was hoping that someone would be enticed to give it a whirl and open a PR so that we can do more than just talk. Obviously that plan failed rather miserably, joining so many of my past schemes 😉
It would be missing the former, although that is not even a path list and would therefore not run into the code introduced by the commit under discussion. It would not be missing the latter, though, as we're literally looking at a slash at the beginning of the path list, not after any colon. In the short run, I still think that we can probably figure out reliable patterns to catch most of the common scenarios. We will never catch all of the scenarios, of course, which is the reason why we need "escape hatches". In scenarios where the automatic path conversion is overzealous, those escape hatches would be:
In scenarios where the automatic path conversion fails to kick in, but would be desirable:
I don't think that we will ever be able to completely prevent the need for those escape hatches. Of course, I could imagine that eventually we'd introduce support for configuring regular expressions via environment variables to override the MSYS2 runtime's default classification. But then...: |
…nvironment variables to Windows form for native Win32 applications. When we fixed MSYS2's automatic Unix <-> Windows path conversion to identify and skip Git-style `<rev>:<path>` arguments (and incidentally also scp-style `<host>:<path>` ones), we assumed that path lists containing relative paths would be a rare scenario. My, was this assumption wrong! Let's add another heuristic that detects absolute paths at the beginning of path lists, and relative ones starting with either `./` or `../`, neither of which match those Git-style nor scp-style arguments, and then prevent the detection of the latter style from kicking in. This addresses msys2#208 Signed-off-by: Johannes Schindelin <[email protected]>
So here is a PR with the quick fix; Once the PR build finishes, I hope that y'all can give it a whirl to see whether the MSYS2 runtime built that way addresses your concerns? |
Unfortunately, the problem still existed. Simply revert 0042-fixup-Add-functionality-for-converting-UNIX-paths-in.patch fix this issue |
This is not a great suggestion, given that that patch was introduced to fix problems in the first place. The suggestion is to re-introduce those problems. You're just asking your needs to be favored over others, without weighing the overall benefits, which a large project like MSYS2 cannot afford. Also, please do not mingle unrelated tickets. In this here ticket, we are not discussing what happens to brackets in the auto-magic (or not so magic) path conversion, but what happens to path lists used in package builds. But maybe I should have been more specific, and not said "y'all" when I really meant users who are affected by the problem described in this ticket. |
To be more specific, revert that patch not only fix issue 187, it also fix this problem.
All problems related to pathconv are comes from msys2-runtime 3.4.10-4. |
And cause a regression. Great suggestion!
Git for Windows is just a placeholder for all programs that expect This continued suggestion to regress on a fix just to fix another regression, in effect trying to get us into a vicious cycle of regression hell, is really not helpful, I find. |
Let's get back again to the "we have an issue, let's fix it together" mode. The damage is done, let's focus on how to fix it. But I vote against the "patch until no one screams anymore marathon".
If we want to get both together, we need a
In an ideal world, I'd also love to see the git checks run automatically on every change in msys2, so we don't need to duplicate that stuff and run out-of-sync over time. |
If you have more tests in mind for your point 1, you could probably add them to the tests here: |
@reneparis There is actually a test suite, and I worked a bit to get it working in #135. And I agree with @mmuetzel that the Hooking up the msys2-tests so that they are run as part of the CI builds in |
That was the piece of the puzzle I was missing. |
Seems I missed my opportunity to reply to @dscho's thorough answer from above. I wanted to point out various reasons why I disagree, but as things seems to go into a positive direction again, I don't want to add further noise 😄 Looking forward finding a good solution together 👍 |
@ReinhardBiegelIntech I fear that you just did add further noise and did contribute in the direction you claimed not to want, though, merely by giving in to the urge of add this comment without any other contribution in furtherance of this issue. Having said that, I'd love to see some constructive contribution from your side. For example, you could contribute a PR to run the |
…nvironment variables to Windows form for native Win32 applications. When we fixed MSYS2's automatic Unix <-> Windows path conversion to identify and skip Git-style `<rev>:<path>` arguments (and incidentally also scp-style `<host>:<path>` ones), we assumed that path lists containing relative paths would be a rare scenario. My, was this assumption wrong! Let's add another heuristic that detects absolute paths at the beginning of path lists, and relative ones starting with either `./` or `../`, neither of which match those Git-style nor scp-style arguments, and then prevent the detection of the latter style from kicking in. This addresses msys2#208 Signed-off-by: Johannes Schindelin <[email protected]>
Hey @dscho @ReinhardBiegelIntech and I "gave it a whirl" three weeks ago and I'd really like get some progress here (or actually our customer). I don't know how the MSYS team is organized internally and who actually feels responsible for this (@lazka, @mmuetzel, you?). But without anyone giving us a hint if the things we're whirling up is right, participating feels pretty frustrating. Is it possible that you or anyone from the team can take a look at it in the near future or at least give us a time horizon? Thanks @reneparis |
I'm sorry to be so scarce on time, the security work leading up to Git v2.45.1 and follow-up work to address fall-out is demanding most of my attention. |
…nvironment variables to Windows form for native Win32 applications. When we fixed MSYS2's automatic Unix <-> Windows path conversion to identify and skip Git-style `<rev>:<path>` arguments (and incidentally also scp-style `<host>:<path>` ones), we assumed that path lists containing relative paths would be a rare scenario. My, was this assumption wrong! Let's add another heuristic that detects absolute paths at the beginning of path lists, and relative ones starting with either `./` or `../`, neither of which match those Git-style nor scp-style arguments, and then prevent the detection of the latter style from kicking in. This addresses msys2#208 Signed-off-by: Johannes Schindelin <[email protected]>
Previously msys2-runtime converted the path separator from
:
to;
when passing to a Windows program. Now, for some reason, this doesn't work:Though if it's the
PATH
variable it seems to work.Output from an old version of runtime for reference:
This is probably why rebuilding texlive errors out, see msys2/MINGW-packages#19921 (comment).
The text was updated successfully, but these errors were encountered: