diff options
| author | Ryan Liptak <squeek502@hotmail.com> | 2023-08-19 15:41:09 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2023-08-19 22:32:24 -0700 |
| commit | 020105d0dde614538a5839ede697e63a43bf6aa6 (patch) | |
| tree | cf82ea1142d2bf8367049e69a794633d639fbbd5 /src/codegen/llvm.zig | |
| parent | a11cdb6a34de8820826e49ba54459c3abd4aca4e (diff) | |
| download | zig-020105d0dde614538a5839ede697e63a43bf6aa6.tar.gz zig-020105d0dde614538a5839ede697e63a43bf6aa6.zip | |
Cache: Fix findPrefix when paths are slightly out of the ordinary
This makes Cache.findPrefix/findPrefixResolved use `std.fs.path.relative` instead of `std.mem.startsWith` when checking if a file is within a prefix. This fixes multiple edge cases around prefix detection:
- If a prefix path ended with a path separator, then the first character of the 'sub_path' would get cut off because the previous implementation assumed it was a path separator. Example: prefix: `/foo/`, file_path: `/foo/abc.txt` would see that they both start with `/foo/` and then slice starting from one byte past the common prefix, ending up with `bc.txt` instead of the expected `abc.txt`
- If a prefix contained double path separators after any component, then the `startsWith` check would erroneously fail. Example: prefix: `/foo//bar`, file_path: `/foo/bar/abc.txt` would not see that abc.txt is a sub path of the prefix `/foo//bar`
- On Windows, case insensitivity was not respected at all, instead the UTF-8 bytes were compared directly
This fixes all of the things in the above list (and possibly more).
Diffstat (limited to 'src/codegen/llvm.zig')
0 files changed, 0 insertions, 0 deletions
