From 537321b8c6f920b068fb7a88e89aee56810cefe3 Mon Sep 17 00:00:00 2001 From: sunrisepeak Date: Sun, 2 Aug 2026 01:43:11 +0800 Subject: [PATCH 1/2] =?UTF-8?q?sync:=20=E5=B7=A5=E5=85=B7=E9=93=BE=20pin?= =?UTF-8?q?=20=E8=B7=9F=E8=BF=9B=20=E2=80=94=E2=80=94=20mcpp=200.0.104=20?= =?UTF-8?q?=E2=86=92=202026.8.1.1,d2x=20=E2=86=92=202026.08.02.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit mcpp 侧不是升级偏好,是必须:mcpplibs 依赖索引已把 index floor 抬到 0.0.109, 钉在 0.0.104 的工程一律 E0006「index requires mcpp >= 0.0.109」而拒绝解析依赖。 d2x 仓库的 CI 因此一度全平台红,并为本课程加了一步「安装前把 pin 对齐」的 workaround —— 本次同步之后那步就可以撤掉了。 d2x 侧跟到刚发布的 2026.08.02.1:Win10 / Win11 CI(完整测试段 + 以本课程做 checker 真实冒烟)、Windows 上练习页路径显示修复、Windows 活性超时补齐。 CI 头部注释一并更新:原文只写了「依赖 mcpp >= 0.0.104」,而真实下限已被上游 抬到 0.0.109,不写清楚下一个人会以为 0.0.104 还能用。 --- .github/workflows/dslings-ref-ci.yml | 6 +++++- .xlings.json | 8 ++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.github/workflows/dslings-ref-ci.yml b/.github/workflows/dslings-ref-ci.yml index 37279cc..7cbd45b 100644 --- a/.github/workflows/dslings-ref-ci.yml +++ b/.github/workflows/dslings-ref-ci.yml @@ -8,7 +8,11 @@ name: Validate exercises and reference solutions # 链路,所以 CI 绿灯等价于学习者本地能跑通,而不是另一条平行的构建路径。 # # 依赖 mcpp >= 0.0.104(测试能力批次:逐测试隔离 / 过滤 / --list / --timeout / -# --message-format json / tests 吃 [build].flags)。pin 见 .xlings.json。 +# --message-format json / tests 吃 [build].flags)。 +# +# 但真正的下限已被上游抬高:mcpplibs 依赖索引现在要求 mcpp >= 0.0.109,更低的 +# 版本一律 E0006「index requires mcpp >= 0.0.109」而拒绝解析依赖 —— 原先钉的 +# 0.0.104 自此装不出来。pin 见 .xlings.json,当前为 2026.8.1.1。 on: push: diff --git a/.xlings.json b/.xlings.json index 8e71f7c..83b5d00 100644 --- a/.xlings.json +++ b/.xlings.json @@ -1,12 +1,12 @@ { "workspace": { - "d2x": "2026.07.24.1", + "d2x": "2026.08.02.1", "mdbook": "0.4.43", "code": "", "mcpp": { - "linux": "0.0.104", - "macosx": "0.0.104", - "windows": "0.0.104" + "linux": "2026.8.1.1", + "macosx": "2026.8.1.1", + "windows": "2026.8.1.1" } } } From 2700e12351d28e6a42b75bbeea1c7b3140498234 Mon Sep 17 00:00:00 2001 From: sunrisepeak Date: Sun, 2 Aug 2026 02:14:55 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix(provider):=20Windows=20=E4=B8=8A=20capt?= =?UTF-8?q?ure=5Fstdout=20=E7=9A=84=202>/dev/null=20=E8=AE=A9=20mcpp=20tes?= =?UTF-8?q?t=20=E6=A0=B9=E6=9C=AC=E6=B2=A1=E8=B7=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Windows 上每道练习都判不出结果,现象是 Provider 报「mcpp test 没有返回 '' 的记录」,看起来像 mcpp 不支持 --message-format json —— 实际是本仓库 Provider 自己的问题。 capture_stdout 无条件给命令尾巴上接 ` 2>/dev/null`。Windows 上 _popen 走的是 cmd.exe,那里没有 /dev/null:cmd 把它当成「重定向到 \dev\null 这个路径」,而 \dev 不存在,于是直接报 The system cannot find the path specified. 并且整条命令根本不执行。mcpp test 一条 JSON 都没吐,解析侧 saw_any 为假,判定 链退化成「没有该测试的记录」,那句「mcpp 可能不支持 --message-format json」的 提示把锅指错了方向。 证据(d2x 的 Win10 / Win11 checker 冒烟实测): 外层 `mcpp run -q -p d2x/buildtools -- check hello-mcpp` 本身跑得通 —— 说明 mcpp 在 PATH 上(不在的话 cmd 会报 'mcpp' is not recognized,是另一句话); 只有内层带 2>/dev/null 的 mcpp test 挂掉。两者唯一的差别就是这个重定向。 空设备在 cmd 下叫 NUL,按平台分开写即可。POSIX 分支拼出的字符串与改前逐字节 相同,linux 行为不变;本地实测 check hello-mcpp 仍是 stage → output(真实编译 错误)→ verdict fail。 --- d2x/buildtools/src/runner.cppm | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/d2x/buildtools/src/runner.cppm b/d2x/buildtools/src/runner.cppm index 1af14f7..74c2aec 100644 --- a/d2x/buildtools/src/runner.cppm +++ b/d2x/buildtools/src/runner.cppm @@ -33,7 +33,17 @@ export struct Captured { // workaround 随之删除。 export Captured capture_stdout(const std::string& cmd) { Captured result; + // 丢弃 stderr 的写法必须分平台:_popen 走的是 cmd.exe,那里没有 + // /dev/null —— `2>/dev/null` 会被当成「重定向到 \dev\null 这个路径」, + // 而 \dev 不存在,cmd 直接报 "The system cannot find the path specified." + // 并且整条命令根本不执行。于是 mcpp test 一条 JSON 都吐不出来,判定链 + // 退化成「没有该测试的记录」,Windows 上每道题都卡在这里(d2x 的 + // Win10/Win11 checker 冒烟实测)。空设备在 cmd 下叫 NUL。 +#ifdef _WIN32 + std::string full = cmd + " 2>NUL"; +#else std::string full = cmd + " 2>/dev/null"; +#endif #ifdef _WIN32 FILE* pipe = ::_popen(full.c_str(), "r");