Skip to content

worker: give a local Mirror an absolute, allowed destination - #21

Draft
ash-iir wants to merge 1 commit into
mainfrom
fix-mirror-local-path
Draft

ash-iir wants to merge 1 commit into
mainfrom
fix-mirror-local-path

Conversation

@ash-iir

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

Copy link
Copy Markdown
Owner

Backend #11. With the default local destination (no dests/local.json), DPATH is empty and remote_pfx is just vdbackup, relative to the worker's cwd. Mirror backups failed on a read-only / or landed somewhere unintended, and Mirror restore read the same relative path. do_mirror also never checked the local path against safe_local_dest, unlike transfer_full.

  • New mirror_local_dest (used by do_mirror and do_restore_mirror): for a local destination with no path, DPATH becomes <backups dir>/.mirror (/data/media/<u>/VDBackup/.mirror, hidden from the backup list like .paths/.adb). Then safe_local_dest must pass, else ERR_DEST_UNSAFE (existing code and message).
  • do_mirror: the APK sync result is now checked; a failure fails the mirror with ERR_TRANSFER like the other items (_bfail is set up before it).
  • rclone mirrors are unchanged.

Mirror data from the old relative path, if any ever landed somewhere, is not migrated.

Testing

  • sh -n, mksh -n, busybox sh -n; shellcheck -s sh: same warnings as main.
  • The real remote_pfx, mirror_local_dest, safe_local_dest and do_mirror with stubbed rsync/pm/freeze, under mksh R59, busybox 1.37 ash and dash, run from /: default dest becomes /data/media/0/VDBackup/.mirror and the prefix is absolute; /data/adb/x is refused with ERR_DEST_UNSAFE; rclone dest untouched; a failing APK rsync ends with ERR_TRANSFER, a clean run with ok.
  • Not tested on a rooted device.

The default local destination has no path, so Mirror mode wrote to and
restored from "vdbackup" relative to the worker's cwd. Default it to
.mirror in the user's backups dir, and refuse a local Mirror path that
fails safe_local_dest, as a full backup's local copy already does. A
failed APK sync now also fails the mirror instead of being ignored.

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