patch: moving an executable script removes its executable bit
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- shell, typescript
- Domain
- developer-experience, tooling
Research direction
Start in the V2 patch tool’s move path, specifically where it writes the destination and removes the source, and review the core tool test harness for existing move and symlink cases. Reproduce the provided script.sh rename, then add or update a test asserting that mode 0755 is preserved. The work is done when the moved script retains its executable bit, runs successfully, and existing symlink behavior still passes.
Written by the indexing model from the issue text.
Description
Description
The V2 patch tool drops the executable bit when it moves a script. The tool reports success, but running the moved script then fails with Permission denied (exit 126). This breaks a rename-and-run workflow even though the script was executable beforehand.
I reproduced this locally through the registered patch tool. The move path writes a new destination file and removes the source, so a 0755 source becomes a 0644 destination. The move should preserve the source permission bits. Copying those bits after the destination write and before source removal fixes the failure while keeping the existing symlink behavior.
Plugins
None beyond the built-in patch tool.
OpenCode version
2.1.4, V2 local source reproduction.
Steps to reproduce
-
Create and run an executable script:
printf '#!/bin/sh\necho before\n' > script.sh chmod 755 script.sh ./script.sh -
Call the V2
patchtool with thispatchText:*** Begin Patch *** Update File: script.sh *** Move to: nested/renamed.sh @@ -echo before +echo after *** End Patch -
Run
./nested/renamed.sh.
Expected: prints after, exits 0, and retains mode 0755.
Actual: patch reports success, but the destination is 0644 and execution fails with Permission denied (exit 126).
Screenshot
Not applicable; command-line reproduction.
Operating System
Linux (POSIX executable permissions).
Terminal
Bash; reproduced using the core tool test harness.
- Dominant language
- TypeScript
- Stars
- 215k
- Forks
- 28.9k
- Avg merge
- 4h 37m
- Merged PRs (30d)
- 512
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing 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.
More from anomalyco/opencode
-
Snapshot capture failure (EPERM spawning git) fails the whole step despite the best-effort contractOpenreproduced
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
anomalyco/opencode#58685 · 1 comment ·
Maintainers usually reply within 1 day
-
reproduced
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
anomalyco/opencode#58664 · 1 comment ·
Maintainers usually reply within 1 day
-
reproduced
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
anomalyco/opencode#58648 · 3 comments ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
anomalyco/opencode#58636 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
anomalyco/opencode#58618 · 1 comment ·
Maintainers usually reply within 1 day
All issues in anomalyco/opencode
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
awesome-dsh-plugin/awesome-dsh-plugin#9184 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
farion1231/cc-switch#8829 ·
Maintainers usually reply within 1 day
-
[core-client] Remove unused hand-maintained transport helpers after the definition-table cutoverOpendoc-audit enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100