git-for-windows / git

A fork of Git containing Windows-specific patches.
http://gitforwindows.org/
Other
8.19k stars 2.49k forks source link

Unable to install when shell folder constant localappdata unavailable. #4967

Closed Walter-Gates-Bose closed 2 weeks ago

Walter-Gates-Bose commented 1 month ago

Setup

$ git --version --build-options

git version 2.44.0.windows.1                                                                                            
cpu: x86_64                                                                                                             
built from commit: ad0bbfffa543db6979717be96df630d3e5741331                                                             
sizeof-long: 4                                                                                                          
sizeof-size_t: 8                                                                                                        
shell-path: /bin/sh                                                                                                     
feature: fsmonitor--daemon
$ cmd.exe /c ver

Microsoft Windows [Version 10.0.20348.2340]
The following command as part of a Chocolatey install script.

Git-2.44.0-64-bit.exe /VERYSILENT /SUPPRESSMSGBOXES /ALLUSERS /NORESTART /SP- /DIR="C:\Program Files\Git" /COMPONENTS=*ext,gitlfs,assoc,assoc_sh,scalar /LOG="C:\Windows\TEMP\chocolatey\git.2.44.0.20240423.MsiInstall.log"

git.2.44.0.20240423.MsiInstall.log

PS > Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" -Name "Local AppData"
Get-ItemProperty: Property Local AppData does not exist 

The machine is an AWS EC2 instance. The user is the default admin user. All tests that the user is in admin mode returned true.

I looked through https://github.com/git-for-windows/build-extra to try to find a reason this could be happening and one set of paths ( 1 2 3 ) I found that looked like they might be trying to access the localappdata constant were for the windowsterminal component, so I made sure I was not selecting that component; those code paths also were only looking at localappdata when not in admin install mode so I double checked that my terminal was in admin mode. Another section looks to be only call as part of after install cleanup that the log indicates the process never reached.

Details

PowerShell

Git-2.44.0-64-bit.exe /VERYSILENT /SUPPRESSMSGBOXES /ALLUSERS /NORESTART /SP- /DIR="C:\Program Files\Git" /COMPONENTS=*ext,gitlfs,assoc,assoc_sh,scalar /LOG="C:\Windows\TEMP\chocolatey\git.2.44.0.20240423.MsiInstall.log"

Git installed.

Error message.

N/A

dscho commented 1 month ago

I could imagine that it is actually the DeleteFromVirtualStore() function that looks up the path of LocalAppData.

Having said that, I think that InnoSetup assumes that LocalAppData is always there, just like I did before this report came in. How can it be missing?

Walter-Gates-Bose commented 1 month ago

I believe the reason the HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders key is missing is related to the machine being an AWS EC2 instance with no users other than the default Administrator set up. The corresponding environment variable returns:

PS C:\Windows\system32> $env:LocalAppData
C:\Windows\system32\config\systemprofile\AppData\Local

I had to move on from this to continue my work priorities (I used the portable installer) however I will try to look into it a little more on my free time.

dscho commented 3 weeks ago

Seems like the warning shown in the log is produced by this code, and the error by this code.

I guess the best course of action would be to report this issue in the InnoSetup forum and hopefully they have a clear idea how to fix it.

dscho commented 2 weeks ago

I'll close this ticket because it is now clear that this is an InnoSetup bug, not a Git for Windows bug, and needs to be addressed there instead.