delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2001/05/20/05:28:45

Sender: rich AT phekda DOT freeserve DOT co DOT uk
Message-ID: <3B078E2D.682B95BB@phekda.freeserve.co.uk>
Date: Sun, 20 May 2001 10:28:13 +0100
From: Richard Dawe <rich AT phekda DOT freeserve DOT co DOT uk>
X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.2.17 i586)
X-Accept-Language: de,fr
MIME-Version: 1.0
To: djgpp-workers AT delorie DOT com
Subject: Re: ANNOUNCE: Fileutils 4.0 beta 2
References: <Pine DOT SUN DOT 3 DOT 91 DOT 1010513160015 DOT 15149B AT is>
Reply-To: djgpp-workers AT delorie DOT com

Hello.

Eli Zaretskii wrote:
> 
> On Sun, 13 May 2001, Richard Dawe wrote:
>
> > I can see two problems with the fixes for DJGPP:
> >
> > * It does not save and restore the current user and group in the
> > environment. This could cause unexpected side-effects.
> 
> Could you spell out some of these side effects?

There may not be any in Fileutils.

I don't like the idea a function of setting the user and group and not
restoring them, just so the C library "thinks" that we are the specified
user & group. I think the user and group switch should be local to the
function. What if other functions also use the user & group? They may
behave differently if called before/after a function that switches user &
group.

> > * It makes all user & group names map to the same uid & gid
> > respectively. This may be what you want in some cases. But there is no
> > way to distinguish between current user & group and every other user &
> > group. In chown and chgrp you want the second behaviour.
> 
> I don't think I see why the value of uid and gid matter.

It's not the values that matter. What matters is that you can distinguish
between the "owned by me" and "not owned by me" and "in my group" and "not
in my group" cases. Again, this is for chown, chgrp. Other programs may
not care about this distinction.

> If this gets too complicated to fix in userspec.c, perhaps we should
> consider fixing it in libc.a.

I think this is a better way to go. But how would we do it? We could add
functions to create other users & groups on the fly, e.g.:

    __add_user("brian", 123);
    __add_group("root", 0);

We could have a 'struct passwd' and 'struct group' as the argument
respectively, rather than many parameters.

Or would it be better to have $DJDIR/etc/passwd and $DJDIR/etc/group? 
These could supplement the enviroment variables.

I think I prefer the former solution, since it is easier for users.

Bye, Rich =]

-- 
Richard Dawe
http://www.phekda.freeserve.co.uk/richdawe/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019