@@ -273,23 +273,27 @@ def __init__(self, manifest, args, decrypted_repository):
273273 self .uid_forced = None
274274 self .gid_forced = None
275275 self .umask = 0
276+ self .archive_root_dir = {} # archive ID --> directory name
276277
277278 def _create_filesystem (self ):
278279 self ._create_dir (parent = 1 ) # first call, create root dir (inode == 1)
279280 self .versions_index = FuseVersionsIndex ()
280281 archives = self ._manifest .archives .list_considering (self ._args )
281282 name_counter = Counter (a .name for a in archives )
282283 duplicate_names = {a .name for a in archives if name_counter [a .name ] > 1 }
284+ for archive in archives :
285+ name = f"{ archive .name } "
286+ if name in duplicate_names :
287+ name += f"-{ bin_to_hex (archive .id ):.8} "
288+ self .archive_root_dir [archive .id ] = name
283289 for archive in archives :
284290 if self .versions :
285291 # process archives immediately
286292 self ._process_archive (archive .id )
287293 else :
288294 # lazily load archives, create archive placeholder inode
289295 archive_inode = self ._create_dir (parent = 1 , mtime = int (archive .ts .timestamp () * 1e9 ))
290- name = f"{ archive .name } "
291- if name in duplicate_names :
292- name += f"-{ bin_to_hex (archive .id ):.8} "
296+ name = self .archive_root_dir [archive .id ]
293297 self .contents [1 ][os .fsencode (name )] = archive_inode
294298 self .pending_archives [archive_inode ] = archive
295299
@@ -310,7 +314,7 @@ def check_pending_archive(self, inode):
310314 # Check if this is an archive we need to load
311315 archive_info = self .pending_archives .pop (inode , None )
312316 if archive_info is not None :
313- self ._process_archive (archive_info .id , [os .fsencode (archive_info .name )])
317+ self ._process_archive (archive_info .id , [os .fsencode (self . archive_root_dir [ archive_info .id ] )])
314318
315319 def _allocate_inode (self ):
316320 self .inode_count += 1
0 commit comments