Skip to content

Saving an Android baseline fails: config.ini has spaces around = #1369

Closed

Description

@V3RON

What happened

Saving an Android baseline through the gateway fails, and the lease ends anyway, so the prepared emulator is lost:

$ simlock --gateway baseline save demo --lease <android lease>
BASELINE_SAVE_FAILED … Android device dev_… cannot be saved: its AVD names no system image. Lease lse_b8196590-6055-4eab-bef2-dd9a321d1ef8 has ended.

The cause is savedKindOf in src/drivers/android/seeds.ts:55. Its regexes expect key=value with no spaces:

/^image\.sysdir\.1=system-images\/android-([^/]+)\/([^/]+)\/([^/\s]+)\/?\s*$/m
/^hw\.device\.name=(.+?)\s*$/m

But the config.ini that avdmanager writes puts spaces around =:

image.sysdir.1 = system-images/android-36/google_apis/arm64-v8a/
hw.device.name = pixel_6

So the image line never matches. The model would also fall back to unknown. The test fixtures use no spaces, so the tests pass.

What you expected

The save succeeds and makes demo v1 for Android, the way it does for iOS.

How to reproduce

  1. simlock lease --platform android --detach (directly or through a gateway)
  2. simlock baseline save demo --lease <id>
  3. It fails every time.

Environment

Simlock 0.6.0 from main at 6674ad0, on both sides. Gateway: macOS 26.6.1 arm64. Worker (connected to the gateway over Tailscale): macOS 27.0.1 arm64, Xcode 27.1 (27A9275), emulator 37.2.13, platform-tools 36.0.0, cmdline-tools 19.0. Image: system-images;android-36;google_apis;arm64-v8a.

Logs and evidence

The same save on iOS worked (demo v1, iPhone 17, iOS 26.5, 2.3 GB). Suggested fix: allow optional whitespace around = in both regexes, and add a fixture in avdmanager's real format.

Written by an agent.

Activity

  1. added
    bug:new
    on Nov 6, 2026
  2. V3RON commented on Nov 6, 2026

    @V3RON
    ContributorAuthor

    Written by an agent.

  3. added
    platform:android
    on Nov 6, 2026
  4. self-assigned this
    on Nov 6, 2026
  5. V3RON commented on Nov 6, 2026

    @V3RON
    ContributorAuthor

    Reproduction

    Confirmed. src/drivers/android/index-lifecycle.test.ts, "saves a device whose config.ini has spaces around =, as avdmanager writes it, with the model and image it names", on bug/1369-repro. The fixture uses hw.device.name = pixel_6 and image.sysdir.1 = system-images/android-34/google_apis/arm64-v8a/. The test expects the save to succeed and the source to list model pixel_6, API 34, tag google_apis.

    $ pnpm exec vitest run --project unit src/drivers/android/index-lifecycle.test.ts -t "spaces around"
    AssertionError: promise rejected "DriverCrashError: Android device simlock_…" instead of resolving
    Caused by: DriverCrashError: Android device simlock_one cannot be saved: its AVD names no system image
     ❯ Seeds.#kindOfDevice src/drivers/android/seeds.ts:338:13
    

    The format depends on who wrote the file last. On this Mac (emulator 36.5.11) the files look like this:

    ~/.android/avd/Pixel_8_API_35.avd/config.ini              image.sysdir.1 = system-images/android-35/default/arm64-v8a/
    ~/.simlock-baselines-test/.../simlock.avd/config.ini (x5)  image.sysdir.1=system-images/android-37.0/...   (0 spaced lines)
    

    Root cause

    Defect. savedKindOf (src/drivers/android/seeds.ts:63 and :70) matches key=value with no spaces. A config.ini that avdmanager wrote keeps =. Here the emulator rewrites the file without spaces when it boots, which is why the save works on this host. On the reporter's emulator 37.2.13 the spaces stay, so the image regex never matches and #kindOfDevice (seeds.ts:338) throws. The module already has a parser that accepts spaces: iniValues (avd-config.ts:174), which foreignDevices uses on the user's own AVDs.

    Simplest fix

    Read both keys through iniValues, then match the image path on its value.

    -  const image = /^image\.sysdir\.1=system-images\/android-([^/]+)\/([^/]+)\/([^/\s]+)\/?\s*$/m.exec(
    -    config,
    +  const image = /^system-images\/android-([^/]+)\/([^/]+)\/([^/\s]+)\/?$/.exec(
    +    iniValues(config, /^image\.sysdir\.1$/)[0] ?? "",
       );
    -    model: /^hw\.device\.name=(.+?)\s*$/m.exec(config)?.[1] ?? "unknown",
    +    model: iniValues(config, /^hw\.device\.name$/)[0] ?? "unknown",
    $ pnpm exec vitest run --project unit src/drivers/android/
     Test Files  23 passed (23)
          Tests  709 passed | 1 skipped (710)
    

    Alternatives rejected

    • \s*=\s* in both regexes (as the reporter suggests): it works (709 pass), but it adds a second ini parser, and \s under /m can match across a line break.
    • Rewrite config.ini without spaces when copying: this changes a file the emulator owns, to work around a parser.

    Risk

    • iniValues takes the first =, so a value that contains = stays whole. Check that hw.device.name never needs more than that.

    Fast track

    • Defect: yes
    • Fix tried: yes
    • Nothing public added or broken: yes
    • No ADR or rule changed: yes
    • One fix: yes

    Written by an agent.

  6. removed their assignment
    on Nov 6, 2026
  7. added
    bug:ready
    fast-track
    and removed
    bug:new
    on Nov 6, 2026
  8. self-assigned this
    on Nov 6, 2026
  9. V3RON commented on Nov 6, 2026

    @V3RON
    ContributorAuthor

    Delivery run

    Merged: #1379 (#1369)
    Parked: none
    Waiting: none
    Decided: none

    Written by an agent.

  10. added a commit that references this issue on Nov 10, 2026
    5b0c552
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug:readyfast-trackplatform:android

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions