This site is an archive; learn more about 8 years of OpenHatch.

[Devel] [issue484] Crasher bug in the diffsingle training mission

Asheesh Laroia bugs at openhatch.org
Sat Jul 16 04:02:49 UTC 2011


New submission from Asheesh Laroia <asheesh at asheesh.org>:

Here's the stack trace from a few minutes ago:

Traceback (most recent call last):

  File
"/home/deploy/milestone-a.buildout/parts/production/django/core/handlers/base.py",
line 100, in get_response
    response = callback(request, *callback_args, **callback_kwargs)

  File
"/home/deploy/milestone-a.buildout/parts/production/django/contrib/auth/decorators.py",
line 25, in
_wrapped_view
    return view_func(request, *args, **kwargs)

  File "/home/deploy/milestone-a.buildout/mysite/missions/diffpatch/views.py",
line 69, in diffsingle_submit
    controllers.DiffSingleFileMission.validate_patch(form.cleaned_data['diff'])

  File
"/home/deploy/milestone-a.buildout/mysite/missions/diffpatch/controllers.py",
line 31, in validate_patch
    the_patch = patch.fromstring(patchdata)

  File "/home/deploy/milestone-a.buildout/mysite/missions/base/patch.py", line
67, in fromstring
    return Patch( StringIO(s) )

  File "/home/deploy/milestone-a.buildout/mysite/missions/base/patch.py", line
118, in __init__
    self.parse(stream)

  File "/home/deploy/milestone-a.buildout/mysite/missions/base/patch.py", line
325, in parse
    self.hunks[nextfileno-1].append(hunkinfo.copy())

IndexError: list index out of range

This is the POST data that was submitted:

POST:<QueryDict: {u'diff': [u"This mission is to have you make modifications to
a file and submit a\r\ndiff of
them. The changes may seem a bit silly, but they will cause the\r\ndiff to
contain examples of different types of
changes - additions,\r\ndeletions, and changes. Here is what we want you to do
to this file:\r\n\r\n  1.  Keep an
unmodified copy of this file handy; you'll need it to\r\n      make the diff
once you're finished.\r\n\r\n  2.  Try
to keep the formatting intact, as the result file will be\r\n      compared
character-for-character. There is
exactly one blank line\r\n      between each paragraph and bullet point, and all
indentation is\r\n      done with
spaces. There is never trailing whitespace.\r\n\r\n  3.  Delete this step (and
the blank line below it). (Don't
renumber the\r\n      ones below it.)\r\n\r\n  4.  Leave this step the way it
is.\r\n\r\n  5.  Move this step so it
comes between #1 and #2. (Again, don't\r\n      renumber the steps.)\r\n\r\n  6.  
 Make an exact copy of this step and place it before #1; change the\r\n     
copy's step number to be 0.\r\n\r\n
7.  There is a typo in this step, which oyu should fix.\r\n\r\n  8.  Save the
changes and make a unified diff of
your changes using the\r\n      diff command. Submit the diff on the page from
which you obtained\r\n      this
file.\r\n\r\nGood luck!\r\n"]}>,

To fix this, you should first write a test that reproduces the crash. Then,
change the code until the test passes.
http://openhatch.org/wiki/Automated_testing explains how we do testing in the code.

----------
messages: 2203
nosy: paulproteus
priority: bug
status: unread
title: Crasher bug in the diffsingle training mission

__________________________________________
Roundup issue tracker <bugs at openhatch.org>
<https://openhatch.org/bugs/issue484>
__________________________________________


More information about the Devel mailing list