Skip to content

emrg: fix emrg.iss heredoc $FFFF unbound variable (v0.2.2 CI 修复) - #397

Merged
argszero merged 1 commit into
masterfrom
feature/fix-iss-hex-escape
Aug 5, 2026
Merged

emrg: fix emrg.iss heredoc $FFFF unbound variable (v0.2.2 CI 修复)#397
argszero merged 1 commit into
masterfrom
feature/fix-iss-hex-escape

Conversation

@argszero

@argszero argszero commented Aug 5, 2026

Copy link
Copy Markdown
Owner

修复 v0.2.2 Build Release CI Windows 构建失败。

==== 根因 ====
make-installer.sh windows 分支 heredoc(unquoted EOF)中,R119 新增的 Pascal 注释 / / 里的 $ 被 bash 展开。脚本 set -euo pipefail(nounset)下,$FFFF 是未定义变量 → line 160: FFFF: unbound variable,iscc 编译前脚本退出。

==== 修复 ====
3 处十六进制注释 $ 转义为 \$(heredoc 输出字面 { $FFFF },Pascal 注释原意保留):

  • WM_SETTINGCHANGE = 26; { /bin/sh01A }
  • HWND_BROADCAST = 65535; { \ }
  • SMTO_ABORTIFHUNG = 2; { /bin/sh002 }

==== 验证 ====

  • 模拟 set -euo pipefail 下 heredoc 展开:无 unbound variable,输出字面 { $FFFF }
  • sh -n 语法通过
  • uv run pytest tests/ — 466 passed
  • import run_client + emrg --help — OK

==== 后续 ====
merge 后重新 tag v0.2.2(delete + recreate 或 bump v0.2.3)触发 CI

@argszero argszero left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ LGTM — cycle 20260805-1515. 根因诊断准确:heredoc unquoted EOF + set -u 下 $FFFF 被 bash 展开为 unbound variable;修复正确(3 处转义 $,输出保留字面 Pascal 注释);模拟验证无报错 + 466 passed。LGTM 1/3。

@argszero argszero left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ LGTM — cycle 20260805-1520. 独立验证:① heredoc 内仅剩 5 处有意展开的 bash 变量(VERSION/DIST_WIN/ROOT_WIN/STAGE_WIN,均已在脚本定义);② 3 处十六进制注释转义为 $,set -euo pipefail 模拟展开无 unbound variable,输出字面 { $FFFF };③ 无其他未转义 $。修复完整。CI test pass 34s。此 bug 由 #395 引入(我上一轮自查时发现 $ 行但误判无害),教训:unquoted heredoc + nounset 下任何 $-开头 token 都必须转义,已记入演化记录。

@argszero argszero left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ LGTM — cycle 20260805-1520. 第 2 个 cycle 确认:① 修复最小化(3 处 $ 转义);② CI test 通过(34s);③ 本地验证(set -u heredoc 模拟 + sh -n + 466 passed)结论不变;④ 该 bug 仅在 Windows CI 暴露,修复后 v0.2.2 重发可验证。LGTM 2/3。

@argszero argszero left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ LGTM — cycle 20260805-1524. 第 3 个独立 cycle 确认:① diff 仅 3 处 $ 转义(WM_SETTINGCHANGE/HWND_BROADCAST/SMTO_ABORTIFHUNG 注释),修复最小化;② 其余 5 处 bash 变量(VERSION/DIST_WIN/ROOT_WIN/STAGE_WIN)为有意展开且均已定义;③ CI test pass 34s。LGTM 3/3,满足合并条件。

