Commit 07e4fb2
authored
[FS] Make fstatfs actually work (#23381)
Prior to this change, `fstatfs` calls `statfs64` with the `char*` path
pointer argument set to zero. Generally byte zero of the memory seems to
be null, so when `statfs64` converts this `char*` to a JS string it gets
the empty string. Then it calls `FS.statfs` with the empty string as an
argument. `FS.statfs` calls `lookupPath` with an empty string argument
which returns a `null` node, so `fstatfs` returns the default values for
when there is no statfs handler in the files system.
This fixes the problem and adds testing for statfs/fstatfs on nodefs and
rawfs. We have to add separate `FS.statfsNode` and `FS.statfsStream`
handlers because in some cases `stream.node` is null and in some cases
`stream.path` is useless (like for stdout). Also, in noderawfs we need
to give paths for the standard streams because there is unfortunately no
`fs.fstatfsSync` so we can only access information from the host via a
path. This means the noderawfs test won't be portable to windows.1 parent ebfeaf7 commit 07e4fb2
File tree
5 files changed
+56
-25
lines changed- src
- test
- unistd
5 files changed
+56
-25
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
693 | 693 | | |
694 | 694 | | |
695 | 695 | | |
696 | | - | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
697 | 705 | | |
698 | | - | |
| 706 | + | |
| 707 | + | |
699 | 708 | | |
700 | 709 | | |
701 | 710 | | |
| |||
709 | 718 | | |
710 | 719 | | |
711 | 720 | | |
712 | | - | |
713 | | - | |
714 | | - | |
| 721 | + | |
| 722 | + | |
715 | 723 | | |
716 | 724 | | |
717 | 725 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | | - | |
| 51 | + | |
| 52 | + | |
52 | 53 | | |
53 | | - | |
| 54 | + | |
54 | 55 | | |
55 | 56 | | |
56 | 57 | | |
| |||
79 | 80 | | |
80 | 81 | | |
81 | 82 | | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
82 | 89 | | |
83 | 90 | | |
84 | 91 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
66 | 78 | | |
67 | 79 | | |
68 | 80 | | |
| |||
801 | 813 | | |
802 | 814 | | |
803 | 815 | | |
804 | | - | |
805 | | - | |
806 | | - | |
807 | | - | |
808 | | - | |
809 | | - | |
810 | | - | |
811 | | - | |
812 | | - | |
813 | | - | |
814 | | - | |
| 816 | + | |
815 | 817 | | |
816 | 818 | | |
817 | 819 | | |
818 | 820 | | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
819 | 824 | | |
820 | | - | |
| 825 | + | |
| 826 | + | |
821 | 827 | | |
822 | 828 | | |
823 | 829 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
| 39 | + | |
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| |||
13741 | 13741 | | |
13742 | 13742 | | |
13743 | 13743 | | |
13744 | | - | |
| 13744 | + | |
| 13745 | + | |
13745 | 13746 | | |
13746 | | - | |
13747 | | - | |
| 13747 | + | |
| 13748 | + | |
13748 | 13749 | | |
13749 | 13750 | | |
13750 | 13751 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
8 | | - | |
9 | | - | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
10 | 19 | | |
11 | 20 | | |
12 | 21 | | |
0 commit comments