ValidateGlibcVersion checks if the glibc version is supported and returns an Error Catalog error if it is not. This check only applies to glibc-based Linux systems (amd64, arm64).
(debugLogger *zerolog.Logger, glibcVersion string, os string, arch string, staticNodeJsBinaryBool bool)
| 206 | // ValidateGlibcVersion checks if the glibc version is supported and returns an Error Catalog error if it is not. |
| 207 | // This check only applies to glibc-based Linux systems (amd64, arm64). |
| 208 | func ValidateGlibcVersion(debugLogger *zerolog.Logger, glibcVersion string, os string, arch string, staticNodeJsBinaryBool bool) error { |
| 209 | // Skip validation on linuxstatic, non-Linux, or if glibc not detected |
| 210 | if glibcVersion == "" || os != "linux" || staticNodeJsBinaryBool { |
| 211 | return nil |
| 212 | } |
| 213 | |
| 214 | var minVersion string |
| 215 | switch arch { |
| 216 | case "arm64": |
| 217 | minVersion = MIN_GLIBC_VERSION_LINUX_ARM64 |
| 218 | case "amd64": |
| 219 | minVersion = MIN_GLIBC_VERSION_LINUX_AMD64 |
| 220 | default: |
| 221 | return nil |
| 222 | } |
| 223 | |
| 224 | res := utils.SemverCompare(glibcVersion, minVersion) |
| 225 | |
| 226 | if res < 0 { |
| 227 | return snyk.NewRequirementsNotMetError( |
| 228 | fmt.Sprintf("The installed glibc version, %s is not supported. Upgrade to a version of glibc >= %s", glibcVersion, minVersion), |
| 229 | snyk_errors.WithLinks([]string{"https://docs.snyk.io/developer-tools/snyk-cli/releases-and-channels-for-the-snyk-cli#runtime-requirements"}), |
| 230 | ) |
| 231 | } |
| 232 | |
| 233 | // We currently do not fail on Linux when glibc is not detected, which could lead to an ungraceful failure. |
| 234 | // Failing here would require detectGlibcVersion to always return a valid version, which is not the case. |
| 235 | return nil |
| 236 | } |
no outgoing calls