• Andi Kleen's avatar
    Add a personality to report 2.6.x version numbers · be27425d
    Andi Kleen authored
    I ran into a couple of programs which broke with the new Linux 3.0
    version.  Some of those were binary only.  I tried to use LD_PRELOAD to
    work around it, but it was quite difficult and in one case impossible
    because of a mix of 32bit and 64bit executables.
    For example, all kind of management software from HP doesnt work, unless
    we pretend to run a 2.6 kernel.
      $ uname -a
      Linux svivoipvnx001 3.0.0-08107-g97cd98f #1062 SMP Fri Aug 12 18:11:45 CEST 2011 i686 i686 i386 GNU/Linux
      $ hpacucli ctrl all show
      Error: No controllers detected.
      $ rpm -qf /usr/sbin/hpacucli
    Another notable case is that Python now reports "linux3" from
    sys.platform(); which in turn can break things that were checking
    sys.platform() == "linux2":
    It seems pretty clear to me though it's a bug in the apps that are using
    '==' instead of .startswith(), but this allows us to unbreak broken
    This patch adds a UNAME26 personality that makes the kernel report a
    2.6.40+x version number instead.  The x is the x in 3.x.
    I know this is somewhat ugly, but I didn't find a better workaround, and
    compatibility to existing programs is important.
    Some programs also read /proc/sys/kernel/osrelease.  This can be worked
    around in user space with mount --bind (and a mount namespace)
    To use:
      wget ftp://ftp.kernel.org/pub/linux/kernel/people/ak/uname26/uname26.c
      gcc -o uname26 uname26.c
      ./uname26 program
    Signed-off-by: default avatarAndi Kleen <ak@linux.intel.com>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>