Fix two confirmed findings from full codebase audit

- patch_ui.py: wrap shutil.copy2 backup in try/except OSError so a
  permission or read-only filesystem error prints a specific diagnostic
  instead of crashing the script with a generic 'exited non-zero' message
- install.sh: add early guard that detects pipe-install (bash <(curl ...))
  and exits with a clear error pointing to the git clone workflow
This commit is contained in:
2026-06-15 16:03:19 +00:00
parent 2a3b15b4b2
commit 7c9aa7159a
2 changed files with 13 additions and 1 deletions
+5 -1
View File
@@ -90,7 +90,11 @@ def main():
backup = path + ".pre-truecloud-patch"
if not os.path.exists(backup):
shutil.copy2(path, backup)
try:
shutil.copy2(path, backup)
except OSError as exc:
print(f"[truecloud-patch] ERROR: Could not create backup {backup}: {exc}")
return
patched, count = FIND.subn(REPLACE, content)
if count != 1: