Skip to content

worker: fail snapshot, mirror and import restores when the APK install fails - #22

Draft
ash-iir wants to merge 1 commit into
mainfrom
fix-install-checks
Draft

ash-iir wants to merge 1 commit into
mainfrom
fix-install-checks

Conversation

@ash-iir

@ash-iir ash-iir commented Nov 19, 2026

Copy link
Copy Markdown
Owner

Backend #12. Only restore() checked pm path after the install session (the issue #7 fix). Snapshot restore, Mirror restore and the DataBackup and Neo-Backup imports ignored a failed install-commit, then wiped and restored the data and finished with ok.

  • New install_ok <op>: the same fw pm path --user "$U" "$PKG" check as restore(); on failure it audits and ends with ERR_INSTALL (existing message). Called after the install step of all four, only when that step had APKs.
  • The install session is now created only when there is something to write (Mirror without apk/, a snapshot with no .apk, a DataBackup apk.tar.zst with no APKs), so no session is left open.
  • Neo import:
    • a data archive that fails to decrypt ended neo_item's loop with rc 0, so a wrong password skipped the data silently. It now ends with ERR_IMPORT_ENCRYPTED, which the WebUI already answers by asking for the password again.
    • an encrypted APK that fails to decrypt does the same, after pm install-abandon on the open session.

Like restore(), the check can't tell a failed update of an app that was already installed; the old version is still there, so the data restore goes on.

Testing

  • sh -n, mksh -n, busybox sh -n; shellcheck -s sh: same warnings as main.
  • The real do_restore_mirror and install_ok with stubbed fw/rsync, under mksh R59, busybox 1.37 ash and dash: APKs + package missing afterwards gives ERR_INSTALL; APKs + installed gives ok; no APKs gives ok and no install-create call.
  • Snapshot, DataBackup and Neo paths: syntax and review only, not run.
  • Not tested on a rooted device.

…l fails

Only restore() checked that the package was installed after the install
session. Snapshot and Mirror restores and the Neo-Backup and DataBackup
imports ignored a failed install, then restored the data and reported
success.

- New install_ok: the same pm path --user check as restore(), with
  ERR_INSTALL on failure; used after each of the four install steps.
- Create the install session only when there are APKs to write.
- Neo import: a decrypt failure (APK or data archive) now ends with
  ERR_IMPORT_ENCRYPTED, so the WebUI asks for the password again,
  instead of skipping the item and reporting success. A session opened
  for the APKs is abandoned.

Signed-off-by: ash-iir <254348575+ash-iir@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant