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

Installer parameters CLOSEAPPLICATIONS/FORCECLOSEAPPLICATIONS do not seem to have any impact #5250

Open
1 task done
obuolinis opened this issue Nov 11, 2024 · 6 comments · May be fixed by git-for-windows/build-extra#580

Comments

@obuolinis
Copy link

  • 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-2.47.0.2-64-bit.exe installer
  • Which version of Windows are you running? Vista, 7, 8, 10? Is it 32-bit or 64-bit?
$ cmd.exe /c ver

Microsoft Windows [Version 10.0.22631.4317]

Details

1. Have any Git version installed
2. Open Git GUI and/or Git Bash
3. Run installer with parameters: /VERYSILENT /NORESTART /FORCECLOSEAPPLICATIONS /LOG="C:\Windows\Logs\Software\Git-x64-Install.log"
  • What did you expect to occur after running these commands?

Expect the installer to force-close any open git-related apps and proceed with the installation

  • What actually happened instead?

If I run the above command as an administrative user, I receive a popup
Screenshot 2024-11-11 144909

If the installer gets executed via device management software, like SCCM or Intune (that is as SYSTEM account), the exact same message gets written into the log and the installer process is just hanging there indefinitely.

dscho added a commit to dscho/build-extra that referenced this issue Nov 11, 2024
When `/CLOSEAPPLICATIONS` or `/FORCECLOSEAPPLICATIONS` is passed to
InnoSetup, it will handle the closing/terminating of in-use apps, and we
do not have to do anything manually.

This fixes git-for-windows/git#5250

Signed-off-by: Johannes Schindelin <[email protected]>
@dscho
Copy link
Member

dscho commented Nov 11, 2024

If I run the above command as an administrative user, I receive a popup

This error message is produced here.

I guess that this code should be skipped if /CLOSEAPPLICATIONS or /FORCECLOSEAPPLICATIONS is passed to the installer. I gave this a try in git-for-windows/build-extra#580. Once that PR build is done, would you mind testing the installer artifact, @obuolinis?

@dscho
Copy link
Member

dscho commented Nov 11, 2024

would you mind testing the installer artifact, @obuolinis?

This is the URL for the install-artifacts artifact: https://github.com/git-for-windows/build-extra/actions/runs/11781878036/artifacts/2172074982

@obuolinis
Copy link
Author

This is the URL for the install-artifacts artifact: https://github.com/git-for-windows/build-extra/actions/runs/11781878036/artifacts/2172074982

Just managed to test it, same command line. It kind of worked but not the way I'd expect it to.

First I installed v2.40.1 and opened Git GUI and Git Bash, then ran the test installer. No foreground apps were force-closed (wish.exe, mintty.exe), however the installer proceeded with the installation and when it was finished i could see that git version was now 2.47.0.2.
Then I noticed that the installer wasn't able to update certain executables and dlls that were in use - git-bash.exe, bash.exe, wish.exe, mintty.exe. The log said they would be updated after a reboot.

That's the behavior I'd expect from another install parameter - /NOCLOSEAPPLICATIONS, but not /CLOSEAPPLICATIONS or /FORCECLOSEAPPLICATIONS. So maybe you could explain what each parameter is supposed to do?

@dscho
Copy link
Member

dscho commented Nov 12, 2024

Then I noticed that the installer wasn't able to update certain executables and dlls that were in use - git-bash.exe, bash.exe, wish.exe, mintty.exe. The log said they would be updated after a reboot.

That's the behavior I'd expect from another install parameter - /NOCLOSEAPPLICATIONS, but not /CLOSEAPPLICATIONS or /FORCECLOSEAPPLICATIONS. So maybe you could explain what each parameter is supposed to do?

Hmm. I cannot really explain this behavior because this is not actually in Git for Windows' code, it is in InnoSetup's.

From what I can tell, the applications to close are registered here, and it looks straight-forward. So I have no idea why they are not force-closed.

However, I do see that there is plenty of logging going on. Have you tried to log to a file with /LOG=<filename> and looked for those tell-tales?

@obuolinis
Copy link
Author

Yes, I'm using /LOG as mentioned in the first post. However after running the test installer you provided I'm not able to find in the log any of the strings you linked. Furthermore there's no single mention of "RestartManager" at all.

For testing I first installed Git 2.40.1 x64 and opened "Git Bash", then ran the test installer with parameters /VERYSILENT /NORESTART /FORCECLOSEAPPLICATIONS /LOG=C:\Windows\Logs\Software\Git-0-x64-Install.log.

Here are the files that the installer wasn't able to handle:

