Skip to content

Commit 46aae81

Browse files
committed
Fix installer deleting nsclient.ini on upgrade
The PurgeConfig component carried a `<RemoveFile Name="*.ini" On="uninstall"/>` rule whose glob also matches the user's nsclient.ini. Because RemoveFile entries are name-based and bypass MSI component reference counting, that rule deletes nsclient.ini whenever the component is removed - including when RemoveExistingProducts uninstalls the previous version during a major upgrade. With RemoveExistingProducts scheduled After InstallExecute (late), this fires after BackupConfig / ExecWriteConfig have already restored the configuration, so the just-restored nsclient.ini is deleted and NeverOverwrite on the config component prevents a fresh copy from being laid down. The `NOT OLDERVERSIONBEINGUPGRADED` guard on the component does not help: a component whose <Condition> evaluates false is set to absent, and an On="uninstall" RemoveFile fires exactly when the component goes absent - so gating the purge off during upgrade actually triggers it. There is no purely declarative way for an On="uninstall" RemoveFile to distinguish a real uninstall from the upgrade-time removal of the old product, and NSClient++ already goes to some length (BackupConfig / ExecWriteConfig) to preserve configuration across upgrades. Removing the component keeps nsclient.ini intact on upgrade. If purge-on-real-uninstall is wanted later it should be a deferred custom action gated on REMOVE="ALL" AND NOT UPGRADINGPRODUCTCODE. Signed-off-by: Michael Medin <michael@medin.name>
1 parent aeeccfa commit 46aae81

1 file changed

Lines changed: 0 additions & 7 deletions

File tree

installers/installer-NSCP/Product.wxs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,6 @@
7070
</File>
7171
<Condition>USER_WRITABLE_CONFIG AND NOT ALLOW_CONFIGURATION="0"</Condition>
7272
</Component>
73-
<Component Id="PurgeConfig" Guid="E5A2F1C3-9B84-4D67-A1E0-3C7F28D59B12" Win64="$(var.Win64)">
74-
<RegistryValue Root="HKCU" Key="Software\NSClient++\Installer" Name="purge config" Type="integer" Value="1" KeyPath="yes"/>
75-
<RemoveFile Id="PurgeConfigFiles" Name="*.ini" On="uninstall" />
76-
<Condition>NOT ALLOW_CONFIGURATION="0" AND NOT OLDERVERSIONBEINGUPGRADED</Condition>
77-
</Component>
78-
7973
<Component Id="RandomFiles" Guid="E23865C3-C11F-4d11-BE63-C670D60B0CD0" Win64="$(var.Win64)">
8074
<File Id="License" Name="license.txt" DiskId="1" Source="$(var.Source)/license.txt" Vital="no" KeyPath="yes" />
8175
<File Id="settingsMap" Name="old-settings.map" DiskId="1" Source="$(var.Source)/old-settings.map" Vital="no" />
@@ -216,7 +210,6 @@
216210

217211
<ComponentRef Id="NSClientConfig" />
218212
<ComponentRef Id="NSClientConfigUser" />
219-
<ComponentRef Id="PurgeConfig" />
220213

221214
<?if "$(var.Runtime)" = "dynamic"?>
222215
<MergeRef Id="VCRedist110"/>

0 commit comments

Comments
 (0)