Bug 67551 - "rup -l" with list of hostnames doesn't work as expected.
"rup -l" with list of hostnames doesn't work as expected.
Status: CLOSED RAWHIDE
Product: Red Hat Linux
Classification: Retired
Component: rusers (Show other bugs)
7.3
All Linux
medium Severity medium
: ---
: ---
Assigned To: Phil Knirsch
Ben Levenson
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2002-06-27 07:33 EDT by Hannu Martikka
Modified: 2015-03-04 20:10 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2002-06-27 07:33:59 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Hannu Martikka 2002-06-27 07:33:54 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.0) Gecko/20020607

Description of problem:
Running "rup -l host1 host2 host3..." doesn't sort the hostnames correctly
(actually it doesn't sort them at all).

This is a problem in older RH versions also.

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


How reproducible:
Always

Steps to Reproduce:
1.rup -l host1 host2 host3
2.
3.
	

Actual Results:  "rup -l host1 host2 host3" displays hosts in random order. With
-l the rup should sort the display by load average. 
"rup -l" (without any hostnames) works, but not with the list of hosts.


Expected Results:  It should sort the display by load average with "-l" as
described in manual even with the list of hostnames.

Additional info:

Here's a patch for it:

netkit-rusers-0.17-sort.patch

--- rup/rup.c.orig      Sat Jul 22 22:51:40 2000
+++ rup/rup.c   Thu Apr 25 12:28:35 2002
@@ -256,19 +256,46 @@
        memset(&host_stat, 0, sizeof(host_stat));
        if (clnt_call(rstat_clnt, RSTATPROC_STATS, 
                      (xdrproc_t) xdr_void, NULL, 
-                     (xdrproc_t) xdr_statstime, &host_stat, 
+                     (xdrproc_t) xdr_statstime,
+                     (caddr_t) &host_stat, 
                      foo) != RPC_SUCCESS) 
        {
                warnx("%s",  clnt_sperror(rstat_clnt, host));
                return;
        }
-
-       print_rup_data(host, &host_stat);
+       if (sort_type != SORT_NONE) {
+               remember_rup_data(host, &host_stat);
+       } else {
+               print_rup_data(host, &host_stat);
+       }
        clnt_destroy(rstat_clnt);
 }
 
 static
 void
+enumhosts(int argc, char *argv[], int optind)
+{
+       if (sort_type != SORT_NONE) {
+               printf("collecting responses...");
+               fflush(stdout);
+       }
+
+       for (; optind < argc; optind++)
+               onehost(argv[optind]);
+
+       if (sort_type != SORT_NONE) {
+               int i;
+               putchar('\n');
+               qsort(rup_data, rup_data_idx, sizeof(struct rup_data), compare);
+
+               for (i = 0; i < rup_data_idx; i++) {
+                       print_rup_data(rup_data[i].host, &rup_data[i].statstime);
+               }
+       }
+}
+
+static
+void
 allhosts(void)
 {
        statstime host_stat;
@@ -337,10 +364,8 @@
 
        if (argc == optind)
                allhosts();
-       else {
-               for (; optind < argc; optind++)
-                       onehost(argv[optind]);
-       }
+       else
+               enumhosts(argc, argv, optind);
 
        exit(0);
 }
Comment 1 Phil Knirsch 2002-07-17 09:40:22 EDT
Fixed in rawhide package rusers-0.17-20

Read ya, Phil

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