Replies: 2 comments
|
Confirmed at source + empirically reproduced — your diagnosis is exactly right, and it resolves discussion #3188 (the CJK directory-name truncation report) whose root cause was misattributed on my part. This is the host-side bug I wrongly ruled out. 1. Verification (rc.7, 99f6f02)
function readUtf16(koffi: Koffi, address: unknown): string {
const bytes = Buffer.from(koffi.view(address, 32768))
let end = 0
while (end + 1 < bytes.length && bytes[end] !== 0) end += 2 // ← low byte only
return bytes.toString('utf16le', 0, end)
}The loop treats any even-offset 0 byte as the terminator. For Empirical reproduction with the exact characters from #3188 ( Your one-line fix (check both bytes for the true UTF-16LE NUL: 2. Self-correction (my #3188 reply was wrong)In discussion #3188 I source-verified the whole host chain and stated the native Win32 3. Why this is a nastier bug than it looks
4. Suggested shape (one PR, ~3 lines + 1 test)
This is the cleanest small-fix candidate I've seen this week: root cause pinned to one byte comparison, one-line repair, deterministic regression test, and it closes three threads (#3188 / #3279 / #3291). When the PR channel reopens, this should be near the front of the queue. |
|
补充一个面向使用者的判别与验收方法。这个问题和 #30 的 worker crash 外观不同:
验收时至少确认:Open、Navigate、包含 U+XX00 的 Unicode 路径、Create folder、Restart 后仍可用。 我们根据 rc.7 源码把 crash 与 silent truncation 分成四条排查分支,并画出了 说明:这是独立社区 runbook,不代表官方修复状态。 |
Uh oh!
There was an error while loading. Please reload this page.
环境
@deepseek-ai/dsh0.1.0-rc.7(npm 最新版,全局安装),通过dsh web启动@deepseek-ai/dsh-host-directory-picker-native(Windows 原生文件夹对话框)现象
在 Web 界面点击"添加工作区"会弹出 Windows 原生文件夹对话框。用鼠标逐级点选(非手动输入)一个路径中含有"低字节为 0x00 的汉字(U+XX00)"的目录后,创建工作区失败:
期望路径是
D:\PythonProjects\Python\CAN盒子二次开发\can_auto_test,实际在开(U+5F00)处被静默截断。截断后的路径在磁盘上不存在,服务端fs.realpath拒绝是正确行为——但路径在到达服务端之前就已经损坏了。根因
packages/host/directory-picker-native/src/win32-dialog-bindings.ts中的readUtf16:它按 UTF-16LE 逐字符扫描,把任意偶数偏移处的 0 字节当作字符串终止符。UTF-16LE 中,码位
U+XX00(如 一 U+4E00、刀 U+5200、开 U+5F00、退 U+9000)的存储为00 XX,循环会在字符串中间停下。UTF-16LE 真正的终止符是连续两个 0 字节,判断必须同时检查两个字节:影响
ENOENT看起来像"用户路径写错",而不是产品 Bug,遇到的人一般不会上报。复现步骤
dsh web。U+XX00汉字的目录,例如D:\PythonProjects\Python\CAN盒子二次开发\can_auto_test。开处被截断,创建工作区失败,报错如上。修复建议
按上文在
readUtf16中改一行(终止符判断改为同时检查两个字节)。All reactions