[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

rpms/procps/devel procps-3.2.7-ps-plussort.patch, NONE, 1.1 procps-3.2.7-ps-stime.patch, NONE, 1.1 procps-3.2.7-sysctl-tmpname.patch, NONE, 1.1 procps-3.2.7-watch-unicode.patch, NONE, 1.1 procps.spec, 1.60, 1.61



Author: tsmetana

Update of /cvs/pkgs/rpms/procps/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv11050

Modified Files:
	procps.spec 
Added Files:
	procps-3.2.7-ps-plussort.patch procps-3.2.7-ps-stime.patch 
	procps-3.2.7-sysctl-tmpname.patch 
	procps-3.2.7-watch-unicode.patch 
Log Message:
Resolves: #208217, #183029, #222251, fix buffer overflow in sysctl

procps-3.2.7-ps-plussort.patch:

--- NEW FILE procps-3.2.7-ps-plussort.patch ---
--- procps-3.2.7/ps/sortformat.c.old	2007-05-04 10:39:58.000000000 +0200
+++ procps-3.2.7/ps/sortformat.c	2007-05-04 10:40:46.000000000 +0200
@@ -325,7 +325,7 @@
   if(*spec == '-'){
     reverse = 1;
     spec++;
-  }
+  }else if (*spec == '+') spec++;
   fs = search_format_array(spec);
   if(fs){
     sort_node *thisnode;

procps-3.2.7-ps-stime.patch:

--- NEW FILE procps-3.2.7-ps-stime.patch ---
--- procps-3.2.7/ps/output.c.jitter	2007-04-26 13:15:47.000000000 +0200
+++ procps-3.2.7/ps/output.c	2007-04-26 13:31:24.000000000 +0200
@@ -77,7 +77,6 @@
 static int wide_signals;  /* true if we have room */
 
 static unsigned long seconds_since_1970;
-static unsigned long time_of_boot;
 static unsigned long page_shift;
 
 
@@ -1952,7 +1951,6 @@
   // available space:  page_size*outbuf_pages-SPACE_AMOUNT
 
   seconds_since_1970 = time(NULL);
-  time_of_boot = seconds_since_1970 - seconds_since_boot;
 
   meminfo();
 
--- procps-3.2.7/ps/common.h.jitter	2005-01-27 04:43:22.000000000 +0100
+++ procps-3.2.7/ps/common.h	2007-04-26 12:44:01.000000000 +0200
@@ -302,6 +302,7 @@
 extern int             screen_cols;
 extern int             screen_rows;
 extern unsigned long   seconds_since_boot;
+extern unsigned long   time_of_boot;
 extern selection_node *selection_list;
 extern unsigned        simple_select;
 extern sort_node      *sort_list;
--- procps-3.2.7/ps/global.c.jitter	2005-10-30 01:43:34.000000000 +0200
+++ procps-3.2.7/ps/global.c	2007-04-26 13:26:38.000000000 +0200
@@ -70,6 +70,7 @@
 int             screen_cols = -1;
 int             screen_rows = -1;
 unsigned long   seconds_since_boot = -1;
+unsigned long   time_of_boot = -1;
 selection_node *selection_list = (selection_node *)0xdeadbeef;
 unsigned        simple_select = 0xffffffff;
 sort_node      *sort_list = (sort_node *)0xdeadbeef; /* ready-to-use sort list */
@@ -361,7 +362,23 @@
   look_up_our_self(&p);
   set_screen_size();
   set_personality();
-  
+  int fd;
+  char *buf[BUFFSIZE];
+  const char *b;
+
+  /* get boot time from /proc/stat */
+  fd = open("/proc/stat", O_RDONLY, 0);
+  if (fd != -1) {
+    buf[BUFFSIZE-1] = 0;
+    read(fd, buf, BUFFSIZE-1);
+    b = strstr(buf, "btime ");
+    if (b) {
+      sscanf(b, "btime %lu", &time_of_boot);
+      seconds_since_boot = time(0) - time_of_boot;
+    }  
+    close(fd);
+  }
+    
   all_processes         = 0;
   bsd_c_option          = 0;
   bsd_e_option          = 0;
@@ -380,7 +397,6 @@
   negate_selection      = 0;
   page_size             = getpagesize();
   running_only          = 0;
-  seconds_since_boot    = uptime(0,0);
   selection_list        = NULL;
   simple_select         = 0;
   sort_list             = NULL;

procps-3.2.7-sysctl-tmpname.patch:

--- NEW FILE procps-3.2.7-sysctl-tmpname.patch ---
--- procps-3.2.7/sysctl.c.old	2007-04-25 16:38:30.000000000 +0200
+++ procps-3.2.7/sysctl.c	2007-04-25 16:39:12.000000000 +0200
@@ -174,7 +174,7 @@
    }
 
    /* used to open the file */
