Skip to content

@lute/fs: clean up some smaller problems in the filesystem implementation code#1073

Merged
aatxe merged 7 commits into
primaryfrom
awe/smaller-fs-fixups
May 7, 2026
Merged

@lute/fs: clean up some smaller problems in the filesystem implementation code#1073
aatxe merged 7 commits into
primaryfrom
awe/smaller-fs-fixups

Conversation

@aatxe
Copy link
Copy Markdown
Member

@aatxe aatxe commented May 6, 2026

This PR implements a bunch of small fixes/clean up work for various things across the implementation of @lute/fs, including:

  • Fixes a typo in the name of initializeFS where it was mistakenly initalizeFS
  • Rename some of the variables in setFlags to have clearer names without shadowing
  • Change createDurationFromTimespec32 to just be an overload of createDurationFromTimespec without suggesting any particular bit sizing
  • Remove the std::fill zero-pass over the read chunk buffer in FSRead::readCallback since only bytesRead bytes are ever appended to the output buffer, meaning nothing ever actually looks at the zeroed bytes.
  • Change the behavior of append (a) mode to include O_CREAT to make it consistent with general POSIX behavior where append will create non-existent files.
  • Eliminate some duplicated logic for the situation where the mode for files was not present.

The biggest/most disruptive change here is a change to how we validate arguments to functions. Looking at the Luau VM code and the existing built-in libraries for Luau, it's actually very abnormal to do lua_gettop and produce errors for argument counts and so forth. The general pattern is that functions will do typechecks for the arguments they're expecting, and silently ignore any additional arguments. I've changed the filesystem library to be consistent with this behavior in this PR, and I'll put up a follow-up PR to make this change across the whole project.

@aatxe aatxe self-assigned this May 6, 2026
@aatxe aatxe added bug Something isn't working runtime Work in the C++ runtime portion of the code labels May 6, 2026
@aatxe aatxe merged commit f9fa2b9 into primary May 7, 2026
15 checks passed
@aatxe aatxe deleted the awe/smaller-fs-fixups branch May 7, 2026 17:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working runtime Work in the C++ runtime portion of the code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants