@@ -420,6 +420,13 @@ let verboseArchiveName thisRoot =
420
420
Printf. sprintf " Archive for root %s synchronizing roots %s"
421
421
thisRoot (Prefs. read rootsName)
422
422
423
+ module PathMap = MyMap. Make (Path )
424
+
425
+ let mpaths = PathMap. m Proplist. m
426
+
427
+ let propPathKey : Proplist.t PathMap.t Proplist.key =
428
+ Proplist. register " paths" mpaths
429
+
423
430
let mpayload = Umarshal. prod4
424
431
marchive Umarshal. int Umarshal. string Proplist. m
425
432
Umarshal. id Umarshal. id
@@ -486,6 +493,14 @@ let loadArchiveLocal fspath (thisRoot: string) :
486
493
(* Load the datastructure *)
487
494
let ((archive, hash, magic, properties) : archive * int * string * Proplist.t) =
488
495
Umarshal. from_channel mpayload c in
496
+ (* "paths" is stored separately to keep the archive file readable
497
+ for versions <= 2.53.3 *)
498
+ let properties =
499
+ try
500
+ let paths = Umarshal. from_channel mpaths c in
501
+ Proplist. add propPathKey paths properties
502
+ with End_of_file -> properties
503
+ in
489
504
close_in c;
490
505
(* Restore to the negotiated features *)
491
506
let () = Features. setEnabled negotiatedFts in
@@ -587,7 +602,14 @@ let storeArchiveLocal fspath thisRoot archive hash magic properties =
587
602
output_string c " \030 " ;
588
603
output_string c (String. concat " \030 " (Features. changingArchiveFormat () ));
589
604
output_string c " \n " ;
605
+ (* "paths" is stored separately to keep the archive file readable
606
+ for versions <= 2.53.3. Otherwise the older versions would fail
607
+ with a fatal error "Property lists: paths not yet registered!" *)
608
+ let paths =
609
+ try Proplist. find propPathKey properties with Not_found -> PathMap. empty in
610
+ let properties = Proplist. remove propPathKey properties in
590
611
Umarshal. to_channel mpayload c (archive, hash, magic, properties);
612
+ if not (PathMap. is_empty paths) then Umarshal. to_channel mpaths c paths;
591
613
close_out c))
592
614
593
615
(* IMPORTANT! This val is here for smoother upgrades from versions <= 2.51.5
@@ -2370,11 +2392,6 @@ let mustRescanProps props setProps =
2370
2392
newXattrs = Some true || newACL = Some true
2371
2393
end
2372
2394
2373
- module PathMap = MyMap. Make (Path )
2374
-
2375
- let propPathKey : Proplist.t PathMap.t Proplist.key =
2376
- Proplist. register " paths" (PathMap. m Proplist. m)
2377
-
2378
2395
let getArchivePropsForPath thisRoot path =
2379
2396
let props = getArchiveProps thisRoot in
2380
2397
try
@@ -2457,8 +2474,20 @@ let extractOldStyleProps props =
2457
2474
2458
2475
let checkNoUpdatePredicateChange thisRoot paths =
2459
2476
(* Default to old style (<= 2.53.3) and then the new style, per path *)
2460
- let oldprops = getArchiveProps thisRoot in
2461
- setArchivePropsLocal thisRoot (clearOldStyleProps oldprops);
2477
+ let hasNewPropPaths =
2478
+ try
2479
+ ignore (Proplist. find propPathKey (getArchiveProps thisRoot));
2480
+ true
2481
+ with Not_found -> false
2482
+ in
2483
+ let oldprops =
2484
+ if hasNewPropPaths then Proplist. empty else getArchiveProps thisRoot in
2485
+ (* FIXME: Enable in some future version: setArchivePropsLocal thisRoot (clearOldStyleProps oldprops); *)
2486
+ (* FIXME: Remove in some future version.
2487
+ Store global paths props for versions <= 2.53.3. Only for compatibility. *)
2488
+ ignore (mustRescanProps (getArchiveProps thisRoot) (setArchivePropsLocal thisRoot));
2489
+ ignore (updatePredicateChanged (getArchiveProps thisRoot) (setArchivePropsLocal thisRoot));
2490
+ (* FIXME: ^ Remove the above in some future version ^ *)
2462
2491
let getPropsForPath path =
2463
2492
let pprops = getArchivePropsForPath thisRoot path in
2464
2493
if pprops <> Proplist. empty then pprops
0 commit comments