Don't throw uninformative IndexErrors when buglink is configured with a bad regex

REOPENED
Unassigned

Status

Webtools
DXR
REOPENED
3 years ago
3 years ago

People

(Reporter: Jack Marr, Unassigned)

Tracking

Trunk

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

3 years ago
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_4) AppleWebKit/600.7.12 (KHTML, like Gecko) Version/8.0.7 Safari/600.7.12

Steps to reproduce:

dxr index (github snapshot taken 13-Jul-15)


Actual results:

Traceback and error message:

Running post_build [####################################] 100%
Indexing folders   [####################################]
Indexing files     [------------------------------------]   0%A worker failed while indexing /plm/cynas/iproot2/ugnx110/build/export_jack/ip12/src/ann/no/ind/Annot_BaseCenterline3dBuilder.cxx:
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/dxr-0.1-py2.7.egg/dxr/build.py", line 579, in index_chunk
    index_file(tree, tree_indexers, path, es, index)
  File "/usr/lib/python2.7/site-packages/dxr-0.1-py2.7.egg/dxr/build.py", line 549, in index_file
    for chunk in bulk_chunks(docs(), docs_per_chunk=300, bytes_per_chunk=10000):
  File "/usr/lib/python2.7/site-packages/pyelasticsearch/utils.py", line 31, in bulk_chunks
    for action in actions:
  File "/usr/lib/python2.7/site-packages/dxr-0.1-py2.7.egg/dxr/build.py", line 526, in docs
    chain.from_iterable(regionses)))):
  File "/usr/lib/python2.7/site-packages/dxr-0.1-py2.7.egg/dxr/lines.py", line 299, in finished_tags
    tags = list(tag_boundaries(chain(refs, regions)))
  File "/usr/lib/python2.7/site-packages/dxr-0.1-py2.7.egg/dxr/lines.py", line 169, in tag_boundaries
    for start, end, data in tags:
  File "/usr/lib/python2.7/site-packages/dxr-0.1-py2.7.egg/dxr/plugins/buglink/__init__.py", line 15, in refs
    bug = m.group(1)
IndexError: no such group


/usr/lib/python2.7/site-packages/dxr-0.1-py2.7.egg/dxr/lines.py:224: UserWarning: htmlifier plugins requested overlapping <a> tags. Fix the plugins.
  warn('htmlifier plugins requested overlapping <a> tags. Fix the plugins.')
/usr/lib/python2.7/site-packages/dxr-0.1-py2.7.egg/dxr/lines.py:224: UserWarning: htmlifier plugins requested overlapping <a> tags. Fix the plugins.
  warn('htmlifier plugins requested overlapping <a> tags. Fix the plugins.')
/usr/lib/python2.7/site-packages/dxr-0.1-py2.7.egg/dxr/lines.py:224: UserWarning: htmlifier plugins requested overlapping <a> tags. Fix the plugins.
  warn('htmlifier plugins requested overlapping <a> tags. Fix the plugins.')
/usr/lib/python2.7/site-packages/dxr-0.1-py2.7.egg/dxr/lines.py:224: UserWarning: htmlifier plugins requested overlapping <a> tags. Fix the plugins.
  warn('htmlifier plugins requested overlapping <a> tags. Fix the plugins.')
/usr/lib/python2.7/site-packages/dxr-0.1-py2.7.egg/dxr/lines.py:224: UserWarning: htmlifier plugins requested overlapping <a> tags. Fix the plugins.
  warn('htmlifier plugins requested overlapping <a> tags. Fix the plugins.')
/usr/lib/python2.7/site-packages/dxr-0.1-py2.7.egg/dxr/lines.py:224: UserWarning: htmlifier plugins requested overlapping <a> tags. Fix the plugins.
  warn('htmlifier plugins requested overlapping <a> tags. Fix the plugins.')
/usr/lib/python2.7/site-packages/dxr-0.1-py2.7.egg/dxr/lines.py:224: UserWarning: htmlifier plugins requested overlapping <a> tags. Fix the plugins.
  warn('htmlifier plugins requested overlapping <a> tags. Fix the plugins.')
/usr/lib/python2.7/site-packages/dxr-0.1-py2.7.egg/dxr/lines.py:224: UserWarning: htmlifier plugins requested overlapping <a> tags. Fix the plugins.
  warn('htmlifier plugins requested overlapping <a> tags. Fix the plugins.')
Traceback (most recent call last):
  File "/bin/dxr", line 9, in <module>
    load_entry_point('dxr==0.1', 'console_scripts', 'dxr')()
  File "/usr/lib/python2.7/site-packages/dxr-0.1-py2.7.egg/dxr/cli/__init__.py", line 29, in main
    return dxr.invoke(ctx)
  File "/usr/lib/python2.7/site-packages/click/core.py", line 991, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python2.7/site-packages/click/core.py", line 837, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python2.7/site-packages/click/core.py", line 464, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/dxr-0.1-py2.7.egg/dxr/cli/index.py", line 26, in index
    index_and_deploy_tree(tree, verbose=verbose)
  File "/usr/lib/python2.7/site-packages/dxr-0.1-py2.7.egg/dxr/build.py", line 64, in index_and_deploy_tree
    index_name = index_tree(tree, es, verbose=verbose)
  File "/usr/lib/python2.7/site-packages/dxr-0.1-py2.7.egg/dxr/build.py", line 276, in index_tree
    index_files(tree, tree_indexers, index, pool, es)
  File "/usr/lib/python2.7/site-packages/dxr-0.1-py2.7.egg/dxr/build.py", line 643, in index_files
    raise type, value  # exits with non-zero
IndexError: no such group



Expected results:

Should sail on through...
Hi, can you post the relevant contents of Annot_BaseCenterline3dBuilder.cxx? It looks like a regex not working correctly.
Flags: needinfo?(jlmarr53)
(Reporter)

Comment 2

3 years ago
Now that I look at it, I see that our regex which should have been PR\s*\043?([0-9]+) was written as this:

regex = PRs*#?([0-9]+)

Would that explain the problem?  We arrived at the correct URL some time ago but just started generating the per-development-cycle dxr.config from a template and didn't notice the mismatch.

Still I'm not sure why it would crash the process.
Flags: needinfo?(jlmarr53)
(Reporter)

Comment 3

3 years ago
Fixing the regex fixes the problem for me.  I was able to get a full build with no errors.

I'll mark this as resolved, although you might consider it a bug for a bad regex to crash the build.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 3 years ago
Resolution: --- → INVALID
That's legitimate. We shouldn't throw a random IndexError; we should at least throw something more informative.
Status: RESOLVED → REOPENED
Ever confirmed: true
Resolution: INVALID → ---
Summary: Error message: IndexError: no such group → Don't throw uninformative IndexErrors when buglink is configured with a bad regex
You need to log in before you can comment on or make changes to this bug.