[PATCH] chown user: w/o group

Tito farmatito at tiscali.it
Fri Sep 22 20:17:48 UTC 2006


On Friday 22 September 2006 22:10, Luciano Miguel Ferreira Rocha wrote:
> On Fri, Sep 22, 2006 at 09:55:45PM +0200, Tito wrote:
> > > With the format:
> > > 
> > > chown <newuser>:<newgroup> <files> ...
> > > 
> > > If <newgroup> is empty, and <newuser> isn't, then get the passwd entry
> > > for <newuser> and use its default group.
> > > 
> > > It isn't necessary to create a new function, I could put that code in
> > > the chown applet. But this way it simplified the applet and make the
> > > funcionality available as a function for other applets.
> > > 
> > 
> > Can you think of some other applet that could need this kind of
> > funcionality?
> > If yes it is a good idea to put it in libbb else
> > it should better go in the applet itself.
> 
> Not really. There'll probably others that also need uid+gid from
> username, but not uid+gid iff gname is empty, or that *only* need those
> two values from the passwd entry.
> 
> As busbybox's build system splits each libbb's function to each file, I
> didn't expect busybox's size to increase even if the function was
> unused, so making that funcionality a single function helped to make
> chown's code cleaner (imho).
> 
> Actually, my busybox's size remains unchaged either with or without the
> patch. I find that disturbing...
> 
> Anyway, I don't mind where it ends. I'll make a version w/o that
> function and send it.
>

Maybe moving the function as it is to chown.c could do it.
Could I suggest something like parse_user_and_group() as name.

Ciao,
Tito



More information about the busybox mailing list