-
Notifications
You must be signed in to change notification settings - Fork 384
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve POSIX compliance in CLI/FileUtils.cpp #1064
Conversation
Thanks for the contribution! I'm not sure what |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs a different compatibility strategy so that macOS/Linux by default do not need to stat the file.
@zeux Thanks! I'll try to find where that macro is defined. It's supposed to translate the d_type parameter into the mode_t bitfields. I was so happy to find something that worked on both Haiku and Linux that it didn't occur to me that it might not be defined. |
Apple has it defined in the last entry in dirent.h. I'll try checking for an include directive for sys/types.h and dirent.h and see if it helps. |
Ah, maybe that's the issue here - your patch is using |
There. Sorry about the typos. It should be smaller and less branchy by eliminating the double-pipe or statements (d_type==x || mode & S_x) becomes (mode & S_x) on the if statements. |
Thanks - this is better, but we're not there yet. I don't think the switch to From Linux bits/stat.h:
A bit test vs IFDIR will also cover block devices. This will cause us to recurse into block devices which will probably not end well. Additionally, because some values (IFLNK in particular) have multiple bits set, testing using |
OK. This should be better. The double equals checks are back in place. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I think this looks good now.
## What's Changed - Improve POSIX compliance in `CLI/FileUtils.cpp` by @SamuraiCrow #1064 - `AstStat*::hasEnd` is deprecated; use `AstStatBlock::hasEnd` instead - Added a lint for common misuses of the `#` operator - Luau now issues deprecated diagnostics for some uses of `getfenv` and `setfenv` - Fixed a case where we included a trailing space in some error stringifications ### Compiler - Do not do further analysis in O2 on self functions - Improve detection of invalid repeat..until expressions vs continue ### New Type Solver - We now cache subtype test results to improve performance - Improved operator inference mechanics (aka type families) - Further work towards type states - Work towards [new non-strict mode](https://github.com/Roblox/luau/blob/master/rfcs/new-nonstrict.md) continues ### Native Codegen - Instruction last use locations should follow the order in which blocks are lowered - Add a bonus assertion to IrLoweringA64::tempAddr --- Co-authored-by: Arseny Kapoulkine <[email protected]> Co-authored-by: Vyacheslav Egorov <[email protected]> Co-authored-by: Andy Friesen <[email protected]> Co-authored-by: Aaron Weiss <[email protected]> Co-authored-by: Alexander McCord <[email protected]> Co-authored-by: Vighnesh Vijay <[email protected]>
Some POSIX platforms, such as Haiku and some BSDs, don't supply DT_* identifiers and the corresponding d_type field in stat. This fixes that and has been tested to still work on 64-bit Linux as well as 64-bit Haiku.