Adeodato Simó ha scritto: > Sorry, this diff is more than I'm willing to take. I prepared an upload for tpu to fix #502219 and #379592, I'd like to upload in t-p-u, for your approval. Attached the debdiff. Giuseppe Iuculano
diff -u procinfo-18/debian/patches/00list procinfo-18/debian/patches/00list --- procinfo-18/debian/patches/00list +++ procinfo-18/debian/patches/00list @@ -7,0 +8,2 @@ +09_procinfo_fix_high_interrupt.dpatch +10_fix_garbles_numbers_on_amd64.dpatch diff -u procinfo-18/debian/changelog procinfo-18/debian/changelog --- procinfo-18/debian/changelog +++ procinfo-18/debian/changelog @@ -1,3 +1,12 @@ +procinfo (18-2+lenny1) testing-proposed-updates; urgency=low + + * Fix a segfault caused by interrupts counting. (Closes: #502219) + * Set me as maintainer. + * Fix garbles numbers on amd64 (Closes: #379592) + * debian/rules: Do not ignore make clean error + + -- Giuseppe Iuculano <giuseppe@iuculano.it> Tue, 14 Oct 2008 23:12:03 +0200 + procinfo (18-2) unstable; urgency=low * New maintainer (closes: #384633). diff -u procinfo-18/debian/control procinfo-18/debian/control --- procinfo-18/debian/control +++ procinfo-18/debian/control @@ -1,7 +1,7 @@ Source: procinfo Section: utils Priority: optional -Maintainer: Antonio José Calderón <neo@neocalderon.net> +Maintainer: Giuseppe Iuculano <giuseppe@iuculano.it> Build-Depends: libncurses5-dev, debhelper (>= 5), dpatch Standards-Version: 3.7.2 diff -u procinfo-18/debian/rules procinfo-18/debian/rules --- procinfo-18/debian/rules +++ procinfo-18/debian/rules @@ -29,7 +29,7 @@ dh_testdir dh_testroot rm -f build-stamp - $(MAKE) -i clean + [ ! -f Makefile ] || $(MAKE) clean dh_clean install: build only in patch2: unchanged: --- procinfo-18.orig/debian/patches/09_procinfo_fix_high_interrupt.dpatch +++ procinfo-18/debian/patches/09_procinfo_fix_high_interrupt.dpatch @@ -0,0 +1,158 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 09_procinfo_fix_high_interrupt.dpatch by Giuseppe Iuculano <giuseppe@iuculano.it> +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: Fix segfault caused by interrupts counting + +@DPATCH@ +diff -urNad procinfo-18~/procinfo.c procinfo-18/procinfo.c +--- procinfo-18~/procinfo.c 2008-10-14 22:16:17.844235046 +0200 ++++ procinfo-18/procinfo.c 2008-10-14 22:27:57.158390839 +0200 +@@ -499,22 +499,31 @@ + + if (nr_irqs) { + char irq_label[nr_irqs][22]; ++ unsigned real_irq_nums[nr_irqs]; ++ unsigned real_nr_irqs = 0U; + + memset (irq_label, 0, nr_irqs * 22); + + if (interruptsfp) { +- int i; + + fseek (interruptsfp, 0L, SEEK_SET); + while (fgets (line, sizeof (line), interruptsfp)) { ++ char *endptr; + char *p; ++ int i; + + if (!strchr(line, ':')) /* skip " CPU0" */ + continue; + +- i = atol (strtok (line, ":")); /* Get the IRQ no. */ +- +- p = strtok (NULL, "\n"); ++ /* Get the IRQ no. */ ++ p = strtok(line, ":"); ++ endptr = NULL; ++ real_irq_nums[real_nr_irqs] = strtol(p, &endptr, 10); ++ if (endptr == p) /* Not a number */ ++ { ++ continue; ++ } ++ p = strtok (NULL, " "); + + /* + Left: p = " 31273 + serial" +@@ -523,38 +532,24 @@ + or whatever. + Anyway, let's first gobble up... + */ +- +- while (*p == ' ') /* ...spaces... */ +- p++; +- while (*p >= '0' && *p <= '9') /* ...digits... */ +- p++; +- while (*p == ' ' || *p == '+') /* ...and the rest. */ +- p++; ++ for (i = 0; i < nr_cpus; i++) ++ p = strtok(NULL, " "); + + /* Left: "serial" or "XT PIC serial" */ + + if (linux_version_code >= 0x20150) { +- /* +- I don't really like hardcoding version numbers, but +- since the label itself may contain spaces, I can't +- think of a fool-proof algorithm to detect a "XT PIC" +- style /proc/interrupts. +- */ +- char *q; +- +- if ((q = strstr (p, "PIC"))) { +- while (*q != ' ') /* eat up "PIC" or "PIC-foo" */ +- q++; +- while (*q == ' ') /* eat up spaces */ +- q++; +- p = q; +- } ++ p = strtok(NULL, " "); + } ++ if (p[strlen(p) - 1] == '\n') ++ p[strlen(p) - 1] = '\0'; ++ + + /* XXX Don't let NMI:, IPI: overwrite real values */ +- if (irq_label[i][0] == 0) +- strncpy (irq_label[i], p, 20); ++ if (irq_label[real_nr_irqs][0] == 0) { ++ strncpy (irq_label[real_nr_irqs], p, 20); ++ ++real_nr_irqs; + } ++ } + } + + +@@ -569,7 +564,7 @@ + while (fgets (line, sizeof (line), dmafp)) { + int foo = strcspn (&line[4], " \n"); + +- for (i = 0; i < nr_irqs; i++) { ++ for (i = 0; i < real_nr_irqs; i++) { + if (strncmp (&line[4], irq_label[i], foo) == 0) { + tmplen = sprintf (tmp, " [%ld]", + atol (strtok (line, ":"))); +@@ -594,9 +589,9 @@ + char *label; + } squirqs[nr_irqs]; + +- for (i = 0; i < nr_irqs; i++) { ++ for (i = 0; i < real_nr_irqs; i++) { + if (new.intr[i] || irq_label[i][0]) { +- squirqs[howmany].nr = i; ++ squirqs[howmany].nr = real_irq_nums[i]; + squirqs[howmany].count = bDIFF(intr[i]); + squirqs[howmany].label = irq_label[i]; + howmany++; +@@ -608,11 +603,11 @@ + for (i = 0; i < rows; i++) { + /* The last row may be incomplete if howmany is odd, hence: */ + if (i == rows - 1 && howmany & 1) { +- printf ("irq%3d:%10lu %-21s\n", ++ printf ("irq%4d:%10lu %-21s\n", + squirqs[i].nr, squirqs[i].count, squirqs[i].label); + } else { +- printf ("irq%3d:%10lu %-21s " +- "irq%3d:%10lu %-21s\n", ++ printf ("irq%4d:%10lu %-21s " ++ "irq%4d:%10lu %-21s\n", + squirqs[i].nr, squirqs[i].count, squirqs[i].label, + squirqs[i+rows].nr, + squirqs[i+rows].count, +@@ -620,10 +615,10 @@ + } + } + } else { +- for (i = 0; i < nr_irqs / 2; i++) ++ for (i = 0; i < real_nr_irqs / 2; i++) + printf ("irq%3d:%10lu %-21s " + "irq%3d:%10lu %-21s\n", +- i, bDIFF (intr[i]), irq_label[i], ++ real_irq_nums[i], bDIFF (intr[i]), irq_label[i], + i + (nr_irqs / 2), + bDIFF (intr[i + (nr_irqs / 2)]), + irq_label[i + (nr_irqs / 2)]); +@@ -944,10 +939,10 @@ + for(i = 5; i < len; i++) + if(line[i] == ' ') + nr_irqs++; +- new.intr = my_xcalloc (nr_irqs, sizeof (unsigned int)); +- old.intr = my_xcalloc (nr_irqs, sizeof (unsigned int)); ++ new.intr = my_xcalloc (nr_irqs, sizeof (unsigned long)); ++ old.intr = my_xcalloc (nr_irqs, sizeof (unsigned long)); + memset (&base, 0, sizeof (struct info)); +- base.intr = my_xcalloc (nr_irqs, sizeof (unsigned int)); ++ base.intr = my_xcalloc (nr_irqs, sizeof (unsigned long)); + continue; + } + /* While we're at it, fill in booted. */ only in patch2: unchanged: --- procinfo-18.orig/debian/patches/10_fix_garbles_numbers_on_amd64.dpatch +++ procinfo-18/debian/patches/10_fix_garbles_numbers_on_amd64.dpatch @@ -0,0 +1,30 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 10_fix_garbles_numbers_on_amd64.dpatch by Giuseppe Iuculano <giuseppe@iuculano.it> +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: Fix garbles numbers on AMD64. + +@DPATCH@ +diff -urNad procinfo-18~/procinfo.c procinfo-18/procinfo.c +--- procinfo-18~/procinfo.c 2008-10-14 22:43:05.208233922 +0200 ++++ procinfo-18/procinfo.c 2008-10-14 22:44:01.774419367 +0200 +@@ -79,7 +79,7 @@ + + char line[1024], cmdline[1024], booted[40], *version = NULL, *message = NULL; + +-float rate = 1.0; /* per interval or per sec */ ++double rate = 1.0; /* per interval or per sec */ + + struct info new, old, base; + struct utsname ut; +@@ -1144,8 +1144,8 @@ + then = now; + gettimeofday (&now, 0); + if (per_sec) +- rate = (float) now.tv_sec + (float) now.tv_usec / 1.0e6 - +- (float) then.tv_sec - (float) then.tv_usec / 1.0e6; ++ rate = (double) now.tv_sec + (float) now.tv_usec / 1.0e6 - ++ (double) then.tv_sec - (double) then.tv_usec / 1.0e6; + + } else { + putchar ('\n');
Attachment:
signature.asc
Description: OpenPGP digital signature