Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix parsing of backslash at end of line #184

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions files/docker/systemctl.py
Original file line number Diff line number Diff line change
Expand Up @@ -810,6 +810,8 @@ def read_sysd(self, filename):
else:
# hint: an empty line shall reset the value-list
self.set(section, name, text and text or None)
if nextline:
self.set(section, name, text)
return self
def read_sysv(self, filename):
""" an LSB header is scanned and converted to (almost)
Expand Down
2 changes: 2 additions & 0 deletions files/docker/systemctl3.py
Original file line number Diff line number Diff line change
Expand Up @@ -810,6 +810,8 @@ def read_sysd(self, filename):
else:
# hint: an empty line shall reset the value-list
self.set(section, name, text and text or None)
if nextline:
self.set(section, name, text)
return self
def read_sysv(self, filename):
""" an LSB header is scanned and converted to (almost)
Expand Down
10 changes: 10 additions & 0 deletions testsuite.py
Original file line number Diff line number Diff line change
Expand Up @@ -1383,17 +1383,27 @@ def test_1062_can_have_multi_line_settings_with_linebreak_mark(self) -> None:
which is quite special
[Service]
PIDFile=/var/run/zzfoo.pid
ExecStart=sleep \\
2 \\

""")
textA = reads(os_path(root, "/etc/systemd/system/zza.service"))
self.assertTrue(greps(textA, "Testing A"))
self.assertTrue(greps(textA, "quite special"))
self.assertTrue(greps(textA, "PIDFile="))
self.assertTrue(greps(textA, "ExecStart="))
cmd = "{systemctl} __get_description zza.service"
out, end = output2(cmd.format(**locals()))
logg.info("%s => \n%s", cmd, out)
self.assertEqual(end, 0)
self.assertTrue(greps(out, "Testing A"))
self.assertTrue(greps(out, "quite special"))
cmd = "{systemctl} command zza.service"
out, end = output2(cmd.format(**locals()))
logg.info("%s => \n%s", cmd, out)
self.assertEqual(end, 0)
self.assertEqual(len(lines(out)), 3)
self.assertTrue(greps(out, "sleep \\\\"))
cmd = "{systemctl} __get_pid_file zza.service"
out, end = output2(cmd.format(**locals()))
logg.info("%s => \n%s", cmd, out)
Expand Down