From 55216e0b0ac207d48b7c1b86430b3b788522a6c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20Br=C3=BCbach?= Date: Fri, 2 Oct 2026 02:40:12 +0200 Subject: [PATCH] [Installer] Give FindFirst the two arguments it takes FindFirst takes the pattern and the output variable and leaves the search handle in $0. There is no handle argument, and FindNext taking only a variable is the giveaway: the handle has to live somewhere implicit, and it is $0. The call passed three arguments, so makensis rejected the script and the CPack packaging step failed with "Problem running NSIS command" before ever reaching the required-runtime check. This was not only a compile error. The handle variable was never populated, so the stale-runtime check that commit 844a1a9b added could never see a match: it probed $StaleFindHandle, which stayed empty, and the widened wildcard scan over the purge set was a no-op. Pass the pattern, test $0, and close $0. No FindNext is needed, because $R0 is a yes/no flag rather than a list. Drops the now unused StaleFindHandle Var. --- cmake/NSIS.template.in | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/cmake/NSIS.template.in b/cmake/NSIS.template.in index b647072e0..b2b4cb535 100644 --- a/cmake/NSIS.template.in +++ b/cmake/NSIS.template.in @@ -15,7 +15,6 @@ Var ReinstallMode Var AllowForceClose Var GuardDir Var OldUninstallString -Var StaleFindHandle Var StaleFindName Var IsUpgrade Var AbortReason @@ -686,10 +685,16 @@ Function CheckStaleRuntimeMask ${If} $R0 = 1 Return ${EndIf} - FindFirst $StaleFindHandle $StaleFindName "$INSTDIR\$R3" - ${If} $StaleFindHandle != "" + ; FindFirst takes the pattern and the name variable only, and leaves the + ; search handle in $0 - there is no handle argument and no handle variable + ; to keep, which is why FindNext does not take one either. $R3 and $R0 are + ; untouched by it, so only $0 is consumed here. + ; One match is enough: $R0 is a yes/no flag, not a list, so there is no + ; FindNext and nothing to iterate. + FindFirst "$INSTDIR\$R3" $StaleFindName + ${If} $0 != "" StrCpy $R0 1 - FindClose $StaleFindHandle + FindClose $0 ${EndIf} FunctionEnd