Skip to content

linter: --fix panics on read-only files instead of reporting a write error #22858

@fallintoplace

Description

@fallintoplace

What version of Oxlint are you using?

1.67.0 (built from current main, commit 39d92d65e9)

What command did you run?

tmpdir=$(mktemp -d)
printf 'var x = 1;\n' > "$tmpdir/test.js"
chmod 444 "$tmpdir/test.js"
target/debug/oxlint --fix -D no-var "$tmpdir/test.js"

What does your .oxlintrc.json (or oxlint.config.ts) config file look like?

No config file.

What happened?

I hit a deterministic panic when --fix tries to write back to a read-only file.

The repro above currently crashes with:

thread '<unnamed>' panicked at crates/oxc_linter/src/service/runtime.rs:722:75:
called `Result::unwrap()` on an `Err` value: Os { code: 13, kind: PermissionDenied, message: "Permission denied" }

RuntimeFileSystem::write_file already returns Result<(), std::io::Error>, so this looks like the fix path is still unwrapping a normal OS write error.

I would expect oxlint to report a regular write failure for that file and exit non-zero, rather than panic.

Metadata

Metadata

Assignees

Labels

Type

Priority

None yet

Effort

None yet

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions