Subject: Re: chown/chgrp problem: is "." a separator or part of a name ?
To: Darren Reed <firstname.lastname@example.org>
From: Perry E. Metzger <email@example.com>
Date: 05/06/2000 17:59:51
Darren Reed <firstname.lastname@example.org> writes:
> Whilst looking through the PR's currently open, I came across one where
> a person was attempting to chown a file to a user where the username was
> made up of a ".". Easy to deal with ? Maybe.
> Consider that a username might be "foo.bar", "foo", "bar" and a group
> name to match each of those.
> If I do "chown foo.bar /tmp/foryou" what should happen ?
> Is the best option, in this case, to simply bail out because the user
> is not being clear about what they want to do ?
There are two possibilities here. The current docs we have don't even
indicate that "." still works. In theory, we could perhaps just rip it
Assuming we keep it, we should observe a few things:
1) Using : should be the *encouraged* way of doing things.
2) We don't want to rip out "." support in the cases when it doesn't
cause trouble, though. Users are used to it. Therefore, if there
aren't dots in your passwd file names, and someone says "chown
foo.bar", it should do what it does right now.
3) That said, if there is a . in a user name, and it is unambiguously
a user name (i.e. someone does "chown foo.bar" and there is a
"foo.bar" in the password file) the right thing should happen, too
-- i.e. the username should be assumed, not user.group syntax.
4) Given that : is the encouraged syntax, if there is a conflict
(i.e. foo, bar and foo.bar all exist), then the assumption should
be that the user "foo.bar" was meant. As der Mouse said
differently, we supply the rope -- it is up to a user to hang
So, then, we should do this in the code:
1) If there is a :, what is before the colon is assumed to be a
username, and what is after is a group name, PERIOD.
2) If there is NOT a :, and there is a period in the string, we check
if the full string is in the password file. If it is, we treat it
as a user name. If not, we treat it as "user.group" syntax.
3) if there is a string with no ":" or "." in it, just treat it as a
2) could of course be done in several ways, but the impact should more
or less be what is implied there, IMHO.
Or, of course, we could just rip it out.