Backup: probe the target with a real write instead of access(W_OK)

On the server the backup folder is a Synology NFS share with "map all
users to admin": access(W_OK) returns EACCES for uid 1000 although
writes succeed, so the first scheduled run failed with "not usable".
Create and remove a probe file instead; test that it leaves nothing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
MaashkinoozheandClaude Opus 5.5 committed 2026-10-22 18:12:41 +02:00
1 parent 086f6353f8
commit f8f21ab42a
3 files changed
+18 -2

No files matched your search

+5 -1
View File
@@ -169,7 +169,11 @@ class BackupService {
try {
const st = await fsp.stat(this.backupRoot);
if (!st.isDirectory()) throw new Error('not a directory');
await fsp.access(this.backupRoot, fs.constants.W_OK);
// Probe with a real write: access(W_OK) is unreliable on NFS with squashed ids (Synology
// "map all users to admin" denies it although writes succeed).
const probe = path.join(this.backupRoot, `.circus-backup-probe-${process.pid}`);
await fsp.writeFile(probe, '');
await fsp.rm(probe, { force: true });
const names = (await fsp.readdir(this.backupRoot)).filter(name => ARCHIVE.test(name)).sort();
this.archives = await Promise.all(names.map(async name => ({ name, size: (await fsp.stat(path.join(this.backupRoot, name))).size, at: archiveTime(name) })));
this.targetError = null;