Skip to content

Executables do not include FileVersion #4090

Closed
@Mortein

Description

@Mortein
  • 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.38.1.windows.1
cpu: x86_64
built from commit: b85c8f604d375d4d773a36842964e8a7ec056aae
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?
$ cmd.exe /c ver

Microsoft Windows [Version 10.0.14393]

It's Windows Server 2016.

  • What options did you set as part of the installation? Or did you choose the
    defaults?
> type "C:\Program Files\Git\etc\install-options.txt"

Editor Option: VIM
Custom Editor Path:
Default Branch Option:
Path Option: Cmd
SSH Option: OpenSSH
Tortoise Option: false
CURL Option: OpenSSL
CRLF Option: CRLFAlways
Bash Terminal Option: MinTTY
Git Pull Behavior Option: Merge
Use Credential Manager: Disabled
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?

No.

Details

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

Bash on WSL, using Ansible 2.9's ansible-playbook command.

Variables in use:

---
git_package_version: "2.38.1"

Ansible task to install/update Git on a Windows system:

---
- name: "Install Git {{ git_package_version }} on Windows"
  win_package:
    path: "https://github.com/git-for-windows/git/releases/download/v{{ git_package_version }}.windows.1/Git-{{ git_package_version }}-64-bit.exe"
    arguments:
    - /SP-
    - /VERYSILENT
    - /NOCANCEL
    - /NORESTART
    - /CLOSEAPPLICATIONS
    - /RESTARTAPPLICATIONS
    creates_path: C:\Program Files\Git\bin\git.exe
    creates_version: "{{ git_package_version }}.1"
  become: true

Use Ansible to install Git on computer:

ansible-playbook -i hosts.ini development.yaml

Use Ansible a second time to update Git on computer:

ansible-playbook -i hosts.ini development.yaml
  • What did you expect to occur after running these commands?

Ansible would install Git for the first run.

Ansible would not install Git for subsequent runs, as the installed file version, in this case 2.38.1.1 (which includes the build number), should match creates_version (the file version that will be installed by the win_package task).

  • What actually happened instead?

Ansible installed Git for the first run.

Ansible reinstalled Git for the second run, and subsequent runs.

Testing

The Ansible 2.9 win_package module uses the following to compare the creates_version string and the file version of creates_path:

$existing_version = [System.Diagnostics.FileVersionInfo]::GetVersionInfo($creates_path).FileVersion
$version_matched = $creates_version -eq $existing_version
$metadata.installed = $version_matched

The actual version information of git.exe using PowerShell:

PS C:\> [System.Diagnostics.FileVersionInfo]::GetVersionInfo("C:\Program Files\Git\bin\git.exe") | Select-Object *

FileVersionRaw     : 2.38.1.1
ProductVersionRaw  : 2.38.1.1
Comments           :
CompanyName        :
FileBuildPart      : 1
FileDescription    :
FileMajorPart      : 2
FileMinorPart      : 38
FileName           : C:\Program Files\Git\bin\git.exe
FilePrivatePart    : 1
FileVersion        :
InternalName       :
IsDebug            : False
IsPatched          : False
IsPrivateBuild     : False
IsPreRelease       : False
IsSpecialBuild     : False
Language           : English (United States)
LegalCopyright     :
LegalTrademarks    :
OriginalFilename   :
PrivateBuild       :
ProductBuildPart   : 1
ProductMajorPart   : 2
ProductMinorPart   : 38
ProductName        :
ProductPrivatePart : 1
ProductVersion     :
SpecialBuild       :

As the FileVersion attribute is null, Git is always reinstalled. To confirm, I tested using an empty string for creates_version and Git was not reinstalled.

Later versions of Ansible use the individual fields for the parts of the version (FileMajorPart, FileMinorPart, FileBuildPart, and FilePrivatePart), but Ansible 2.9 is used by Ansible Tower and cannot be upgraded. It is also not possible to use a different file version attribute (such as FileVersionRaw) for comparison against creates_version.

Could FileVersion be populated on the executables? It would probably be a good idea to populate ProductVersion at the same time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Help Wantedhelp is requested from collaborators, please!Potential ProjectThis issue can be used as a development Project for those loooking for a nice challenge

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions