Bug: String comparison for kernel version
File: scripts/setup.sh
The OpenShell prerequisite check compares the Linux kernel version as a string:
if [[ "$(uname -r | cut -d. -f1-2)" < "5.13" ]]; then
warn "Kernel $(uname -r) — Landlock needs >= 5.13"
fi
Bash's [[ < ]] operator performs lexicographic (alphabetical) comparison, not numeric comparison. This means:
| Kernel |
cut output |
String comparison result |
Correct? |
| 5.4 |
5.4 |
"5.4" < "5.13" → false (4 > 1) |
❌ should warn, doesn't |
| 5.9 |
5.9 |
"5.9" < "5.13" → false (9 > 1) |
❌ should warn, doesn't |
| 5.13 |
5.13 |
"5.13" < "5.13" → false |
✓ |
| 6.0 |
6.0 |
"6.0" < "5.13" → false |
✓ |
Kernels 5.4–5.12 (which don't support Landlock) will not trigger the warning, potentially leading to a broken OpenShell install.
Fix
kernel_maj=$(uname -r | cut -d. -f1)
kernel_min=$(uname -r | cut -d. -f2)
if (( kernel_maj < 5 || (kernel_maj == 5 && kernel_min < 13) )); then
warn "Kernel $(uname -r) — Landlock needs >= 5.13"
fi
Bug: String comparison for kernel version
File:
scripts/setup.shThe OpenShell prerequisite check compares the Linux kernel version as a string:
Bash's
[[ < ]]operator performs lexicographic (alphabetical) comparison, not numeric comparison. This means:cutoutput5.45.95.136.0Kernels 5.4–5.12 (which don't support Landlock) will not trigger the warning, potentially leading to a broken OpenShell install.
Fix