Re: passwd entry for uid -1
> The idea was to add the login user automatically in the Hurd postinst file,
> but adduser did not support negative uids. Now it does, but I forgot about
> changing the postinst file. Anyway, if we were to specify -1 as the uid
> now, we still have the problem that putpwent in glibc has this code:
> if (fprintf (stream, "%s:%s:%lu:%lu:%s:%s:%s\n",
> p->pw_name, _S (p->pw_passwd),
> (unsigned long int) p->pw_uid, (unsigned long int) p->pw_gid,
> _S (p->pw_gecos), _S (p->pw_dir), _S (p->pw_shell)) < 0)
> Note the (unsigned long int) p->pw_uid. So the uid will come out as
> ULONG_MAX or so in the passwd file. Is this safe?
It will work out ok. The value is read from the file using strtoul,
and cast to uid_t which is unsigned int which is the same as unsigned long int.
Any comparison with int -1 in C will match.
> The other possibility is to include the login user in the passwd/group master
> file in base-passwd. This is Architecture: any, so that's okay (I think it
> was architecture all before, and we ruled it out because of this).
I don't speak debianese.
> We also need an entry for -1 in the group file, right?
Well, I don't know about "need" but it would be a fine thing to have I suppose.
Perhaps they should both be "nouser" or something instead of "login".
The only need for either entry is for programs that don't cope nicely if
getpwuid(getuid()) or getgrgid(getgid()) fails to work, or that are made
somehow nicer to use by having these entries. So the details depend really
on the details of that set of programs.