1. TortoiseHg
  2. TortoiseHg
  3. thg
  4. Issues
Issue #2407 resolved

Application crash when repository's file contains \\\

created an issue

One file contains the following code:



the \\\ makes tortoiseHg crash when i try to commit the project.

TortoiseHr version 2.7

Comments (15)

  1. nicola_molinazzi reporter

    Hi, I have Windows XP 32 bit SP3, running on a virtual machine.

    the problem occurred when i added the \\ to the .pro file and then try to commit the version: I opened the workbench and it got stuck after i selected the working directory to commit the version. It was like, It could not visualize the difference in the file and the progress bar in bottom left of the windows didn't move and beside it there was written something like "updating file status". At this point the windows stops responding and I had to kill the process by task manager.

    I did different tests to understand what it was, finally i understood that the problem was in the \. It's not a problem in the repository because i tried in others projects and i have the same problem. The only solution I found was to delete the \.

    I've talked to a colleague of mine and he also experienced the same problem.

    From the following link u can download a repository where i have the problem i have just described: first commit file without \\, working directory with file containing \. I can not commit this version because it get stuck before.


    Sorry if i hasn't been enough clear in my previous explanation. Thanks for your help!

  2. Yuya Nishihara

    You've hit the bug of Pygments. Pygments' PrologLexer seems to have infinite (or quite heavy) regexp pattern.

    Our code uses guess_lexer_for_filename(), which tries all possible lexers. Probably we should use lightweight get_lexer_for_filename() instead.

    # not well tested
    diff --git a/tortoisehg/hgqt/commit.py b/tortoisehg/hgqt/commit.py
    --- a/tortoisehg/hgqt/commit.py
    +++ b/tortoisehg/hgqt/commit.py
    @@ -506,12 +506,12 @@ class CommitWidget(QWidget, qtlib.TaskWi
    -            from pygments.lexers import guess_lexer_for_filename
    +            from pygments.lexers import get_lexer_for_filename
                 from pygments.token import Token
                 from pygments.util import ClassNotFound
                     contents = unicode(contents)
    -                lexer = guess_lexer_for_filename(wfile, contents)
    +                lexer = get_lexer_for_filename(wfile, contents)
                     for tokentype, value in lexer.get_tokens(contents):
                         if tokentype in Token.Name and len(value) > 4:
  3. Yuya Nishihara

    Our code uses guess_lexer_for_filename(), which tries all possible lexers. Probably we should use lightweight get_lexer_for_filename() instead.

    Oops, it isn't true. There isn't so much difference between these functions.

  4. André Sintzoff

    Unfortunately the bug is not yet fixed. As Yuya said, get_lexer_for_filename() has the same behaviour as guess_lexer_for_filename().

    BTW, yesterday I didn't reproduce the issue because I didn't the ".pro" extension file...

  5. Log in to comment