This is an automated email from the ASF dual-hosted git repository.
apupier pushed a commit to branch camel-4.18.x
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/camel-4.18.x by this push:
new cdf68bd668f3 CAMEL-23940 - fix JBang 0.138+ wrapper script -D property
serialization bug
cdf68bd668f3 is described below
commit cdf68bd668f3e81b8aa7d071a6003d98c20ccbc5
Author: Aurélien Pupier <[email protected]>
AuthorDate: Thu Jul 9 14:17:39 2026 +0200
CAMEL-23940 - fix JBang 0.138+ wrapper script -D property serialization
bug
this is a backport from
https://github.com/apache/camel/commit/4ff8202ab22537fd1f6ca6e2d937c6aa1fc2c205
(cannot be cherry-picked directly)
Signed-off-by: Aurélien Pupier <[email protected]>
---
.../cli/services/CliLocalContainerService.java | 23 +++++++++++++++++++++-
.../camel/test/infra/cli/services/Dockerfile | 3 +++
2 files changed, 25 insertions(+), 1 deletion(-)
diff --git
a/test-infra/camel-test-infra-cli/src/test/java/org/apache/camel/test/infra/cli/services/CliLocalContainerService.java
b/test-infra/camel-test-infra-cli/src/test/java/org/apache/camel/test/infra/cli/services/CliLocalContainerService.java
index 3f71c9958135..7fa52c20c0fe 100644
---
a/test-infra/camel-test-infra-cli/src/test/java/org/apache/camel/test/infra/cli/services/CliLocalContainerService.java
+++
b/test-infra/camel-test-infra-cli/src/test/java/org/apache/camel/test/infra/cli/services/CliLocalContainerService.java
@@ -17,6 +17,8 @@
package org.apache.camel.test.infra.cli.services;
import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
@@ -76,7 +78,7 @@ public class CliLocalContainerService implements CliService,
ContainerService<Cl
if (!container.isRunning()) {
LOG.info("Trying to start the {} container", CONTAINER_NAME);
container.start();
-
+ fixJBangAppScript();
registerProperties();
LOG.info("{} instance running", CONTAINER_NAME);
if (ObjectHelper.isNotEmpty(forceToRunVersion)) {
@@ -96,6 +98,25 @@ public class CliLocalContainerService implements CliService,
ContainerService<Cl
}
+ 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());
+ }
+ }
+
@Override
public void shutdown() {
if (container.isRunning()) {
diff --git
a/test-infra/camel-test-infra-cli/src/test/resources/org/apache/camel/test/infra/cli/services/Dockerfile
b/test-infra/camel-test-infra-cli/src/test/resources/org/apache/camel/test/infra/cli/services/Dockerfile
index 7fe89a9d5816..226836f1492b 100644
---
a/test-infra/camel-test-infra-cli/src/test/resources/org/apache/camel/test/infra/cli/services/Dockerfile
+++
b/test-infra/camel-test-infra-cli/src/test/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 - see https://github.com/jbangdev/jbang/issues/2555
+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