zig/lib/std/os
Ryan Liptak 3f7166eb8b child_process: Fix regression on Windows for FAT filesystems
This fixes a regression caused by https://github.com/ziglang/zig/pull/13993

As an optimization, the first call to `NtQueryDirectoryFile` would only ask for a single result and assume that if the result returned did not match the app_name exactly, then the unappended app_name did not exist. However, this relied on the assumption that the unappended app_name would always be returned first, but that only seems to be the case on NTFS. On FAT filesystems, the order of returned files can be different, which meant that it could assume the unappended file doesn't exist when it actually does.

This commit fixes that by fully iterating the wildcard matches via `NtQueryDirectoryFile` and taking note of any unappended/PATHEXT-appended filenames it finds. In practice, this strategy does not introduce a speed regression compared to the previous (buggy) implementation.

Benchmark 1 (10 runs): winpathbench-master.exe
  measurement          mean ± σ            min … max           outliers         delta
  wall_time           508ms ± 4.08ms     502ms …  517ms          1 (10%)        0%
  peak_rss           3.62MB ± 2.76KB    3.62MB … 3.63MB          0 ( 0%)        0%
Benchmark 2 (10 runs): winpathbench-fat32-fix.exe
  measurement          mean ± σ            min … max           outliers         delta
  wall_time           500ms ± 21.4ms     480ms …  535ms          0 ( 0%)          -  1.5% ±  2.8%
  peak_rss           3.62MB ± 2.76KB    3.62MB … 3.63MB          0 ( 0%)          -  0.0% ±  0.1%

---

Partially addresses #16374 (it fixes `zig build` on FAT32 when no `zig-cache` is present)
2023-07-23 19:09:20 -07:00
..
linux linux: rework getcontext to closer match the specification (saved IP/SP match the state after it would return) 2023-07-20 22:58:14 -04:00
plan9 all: zig fmt and rename "@XToY" to "@YFromX" 2023-06-19 12:34:42 -07:00
uefi more UEFI alignment fixes 2023-07-20 12:46:33 -07:00
windows debug: fix reading -gdwarf generated debug sections in COFF files 2023-07-20 22:58:14 -04:00
linux.zig debug: fix initialization of the optional fields on StackIterator 2023-07-20 22:58:15 -04:00
plan9.zig all: migrate code to new cast builtin syntax 2023-06-24 16:56:39 -07:00
test.zig all: migrate code to new cast builtin syntax 2023-06-24 16:56:39 -07:00
uefi.zig std.os.uefi: use std.os.uefi.cc instead of .C as calling convention 2023-07-08 17:32:36 -04:00
wasi.zig all: migrate code to new cast builtin syntax 2023-06-24 16:56:39 -07:00
windows.zig child_process: Fix regression on Windows for FAT filesystems 2023-07-23 19:09:20 -07:00