Browse code

Fix a bug triggered when a real filepath appears more than once in a virtual file.

Xavier G authored on 11/04/2020 13:34:54
Showing 1 changed files

... ...
@@ -225,11 +225,16 @@ class CombinedFS(Operations):
225 225
 				attrs[prop] = getattr(root_stats, prop)
226 226
 			attrs['st_mode'] = stat.S_IFREG | read_mode_setting(file_spec, 'mode', def_mode)
227 227
 			return attrs
228
+		# One array to hold the actual, successive filepaths, one dict to hold
229
+		# the latest stat() result for each file:
230
+		filepaths = []
228 231
 		stats = {}
229 232
 		def stat_file(path):
230 233
 			stats[path] = os.stat(path)
234
+			filepaths.append(path)
231 235
 		self.iterate_paths(stat_file, paths)
232
-		for filepath, stat_obj in stats.items():
236
+		for filepath in filepaths:
237
+			stat_obj = stats[filepath]
233 238
 			# Pick the highest/latest value for access/change/modification times:
234 239
 			for prop in TIME_PROPS:
235 240
 				prop_val = getattr(stat_obj, prop)