IgnoreFile: trailing space after an escaped backslash isn't trimmed
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 76/100
Research direction
Start in projects/packages/ignorefile/src/IgnoreFile.php at the trailing-space trim regex identified in the issue, then compare its behavior with Git’s backslash handling test linked in the report. Reproduce the example with the package and verify the pattern matches the path after the fix; confirm the existing ignorefile tests still pass.
Written by the indexing model from the issue text.
Description
In the ignorefile package (automattic/ignorefile 4.0.0), a pattern that ends in an escaped backslash and then a space keeps the space. Git trims it, since the backslash pair is the escaped part and the space isn't.
<?php
require 'vendor/autoload.php';
$ignore = new \Automattic\IgnoreFile();
$ignore->add( 'trailing 3 ' . str_repeat( '\\', 4 ) . ' ' );
var_dump( $ignore->ignores( 'trailing 3 ' . str_repeat( '\\', 2 ) ) );
This prints bool(false). With the same rule in a .gitignore, git check-ignore lists that path. It's the third path in Git's backslash handling test in v2.56.1.
The trim regex (?<!\\\\) +$ only looks at the one character before the spaces, so any backslash there blocks the trim, even when it's the second half of a \\ pair. The regex is the same on trunk.
- Dominant language
- PHP
- Stars
- 1.9k
- Forks
- 910
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 777
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 Automattic/jetpack
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Automattic/jetpack#55385 · 1 comment ·
Maintainers usually reply within 1 day
-
WAF: jetpack_waf_blocklog is created without the site's charset and collationPossibly taken @Peerapatfc claimed this 3 days ago. Open
Difficulty 1/5 Under an hour Newbie friendliness 85/100
Automattic/jetpack#55365 ·
Maintainers usually reply within 1 day
-
Sharing Buttons: Text styles are white on white on dark backgroundsPossibly taken @KarunyaChavan claimed this 3 days ago. OpenBug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Automattic/jetpack#55253 ·
Maintainers usually reply within 1 day
-
[Package] Stats Admin [Type] Bug
Difficulty 1/5 Under an hour Newbie friendliness 86/100
Automattic/jetpack#54188 ·
Maintainers usually reply within 1 day
-
Bug Needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Automattic/jetpack#53467 ·
Maintainers usually reply within 1 day
All issues in Automattic/jetpack
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
taskforcesh/bullmq#5238 ·
Maintainers usually reply within 1 day
-
[Bug] v-change-database-password reports success but doesn't change the password when MySQL validate_password rejects itPossibly taken @bfs2021 claimed this today. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 84/100
-
area/import type/enhancement when/later
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
Maintainers usually reply within 1 day
-
bug good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Jeffallan/claude-skills#347 ·
Maintainers usually reply within 1 day