[ 
https://issues.apache.org/jira/browse/FELIX-6509?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17502195#comment-17502195
 ] 

Grzegorz Grzybek commented on FELIX-6509:
-----------------------------------------

Hmm, true - breakpoint hits this line in {{CommandSessionImpl}}:
{code:java}
return Arrays.toString((char[]) target);
{code}

but the char array already contains {{M y T e s t \r}} chars. However the 
trimming happens a bit earlier - in 
{{org.apache.felix.gogo.runtime.Closure#eval(org.apache.felix.gogo.runtime.Token,
 boolean)}} and if only it was trimmed correctly, {{Arrays.toString((char[]) 
target)}} would print without {{\r}}.

> Evaluation of subshell String results are wrong on Windows
> ----------------------------------------------------------
>
>                 Key: FELIX-6509
>                 URL: https://issues.apache.org/jira/browse/FELIX-6509
>             Project: Felix
>          Issue Type: Bug
>          Components: Gogo Runtime
>            Reporter: Grzegorz Grzybek
>            Assignee: Guillaume Nodet
>            Priority: Major
>
> I'm trying this use case (gogo-runtime 1.1.4):
> {noformat}
> karaf@root()> "MyTest" toCharArray
> [M, y, T, e, s, t]
> {noformat}
> and it's fine. However, trying this:
> {noformat}
> karaf@root()> config:property-set -p test test "MyTest"
> karaf@root()> config:property-get -p test test
> MyTest
> karaf@root()> ((config:property-get -p test test)) toCharArray
> ]M, y, T, e, s, t,
> {noformat}
> produces weird result. Actually understandable - the {{\r}} is not trimmed 
> from the result, so it moves cursor to the beginning of the line, and {{]}} 
> overwrites initial {{[}}.
> the reason [is this 
> loop|https://github.com/apache/felix-dev/blob/org.apache.felix.gogo.runtime-1.1.4/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/Closure.java#L388-L390]:
> {code:java}
> String s = baos.toString();
> while (!s.isEmpty() && s.charAt(s.length() - 1) == '\n') {
>     s = s.substring(0, s.length() - 1);
> }
> {code}
> it isn't OS aware. {{\r}} should also be removed (probably affects Mac too).



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to