public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
* getPatchedFiles in oe.patch doesn't correctly handle filenames with spaces
@ 2022-10-19 15:40 Alberto Pianon
  2022-10-19 16:20 ` [OE-core] " Ross Burton
  0 siblings, 1 reply; 2+ messages in thread
From: Alberto Pianon @ 2022-10-19 15:40 UTC (permalink / raw)
  To: Openembedded Core

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




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [OE-core] getPatchedFiles in oe.patch doesn't correctly handle filenames with spaces
  2022-10-19 15:40 getPatchedFiles in oe.patch doesn't correctly handle filenames with spaces Alberto Pianon
@ 2022-10-19 16:20 ` Ross Burton
  0 siblings, 0 replies; 2+ messages in thread
From: Ross Burton @ 2022-10-19 16:20 UTC (permalink / raw)
  To: alberto@pianon.eu; +Cc: Openembedded Core

On 19 Oct 2022, at 16:40, Alberto Pianon via lists.openembedded.org <alberto=pianon.eu@lists.openembedded.org> wrote:
> 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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-10-19 16:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-19 15:40 getPatchedFiles in oe.patch doesn't correctly handle filenames with spaces Alberto Pianon
2022-10-19 16:20 ` [OE-core] " Ross Burton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox