Skip to content

fix(storage): Allow filesystem reads without write access - #3830

Open
saikpr wants to merge 2 commits into
e2b-dev:mainfrom
saikpr:fix/fs-read-only-3802
Open

saikpr wants to merge 2 commits into
e2b-dev:mainfrom
saikpr:fix/fs-read-only-3802

Conversation

@saikpr

@saikpr saikpr commented Nov 13, 2026

Copy link
Copy Markdown

Filesystem object reads currently open files with write and create flags. This rejects existing objects on read-only storage.

Use os.Open in getHandle, check directories through the opened handle, and map missing-open errors to ErrObjectNotExist. Close rejected handles and remove the unused checkExistence parameter. Reads cannot recreate an object deleted before the open.

Add coverage for WriteTo, Size, and range reads with a read-only file and directory. Skip the permission test under root. Extend missing-object coverage and check directory rejection.

Validation:

  • A standalone test using the extracted, unchanged getHandle failed with permission denied before the fix. Afterward, read-only, missing-object, and directory checks passed with -race.
  • Formatted both files with the repository-pinned golangci-lint; git diff --check passed.
  • Package tests, make test, and make lint attempted but blocked by the existing github.com/grafana/loki/pkg/push pin: unknown revision 94c0ba7b0952. make test also encounters a missing test target in packages/local-dev. The added package tests have not executed.

Fixes #3802.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Filesystem storage reads require write access

1 participant