Moved the check for formatting a directory#5648
Moved the check for formatting a directory#5648DrDeano wants to merge 1 commit intoziglang:masterfrom
Conversation
The original check for a directory was for the `readAllAlloc` so move the check from open to read. This in turn fixes the fmt step in the build script for directories.
|
Closes ZystemOS/pluto#165 |
|
I believe the catch needs to be in both open and read rather than moved from one to the other. If I'm reading the code correctly, then on Windows, (note that previously, the EDIT: Would |
|
@DrDeano thank you for the patch, and apologies for the downstream breakage. This landed in edea7a4.
On Linux, when opening a file with read-only permissions, there is no way to determine whether the file descriptor is a directory handle without an additional syscall. In the additional commits I added to this branch before merging, I modified the symlink loop detection to use the inode rather than the realpath. This means unconditionally doing a stat() for both directories and files, which also tells whether the file descriptor is a directory or not. I got a bit carried away with the merge, but the end result should be that and (repeated for every directory) |
|
This auto generated graph from https://github.com/ziglang/gotta-go-fast/blob/master/records.csv is messy, but you can still see the dip at the end from the merge: |

The original check for a directory was for the
readAllAllocso move the check from open to read. This in turn fixes the fmt step in the build script for directories.