-
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
Regressions with the terminal alternate screen in msys2-runtime 3.3.6-5 #185
Comments
I can not reproduce any of those issues in msys2 setup.
That page clearly warns that "Please note that this scenario is not officially supported by Git for Windows"1 Please install git-for-windows and msys2 separately if you want both in your system. Footnotes |
I could observe the bad behaviour with vanilla MSYS2, without git installed. I used the latest installer (msys2-base-x86_64-20231026.tar.xz), here are my steps to setup the MSYS2 environment:
Now create the executable:
Running Now the interesting bit is that if I downgrade the runtime to 3.3.6-4, by manually downloading https://repo.msys2.org/msys/x86_64/msys2-runtime-3.3.6-4-x86_64.pkg.tar.zst and |
I used the MINGW64 environment, not UCRT64. |
What is your OS/ My main machine is on Windows 11. I just tried to reproduce on 2 VMs, one win 10, one win 11. I only reproduced a single time on win 10, with 9 strings printed out of 10, across many executions of the for loop command. On win 11 however I could reproduce the problem easily. I followed the steps I provided above, installing a clean and up-to-date MSYS2, and confirmed the installed msys2-runtime package is version 3.4.10-2. |
I have tried the commands both in Windows 10 and Windows 11 latest version (dual boot and bare metal installation). The command shows same output in 10 or 11. |
I had a go at isolating the issue and it seems to be somewhere in the tty translation because:
|
You are using GFW installed inside MSYS2 proper aren’t you? If so, I described the procedure in the wiki page:
If you don’t want to affect your config, you can do
I don’t see any issue on my end with
What is your I can reproduce on # preliminary: create a cat file
echo ok >cat
# should print `10 ok`
for i in {1..10}; { ./bad_exec cat; } | uniq -c
# should print `10 ls: cannot access 'ls': No such file or directory`, unless you have an ls file
for i in {1..10}; { ./bad_exec ls; } 2>&1 | uniq -c
# should print `10 printf` -- same test as before
for i in {1..10}; { ./bad_exec printf; } | grep -o printf | uniq -c |
I confirm these observations on my end too. This seems to be the best way to demonstrate the problem. As an aside, here, the environment variable is only set on the left hand side of the pipe, so the Note that GFW’s msys2-runtime 3.3.6-4 fixes this problem too. |
Another issue is |
The issue with The latest version, PortableGit-2.43.0-64-bit.7z.exe, also has the issue. But Git-2.43.0-64-bit.exe, which is an other installer artefact of the same 2.43.0 release, seems to work fine! Now, going back to MSYS2 proper, I narrowed down where the bug was introduced: between msys2-runtime-3.3.6-1-x86_64.pkg.tar.zst (good) and msys2-runtime-3.3.6-2-x86_64.pkg.tar.zst (bad). Guessing from the build date, I suspect this commit: msys2/MSYS2-packages@3dad035. In my first post on this issue, I mixed up the msys2-runtime packages for MSYS2 proper (currently distributed as tar.zst) and those obtained from the GFW repo (tar.xz). There appears to be no 3.3.6-5 on GFW side. The last good version of the package on GFW is 3.3.6-4 as previously indicated, but the first bad one is 3.4.6-1. It would seem as though the regression was first introduced in MSYS2, then 9 months later got into GFW. Looking at the range of commits found in the file properties of msys-2.0.dll, I get this huge diff: git-for-windows/msys2-runtime@bec3d60...82f0d82. It contains most of the changes from the above MSYS2-proper commit, though the actual commits are slightly different: git-for-windows/msys2-runtime@de71536, and the dropping of 8e89fff (as opposed to being reverted, as in the above). As an aside, GFW’s msys-2.0.dll has, in its file properties’ product version, the git revision hash for the commit in the GFW msys2-runtime repo it was built from. That is very helpful, and I would suggest MSYS2 also do the same. I think it was added in this commit: git-for-windows/msys2-runtime@dbd0a16 This disable_pcon change seemed very related. And I found this documentation page: https://cygwin.com/cygwin-ug-net/using-cygwinenv.html. So, I just gave it a try, starting my terminal as I want to mention that I very much appreciate dscho’s detailed commit messages. |
I confirmed that setting the
The reason for that is that, although msys-2.0.dll and git-bash.exe are binary identical in both artefacts, the installer one creates a file As for my setup, in MSYS2, I needed to add that line to Perhaps the most surprising of all issues fixed, because it seems unrelated to the console, was the fact that the C function |
There are 2 regressions I noticed after a
pacboy update
, which are still observable in the latest msys2-runtime 3.4.10-1:git help X
does not show the man page for X anymore. I have to resort to typingman git-X
.LESS=R git show
does not start theless
pager in an alternate screen anymore. Becauseless
correctly clears the text on exit, it results in blank vertical space in the terminal, corresponding to the number of lines of the screen thatless
used for printing content. I can still get the original desired behaviour by typinggit show --color | less -R
.I have installed Git for Windows inside MSYS2, as per https://github.com/git-for-windows/git/wiki/Install-inside-MSYS2-proper.
I initially thought these regressions were caused by
less
,mintty
, orgit
, but finally found out that reverting the single msys2-runtime package to 3.3.6-4 fixes both issues. Beyond the fact that they were introduced at the same time, I am now unsure of how related they are.Indeed, from the git source code I reduced the problem 1 to the following:
which seems not to do anything from version 3.3.6-5 of the runtime, despite exiting with return code 0. But, replacing all occurrences of
man
withprintf
in the above produces no output either, wheareas it does printprintf
in version 3.3.6-4. So it seems unrelated to alternate screens after all. Please let me know if I should create 2 distinct issues.I thought this problem could have been introduced in the Cygwin upstream. But after installing it, recompiling and running the snippet of code produced an execution of
man man
as expected with the cygwin package versions from 3.4.10 down to 3.4.7. I had suspected some commits in Dec 2021 or Jan 2022 which affect the cygwin pty or console. Maybe it is that some msys patches did not play well with such changes.As for problem 2, I did not manage to get a reduction. I would tend to think that the function
mingw_spawnvpe
, used to spawn theless
pager process and implemented in Git’s sourcecompat/mingw.c
, is a likely culprit. That would relate the two issues to process functions. But given thatmingw_spawnvpe
looks to be implemented in terms of the Windows API, I do not see how a msys runtime change could break it, so that seems to contradict my hypothesis.What I found amusing about it is that running the equivalent command in PowerShell works as expected:
The text was updated successfully, but these errors were encountered: