patches/glibc/2.7/250-sh-chop-linux-version.patch
author "Yann E. MORIN" <yann.morin.1998@free.fr>
Wed Jun 25 23:33:01 2014 +0200 (2014-06-25)
changeset 3325 069f43a215cc
permissions -rw-r--r--
all: fix wildcard to work with make-4.x

In make-3.8x, the $(wildacrd) function would sort the entries,
while in make-4.x, it would just return the entries in any
unpredictable order [*]

Use the $(sort) function to get reproducible behaviour.

[*] Well, most probably the roder the entries appear when read
from readdir()

Reported-by: Andrew Ruder <andrew.ruder@elecsyscorp.com>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Tested-by: Andrew Ruder <andrew.ruder@elecsyscorp.com>
     1 --- glibc-2.7/sysdeps/unix/sysv/linux/dl-osinfo.h.orig	2007-09-15 23:54:08.000000000 +0100
     2 +++ glibc-2.7/sysdeps/unix/sysv/linux/dl-osinfo.h	2008-08-20 09:26:26.000000000 +0100
     3 @@ -83,6 +83,10 @@
     4    int parts;
     5    char *cp;
     6    struct utsname uts;
     7 +  int dotsfound = 0;
     8 +  int versionindex = 0;
     9 +  char *choppoint;
    10 +
    11  
    12    /* Try the uname system call.  */
    13    if (__uname (&uts))
    14 @@ -102,8 +106,34 @@
    15    else
    16      buf = uts.release;
    17  
    18 +  /* We are only interested in the first three kernel numbers, so */
    19 +  /* chop off anything past that: */
    20 +
    21 +  choppoint = buf;
    22 +  while (1)
    23 +    {
    24 +      versionindex++;
    25 +      if (versionindex == 63) break;
    26 +      if (*choppoint == '.') dotsfound++;
    27 +      choppoint++;
    28 +      if (dotsfound == 2)
    29 +      {
    30 +        if (*choppoint == '0' || *choppoint == '1'
    31 +          || *choppoint == '2' || *choppoint == '3'
    32 +          || *choppoint == '4' || *choppoint == '5'
    33 +          || *choppoint == '6' || *choppoint == '7'
    34 +          || *choppoint == '8' || *choppoint == '9')
    35 +          continue;
    36 +        else
    37 +          {
    38 +            *choppoint = 0;
    39 +            break;
    40 +          }
    41 +      }
    42 +    }
    43 +
    44    /* Now convert it into a number.  The string consists of at most
    45 -     three parts.  */
    46 +     three parts.  Now it does, anyway.  ;-)  */
    47    version = 0;
    48    parts = 0;
    49    cp = buf;