ChocolateyPackages icon indicating copy to clipboard operation
ChocolateyPackages copied to clipboard

Fix incorrect Get-OSArchitectureWidth comparison

Open brogers5 opened this issue 2 years ago • 3 comments

This changeset resolves a subtle install script failure that is only apparent on 32-bit systems. I experienced the exact same issue with a few of my packages, and did a recursive search on my machine for other places this may have happened. As I've previously cloned your repository, a couple of your packages came up.

The gist of it is that Get-OSArchitectureWidth -eq 64 will effectively ignore the -eq 64 portion, since Get-OSArchitectureWidth is a function and does not recognize -eq as a valid parameter. PowerShell will return the numerical address width value (i.e. 32 or 64) instead of performing the intended bool comparison. As this will always return a non-zero value, it will trigger the behavior intended for 64-bit systems on 32-bit systems.

This can be fixed by either wrapping Get-OSArchitectureWidth -eq 64 in parentheses to enable a correct interpretation of the condition, or change -eq to the supported -Compare parameter to return a bool value instead. I opted for the -Compare approach, as this isn't dependent on what could otherwise come across as redundant parentheses.

I've bumped the version of both affected packages using package fix notation.

brogers5 avatar Jun 03 '22 01:06 brogers5

Thanks.

I think there's an update to the program. If you update the URL, checksum, and package version I'll pull it in.

bcurran3 avatar Jul 31 '22 04:07 bcurran3

I've rebased against master's current state, and updated both affected packages to the latest available version as requested. They were tested successfully against both 32-bit and 64-bit operating systems.

Some things I felt I should note:

  • Snappy Driver Installer

    • The author appears to have stopped publishing new versions on SourceForge. These are now being published on the project's website. Updating the download URL accordingly.
    • The archive's directory structure has changed and no longer uses a version-specific directory. I've modified the shortcut filepaths accordingly.
    • The author appears to have revoked public view permissions for this project's source code. Since the links are no longer valid, and I could not find suitable replacements, I've removed projectSourceUrl and licenseUrl (and by extension, requireLicenseAcceptance).
  • TeamSpeak Server

    • Interestingly, the 64-bit archive's checksum as published here appears to be incorrect.
      • Expected: 605af411794f10530657153d91a47e32664a2b365d528848a5fa7b0874ac7572
      • Actual: 489f6f02b336f80812ad0307897e072c37042d1c39341e4efbe7c09d1e100f59
    • TeamSpeak migrated to a new forum system located at https://community.teamspeak.com/, and made the old one read-only. I've updated mailingListUrl and bugTrackerUrl accordingly.

brogers5 avatar Jul 31 '22 21:07 brogers5

And some optional thoughts I had while going through these:

  • Snappy Driver Installer
    • Given the downloaded file's size, I'm assuming this package is intended for the "SDI Lite" edition as presented on the project website's download page. Perhaps we should update the package description to make this more clear.
    • Since this is licensed under GPLv3, it should be redistributable. Perhaps we should convert this into an embedded package.
    • Shims are being created for both binaries, regardless of architectural compatibility with the operating system. Perhaps we should create a shim ignore file for the 64-bit binary when installing on 32-bit operating systems or forcing x86 behavior, and remove any previous existing 64-bit shim that may exist during install.
    • The shortcut creation code does not appear to honor forcing x86 behavior. Perhaps we should further qualify the architecture check accordingly.
      • Alternatively, we could also create 32-bit shortcuts on 64-bit systems to make this consistent with the shim creation behavior.
    • Neither of the binaries appear to be designed for global execution. Perhaps we should add a package note reminding users to use --shimgen-usetargetworkingdirectory when running the application via the generated shim(s).
    • Perhaps we could include a chocolateyBeforeModify.ps1 script to ensure any running instances of SDI_*.exe are closed before upgrading/uninstalling.
  • TeamSpeak Server
    • Perhaps we could include a chocolateyBeforeModify.ps1 script to ensure both ts3server.exe and tsdnsserver.exe are closed before upgrading/uninstalling.
    • ts3server.exe should be a GUI shim. Perhaps we should create a .gui file to ensure a GUI shim is created with legacy Chocolatey versions.
    • ts3server.exe doesn't appear to be designed for global execution. Perhaps we should add a package note reminding users to use --shimgen-usetargetworkingdirectory when running this via the generated shim.

brogers5 avatar Jul 31 '22 21:07 brogers5

Coming back round to this...

RE: Snappy Driver Installer I remember there was some drama about this. A split between the devs and then two versions? I think one ver had a virus scare or was a virus? I also believe someone else created a Chocolatey package with the newer split version. I have no idea of the status of either now.

Assuming Snappy Driver is still around and kicking, I don't have an interest in maintaining it. I'd love to add you as a maintainer. Let me know your ChocolateyId if you accept.

RE: TeamSpeak Server I see the package is out of date. I don't use this and have no interest in it. I think it was late one night and I saw TeamSpeak Client was available on chocolatey.org and thought to myself that the server version should be too. I had more time back then... hahahaha

I'd love to pass maintainership of TeamSpeak Server to you as well. Let me know your ChocolateyId if you accept.

bcurran3 avatar May 08 '23 17:05 bcurran3

Unfortunately, I don't really use either of these, so I feel maintainership would be best assumed by someone else if you'd rather hand it off. Perhaps some RFMs are in order?

brogers5 avatar May 08 '23 22:05 brogers5

Closing this as I am no longer creating or maintaining Chocolatey packages. Sorry, out of my control.

Hopefully you've enjoyed my work and found it useful.

Bella Ciao!

bcurran3 avatar Jan 30 '24 21:01 bcurran3