mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-04-28 19:54:35 +00:00
runtime: kernel version with '+' as suffix panic in parse
The current kernel version parse lib can't process suffix '+', as the modified kernel version will add '+' as suffix, thus panic will occur. For example, if the current kernel version is "5.14.0-rc4+", test TestHostNetworkingRequested will panic: --- FAIL: TestHostNetworkingRequested (0.00s) panic: &{DistroName:ubuntu DistroVersion:18.04 KernelVersion:5.11.0-rc3+ Issue: Passed:[] Failed:[] Debug:true ActualEUID:0}: failed to check test constraints: error: Build meta data is empty Here, remove the suffix '+' in kernel version fix helper. Fixes: #2809 Signed-off-by: Jianyong Wu <jianyong.wu@arm.com>
This commit is contained in:
parent
03877f3479
commit
fa922517d9
@ -147,8 +147,15 @@ func getDistroDetails() (name, version string, err error) {
|
||||
// centos: 3.10.0-957.12.1.el7.x86_64
|
||||
// fedora: 5.0.9-200.fc29.x86_64
|
||||
//
|
||||
// For some self compiled kernel, the kernel version will be with "+" as its suffix
|
||||
// For example:
|
||||
// 5.12.0-rc4+
|
||||
// These kernel version can't be parsed by the current lib and lead to panic
|
||||
// therefore the '+' should be removed.
|
||||
//
|
||||
func fixKernelVersion(version string) string {
|
||||
return strings.Replace(version, "_", "-", -1)
|
||||
version = strings.Replace(version, "_", "-", -1)
|
||||
return strings.Replace(version, "+", "", -1)
|
||||
}
|
||||
|
||||
// handleDistroName checks that the current distro is compatible with
|
||||
|
Loading…
Reference in New Issue
Block a user