[OpenAFS] Re: retaining AFS-specific nameless group IDs (PAG) in `id' and `groups'
Jim Meyering
jim@meyering.net
Wed, 23 Apr 2008 13:49:11 +0200
Adam Megacz <megacz@cs.berkeley.edu> wrote:
> Jim Meyering <jim@meyering.net> writes:
>> Since you guys are interested in AFS, I'm hoping one of you will
>> respond to the above.
>
> http://lists.openafs.org/pipermail/openafs-info/2008-April/029132.html
Thanks for the pointer.
With that, I'm going ahead:
>> I'll wait a few days, after which, if I don't hear anything, I'll
>> just revert to the old behavior.
>
> If "old behavior" means no special action for GIDs that might be PAGs,
> I think that is the right course of action.
Yes.
I'm planning to revert it with the following patch.
Normally, I would also write an accompanying test case,
but I don't know enough about AFS to do that portably.
Maybe you can help (this may save you trouble in terms of
avoided regressions later ;-):
- how can I detect (in Perl or Bourne shell) whether the
current system is AFS-enabled?
- is there always exactly one PAG?
>From 563493fe424af24a32458273e9d78cc1c11b389a Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@redhat.com>
Date: Wed, 23 Apr 2008 11:45:38 +0200
Subject: [PATCH] id: do print the AFS-specific nameless group ID (called a PAG)
In 6.11, we mistakenly suppressed the printing of certain group IDs,
thinking they were useless AFS-specific artifacts.
This change reverts that, so now they are printed once again.
http://thread.gmane.org/gmane.org.fsf.announce/867/focus=13345
This also reverts the bug-fix that applied solely to the new code
used to avoid printing those IDs
Revert "id bug fix: don't point to potentially clobbered static storage"
This reverts commit f7d1c59c224f81a8bab5fa2afcaf815988f50467.
Revert "Work around AFS bug: id and groups would print invalid group number."
This reverts commit b7a836c0a3524cda8ef79c30c3fe7ea759ae4656.
Signed-off-by: Jim Meyering <meyering@redhat.com>
---
NEWS | 12 +++++++++---
src/groups.c | 2 +-
src/id.c | 11 +++--------
3 files changed, 13 insertions(+), 12 deletions(-)
diff --git a/NEWS b/NEWS
index 04893c6..47f5157 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,14 @@
GNU coreutils NEWS -*- outline -*-
+* Noteworthy changes in release 6.12 (????-??-??) [stable]
+
+** Bug fixes
+
+ id and groups once again print the AFS-specific nameless group-ID (PAG).
+ Printing of such large-numbered, kernel-only (not in /etc/group) group-IDs
+ was suppressed in 6.11 due to ignorance that they are useful.
+
+
* Noteworthy changes in release 6.11 (2008-04-19) [stable]
** Bug fixes
@@ -72,9 +81,6 @@ GNU coreutils NEWS -*- outline -*-
** Improvements
- id and groups work around an AFS-related bug whereby those programs
- would print an invalid group number, when given no user-name argument.
-
ls --color no longer outputs unnecessary escape sequences
seq gives better diagnostics for invalid formats.
diff --git a/src/groups.c b/src/groups.c
index c8e617b..baac7b9 100644
--- a/src/groups.c
+++ b/src/groups.c
@@ -102,7 +102,7 @@ main (int argc, char **argv)
egid = getegid ();
rgid = getgid ();
- if (!print_group_list (getlogin (), ruid, rgid, egid, true))
+ if (!print_group_list (NULL, ruid, rgid, egid, true))
ok = false;
putchar ('\n');
}
diff --git a/src/id.c b/src/id.c
index a178714..e4eda40 100644
--- a/src/id.c
+++ b/src/id.c
@@ -196,22 +196,17 @@ of a different user"));
error (EXIT_FAILURE, 0,
_("cannot print only names or real IDs in default format"));
- char const *user_name;
if (argc - optind == 1)
{
- struct passwd const *pwd = getpwnam (argv[optind]);
+ struct passwd *pwd = getpwnam (argv[optind]);
if (pwd == NULL)
error (EXIT_FAILURE, 0, _("%s: No such user"), argv[optind]);
- user_name = argv[optind];
ruid = euid = pwd->pw_uid;
rgid = egid = pwd->pw_gid;
}
else
{
- struct passwd const *pwd;
euid = geteuid ();
- pwd = getpwuid (euid);
- user_name = pwd ? xstrdup (pwd->pw_name) : NULL;
ruid = getuid ();
egid = getegid ();
rgid = getgid ();
@@ -228,7 +223,7 @@ of a different user"));
}
else if (just_group_list)
{
- if (!print_group_list (user_name, ruid, rgid, egid, use_name))
+ if (!print_group_list (argv[optind], ruid, rgid, egid, use_name))
ok = false;
}
else if (just_context)
@@ -237,7 +232,7 @@ of a different user"));
}
else
{
- print_full_info (user_name);
+ print_full_info (argv[optind]);
}
putchar ('\n');
--
1.5.5.1.68.gbdcd8