build: Remove lingering Windows registry & shortcuts (#32132 follow-up) #33422

pull hodlinator wants to merge 1 commits into bitcoin:master from hodlinator:2025/09/32132_follow_up changing 1 files +13 −0
  1. hodlinator commented at 7:57 am on September 18, 2025: contributor

    Problem

    Prior to fb2b05b1259d3e69e6e675adfa30b429424c7625 / #32132 we installed using paths with an extra " (64-bit)"-suffix. Installing a version including that commit on top of a version that does not results in 2 entries in the “Installed apps” list. Both of them end up running the same C:\Program Files\Bitcoin\uninstall.exe. However, only one of the entries is removed by the uninstaller. The left over registry entry will now point to an executable that no longer exists and fail to work.

    Removing the left over “Installed apps” entry on master currently requires the user to manually remove the Windows Registry entries (or run the correct old/new installer to ensure the uninstaller exists again).

    Solution

    This PR automates removal of old entries (& shortcuts) when installing the new version.

    Disclaimer

    Not an NSIS expert - confirmed that added deletion commands work without causing any visible errors both when prior items exist and when they don’t.

    Post-merge edit: Issue was initially reported by @hebasto in #32132 (comment)

  2. DrahtBot added the label Build system on Sep 18, 2025
  3. DrahtBot commented at 7:57 am on September 18, 2025: contributor

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Code Coverage & Benchmarks

    For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/33422.

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK hebasto, achow101

    If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

  4. hodlinator renamed this:
    build: Clean lingering Windows registry & shortcuts (#32132 follow-up)
    build: Remove lingering Windows registry & shortcuts (#32132 follow-up)
    on Sep 18, 2025
  5. achow101 added this to the milestone 30.0 on Sep 18, 2025
  6. hodlinator commented at 8:07 pm on September 18, 2025: contributor

    Parallel uninstall entries:

    Error when trying to uninstall the second entry after the first one has already been uninstalled:

  7. in share/setup.nsi.in:125 in 1a4ad0ae50 outdated
    119+    Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\Uninstall $(^Name) (64-bit).lnk"
    120+    Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\$(^Name) (64-bit).lnk"
    121+    DeleteRegValue HKCU "${REGKEY} (64-bit)" StartMenuGroup
    122+    DeleteRegValue HKCU "${REGKEY} (64-bit)" Path
    123+    DeleteRegKey /IfEmpty HKCU "${REGKEY} (64-bit)\Components"
    124+    DeleteRegKey /IfEmpty HKCU "${REGKEY} (64-bit)"
    


    hodlinator commented at 8:12 pm on September 18, 2025:
    Apart from the added (64-bit) suffix, these are copied from the uninstaller sections below, excluding items which would not originally have had the suffix.
  8. fanquake commented at 9:00 pm on September 18, 2025: member
  9. achow101 commented at 9:23 pm on September 18, 2025: member

    ACK 1a4ad0ae501d15f77b1601ace3e1a1c8bf440dd6

    Tested on Windows 11, and it appears to correctly remove the old (64-bit) uninstall entry.

  10. luke-jr referenced this in commit ba0bd1d3a9 on Sep 19, 2025
  11. hebasto commented at 12:50 pm on September 19, 2025: member

    Concept ACK. @hodlinator Thank you!

    Another alternative is to ask the user to uninstall any previous installation before installing a new one, but this is suboptimal.

  12. hebasto commented at 2:20 pm on September 19, 2025: member

    I suggest the following patch:

     0--- a/share/setup.nsi.in
     1+++ b/share/setup.nsi.in
     2@@ -118,10 +118,12 @@ Section -post SEC0001
     3     DeleteRegKey HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name) (64-bit)"
     4     Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\Uninstall $(^Name) (64-bit).lnk"
     5     Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\$(^Name) (64-bit).lnk"
     6+    Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\Bitcoin Core (testnet, 64-bit).lnk"
     7     DeleteRegValue HKCU "${REGKEY} (64-bit)" StartMenuGroup
     8     DeleteRegValue HKCU "${REGKEY} (64-bit)" Path
     9     DeleteRegKey /IfEmpty HKCU "${REGKEY} (64-bit)\Components"
    10     DeleteRegKey /IfEmpty HKCU "${REGKEY} (64-bit)"
    11+    RMDir /r /REBOOTOK $INSTDIR\doc
    12 SectionEnd
    13 
    14 # Macro for selecting uninstaller sections
    

    It additionally clears lingering artifacts from older versions and enables a clean uninstall on systems with a long upgrade history.

    See:

  13. build(windows): Remove lingering registry entries and shortcuts upon install
    Prior releases installed using these paths. Especially annoying was that the lingering registry entry for the uninstaller would show up as "Bitcoin Core (64-bit)" besides the current "Bitcoin Core" entry in the list of installed programs, and whichever was uninstalled last would fail to work as they would default to the same install directory.
    79752b9c0b
  14. hodlinator force-pushed on Sep 19, 2025
  15. hebasto commented at 2:50 pm on September 19, 2025: member
    What about RMDir /r /REBOOTOK $INSTDIR\doc part I mentioned in #33422#pullrequestreview-3245114592?
  16. hodlinator commented at 2:51 pm on September 19, 2025: contributor

    Another alternative is to ask the user to uninstall any previous installation before installing a new one, but this is suboptimal.

    Yup. I wish NSIS would keep exact track of previously installed files in the registry with checksums and allowed one to diff against the new files.

    I suggest the following patch: … It additionally clears lingering artifacts from older versions and enables a clean uninstall on systems with a long upgrade history.

    See:

    * [#25809](/bitcoin-bitcoin/25809/)
    
    * [#26334](/bitcoin-bitcoin/26334/)
    

    Aha, I have been wondering why we don’t provide at least some of the docs with the install (doc/reduce-memory.md comes to mind as appropriate for node operators). I’m worried users might modify/add files under docs so I skipped that part for now. (Considered adding it without /r to only delete empty directories but that felt quite pointless).

    Added comments for which commits the corresponding files where lingering from.

  17. hebasto approved
  18. hebasto commented at 2:53 pm on September 19, 2025: member
    ACK 79752b9c0b6bd9b2203ac98d28dd67734050c14a.
  19. DrahtBot requested review from achow101 on Sep 19, 2025
  20. achow101 commented at 8:50 pm on September 19, 2025: member
    ACK 79752b9c0b6bd9b2203ac98d28dd67734050c14a
  21. hebasto merged this on Sep 19, 2025
  22. hebasto closed this on Sep 19, 2025

  23. hebasto added the label Needs backport (30.x) on Sep 19, 2025
  24. fanquake referenced this in commit 57ebe3b132 on Sep 20, 2025
  25. fanquake commented at 9:08 am on September 20, 2025: member
    Backported to 30.x in #33424.
  26. fanquake removed the label Needs backport (30.x) on Sep 20, 2025

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2025-10-10 15:13 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me