You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@karaf.apache.org by "Jens Offenbach (JIRA)" <ji...@apache.org> on 2016/09/09 15:46:20 UTC
[jira] [Created] (KARAF-4704) Unwanted variable interpolation in
shell scripts
Jens Offenbach created KARAF-4704:
-------------------------------------
Summary: 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
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)