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

import19: IndexError: list index out of range during Moin 1.9 to Moin 2.0 migration #1826

Open
syun03 opened this issue Jan 4, 2025 · 1 comment
Labels
bug Something isn't working cli

Comments

@syun03
Copy link

syun03 commented Jan 4, 2025

I encountered an error while migrating data from Moin 1.9 to Moin 2.0. Below are the details:

Environment

moin --version
Python 3.9.21
Flask 3.1.0
Werkzeug 3.1.3

Error Log

2025-01-04 21:28:47,924 INFO moin.cli.migration.moin19.import19:194 PHASE3: Converting last revision of Moin 1.9 items to Moin 2.0 markup ...
Traceback (most recent call last):
  File "/usr/local/bin/moin", line 8, in <module>
    sys.exit(cli())
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1161, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1082, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1697, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1443, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 788, in invoke
    return __callback(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/click/decorators.py", line 33, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/flask/cli.py", line 400, in decorator
    return ctx.invoke(f, *args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 788, in invoke
    return __callback(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/moin/cli/migration/moin19/import19.py", line 213, in ImportMoin19
    dom = conv_in(data_in, CONTENTTYPE_MOINWIKI)
  File "/usr/local/lib/python3.9/site-packages/moin/converters/moinwiki_in.py", line 142, in __call__
    body = self.parse_block(iter_content, arguments)
  File "/usr/local/lib/python3.9/site-packages/moin/converters/moinwiki_in.py", line 1084, in parse_block
    self.indent_repl(iter_content, stack, line, **data)
  File "/usr/local/lib/python3.9/site-packages/moin/converters/moinwiki_in.py", line 512, in indent_repl
    self._apply(match, "block", it, new_stack)
  File "/usr/local/lib/python3.9/site-packages/moin/converters/moinwiki_in.py", line 1070, in _apply
    getattr(self, func)(*args, **data)
  File "/usr/local/lib/python3.9/site-packages/moin/converters/moinwiki_in.py", line 365, in block_text_repl
    self.parse_inline(text, stack, self.inline_re)
  File "/usr/local/lib/python3.9/site-packages/moin/converters/moinwiki_in.py", line 1100, in parse_inline
    stack.top_append_ifnotempty(text[pos:])
  File "/usr/local/lib/python3.9/site-packages/moin/converters/_util.py", line 160, in top_append_ifnotempty
    self.top_append(elem)
  File "/usr/local/lib/python3.9/site-packages/moin/converters/_util.py", line 156, in top_append
    self.top().append(elem)
  File "/usr/local/lib/python3.9/site-packages/moin/converters/_util.py", line 150, in top
    return self._list[-1].elem
IndexError: list index out of range

Steps to Reproduce

  1. Create a page in Moin 1.9 with the following content:
    * --(A::B)-- C
    
  2. Execute the Moin 1.9 to 2.0 migration process.
  3. Observe the error during Phase 3 (converting last revision to Moin 2.0 markup).

Expected Behavior

Migration should complete without errors, even for pages containing the specified text.

Actual Behavior

An IndexError is raised during the migration process when encountering a page with the specified text.

Additional Information

Please let me know if further details are needed for debugging this issue.

@UlrichB22
Copy link
Collaborator

The traceback is similar to #1756.

I cannot reproduce the traceback with the latest git version, but the resulting moin markup is wrong after migration.
Even when using the markup in a new moin 2.0 item gives a wrong result.

In moin 1.9 the result of above markup looks like this:
Screenshot_strike_through

@UlrichB22 UlrichB22 added bug Something isn't working cli labels Jan 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cli
Projects
None yet
Development

No branches or pull requests

2 participants