From 8202ad6d8a95497039a5714a2a30e4f5fbc8bf9f Mon Sep 17 00:00:00 2001 From: Sitaram Chamarty Date: Sun, 24 Oct 2010 18:06:42 +0530 Subject: [PATCH] (minor) allow @all to be combined with other items This was a very old quirk/oddity. Doing R = @all alice would fail, but you could still do R = @all R = alice Now we fixed it so it's consistent. ---- This also fixed a curious bug that no one ever caught: @all = u1 u2 # yes -- there was no check on redefining @all repo foo R = @all u3 # now would not fail because of defining @all would have given only those 3 users R access to foo, not really @all users! This was because the previous failure message was an artifact of not finding an expansion for @all, not a genuine "why are you saying @all and then specifying some user explicitly" warning! --- src/gl-compile-conf | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/src/gl-compile-conf b/src/gl-compile-conf index afa8bf5..c01ba79 100755 --- a/src/gl-compile-conf +++ b/src/gl-compile-conf @@ -126,7 +126,7 @@ sub expand_list for my $item (@list) { - if ($item =~ /^@/) # nested group + if ($item =~ /^@/ and $item ne '@all') # nested group { die "$ABRT undefined group $item\n" unless $groups{$item}; # add those names to the list @@ -183,16 +183,14 @@ sub parse_conf_line { # grab the list... @{ $repos_p } = split ' ', $1; - unless (@{ $repos_p } == 1 and $repos_p->[0] eq '@all') { - # ...expand groups in the default case - @{ $repos_p } = expand_list ( @{ $repos_p } ) unless $GL_BIG_CONFIG; - # ...sanity check - for (@{ $repos_p }) { - die "$ABRT bad reponame $_\n" - if ($GL_WILDREPOS and $_ !~ $REPOPATT_PATT); - die "$ABRT bad reponame $_ or you forgot to set \$GL_WILDREPOS\n" - if (not $GL_WILDREPOS and $_ !~ $REPONAME_PATT); - } + # ...expand groups in the default case + @{ $repos_p } = expand_list ( @{ $repos_p } ) unless $GL_BIG_CONFIG; + # ...sanity check + for (@{ $repos_p }) { + die "$ABRT bad reponame $_\n" + if ($GL_WILDREPOS and $_ !~ $REPOPATT_PATT); + die "$ABRT bad reponame $_ or you forgot to set \$GL_WILDREPOS\n" + if (not $GL_WILDREPOS and $_ !~ $REPONAME_PATT); } s/\bCREAT[EO]R\b/\$creator/g for @{ $repos_p }; } @@ -215,8 +213,7 @@ sub parse_conf_line @refs = map { s(/USER/)(/\$gl_user/); $_ } @refs; # expand the user list, unless it is just "@all" - @users = expand_list ( @users ) - unless ($GL_BIG_CONFIG or (@users == 1 and $users[0] eq '@all')); + @users = expand_list ( @users ) unless $GL_BIG_CONFIG; do { die "$ABRT bad username $_\n" unless $_ =~ $USERNAME_PATT } for @users; s/\bCREAT[EO]R\b/~\$creator/g for @users;