[gnu.emacs.bug] bug in get-real-user-name/startup.el

shap%delrey.wpd@SGI.COM (Jonathan Shapiro) (01/10/90)

Symptom:  "error in init file" diagnostic when starting up,
but no init file.

Repeat by:  In an environment where yellow pages is running, create a
yellow pages passwd entry of the form:

	+user:::user-name:user-directory:

invoke emacs.

What's happening:

Since there is no uid in the passwd entry, the call to getpwuid() in
USER-REAL-LOGIN-NAME in editfns.c fails, resulting in a real-user-name
of "unknown".  startup.el in turn fails if the real-user-id and the
user-id don't match.

Easy workaround: edit startup.el to special case a
USER-REAL-LOGIN-NAME of "unknown" and go with the USER-LOGIN-NAME.

Moral: Don't rely on getpwuid() returning the right answer.  If it
returns NULL and the real uid is the same as the effective uid, the
best you can do is to believe whatever you find in the LOGNAME or USER
environment variables.

I will also post an SGI bug on this.

Jon Shapiro
Silicon Graphics