Skip to content

platform-tools 是目录联接时也认得出自己起的 logcat 采集 - #125

Merged
qiyinxi merged 1 commit into
ModAVD:mainfrom
qiyinxi:fix/capture-junction
Nov 11, 2026
Merged

qiyinxi merged 1 commit into
ModAVD:mainfrom
qiyinxi:fix/capture-junction

Conversation

@qiyinxi

@qiyinxi qiyinxi commented Nov 10, 2026

Copy link
Copy Markdown
Member

为什么

根目录的 sdk\platform-tools 是目录联接或符号链接时,管理器认不出自己起的 logcat 采集:开机不打印 logcat:<路径>,开诊断模式误报「已有其它程序采集 logcat」(ModAVD/ModAVD#135)。

原因是 capturePathMatches 在 Windows 上只比路径名:进程映像路径是解析过链接的,m.Root.AdbExe() 是经过链接的,两边对不上。根目录本身是联接时,tools\modavd.exe 和根目录参数的比对也一样。

改了什么

internal/emu/capture_policy.go 的 capturePathMatches:Windows 上名字(不分大小写)一样就算;不一样时再按文件身份(os.SameFile)比,和其它平台的做法一样。ownedCapture、pendingOwnedCapture、waitDiagnosticCaptureRuntime、ownsCaptureHelper 都经过它,一起修好。

测试

  • 新单测 TestCapturePathMatchesThroughJunction:platform-tools 是目录联接、根目录是联接、大小写不同、同目录的别的文件、不存在的文件、空路径。去掉修复时前两项失败。
  • go test ./internal/emu/... 通过;go vet(Windows、GOOS=darwin)通过。

Refs ModAVD/ModAVD#135

进程映像路径是解析过链接的,m.Root.AdbExe() 经过链接,capturePathMatches
在 Windows 上只比名字,两边对不上:开机不打印 logcat 路径,开诊断误报
「已有其它程序采集」。根目录本身是联接时,tools\modavd.exe 和根目录参数
的比对也一样。

Windows 上名字对不上时,再按文件身份(os.SameFile)比,和别的平台一样。
补了 platform-tools 和根目录是目录联接时的单测,去掉修复时单测失败。

Refs ModAVD/ModAVD#135
@qiyinxi qiyinxi added the bug Something isn't working / 有东西坏了 label Nov 10, 2026
@qiyinxi
qiyinxi added this pull request to the merge queue Nov 11, 2026
Merged via the queue into ModAVD:main with commit ee5a651 Nov 11, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working / 有东西坏了

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant