Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Bugfix] Support EulerOS in dependencies installer#2460

Merged
stmatengss merged 2 commits into
kvcache-ai:mainkvcache-ai/Mooncake:mainfrom
he-yufeng:fix/euleros-dependencieshe-yufeng/Mooncake:fix/euleros-dependenciesCopy head branch name to clipboard
Jun 16, 2026
Merged

[Bugfix] Support EulerOS in dependencies installer#2460
stmatengss merged 2 commits into
kvcache-ai:mainkvcache-ai/Mooncake:mainfrom
he-yufeng:fix/euleros-dependencieshe-yufeng/Mooncake:fix/euleros-dependenciesCopy head branch name to clipboard

Conversation

@he-yufeng

@he-yufeng he-yufeng commented Jun 14, 2026

Copy link
Copy Markdown
Collaborator

Summary

dependencies.sh reads /etc/os-release and lowercases ID, but the RHEL-like branch only accepts centos, rhel, rocky, almalinux, and openeuler. On EulerOS hosts where /etc/os-release reports ID=euleros, the installer reaches the unsupported-OS path even though the package flow is the same yum-based family.

This adds euleros to the RHEL-like branches and keeps the unsupported-OS message aligned with the accepted list. I also made the os-release path overridable so the detection logic can be smoke-tested without changing the host /etc/os-release.

Fixes #2385.

Validation

To verify:

  • "C:\Program Files\Git\bin\bash.exe" -lc 'cd /c/dev/GITHUB-clean/Mooncake-2385; bash -n dependencies.sh; tmp=$(mktemp); printf "ID=euleros\nVERSION_ID=2.0\n" > "$tmp"; test_script=$(mktemp); { echo "GREEN=; RED=; NC="; echo "print_error(){ echo ERROR: \"\$1\"; exit 1; }"; echo "OS_RELEASE_FILE=\"$tmp\""; awk "/^detect_os\(\)/,/^}/" dependencies.sh; echo "detect_os >/dev/null"; echo "test \"\$OS\" = euleros"; echo "test \"\$OS_VERSION\" = 2.0"; } > "$test_script"; bash "$test_script"; rm -f "$tmp" "$test_script"; echo ok'
  • git diff --check

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds support for EulerOS in the dependencies installation script and introduces an overridable environment variable, OS_RELEASE_FILE, for the OS release file path. However, sourcing this overridable file directly introduces a critical security vulnerability that could allow privilege escalation or code injection. It is recommended to safely parse the required variables using grep and cut instead of sourcing the file.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread dependencies.sh Outdated
Comment on lines +54 to +55
if [ -f "$OS_RELEASE_FILE" ]; then
. "$OS_RELEASE_FILE"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security-critical critical

Sourcing an overridable environment variable (OS_RELEASE_FILE) using the . command introduces a critical security vulnerability (Privilege Escalation / Code Injection). If this script is run with sudo privileges (e.g., in environments where users have restricted sudo access to run specific scripts), an attacker can escalate privileges to root by setting OS_RELEASE_FILE to a malicious file they control.

Instead of sourcing the file, parse the required variables (ID and VERSION_ID) safely using grep and cut to avoid executing arbitrary code.

Suggested change
if [ -f "$OS_RELEASE_FILE" ]; then
. "$OS_RELEASE_FILE"
if [ -f "$OS_RELEASE_FILE" ]; then
OS=$(grep -E '^ID=' "$OS_RELEASE_FILE" | cut -d= -f2- | tr -d '"' | tr -d "'")
OS=$(echo "$OS" | tr '[:upper:]' '[:lower:]')
OS_VERSION=$(grep -E '^VERSION_ID=' "$OS_RELEASE_FILE" | cut -d= -f2- | tr -d '"' | tr -d "'")

@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@stmatengss

stmatengss commented Jun 14, 2026

Copy link
Copy Markdown
Collaborator

Hi. Can you explain the difference between OpenEuler and EulerOS?

@ykwd
ykwd requested a review from alogfans June 15, 2026 03:29
@he-yufeng

Copy link
Copy Markdown
Collaborator Author

Good question. They are related but not the same distribution identity.

openEuler is the upstream community distribution. In /etc/os-release it commonly reports ID=openEuler / ID=openeuler depending on release packaging.

EulerOS is Huawei's enterprise/commercial downstream distribution. On the machines this change is meant to cover, /etc/os-release reports a separate ID=EulerOS, so the old check that only accepted openeuler would fall through to the unsupported-OS branch even though the package manager path is still the same yum/dnf-style path used by the RHEL-family handling here.

I also pushed eb83345 to address the review concern about OS_RELEASE_FILE: the script no longer sources the override file. It now parses only ID and VERSION_ID, so the test override remains useful without executing arbitrary shell from that file.

Validation:

"C:\Program Files\Git\bin\bash.exe" -n dependencies.sh
# simulated OS_RELEASE_FILE with ID=EulerOS and a shell expression field; detect_os reports euleros 2.0 and does not execute the expression
git diff --check upstream/main..HEAD

@he-yufeng

Copy link
Copy Markdown
Collaborator Author

Small correction: the pushed follow-up commit is \25b6f699\ ( ix: parse os-release without sourcing it). The rest of the explanation and validation above applies to that commit.

@stmatengss

Copy link
Copy Markdown
Collaborator

Good question. They are related but not the same distribution identity.

openEuler is the upstream community distribution. In /etc/os-release it commonly reports ID=openEuler / ID=openeuler depending on release packaging.

EulerOS is Huawei's enterprise/commercial downstream distribution. On the machines this change is meant to cover, /etc/os-release reports a separate ID=EulerOS, so the old check that only accepted openeuler would fall through to the unsupported-OS branch even though the package manager path is still the same yum/dnf-style path used by the RHEL-family handling here.

I also pushed eb83345 to address the review concern about OS_RELEASE_FILE: the script no longer sources the override file. It now parses only ID and VERSION_ID, so the test override remains useful without executing arbitrary shell from that file.

Validation:

"C:\Program Files\Git\bin\bash.exe" -n dependencies.sh
# simulated OS_RELEASE_FILE with ID=EulerOS and a shell expression field; detect_os reports euleros 2.0 and does not execute the expression
git diff --check upstream/main..HEAD

Thanks for clarifying. Others LGTM

@stmatengss
stmatengss merged commit 14ab37e into kvcache-ai:main Jun 16, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

3 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.