Replies: 1 comment
macOS 侧确认(0.2.0-rc.2),并补充影响面
复现输出(Electron 内建 node): 即 asar 内路径 影响面不止 也就是说:任何把内置资源放在 触发链路(供定位): 修复方向与 #7929 一致( |
macOS 侧确认(0.2.0-rc.2),并补充影响面
复现输出(Electron 内建 node): 即 asar 内路径 影响面不止 也就是说:任何把内置资源放在 触发链路(供定位): 修复方向与 #7929 一致( |
Uh oh!
There was an error while loading. Please reload this page.
Environment
0.2.0-rc.2@deepseek-ai/dsh-fs-local:0.2.0-rc.2DeepSeek Harness.exe), Electron's transparent ASAR view enabledpackages/fs/fs-local/src/fsio.ts@deepseek-ai/dsh-fs-local/lib/index.js(probeandprobeNoFollow)Submission note
CONTRIBUTING.mdcurrently says the project does not accept external pull requests and asks contributors to report issues/bugs in GitHub Discussions. This report is therefore submitted as a Discussion.Summary
dsh-fs-localcallsstat(path, { bigint: true })and assumes the returnedmodefield is abigint. Under Electron's transparent ASAR view, a path whose segment ends in.asar(or.asar.unpacked) is treated as an archive directory, andfs.stat(..., { bigint: true })still returns Number fields for such paths.probe()then evaluates:When
info.modeis a Number, theNumber & bigintexpression throws:This breaks any DSH operation that stats a path containing an
.asarsegment, including DSH's own installation file:Root cause
Electron patches
fsin packaged processes so that a path ending in.asarreads as a directory. For those paths, theStatsobject returns Number fields even when{ bigint: true }is requested.Minimal reproduction:
Run it as an Electron Node process:
Observed output:
Note: plain Node (without Electron's ASAR view) returns
bigintfields here, so the failure is specific to Electron's ASAR patchedfs.Affected code in
packages/fs/fs-local/src/fsio.ts:pathType(info)/pathLinkType(info)continue to work because the originalStatsmethods are still backed by Number fields; only the BigInt mask expression is wrong.Suggested fix
Convert
info.modetoNumberbefore applying the numeric mask:This works for both
Stats(Number) andBigIntStats(BigInt) and removes the mixed-type bitwise expression. The same change is needed in bothprobe()andprobeNoFollow().A more explicit alternative that keeps the BigInt mask:
Patch
A ready-to-apply patch is attached as
deepseek-harness-fs-local-bigint.patch:Test plan
Stats-like object whosemodeis a Number and aBigIntStats-like object whosemodeis a BigInt; assertprobe()/probeNoFollow()returnmode = 384for0o600/0o777masks and do not throw.Stats/BigIntStatstests should continue to pass.stat/lstatagainst a real.asarpath with{ bigint: true }and assert the resulting object supportsisFile()/isDirectory()andmode & 0o777n-style arithmetic without error.Workaround for downstream applications
Packaged Electron applications that cannot disable ASAR view (because their own code is loaded from
app.asar) can normalize the returnedmodebefore BigInt operations, or stat.asarpaths through a physical-filesystem bypass. Downstream DSH Desktop already works around this by settingprocess.noAsar = truefor unpacked processes; the official packaged build loads its own code fromapp.asar, so it cannot do that.Additional context
This was observed while running DeepSeek Harness
0.2.0-rc.2on Windows. Reading the installation's ownresources\app.asarthrough DSH file tools triggered the exact error. After patching the built expression toNumber(info.mode) & 511, DSHreadno longer threw the BigInt error and correctly returnednot a regular filefor the ASAR archive path.All reactions