termux-sync 1.3.6__tar.gz → 1.3.7__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {termux_sync-1.3.6 → termux_sync-1.3.7}/CHANGELOG.md +16 -0
- {termux_sync-1.3.6 → termux_sync-1.3.7}/PKG-INFO +1 -1
- {termux_sync-1.3.6 → termux_sync-1.3.7}/pyproject.toml +1 -1
- {termux_sync-1.3.6 → termux_sync-1.3.7}/src/termux_sync/__init__.py +34 -9
- {termux_sync-1.3.6 → termux_sync-1.3.7}/.gitignore +0 -0
- {termux_sync-1.3.6 → termux_sync-1.3.7}/LICENSE +0 -0
- {termux_sync-1.3.6 → termux_sync-1.3.7}/README.md +0 -0
|
@@ -11,6 +11,22 @@ Version numbers follow [Semantic Versioning](https://semver.org/).
|
|
|
11
11
|
|
|
12
12
|
---
|
|
13
13
|
|
|
14
|
+
## [1.3.7] - 2026-11-19
|
|
15
|
+
|
|
16
|
+
### Added
|
|
17
|
+
- `Repo Bot` workflow that runs every 6 hours (and on demand). It runs lint and tests against the latest dependencies, checks that the version in `pyproject.toml`, the source, `uv.lock` and `CHANGELOG.md` agree, and checks that `termux-sync.py` mirrors the package. It opens a pull request when the script drifted, starts the PyPI publish when a GitHub release is missing from PyPI for more than 90 minutes, and keeps a single "Repository health report" issue up to date, closing it when everything passes again.
|
|
18
|
+
- `release-pypi.yml` can now be started by hand (`workflow_dispatch`) with an existing release tag, which is what the bot uses to repair a missing PyPI upload.
|
|
19
|
+
|
|
20
|
+
### Fixed
|
|
21
|
+
- **Restore could write outside the backed-up directory.** Each archive was extracted into the parent of its backup root, and members were only checked against that wider directory, so a crafted `usr_etc` or `usr_lib` archive could overwrite files such as `$PREFIX/bin/sh`. Every member must now start with the folder name the backup would have produced (`etc`, `lib`, `home`); anything else is skipped and logged.
|
|
22
|
+
- Package names read from a manifest are validated and passed to `pkg install` after `--`, so a name starting with `-` can no longer be read as an option.
|
|
23
|
+
|
|
24
|
+
### Changed
|
|
25
|
+
- The daemon no longer re-reads the schedule at the top of every loop before waiting; it checks it once after each wait, which is when a change matters. Behaviour is otherwise the same as in 1.3.6.
|
|
26
|
+
- More regression tests for the 1.3.6 fixes (temporary folder selection, config permissions, unsafe archive names in a manifest, invalid names in `delete`, hard link and extraction failures), to bring patch coverage back above the Codecov target.
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
14
30
|
## [1.3.6] - 2026-11-13
|
|
15
31
|
|
|
16
32
|
### Fixed
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: termux-sync
|
|
3
|
-
Version: 1.3.
|
|
3
|
+
Version: 1.3.7
|
|
4
4
|
Summary: Backup and restore your entire Termux environment across devices
|
|
5
5
|
Project-URL: Homepage, https://github.com/djunekz/termux-sync
|
|
6
6
|
Project-URL: Repository, https://github.com/djunekz/termux-sync
|
|
@@ -55,7 +55,7 @@ except ImportError:
|
|
|
55
55
|
)
|
|
56
56
|
sys.exit(1)
|
|
57
57
|
|
|
58
|
-
VERSION = "1.3.
|
|
58
|
+
VERSION = "1.3.7"
|
|
59
59
|
APP_NAME = "termux-sync"
|
|
60
60
|
CONFIG_DIR = Path.home() / ".config" / APP_NAME
|
|
61
61
|
CONFIG_FILE = CONFIG_DIR / "config.json"
|
|
@@ -438,6 +438,9 @@ def get_installed_packages() -> list[str]:
|
|
|
438
438
|
return []
|
|
439
439
|
|
|
440
440
|
|
|
441
|
+
_PKG_NAME_RE = re.compile(r"[A-Za-z0-9][A-Za-z0-9+._-]*")
|
|
442
|
+
|
|
443
|
+
|
|
441
444
|
def install_packages(pkg_list: list[str], console: Console) -> list[str]:
|
|
442
445
|
"""Reinstall packages one by one. Returns the names that failed."""
|
|
443
446
|
if not pkg_list:
|
|
@@ -449,9 +452,14 @@ def install_packages(pkg_list: list[str], console: Console) -> list[str]:
|
|
|
449
452
|
task = progress.add_task("[cyan]Installing…", total=total)
|
|
450
453
|
for i, pkg in enumerate(pkg_list, 1):
|
|
451
454
|
progress.update(task, description=f"[cyan]{i}/{total} {escape(pkg)}")
|
|
455
|
+
if not _PKG_NAME_RE.fullmatch(str(pkg)):
|
|
456
|
+
log("WARNING", f"Skipped invalid package name in manifest: {pkg!r}")
|
|
457
|
+
failed.append(str(pkg))
|
|
458
|
+
progress.advance(task)
|
|
459
|
+
continue
|
|
452
460
|
try:
|
|
453
461
|
subprocess.run(
|
|
454
|
-
["pkg", "install", "-y", pkg],
|
|
462
|
+
["pkg", "install", "-y", "--", pkg],
|
|
455
463
|
capture_output=True, check=True
|
|
456
464
|
)
|
|
457
465
|
except Exception:
|
|
@@ -582,7 +590,23 @@ def _safe_extract_member(member: tarfile.TarInfo, dest_path: Path):
|
|
|
582
590
|
raise ValueError(f"Refusing device/fifo entry in archive: {member_name!r}")
|
|
583
591
|
|
|
584
592
|
|
|
585
|
-
def
|
|
593
|
+
def _check_member_root(member: tarfile.TarInfo, expected_top: str | None):
|
|
594
|
+
if expected_top is None:
|
|
595
|
+
return
|
|
596
|
+
parts = [p for p in Path(member.name).parts if p != "."]
|
|
597
|
+
if not parts or parts[0] != expected_top:
|
|
598
|
+
raise ValueError(
|
|
599
|
+
f"Archive member outside expected root {expected_top!r}: {member.name!r}"
|
|
600
|
+
)
|
|
601
|
+
|
|
602
|
+
|
|
603
|
+
def extract_archive(
|
|
604
|
+
archive_path: Path,
|
|
605
|
+
dest_path: Path,
|
|
606
|
+
label: str,
|
|
607
|
+
progress: Progress,
|
|
608
|
+
expected_top: str | None = None,
|
|
609
|
+
):
|
|
586
610
|
task = progress.add_task(f"[cyan]{label}", total=None)
|
|
587
611
|
dest_path.mkdir(parents=True, exist_ok=True)
|
|
588
612
|
|
|
@@ -592,6 +616,7 @@ def extract_archive(archive_path: Path, dest_path: Path, label: str, progress: P
|
|
|
592
616
|
for member in tf.getmembers():
|
|
593
617
|
try:
|
|
594
618
|
_safe_extract_member(member, dest_path)
|
|
619
|
+
_check_member_root(member, expected_top)
|
|
595
620
|
except ValueError as e:
|
|
596
621
|
log("WARNING", f"Skipped unsafe archive member during restore: {e}")
|
|
597
622
|
continue
|
|
@@ -1609,9 +1634,11 @@ def cmd_restore(cfg: dict, backup_name: str = ""):
|
|
|
1609
1634
|
# and must never be trusted as an extraction root — only used to double
|
|
1610
1635
|
# check they agree with the known-safe root for that item key.
|
|
1611
1636
|
allowed_roots = {}
|
|
1637
|
+
expected_tops = {}
|
|
1612
1638
|
for item_key, _label, item_root in BACKUP_ITEMS:
|
|
1613
1639
|
if item_root is not None:
|
|
1614
1640
|
allowed_roots[item_key] = Path(item_root).resolve().parent
|
|
1641
|
+
expected_tops[item_key] = Path(item_root).resolve().name
|
|
1615
1642
|
|
|
1616
1643
|
for key, info in manifest.get("files", {}).items():
|
|
1617
1644
|
if _clean_backup_name(info.get("archive", "")) != info.get("archive"):
|
|
@@ -1628,7 +1655,10 @@ def cmd_restore(cfg: dict, backup_name: str = ""):
|
|
|
1628
1655
|
continue
|
|
1629
1656
|
|
|
1630
1657
|
try:
|
|
1631
|
-
extract_archive(
|
|
1658
|
+
extract_archive(
|
|
1659
|
+
archive, src_dir, info["archive"], progress,
|
|
1660
|
+
expected_top=expected_tops.get(key),
|
|
1661
|
+
)
|
|
1632
1662
|
log("INFO", f"Extracted {info['archive']} → {src_dir}")
|
|
1633
1663
|
except Exception as e:
|
|
1634
1664
|
console.print(f" [red]✗ Extract failed: {escape(str(e))}[/red]")
|
|
@@ -1945,11 +1975,6 @@ def cmd_daemon(cfg: dict):
|
|
|
1945
1975
|
log("INFO", "Daemon started")
|
|
1946
1976
|
|
|
1947
1977
|
while True:
|
|
1948
|
-
sched = load_schedule()
|
|
1949
|
-
if not sched.get("enabled"):
|
|
1950
|
-
log("INFO", "Daemon stopped: auto-backup was disabled")
|
|
1951
|
-
console.print("[yellow]Auto-backup was disabled. Daemon stopped.[/yellow]")
|
|
1952
|
-
return
|
|
1953
1978
|
now = datetime.datetime.now()
|
|
1954
1979
|
target = now.replace(hour=sched["hour"], minute=sched["minute"], second=0, microsecond=0)
|
|
1955
1980
|
if target <= now:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|