This repository was archived by the owner on Sep 14, 2026. It is now read-only.
Repository navigation
Fix expire phase failing on snapshots without owner write bit - #1
Merged
Merged
Conversation
fn_expire_backup called fn_rm_dir directly without ever sanitizing permissions. When a snapshot aged into expiration containing files or directories without u+w (typical of ISPConfig .php-fcgi-starter at 0500, web1/ at 0550, or /etc/ssl/private/ at 0700), `rm -rf` failed with "Permission denied" and the entire backup run aborted. Real-world trigger on stor01-ovh, user kvm476: rm: cannot remove '.../2026-01-19-124749/var/www/php-fcgi-scripts/ web1/.php-fcgi-starter': Permission denied Two changes: 1. fn_fix_permissions: widen the find filter from the narrow `-perm 0111` / `-perm 000` to `! -perm -u=w`. This catches every dir/file where the owner lacks write, including 0400, 0500, 0550, 0700, 0710 — all common in /var/www, /root, /etc/ssl/private. Also collapse the duplicated SUDO branches into a single $sudo_cmd prefix. 2. fn_expire_backup: invoke fn_fix_permissions on the snapshot before fn_rm_dir, guarded so it only runs on local destinations (the find in fn_fix_permissions does not go through fn_run_cmd / SSH). Added tests/06_expire_perms.bats with two regression cases: - ISPConfig-style 0500 file inside 0550 dir - 0400 private key inside 0700 dir All 56 bats tests pass.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
fn_expire_backupinvocabafn_rm_dirdirectamente sin sanear permisos. Cuando un snapshot envejece y contiene ficheros/dirs sinu+w(típico de ISPConfig.php-fcgi-starter0500,web1/0550, o/etc/ssl/private/0700),rm -rffalla conPermission deniedy aborta todo el backup.Caso real detectado en stor01-ovh (user kvm476):
```
rm: cannot remove '.../2026-01-19-124749/var/www/php-fcgi-scripts/web1/.php-fcgi-starter': Permission denied
```
Changes
fn_fix_permissions— filtro ampliado de-perm 0111/-perm 000a! -perm -u=w. Captura cualquier dir/file donde el propietario carece de write (0400, 0500, 0550, 0700, 0710...). Ramas SUDO colapsadas en un único\$sudo_cmd.fn_expire_backup— llama afn_fix_permissionssobre el snapshot antes defn_rm_dir, condicionado a destino local (la función no usafn_run_cmd, no es SSH-aware).Test plan
tests/06_expire_perms.batsStorages afectados (propagación tras merge)
stor01-ovh(user kvm476)localstor-indiva(user indiva)stor01avanzait(user avanzait)🤖 Generated with Claude Code