Uploaded image for project: 'CFEngine Community'
  1. CFEngine Community
  2. CFE-2951

ps command and long usernames

    XMLWordPrintable

    Details

      Description

      we still rely on ps command line parsing and now days usernames are longer then 8 chars. But the ps options for linux is:

      -eo user,pid,ppid,pgid,pcpu,pmem,vsz,ni,rss:9,nlwp,stime,etime,time,args
      

      This will limit the user lenght to 8, see:

      message+   641     1  0 08:27 ?        00:00:06 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation
      Debian-+   945     1  0 08:28 ?        00:00:08 /usr/sbin/snmpd -Lsd -Lf /dev/null -u Debian-snmp -g Debian-snmp -I -smux mteTrigger mteTriggerConf -f
      

      So we can not distinguish between the user after the 8 char,eg

      • systemd-timesync
      • systemd-network
      • systemd-resolve
      • systemd-bus-proxy
      • we have also have logins that are longer then 8 chars.

      A solution can be use the length argument, eg:

      ps -eo user:30,pid,ppid,pgid,pcpu,pmem,vsz,ni,rss:9,nlwp,stime,etime,time,args
      

      I can write a patch for it, but beter would be:

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            bas Bas van der Vlies
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: