rpms/procps/devel procps-3.2.5-sysctl-ignore.patch, NONE, 1.1 procps-3.2.7-top-sorthigh.path, NONE, 1.1 procps.spec, 1.57, 1.58

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Mon Feb 5 08:21:15 UTC 2007


Author: kzak

Update of /cvs/dist/rpms/procps/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv3132

Modified Files:
	procps.spec 
Added Files:
	procps-3.2.5-sysctl-ignore.patch 
	procps-3.2.7-top-sorthigh.path 
Log Message:
* Mon Feb  5 2007 Karel Zak <kzak at redhat.com> 3.2.7-10
- fix #212637 - sysctl using deprecated syscall
- fix #140975 - top corrupts screen when sorting on first column
- Resolves: rhbz#212637 rhbz#140975


procps-3.2.5-sysctl-ignore.patch:
 sysctl.c |   49 ++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 46 insertions(+), 3 deletions(-)

--- NEW FILE procps-3.2.5-sysctl-ignore.patch ---

 Don't touch deprecated syscalls when run "sysctl -a".

 Karel Zak <kzak at redhat.com> 

--- procps-3.2.7/sysctl.c.ignore	2006-11-28 12:14:19.000000000 +0100
+++ procps-3.2.7/sysctl.c	2006-11-28 12:56:32.000000000 +0100
@@ -63,6 +63,43 @@
 static const char ERR_PRELOAD_FILE[] = "error: unable to open preload file \"%s\"\n";
 static const char WARN_BAD_LINE[] = "warning: %s(%d): invalid syntax, continuing...\n";
 
+/* Ignore deprecated sysctls
+ * -- we use this list when we scan (DisplayAll) /proc/sys only. We don't use it
+ *    in case when user direcly uses deprecated key. It's better when user can read
+ *    an error message from kernel.
+ */
+struct sysctl_ignore {
+	const char *prefix;
+	int        prefix_len;
+	const char *option;
+	int        option_len;
+};
+
+#define IGNORE_ENTRY(prefix, option) \
+		{ prefix, sizeof(prefix)-1, option, sizeof(option)-1 }
+
+static struct sysctl_ignore Ignore[] =
+{
+	IGNORE_ENTRY( "net.ipv6.neigh", "base_reachable_time" )
+};
+
+static bool IsIgnored(const char *name)
+{
+  unsigned int i;
+  int sz = strlen(name);
+
+  for (i = 0; i < sizeof(Ignore)/sizeof(struct sysctl_ignore); i++) {
+     struct sysctl_ignore *p = &Ignore[i];
+
+     if (sz < (p->prefix_len + p->option_len))
+	     continue;
+
+     if (strncmp(name, p->prefix, p->prefix_len) == 0 &&
+         strcmp(name + (sz - p->option_len), p->option) == 0)
+       return true;
+  }
+  return false;
+}
 
 static void slashdot(char *restrict p, char old, char new){
   p = strpbrk(p,"/.");
@@ -122,7 +159,7 @@
  *     Read a sysctl setting 
  *
  */
-static int ReadSetting(const char *restrict const name) {
+static int ReadSetting(const char *restrict const name, bool useign) {
    int rc = 0;
    char *restrict tmpname;
    char *restrict outname;
@@ -145,6 +182,12 @@
    outname = strdup(name);
    slashdot(outname,'/','.'); /* change / to . */
 
+   if (useign && IsIgnored(outname)) {
+     free(outname);
+     free(tmpname);
+     return rc;
+   }
+
    if (stat(tmpname, &st)==0) {
 	if (st.st_mode & (S_IRUSR|S_IROTH|S_IRGRP))	   
 	   	fp = fopen(tmpname, "r");
@@ -257,7 +300,7 @@
                strcat(tmpdir, "/");
                DisplayAll(tmpdir);
             } else {
-               rc |= ReadSetting(tmpdir+strlen(PROC_PATH));
+               rc |= ReadSetting(tmpdir+strlen(PROC_PATH), true);
             }
          }
          free(tmpdir);
@@ -519,7 +562,7 @@
          if (WriteMode || index(*argv, '='))
             ReturnCode = WriteSetting(*argv);
          else
-            ReturnCode = ReadSetting(*argv);
+            ReturnCode = ReadSetting(*argv, false);
       }
    }
 


--- NEW FILE procps-3.2.7-top-sorthigh.path ---
--- procps-3.2.7/top.c.sorthigh	2007-02-05 09:06:34.000000000 +0100
+++ procps-3.2.7/top.c	2007-02-05 09:09:35.000000000 +0100
@@ -3121,6 +3121,7 @@
       unsigned    w = Fieldstab[i].width;
 
       int advance = (x==0) && !Rc.mode_altscr;
+      f += advance;
 
       switch (i) {
          case P_CMD:
@@ -3179,7 +3180,7 @@
             break;
          case P_PRI:
             if (unlikely(-99 > p->priority) || unlikely(999 < p->priority)) {
-               f = "  RT";
+               f = advance ? " RT" : "  RT";
                MKCOL("");
             } else
                MKCOL((int)p->priority);
@@ -3227,7 +3228,7 @@
             break;
          case P_WCH:
             if (No_ksyms) {
-               f = " %08lx ";
+               f = advance ? "%08lx " : " %08lx ";
                MKCOL((long)p->wchan);
             } else {
                MKCOL(lookup_wchan(p->wchan, p->XXXID));
@@ -3236,7 +3237,7 @@
 
         } /* end: switch 'procflag' */
 
-        rp = scat(rp, cbuf+advance);
+        rp = scat(rp, cbuf);
    } /* end: for 'maxpflgs' */
 
    PUFF(


Index: procps.spec
===================================================================
RCS file: /cvs/dist/rpms/procps/devel/procps.spec,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -r1.57 -r1.58
--- procps.spec	30 Jan 2007 11:47:47 -0000	1.57
+++ procps.spec	5 Feb 2007 08:21:13 -0000	1.58
@@ -1,7 +1,7 @@
 Summary: System and process monitoring utilities.
 Name: procps
 Version: 3.2.7
-Release: 9
+Release: 10
 License: GPL
 Group: Applications/System
 Source: http://procps.sourceforge.net/procps-%{version}.tar.gz
@@ -42,6 +42,10 @@
 Patch19: procps-3.2.7-top-single.patch
 # 199174 - top returns with exit code 1 even if no error occurs
 Patch20: procps-3.2.7-top-exitcode.patch
+# 212637 - sysctl using deprecated syscall
+Patch21: procps-3.2.5-sysctl-ignore.patch
+# 140975 - top corrupts screen when sorting on first column
+Patch22: procps-3.2.7-top-sorthigh.path
 
 BuildRequires: ncurses-devel
 
@@ -87,6 +91,8 @@
 %patch18 -p1
 %patch19 -p1
 %patch20 -p1
+%patch21 -p1
+%patch22 -p1
 
 cp %SOURCE1 .
 
@@ -124,6 +130,10 @@
 %attr(0644,root,root) %{_mandir}/man5/*
 
 %changelog
+* Mon Feb  5 2007 Karel Zak <kzak at redhat.com> 3.2.7-10
+- fix #212637 - sysctl using deprecated syscall
+- fix #140975 - top corrupts screen when sorting on first column
+
 * Tue Jan 30 2007 Karel Zak <kzak at redhat.com> 3.2.7-9
 - fix procps_version in FAQ patch (thanks to Ian Kent)
 




More information about the fedora-cvs-commits mailing list