Repository navigation
fix(release): drop the Moore Threads apt source before installing packages - #1117
Merged
Merged
Conversation
…kages The MUSA base image configures dl.mthreads.com, which answers 403 to CI runners and makes apt-get update fail. No installed package comes from it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Hey - I've found 4 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="scripts/apt-install.sh" line_range="68-70" />
<code_context>
+remove_vendor_repos() {
+ local vendor_host="dl.mthreads.com"
+ local files
+ files=$(grep -rlF "$vendor_host" /etc/apt/sources.list.d/ 2>/dev/null || true)
+ if [ -n "$files" ]; then
+ echo "$files" | xargs rm -f
+ fi
+ if [ -f /etc/apt/sources.list ]; then
</code_context>
<issue_to_address>
**Base image can delete arbitrary files**
When the inherited image contains a matching file under `/etc/apt/sources.list.d/` whose pathname includes a newline followed by another absolute path, `echo` and `xargs` split that pathname into separate `rm -f` operands, so `rm` deletes the injected absolute-path target as root during the build.
Use NUL-delimited grep output with `xargs -0r rm -f --`.
</issue_to_address>
### Comment 2
<location path="scripts/apt-install.sh" line_range="68-70" />
<code_context>
+remove_vendor_repos() {
+ local vendor_host="dl.mthreads.com"
+ local files
+ files=$(grep -rlF "$vendor_host" /etc/apt/sources.list.d/ 2>/dev/null || true)
+ if [ -n "$files" ]; then
+ echo "$files" | xargs rm -f
+ fi
+ if [ -f /etc/apt/sources.list ]; then
</code_context>
<issue_to_address>
**Required repositories disappear**
When a matching source file also contains another active repository entry, `echo "$files" | xargs rm -f` removes the whole file, so apt loses the unrelated source and later package installs cannot obtain packages available only there.
Remove only the Moore Threads entries from matching files, preserving their other repository entries.
</issue_to_address>
### Comment 3
<location path="scripts/apt-install.sh" line_range="73" />
<code_context>
+ echo "$files" | xargs rm -f
+ fi
+ if [ -f /etc/apt/sources.list ]; then
+ sed -i "\|$vendor_host|d" /etc/apt/sources.list
+ fi
+}
</code_context>
<issue_to_address>
**Other repositories are deleted**
When `/etc/apt/sources.list` contains a non-vendor hostname matching the pattern with different characters in place of either dot, `sed` treats the dots in `vendor_host` as regex wildcards and deletes the non-vendor source line, so apt stops using that repository.
Escape regex metacharacters in the hostname before using it in the `sed` pattern.
Also at `scripts/apt-install.sh:74`.
</issue_to_address>
### Comment 4
<location path="scripts/apt-install.sh" line_range="68" />
<code_context>
+remove_vendor_repos() {
+ local vendor_host="dl.mthreads.com"
+ local files
+ files=$(grep -rlF "$vendor_host" /etc/apt/sources.list.d/ 2>/dev/null || true)
+ if [ -n "$files" ]; then
+ echo "$files" | xargs rm -f
</code_context>
<issue_to_address>
**Vendor source remains active**
When the vendor source file in `/etc/apt/sources.list.d/` is a symlink, `grep -r` skips symlinked files during traversal, so `remove_vendor_repos` misses the source and `apt-get update` still contacts the failing repository.
Search symlinked files as well, or explicitly inspect symlink targets.
</issue_to_address>Removing whole files dropped other entries in the same file and fed unquoted paths to rm. Editing lines in place with a literal pattern keeps other repositories and follows symlinked source files. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
doringeman
approved these changes
Nov 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The v1.2.10 Release run failed twice while building the MUSA image.
apt-get updateinscripts/apt-install.shaborts because the Moore Threads repository, configured by the upstreamserver-musabase image, answers403 Forbiddento the CI runners:Because the MUSA image fails, the OpenVINO image,
verify-docker-ce, and the GitHub release are skipped.Change
Before running
apt-get update,apt-install.shdeletes the lines that point atdl.mthreads.comfromsources.listandsources.list.d/*.list. It edits the files in place, so other entries in the same file are kept and symlinked source files are followed. None of the packages it installs come from that repository, and the MUSA runtime libraries are already in the base image. Images that do not use the repository are unaffected.Validation
set -eux -o pipefail, the function succeeds and changes nothing on cleanubuntu:22.04andubuntu:24.04images. These are the non-MUSA cases.ubuntu:22.04container, the function removes mthreads entries fromsources.listand from a symlinked.listfile. It keeps the symlink, the other entry in that file, and a look-alike host (dlXmthreadsYcom.example)./etc/aptfromghcr.io/ggml-org/llama.cpp:server-musa-v1.0.0-b12359-b1b770d, the function removes the only entry insources.list.d/musa-repo-manual-generic-main.listand keeps the 10 Ubuntudeblines insources.list.apt-get updateitself was not run, because this environment cannot emulate amd64.The MUSA image is built only by the Release workflow, so PR CI does not cover it. After this merges, rerunning the Release on
mainvalidates it end to end.🤖 Generated with Claude Code