summaryrefslogtreecommitdiff
path: root/pre-commit.d/30store-metadata
diff options
context:
space:
mode:
authorJoey Hess <joey@kitenet.net>2013-05-08 11:51:48 -0400
committerJoey Hess <joey@kitenet.net>2013-05-08 11:51:48 -0400
commit94ef6c3adf5a69dca00ffd6b77b77acb1e9ec914 (patch)
treed3cc7891541fd252a1b9ede50080752095989ff1 /pre-commit.d/30store-metadata
parent114e3ed40a7ddb3a6a5613aef6b9309dcba1df8c (diff)
When a file is owned by a uid or a gid with no corresponding user or group, put a numeric chown into .etckeeper. Previously, a broken chown was outputted.
Diffstat (limited to 'pre-commit.d/30store-metadata')
-rwxr-xr-xpre-commit.d/30store-metadata6
1 files changed, 4 insertions, 2 deletions
diff --git a/pre-commit.d/30store-metadata b/pre-commit.d/30store-metadata
index 455429a..d445db1 100755
--- a/pre-commit.d/30store-metadata
+++ b/pre-commit.d/30store-metadata
@@ -81,14 +81,16 @@ generate_metadata() {
if (exists $uidcache{$want}) {
return $uidcache{$want};
}
- return $uidcache{$want}=scalar getpwuid($want);
+ my $name=scalar getpwuid($want);
+ return $uidcache{$want}=defined $name ? $name : $want;
}
sub gidname {
my $want=shift;
if (exists $gidcache{$want}) {
return $gidcache{$want};
}
- return $gidcache{$want}=scalar getgrgid($want);
+ my $name=scalar getgrgid($want);
+ return $gidcache{$want}=defined $name ? $name : $want;
}
chomp;
my @stat=stat($_);