Bug 504795

Summary: htop aborts after hitting F6 key
Product: [Fedora] Fedora Reporter: Michal Nowak <mnowak>
Component: htopAssignee: Rafał Psota <rafalzaq>
Status: CLOSED NEXTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: rawhideCC: dmach, fedora-bugs, ohudlick, rafalzaq
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: 0.8.2-2.fc11 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-06-16 01:20:31 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
Patch from bug 505387 none

Description Michal Nowak 2009-06-09 13:52:33 UTC
Description of problem:

htop aborts after hitting F6 key (and when pressing 'a' also).

Version-Release number of selected component (if applicable):

htop-0.8.2-1.fc11.x86_64

How reproducible:

always

Steps to Reproduce:
1. run htop
2. press "F6" (SortBy function)
  
Actual results:

htop 0.8.2 aborted. Please report bug at http://htop.sf.net

Expected results:

Column sorted.

Additional info:

Problem started with 0.8.2, I think. 

Also here, without answer, yet.

http://sourceforge.net/mailarchive/forum.php?thread_name=20090607170847.0e4f7885%40pluto.lan&forum_name=htop-general

http://sourceforge.net/mailarchive/forum.php?thread_name=d8fa22ff26511f856b70d51fed039233.squirrel%40jesgue.homelinux.org&forum_name=htop-general

Comment 1 Daniel Mach 2009-06-09 19:23:15 UTC
I hit the same problem on pressing '>' key which also opens sort menu.
Strace shows that htop ends with SIGSEGV (Segmentation fault) just after pressing the key.

Comment 2 Michal Nowak 2009-06-09 21:24:10 UTC
Program received signal SIGSEGV, Segmentation fault.
strlen () at ../sysdeps/i386/i486/strlen.S:40
40		cmpb %ch, (%eax)	/* is byte NUL? */
Current language:  auto; currently asm
(gdb) bt all
No symbol "all" in current context.
(gdb) bt
#0  strlen () at ../sysdeps/i386/i486/strlen.S:40
#1  0x00a5f0e5 in __strdup (s=0x4a2ed0aa <Address 0x4a2ed0aa out of bounds>) at strdup.c:42
#2  0x0804cc51 in FunctionBar_new (functions=0xbfa8f780, keys=0xbfa8d9fc, events=0xbfa8d9f4) at FunctionBar.c:57
#3  0x0804d7cb in pickFromVector (panel=0x8513880, list=0x851f180, x=15, y=5, keyLabels=0xbfa8f780, prevBar=0x8513ef8) at htop.c:198
#4  0x0804ff33 in main (argc=1, argv=Cannot access memory at address 0x6
) at htop.c:707

Comment 3 Tobias Mueller 2009-06-11 18:27:04 UTC
yeah, I hit this in bug 505387.

The problem is, that we don't know the size of the functions array. http://htop.svn.sourceforge.net/viewvc/htop/trunk/FunctionBar.c?revision=155&view=markup has a dumb logic in line 55 iterating blindly over 15 elements, even if the array has two elements only. I cooked up patch 347448 which might fix your issue as well.

Comment 4 Tobias Mueller 2009-06-11 18:34:14 UTC
patch #347448 doesn't fix this issue, but patch #347449  does :)
Happy Patching!

Comment 5 Michal Nowak 2009-06-12 09:16:52 UTC
Created attachment 347524 [details]
Patch from bug 505387

Comment 6 Michal Nowak 2009-06-12 09:18:21 UTC
*** Bug 505387 has been marked as a duplicate of this bug. ***

Comment 7 Michal Nowak 2009-06-12 09:20:33 UTC
I tested the patch by Tobias and it fixes both "a" and "F6" bugs. Can you please post it upstream?

Comment 8 Michal Nowak 2009-06-12 09:24:02 UTC
I've also noticed small typos here:

  #remove empty direcories
  rm -rf $RPM_BUILD_ROOT%{prefix}/lib
  rm -rf $RPM_BUILD_ROOT%{prefix}/include

should be something like this:

  #remove empty directories
  rmdir $RPM_BUILD_ROOT%{_libdir}
  rmdir $RPM_BUILD_ROOT%{_includedir}

Comment 9 Rafał Psota 2009-06-12 10:20:45 UTC
Wow. A few days of absence, and I have another bug fixed. Thanks!

Comment 10 Fedora Update System 2009-06-12 11:03:33 UTC
htop-0.8.2-2.fc10 has been submitted as an update for Fedora 10.
http://admin.fedoraproject.org/updates/htop-0.8.2-2.fc10

Comment 11 Fedora Update System 2009-06-12 11:03:40 UTC
htop-0.8.2-2.fc9 has been submitted as an update for Fedora 9.
http://admin.fedoraproject.org/updates/htop-0.8.2-2.fc9

Comment 12 Fedora Update System 2009-06-12 11:03:45 UTC
htop-0.8.2-2.fc11 has been submitted as an update for Fedora 11.
http://admin.fedoraproject.org/updates/htop-0.8.2-2.fc11

Comment 13 Fedora Update System 2009-06-16 01:20:25 UTC
htop-0.8.2-2.fc10 has been pushed to the Fedora 10 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 14 Fedora Update System 2009-06-16 01:39:15 UTC
htop-0.8.2-2.fc9 has been pushed to the Fedora 9 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 15 Fedora Update System 2009-06-16 01:45:32 UTC
htop-0.8.2-2.fc11 has been pushed to the Fedora 11 stable repository.  If problems still persist, please make note of it in this bug report.