diff options
author | Zac Medico <zmedico@gentoo.org> | 2019-10-24 12:52:10 -0700 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2019-10-24 12:53:57 -0700 |
commit | e69ec2d046626fa2079d460aab469d04256182cd (patch) | |
tree | ceb4255223636beeebf90383156603f2763a888b | |
parent | Update version for 2.2.5 release (diff) | |
download | mirrorselect-e69ec2d046626fa2079d460aab469d04256182cd.tar.gz mirrorselect-e69ec2d046626fa2079d460aab469d04256182cd.tar.bz2 mirrorselect-e69ec2d046626fa2079d460aab469d04256182cd.zip |
write_make_conf: fix infinite loop (bug 698470)
Fixes: 42238f4ff13a ("write_make_conf: support multi-line GENTOO_MIRRORS (bug 543814)")
Bug: https://bugs.gentoo.org/698470
Signed-off-by: Zac Medico <zmedico@gentoo.org>
-rw-r--r-- | mirrorselect/configs.py | 2 | ||||
-rw-r--r-- | tests/test_write_make_conf.py | 1 |
2 files changed, 3 insertions, 0 deletions
diff --git a/mirrorselect/configs.py b/mirrorselect/configs.py index df718f6..4cba14f 100644 --- a/mirrorselect/configs.py +++ b/mirrorselect/configs.py @@ -81,6 +81,8 @@ def write_make_conf(output, config_path, var, mirror_string): lex.quotes = "\"'" while True: key = lex.get_token() + if key is None: + break if key == var: begin_line = lex.lineno diff --git a/tests/test_write_make_conf.py b/tests/test_write_make_conf.py index 3dedd93..fb84978 100644 --- a/tests/test_write_make_conf.py +++ b/tests/test_write_make_conf.py @@ -23,6 +23,7 @@ class WriteMakeConfTestCase(unittest.TestCase): ('\n{}="foo \\\nbar"\n'.format(var), '\n{}\n'.format(mirror_string)), ('\n\n{}="foo \\\nbar"\n'.format(var), '\n\n{}\n'.format(mirror_string)), ('\n\n{}="foo \\\nbar"\na="b"\n'.format(var), '\n\na="b"\n{}\n'.format(mirror_string)), + ('', '{}\n'.format(mirror_string)), ) for make_conf, expected_result in cases: |