Remote adb/simctl passthrough corrupts binary stdout (exec-out screencap returns U+FFFD instead of 0x89)

未关闭
#2,108 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
74/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
android, node.js, typescript
领域
backend, cli

调研方向

Start by tracing the remote adb command path used with --url or SIMLOCK_URL, from the CLI through the worker response handling. Check where stdout is converted between bytes and text, then look for tests covering streamed command output. Done means the repro returns a PNG beginning 8950 4e47 0d0a 1a0a; the issue names no relevant source or test files.

由索引模型根据 Issue 内容生成。

描述

What happens

When a command runs on a worker through a farm URL (simlock --url <farm-url> adb …, or with SIMLOCK_URL set), binary stdout comes back corrupted. A PNG from screencap starts with ef bf bd 50 4e 47 instead of 89 50 4e 47: the 0x89 byte has been replaced by the UTF-8 replacement character (U+FFFD). It looks as if the output is decoded as UTF-8 text somewhere on the remote path and re-encoded.

The docs use this exact command (using-devices/build-and-run.mdx):

simlock adb -s "$SERIAL" exec-out screencap -p > home.png

using-devices/run-commands.mdx says that through a gateway or farm URL the worker runs the command and "streams the output back", with no caveat about binary output.

Repro

  1. Lease an Android emulator through a farm URL:
    simlock --url <farm-url> lease --platform android --detach --ttl 5m
  2. Run:
    simlock --url <farm-url> adb --lease <lease> exec-out screencap -p > out.png
  3. Run xxd out.png | head -1.

Expected: 8950 4e47 0d0a 1a0a (a valid PNG).
Actual: efbf bd50 4e47 …. The file isn't a valid image, and any other byte ≥ 0x80 is mangled the same way.

Workaround

adb shell "screencap -p /sdcard/s.png && base64 /sdcard/s.png", then decode locally.

Environment

  • simlock 0.9.0 (CLI and daemon)
  • macOS worker on Apple Silicon, Android emulator, API 34 and 35
  • Command sent through the farm URL, so the worker runs it and streams the output back

The same likely applies to simlock simctl … io screenshot to stdout, and to any binary output streamed back from a worker. Not verified.

主要语言
TypeScript
星标
730
派生
44
平均合并
15 小时 44 分钟
30 天内合并 PR
378

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

callstackincubator/simlock 的其他 Issue

查看 callstackincubator/simlock 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。