From c187552372975c74cc6286af3a18223e3c0e323c Mon Sep 17 00:00:00 2001 From: David Gardner Date: Wed, 23 Jan 2019 17:20:50 +0000 Subject: [PATCH 1/3] Use IFS to cope with spaces in paths, by splitting on newline. --- templates/30.erb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/templates/30.erb b/templates/30.erb index a14c58a..18a8015 100644 --- a/templates/30.erb +++ b/templates/30.erb @@ -1,7 +1,9 @@ # Apply the ACLs. Any existing ACLs will be replaced DIRSORTED="$(for DIR in "${!ACLOPTS[@]}"; do echo $DIR; done | sort)" +IFS=$'\n' for DIR in ${DIRSORTED}; do setfacl ${ACLOPTS_GLOBAL} ${ACLOPTS[${DIR}]} ${DIR} done +unset IFS From 59ebb7e8264be7ec2b0deb26ae5a7a5a73814e91 Mon Sep 17 00:00:00 2001 From: David Gardner Date: Wed, 23 Jan 2019 17:36:26 +0000 Subject: [PATCH 2/3] Use while read loop instead of IFS setting, as the latter affects quoting of the other variables... --- templates/30.erb | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/templates/30.erb b/templates/30.erb index 18a8015..15b1ecb 100644 --- a/templates/30.erb +++ b/templates/30.erb @@ -1,9 +1,7 @@ # Apply the ACLs. Any existing ACLs will be replaced DIRSORTED="$(for DIR in "${!ACLOPTS[@]}"; do echo $DIR; done | sort)" -IFS=$'\n' -for DIR in ${DIRSORTED}; do +while read -r DIR ; do setfacl ${ACLOPTS_GLOBAL} ${ACLOPTS[${DIR}]} ${DIR} -done -unset IFS +done <<< "${DIRSORTED}" From 51cf6f50dc380d99ad061fa2a7d2b2e3a4cd476c Mon Sep 17 00:00:00 2001 From: David Gardner Date: Wed, 23 Jan 2019 17:44:31 +0000 Subject: [PATCH 3/3] Quote directory name in final setfacl command --- templates/30.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/30.erb b/templates/30.erb index 15b1ecb..1b5c4a2 100644 --- a/templates/30.erb +++ b/templates/30.erb @@ -2,6 +2,6 @@ # Apply the ACLs. Any existing ACLs will be replaced DIRSORTED="$(for DIR in "${!ACLOPTS[@]}"; do echo $DIR; done | sort)" while read -r DIR ; do - setfacl ${ACLOPTS_GLOBAL} ${ACLOPTS[${DIR}]} ${DIR} + setfacl ${ACLOPTS_GLOBAL} ${ACLOPTS[${DIR}]} "${DIR}" done <<< "${DIRSORTED}"