Merge branch 'hotfix/stat-explorer' into 'master'

Hotfix:  Fix incorrect interpretation of --mode strings with leading 0s as octal

See merge request ungleich-public/cdist!911
This commit is contained in:
poljakowski 2020-07-23 10:59:18 +02:00
commit 5d0f6caef7
2 changed files with 6 additions and 2 deletions

View File

@ -99,7 +99,9 @@ case "$state_should" in
# format mode in four digits => same as stat returns
if [ "$attribute" = mode ]; then
value_should=$(printf '%04u' "${value_should}")
# Convert to four-digit octal number (printf interprets
# strings with leading 0s as octal!)
value_should=$(printf '%04o' "0${value_should}")
fi
if [ "$set_attributes" = 1 ] || [ "$value_should" != "$value_is" ]; then

View File

@ -70,7 +70,9 @@ case "$state_should" in
# format mode in four digits => same as stat returns
if [ "$attribute" = mode ]; then
value_should=$(printf '%04u' "${value_should}")
# Convert to four-digit octal number (printf interprets
# strings with leading 0s as octal!)
value_should=$(printf '%04o' "0${value_should}")
fi
value_is="$(get_current_value "$attribute" "$value_should")"