kernel-archive: stop the inner directory check from killing the run - #241
Merged
Conversation
`tar -tf "${built}" | head -n1` 在 `set -o pipefail` 之下会间歇性让整支脚本
以 141 结束:`head` 读到第一行就关掉管线,`tar` 收到 SIGPIPE,pipefail 把它
变成整条管线失败,`set -e` 中止。SIGPIPE 不产生任何讯息,所以日志上看不出
原因。
档案越大越容易触发,真实产物是 141 MB。拿 4000 个条目的 tar 实测,旧写法
第一次就复现;改成 `sed -n` 读完整个清单之后 40 次全过。
发生的位置是建完内核、还没发布的那一步,所以症状是建置完成、日志正常结束、
东西没上站。2026-08-09 手动执行时遇过一次,当时归咎于 ssh 断线,是错的。
夹具原本只有两个条目,触发机率太低,测试因此从来没红过。改成三千个条目,
退回 `head` 写法之后连续三次都是 141。
顺带把 `test-shell-behaviour.sh` 里比对这一行源码文字的断言换掉:包内目录名
的行为原本只有那条文字比对在守,现在由 `test-kernel-archive-integrity.sh`
实际建出一个包内目录为 `-3` 的产物来验,拿掉生产端的检查会转红。
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.
build/kernel-archive.sh会间歇性以 141 结束,没有任何错误讯息。inner=$(tar -tf "${built}" | head -n1 | cut -d/ -f1)在set -o pipefail之下,head读到第一行就关掉管线,tar收到 SIGPIPE,pipefail 把它变成整条管线失败,set -e中止。SIGPIPE 静默,所以日志上只看到建置正常结束。发生位置在建完内核、还没发布之间,症状是「建置完成、日志正常、东西没上站」。
2026-08-09 手动执行遇过一次,当时归咎于 ssh 断线,那个判断是错的。
证据
拿 4000 个条目的 tar 实测:
tar -tf … | head -n1 | cut:第 1 次就rc=141tar -tf … | sed -n '1{s|/.*||;p;}':40 次全过sed会读完整个清单,所以上游不会收到 SIGPIPE。为什么测试从来没抓到
夹具的 gpkg 只有两个条目,
tar在head退出前就写完了。改成三千个条目之后,退回
head写法连续三次都是141。修好之后测试 10 次全绿,耗时 0.87 秒。顺带
test-shell-behaviour.sh里有一条断言在比对这一行的源码文字,改了实作就会红。包内目录名的行为原本只有那条文字比对在守——把生产端的检查拿掉,整套测试
仍然全绿。改成在
test-kernel-archive-integrity.sh实际建出一个包内目录为-3的产物,要求脚本拒绝发布也不保留副本;拿掉检查会转红。
同一支脚本第 212 行的
grep -qx管线形状类似,实测 30 次无法触发(tar取具名成员后就停,上游不会写满),因此不改。
测试
本机全套 Python、Shell、JavaScript 测试、
check-copy、py_compile、check-commits与建置机容器内的 ShellCheck 通过。