davsclaus commented on code in PR #29805:
URL: https://github.com/apache/camel/pull/29805#discussion_r4568941270


##########
dsl/camel-jbang/camel-launcher/src/main/resources/bin/camel.bat:
##########
@@ -83,7 +83,18 @@ if "!_CDS_REST!"=="." set "_CDS_CMD=!_CDS_ARG!"
 :cdsCommandDone
 for %%j in ("!LAUNCHER_JAR!") do set "_CDS_VERSION=%%~nj"
 set "_CDS_VERSION=!_CDS_VERSION:camel-launcher-=!"
-set "_CDS_DIR=!LOCALAPPDATA!\camel-cli\cds\!_CDS_VERSION!"
+@REM Include a hash of the install directory so two installs of the same 
version get separate archives.
+@REM Different install methods (SDKMAN, zip) place the launcher in different 
directories;
+@REM a shared archive from another install points at the wrong JAR or returns 
wrong install metadata.
+@REM Pass BASEDIR via environment to avoid trailing-backslash breaking 
PowerShell string quoting.
+set "_CDS_INSTALL_HASH="
+set "_CDS_PS_INPUT=!BASEDIR!"
+set "_CDS_PS_EXE=%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe"
+if exist "!_CDS_PS_EXE!" (
+  for /f "delims=" %%h in ('"!_CDS_PS_EXE!" -NoProfile -NonInteractive 
-Command 
"$b=[System.Text.Encoding]::UTF8.GetBytes($env:_CDS_PS_INPUT);$h=[System.Security.Cryptography.SHA256]::Create().ComputeHash($b);($h[0..3]|ForEach-Object{$_.ToString(\"x2\")})
 -join \"\"" 2^>nul') do set "_CDS_INSTALL_HASH=%%h"

Review Comment:
   Confirmed by CI. On c5bf4635 the Windows validator (run 43510977326) fails 
`CamelBatDiscoveryTest.usesAClassDataSharingArchivePerCommand`, 
`removesAnEmptyArchive` and `usesTheArchiveOfCamelWithoutACommand` with 
"expected: <true> but was: <false>". That fits cmd stripping the quotes, so the 
hash falls back to `default`. 59de47dd had the unquoted form, but its run was 
cancelled when c5bf4635 was pushed, so it was never tested. Going back to the 
unquoted `!_CDS_PS_EXE!`, as suggested above, should make the validator green.
   
   _Claude Code on behalf of davsclaus_
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to