Skip to content

feat(eldritch-libfile): implement cross-platform file.chmod method#2356

Draft
KCarretto wants to merge 3 commits into
mainfrom
feat/eldritch-chmod-17410459241447846603
Draft

feat(eldritch-libfile): implement cross-platform file.chmod method#2356
KCarretto wants to merge 3 commits into
mainfrom
feat/eldritch-chmod-17410459241447846603

Conversation

@KCarretto
Copy link
Copy Markdown
Collaborator

Adds a new chmod method to the FileLibrary trait in eldritch-libfile to allow cross-platform modification of file permissions.

  • Unix platforms correctly set the full permissions mode.
  • Windows platforms inspect the owner writable bit (0o200) and toggle the read-only file attribute accordingly, mimicking Golang's os.Chmod behavior.
  • Added corresponding mock implementations to fake.rs to maintain testing compatibility.
  • Added standard implementations and tests to chmod_impl.rs.

PR created automatically by Jules for task 17410459241447846603 started by @KCarretto

Adds a new `chmod` method to `FileLibrary` in `eldritch-libfile`.
The method sets file permissions using `std::fs::set_permissions` and `std::os::unix::fs::PermissionsExt` on Unix platforms.
On Windows platforms, it adopts the logic from Golang's `os.Chmod`, checking only the `0o200` (owner writable) bit to determine whether to clear or set the read-only attribute via `std::fs::Permissions::set_readonly`.
Includes unit tests for both platform implementations.

Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com>
@google-labs-jules
Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

google-labs-jules Bot and others added 2 commits May 17, 2026 01:00
Adds a new `chmod` method to `FileLibrary` in `eldritch-libfile`.
The method sets file permissions using `std::fs::set_permissions` and `std::os::unix::fs::PermissionsExt` on Unix platforms.
On Windows platforms, it adopts the logic from Golang's `os.Chmod`, checking only the `0o200` (owner writable) bit to determine whether to clear or set the read-only attribute via `std::fs::Permissions::set_readonly`.
Includes unit tests for both platform implementations, and fixes `golem` cli tests expecting specific file library functions output.

Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com>
Adds a new `chmod` method to `FileLibrary` in `eldritch-libfile`.
The method sets file permissions using `std::fs::set_permissions` and `std::os::unix::fs::PermissionsExt` on Unix platforms.
On Windows platforms, it adopts the logic from Golang's `os.Chmod`, checking only the `0o200` (owner writable) bit to determine whether to clear or set the read-only attribute via `std::fs::Permissions::set_readonly`.
Includes unit tests for both platform implementations, fixes `golem` cli tests expecting specific file library functions output, and adds documentation.

Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com>
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.

1 participant