[lkml]   [2011]   [Jun]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: Linux 3.0-rc3
On Tue, Jun 14, 2011 at 5:15 AM, Denys Vlasenko
<> wrote:
> I've got a patch for my project to fix parsing of kernel version which
> has only two numbers. Basically,
> - scanf(ver, "%u.%u.%u", &a, &b, &c)
> + sscanf(ver, "%u.%u", &a, &b)

Please just fix it.

The projects that care about kernel version are buggy in so many ways
that it's not funny.

It's not just the "two versus three digits" bug either. The *bigger*
bug is usually that the tests are done the wrong way entirely, namely
to fail when you cannot parse the version. And that's just f*%!ing

If you cannot parse the version, then rather than fail, a project
should have gone "uh, it's some future version that I don't recognize
or some other OS entirely, so I'll just do whatever the most modern
thing is". Having an "assert()" or returning an error is just the mark
of incompetence.

So please just fix things. Preferably by removing the version check
entirely, but if you really feel that you cannot do that, then AT
LEAST realize that the reason you're looking at the version is to
support *old* versions, not new ones, and make the logic work that way
(so that next time around, when we change the version numbers to be
sanscrit characters and you fail parsing them *again*, you don't
actually fail, you just go "oh, this is modern" and go on with your

In other words: don't be stupid.



 \ /
  Last update: 2011-06-14 20:03    [W:0.161 / U:6.604 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site