[Mono-dev] Error in UnixGroupInfo

Rafael Teixeira monoman at gmail.com
Wed Jun 20 09:11:41 EDT 2007


Another variation to keep UnixUserInfo sealed, is to make the the
class itself accept an invalid name or a -1 as the user id, and throw
on any unknown property, except UserId (so sometimes the Name would
also be available, which helps pinpoint the failures, didn't follow
the GetMembers code to see if this would be the case).

:)

On 6/20/07, Rafael Teixeira <monoman at gmail.com> wrote:
> An alternative is to return 'dummy' members for the missing ones in
> GetMembers, aka
> 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
> this subclass.
>
> 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
> > 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
> >
> >
> > _______________________________________________
> > Mono-devel-list mailing list
> > Mono-devel-list at lists.ximian.com
> > http://lists.ximian.com/mailman/listinfo/mono-devel-list
> >
>
>
> --
> 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
>


-- 
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 mailing list