-
Notifications
You must be signed in to change notification settings - Fork 3
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
Redefine FdFlag #393
Redefine FdFlag #393
Conversation
WalkthroughThis update enhances the Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant System
participant FdFlag
participant EnumSet
User->>System: Request file descriptor operation
System->>FdFlag: Check flags
FdFlag->>EnumSet: Convert to EnumSet<FdFlag>
System->>EnumSet: Process multiple flags
EnumSet-->>System: Return flag status
System-->>User: Respond with operation result
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? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
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.
Actionable comments posted: 0
Outside diff range, codebase verification and nitpick comments (3)
yash-env/src/system/real.rs (2)
213-214
: Ensure all calls todup
useEnumSet<FdFlag>
The change to use
EnumSet<FdFlag>
improves flexibility. Ensure all calls todup
are updated to use the new flag type. The following instances need to be updated:
yash-semantics/src/redir.rs: .dup(target_fd, MIN_INTERNAL_FD, FdFlag::CloseOnExec.into())
yash-env/src/system/virtual.rs: let result = system.dup(Fd::STDOUT, Fd::STDERR, FdFlag::CloseOnExec.into());
Please update these instances to use
EnumSet<FdFlag>
.Analysis chain
LGTM! Verify the usage of
dup
in the codebase.The change to use
EnumSet<FdFlag>
improves flexibility. Ensure all calls todup
are updated to use the new flag type.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all function calls to `dup` match the new signature. # Test: Search for the function usage. Expect: Only occurrences of the new signature. rg --type rust -A 5 $'dup'Length of output: 12553
304-309
: Update required forfcntl_setfd
calls!Some calls to
fcntl_setfd
still useFdFlag::CloseOnExec.into()
. These need to be updated to useEnumSet<FdFlag>
for consistency with the new function signature.
- Files to update:
yash-semantics/src/redir.rs
yash-env/src/system/virtual.rs
Please update these calls to use
EnumSet<FdFlag>
.Analysis chain
LGTM! Verify the usage of
fcntl_setfd
in the codebase.The change to accept
EnumSet<FdFlag>
improves flexibility. Ensure all calls tofcntl_setfd
are updated to use the new flag type.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all function calls to `fcntl_setfd` match the new signature. # Test: Search for the function usage. Expect: Only occurrences of the new signature. rg --type rust -A 5 $'fcntl_setfd'Length of output: 4455
yash-env/src/system/shared.rs (1)
319-319
: Update required indup
function callThe
dup
function call inyash-semantics/src/redir.rs
still usesFdFlag::CloseOnExec.into()
. This needs to be updated to useEnumSet<FdFlag>
to match the new function signature.
- File:
yash-semantics/src/redir.rs
- Line: Update the
dup
call to useEnumSet<FdFlag>
.Analysis chain
LGTM! Verify the usage of
dup
in the codebase.The change to use
EnumSet<FdFlag>
improves flexibility. Ensure all calls todup
are updated to use the new flag type.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all function calls to `dup` match the new signature. # Test: Search for the function usage. Expect: Only occurrences of the new signature. rg --type rust -A 5 $'dup'Length of output: 12553
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (11)
- yash-builtin/src/source/semantics.rs (2 hunks)
- yash-env/CHANGELOG.md (2 hunks)
- yash-env/src/system.rs (6 hunks)
- yash-env/src/system/fd_flag.rs (1 hunks)
- yash-env/src/system/real.rs (3 hunks)
- yash-env/src/system/shared.rs (6 hunks)
- yash-env/src/system/virtual.rs (10 hunks)
- yash-env/src/system/virtual/io.rs (2 hunks)
- yash-env/src/system/virtual/process.rs (2 hunks)
- yash-semantics/src/command/pipeline.rs (6 hunks)
- yash-semantics/src/redir.rs (5 hunks)
Files skipped from review due to trivial changes (1)
- yash-semantics/src/redir.rs
Additional comments not posted (33)
yash-env/src/system/fd_flag.rs (4)
1-15
: LGTM! Licensing information is correctly formatted.The licensing information is complete and correctly formatted.
17-17
: LGTM! Module-level documentation is clear and informative.The module-level documentation provides a good overview of the module.
19-19
: LGTM! Import statement is necessary and correctly used.The import of
EnumSetType
is necessary for defining theFdFlag
enum.
21-28
: LGTM!FdFlag
enum is correctly defined and well-documented.The
FdFlag
enum is correctly defined usingEnumSetType
and includes necessary documentation for each variant. The TODO comment indicates future work.yash-env/CHANGELOG.md (4)
Line range hint
12-30
:
LGTM! "Added" section is accurate and well-documented.The "Added" section for version 0.3.0 is accurate, complete, and well-documented.
31-43
: LGTM! "Changed" section is accurate and well-documented.The "Changed" section for version 0.3.0 is accurate, complete, and well-documented.
Line range hint
45-47
:
LGTM! "Deprecated" section is accurate and well-documented.The "Deprecated" section for version 0.3.0 is accurate, complete, and well-documented.
Line range hint
49-53
:
LGTM! "Removed" section is accurate and well-documented.The "Removed" section for version 0.3.0 is accurate, complete, and well-documented.
yash-builtin/src/source/semantics.rs (2)
166-166
: LGTM! Import statement is necessary and correctly used.The import of
EnumSet
is necessary for the updated assertion logic in the test suite.
263-263
: LGTM! Updated assertion logic is correct and adheres to best practices.The updated assertion logic using
EnumSet::only(FdFlag::CloseOnExec)
is correct and adheres to best practices.yash-semantics/src/command/pipeline.rs (4)
22-22
: Import statement approved.The
EnumSet
import is necessary for the newEnumSet
type used in the file.
309-309
: Code change approved.The update to use
EnumSet::empty()
instead ofFdFlag::empty()
aligns with the new implementation and ensures consistency.
655-656
: Code change approved.The update to check for
flags
instead offlag
in the assertion aligns with the new implementation and ensures that the tests reflect the updated structure of the file descriptor representation.
674-676
: Code change approved.The update to check for
flags
instead offlag
in the assertion aligns with the new implementation and ensures that the tests reflect the updated structure of the file descriptor representation.Also applies to: 694-694
yash-env/src/system/virtual/io.rs (3)
23-23
: Import statement approved.The
EnumSet
import is necessary for the newEnumSet
type used in the file.
244-244
: Code change approved.The update to use
EnumSet<FdFlag>
instead of a singleFdFlag
enhances the flexibility of theFdBody
structure by allowing it to hold multiple flags simultaneously.
249-250
: Code change approved.The update to compare the new
flags
field instead of the previousflag
field in thePartialEq
implementation ensures that the comparison now reflects the potential for multiple flags.yash-env/src/system.rs (5)
20-20
: Module introduction approved.The
fd_flag
module is necessary for better organization and encapsulation of the file descriptor flag-related functionality.
34-34
: Code change approved.The update to use the new
fd_flag
module for theFdFlag
import aligns with the new module structure and ensures consistency.
122-122
: Code change approved.The update to use
EnumSet<FdFlag>
instead ofFdFlag
in thedup
method signature enhances the flexibility of the method by allowing it to accept multiple flags simultaneously.
167-167
: Code change approved.The update to return
Result<EnumSet<FdFlag>>
instead ofResult<FdFlag>
in thefcntl_getfd
method signature enhances the flexibility of the method by allowing it to return multiple flags simultaneously.
172-172
: Code change approved.The update to accept
EnumSet<FdFlag>
instead ofFdFlag
in thefcntl_setfd
method signature enhances the flexibility of the method by allowing it to accept multiple flags simultaneously.yash-env/src/system/real.rs (1)
294-301
: LGTM! Verify the usage offcntl_getfd
in the codebase.The change to return
EnumSet<FdFlag>
improves flexibility. Ensure all calls tofcntl_getfd
are updated to handle the new return type.yash-env/src/system/virtual/process.rs (1)
Line range hint
598-661
: LGTM! Verify the usage ofFdBody
in the codebase.The change to use
EnumSet<FdFlag>
improves flexibility. Ensure all instances ofFdBody
are updated to handle the new flag type.Verification successful
All instances of
FdBody
have been updated to handle the new flag typeEnumSet<FdFlag>
.The changes are consistent across the codebase, ensuring proper handling of the new flag type.
yash-env/src/system/virtual.rs
yash-env/src/system/virtual/process.rs
yash-env/src/system/virtual/io.rs
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all instances of `FdBody` are updated to handle the new flag type. # Test: Search for the struct usage. Expect: Only occurrences of the new flag type. rg --type rust -A 5 $'FdBody'Length of output: 7413
yash-env/src/system/shared.rs (2)
346-346
: LGTM! Verify the usage offcntl_getfd
in the codebase.The change to return
EnumSet<FdFlag>
improves flexibility. Ensure all calls tofcntl_getfd
are updated to handle the new return type.Verification successful
LGTM! Verify the usage of
fcntl_getfd
in the codebase.The change to return
EnumSet<FdFlag>
improves flexibility. Ensure all calls tofcntl_getfd
are updated to handle the new return type.
yash-semantics/src/redir.rs
: The call tofcntl_getfd
correctly uses thecontains
method.yash-env/src/system/virtual.rs
: The calls tofcntl_getfd
correctly use theunwrap
method and handleEnumSet<FdFlag>
.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all function calls to `fcntl_getfd` match the new return type. # Test: Search for the function usage. Expect: Only occurrences of the new return type. rg --type rust -A 5 $'fcntl_getfd'Length of output: 4215
349-349
: LGTM! Verify the usage offcntl_setfd
in the codebase.The change to accept
EnumSet<FdFlag>
improves flexibility. Ensure all calls tofcntl_setfd
are updated to use the new flag type.yash-env/src/system/virtual.rs (7)
165-165
: LGTM!The initialization of
flags
withEnumSet::empty()
aligns with the new flag management strategy.
402-406
: LGTM!The initialization of
flags
withEnumSet::empty()
aligns with the new flag management strategy.
418-421
: LGTM!The update to accept
EnumSet<FdFlag>
forflags
and setting theflags
field aligns with the new flag management strategy.
428-428
: LGTM!Setting the
flags
field toEnumSet::empty()
aligns with the new flag management strategy.
499-502
: LGTM!The conditional initialization of the
flags
field withEnumSet::only(FdFlag::CloseOnExec)
orEnumSet::empty()
aligns with the new flag management strategy.
558-561
: LGTM!The update to return
EnumSet<FdFlag>
forfcntl_getfd
aligns with the new flag management strategy.
564-567
: LGTM!The update to accept
EnumSet<FdFlag>
forfcntl_setfd
and setting theflags
field aligns with the new flag management strategy.
This pull request is part of #353 and replaces the
FdFlag
type with a platform-independent definition.Summary by CodeRabbit
New Features
Bug Fixes
EnumSet
type for file descriptor flags, improving accuracy and consistency.Refactor
EnumSet<FdFlag>
, improving flexibility and clarity in flag handling.Documentation