Bug 340 - procps-1.2.9 bug fix - sorting in reverse order w/short options
Summary: procps-1.2.9 bug fix - sorting in reverse order w/short options
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: procps
Version: 5.2
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Michael K. Johnson
QA Contact:
Depends On:
TreeView+ depends on / blocked
Reported: 1998-12-08 03:23 UTC by prince
Modified: 2008-05-01 15:37 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 1999-05-16 21:47:15 UTC

Attachments (Terms of Use)

Description prince 1998-12-08 03:23:56 UTC
The Problem

Sorting in reverse order with short options didn't work.
Also, sorting in unreversed order didn't work if the
optional '+' was specified.  Example: generate a list of
processes sorted in order by pid.  The following two
commands should generate identical results, but didn't.

ps auxOp
ps auxO+p

The Solution

Fix one file, proc/compare.c, as follows, to remove the
offending line. Of course, you can just delete the
offending line rather than comment it out as I've done here.

mystic:/usr/src/redhat/BUILD/procps-1.2.9/proc $ diff -u
compare_old.c compare.c
--- compare_old.c       Mon Dec  7 00:09:23 1998
+++ compare.c   Sun Dec  6 23:44:37 1998
@@ -226,7 +226,15 @@
         if (*opt == '-' || *opt == '+') {
             if (*opt == '-')
                 next_dir = -1;
+            /* [prince] Sun Dec  6 23:38:15 PST 1998
+               The commands "ps -auxOp" and "ps -auxO+p"
should produce
+               identical results, but they don't because
this function
+               incorrectly skips the character after the
'-' or '+' in
+               short option lists.  The '++opt' in the for
() statement will
+               skip past the '-' or '+' anyway.
+               Old Code:
+              End Old Code */
         for (i = 0; cmp[i].letter; i++)

Comment 1 Michael K. Johnson 1999-02-11 20:42:59 UTC
Will be fixed in procps 1.2.10 or procps 2.0.x, whichever comes first.

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