@argszero
argszero merged commit 51aab23 into master Aug 5, 2026
1 check passed
argszero added a commit that referenced this pull request Aug 5, 2026
… 二次修复 (#398)

* emrg: remove duplicate Inno const block (WM_SETTINGCHANGE/HWND_BROADCAST/SMTO_ABORTIFHUNG are IS 6.3+ builtin)

#397 修复 heredoc 转义后,iscc 首次成功解析 .iss,暴露下一层错误:
Duplicate identifier 'HWND_BROADCAST'(Inno Setup 6.3+ 已预置这些 Windows 常量)。
删除 [Code] const 块,保留 R120 注释说明。windows-2025 runner 内置 IS 6.4.x。

* emrg: keep WM_SETTINGCHANGE/SMTO_ABORTIFHUNG const, only drop HWND_BROADCAST (iscc builtin)

修正 #398 的不完整修复:issrc 源码确认 iscc 预定义常量
(Compiler.ScriptFunc.pas RegisterConst,185 个)仅含 HWND_BROADCAST,
无任何 WM_*/SMTO_* 常量。删除整个 const 块会导致
Unknown identifier 'WM_SETTINGCHANGE'。现在 const 块保留
WM_SETTINGCHANGE = 26 与 SMTO_ABORTIFHUNG = 2(带 $ 转义),
仅移除 HWND_BROADCAST 定义。

---------

Co-authored-by: EMRG Evolution <emrg@argszero.dev>
argszero added a commit that referenced this pull request Aug 5, 2026
…licit failures, [UninstallDelete]) (#399)

* emrg: remove duplicate Inno const block (WM_SETTINGCHANGE/HWND_BROADCAST/SMTO_ABORTIFHUNG are IS 6.3+ builtin)

#397 修复 heredoc 转义后,iscc 首次成功解析 .iss,暴露下一层错误:
Duplicate identifier 'HWND_BROADCAST'(Inno Setup 6.3+ 已预置这些 Windows 常量)。
删除 [Code] const 块,保留 R120 注释说明。windows-2025 runner 内置 IS 6.4.x。

* emrg: keep WM_SETTINGCHANGE/SMTO_ABORTIFHUNG const, only drop HWND_BROADCAST (iscc builtin)

修正 #398 的不完整修复:issrc 源码确认 iscc 预定义常量
(Compiler.ScriptFunc.pas RegisterConst,185 个)仅含 HWND_BROADCAST,
无任何 WM_*/SMTO_* 常量。删除整个 const 块会导致
Unknown identifier 'WM_SETTINGCHANGE'。现在 const 块保留
WM_SETTINGCHANGE = 26 与 SMTO_ABORTIFHUNG = 2(带 $ 转义),
仅移除 HWND_BROADCAST 定义。

* emrg: thorough Windows uninstall — kill GUI first, full whitelist, explicit failures, [UninstallDelete] (rant 2026-08-05T15:35:17)

根因(rant 证据链):
1. GUI 进程(EMRG.exe)在 ws 断开后自动 startDaemon 重建 daemon → 卸载过程
   中 emrgd.pid/port/log/projects.yml 被重写;运行中 daemon 锁住 install/。
2. WHITELIST 缺 emrgd.log/emrg-gui.log/gui-window.json/skills → 被当用户数据保留。
3. rmtree(ignore_errors=True) + except OSError: pass → 删除失败静默吞掉。
4. .iss 无 [UninstallDelete] → install/ 删除失败无兜底。
5. self_verify 只查 6 个固定文件 → 残留不告警、退出码 0。

修复:
- Step 1a 新增 stop_gui(Windows taskkill /IM EMRG.exe /F;POSIX pkill -f EMRG)
- Step 1b daemon 停止后 Windows 轮询 tasklist 确认退出(≤5s)
- WHITELIST 补全 4 项;graveyard 快照 members 增加 skills
- delete_whitelisted 返回 (removed, failed),失败写入 report 的
  4_delete_whitelisted.failed,残留时 WARNING + 退出码 1
- self_verify 全量扫描 ~/.emrg 顶层项
- Step 7 finalize:卸载凭证(report + graveyard 快照)移至家目录,rmtree ~/.emrg
- .iss 增加 [UninstallDelete] Type: filesandordirs; Name: "{app}"
  (emrg-uninstall 退出后强制删除 install/)

验证:466 passed + import OK + 隔离 HOME 实测(12 paths 删除、~/.emrg 清除、
凭证移家目录、二次运行幂等 EXIT=0)。

---------

Co-authored-by: EMRG Evolution <emrg@argszero.dev>
argszero added a commit that referenced this pull request Aug 5, 2026
… 6.7.1 lacks them) (#400)

v0.2.2 Build Release CI 三次失败链:#397 heredoc → #398 HWND_BROADCAST 重复 → 本轮 WPARAM 类型。

根因(issrc is-6_7_1 标签源码验证):
- WPARAM/LPARAM 类型在 Inno Setup 6.7.2+ 才加入 iscc 预置
  (issrc commit 27bce18660, 2025-12-27 "Add WPARAM and LPARAM types")
- runner windows-2025 安装 Inno Setup 6.7.1 → Unknown type 'WPARAM'
- 6.7.1 已注册类型:DWORD/UINT = LongWord(Compiler.ScriptFunc.pas:88-89)

修复:SendMessageTimeout 的 wParam/lParam 参数类型 WPARAM/LPARAM → DWORD。
iscc 生成 32 位安装器,WPARAM/LPARAM 在 32 位下为 4 字节,与 DWORD 完全兼容;
调用处传 0, 0 无影响。HWND 保留(CI 实测 6.7.1 可用,uPSCompiler 内置)。

验证:heredoc set -u 模拟(无 unbound、无 WPARAM/LPARAM 使用)+ sh -n
+ 466 passed + import OK + --help OK

Co-authored-by: EMRG Evolution <emrg@argszero.dev>
argszero added a commit that referenced this pull request Aug 5, 2026
…k comment broke iscc (v0.2.2 CI 四次失败) (#402)

v0.2.2 Build Release CI 四次失败链:#397 heredoc → #398 HWND_BROADCAST 重复 →
#400 WPARAM 类型缺失 → 本轮:line 88 Syntax error({olddata})。

根因:Inno Setup Pascal 块注释 { } 不支持嵌套。R119 大注释块
"{ R119: ... {app} ... {olddata} ... }" 内含 {app}/{olddata},内部的 }
提前终止注释块 → 后续内容变成代码 → "Syntax error"(line 88 column 19)。

修复:将含 {app}/{olddata} 的 2 处块注释改为 Pascal // 行注释
(AddBinDirToPath 上方 7 行 + RemoveBinDirFromPath 上方 1 行)。
其余块注释(R120/R122/R119 单行)无嵌套花括号,保持 { } 不变。

验证:heredoc set -u 模拟(无 unbound + 无嵌套花括号)+ sh -n
+ 466 passed + import OK + --help OK。

Co-authored-by: EMRG Evolution <emrg@argszero.dev>
@argszero
argszero deleted the feature/fix-iss-hex-escape branch August 5, 2026 08:36
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.

1 participant