path: root/meta/classes
diff options
authorAndré Draszik <>2019-02-05 02:32:29 +0000
committerRichard Purdie <>2019-02-06 08:29:02 +0000
commit126743162397e4145902b3f127f2dafd80a8a49b (patch)
tree0f09c5a93554c0a885cf82bbb4a2f8f258c6b6c0 /meta/classes
parent0edda66097407c62821af9e98579f5fcf906e938 (diff)
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 /opt/poky/2.6+snapshot/sysroots/i686-pokysdk-linux/sbin/losetup 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 <> Signed-off-by: Richard Purdie <>
Diffstat (limited to 'meta/classes')
1 files changed, 2 insertions, 2 deletions
diff --git a/meta/classes/update-alternatives.bbclass b/meta/classes/update-alternatives.bbclass
index e252651128..537e85d9a3 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...