Skip to contentSkip to conversation

parse/ConfHandler: Fix multiline variable corruption

PATCH New Richard Purdie 1 participant 1 message Jul 20, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 parse/ConfHandler: Fix multiline variable corruption

When parsing multiline variables in conf files, the last character can be accidentally removed. s2 contains new data read from the file which may or may not end with the continuation character. It makes sense to let the next loop iteration strip this if needed.

We don't often use multiline expressions in .conf files which is why I'd imagine we haven't noticed this before. Most variables are quoted and its the closing quotation which often disappears.

lib/bb/parse/parse_py/ConfHandler.py +1 -1
@@ -96,7 +96,7 @@ def handle(fn, data, include):
         s = s.rstrip()
         if s[0] == '#': continue    # skip comments
         while s[-1] == '\\':
-            s2 = f.readline()[:-1].strip()
+            s2 = f.readline().strip()
             lineno = lineno + 1
             s = s[:-1] + s2
         feeder(lineno, s, fn, statements)