From 37c02dad45065fb2203b85071f9b71b3cf77a045 Mon Sep 17 00:00:00 2001 From: Matt Coddington Date: Thu, 2 Feb 2012 11:09:20 -0500 Subject: [PATCH] bugfix - do chmod last --- conf/type/__file/gencode-remote | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/conf/type/__file/gencode-remote b/conf/type/__file/gencode-remote index 9e700934..2b4c7e45 100755 --- a/conf/type/__file/gencode-remote +++ b/conf/type/__file/gencode-remote @@ -34,11 +34,6 @@ case "$state_should" in fi fi - # Mode settings - if [ -f "$__object/parameter/mode" ]; then - echo chmod \"$(cat "$__object/parameter/mode")\" \"$destination\" - fi - # Group if [ -f "$__object/parameter/group" ]; then echo chgrp \"$(cat "$__object/parameter/group")\" \"$destination\" @@ -48,6 +43,12 @@ case "$state_should" in if [ -f "$__object/parameter/owner" ]; then echo chown \"$(cat "$__object/parameter/owner")\" \"$destination\" fi + + # Mode - needs to happen last as a chown/chgrp can alter mode by + # clearing S_ISUID and S_ISGID bits (see chown(2)) + if [ -f "$__object/parameter/mode" ]; then + echo chmod \"$(cat "$__object/parameter/mode")\" \"$destination\" + fi ;; absent)