Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 161449 - "top" ignores user and system toprc
Summary: "top" ignores user and system toprc
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: procps
Version: 4
Hardware: i686
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Karel Zak
QA Contact: Brian Brock
URL:
Whiteboard:
: 162941 163411 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2005-06-23 15:00 UTC by Michael Lee Yohe
Modified: 2007-11-30 22:11 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2005-07-11 11:29:03 UTC


Attachments (Terms of Use)
strace output of top when it ignores system toprc and user toprc (deleted)
2005-06-23 15:02 UTC, Michael Lee Yohe
no flags Details
toprc (user and system) - tried both (deleted)
2005-06-23 15:03 UTC, Michael Lee Yohe
no flags Details
bug fix patch (deleted)
2005-06-28 16:10 UTC, Karel Zak
no flags Details | Diff
second version of the patch (deleted)
2005-06-28 20:55 UTC, Karel Zak
no flags Details | Diff
bug fix patch (deleted)
2005-06-28 21:04 UTC, Karel Zak
no flags Details | Diff

Description Michael Lee Yohe 2005-06-23 15:00:11 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.8) Gecko/20050511 Firefox/1.0.4

Description of problem:
I did a fresh install of Fedora Core 4 on a computer and have come to realize that "top" is ignoring $HOME/.toprc and /etc/toprc.  I did an strace on top and it seems to be encountering an error with the toprc format generated by - you guessed it - top.

I did not have this problem on a Fedora Core 3 box.

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

How reproducible:
Always

Steps to Reproduce:
1. Run top.
2. Configure, as desired, for the display.
3. "w" to write out a user-configuration file.
4. Quit top.
5. Reload top.
  

Actual Results:  Top reverts to default display mode.

Expected Results:  Top reads the $HOME/.toprc and restores user configured display.

Additional info:

$ rpm -qif `which top`
Name        : procps                       Relocations: (not relocatable)
Version     : 3.2.5                             Vendor: Red Hat, Inc.
Release     : 6                             Build Date: Tue 10 May 2005 09:52:03 AM CDT
Install Date: Wed 22 Jun 2005 02:45:23 PM CDT      Build Host: decompose.build.redhat.com
Group       : Applications/System           Source RPM: procps-3.2.5-6.src.rpm
Size        : 358119                           License: GPL
Signature   : DSA/SHA1, Fri 20 May 2005 12:40:47 PM CDT, Key ID b44269d04f2a6fd2
Packager    : Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla>
Summary     : System and process monitoring utilities.
Description :
The procps package contains a set of system utilities that provide
system information. Procps includes ps, free, skill, snice, tload,
top, uptime, vmstat, w, and watch. The ps command displays a snapshot
of running processes. The top command provides a repetitive update of
the statuses of running processes. The free command displays the
amounts of free and used memory on your system. The skill command
sends a terminate command (or another specified signal) to a specified
set of processes. The snice command is used to change the scheduling
priority of specified processes. The tload command prints a graph of
the current system load average to a specified tty. The uptime command
displays the current time, how long the system has been running, how
many users are logged on, and system load averages for the past one,
five, and fifteen minutes. The w command displays a list of the users
who are currently logged on and what they are running. The watch
program watches a running program. The vmstat command displays virtual
memory statistics about processes, memory, paging, block I/O, traps,
and CPU activity.

Excerpt from strace (I will attach strace log to this bug later).

open("/etc/toprc", O_RDONLY)            = 3
read(3, "RCfile for \"top with windows\"\t\t#"..., 1087) = 605
close(3)                                = 0
open("/home/myohe/.toprc", O_RDONLY)    = 3
read(3, "RCfile for \"top with windows\"\t\t#"..., 1085) = 605
close(3)                                = 0

Comment 1 Michael Lee Yohe 2005-06-23 15:02:30 UTC
Created attachment 115876 [details]
strace output of top when it ignores system toprc and user toprc

Comment 2 Michael Lee Yohe 2005-06-23 15:03:06 UTC
Created attachment 115877 [details]
toprc (user and system) - tried both

Comment 3 Michael Lee Yohe 2005-06-23 18:48:01 UTC
Does this have anything to do with "top" being in secure mode?  I cannot find
documentation on this behavioral change.  Please advise.

