[Mono-dev] Error in UnixGroupInfo
monoman at gmail.com
Wed Jun 20 08:57:33 EDT 2007
An alternative is to return 'dummy' members for the missing ones in
Fowler's Special Case pattern, from the PoEAA book.
For invalid users, return an instance of a subclass of
Mono.Unix.UnixUserInfo, that returns UserId as -1, or some other
invalid value. Also all other properties except Name would also have
neutral or invalid values, and methods would do/return nothing, for
Just my 2 cents,
On 6/20/07, Jonathan Pryor <jonpryor at vt.edu> wrote:
> On Wed, 2007-06-20 at 11:30 +0200, pablosantosluac wrote:
> > I have found an issue with Mono.Unix.UnixGroupInfo.GetMembers().
> > This method is meant to return the UnixUserInfo for the members of the given
> > unix group. The issue arises when a system has an unexistent username
> > defined in the group file.
> > This is rather frequent, especially in a NIS environment (lazy admins).
> > Normal unix behavior is to ignore the user and continue.
> > UnixGroupInfo.GetMembers() raises an 'invalid username' exception, and there
> > is no way to retrieve the rest of the users in the group.
> > Is it right to absorb the exception in this method and continue resolving
> > other users?
> Good question. I imagine that it would be more user-friendly to eat the
> ArgumentException and return what it can, but it would then mean that
> the only way to know that there are invalid entries in the group file is
> to compare UnixUserInfo.GetMembers().Length to
> Then again, is knowing that the group file has an invalid entry a common
> scenario that should be documented?
> - Jon
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
Rafael "Monoman" Teixeira
"The reasonable man adapts himself to the world; the unreasonable one
persists in trying to adapt the world to himself. Therefore all
progress depends on the unreasonable man." George Bernard Shaw
More information about the Mono-devel-list