[morty,1/3] archiver: Escape recipe name in regex

Message ID 20170804162700.11765-1-ross.burton@intel.com
State New
Headers show
Series
  • [morty,1/3] archiver: Escape recipe name in regex
Related show

Commit Message

Burton, Ross Aug. 4, 2017, 4:26 p.m.
From: Joshua Watt <jpewhacker@gmail.com>


The recipe name needs to be escaped when using it in a regular expression so
that and special characters are treated literally

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>

Signed-off-by: Ross Burton <ross.burton@intel.com>

---
 meta/classes/archiver.bbclass | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

-- 
2.11.0

-- 
_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core

Comments

akuster808 Aug. 6, 2017, 2:18 p.m. | #1
On 08/04/2017 09:26 AM, Ross Burton wrote:
> From: Joshua Watt <jpewhacker@gmail.com>

>

> The recipe name needs to be escaped when using it in a regular expression so

> that and special characters are treated literally

>

> Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>

> Signed-off-by: Ross Burton <ross.burton@intel.com>

merged into akuster/morty-next.

thanks,
armin
> ---

>   meta/classes/archiver.bbclass | 4 ++--

>   1 file changed, 2 insertions(+), 2 deletions(-)

>

> diff --git a/meta/classes/archiver.bbclass b/meta/classes/archiver.bbclass

> index 3543ca9c588..188f8c04232 100644

> --- a/meta/classes/archiver.bbclass

> +++ b/meta/classes/archiver.bbclass

> @@ -349,8 +349,8 @@ python do_ar_recipe () {

>       bbappend_files = d.getVar('BBINCLUDED', True).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)


-- 
_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core

Patch

diff --git a/meta/classes/archiver.bbclass b/meta/classes/archiver.bbclass
index 3543ca9c588..188f8c04232 100644
--- a/meta/classes/archiver.bbclass
+++ b/meta/classes/archiver.bbclass
@@ -349,8 +349,8 @@  python do_ar_recipe () {
     bbappend_files = d.getVar('BBINCLUDED', True).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)