Bug 481072

Summary: Tree view doesn't work with threads hidden
Product: [Fedora] Fedora Reporter: Josh Stone <cuviper>
Component: htopAssignee: RafaƂ Psota <rafalzaq>
Status: CLOSED NEXTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 10CC: maxamillion, rafalzaq
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-02-06 05:19:54 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
ensure tgid is always set none

Description Josh Stone 2009-01-22 00:06:46 UTC
Created attachment 329674 [details]
ensure tgid is always set

Description of problem:
When htop is configured to show a tree view

Version-Release number of selected component (if applicable):
htop-0.8.1-2.fc10
This is a regression -- 0.7.x didn't have this problem.

How reproducible:
Very easy to reproduce

Steps to Reproduce:
1. Edit or create ~/.htoprc, and set hide_userland_threads=1 and tree_view=1.
2. Start htop
3. Note that it is not actually displaying a tree view.
  
Actual results:
Processes are shown without threads in a flat view.  Pressing F5 to toggle tree view will change the order, but it remains flat.  Pressing H twice to toggle user threads on and off again will restore the proper tree hierarchy (until htop is restarted).

Expected results:
Processes are shown without threads in a tree view to begin with.

Additional info:
The problem is that when htop is hiding user threads, it doesn't go through the enumeration that sets the tgid in its process structures.  Every process is left with tgid=0, which prevents the tree generator from working.

The attached patch fixes the problem by setting tgid=pid when the parent pointer is NULL.

I've posted this to the upstream mailing list and bug tracker as well, but haven't gotten any response.
http://sourceforge.net/tracker/?func=detail&atid=651633&aid=2022810&group_id=108839

Ubuntu accepted this patch for jaunty from LP #298232.

Comment 1 Adam Miller 2009-02-05 20:01:35 UTC
Rafal submitted the patch for upstream/current fedora builds. I have applied the patch to the EPEL branches. Updates to follow...

Comment 2 Fedora Update System 2009-02-06 05:19:52 UTC
htop-0.8.1-3.fc10 has been pushed to the Fedora 10 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 3 Fedora Update System 2009-02-06 05:23:25 UTC
htop-0.8.1-3.fc9 has been pushed to the Fedora 9 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 4 Josh Stone 2009-02-07 02:51:09 UTC
I got the update today and confirmed that the problem is fixed.  Thanks very much!