Hacker News new | past | comments | ask | show | jobs | submit login

The switch from 2.4 to 2.6 had a lot of changes and a lot of programs needed to check the version to see which behavior to use. There are two ways to do that shown below in psuedo-python. This first way has no trouble with 3.x versions.

if kernel_version.startswith('2.4.'): DO_A else: DO_B

On the other hand, if you check for 2.6 instead of checking for 2.4... Well when it encounters 3.0 the code falls back to 2.4 behavior.

if kernel_version.startswith('2.6.'): DO_B else: DO_A

Sadly a number of binary only RAID tools don't really get updated much and have these problems. There is a program in util-linux named uname26 that you can run these tools under which gives them the 2.6.40+ version numbers.

This is just one of those tricks operating systems have to resort to from time to time, its like how Microsoft is skipping Windows 9 because of how many programs execute version.startswith('Windows 9') and assuming that means Win95/Win98.




Thank you for the explanation.

> like how Microsoft is skipping Windows 9 because of how many programs execute version.startswith('Windows 9') and assuming that means Win95/Win98.

Has this been confirmed, or is it just internet speculation?



This isn't confirmation, but it certainly goes beyond speculation.

https://searchcode.com/?q=if%28version%2Cstartswith%28%22win...


From what I understand, that Java API would not return "Windows 9". So while those tests are wrong, it would not cause a problem.

I have not seen a single case proposed that would actually break.


Didn't realise that -thank you :)




Consider applying for YC's W25 batch! Applications are open till Nov 12.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: