Am Montag, 11. März 2019 09:44:25 CET schrieb Kornel Benko <[email protected]>: > Am Sonntag, 10. März 2019 19:18:49 CET schrieb Scott Kostyshak > <[email protected]>: > > I get the following on current master: > > > > $ ctest --timeout 60 -R "lyx2lyx" > > > > The following tests FAILED: > > 1357 - INVERTED.TODO_export/export/lyx2lyx/lyx_2_3_test_lyx16 (Timeout) > > 1358 - INVERTED.TODO_export/export/lyx2lyx/lyx_2_3_test_lyx21 (Timeout) > > 1359 - INVERTED.TODO_export/export/lyx2lyx/lyx_2_3_test_lyx22 (Timeout) > > > > Without --timeout, I get an infinite loop. > > > > Note that the export is not actually supposed to work without error, as > > noted in the invertedTests file: > > > > # back-conversion fails for rotated float inset in a list > > export/export/lyx2lyx/lyx_2_3_test_lyx(16|20|21|22) > > > > However, the recent problem introduced is that now there is a > > (seemingly) infinite loop. > > > > Scott > > > > According to the log, the loop is inside > $ lyx -e lyx22x autotests/export/lyx2lyx/lyx_2_3_test.lyx > So, trying > $ lyx2lyx -V 2.2 lyx_2_3_test.lyx > > The error is inside function revert_new_babel_languages, > lib/lyx2lyx/lyx2lyx_tools.py:792 > Doing: > document.body[2 : 2] = [" something big"] > increments the size, but the pointer 'i' for the find_token(document.body, > '\\lang', i) inside the while(true) loop is not incremented, > and so the same token '\lang' is found again. >
Since we insert 15 lines, we should increment 'i' by 16;
The patch cures it for me.
But, we have more potential dangerous substitutions in this function, like
document.body[i : i] = [more lines]
while incrementing 'i' only by '1'
Kornel
diff --git a/lib/lyx2lyx/lyx2lyx_tools.py b/lib/lyx2lyx/lyx2lyx_tools.py
index 51b4ec4..f3717a2 100644
--- a/lib/lyx2lyx/lyx2lyx_tools.py
+++ b/lib/lyx2lyx/lyx2lyx_tools.py
@@ -755,6 +755,7 @@ def revert_language(document, lyxname, babelname, polyglossianame):
"\\begin_layout Plain Layout", "", "",
"\\backslash",
"selectlanguage{%s}" % document.language,
"\\end_layout", "", "\\end_inset", "", "",
"\\end_layout", ""]
+ i += 16
signature.asc
Description: This is a digitally signed message part.
