[PR #52] [MERGED] Fix Windows uninstaller deleting entire System PATH instead of OLM entry #50

Closed
opened 2025-11-19 07:05:05 -06:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/fosrl/olm/pull/52
Author: @Copilot
Created: 11/11/2025
Status: Merged
Merged: 11/14/2025
Merged by: @oschwartz10612

Base: mainHead: copilot/fix-system-path-removal


📝 Commits (3)

  • d910034 Initial plan
  • 1168f55 Fix Windows PATH removal issue by implementing custom uninstall procedure
  • 91f0230 Refactor PATH removal to use TStringList for more robust parsing

📊 Changes

1 file changed (+67 additions, -3 deletions)

View changed files

📝 olm.iss (+67 -3)

📄 Description

Uninstalling OLM on Windows 11 removes the entire System PATH variable, breaking system commands like ping and route. The Inno Setup uninsdeletevalue flag deletes the entire registry value rather than removing a specific entry from the semicolon-delimited list.

Changes

  • Removed uninsdeletevalue flag from Registry section to prevent PATH deletion
  • Added RemovePathEntry() procedure that:
    • Parses PATH using TStringList with semicolon delimiter
    • Performs case-insensitive search using CompareText with trimming
    • Removes only matching OLM entry, preserves all other paths
    • Writes reconstructed PATH back to registry
  • Added CurUninstallStepChanged() hook to invoke removal during uninstall

Example

Before (user reported):

# Before uninstall
PS> [System.Environment]::GetEnvironmentVariable('PATH', 'Machine')
C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;...;C:\Program Files\olm

# After uninstall - entire PATH deleted!
PS> [System.Environment]::GetEnvironmentVariable('PATH', 'Machine')
;C:\Program Files\olm

After this fix:

procedure RemovePathEntry(PathToRemove: string);
var
  PathList: TStringList;
begin
  PathList := TStringList.Create;
  try
    PathList.Delimiter := ';';
    PathList.DelimitedText := OrigPath;
    
    for I := PathList.Count - 1 downto 0 do
      if CompareText(Trim(PathList[I]), Trim(PathToRemove)) = 0 then
        PathList.Delete(I);
    
    // Write back only the modified PATH
    RegWriteExpandStringValue(HKLM, ..., PathList.DelimitedText);
  finally
    PathList.Free;
  end;
end;
Original prompt

This section details on the original issue you should resolve

<issue_title>OLM removes System PATH variable on Windows11</issue_title>
<issue_description>### Describe the Bug

When the Program is uninstalled, it removes the whole SYSTEM PATH variable, not only the entry for OLM on Windows11

Healthy System PATH var:

Image

after uninstall and reinstall 😄

Image

Noticed because I wanted to check tunnel status, after uninstalling 0.8 and reinstalling 1.0, with route and ping but got this in return.

Image

Environment

  • OS Type & Version: Win11 24H2 26100
  • Olm Version: (if applicable): 0.8 - 1.0

  • Pangolin Version: N/A
  • Gerbil Version: N/A
  • Traefik Version: N/A
  • Newt Version: N/A

To Reproduce

Uninstall OLM and check Path with powershell or GUI

[System.Environment]::GetEnvironmentVariable('PATH', 'Machine')

Expected Behavior

Just remove the Entry for OLM from System path.</issue_description>

Comments on the Issue (you are @copilot in this section)

@oschwartz10612 Could you confirm if this still is an issue with the latest version? @oschwartz10612 I think this has to do with the PATH code in https://github.com/fosrl/olm/blob/main/olm.iss

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/fosrl/olm/pull/52 **Author:** [@Copilot](https://github.com/apps/copilot-swe-agent) **Created:** 11/11/2025 **Status:** ✅ Merged **Merged:** 11/14/2025 **Merged by:** [@oschwartz10612](https://github.com/oschwartz10612) **Base:** `main` ← **Head:** `copilot/fix-system-path-removal` --- ### 📝 Commits (3) - [`d910034`](https://github.com/fosrl/olm/commit/d910034ea1889096ee95094600bdc1e6c0c1d9a5) Initial plan - [`1168f55`](https://github.com/fosrl/olm/commit/1168f5541cada58c40b2770e7b8213e51377e542) Fix Windows PATH removal issue by implementing custom uninstall procedure - [`91f0230`](https://github.com/fosrl/olm/commit/91f0230d21e7d52e2f98059cf1cfaa4c40d130ed) Refactor PATH removal to use TStringList for more robust parsing ### 📊 Changes **1 file changed** (+67 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `olm.iss` (+67 -3) </details> ### 📄 Description Uninstalling OLM on Windows 11 removes the entire System PATH variable, breaking system commands like `ping` and `route`. The Inno Setup `uninsdeletevalue` flag deletes the entire registry value rather than removing a specific entry from the semicolon-delimited list. ## Changes - **Removed `uninsdeletevalue` flag** from Registry section to prevent PATH deletion - **Added `RemovePathEntry()` procedure** that: - Parses PATH using `TStringList` with semicolon delimiter - Performs case-insensitive search using `CompareText` with trimming - Removes only matching OLM entry, preserves all other paths - Writes reconstructed PATH back to registry - **Added `CurUninstallStepChanged()` hook** to invoke removal during uninstall ## Example Before (user reported): ```powershell # Before uninstall PS> [System.Environment]::GetEnvironmentVariable('PATH', 'Machine') C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;...;C:\Program Files\olm # After uninstall - entire PATH deleted! PS> [System.Environment]::GetEnvironmentVariable('PATH', 'Machine') ;C:\Program Files\olm ``` After this fix: ```pascal procedure RemovePathEntry(PathToRemove: string); var PathList: TStringList; begin PathList := TStringList.Create; try PathList.Delimiter := ';'; PathList.DelimitedText := OrigPath; for I := PathList.Count - 1 downto 0 do if CompareText(Trim(PathList[I]), Trim(PathToRemove)) = 0 then PathList.Delete(I); // Write back only the modified PATH RegWriteExpandStringValue(HKLM, ..., PathList.DelimitedText); finally PathList.Free; end; end; ``` <!-- START COPILOT CODING AGENT SUFFIX --> <details> <summary>Original prompt</summary> > > ---- > > *This section details on the original issue you should resolve* > > <issue_title>OLM removes System PATH variable on Windows11</issue_title> > <issue_description>### Describe the Bug > > When the Program is uninstalled, it removes the whole SYSTEM PATH variable, not only the entry for OLM on Windows11 > > Healthy System PATH var: > > <img width="1464" height="174" alt="Image" src="https://github.com/user-attachments/assets/0ad20d4a-99ad-41b9-85ad-b0b2f45490fb" /> > > after uninstall and reinstall 😄 > > <img width="795" height="215" alt="Image" src="https://github.com/user-attachments/assets/cf49380f-0781-425b-b34c-9e772bc0ab3f" /> > > > Noticed because I wanted to check tunnel status, after uninstalling 0.8 and reinstalling 1.0, with `route` and `ping` but got this in return. > > <img width="1233" height="252" alt="Image" src="https://github.com/user-attachments/assets/937596f3-a214-4c92-a354-a404ef509c40" /> > > ### Environment > > - OS Type & Version: Win11 24H2 26100 > - Olm Version: (if applicable): 0.8 - 1.0 > > ---- > > - Pangolin Version: N/A > - Gerbil Version: N/A > - Traefik Version: N/A > - Newt Version: N/A > > > ### To Reproduce > > Uninstall OLM and check Path with powershell or GUI > > `[System.Environment]::GetEnvironmentVariable('PATH', 'Machine') ` > > ### Expected Behavior > > Just remove the Entry for OLM from System path.</issue_description> > > ## Comments on the Issue (you are @copilot in this section) > > <comments> > <comment_new><author>@oschwartz10612</author><body> > Could you confirm if this still is an issue with the latest version?</body></comment_new> > <comment_new><author>@oschwartz10612</author><body> > I think this has to do with the PATH code in https://github.com/fosrl/olm/blob/main/olm.iss</body></comment_new> > </comments> > </details> - Fixes fosrl/olm#50 <!-- START COPILOT CODING AGENT TIPS --> --- 💬 We'd love your input! Share your thoughts on Copilot coding agent in our [2 minute survey](https://gh.io/copilot-coding-agent-survey). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2025-11-19 07:05:05 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/olm#50