forked from ungleich-public/cdist
[type/{__file,__directory}] Fix incorrect interpretation of strings with leading 0s as octal
This commit is contained in:
parent
8903540e91
commit
595e43b8d5
2 changed files with 6 additions and 2 deletions
|
@ -99,7 +99,9 @@ case "$state_should" in
|
||||||
|
|
||||||
# format mode in four digits => same as stat returns
|
# format mode in four digits => same as stat returns
|
||||||
if [ "$attribute" = mode ]; then
|
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
|
fi
|
||||||
|
|
||||||
if [ "$set_attributes" = 1 ] || [ "$value_should" != "$value_is" ]; then
|
if [ "$set_attributes" = 1 ] || [ "$value_should" != "$value_is" ]; then
|
||||||
|
|
|
@ -70,7 +70,9 @@ case "$state_should" in
|
||||||
|
|
||||||
# format mode in four digits => same as stat returns
|
# format mode in four digits => same as stat returns
|
||||||
if [ "$attribute" = mode ]; then
|
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
|
fi
|
||||||
|
|
||||||
value_is="$(get_current_value "$attribute" "$value_should")"
|
value_is="$(get_current_value "$attribute" "$value_should")"
|
||||||
|
|
Loading…
Reference in a new issue