Checkpoint archive name longer than cli argument validator allows
Discussed in https://github.com/borgbackup/borg/discussions/8319
Originally posted by SpiritInAShell August 4, 2024 user too tired to evaluate this properly (and doesn't want to spam Issues (again) with user error)
Still, if this was a BUG, it should be addressed soon.
tl;dr:
with borg2 v2.0.0b9 it is possible to (unpurposefully) create archive names exceeding length of 200chars, by interrupting the process, where archive name will be extended by string .checkpoint which causes length to exceed 200chars. That archive cannot be accessed by borg list <too long archive name>.
I roughly tried this with borg import-tar aswell as borg create where I interrupted the process after a minute to force creating a .checkpoint
I did some short testing with newly created empty borg2 repos. It seems to be true for these, too.
Have you checked borgbackup docs, FAQ, and open GitHub issues?
Yes
Is this a BUG / ISSUE report or a QUESTION?
BUG (likely)
System information. For client/server mode post info for both machines.
Your borg version (borg -V).
> borg2beta version # just a symbolic link
2.0.0b9 / 2.0.0b9
Operating system (distribution) and version.
> uname -a
Linux hp-server 5.16.0-0.bpo.4-amd64 #1 SMP PREEMPT Debian 5.16.12-1~bpo11+1 (2022-03-08) x86_64 GNU/Linux
How much data is handled by borg?
A: about 400GiB on a sftp share B: empty new created repos on ext4 filesystem
Full borg commandline that lead to the problem (leave away excludes and passwords)
borg2beta import-tar <...> "<archive name total length 197> - < export.tar
# pressed ctrl+c or other cause of interruption
borg2beta list --bypass-lock --short --repo=/<path to a read-only snapshot>/<myRepo>.borg2/ <archivename length total 208 chars ending with .checkpoint.checkpoint>
Describe the problem you're observing.
Can you reproduce the problem? If so, describe how. If not, describe troubleshooting steps you took before opening the issue.
Yes.
Include any warning/errors/backtraces from the system logs
TODO:
- check the background of that 200 chars limit
- if there is no problem when slightly going over the limit, fix the validator so that it ignores the length of ".checkpoint*".
Linux have 2 variables: #define NAME_MAX 255 /* # chars in a file name / #define PATH_MAX 4096 / # chars in a path name including nul */
BSD have same NAME_MAX limit as Linux, but PATH_MAX is limited to 1024 /* max bytes in pathname */
Microsoft Windows has a MAX_PATH limit of 260 characters, but starting from Windows 10, version 1607, MAX_PATH limitations have been removed from many common Win32 file and directory functions.
@infectormp The archive name is not present in the filesystem, neither as path, nor as filename.
borg stores the archive names within the repository manifest and within the archive metadata (and both are stored into segment files).
So, the limitation in length is rather as a precautionary measure - to not have to deal with too long archive names in case there is a restriction some day.
#8332 might "fix" this in master branch, because it does not do checkpointing any more (because there is no need to for the way it works with that PR's code).
Oops, just noticed I was wrong, sorry @infectormp!
Yeah, master branch imposes some limits on the archive name and the reason has to do with the filesystem: because archive names are directory names when mounting the repo with borg mount. So we need to stay below NAME_MAX (on Linux).
Considering fixing this:
- borg 1.x archivename_validator does not limit archive name length (but likely it should, to avoid issues when migrating to borg2)
- the specific
.checkpointname length issue is solved for borg2, since #8332 was merged
Closing this. Issue mentioned in top comment does not exist anymore.