2024-11-16 18:45:26.624   -- File entry --
2024-11-16 18:45:26.624   Dest filename: C:\Program Files\Git\git-bash.exe
2024-11-16 18:45:26.624   Time stamp of our file: 2024-11-11 15:55:26.000
2024-11-16 18:45:26.624   Dest file exists.
2024-11-16 18:45:26.624   Time stamp of existing file: 2023-04-19 05:40:20.000
2024-11-16 18:45:26.624   Version of our file: 2.47.0.2
2024-11-16 18:45:26.624   Version of existing file: 2.40.1.1
2024-11-16 18:45:26.624   Installing the file.
2024-11-16 18:45:26.624   DeleteFile: The existing file appears to be in use (5). Retrying.
2024-11-16 18:45:27.643   DeleteFile: The existing file appears to be in use (5). Retrying.
2024-11-16 18:45:28.662   DeleteFile: The existing file appears to be in use (5). Retrying.
2024-11-16 18:45:29.668   DeleteFile: The existing file appears to be in use (5). Retrying.
2024-11-16 18:45:30.684   DeleteFile: The existing file appears to be in use (5). Will replace on restart.
2024-11-16 18:45:30.684   Leaving temporary file in place for now.
(...)
2024-11-16 18:45:37.502   -- File entry --
2024-11-16 18:45:37.502   Dest filename: C:\Program Files\Git\usr\bin\bash.exe
2024-11-16 18:45:37.502   Time stamp of our file: 2024-11-11 15:55:26.000
2024-11-16 18:45:37.502   Dest file exists.
2024-11-16 18:45:37.502   Time stamp of existing file: 2023-04-19 06:02:16.000
2024-11-16 18:45:37.502   Version of our file: (none)
2024-11-16 18:45:37.502   Version of existing file: (none)
2024-11-16 18:45:37.502   Installing the file.
2024-11-16 18:45:37.629   DeleteFile: The existing file appears to be in use (5). Will replace on restart.
2024-11-16 18:45:37.629   Leaving temporary file in place for now.
(...)
2024-11-16 18:45:38.367   -- File entry --
2024-11-16 18:45:38.367   Dest filename: C:\Program Files\Git\usr\bin\mintty.exe
2024-11-16 18:45:38.367   Time stamp of our file: 2024-11-11 15:55:26.000
2024-11-16 18:45:38.367   Dest file exists.
2024-11-16 18:45:38.367   Time stamp of existing file: 2023-04-19 06:02:16.000
2024-11-16 18:45:38.367   Version of our file: 3.7.6.0
2024-11-16 18:45:38.367   Version of existing file: 3.6.3.0
2024-11-16 18:45:38.367   Installing the file.
2024-11-16 18:45:38.404   DeleteFile: The existing file appears to be in use (5). Will replace on restart.
2024-11-16 18:45:38.404   Leaving temporary file in place for now.
(...)
2024-11-16 18:45:38.420   -- File entry --
2024-11-16 18:45:38.420   Dest filename: C:\Program Files\Git\usr\bin\msys-2.0.dll
2024-11-16 18:45:38.420   Time stamp of our file: 2024-11-11 15:54:16.000
2024-11-16 18:45:38.420   Dest file exists.
2024-11-16 18:45:38.420   Time stamp of existing file: 2023-04-19 06:02:18.000
2024-11-16 18:45:38.420   Version of our file: 3005.4.0.0
2024-11-16 18:45:38.420   Version of existing file: 3003.6.0.0
2024-11-16 18:45:38.420   Installing the file.
2024-11-16 18:45:39.009   DeleteFile: The existing file appears to be in use (5). Will replace on restart.
2024-11-16 18:45:39.009   Leaving temporary file in place for now.
(...)
2024-11-16 18:45:52.986   Need to restart Windows? Yes
2024-11-16 18:45:52.986   Will not restart Windows automatically.
2024-11-16 18:45:52.986   Deinitializing Setup.
2024-11-16 18:45:53.131   Log closed.

So /FORCECLOSEAPPLICATIONS isn't doing what it's supposed to do as you can see. My question is - how is the installer supposed to know what it needs to force-close? What you did with the test installer I think you just skipped the code that detects open apps and throws popups, therefore installer just proceeds regardless.

@obuolinis
Copy link
Author

In the end we decided against trying to force-close any open Git processes as users may have important activities going on at the time when Git update gets triggered. We use PSADT framework as a wrapper which can present users a popup with a countdown asking to close certain offending apps/processes before executing the actual installer, and that's what we're going to do with Git.

There's only one problem - in some cases Git installer (with same install parameters as above) throws the following message and refuses to continue:

2024-11-14 15:46:25.775   Message box (Yes/No):
                          If you continue without closing the listed applications they will be terminated/restarted automatically.

Are you sure you want to continue?
2024-11-14 16:10:30.627   User chose No.
2024-11-14 16:10:30.628   Failed to proceed to next wizard page; aborting.
2024-11-14 16:10:30.628   Got EAbort exception.
2024-11-14 16:10:30.628   Deinitializing Setup.
2024-11-14 16:10:30.676   Log closed.

There are no applications in the list and it's not clear why that message was triggered. I wasn't able to reproduce such behavior myself. What's going on here? What am i missing?

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

Successfully merging a pull request may close this issue.

2 participants