mirror of
https://github.com/borgbackup/borg.git
synced 2026-04-29 01:49:54 -04:00
HardLinkManager: allow NoneType for contentless hardlinks, see #9208
Some hardlinks have content and thus a chunks list, but e.g. block or char device hardlinks do not have a chunks list.
This commit is contained in:
parent
352f982393
commit
3bda2f10d9
2 changed files with 4 additions and 2 deletions
|
|
@ -346,7 +346,7 @@ class HardLinkManager:
|
|||
def __init__(self, *, id_type, info_type):
|
||||
self._map = {}
|
||||
self.id_type = id_type
|
||||
self.info_type = info_type
|
||||
self.info_type = info_type # can be a single type or a tuple of types
|
||||
|
||||
def borg1_hardlinkable(self, mode): # legacy
|
||||
return stat.S_ISREG(mode) or stat.S_ISBLK(mode) or stat.S_ISCHR(mode) or stat.S_ISFIFO(mode)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
from struct import Struct
|
||||
from types import NoneType
|
||||
|
||||
from .constants import REQUIRED_ITEM_KEYS, CH_BUZHASH
|
||||
from .compress import ZLIB, ZLIB_legacy, ObfuscateSize
|
||||
|
|
@ -53,7 +54,8 @@ class UpgraderFrom12To20:
|
|||
|
||||
def new_archive(self, *, archive):
|
||||
self.archive = archive
|
||||
self.hlm = HardLinkManager(id_type=bytes, info_type=list) # hlid -> chunks_correct
|
||||
# hlid -> chunks_correct list (or None, for contentless hardlinks)
|
||||
self.hlm = HardLinkManager(id_type=bytes, info_type=(list, NoneType))
|
||||
|
||||
def upgrade_item(self, *, item):
|
||||
"""Upgrades the item as needed and removes legacy data."""
|
||||
|
|
|
|||
Loading…
Reference in a new issue