karaf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jean-Baptiste Onofré (JIRA) <j...@apache.org>
Subject [jira] [Updated] (KARAF-4704) Unwanted variable interpolation in shell scripts
Date Mon, 12 Sep 2016 05:53:20 GMT

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

Jean-Baptiste Onofré updated KARAF-4704:
----------------------------------------
    Fix Version/s: 4.1.0

> 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: Jean-Baptiste Onofré
>              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)

Mime
View raw message