Bug in ps -f

DAVID NEWALL ccdn at levels.sait.edu.au
Tue Oct 18 21:44:29 AEST 1988


I have discovered a bug in System V Unixes.  Under certain circumstances,
ps -f displays "junk" in the login name field.  This bug exists on our NCR
Tower 32/600's which are running NCR OS 01.03.02 (Unix V.2) and also on my
Stride 440 (Unix/68 V.1).  This does not appear to be a problem in BSD4.2
- at least, the bug does not occur on our Sun 3/60's (SUNOS 3.2).

This bug occurs when a logged in user has a login name which is 8 characters
long (could be longer; I haven't checked), and when the entry in /etc/passwd
that follows that user's has a user number greater than 256.

The "junk" that is displayed is the user's login name followed by the next
user's user number mod 256 (as a character) followed by that (second) user's
login name.  Similarly for third and subsequent lines.

For example:

        $ who am i
        user1234
        $ tail -3 /etc/passwd
        user1234:likjlasdfSDF:100:100:User 1234:/usr/1234:/bin/sh
        user2345:89kkakkik2kH:321:100:User 2345:/usr/2345:/bin/sh
        user3456:jKLJD983.8Hs:322:100:User 3456:/usr/3456:/bin/sh
        $ ps -f
            UID   PID  PPID  C           TTY  TIME COMMAND
        user1234Auser2345Buser3456 14165     1  2 15:54:52   05  0:03 sh
        user1234Auser2345Buser3456 14166 14165  0 15:54:57   05  0:00 ps -f

David Newall                     Phone:  +61 8 343 3160
Unix Systems Programmer          Fax:    +61 8 349 6939
Academic Computing Service       E-mail: ccdn at levels.sait.oz.au
SA Institute of Technology       Post:   The Levels, South Australia, 5095



More information about the Comp.unix.wizards mailing list