conan-io / python-patch-ng

Library to parse and apply unified diffs

Home Page:https://pypi.org/project/patch-ng

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[bug] Not handling quoted source/destination file paths

luizfeldmann opened this issue · comments

Hi all,

The regular expressions for parsing the +++ and --- lines are matching quotes in the file names, causing most subsequent logic to fail.

Looking at the implementation of git itself, we can see that this case is handled correctly there (git apply works correctly with quoted paths), so I would expect this library's implementation to be consistent.

I'm aware that the specification of the unified format does not mention this case, but apparently there is a proposed new style which does mention it.
Also, there are tools that will output such quoted files, for instance the TortoiseGit.

Hi @luizfeldmann

Thanks for your feedback.

The link https://lore.kernel.org/git/7vll0wvb2a.fsf@assigned-by-dhcp.cox.net/ is not very helpful, it seems some email thread from 2005. We would need some modern evidence of standard syntax.

Also, it would help some more detailed example, like an actual patch that fails, a full example. And also clarify the possible alternatives, approaches, etc. We would need to understand better the scope of the issue.