-   tmpname = malloc(strlen(name)+strlen(PROC_PATH)+1);
+   tmpname = malloc(strlen(name)+strlen(PROC_PATH)+2);
    strcpy(tmpname, PROC_PATH);
    strcat(tmpname, name); 
    slashdot(tmpname+strlen(PROC_PATH),'.','/'); /* change . to / */

procps-3.2.7-watch-unicode.patch:

--- NEW FILE procps-3.2.7-watch-unicode.patch ---
diff -u procps-3.2.7/Makefile procps/Makefile
--- procps-3.2.7/Makefile	2007-01-16 17:24:49.000000000 +0100
+++ procps/Makefile	2007-01-16 17:29:27.000000000 +0100
@@ -67,7 +67,7 @@
 # plus the top-level Makefile to make it work stand-alone.
 _TARFILES := Makefile
 
-CURSES := -lncurses
+CURSES := -lncursesw
 
 # This seems about right for the dynamic library stuff.
 # Something like this is probably needed to make the SE Linux
diff -u procps-3.2.7/watch.c procps/watch.c
--- procps-3.2.7/watch.c	2007-01-16 17:24:49.000000000 +0100
+++ procps/watch.c	2007-01-16 18:06:57.000000000 +0100
@@ -15,7 +15,7 @@
 #include <ctype.h>
 #include <getopt.h>
 #include <signal.h>
-#include <ncurses.h>
+#include <ncursesw/ncurses.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -28,6 +28,8 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
+#include <wchar.h>
+#include <wctype.h>
 
 #ifdef FORCE_8BIT
 #undef isprint
@@ -137,6 +139,27 @@
 	}
 }
 
+static wint_t
+readwc(FILE *stream, mbstate_t *mbs)
+{
+	for (;;) {
+		int chr;
+		char c;
+		wchar_t wc;
+		size_t len;
+
+		chr = getc(stream);
+		if (chr == EOF)
+			return WEOF;
+		c = chr;
+		len = mbrtowc(&wc, &c, 1, mbs);
+		if (len == (size_t)-1)
+			memset(mbs, 0, sizeof(*mbs));
+		else if (len != (size_t)-2)
+			return wc;
+	}
+}
+
 int
 main(int argc, char *argv[])
 {
@@ -243,6 +266,7 @@
 		FILE *p;
 		int x, y;
 		int oldeolseen = 1;
+		mbstate_t mbs;
 
 		if (screen_size_changed) {
 			get_terminal_size();
@@ -276,49 +300,63 @@
 			do_exit(2);
 		}
 
+		memset(&mbs, 0, sizeof(mbs));
 		for (y = show_title; y < height; y++) {
 			int eolseen = 0, tabpending = 0;
 			for (x = 0; x < width; x++) {
-				int c = ' ';
-				int attr = 0;
+				wint_t c = L' ';
+				int attr = 0, c_width;
+				cchar_t cc;
+				wchar_t wstr[2];
 
 				if (!eolseen) {
 					/* if there is a tab pending, just spit spaces until the
 					   next stop instead of reading characters */
 					if (!tabpending)
 						do
-							c = getc(p);
-						while (c != EOF && !isprint(c)
-						       && c != '\n'
-						       && c != '\t');
-					if (c == '\n')
+							c = readwc(p, &mbs);
+						while (c != WEOF && !iswprint(c)
+						       && c != L'\n'
+						       && c != L'\t');
+					if (c == L'\n')
 						if (!oldeolseen && x == 0) {
 							x = -1;
 							continue;
 						} else
 							eolseen = 1;
-					else if (c == '\t')
+					else if (c == L'\t')
 						tabpending = 1;
-					if (c == EOF || c == '\n' || c == '\t')
-						c = ' ';
+					if (c == WEOF || c == L'\n' || c == L'\t')
+						c = L' ';
 					if (tabpending && (((x + 1) % 8) == 0))
 						tabpending = 0;
 				}
+				wstr[0] = c;
+				wstr[1] = 0;
+				setcchar (&cc, wstr, 0, 0, NULL);
 				move(y, x);
 				if (option_differences) {
-					int oldch = inch();
-					char oldc = oldch & A_CHARTEXT;
+					cchar_t oldc;
+					wchar_t oldwstr[2];
+					attr_t attrs;
+					short colors;
+
+					in_wch(&oldc);
+					getcchar(&oldc, oldwstr, &attrs, &colors, NULL);
 					attr = !first_screen
-					    && (c != oldc
+					    && (wstr[0] != oldwstr[0]
 						||
 						(option_differences_cumulative
-						 && (oldch & A_ATTRIBUTES)));
+						 && attrs));
 				}
 				if (attr)
 					standout();
-				addch(c);
+				add_wch(&cc);
 				if (attr)
 					standend();
+				c_width = wcwidth(c);
+				if (c_width > 1)
+					x += c_width - 1;
 			}
 			oldeolseen = eolseen;
 		}


Index: procps.spec
===================================================================
RCS file: /cvs/pkgs/rpms/procps/devel/procps.spec,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -r1.60 -r1.61
--- procps.spec	2 Apr 2007 23:32:48 -0000	1.60
+++ procps.spec	23 May 2007 08:00:31 -0000	1.61
@@ -1,7 +1,7 @@
 Summary: System and process monitoring utilities
 Name: procps
 Version: 3.2.7
-Release: 11%{?dist}
+Release: 13%{?dist}
 License: GPL
 Group: Applications/System
 URL: http://procps.sourceforge.net
@@ -49,6 +49,13 @@
 Patch22: procps-3.2.7-top-sorthigh.path
 # 234546 - 'w' doesn't give correct information about what's being run.
 Patch23: procps-3.2.7-w-best.patch
+# 183029 - watch ignores unicode characters
+Patch24: procps-3.2.7-watch-unicode.patch
+Patch25: procps-3.2.7-sysctl-tmpname.patch
+# 222251 - STIME can jitter by one second
+Patch26: procps-3.2.7-ps-stime.patch
+#208217 - command "ps jax --sort=uid,-ppid,+pid" fails
+Patch27: procps-3.2.7-ps-plussort.patch
 
 BuildRequires: ncurses-devel
 
@@ -97,6 +104,10 @@
 %patch21 -p1
 %patch22 -p1
 %patch23 -p1
+%patch24 -p1
+%patch25 -p1
+%patch26 -p1
+%patch27 -p1
 
 cp %SOURCE1 .
 
@@ -134,6 +145,14 @@
 %attr(0644,root,root) %{_mandir}/man5/*
 
 %changelog
+* Tue May 22 2007 Tomas Smetana <tsmetana redhat com> 3.2.7-13
+- fix #208217 - ps does not accept '+' in sort specifier
+
+* Wed Apr 25 2007 Tomas Smetana <tsmetana redhat com> 3.2.7-12
+- fix #183029 - watch ignores multibyte characters
+- fix #222251 - STIME column can jitter
+- fix array overflow in sysctl
+
 * Tue Apr  3 2007 Karel Zak <kzak redhat com> 3.2.7-11
 - fix #234546 - 'w' doesn't give correct information about what's being run.
 - fix #228870 - process `sysctl' is using deprecated sysctl


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]