Commit c6820a1
authored
Fix
When `dereference_symlinks: true` was set and there was a symlink cycle
(e.g., a -> b -> a), the function would infinitely recurse. This fix
tracks visited paths using a `MapSet` and returns `{:error, :eloop, path}`
when a cycle is detected.File.cp_r/3 infinite loop with symlink cycles (#15152)1 parent 93734a5 commit c6820a1
2 files changed
Lines changed: 41 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1199 | 1199 | | |
1200 | 1200 | | |
1201 | 1201 | | |
1202 | | - | |
| 1202 | + | |
| 1203 | + | |
| 1204 | + | |
1203 | 1205 | | |
1204 | 1206 | | |
1205 | 1207 | | |
| |||
1240 | 1242 | | |
1241 | 1243 | | |
1242 | 1244 | | |
1243 | | - | |
| 1245 | + | |
1244 | 1246 | | |
1245 | 1247 | | |
1246 | 1248 | | |
| |||
1253 | 1255 | | |
1254 | 1256 | | |
1255 | 1257 | | |
1256 | | - | |
1257 | | - | |
| 1258 | + | |
| 1259 | + | |
| 1260 | + | |
| 1261 | + | |
| 1262 | + | |
| 1263 | + | |
| 1264 | + | |
| 1265 | + | |
| 1266 | + | |
1258 | 1267 | | |
1259 | 1268 | | |
1260 | 1269 | | |
| |||
1268 | 1277 | | |
1269 | 1278 | | |
1270 | 1279 | | |
1271 | | - | |
1272 | | - | |
| 1280 | + | |
| 1281 | + | |
| 1282 | + | |
| 1283 | + | |
| 1284 | + | |
| 1285 | + | |
| 1286 | + | |
| 1287 | + | |
| 1288 | + | |
| 1289 | + | |
| 1290 | + | |
1273 | 1291 | | |
1274 | 1292 | | |
1275 | 1293 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
678 | 678 | | |
679 | 679 | | |
680 | 680 | | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
681 | 698 | | |
682 | 699 | | |
683 | 700 | | |
| |||
0 commit comments