[Mono-dev] Error in UnixGroupInfo

Jonathan Pryor jonpryor at vt.edu
Wed Jun 20 07:28:39 EDT 2007


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
UnixUserInfo.GetMemberNames().Length.

Then again, is knowing that the group file has an invalid entry a common
scenario that should be documented?

Opinions?

Thanks,
 - Jon





More information about the Mono-devel-list mailing list