Comment 4 Karel Zak 2005-06-28 16:10:59 UTC
Created attachment 116068 [details]
bug fix patch

The problem is in the top.c: windows_stage1() function where is bad code that
doesn't work with gcc4.

The bug fix should be available in next procps update (this or next week).

Comment 5 Michael Lee Yohe 2005-06-28 17:58:45 UTC
I rebuilt the package using the bugfix you provided.  I still receive the same
results.

From strace:
open("/etc/toprc", O_RDONLY)            = -1 ENOENT (No such file or directory)
open("/home/myohe/.toprc", O_RDONLY)    = 3
read(3, "RCfile for \"top with windows\"\t\t#"..., 1085) = 605
close(3)                                = 0

From spec file:
Patch1: procps-3.2.5-selinux.patch
Patch2: procps-3.1.15-misc.patch
Patch3: procps-3.2.3-FAQ.patch
Patch4: procps-3.2.1-selinux-workaround.patch
Patch5: procps-3.2.1-top-vmsize-env.patch
Patch6: procps-3.2.3-noproc.patch
Patch7: procps-3.2.3-pseudo.patch
Patch8: procps-3.2.4-0x9b.patch
Patch9: procps-3.2.5-sysctl-writeonly.patch
Patch10: procps-3.2.5-gcc4.patch

From procps-3.2.5-gcc4.patch:
--- procps-3.2.5/top.c.rc   2005-06-28 17:53:14.000000000 +0200
+++ procps-3.2.5/top.c  2005-06-28 17:58:36.000000000 +0200
@@ -2365,7 +2365,7 @@
    for (i = 0; i < GROUPSMAX; i++) {
       w = &Winstk[i];
       w->winnum = i + 1;
-      w->rc = Rc.win[i];
+      memcpy(&w->rc, &Rc.win[i], sizeof(RCF_t));
       w->captab[0] = Cap_norm;
       w->captab[1] = Cap_norm;
       w->captab[2] = w->cap_bold;
@@ -2375,9 +2375,10 @@
       w->captab[6] = w->capclr_hdr;
       w->captab[7] = w->capclr_rowhigh;
       w->captab[8] = w->capclr_rownorm;
-      w->next = w + 1;
-      w->prev = w - 1;
-      ++w;
+      if (i < GROUPSMAX+1)
+         w->next = w + 1;
+      if (i > 0)
+         w->prev = w - 1;
    }
       /* fixup the circular chains... */
    Winstk[3].next = &Winstk[0];

Patch applied without issue.  Any clues?

Comment 6 Michael Lee Yohe 2005-06-28 17:59:53 UTC
Oh - I forgot to add that I did have "%patch10 -p1 -b .gcc4" in the spec file.

Comment 7 Michael Lee Yohe 2005-06-28 18:08:50 UTC
I took a hint from your reply that GCC 4 is the cause.  So, I changed the SPEC
file to "gcc32" (compat-gcc-32 installed), and rebuilt - everything works great.
So there must be another GCC 4 quirk somewhere that has yet to be found.

Comment 8 Karel Zak 2005-06-28 19:46:30 UTC
Sorry, the patch is wrong. Problem is -O2 gcc4 option; with -O0 it works fine.

Comment 9 Karel Zak 2005-06-28 20:55:05 UTC
Created attachment 116089 [details]
second version of the patch

Comment 10 Karel Zak 2005-06-28 20:58:10 UTC
Ooops.. bad day, I sent previous version of the patch.

Comment 11 Karel Zak 2005-06-28 21:04:20 UTC
Created attachment 116090 [details]
bug fix patch

Comment 12 Karel Zak 2005-07-11 11:29:03 UTC
Fixed in procps-3.2.5-6.3 (FC4) and procps-3.2.3-5.3 (FC3).

Comment 13 Karel Zak 2005-07-11 20:16:14 UTC
*** Bug 162941 has been marked as a duplicate of this bug. ***

Comment 14 Karel Zak 2005-07-17 08:48:02 UTC
*** Bug 163411 has been marked as a duplicate of this bug. ***


Note You need to log in before you can comment on or make changes to this bug.