archiver: Escape recipe name in regex
PATCH v2 1/1 archiver: Escape recipe name in regex
The recipe name needs to be escaped when it is used in a regular expression so that any special characters are treated literally
--- meta/classes/archiver.bbclass | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
meta/classes/archiver.bbclass +2 -2
@@ -349,8 +349,8 @@ python do_ar_recipe () { bbappend_files = d.getVar('BBINCLUDED').split() # If recipe name is aa, we need to match files like aa.bbappend and aa_1.1.bbappend # Files like aa1.bbappend or aa1_1.1.bbappend must be excluded. - bbappend_re = re.compile( r".*/%s_[^/]*\.bbappend$" %pn) - bbappend_re1 = re.compile( r".*/%s\.bbappend$" %pn) + bbappend_re = re.compile( r".*/%s_[^/]*\.bbappend$" % re.escape(pn)) + bbappend_re1 = re.compile( r".*/%s\.bbappend$" % re.escape(pn)) for file in bbappend_files: if bbappend_re.match(file) or bbappend_re1.match(file): shutil.copy(file, outdir)
Signature · 1 line
2.9.4
Quoted 24 lines · Joshua Watt
The recipe name needs to be escaped when it is used in a regular expression so that any special characters are treated literally
Signed-off-by Joshua Watt <[email protected]>--- meta/classes/archiver.bbclass | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)meta/classes/archiver.bbclass +2
-3@@ -349,8 +349,8 @@ python do_ar_recipe () { bbappend_files = d.getVar('BBINCLUDED').split() # If recipe name is aa, we need to match files like aa.bbappend and aa_1.1.bbappend # Files like aa1.bbappend or aa1_1.1.bbappend must be excluded. - bbappend_re = re.compile( r".*/%s_[^/]*\.bbappend$" %pn) - bbappend_re1 = re.compile( r".*/%s\.bbappend$" %pn) + bbappend_re = re.compile( r".*/%s_[^/]*\.bbappend$" % re.escape(pn)) + bbappend_re1 = re.compile( r".*/%s\.bbappend$" % re.escape(pn)) for file in bbappend_files: if bbappend_re.match(file) or bbappend_re1.match(file): shutil.copy(file, outdir) --
Quoted 2 lines
2.9.4
Would it be possible to get this backported to pyro and morty? If there is something else I need to move that along, please let me know.
Thanks,
Joshua Watt
Quoted 3 lines · Joshua Watt
Would it be possible to get this backported to pyro and morty? If there is something else I need to move that along, please let me know.
The patch is now in master, so if you backport it to those branches and then post the patches to the list with [pyro] and [morty] in the subject then the release maintainers can pick the patches up.
Ross