digital-fabric / polyphony

Fine-grained concurrency for Ruby
https://www.rubydoc.info/gems/polyphony
MIT License
658 stars 17 forks source link

Fix KERNEL_INFO_RE #89

Closed dezza closed 2 years ago

dezza commented 2 years ago

Polyphony fails to build if uname -sr is not formed a certain way, since $KERNEL_INFO_RE does not match on some systems.

Current regex requires:

Other samples I found:

I propose: Linux (\d)\.(\d+)(?:\.)?((?:\d+\.?)*)(?:\-)?([\w\-]+)?

Which will match on: Linux 5.10.63.62.63, infinite patch numbers Linux 5.10.60.1-microsoft-standard-WSL2, word at the end including -

This should ensure

Test: https://regex101.com/r/CLX00x/1

dezza commented 2 years ago

~Out of curiosity, why did you close the PR? This seems like a valuable change.~ Nevermind, I now see your other PR #89.

Yeah.. On afterthought, maybe it would be wiser to drop the regex and do

kernel_info = `uname -r`
version_str, distribution = kernel_info.split('-')
version, major_revision = version_str.split('.')