Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

[arch] 多次 chsrc set arch 后 mirrorlist 累积旧 Server 行,upstream 官方源地址无效

Open
#393 2 comments 2 reactions 1 assignee View on GitHub

@yayoinoyume is already working on this.

Since Sep 7, 2026.

Assessment

This issue has not been assessed yet.

Description

Linux os_dish 源

问题描述

1. Arch的换源操作不是幂等

chsrc set arch <源> 每次都会向 /etc/pacman.d/mirrorlist 追加(prepend)新的 Server 行,但从不清理旧行。多次换源后 mirrorlist 会累积所有历史源,例如:

  • chsrc set arch tuna → mirrorlist 写入 tuna 行
  • chsrc set arch ali → mirrorlist 写入 ali 行(tuna 行仍在)
  • chsrc set arch tencent → mirrorlist 写入 tencent 行(tuna、ali 行仍在)

结果:mirrorlist 中出现多行 Server,且最先命中的可能是旧源(行为不可预期);累积行数随换源次数线性增长,文件越来越脏。这不是幂等操作,重复执行同一操作结果不同。

修复:实现换源的幂等操作,仅对 x86_64 有效。

2. 官方源地址 https://repo.archlinux.org 实际不存在

arch dish 的 UpstreamProvider(即 chsrc set arch upstream)地址为 https://repo.archlinux.org,但该域名不存在:

  • 本机 curl -I https://repo.archlinux.org 提示 curl: (6) Could not resolve host: repo.archlinux.org。
  • 在线DNS检测,这个地址没有任何A记录
  • Arch 官方全局 mirrorlist 中无此条目。
  • 官方推荐入口是 geo.mirror.pkgbuild.com(按地理位置自动选最近镜像)/ fastly.mirror.pkgbuild.com

因此任何用户执行 chsrc set arch upstream ,会报 致命错误,且chsrc reset arch不可用,提示 暂未实现reset。

关联

已尝试实现修复并实测验证,具体见关联 PR #394

Dominant language
C
Stars
6.9k
Forks
285
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from RubyMetric/chsrc

All issues in RubyMetric/chsrc

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.