You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@karaf.apache.org by "Guillaume Nodet (JIRA)" <ji...@apache.org> on 2016/10/20 21:12:58 UTC

[jira] [Resolved] (KARAF-4704) Unwanted variable interpolation in shell scripts

     [ https://issues.apache.org/jira/browse/KARAF-4704?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Guillaume Nodet resolved KARAF-4704.
------------------------------------
    Resolution: Fixed
      Assignee: Guillaume Nodet  (was: Jean-Baptiste Onofré)

> Unwanted variable interpolation in shell scripts
> ------------------------------------------------
>
>                 Key: KARAF-4704
>                 URL: https://issues.apache.org/jira/browse/KARAF-4704
>             Project: Karaf
>          Issue Type: Bug
>          Components: karaf-shell
>    Affects Versions: 4.1.0
>            Reporter: Jens Offenbach
>            Assignee: Guillaume Nodet
>              Labels: bash, shell-script
>             Fix For: 4.1.0
>
>
> There is a variable interpolation problem in the shell scripts "/bin/shell", "/bin/start", "/bin/client", ... of Karaf 4.1.0-SNAPSHOT. All affected files can be found here: https://github.com/apache/karaf/tree/master/assemblies/features/base/src/main/filtered-resources/resources/bin). 
> Because the shell scripts get filtered by Maven, the variable ${PWD} gets accidently replaced during the build process by "/home/jenkins/jenkins-slave". I am refering to the nightly builds available in the Apache Snapshot Repository: https://repository.apache.org/content/groups/snapshots-group/org/apache/karaf/apache-karaf/4.1.0-SNAPSHOT/
> IS:
> realpath() {
>   OURPWD=/home/jenkins/jenkins-slave
>   cd "$(dirname "${1}")"
>   LINK=$(readlink "$(basename "${1}")")
>   while [ "${LINK}" ]; do
>     cd "$(dirname "${LINK}")"
>     LINK=$(readlink "$(basename "${1}")")
>   done
>   REALPATH="/home/jenkins/jenkins-slave/$(basename "${1}")"
>   cd "${OURPWD}"
>   echo "${REALPATH}"
> }
> SHOULD:
> realpath() {
>   OURPWD=${PWD}
>   cd "$(dirname "${1}")"
>   LINK=$(readlink "$(basename "${1}")")
>   while [ "${LINK}" ]; do
>     cd "$(dirname "${LINK}")"
>     LINK=$(readlink "$(basename "${1}")")
>   done
>   REALPATH="${PWD}/$(basename "${1}")"
>   cd "${OURPWD}"
>   echo "${REALPATH}"
> }
> We can replace ${PWD} by \${PWD}, whereas "\" is the default escapeString. But we should find a solution that avoids unwanted interpolation at all. The best solution would be to define a custom delimiter for the Maven resource plugin which does not overlap with statements within the shell code.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)