From 618123e77322ea002cde9b80cce269b1960b574d Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 25 Nov 2011 12:07:37 -0400 Subject: store all permissions of files and directories, even those with standard permissions of 644 and 755 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is unfortunately necessary in order to support etckeeper init on a checkout that was made with a nonstandard umask, in which case the files that were expected to be 644 and 755, won't be. Closes: #649701 Thanks to Дмитрий Матросов for reporting the bug and developing a fixup script (attached to the bug) which could be used if you've already encountered this problem. --- debian/changelog | 13 +++++++++++++ etckeeper.spec | 2 +- pre-commit.d/30store-metadata | 21 ++++++--------------- 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/debian/changelog b/debian/changelog index 7773187..95b32c1 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,16 @@ +etckeeper (0.58) UNRELEASED; urgency=low + + * Changed to store all permissions of files and directories, even those + with standard permissions of 644 and 755. This is unfortunately necessary + in order to support etckeeper init on a checkout that was made with a + nonstandard umask, in which case the files that were expected to be + 644 and 755, won't be. Closes: #649701 + Thanks to Дмитрий Матросов for reporting the bug and developing + a fixup script (attached to the bug) which could be used if you've + already encountered this problem. + + -- Joey Hess Fri, 25 Nov 2011 12:00:55 -0400 + etckeeper (0.57) unstable; urgency=low * Use find -path instead of less portable find -wholename. diff --git a/etckeeper.spec b/etckeeper.spec index dcb2c4d..ea2c13a 100644 --- a/etckeeper.spec +++ b/etckeeper.spec @@ -1,5 +1,5 @@ Name: etckeeper -Version: 0.57 +Version: 0.58 Release: 4%{?dist} Summary: store /etc in git, mercurial, bzr or darcs diff --git a/pre-commit.d/30store-metadata b/pre-commit.d/30store-metadata index 2e35e6c..871d5c8 100755 --- a/pre-commit.d/30store-metadata +++ b/pre-commit.d/30store-metadata @@ -37,14 +37,16 @@ statf() { } generate_metadata() { - # This function generates the script commands to fix any files - # that aren't owner=root, group=root, or mode=0644 or 0755. + # This function generates the script commands to fix any file + # ownerships that aren't owner=root, group=root, as well as to + # store the permissions of all files (all are needed because the + # user may have an unusual umask). # The script is produced on stdout. Errors go to stderr. # # The script can use a 'maybe' function, which only runs a command # if the file in its last argument exists. - # We maintain the permissions on the directory containing VCS data + # We want files in the directory containing VCS data # but we want find to ignore the VCS files themselves. # # (Note that when using this, the find expression must end with @@ -77,18 +79,7 @@ generate_metadata() { # Find all files and directories that don't have root as the group find $NOVCS \! -group $(id -g) -print | statf "maybe chgrp %G" | sort | filter_unknown 'maybe chgrp' group - # Find all directories that aren't 0755 - find $NOVCS -type d \! -perm 0755 -print | statf "maybe chmod %a" | sort - - if [ "$VCS" = darcs ]; then - # Find all files that aren't 0644 (darcs doesn't maintain - # the executable bit). - find $NOVCS -type f \! -perm 0644 -print | statf "maybe chmod %a" | sort - else - # Find all files that aren't 0644 or 0755 (we can assume the VCS will - # maintain the executable bit). - find $NOVCS -type f \! -perm 0644 \! -perm 0755 -print | statf "maybe chmod %a" | sort - fi + find $NOVCS -print | statf "maybe chmod %a" | sort # We don't handle xattrs. # Maybe check for getfattr/setfattr and use them if they're available? -- cgit v1.2.3