@@ -1641,7 +1641,11 @@ fn effective_runtime_read_only_conflict_policy_from_proto(
16411641 } else {
16421642 policy. mode . clone ( )
16431643 } ,
1644- allow_promotion : policy. allow_promotion . clone ( ) ,
1644+ allow_promotion : policy
1645+ . allow_promotion
1646+ . iter ( )
1647+ . map ( |path| openshell_policy:: normalize_path ( path) )
1648+ . collect ( ) ,
16451649 }
16461650}
16471651
@@ -1662,7 +1666,11 @@ fn effective_runtime_read_only_conflict_policy_from_local(
16621666 } else {
16631667 policy. mode . clone ( )
16641668 } ,
1665- allow_promotion : policy. allow_promotion . clone ( ) ,
1669+ allow_promotion : policy
1670+ . allow_promotion
1671+ . iter ( )
1672+ . map ( |path| openshell_policy:: normalize_path ( path) )
1673+ . collect ( ) ,
16661674 }
16671675}
16681676
@@ -1723,11 +1731,18 @@ where
17231731 }
17241732 }
17251733 for path in & paths. read_write {
1726- if fs. read_write . iter ( ) . any ( |p| p == path) {
1734+ if fs
1735+ . read_write
1736+ . iter ( )
1737+ . any ( |p| openshell_policy:: normalize_path ( p) == * path)
1738+ {
17271739 continue ;
17281740 }
17291741
1730- let read_only_conflict = fs. read_only . iter ( ) . position ( |p| p == path) ;
1742+ let read_only_conflict = fs
1743+ . read_only
1744+ . iter ( )
1745+ . position ( |p| openshell_policy:: normalize_path ( p) == * path) ;
17311746 if let Some ( index) = read_only_conflict {
17321747 if promotion_allowed ( conflict_policy, path) {
17331748 fs. read_only . remove ( index) ;
@@ -1817,16 +1832,18 @@ where
18171832 }
18181833 for path in & paths. read_write {
18191834 let p = std:: path:: PathBuf :: from ( path) ;
1820- if policy. filesystem . read_write . contains ( & p) {
1821- continue ;
1822- }
1823-
1824- if let Some ( index) = policy
1835+ if policy
18251836 . filesystem
1826- . read_only
1837+ . read_write
18271838 . iter ( )
1828- . position ( |existing| existing == & p )
1839+ . any ( |existing| openshell_policy :: normalize_path ( & existing. to_string_lossy ( ) ) == * path )
18291840 {
1841+ continue ;
1842+ }
1843+
1844+ if let Some ( index) = policy. filesystem . read_only . iter ( ) . position ( |existing| {
1845+ openshell_policy:: normalize_path ( & existing. to_string_lossy ( ) ) == * path
1846+ } ) {
18301847 if promotion_allowed ( conflict_policy, path) {
18311848 policy. filesystem . read_only . remove ( index) ;
18321849 policy. filesystem . read_write . push ( p) ;
@@ -2085,7 +2102,7 @@ mod baseline_tests {
20852102 fn proto_default_conflict_policy_promotes_proc ( ) {
20862103 let mut policy = openshell_policy:: restrictive_default_policy ( ) ;
20872104 policy. filesystem = Some ( openshell_core:: proto:: FilesystemPolicy {
2088- read_only : vec ! [ "/proc" . to_string( ) ] ,
2105+ read_only : vec ! [ "/proc/ " . to_string( ) ] ,
20892106 read_write : vec ! [ ] ,
20902107 include_workdir : false ,
20912108 ..Default :: default ( )
@@ -2105,7 +2122,7 @@ mod baseline_tests {
21052122
21062123 let filesystem = policy. filesystem . expect ( "filesystem policy" ) ;
21072124 assert ! ( enriched) ;
2108- assert ! ( !filesystem. read_only. contains( & "/proc" . to_string( ) ) ) ;
2125+ assert ! ( !filesystem. read_only. contains( & "/proc/ " . to_string( ) ) ) ;
21092126 assert ! ( filesystem. read_write. contains( & "/proc" . to_string( ) ) ) ;
21102127 }
21112128
0 commit comments