getPatchedFiles in oe.patch doesn't correctly handle filenames with spaces
Hi All,
by using Tinfoil together with methods found in oe.* to do software composition analysis, I encountered an error: when parsing python3 recipe, I found patch file [0001-gh-92036-Fix-gc_fini_untrack-GH-92037.patch](https://git.yoctoproject.org/poky/tree/meta/recipes-devtools/python/python3/0001-gh-92036-Fix-gc_fini_untrack-GH-92037.patch?h=kirkstone) which refers to a filename with spaces:
+++ b/Misc/NEWS.d/next/Core and Builtins/2022-04-28-23-37-30.gh-issue-92036.GZJAC9.rst
when using function oe.recipeutils.get_recipe_patched_files(d), the file above is returned as "b/Misc/NEWS.d/next/Core", missing the whole part after the space.
The problem lies in [function patchedpath]((https://git.yoctoproject.org/poky/tree/meta/lib/oe/patch.py?h=kirkstone#n126) within the static method getPatchedFiles in poky/meta/lib/oe/patch.py, which assumes that there are no spaces in filenames
filepth = patchline.split()[1]
Even if spaces in filenames are bad practice, my understanding is that they are allowed by git diff and should be supported.
To solve this issue, the above line may be modified as follows
filepth = patchline[4:]
Should I submit a patch for that?
Regards,
Alberto
Quoted 5 lines · Alberto Pianon via lists.openembedded.org
To solve this issue, the above line may be modified as follows
filepth = patchline[4:]
Should I submit a patch for that?
Yes, but a better solution would be:
filepth = pathline.split(maxsplit=1)[1]
Ross