Bugzilla will be upgraded to version 5.0 on a still to be determined date in the near future. The original upgrade date has been delayed.
Bug 130899 - Incorrect save state for the "I" option in saved ~/.toprc
Incorrect save state for the "I" option in saved ~/.toprc
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: procps (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Karel Zak
Brian Brock
Depends On:
  Show dependency treegraph
Reported: 2004-08-25 13:00 EDT by Pancrazio `ezio' de Mauro
Modified: 2007-11-30 17:07 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2004-11-18 02:59:14 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Pancrazio `ezio' de Mauro 2004-08-25 13:00:50 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7)
Gecko/20040803 Firefox/0.9.3

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):

How reproducible:

Steps to Reproduce:
Please see above

Actual Results:  Please see above

Expected Results:  Please see above

Additional info:

This is what happens:

in the source code for top, here is the "save options" code (top.c
line 1987):

       if (!Irixmode)
               fprintf(fp, "%c", 'I');

and this is the "parse options" code (top.c line 221):

       case 'I':
               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
12:26:28.000000000 +0200
       +++ procps-2.0.13/top.c 2003-09-23 12:26:32.000000000 +0200
       @@ -219,7 +219,7 @@
                       case '\n':
                       case 'I':
       -                       Irixmode = 0;
       +                       Irixmode = 1;
                               fprintf(stderr, "Wrong configuration
option %c\n", i);

and it was probably introduced by mistake with the noirixmode patch.
Comment 1 Daniel Walsh 2004-08-30 15:37:27 EDT
Have you looked at procps-2.0.17-10
  It seems to have this fixed.   It is in U3.


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