diff options
author | Michael Olbrich <m.olbrich@pengutronix.de> | 2019-09-04 14:10:17 +0200 |
---|---|---|
committer | Michael Olbrich <m.olbrich@pengutronix.de> | 2019-09-04 14:39:07 +0200 |
commit | c20eaea9bc4c85b65389b1edb52f35b6676ea0ec (patch) | |
tree | 455146b95f659eb9d1a5d91963568811dd037cc4 | |
parent | 5994b77e7669ab8643fadd61e8a31080b80d2bf2 (diff) | |
download | ptxdist-c20eaea9bc4c85b65389b1edb52f35b6676ea0ec.tar.gz ptxdist-c20eaea9bc4c85b65389b1edb52f35b6676ea0ec.tar.xz |
ptxd_normalize_config: handle symlinks in the workspace path correctlyptxdist-2019.09.0
If the workspace path contains a symlink, which means
"${PTXDIST_LAYERS[0]}" != $(readlink -f "${PTXDIST_LAYERS[0]}")
and 'base' is a symlink to another subdirectory of the workspace, then
ptxd_normalize_config() returns the wrong result:
For example:
PTXDIST_WORKSPACE = /tmp/link/BSP
$(readlink -f $PTXDIST_WORKSPACE) = /tmp/real/BSP
$(readlink -f $PTXDIST_WORKSPACE/base) = /tmp/real/BSP/layer
file_dotconfig = /tmp/link/BSP/base/configs/ptxconfig
After the first loop iteration:
nomalized = /tmp/link/BSP/layer/configs/ptxconfig
For the next loop iteration the substitution fails because now $nomalized
contains a symlink. As a result, ptxd_normalize_config() returns the wrong
path.
Fix this by checking if the original resolved path is within each layer and
update $nomalized if that is the case. This way the path is normalized
correctly even if other layers patch as well.
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
-rw-r--r-- | scripts/lib/ptxd_lib_kconfig.sh | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/scripts/lib/ptxd_lib_kconfig.sh b/scripts/lib/ptxd_lib_kconfig.sh index 126ec766f..03c6b05b9 100644 --- a/scripts/lib/ptxd_lib_kconfig.sh +++ b/scripts/lib/ptxd_lib_kconfig.sh @@ -54,7 +54,10 @@ ptxd_normalize_config() { nomalized="$(readlink -f "${file_dotconfig}")" old="${nomalized}" for layer in "${PTXDIST_LAYERS[@]}"; do - nomalized="${nomalized/#$(readlink -f ${layer})\//${layer}/}" + local tmp="${old/#$(readlink -f ${layer})\//${layer}/}" + if [ "${tmp}" != "${old}" ]; then + nomalized="${tmp}" + fi done if [ "$(readlink -f "${nomalized}")" != "${old}" ]; then ptxd_bailout "Failed to normalize filename:" \ |