GNOME Bugzilla – Bug 143552
g_get_real_name() returns "Unknown"
Last modified: 2011-02-18 16:09:28 UTC
When information is missing from the GECOS field in a password entry, g_get_real_name() returns the string "Unknown". I believe that it would be more reasonable to expect the empty string or NULL. I discovered this when tracking down why "Unknown" was showing up in gedit when using the sample "User name" plugin. The plugin checks the return value from g_get_real_name() by calling strlen() on the result, and assuming that if it was greater than 0, the call succeeded. Which it really didn't. A further argument is that someone could perfectly legitimately have "Unknown" as their full name in the GECOS field, and then it would be impossible to distinguish between failure and this name. One argument against fixing this bug is that applications may already be checking for "Unknown" and assuming that means failure. Is that likely, or can this actually be fixed? (Bonsai is down right now, so I can't check to see how long this has been around.)
The "Unknown" is wrong anyway, since it should be localized.
Decided to leave it as is and just clarify the docs.