FS#25727 - [linux] uname -r reporting schema
Attached to Project:
Arch Linux
Opened by Gerhard Brauer (GerBra) - Tuesday, 23 August 2011, 11:16 GMT
Last edited by Dave Reisner (falconindy) - Wednesday, 24 August 2011, 22:22 GMT
Opened by Gerhard Brauer (GerBra) - Tuesday, 23 August 2011, 11:16 GMT
Last edited by Dave Reisner (falconindy) - Wednesday, 24 August 2011, 22:22 GMT
|
Details
Description:
uname -r shows "3.0-ARCH" on package linux 3.0.2-1. Shoudn't this not be: 3.0.2-ARCH? Current i have a piece of code which tests for kernel revision: -------- static int getmountver(void) { struct utsname name; int maj, mid, rev; int ver; if (uname(&name)) { errexit(1, _("Cannot get kernel release\n")); } if (sscanf(name.release, "%d.%d.%d", &maj, &mid, &rev) != 3) { errexit(2, _("Cannot convert kernel release \"%s\" to number\n"), name.release); } ver = maj*0x10000 + mid*0x100 + rev; if (ver < 0x20100) return 2; if (ver < 0x20328) return 3; if (ver < 0x2051F) return 4; return 5; } --------------------- Funktion uname gives name.release which seems a triple with major.minor.patchlevel. The prog breaks here on scanf with errexit (String ARCH is not a dezimal). I wonder if this function (uname) is a common used function and make problems also in other packages. But this is a piece of very old code, so maybe there a actually better possibilities to ask/check for the kernel version... So: any reason why uname -r reports 3.0-ARCH instead 3.0.2-ARCH ? |
This task depends upon
Closed by Dave Reisner (falconindy)
Wednesday, 24 August 2011, 22:22 GMT
Reason for closing: Not a bug
Additional comments about closing: User just needed a nudge in the right direction.
Wednesday, 24 August 2011, 22:22 GMT
Reason for closing: Not a bug
Additional comments about closing: User just needed a nudge in the right direction.
It breaks on: errexit(2, _("Cannot convert kernel release \"%s\" to number\n"), name.release);
Any hint for a common patch in such situations? The code is from old (2005) source from ncpfs. Do we have other packages where a patch exists to bypass such situations?
I'm not a c developer, so i could only make a dirty patch (i would try sscanf != 2 and remove rev var from the sum to build ver ...)
Or a replacement for uname lib function?
With your hints we were able to make a user, who must work with Novell OS (uhuhh) happy again ;-)
From my point (and with this special problem) the thread is solved... Don't know if it makes any sense to keep it open for further reference.