[oe-commits] [openembedded-core] 11/24: update-alternatives: correctly escape PATHs when updating FILES_${PN}

git at git.openembedded.org git at git.openembedded.org
Tue Feb 5 14:05:57 UTC 2019

This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master-next
in repository openembedded-core.

commit fe2cfdf8f765757a7eb4d8351711cbf5fc698e93
Author: André Draszik <andre.draszik at jci.com>
AuthorDate: Tue Feb 5 02:32:29 2019 +0000

    update-alternatives: correctly escape PATHs when updating FILES_${PN}
    The recently added support for updating FILES based on the file renames
    that are happening here is using a regex replace, but failed to
    properly escape the search pattern (the full path). This manifests itself
    in FILES not being updated as soon as the full path contains any
    character that has a special meaning, e.g. '+'.
    In other words an original path (alt_target in the code) like
    can't be matched, and hence we fail to update FILES with the new value,
    causing packaging errors.
    Fix by using re.escape() on the original path before passing into re.sub()
    Fixes: 5c23fe378732 ("update-alternatives: try to update FILES_${PN} when
    renaming a file"), or bcb3e7b7f88a in poky.git
    [YOCTO #13058]
    Signed-off-by: André Draszik <andre.draszik at jci.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
 meta/classes/update-alternatives.bbclass | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/meta/classes/update-alternatives.bbclass b/meta/classes/update-alternatives.bbclass
index e252651..537e85d 100644
--- a/meta/classes/update-alternatives.bbclass
+++ b/meta/classes/update-alternatives.bbclass
@@ -138,12 +138,12 @@ python apply_update_alternative_renames () {
     if not update_alternatives_enabled(d):
-    from re import sub
+    import re
     def update_files(alt_target, alt_target_rename, pkg, d):
         f = d.getVar('FILES_' + pkg)
         if f:
-            f = sub(r'(^|\s)%s(\s|$)' % alt_target, r'\1%s\2' % alt_target_rename, f)
+            f = re.sub(r'(^|\s)%s(\s|$)' % re.escape (alt_target), r'\1%s\2' % alt_target_rename, f)
             d.setVar('FILES_' + pkg, f)
     # Check for deprecated usage...

To stop receiving notification emails like this one, please contact
the administrator of this repository.

More information about the Openembedded-commits mailing list