Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 3, 2026

Repository subscriptions fail on Synology NAS and similar Docker environments with error: unable to get random bytes for temporary file: Function not implemented. Git's temporary file creation attempts to use getrandom() syscall or /dev/random, which are blocked in containers with restricted syscalls.

Changes

  • Set TMPDIR=/tmp before git clone operations in git_clone_scripts()
  • Preserve and restore original TMPDIR value to avoid side effects
# Before
git clone -q --depth=1 $part_cmd $url $dir

# After
local original_tmpdir="${TMPDIR:-}"
export TMPDIR=/tmp
git clone -q --depth=1 $part_cmd $url $dir
exit_status=$?
if [[ -n "$original_tmpdir" ]]; then
  export TMPDIR="$original_tmpdir"
else
  unset TMPDIR
fi

This forces git to use standard temp directory APIs instead of system random sources.

Original prompt

This section details on the original issue you should resolve

<issue_title>订阅功能失效</issue_title>
<issue_description>### Qinglong version

v2.20.1

Steps to reproduce

添加github仓库订阅
运行订阅

Image

What is expected?

正确拉取仓库文件

What is actually happening?

开始执行... 2025-12-31 18:00:48

开始拉取仓库 Cat-zaizai_ZaiZaiCat-Checkin_main 到 /ql/data/repo/Cat-zaizai_ZaiZaiCat-Checkin_main

error: unable to get random bytes for temporary file: Function not implemented
error: unable to get random bytes for temporary file: Function not implemented
fatal: Unable to create temporary file '/ql/data/repo/Cat-zaizai_ZaiZaiCat-Checkin_main/.git/objects/pack/tmp_pack_XXXXXX': Function not implemented

fatal: fetch-pack: invalid index-pack output

拉取 Cat-zaizai_ZaiZaiCat-Checkin_main 失败,请检查日志...

执行结束... 2025-12-31 18:00:52 耗时 4 秒     

System Info

群晖,docker部署,从前面的版本更新上来的(重新pull镜像然后用portainer重新部署),未改部署参数

Any additional comments?

试了仅有的2个仓库,都是同样的问题,其中一个仓库属于是以前加入的、能订阅的,现在不能更新了

https://github.com/Cat-zaizai/ZaiZaiCat-Checkin.git
https://github.com/aefa6/QinglongScript.git

询问过gemini,根据gemini的建议给容器添加--privileged=true也没有解决问题</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@vercel
Copy link

vercel bot commented Jan 3, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
qinglong Ready Ready Preview, Comment Jan 3, 2026 6:59am
qinglong-back Ready Ready Preview, Comment Jan 3, 2026 6:59am

Set TMPDIR=/tmp before git clone operations to fix "unable to get random bytes for temporary file" error in Docker environments with restricted system calls (e.g., Synology NAS).

Co-authored-by: whyour <[email protected]>
Improve git_clone_scripts to save and restore the original TMPDIR value instead of unconditionally unsetting it, avoiding unintended side effects.

Co-authored-by: whyour <[email protected]>
Copilot AI changed the title [WIP] Fix subscription functionality issue Fix git clone failure in restricted Docker environments Jan 3, 2026
Copilot AI requested a review from whyour January 3, 2026 06:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

订阅功能失效

2 participants