Red Hat Bugzilla – Bug 130899
Incorrect save state for the "I" option in saved ~/.toprc
Last modified: 2007-11-30 17:07:03 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7)
Description of problem:
The "I" option in top, used to toggle Irix mode, is icorrectly saved
and restored from ~/.toprc, causing Irix mode to flip-flop every time
top is run.
This is how to reproduce the problem:
1) $ rm ~/.toprc
2) $ top
3) Save the current configuration pressing the W key
4) Quit top pressing the q key
5) ~/.toprc contains the I option even if it shouldn't!
6) run top again
7) Save the current configuration pressing the W key
8) Quit top pressing the q key
9) Now ~/.toprc does not contain I anymore!
So the I option was toggled withtout the user's intervention.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
Please see above
Actual Results: Please see above
Expected Results: Please see above
This is what happens:
in the source code for top, here is the "save options" code (top.c
fprintf(fp, "%c", 'I');
and this is the "parse options" code (top.c line 221):
Irixmode = 1;
in other words, "I" is saved to the file if the Irixmode variable is
false. At the same time, Irixmode is set to true if "I" is found in
the configuration file, and this leads to the unwanted toggling.
This can be fixed at least in two ways.
The two possibilities I can think of are either (file names and line
numbers refer to pristine source code + spec patches applied):
top.c line 1987: "if(!Irixmode)" becomes "if(Irixmode)"
top.c line 222: "Irixmode = 1" becomes "Irixmode = 0"
This last option is probably preferable and it would mean undoing the
second chunk in procps-2.0.13-noirixmode.patch which says:
--- procps-2.0.13/top.c.irixmode 2003-09-23
+++ procps-2.0.13/top.c 2003-09-23 12:26:32.000000000 +0200
@@ -219,7 +219,7 @@
- Irixmode = 0;
+ Irixmode = 1;
fprintf(stderr, "Wrong configuration
option %c\n", i);
and it was probably introduced by mistake with the noirixmode patch.
Have you looked at procps-2.0.17-10
It seems to have this fixed. It is in U3.