Package: psmisc Severity: normal Tags: upstream patch This is psmisc bug #52, see http://sourceforge.net/p/psmisc/bugs/52/
It's patched in f118a020b35fe6ad3d844478363dcf3186556204 in the psmisc git repository. Craig, would you consider updating the debian package for wheezy to contain that fix? For my personal sanity, I already backported the fix. You can find the diff attached, packages build with this fix are working for me. Uli / youam
diff -urN psmisc-22.19-1/debian/changelog psmisc-22.19-1.1/debian/changelog --- psmisc-22.19-1/debian/changelog 2012-06-21 23:15:55.000000000 +0200 +++ psmisc-22.19-1.1/debian/changelog 2013-01-08 16:10:03.000000000 +0100 @@ -1,3 +1,11 @@ +psmisc (22.19-1.1) unstable; urgency=low + + * Non-maintainer upload. + * Added fix for psmisc #52: pstree duplicated trees + http://sourceforge.net/p/psmisc/bugs/52/ + + -- Uli Martens <u...@youam.net> Tue, 08 Jan 2013 16:09:52 +0100 + psmisc (22.19-1) unstable; urgency=medium * Stop killall killing all Closes: #678357 diff -urN psmisc-22.19-1/debian/patches/pstree-find-orphans psmisc-22.19-1.1/debian/patches/pstree-find-orphans --- psmisc-22.19-1/debian/patches/pstree-find-orphans 1970-01-01 01:00:00.000000000 +0100 +++ psmisc-22.19-1.1/debian/patches/pstree-find-orphans 2013-01-08 16:32:05.000000000 +0100 @@ -0,0 +1,86 @@ +Index: psmisc-22.19/src/pstree.c +=================================================================== +--- psmisc-22.19.orig/src/pstree.c 2013-01-08 16:03:23.698752085 +0100 ++++ psmisc-22.19/src/pstree.c 2013-01-08 16:08:56.037143545 +0100 +@@ -134,6 +134,7 @@ + static int dumped = 0; /* used by dump_by_user */ + static int charlen = 0; /* length of character */ + ++static void fix_orphans(void); + /* + * Allocates additional buffer space for width and more as needed. + * The first call will allocate the first buffer. +@@ -248,8 +249,8 @@ + + for (walk = list; walk; walk = walk->next) + if (walk->pid == pid) +- break; +- return walk; ++ return walk; ++ return NULL; + } + + #ifdef WITH_SELINUX +@@ -370,21 +371,7 @@ + parent = new_proc("?", ppid, 0, scontext); + #else /*WITH_SELINUX */ + parent = new_proc("?", ppid, 0); +-#endif /*WITH_SELINUX */ +- /* When using kernel 3.3 with hidepid feature enabled on /proc +- * then we need fake root pid */ +- if (!isthread && pid != 1) { +- PROC *root; +- if (!(root = find_proc(1))) { +-#ifdef WITH_SELINUX +- root = new_proc("?", 1, 0, scontext); +-#else /*WITH_SELINUX */ +- root = new_proc("?", 1, 0); + #endif +- } +- add_child(root, parent); +- parent->parent = root; +- } + } + add_child(parent, this); + this->parent = parent; +@@ -770,6 +759,7 @@ + free(path); + } + (void) closedir(dir); ++ fix_orphans(); + if (print_args) + free(buffer); + if (empty) { +@@ -778,6 +768,32 @@ + } + } + ++static void fix_orphans(void) ++{ ++ /* When using kernel 3.3 with hidepid feature enabled on /proc ++ * then we need fake root pid and gather all the orphan processes ++ * that is, processes with no known parent ++ * As we cannot be sure if it is just the root pid or others missing ++ * we gather the lot ++ */ ++ PROC *root, *walk; ++ ++ if (!(root = find_proc(1))) { ++#ifdef WITH_SELINUX ++ root = new_proc("?", 1, 0, scontext); ++#else /*WITH_SELINUX */ ++ root = new_proc("?", 1, 0); ++#endif ++ } ++ for (walk = list; walk; walk = walk->next) { ++ if (walk->pid == 1 || walk->pid == 0) ++ continue; ++ if (walk->parent == NULL) { ++ add_child(root, walk); ++ walk->parent = root; ++ } ++ } ++} + + #if 0 + diff -urN psmisc-22.19-1/debian/patches/series psmisc-22.19-1.1/debian/patches/series --- psmisc-22.19-1/debian/patches/series 2012-06-17 08:16:48.000000000 +0200 +++ psmisc-22.19-1.1/debian/patches/series 2013-01-08 16:37:31.000000000 +0100 @@ -0,0 +1 @@ +pstree-find-orphans