-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
git update-git-for-windows --yes
does not work in GitHub workflows
#5230
Comments
Thanks for the tip on running under
|
In another run it seems like there was a different issue and maybe that the
|
Progress! Your screenshot suggestion helped greatly! It seems like the installer is succeeding after some time judging from the screenshots and the output of I still don't understand why https://github.com/rotu/workflow-scratch/actions/runs/11524785608/job/32085698468 |
The big problem with Obviously, this is not what we would want in a GitHub workflow: We would want the workflow step to run the installer and wait for its exit status, and avoid stopping any Bash instances. Sadly, I don't think that there is any way to keep Bash running the script while overwriting the MSYS2 runtime and then having a prayer of the script exiting in an orderly fashion. The most common symptom I saw in the past was an infinitely-repeated error message. After thinking about this a bit more, I think that the only solution to this puzzle would be to rewrite the command in pure C, linking to libcurl to download the installer manually (and using the presence of However, this would be a rather big task. A much more narrowly-scoped alternative (and therefore much more practical) would be to add some code guarded by |
Okay, I kinda understand that. It does look like a shell script, with a curl -# -L -o $installer $download || return
start "" "$installer" //SILENT //NORESTART
# Kill all Bash processes (which will let MinTTY quit, too)"
#
# `ps` without `-W` will automatically only catch MSYS2 processes
# that link to *this* MSYS2 runtime, i.e. no processes from other Git
# installations (e.g. Git for Windows' SDK) will be killed.
ps | grep ' /usr/bin/bash$' | awk '{print "kill -9 " $1 ";" }' | sh
return 2 That looks like the Anyhow, in my case, running #!/usr/bin/env bash
# Copyright (C) 2014, Alexey Pavlov
# mailto:[email protected]
# This file is part of Minimal SYStem version 2.
# https://sourceforge.net/p/msys2/wiki/MSYS2%20installation/
# File: start
"$COMSPEC" //c start "${@//&/^&}"
I'm not sure if you realize that
What does Footnotes
|
It is a shell script.
Indeed. This starts the installer, but immediately returns to the shell script. The installer continues running, and the design of the script is that it exits before the installer comes even close to (potentially) overwriting the MSYS2 runtime.
Right, it's a look-alike, living in
Oh, I am well aware of it, and I tried to fight it, and gave up. I did not want the burden of having to maintain Git for Windows and in addition the Bash that runs all of the
The shell that runs
Exactly what we need here. |
I think I'm still confused by why the script kills
I feel you, man...
I don't get is whether any OS resources, file handles, or MSYS2 stuff depend on the process exiting in order to clean up. Or if it's going to be left in a state that conflicts with the installer. It seems like, if we used After composing the previous message, I realized that Windows implicitly scopes some things to the calling window and not the process. I don't understand how that interplays with |
Per @vorporeal at actions/runner-images#10843 (comment)
Interesting. @dscho any insights? Does |
No, that's not what works around the issue here. What does work around the issue here is that The only downside with this is that you will not catch any problems when the installer could not be downloaded, or when it could not successfully run to completion. |
@rotu The script needs to kill its parent process. Otherwise its parent process won't be able to exit correctly if
Unlike Linux, on Windows it is not possible to overwrite files that are in use. To emulate that behavior, Cygwin's runtime (and therefore also the MSYS2 runtime, which is a friendly fork of the Cygwin one) plays nasty tricks. This is the reason why the installer can overwrite However, this emulation is far from perfect. For example, Cygwin cannot prevent Windows' now-broken assumption of an unchanged |
It was reported by @rotu in #5199 (comment) that it does not work:
It could be a modal dialog? If so, it should be possible to capture it with something like this PowerScript:
Another idea would be to run the
git-update-git-for-windows
script with tracing turned on:or to dig into it by debugging with tmate:
However, my money is on this part of the script which tries to ensure that the (interactive) Bash session is quit forcefully lest an updated MSYS2 runtime prevent an orderly exit.
Now, if that last hunch is correct, I could imagine that we need to add a special case for when
$GITHUB_ACTIONS
is non-empty and simply skip that code block in that scenario.@rotu, would you like to give this a try?
The text was updated successfully, but these errors were encountered: