summaryrefslogtreecommitdiffstats
path: root/misc/git-store-meta/fix-storing-group-name.patch
blob: 13bb8718c18fb6e2f23cc430ecfe554b68ecd0bd (plain)
commit e9a545ae7f45ea2b8b031457ffeeb7ec69cac41d
Author: Andrzej Telszewski <atelszewski@gmail.com>
Date:   Sat Oct 24 12:27:13 2020 +0200

    Fix that the 'group' name is not correctly stored
    
    Fix that the 'group' name is not correctly stored in '.git_store_meta'.
    
    The reason for the error is that `getpwuid()` is used instead of
    `getgrgid()` when retreiving group information.

diff --git a/git-store-meta.pl b/git-store-meta.pl
index ddc0024..c7ef50a 100755
--- a/git-store-meta.pl
+++ b/git-store-meta.pl
@@ -473,7 +473,7 @@ sub getfacl_internal {
         }
         if (defined $acl{'group'}) {
             foreach my $gid (keys %{$acl{'group'}}) {
-                my $group = getpwuid($gid);
+                my $group = getgrgid($gid);
                 $group = defined($group) ? $group : $gid;
                 push(@results, "group:$group:" . getfacl_internal_getperms(\%{$acl{'group'}{$gid}}));
             }
@@ -758,7 +758,7 @@ sub get_file_metadata {
             my $user = getpwuid($uid);
             push(@rec, $user || "");
         } elsif ($_ eq "group") {
-            my $group = getpwuid($gid);
+            my $group = getgrgid($gid);
             push(@rec, $group || "");
         } elsif ($_ eq "acl") {
             push(@rec, &$getfacl($file));