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

Feature request: silently stops ssh-agent.exe when upgrading #4172

Closed
1 task done
jeanmichel-nwsb opened this issue Dec 16, 2022 · 6 comments
Closed
1 task done

Feature request: silently stops ssh-agent.exe when upgrading #4172

jeanmichel-nwsb opened this issue Dec 16, 2022 · 6 comments

Comments

@jeanmichel-nwsb
Copy link

jeanmichel-nwsb commented Dec 16, 2022

  • I was not able to find an open or closed issue matching what I'm seeing

Setup

  • Which version of Git for Windows are you using? Is it 32-bit or 64-bit?
$ git --version --build-options
git version 2.39.0.windows.1
cpu: x86_64
built from commit: de9501c66f93785f7eaf10d02ef08d231eb11688
sizeof-long: 4
sizeof-size_t: 8
shell-path: /bin/sh
feature: fsmonitor--daemon
  • Which version of Windows are you running? Vista, 7, 8, 10? Is it 32-bit or 64-bit?
Windows 10 Professional 64-bit, 22H2
  • What options did you set as part of the installation? Or did you choose the
    defaults?
$ cat /etc/install-options.txt
Editor Option: nano
Custom Editor Path:
Default Branch Option: main
Path Option: Cmd
SSH Option: OpenSSH
Tortoise Option: false
CURL Option: OpenSSL
CRLF Option: LFOnly
Bash Terminal Option: MinTTY
Git Pull Behavior Option: Merge
Use Credential Manager: Enabled
Performance Tweaks FSCache: Enabled
Enable Symlinks: Disabled
Enable Pseudo Console Support: Disabled
Enable FSMonitor: Disabled
  • Any other interesting things about your environment that might be related
    to the issue you're seeing?

Details

  • Which terminal/shell are you running Git from? e.g Bash/CMD/PowerShell/other

git-bash (but that's not relevant to the request)

Running setup for upgrading an existing git-for-windows while ssh-agent is already running in the background.

  • What did you expect to occur after running these commands?

Seamless upgrade with no or little user interaction.

  • What actually happened instead?

The installer comes up with an error message telling that ssh-agent.exe is running in the background.
User have to open the task manager, go to the "Details" tab, find ssh-agent.exe and kill it in order to continue the upgrade process.
This is a bit tedious and unfriendly

I am suggesting that the installer either silently kill the running ssh-agent.exe, or at least offers to do it on behalf of the user when popping up the message.

As far as I remember, this behavior has been consistent since I am using Git-for-Windows for the last 3 years.

Thanks
Beside that, I LOVE git-for-windows and git-bash. I prefer using that than WSL2.
Thanks for the job.

  • If the problem was occurring with a specific repository, can you provide the
    URL to that repository to help us with testing?

not applicable

@dscho
Copy link
Member

dscho commented Dec 16, 2022

That's a great idea, and you can even contribute that change yourself:

  1. install Git for Windows' SDK,
  2. sdk cd installer,
  3. edit modules.inc.iss
    You will see that there is already code identifying ssh-agent as a terminate-able process. To find out why that code does not work as expected, you could use Log() or MsgBox()
  4. build a new installer via sdk build installer/test the page via ./release.sh -d Processes
  5. either add more debugging statements, or attempt to fix the bug, then repeat the previous step
  6. verify that that installer works as expected?
  7. open a PR?

@jeanmichel-nwsb
Copy link
Author

Thanks for pointing me in the right direction
I will try during the holidays ;)
Have a great end of year time

@landstander668
Copy link

@jeanmichel-nwsb If you do create a PR for this, it would probably be worth including ssh-pageant as well. It basically handles the same role as the OpenSSH agent, but forwarding requests to the PuTTY authentication agent (pageant) instead of managing the keys itself.

@jeanmichel-nwsb
Copy link
Author

Oups, I haven't used Pascal since I left engineering school in 1989... 🙄

I have identified part of the problem : the test in the line pointed by @dscho doesn't work

https://github.com/git-for-windows/build-extra/blob/15c72a8282add1a1410a062191ae238194fc8f88/installer/modules.inc.iss#L540-L541

because Processes[Have].Name is not ssh-agent but ssh-agent.exe

So I tried the following, backward compatible code:

                ProcessName:=Processes[Have].Name;
                Position:=Pos('.exe',LowerCase(ProcessName));
                if (Position>0) then SetLength(ProcessName,Position-1);
                if ('ssh-add'=ProcessName) or ('ssh-agent'=ProcessName) or ('ssh-pageant'=ProcessName) or ('gpg-agent'=ProcessName) or ('scdaemon'=ProcessName) then
                    Processes[Have].ToTerminate:=True;

It seems more or less to do the job but not before the page that list the processes to kill have appeared once
I will PR this, inviting people to test more before merging

dscho pushed a commit to jeanmichel-nwsb/git-for-windows-build-extra that referenced this issue Dec 18, 2022
This fixes git-for-windows/git#4172

Signed-off-by: Jean-Michel Mercier <jeanmichel.mercier@newsbridge.io>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
@jeanmichel-nwsb
Copy link
Author

Fixed with git-for-windows/build-extra#453

@dscho dscho added this to the Next release milestone Dec 19, 2022
@dscho
Copy link
Member

dscho commented Dec 19, 2022

/add release note bug The installer is expected to stop GPG agents automatically, but there was a bug that prevented that from working, which has been fixed.

The workflow run was started

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

No branches or pull requests

4 participants