Closed magicant closed 3 months ago
The recent updates in the yash project enhance file handling by replacing outdated flag-based approaches with structured, type-safe enumerations for file access permissions. This transition improves code clarity and maintainability while introducing robust error handling. The reorganization of file system operations results in a more efficient and user-friendly shell environment, fostering better interactions with file descriptors.
Files | Change Summary |
---|---|
yash-builtin/src/exec.rs | Updated file permission handling using Mode for clarity; replaced bitwise operations with explicit method calls. |
yash-builtin/src/source/semantics.rs | Switched from OFlag to OfdAccess and OpenFlag in open_file , enhancing type safety and clarity in file access modes. |
yash-cli/src/startup/init_file.rs | Refactored file opening logic to use OpenFlag and OfdAccess , improving file access clarity and functionality. |
yash-cli/src/startup/input.rs | Changed input handling to non-blocking mode; updated file opening with new type-safe flags. |
yash-env/CHANGELOG.md | Documented changes in the system module, introduced new types, methods, and structural changes for improved usability. |
yash-env/src/input/fd_reader.rs | Refactored open method to accept OfdAccess and OpenFlag , enhancing file opening granularity. |
yash-env/src/system.rs | Enhanced file system functionality with new methods; updated open to use structured flags for better access management. |
yash-env/src/system/file_system.rs | Added DEFAULT_DIRECTORY_MODE ; refactored permission management to use structured types for clarity. |
yash-semantics/src/command/item.rs | Updated nullify_stdin to use OfdAccess , improving clarity in file descriptor handling. |
yash-semantics/src/redir.rs | Refactored file opening methods to utilize new access types (OfdAccess , OpenFlag ), enhancing validation and error handling in file operations. |
yash-env/src/system/real/open_flag.rs | Added methods to OfdAccess and OpenFlag enums for better mapping to real system flags, improving interoperability with underlying file operations. |
sequenceDiagram
participant User
participant Shell
participant System
User->>Shell: Request file operation
activate Shell
Shell->>System: Open file with OfdAccess
activate System
System-->>Shell: Return file descriptor
deactivate System
Shell-->>User: Confirm operation success
deactivate Shell
🐇 In the meadow where bunnies play,
New changes hop in, brightening the day!
With clearer paths and flags so neat,
File handling's now a joyful feat!
So let us celebrate with a cheerful cheer,
For a better shell is finally here! 🌼✨
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
This is part of #353.
The fcntl_setfl and fcntl_getfl functions are removed in favor of the new functions get_and_set_nonblocking and ofd_access. We cannot support the fcntl_setfl function because its return value may need to contain platform-specific flags that cannot be represented in a portable type.
The Mode type is replaced with a new homebrew type.
Summary by CodeRabbit
New Features
Bug Fixes
Documentation
Chores