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 304696 - the profile dialog has weird usernames sometimes
the profile dialog has weird usernames sometimes
Status: RESOLVED FIXED
Product: sabayon
Classification: Deprecated
Component: general
0.18
Other Linux
: Normal normal
: ---
Assigned To: Maintainers of sabayon
Maintainers of sabayon
Depends on:
Blocks:
 
 
Reported: 2005-05-18 20:08 UTC by Sebastien Bacher
Modified: 2005-05-19 08:44 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Sebastien Bacher 2005-05-18 20:08:18 UTC
example for "gnome:x:1001:1001:,,,:/home/gnome:/bin/bash" the username is ",,,"

usersdialog.py uses this code:

if pw.pw_gecos:
    name = pw.pw_gecos


>>> pw = pwd.getpwnam ("gnome")
>>> pw.pw_gecos
',,,'


one possible fix:

--- admin-tool/usersdialog.py   12 May 2005 12:30:20 -0000      1.1
+++ admin-tool/usersdialog.py   18 May 2005 20:02:29 -0000
@@ -38,8 +38,8 @@
         for user in db.get_users ():
             pw = pwd.getpwnam (user)
 
-            if pw.pw_gecos:
-                name = pw.pw_gecos
+            if pw.pw_gecos and pw.pw_gecos != ",,,":
+                name = pw.pw_gecos.split(",,,")[0]
             else:
                 name = user

The split handles "UserName,,," cases
Comment 1 Sebastien Bacher 2005-05-18 20:11:15 UTC
splitting on "," is probably better
:
--- admin-tool/usersdialog.py   12 May 2005 12:30:20 -0000      1.1
+++ admin-tool/usersdialog.py   18 May 2005 20:02:29 -0000
@@ -38,8 +38,8 @@
         for user in db.get_users ():
             pw = pwd.getpwnam (user)
 
-            if pw.pw_gecos:
-                name = pw.pw_gecos
+            if pw.pw_gecos and pw.pw_gecos != ",,,":
+                name = pw.pw_gecos.split(",")[0]
             else:
                 name = user

Comment 2 Mark McLoughlin 2005-05-19 07:01:06 UTC
Is this user a real user or a system one? Why does it have ",,," in its gecos
field anyway?

How about

  name = None
  if pw.pw_gecos:
      name = pw.pw_gecos.split(",")[0]
  if not name:
      name = user
Comment 3 Sebastien Bacher 2005-05-19 07:48:09 UTC
",,," is the field you get when you do "adduser <user>" and validate all the
empty fields on a Debian/Ubuntu install

your solution seems to be fine
Comment 4 Mark McLoughlin 2005-05-19 08:44:42 UTC
Thanks

2005-05-19  Mark McLoughlin  <markmc@redhat.com>

        Based on a patch from  Sebastien Bacher <seb128@debian.org>
        in bug #304696

        * admin-tool/usersdialog.py: pw_gecos is a comma separated
        list of values - split it an use the first value as the
        user's name. If that's not set, just use the username as the
        user's name.