From e1e459e480bc6a530cec6ed2718ce52d5ef93149 Mon Sep 17 00:00:00 2001 From: Randy Witt Date: Wed, 6 Apr 2016 23:55:39 -0700 Subject: bitbake: lib/bb/utils.py: Fix a bug in edit_metadata() that could corrupt vars edit_metadata() would corrupt a variable that was multiline, but had the ending quotes on the same line as the last value. For example: TEST_VAR = " foo \ bar" would become " foo ba" because the code would always delete the last character on the line and then do it again if the line ended in the quote. This however doesn't show up if you have: TEST_VAR = " foo \ bar \ " which is how all the test cases were written. This patch fixes that bug and adds and fixes a test that matched the bugs behavior rather than the expected behavior. (Bitbake rev: 14f05cbdc2ad8d59a94af1c8816567d93c39c88c) Signed-off-by: Randy Witt Signed-off-by: Richard Purdie --- bitbake/lib/bb/tests/utils.py | 2 +- bitbake/lib/bb/utils.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'bitbake') diff --git a/bitbake/lib/bb/tests/utils.py b/bitbake/lib/bb/tests/utils.py index a035ccf179..6ded4dfd13 100644 --- a/bitbake/lib/bb/tests/utils.py +++ b/bitbake/lib/bb/tests/utils.py @@ -176,7 +176,7 @@ do_functionname() { # Test file doesn't get modified with some the same values self._testeditfile({'THIS': ('that', None, 0, True), 'OTHER': ('anothervalue', None, 0, True), - 'MULTILINE3': (' c1 c2 c3', None, 4, False)}, self._origfile) + 'MULTILINE3': (' c1 c2 c3 ', None, 4, False)}, self._origfile) def test_edit_metadata_file_1(self): diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py index e9ad68f2d7..8d7df13be7 100644 --- a/bitbake/lib/bb/utils.py +++ b/bitbake/lib/bb/utils.py @@ -1158,7 +1158,7 @@ def edit_metadata(meta_lines, variables, varfunc, match_overrides=False): if in_var.endswith('()'): if full_value.count('{') - full_value.count('}') >= 0: continue - full_value = full_value[:-1] + full_value = full_value[:-1] if handle_var_end(): updated = True checkspc = True -- cgit v1.2.3-54-g00ecf