Patchwork procps: don't print error message with kernel 3.0+

login
register
mail settings
Submitter Andreas Oberritter
Date March 27, 2012, 9:33 p.m.
Message ID <1332884004-5175-1-git-send-email-obi@opendreambox.org>
Download mbox | patch
Permalink /patch/24683/
State Accepted
Commit ec8c54946572200c4fb779ff1fe2d2848660acab
Headers show

Comments

Andreas Oberritter - March 27, 2012, 9:33 p.m.
* All procps tools print a message like this when the kernel
  version consists of only two numbers:

| Non-standard uts for running kernel:
| release ... gives version code ...

* Import a patch from Debian to quieten this message.

Signed-off-by: Andreas Oberritter <obi@opendreambox.org>
---
 .../procps/procps-3.2.8/gnu-kbsd-version.patch     |   44 ++++++++++++++++++++
 meta/recipes-extended/procps/procps_3.2.8.bb       |    3 +-
 2 files changed, 46 insertions(+), 1 deletions(-)
 create mode 100644 meta/recipes-extended/procps/procps-3.2.8/gnu-kbsd-version.patch
Saul Wold - April 3, 2012, 9:53 p.m.
On 03/27/2012 02:33 PM, Andreas Oberritter wrote:
> * All procps tools print a message like this when the kernel
>    version consists of only two numbers:
>
> | Non-standard uts for running kernel:
> | release ... gives version code ...
>
> * Import a patch from Debian to quieten this message.
>
> Signed-off-by: Andreas Oberritter<obi@opendreambox.org>
> ---
>   .../procps/procps-3.2.8/gnu-kbsd-version.patch     |   44 ++++++++++++++++++++
>   meta/recipes-extended/procps/procps_3.2.8.bb       |    3 +-
>   2 files changed, 46 insertions(+), 1 deletions(-)
>   create mode 100644 meta/recipes-extended/procps/procps-3.2.8/gnu-kbsd-version.patch
>

Merged into OE-Core

Thanks
	Sau!

Patch

diff --git a/meta/recipes-extended/procps/procps-3.2.8/gnu-kbsd-version.patch b/meta/recipes-extended/procps/procps-3.2.8/gnu-kbsd-version.patch
new file mode 100644
index 0000000..2582857
--- /dev/null
+++ b/meta/recipes-extended/procps/procps-3.2.8/gnu-kbsd-version.patch
@@ -0,0 +1,44 @@ 
+Upstream-Status: Inappropriate [not author, no upstream]
+
+Imported from Debian.
+Source: http://anonscm.debian.org/gitweb/?p=collab-maint/procps.git;a=blob;f=debian/patches/gnu-kbsd-version.patch;h=fe5489fc772a3355ff8c0dcf9b953bf0c05aa9f8;hb=b460cfd726b019f8d918b380f78af4c19c5f3e50
+Bugtracker: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=632749
+
+Stops procps utilities from printing a warning when used with
+kernels having only two digit versions, e.g. 3.0.
+
+Author: <csmall@debian.org>
+Description: Rework version parsing so its ok with other OSes
+--- a/proc/version.c
++++ b/proc/version.c
+@@ -35,15 +35,23 @@
+ 
+ static void init_Linux_version(void) __attribute__((constructor));
+ static void init_Linux_version(void) {
+-    static struct utsname uts;
+-    int x = 0, y = 0, z = 0;	/* cleared in case sscanf() < 3 */
++    int x = 0, y = 0, z = 0;	/* cleared in case sscanf() < 2 */
++    FILE *fp;
++    char buf[256];
+     
+-    if (uname(&uts) == -1)	/* failure implies impending death */
+-	exit(1);
+-    if (sscanf(uts.release, "%d.%d.%d", &x, &y, &z) < 3)
++    if ( (fp=fopen("/proc/version","r")) == NULL) /* failure implies impending death */
++      exit(1);
++    if (fgets(buf, 256, fp) == NULL) {
++      fprintf(stderr, "Cannot read kernel version from /proc/version\n");
++      fclose(fp);
++      exit(1);
++    }
++    fclose(fp);
++    if (sscanf(buf, "Linux version %d.%d.%d", &x, &y, &z) < 2)
+ 	fprintf(stderr,		/* *very* unlikely to happen by accident */
+ 		"Non-standard uts for running kernel:\n"
+-		"release %s=%d.%d.%d gives version code %d\n",
+-		uts.release, x, y, z, LINUX_VERSION(x,y,z));
++        "release %s=%d.%d.%d gives version code %d\n",
++        buf,
++        x, y, z, LINUX_VERSION(x,y,z));
+     linux_version_code = LINUX_VERSION(x, y, z);
+ }
diff --git a/meta/recipes-extended/procps/procps_3.2.8.bb b/meta/recipes-extended/procps/procps_3.2.8.bb
index 683badc..dfae0b8 100644
--- a/meta/recipes-extended/procps/procps_3.2.8.bb
+++ b/meta/recipes-extended/procps/procps_3.2.8.bb
@@ -1,6 +1,6 @@ 
 require procps.inc
 
-PR = "r6"
+PR = "r7"
 
 inherit update-alternatives
 
@@ -14,6 +14,7 @@  SRC_URI += "file://procmodule.patch \
             file://linux-limits.patch \
             file://sysctl.conf \
             file://procps-3.2.8+gmake-3.82.patch \
+            file://gnu-kbsd-version.patch \
            "
 
 SRC_URI[md5sum] = "9532714b6846013ca9898984ba4cd7e0"