From 727c918f671620d5beb59da0cf7110a0b77b1e48 Mon Sep 17 00:00:00 2001 From: Daniel Heule Date: Thu, 27 Feb 2014 17:04:23 +0100 Subject: [PATCH] work around a bug in bash3, now tested with dash, bash, busybox --- cdist/conf/type/__key_value/gencode-remote | 25 ++++++++++------------ 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/cdist/conf/type/__key_value/gencode-remote b/cdist/conf/type/__key_value/gencode-remote index 1e1d7c92..62cc745d 100755 --- a/cdist/conf/type/__key_value/gencode-remote +++ b/cdist/conf/type/__key_value/gencode-remote @@ -80,30 +80,27 @@ case "$state_should" in esac cat <<__CDIST_HEREDOC_END_HERE_MARKER -export state="\$(cat <<"__CDIST_INPUT_END_HERE_MARKER" +IFS='\n' read -r state <<'__CDIST_INPUT_END_HERE_MARKER' $state_should __CDIST_INPUT_END_HERE_MARKER -)" -export key="\$(cat <<"__CDIST_INPUT_END_HERE_MARKER" +export state +IFS='\n' read -r key <<'__CDIST_INPUT_END_HERE_MARKER' $key __CDIST_INPUT_END_HERE_MARKER -)" -export value="\$(cat <<"__CDIST_INPUT_END_HERE_MARKER" +export key +IFS='\n' read -r value <<'__CDIST_INPUT_END_HERE_MARKER' $(cat "$__object/parameter/value") __CDIST_INPUT_END_HERE_MARKER -)" -export delimiter="\$(cat <<"__CDIST_INPUT_END_HERE_MARKER" +export value +IFS='\n' read -r delimiter <<'__CDIST_INPUT_END_HERE_MARKER' $(cat "$__object/parameter/delimiter") __CDIST_INPUT_END_HERE_MARKER -)" -export exact_delimiter="\$(cat <<"__CDIST_INPUT_END_HERE_MARKER" -$exact_delimiter -__CDIST_INPUT_END_HERE_MARKER -)" -export comment="\$(cat <<"__CDIST_INPUT_END_HERE_MARKER" +export delimiter +IFS='\n' read -r comment <<'__CDIST_INPUT_END_HERE_MARKER' $(cat "$__object/parameter/comment") __CDIST_INPUT_END_HERE_MARKER -)" +export comment +export exact_delimiter="$exact_delimiter" tmpfile=\$(mktemp "${file}.cdist.XXXXXXXXXX") # preserve ownership and permissions by copying existing file over tmpfile