You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
两版本共存期间约多占一份磁盘(本机约 1 GB,可只保留 N 个版本);发布、签名、质检、卸载器与启动器需要按新的目录形态适配。
English summary
Proposal: stop renaming the install directory on Windows. Extract each version into versions\<version>\ and switch by atomically replacing a small current.json (ReplaceFileW); the launcher reads it to decide what to start. Old versions are deleted afterwards as an independent GC step, with a tombstone list retried on next start or via MOVEFILE_DELAY_UNTIL_REBOOT, so failed-attempt leftovers are collected too.
Motivation: the current whole-directory rename fails with ERROR_SHARING_VIOLATION (32) whenever any process holds the install directory as its current working directory (a directory handle, invisible to Restart Manager). On this machine a shell cache process (TGitCache.exe) did exactly that and blocked four consecutive updates; terminating it let the same install succeed.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
建议:Windows 更新改为「版本目录 + 指针切换」
Category suggestion: Ideas
问题
当前更新通过把
$INSTDIR改名为$INSTDIR.old-{GUID}来换入新版本。Windows 不允许重命名「任何进程的当前工作目录」——cwd 是目录句柄,不是文件句柄。而把安装目录当作 cwd 的常驻进程很常见。本机是 TortoiseGit 的图标缓存
TGitCache.exe:浏览该目录时被外壳拉起,带着这个 cwd 长期驻留,导致更新连续 4 次卡在MoveFileExW(错误 32),即使 App 已完全退出、Restart Manager也报告无人锁定文件;结束该进程后,同一次安装立即成功(rc.3 → rc.5)。建议
改成「版本目录 + 指针切换」:
versions\<version>\,不触碰正在运行的旧目录;current.json.tmp→ReplaceFileW(current.json, tmp),launcher 读它决定启动哪个版本;MoveFileEx(..., MOVEFILE_DELAY_UNTIL_REBOOT)兜底);唯一的原子操作变成替换一个小文件,目录是否被占用不再影响更新能否完成;旧版本清理也从安装事务里剥离——失败尝试残留的
dsh.new-*(本机 1.04 GB)由同一个 GC 步骤覆盖。首次迁移
从单目录迁到
versions\时同样不应改名旧目录:复制到versions\<version>\→ 切换指针 → 旧目录记入墓碑、重启后删除。代价是一次额外复制。成本
两版本共存期间约多占一份磁盘(本机约 1 GB,可只保留 N 个版本);发布、签名、质检、卸载器与启动器需要按新的目录形态适配。
English summary
Proposal: stop renaming the install directory on Windows. Extract each version into
versions\<version>\and switch by atomically replacing a smallcurrent.json(ReplaceFileW); the launcher reads it to decide what to start. Old versions are deleted afterwards as an independent GC step, with a tombstone list retried on next start or viaMOVEFILE_DELAY_UNTIL_REBOOT, so failed-attempt leftovers are collected too.Motivation: the current whole-directory rename fails with
ERROR_SHARING_VIOLATION (32)whenever any process holds the install directory as its current working directory (a directory handle, invisible to Restart Manager). On this machine a shell cache process (TGitCache.exe) did exactly that and blocked four consecutive updates; terminating it let the same install succeed.All reactions