From afa3d3943df5e17bd9aa8186832614117ec51fc9 Mon Sep 17 00:00:00 2001 From: Alex Tsariounov Date: Thu, 29 Apr 2010 21:28:01 -0600 Subject: [PATCH] Apply patch by mostroski to commands/proc.py which fixes exception if a process is run with a nonexistant uid. When listing processes running in a cpuset, the patch tries to lookup the user name by uid, and if the uid does not exist in /etc/passwd, the uid is printed instead of the user name. --- cpuset/commands/proc.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cpuset/commands/proc.py b/cpuset/commands/proc.py index e54c7ed..41a246d 100644 --- a/cpuset/commands/proc.py +++ b/cpuset/commands/proc.py @@ -713,7 +713,11 @@ def task_detail(pid, width=70): cmdline = cmdline.replace('\0', ' ') out = [] - out.append(pwd.getpwuid(int(stdict['Uid'].split()[0]))[0][:8].ljust(8)) + try: + uid=pwd.getpwuid(int(stdict['Uid'].split()[0]))[0][:8].ljust(8) + except: + uid=stdict['Uid'].split()[0][:8].ljust(8) + out.append(uid) out.append(stdict['Pid'].rjust(5)) out.append(stdict['PPid'].rjust(5))