CTags icon indicating copy to clipboard operation
CTags copied to clipboard

Valid MySQL escape characters likely to cause 'IndexError: list index out of range'

Open Kludgy opened this issue 11 years ago • 2 comments

Building CTags for D:\broken.sql: Please be patient
error: An unknown error occured.
Check the console for info.
Exception in thread Thread-454:
Traceback (most recent call last):
  File "./threading.py", line 901, in _bootstrap_inner
  File "./threading.py", line 858, in run
  File "ctagsplugin in C:\Users\user\AppData\Roaming\Sublime Text 3\Installed Packages\CTags.sublime-package", line 119, in run
  File "ctagsplugin in C:\Users\user\AppData\Roaming\Sublime Text 3\Installed Packages\CTags.sublime-package", line 907, in build_ctags
  File "ctagsplugin in C:\Users\user\AppData\Roaming\Sublime Text 3\Installed Packages\CTags.sublime-package", line 892, in build_ctags
  File "ctags in C:\Users\user\AppData\Roaming\Sublime Text 3\Installed Packages\CTags.sublime-package", line 331, in build_ctags
  File "ctags in C:\Users\user\AppData\Roaming\Sublime Text 3\Installed Packages\CTags.sublime-package", line 365, in resort_ctags
IndexError: list index out of range

Environment:

  • Windows
  • ctags58.exe
  • Sublime Text 3 - Stable Build 3065

Minimal repro case:

INSERT INTO X (a) VALUES ('\'');
INSERT INTO X (a) VALUES ('DOMAIN');
INSERT INTO X (a) VALUES ('');
  • DOMAIN is a valid SQL token that happened to be in the original file as a string value.
  • Other SQL tokens I've tried don't lead to this issue.
  • Theory: Incorrect handling of backlash escape sequences.

I'll do debugging against head when I have time, unless someone beats me to it. ;)

Kludgy avatar Jan 08 '15 22:01 Kludgy

ctags58.exe produces some trailing garbage ); in the tags file for the repro case above. This looks more like an exuberant-ctags bug.

However, should Sublime CTags try to work around the issue in the meantime, and deal gracefully with unexpected line formats?


A little more info for reference:

Building CTags for D:\work\broken-ctags-sql: Please be patient
**** tag_file=D:\work\broken-ctags-sql\.tags
**** line: !_TAG_FILE_FORMAT    2   /extended format; --format=1 will not append ;" to lines/
**** line: !_TAG_FILE_SORTED    1   /0=unsorted, 1=sorted, 2=foldcase/
**** line: !_TAG_PROGRAM_AUTHOR Darren Hiebert  /[email protected]/
**** line: !_TAG_PROGRAM_NAME   Exuberant Ctags //
**** line: !_TAG_PROGRAM_URL    http://ctags.sourceforge.net    /official site/
**** line: !_TAG_PROGRAM_VERSION    5.8 //
**** line: );
error: An unknown error occured.
Check the console for info.
Exception in thread Thread-13:
Traceback (most recent call last):
  File "./threading.py", line 901, in _bootstrap_inner
  File "./threading.py", line 858, in run
  File "C:\Users\darren.grant\AppData\Roaming\Sublime Text 3\Packages\CTags\ctagsplugin.py", line 119, in run
    result = func(*args, **kwargs)
  File "C:\Users\darren.grant\AppData\Roaming\Sublime Text 3\Packages\CTags\ctagsplugin.py", line 907, in build_ctags
    raise e
  File "C:\Users\darren.grant\AppData\Roaming\Sublime Text 3\Packages\CTags\ctagsplugin.py", line 892, in build_ctags
    cmd=command)
  File "C:\Users\darren.grant\AppData\Roaming\Sublime Text 3\Packages\CTags\ctags.py", line 331, in build_ctags
    resort_ctags(tag_file)
  File "C:\Users\darren.grant\AppData\Roaming\Sublime Text 3\Packages\CTags\ctags.py", line 367, in resort_ctags
    keys.setdefault(line.split('\t')[FILENAME], []).append(line)
IndexError: list index out of range

Kludgy avatar Jan 14 '15 19:01 Kludgy

Related PR: https://github.com/SublimeText/CTags/pull/279

Kludgy avatar Jan 14 '15 20:01 Kludgy