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

apply_patch drops trailing spaces from filenames

Open Beginner friendly
#53,245 2 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@akhil9tiet is already working on this.

Since Oct 12, 2026.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
75/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
rust
Domain
cli, devtools

Research direction

Start by locating the apply_patch parser that reads *** Add File headers; the issue says the parsing code remains on main at commit a9b0815167c27ab13719dd12d13b63e02b70d221. Reproduce the issue on Linux with a filename ending in a space, then trace how the header becomes a path. Done when the patch writes to the filename with its trailing space and leaves the similarly named file unchanged.

Written by the indexing model from the issue text.

Description

bug tool-calls
What issue are you seeing?

This is a minor edge case, but Linux supports filenames ending in a space. Codex's apply_patch silently removes that space and writes to a different file. Gemini CLI and OpenCode handle the same filename correctly with their write tools.

Observed on Linux at Codex commit ca466061d64f0b44f416135c7fd06aa7af850bbc. The same parsing code remains on main at a9b0815167c27ab13719dd12d13b63e02b70d221.

What steps can reproduce the bug?

Create a file whose name ends in one space:

printf 'old\n' > 'notes.txt '

Call apply_patch with this patch. The Add File header must have one space immediately after notes.txt:

*** Begin Patch
*** Add File: notes.txt 
+hello
*** End Patch

Expected: write hello\n to notes.txt .

Actual: Codex reports success adding notes.txt, creates that file with hello\n, and leaves notes.txt unchanged. This simplified reproduction follows the same code path as the recorded test, which used zu.log .

What is the expected behavior?

See above

Additional information

No response

Dominant language
Rust
Stars
128k
Forks
20.1k
Avg merge
1m
Merged PRs (30d)
994

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 openai/codex

All issues in openai/codex

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.