From 1cebd222943e5278a232542a0b916661f4f0433c Mon Sep 17 00:00:00 2001 From: Keith Turner Date: Wed, 3 Sep 2025 20:26:32 +0000 Subject: [PATCH 1/2] stop removing backslashes in shell fixes #3367 --- .../main/java/org/apache/accumulo/shell/Shell.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/shell/src/main/java/org/apache/accumulo/shell/Shell.java b/shell/src/main/java/org/apache/accumulo/shell/Shell.java index b8549712193..8ae4936f4c9 100644 --- a/shell/src/main/java/org/apache/accumulo/shell/Shell.java +++ b/shell/src/main/java/org/apache/accumulo/shell/Shell.java @@ -310,7 +310,8 @@ public boolean config(String... args) throws IOException { TerminalBuilder.builder().jansi(false).systemOutput(SystemOutput.SysOut).build(); } if (this.reader == null) { - this.reader = LineReaderBuilder.builder().terminal(this.terminal).build(); + this.reader = + LineReaderBuilder.builder().parser(new NonEscapeParser()).terminal(this.terminal).build(); } this.writer = this.terminal.writer(); @@ -557,8 +558,16 @@ public void execute(final String[] args) throws IOException { } } + public static class NonEscapeParser extends org.jline.reader.impl.DefaultParser { + @Override + public boolean isEscapeChar(char ch) { + // Don't treat backslash as an escape character + return false; + } + } + public static void main(String[] args) throws IOException { - LineReader reader = LineReaderBuilder.builder().build(); + LineReader reader = LineReaderBuilder.builder().parser(new NonEscapeParser()).build(); new Shell(reader).execute(args); } From 82900a957faf84a053dd377f7e7e6fef52dc0207 Mon Sep 17 00:00:00 2001 From: Keith Turner Date: Thu, 4 Sep 2025 21:06:31 +0000 Subject: [PATCH 2/2] work around jline bug --- .../java/org/apache/accumulo/shell/Shell.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/shell/src/main/java/org/apache/accumulo/shell/Shell.java b/shell/src/main/java/org/apache/accumulo/shell/Shell.java index 8ae4936f4c9..cc214efe23d 100644 --- a/shell/src/main/java/org/apache/accumulo/shell/Shell.java +++ b/shell/src/main/java/org/apache/accumulo/shell/Shell.java @@ -310,8 +310,7 @@ public boolean config(String... args) throws IOException { TerminalBuilder.builder().jansi(false).systemOutput(SystemOutput.SysOut).build(); } if (this.reader == null) { - this.reader = - LineReaderBuilder.builder().parser(new NonEscapeParser()).terminal(this.terminal).build(); + this.reader = newLineReaderBuilder().terminal(this.terminal).build(); } this.writer = this.terminal.writer(); @@ -558,16 +557,17 @@ public void execute(final String[] args) throws IOException { } } - public static class NonEscapeParser extends org.jline.reader.impl.DefaultParser { - @Override - public boolean isEscapeChar(char ch) { - // Don't treat backslash as an escape character - return false; + private static LineReaderBuilder newLineReaderBuilder() { + var builder = LineReaderBuilder.builder(); + // workaround for https://github.com/jline/jline3/pull/1413 + if ("on".equals(System.getProperty("org.jline.reader.props.disable-event-expansion"))) { + builder.option(LineReader.Option.DISABLE_EVENT_EXPANSION, true); } + return builder; } public static void main(String[] args) throws IOException { - LineReader reader = LineReaderBuilder.builder().parser(new NonEscapeParser()).build(); + LineReader reader = newLineReaderBuilder().build(); new Shell(reader).execute(args); }