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

[Devel] [issue463] If you submit nothing to /missions/diffpatch/diffrecursive/submit , the server crashes

Asheesh Laroia bugs at openhatch.org
Fri Jul 1 22:12:31 UTC 2011


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

If you submit the empty value to /missions/diffpatch/diffrecursive/submit , then
the server hits an unhandled exception.

This should be fixed! It's also a good opportunity to write a test. A
good-quality way to fix this is:

* Write a test that logs in and does a POST to
/missions/diffpatch/diffrecursive/submit

* Verify that you can reproduce the crash

* Modify the view so that the test does not crash

* Submit a patch (-:

This is the stack trace you should expect to see.

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 91, in diffrecursive_submit
   
controllers.DiffRecursiveMission.validate_patch(form.cleaned_data['diff'].read())

  File
"/home/deploy/milestone-a.buildout/mysite/missions/diffpatch/controllers.py",
line 76, 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

----------
keyword: bitesize
messages: 2128
milestone: 0.11.07
nosy: paulproteus
priority: critical
status: unread
title: If you submit nothing to /missions/diffpatch/diffrecursive/submit , the server crashes

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


More information about the Devel mailing list