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

オープン
#2,108 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
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分
マージ済み PR(30日)
378

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

callstackincubator/simlock のほかの issue

callstackincubator/simlock の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。