Commit bd90aa6
committed
Auto merge of #44895 - stephaneyfx:master, r=dtolnay
Made `fs::copy` return the length of the main stream
On Windows with the NTFS filesystem, `fs::copy` would return the sum of the
lengths of all streams, which can be different from the length reported by
`metadata` and thus confusing for users unaware of this NTFS peculiarity.
This makes `fs::copy` return the same length `metadata` reports which is the
value it used to return before PR #26751. Note that alternate streams are still
copied; their length is just not included in the returned value.
This change relies on the assumption that the stream with index 1 is always the
main stream in the `CopyFileEx` callback. I could not find any official
document confirming this but empirical testing has shown this to be true,
regardless of whether the alternate stream is created before or after the main
stream.
Resolves #445322 files changed
+22
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1374 | 1374 | | |
1375 | 1375 | | |
1376 | 1376 | | |
1377 | | - | |
| 1377 | + | |
| 1378 | + | |
1378 | 1379 | | |
1379 | 1380 | | |
1380 | 1381 | | |
1381 | 1382 | | |
1382 | 1383 | | |
1383 | 1384 | | |
1384 | | - | |
| 1385 | + | |
| 1386 | + | |
| 1387 | + | |
1385 | 1388 | | |
1386 | 1389 | | |
1387 | 1390 | | |
| |||
2589 | 2592 | | |
2590 | 2593 | | |
2591 | 2594 | | |
2592 | | - | |
| 2595 | + | |
2593 | 2596 | | |
2594 | 2597 | | |
2595 | 2598 | | |
2596 | 2599 | | |
2597 | 2600 | | |
2598 | 2601 | | |
| 2602 | + | |
| 2603 | + | |
| 2604 | + | |
| 2605 | + | |
| 2606 | + | |
| 2607 | + | |
| 2608 | + | |
| 2609 | + | |
| 2610 | + | |
| 2611 | + | |
| 2612 | + | |
| 2613 | + | |
2599 | 2614 | | |
2600 | 2615 | | |
2601 | 2616 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
722 | 722 | | |
723 | 723 | | |
724 | 724 | | |
725 | | - | |
| 725 | + | |
726 | 726 | | |
727 | | - | |
728 | | - | |
| 727 | + | |
| 728 | + | |
729 | 729 | | |
730 | 730 | | |
731 | 731 | | |
732 | 732 | | |
733 | 733 | | |
734 | | - | |
| 734 | + | |
735 | 735 | | |
736 | 736 | | |
737 | 737 | | |
| |||
0 commit comments