After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 542058 - g_get_user_name
g_get_user_name
Status: RESOLVED OBSOLETE
Product: glib
Classification: Platform
Component: general
unspecified
Other All
: Normal enhancement
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2008-07-08 15:52 UTC by Morten Welinder
Modified: 2018-05-24 11:29 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
g_get_user_name_for_display (1.95 KB, patch)
2010-03-12 15:03 UTC, Christian Dywan
none Details | Review
Implement g_get_user_name_for_display (2.33 KB, patch)
2010-06-16 10:48 UTC, Christian Dywan
none Details | Review

Description Morten Welinder 2008-07-08 15:52:54 UTC
The output of g_get_user_name is so ill defined that none of the callers
that I located via google use it right.  I would guess that no-one is.
There ought to be one or more wrappers that allow applications to use it
right.  There seem to be two classes of uses:

1. UTF-8 for display.  Here's one from Nautilus:

      return g_strdup_printf (_("%s's Home"), g_get_user_name ());

   A variant for this should validate for UTF-8 and convert/transscribe
   to UTF-8 for anything that isn't.

2. For filenames.  Here's one from Gimp 2.3.18:

      gchar *user_name = g_strdup (g_get_user_name ());
      ...
      subdir_name = g_strconcat (GIMPDIR ".", user_name, NULL);

   A variant for this should ensure that the encoding is right for filenames
   and that no invalid characters occur in the name.  Gimp tries to do that
   for Win32, but does not get it right.


(Also, the docs for g_get_user_name fail to mention that while the
encoding uses is undefined, it is an encoding that uses zero termination.)
Comment 1 Christian Dywan 2010-03-12 15:03:46 UTC
Created attachment 155970 [details] [review]
g_get_user_name_for_display

This function handles the display case.
Comment 2 Christian Dywan 2010-06-16 10:48:12 UTC
Created attachment 163799 [details] [review]
Implement g_get_user_name_for_display
Comment 3 GNOME Infrastructure Team 2018-05-24 11:29:02 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/glib/issues/149.