You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@karaf.apache.org by "Jean-Baptiste Onofré (JIRA)" <ji...@apache.org> on 2018/02/19 06:00:00 UTC

[jira] [Commented] (KARAF-5613) Scripting Behaviour changed from Karaf 4.0.9 to 4.1.5

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

Jean-Baptiste Onofré commented on KARAF-5613:
---------------------------------------------

That's why it has been done in 4.1.x and not 4.0.x. Let me check if I can easily set this backward compatible. However, we can introduce this kind of small "breaking" change between two Karaf major release (4.2.x, 4.1.x, 4.0.x are three different Karaf series).

> Scripting Behaviour changed from Karaf 4.0.9 to 4.1.5
> -----------------------------------------------------
>
>                 Key: KARAF-5613
>                 URL: https://issues.apache.org/jira/browse/KARAF-5613
>             Project: Karaf
>          Issue Type: Bug
>          Components: karaf-shell
>    Affects Versions: 4.1.5
>            Reporter: Saikat Ghosh
>            Priority: Major
>              Labels: Scripting
>
> Scripting behavior has changed between Karaf v4.0.9 and v4.1.5
> *The following is a shell session for v4.0.10*
> {noformat}
>   Apache Karaf (4.0.10)
> Hit '<tab>' for a list of available commands
> and '[cmd] --help' for help on a specific command.
> Hit '<ctrl-d>' or type 'system:shutdown' or 'logout' to shutdown Karaf.
> karaf@root()> a1 = "This is a test"
> This is a test
> karaf@root()> a2 = $a1 split " "
> This
> is
> a
> test
> karaf@root()> $a2 2
> a
> karaf@root()> $a2 3
> test
> karaf@root()> each ($a2) {echo $it}
> This
> is
> a
> test
> karaf@root()> each ($a1 split " ") {echo $it}
> This
> is
> a
> test{noformat}
> *The following is a shell session for v4.1.5*
> {noformat}
> karaf@root()> a1 = "This is a test"
> This is a test
> karaf@root()> $a1
> This is a test
> karaf@root()> a2 = ($a1 split " ")
> karaf@root()> $a2 0
> This
> karaf@root()> $a2 1
> is
> karaf@root()> $a2 2
> a
> karaf@root()> each ($a1 split " ") {echo $it}
> usage: each elements { closure }
>        elements: an array to iterate on
>        closure: a function or closure to call
> karaf@root()> $a2
> karaf@root()> each ($a2) {echo $it}
> usage: each elements { closure }
>        elements: an array to iterate on
>        closure: a function or closure to call{noformat}
> In both versions the split creates an array - but the shell does not seem to be automatically coerce $a2 into an array for v4.1.5
> This is breaking several scripts currently.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)