[Borgbackup] Local Exception

Thomas Waldmann tw at waldmann-edv.de
Thu Jul 14 16:38:18 EDT 2022


> / is on BTRFS, /home is on XFS, both support chmod.

And the repo is not on a separate fs, but also on XFS?

> One week before, it worked on the same machine. Maybe something is
> broken. If I only could find the one (?) file that is broken/missing?

borg <= 1.2.0 had a bug (or rather "unpretty behaviour") and the fix 
introduced that chmod you see in the traceback (in borg 1.2.1).

The tmp file you see there is created by borg right before it gets 
written to, chmoded and renamed over the old config file. This is to 
avoid empty or partially written config files in case something goes 
wrong. The rename op is atomic, so you either keep the old config file 
or you will have the new config file, but other states are not possible.

And as a file owner, one is allowed to chmod ones own files.

The chmod is because the python stdlib "make a tempfile" code uses very 
strict permissions on the temp file. But in the end, we want the mode to 
look like on a normally created file (which is 666 & ~umask).

>>>> Local Exception
>>>> Traceback (most recent call last):
>>>>     File "/usr/lib64/python3.10/site-packages/borg/archiver.py", line 5115, in main
>>>>       exit_code = archiver.run(args)
>>>>     File "/usr/lib64/python3.10/site-packages/borg/archiver.py", line 5046, in run
>>>>       return set_ec(func(args))
>>>>     File "/usr/lib64/python3.10/site-packages/borg/archiver.py", line 168, in wrapper
>>>>       with repository:
>>>>     File "/usr/lib64/python3.10/site-packages/borg/repository.py", line 198, in __enter__
>>>>       self.create(self.path)
>>>>     File "/usr/lib64/python3.10/site-packages/borg/repository.py", line 297, in create
>>>>       self.save_config(path, config)
>>>>     File "/usr/lib64/python3.10/site-packages/borg/repository.py", line 322, in save_config
>>>>       with SaveFile(config_path) as fd:
>>>>     File "/usr/lib64/python3.10/site-packages/borg/platform/base.py", line 248, in __exit__
>>>>       os.chmod(self.tmp_fname, mode=0o666 & ~ umask)
>>>> PermissionError: [Errno 1] Operation not permitted: '/home/boris/Dokumente/temp/BorgBackup/config-bsdwfcdw.tmp'


More information about the Borgbackup mailing list