openrewrite / openrewrite/rewrite
SetFilePermissions fails to make any change
Open
Nobody has claimed this yet.
bug
recipe
- Dominant language
- Java
- Stars
- 3.7k
- Forks
- 570
- Avg merge
- 13h 12m
- Merged PRs (30d)
- 261
Description
What version of OpenRewrite are you using?
Moderne CLI 8.43.0 which uses OpenRewrite 8.57.0
How are you running OpenRewrite?
I tried both the Moderne SaaS product and Moderne CLI with:
mod run . --recipe=SetFilePermissions -P fileMatcher="**" -P isExecutable="false" -P isReadable="false" -P isWritable="false"
What did you see instead?
No changes are made to the file system. No file permissions are changed.
What is the full stack trace of any errors you encountered?
No stacktrace.
Context
- I tried using this recipe to fix https://github.com/openrewrite/rewrite-static-analysis/pull/650, but nothing worked.
- I spent a few minutes debugging the issue. I have been able to confirm that the
sourceFile.withFileAttributesmethod is actually called and the attributes are set against theSourceFileobjects in question. So also it's not the glob pattern issue. - I suspect this is hard to reproduce with a classic unit test as the issue might be somewhere with writing down to actual file system, a piece which is probably abstracted away in unit tests.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the SetFilePermissions recipe and the SourceFile.withFileAttributes call, then trace the Moderne CLI write-back path using the reported command. Verify whether updated file attributes reach the filesystem rather than only the SourceFile objects. Done means the command changes matching file permissions, ideally with coverage for the filesystem-writing behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100