From fcc139786f395d58aeaaaef1ccb3807b8049e929 Mon Sep 17 00:00:00 2001 From: Tom Payne Date: Mon, 1 May 2023 20:55:30 +0200 Subject: [PATCH] fix: Respect executable file modes in external_ directories --- pkg/chezmoi/sourcestate.go | 1 + pkg/cmd/testdata/scripts/issue2964.txtar | 11 +++++++++++ 2 files changed, 12 insertions(+) create mode 100644 pkg/cmd/testdata/scripts/issue2964.txtar diff --git a/pkg/chezmoi/sourcestate.go b/pkg/chezmoi/sourcestate.go index 4e8f1969c46..bdb2d713a1c 100644 --- a/pkg/chezmoi/sourcestate.go +++ b/pkg/chezmoi/sourcestate.go @@ -2157,6 +2157,7 @@ func (s *SourceState) readExternalDir( TargetName: fileInfo.Name(), Type: SourceFileTypeFile, Empty: true, + Executable: isExecutable(fileInfo), Private: isPrivate(fileInfo), ReadOnly: isReadOnly(fileInfo), } diff --git a/pkg/cmd/testdata/scripts/issue2964.txtar b/pkg/cmd/testdata/scripts/issue2964.txtar new file mode 100644 index 00000000000..2eacf91f6cb --- /dev/null +++ b/pkg/cmd/testdata/scripts/issue2964.txtar @@ -0,0 +1,11 @@ +[windows] skip 'UNIX only' + +chmod 755 $CHEZMOISOURCEDIR/external_dot_dir/executable + +# test that external_ directories respect the executable bit +exec chezmoi apply +[umask:002] cmpmod 775 $HOME/.dir/executable +[umask:022] cmpmod 755 $HOME/.dir/executable + +-- home/user/.local/share/chezmoi/external_dot_dir/executable -- +# contents of .dir/executable