This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new 4ff8202ab225 chore: fix JBang 0.138+ wrapper script -D property
serialization bug
4ff8202ab225 is described below
commit 4ff8202ab22537fd1f6ca6e2d937c6aa1fc2c205
Author: Claus Ibsen <[email protected]>
AuthorDate: Fri Jun 26 17:18:27 2026 +0200
chore: fix JBang 0.138+ wrapper script -D property serialization bug
JBang 0.138+ generates app wrapper scripts with "-D key=value"
(space-separated) but then rejects that format at runtime. Patch
the wrapper script after installation to use "-Dkey=value" (no space)
in both the local process service and the Docker container.
Co-Authored-By: Claude <[email protected]>
Signed-off-by: Claus Ibsen <[email protected]>
---
.../infra/cli/services/CliLocalProcessService.java | 20 ++++++++++++++++++++
.../apache/camel/test/infra/cli/services/Dockerfile | 3 +++
2 files changed, 23 insertions(+)
diff --git
a/test-infra/camel-test-infra-cli/src/main/java/org/apache/camel/test/infra/cli/services/CliLocalProcessService.java
b/test-infra/camel-test-infra-cli/src/main/java/org/apache/camel/test/infra/cli/services/CliLocalProcessService.java
index 3afce9201274..7778006dbab5 100644
---
a/test-infra/camel-test-infra-cli/src/main/java/org/apache/camel/test/infra/cli/services/CliLocalProcessService.java
+++
b/test-infra/camel-test-infra-cli/src/main/java/org/apache/camel/test/infra/cli/services/CliLocalProcessService.java
@@ -118,6 +118,7 @@ public class CliLocalProcessService implements CliService {
"jbang app install --force --fresh
-Dcamel.jbang.version=%s camel@%s/%s", jbangVersion, repo, branch);
}
executeGenericCommand(installCmd);
+ fixJBangAppScript();
}
if (ObjectHelper.isNotEmpty(forceToRunVersion)) {
@@ -376,6 +377,25 @@ public class CliLocalProcessService implements CliService {
}
}
+ private void fixJBangAppScript() {
+ // JBang 0.138+ has a bug: "jbang app install -Dkey=value" generates
wrapper scripts
+ // with "-D key=value" (space-separated), but "jbang run" rejects that
format.
+ // Patch the wrapper script to use "-Dkey=value" (no space).
+ String cmd = getMainCommand();
+ Path script = Path.of(System.getProperty("user.home"), ".jbang",
"bin", cmd);
+ try {
+ if (Files.exists(script)) {
+ String content = Files.readString(script);
+ if (content.contains(" -D ")) {
+ Files.writeString(script, content.replace(" -D ", " -D"));
+ LOG.info("Patched JBang app script to fix -D property
serialization");
+ }
+ }
+ } catch (IOException e) {
+ LOG.warn("Failed to patch JBang app script: {}", e.getMessage());
+ }
+ }
+
private boolean isJBangInstalled() {
try {
String jbangBin = Path.of(System.getProperty("user.home"),
".jbang", "bin").toString();
diff --git
a/test-infra/camel-test-infra-cli/src/main/resources/org/apache/camel/test/infra/cli/services/Dockerfile
b/test-infra/camel-test-infra-cli/src/main/resources/org/apache/camel/test/infra/cli/services/Dockerfile
index 7fe89a9d5816..8d81b4faf7ab 100644
---
a/test-infra/camel-test-infra-cli/src/main/resources/org/apache/camel/test/infra/cli/services/Dockerfile
+++
b/test-infra/camel-test-infra-cli/src/main/resources/org/apache/camel/test/infra/cli/services/Dockerfile
@@ -64,6 +64,9 @@ RUN source ~/.bashrc \
-Dcamel.jbang.version=$CAMEL_JBANG_VERSION \
camel@$CAMEL_REPO/$CAMEL_REF ; fi
+# Fix JBang 0.138+ bug: wrapper scripts serialize -D with a space that breaks
parsing
+RUN if [ -f ~/.jbang/bin/camel ]; then sed -i 's/ -D / -D/g'
~/.jbang/bin/camel; fi
+
LABEL "camel.ref"=$CAMEL_REF
LABEL "keep.container.running"=$KEEP_RUNNING