Rev 6352: Don't accept \n as part of a config option reference in file:///home/vila/src/bzr/bugs/902125-no-newline-in-references/

Vincent Ladeuil v.ladeuil+lp at free.fr
Fri Dec 9 12:04:26 UTC 2011


At file:///home/vila/src/bzr/bugs/902125-no-newline-in-references/

------------------------------------------------------------
revno: 6352
revision-id: v.ladeuil+lp at free.fr-20111209120425-ucpc8l4vjwzrfr7q
parent: pqm at pqm.ubuntu.com-20111208095102-6ljxixlt57eitazx
fixes bug: https://launchpad.net/bugs/902125
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: 902125-no-newline-in-references
timestamp: Fri 2011-12-09 13:04:25 +0100
message:
  Don't accept \n as part of a config option reference
-------------- next part --------------
=== modified file 'bzrlib/config.py'
--- a/bzrlib/config.py	2011-11-29 14:59:18 +0000
+++ b/bzrlib/config.py	2011-12-09 12:04:25 +0000
@@ -3156,7 +3156,7 @@
             yield self.store, section
 
 
-_option_ref_re = lazy_regex.lazy_compile('({[^{}]+})')
+_option_ref_re = lazy_regex.lazy_compile('({[^{}\n]+})')
 """Describes an expandable option reference.
 
 We want to match the most embedded reference first.

=== modified file 'bzrlib/tests/test_config.py'
--- a/bzrlib/tests/test_config.py	2011-11-22 11:50:36 +0000
+++ b/bzrlib/tests/test_config.py	2011-12-09 12:04:25 +0000
@@ -3493,6 +3493,9 @@
                          (False, ''),],
                         '{foo}{bar}')
 
+    def test_newline_in_refs_are_not_matched(self):
+        self.assertRefs([(False, '{\nxx}{xx\n}{{\n}}')], '{\nxx}{xx\n}{{\n}}')
+
 
 class TestStackExpandOptions(tests.TestCaseWithTransport):
 

=== modified file 'doc/en/release-notes/bzr-2.5.txt'
--- a/doc/en/release-notes/bzr-2.5.txt	2011-12-08 09:24:06 +0000
+++ b/doc/en/release-notes/bzr-2.5.txt	2011-12-09 12:04:25 +0000
@@ -32,6 +32,9 @@
 .. Fixes for situations where bzr would previously crash or give incorrect
    or undesirable results.
 
+* Properly ignore '\n' in an option reference since this cannot be part of a
+  config option identifier. (Vincent Ladeuil, #902125)
+
 Documentation
 *************
 



More information about the bazaar-commits mailing list