Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

patch: moving an executable script removes its executable bit

Open Beginner friendly
#58,651 2 comments 0 reactions 0 assignees View on GitHub

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

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

reproduced
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
  1. Create and run an executable script:

    printf '#!/bin/sh\necho before\n' > script.sh
    chmod 755 script.sh
    ./script.sh
    
  2. Call the V2 patch tool with this patchText:

    *** Begin Patch
    *** Update File: script.sh
    *** Move to: nested/renamed.sh
    @@
    -echo before
    +echo after
    *** End Patch
    
  3. 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

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from anomalyco/opencode

All issues in anomalyco/opencode

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.