Skip to content

Fix O_PATH branch returns - #1385

Merged
Jay Bosamiya (Microsoft) (jaybosamiya-ms) merged 3 commits into
mainfrom
jayb/fix-o-path-returns
Sep 18, 2026
Merged

Jay Bosamiya (Microsoft) (jaybosamiya-ms) merged 3 commits into
mainfrom
jayb/fix-o-path-returns

Conversation

@jaybosamiya-ms

Copy link
Copy Markdown
Member

No description provided.

@jaybosamiya-ms

Copy link
Copy Markdown
Member Author

This is just trivial fixups, not sure why I had not done these before, probably was thinking O_PATH needed special handling for these from an error perspective, but the right move is just the existing errors anyways

@jaybosamiya-ms

Copy link
Copy Markdown
Member Author

Hmm, indeed, needed some new variants, Weidong Cui (@wdcui)'s agent pointed out a few examples:

│ Consensus │ Severity │ Location                           │ Finding                                               │
├───────────┼──────────┼────────────────────────────────────┼───────────────────────────────────────────────────────┤
│ Both      │ Medium   │ litebox/src/fs/resolver.rs:752-754 │ lseek() on an O_PATH descriptor returns ESPIPE; Linux │
│           │          │                                    │ semantics require EBADF.                              │
├───────────┼──────────┼────────────────────────────────────┼───────────────────────────────────────────────────────┤
│ Both      │ Medium   │ litebox/src/fs/resolver.rs:955-957 │ getdents64() on an O_PATH directory returns ENOTDIR;  │
│           │          │                                    │ Linux semantics require EBADF.                        │
├───────────┼──────────┼────────────────────────────────────┼───────────────────────────────────────────────────────┤
│ Opus only │ Low      │ litebox/src/fs/resolver.rs:809-811 │ The new truncate() path_only branch is unreachable    │
│           │          │                                    │ because !write_allowed returns first. Consequently,   │
│           │          │                                    │ ftruncate() on an O_PATH descriptor still returns     │
│           │          │                                    │ EACCES instead of EBADF.

I've pushed a new change to add the new variants

@github-actions

Copy link
Copy Markdown

🤖 SemverChecks 🤖 ⚠️ Potential breaking API changes detected ⚠️

Click for details
--- failure enum_no_repr_variant_discriminant_changed: enum variant had its discriminant change value ---

Description:
The enum's variant had its discriminant value change. This breaks downstream code that used its value via a numeric cast like `as isize`.
        ref: https://doc.rust-lang.org/reference/items/enumerations.html#assigning-discriminant-values
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.50.0/src/lints/enum_no_repr_variant_discriminant_changed.ron

Failed in:
  variant TruncateError::IsTerminalDevice 3 -> 4 in /home/runner/work/litebox/litebox/litebox/src/fs/errors.rs:100
  variant TruncateError::Io 4 -> 5 in /home/runner/work/litebox/litebox/litebox/src/fs/errors.rs:102
  variant ReadDirError::Io 2 -> 3 in /home/runner/work/litebox/litebox/litebox/src/fs/errors.rs:204
  variant SeekError::Io 4 -> 5 in /home/runner/work/litebox/litebox/litebox/src/fs/errors.rs:85

--- failure enum_variant_added: enum variant added on exhaustive enum ---

Description:
A publicly-visible enum without #[non_exhaustive] has a new variant.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#enum-variant-new
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.50.0/src/lints/enum_variant_added.ron

Failed in:
  variant TruncateError:NotOpenForWriting in /home/runner/work/litebox/litebox/litebox/src/fs/errors.rs:98

@wdcui Weidong Cui (wdcui) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks!

Merged via the queue into main with commit 709b32b Sep 18, 2026
15 checks passed
@jaybosamiya-ms
Jay Bosamiya (Microsoft) (jaybosamiya-ms) deleted the jayb/fix-o-path-returns branch September 18, 2026 01:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants