conan-io / python-patch-ng

Library to parse and apply unified diffs
https://pypi.org/project/patch-ng
Other
16 stars 7 forks source link

[bug] Not handling quoted source/destination file paths #25

Closed luizfeldmann closed 1 month ago

luizfeldmann commented 10 months ago

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.

luizfeldmann commented 9 months ago

@memsharded

memsharded commented 9 months ago

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.

uilianries commented 1 month ago

Closing this issue as there is no answer from the author. Please, feel free to re-open it can having further information to discuss. Regards.