1515: SVN hook can include empty arguments which seems to confuse svn diff

sto***@gmai***** (Google Code) (Is this you? Claim this profile.)
Nov. 7, 2010
What version are you running?

1.0.5.1

What's the URL of the page containing the problem?

n/a

What steps will reproduce the problem?

I'm getting a weird error:

./rb-post-commit-hook /srv/svn/fred 11
/usr/bin/post-review --repository-url=file:///srv/svn/fred --
username=admin --password=admin -p --submit-as=mike --revision-
range=10:11   --server=http://localhost/reviews/fred --summary="refs
#1 - publish review" --description="(In [11]) refs #1 - publish
review"
Failed to execute command: ['/usr/bin/post-review', '--repository-
url=file:///srv/svn/fred', '--username=admin', '--password=admin', '-
p', '--submit-as=mike', '--revision-range=10:11', '', '', '--
server=http://localhost/reviews/fred', '--summary="refs #1 - publish
review"', '--description="(In [11]) refs #1 - publish review"', '']
Failed to execute command: ['svn', 'diff', '--diff-cmd=diff', 'file:///
srv/svn/fred/@10', 'file:///srv/svn/fred/@11', '', '', '']
['svn: Target lists to diff may not contain both working copy paths
and URLs\n']

If I type the post-review command (I used print to display what was
being executed) then it works:

/usr/bin/post-review --repository-url=file:///srv/svn/fred --
username=admin --password=admin -p --submit-as=mike --revision-
range=10:11   --server=http://localhost/reviews/fred --summary="refs
#1 - publish review" --description="(In [11]) refs #1 - publish
review"
==> Review Board Login Required
Enter username and password for Review Board at http://localhost/reviews/fred/
Review request #13 posted.

http://localhost/reviews/fred/r/13 

What is the expected output? What do you see instead?

The review should be generated.

What operating system are you using? What browser?

Fedora 12 & Firefox/Galeon.

Please provide any additional information below.

The SVN hook can sometimes include empty arguments. Empty arguments should
be filtered from the argument list. See attached patch.
--- ORIGINAL-svn-hook-postcommit-review	2010-02-25 08:50:07.000000000 -0500
+++ svn-hook-postcommit-review	2010-02-25 09:09:40.000000000 -0500
@@ -221,6 +221,9 @@
     if len(reviewid) == 0:
         args += [summary, description, bugs]
 
+    # Filter out blank arguments.
+    args = [elem for elem in args if len(elem) > 1]
+
     if DEBUG:
         args += ['-d', '--output-diff']
         print [os.path.join(POSTREVIEW_PATH, 'post-review')] + args
@@ -234,3 +237,4 @@
 
 if __name__ == '__main__':
     main()
+
chipx86
#1 chipx86
Can you post the patch at http://reviews.reviewboard.org/ ? We don't review patches
on the bug tracker.
#2 sto***@gmai***** (Google Code) (Is this you? Claim this profile.)
I tried already but the site crashed with an exception that the patch was empty. I
guess I need to diff against the git repository except git clones are blocked by our
corporate firewall. :(
#3 sto***@gmai***** (Google Code) (Is this you? Claim this profile.)
Environment:

Request Method: POST
Request URL: http://reviews.reviewboard.org/r/new/
Django Version: 1.1.1
Python Version: 2.5.2
Installed Applications:
['django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.markup',
 'django.contrib.sites',
 'django.contrib.sessions',
 'djblets.datagrid',
 'djblets.feedview',
 'djblets.log',
 'djblets.siteconfig',
 'djblets.util',
 'djblets.webapi',
 'reviewboard.accounts',
 'reviewboard.admin',
 'reviewboard.changedescs',
 'reviewboard.diffviewer',
 'reviewboard.iphone',
 'reviewboard.notifications',
 'reviewboard.reports',
 'reviewboard.reviews',
 'reviewboard.scmtools',
 'reviewboard.webapi',
 'django_evolution']
Installed Middleware:
('django.middleware.gzip.GZipMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.doc.XViewMiddleware',
 'django.middleware.http.ConditionalGetMiddleware',
 'django.middleware.locale.LocaleMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'djblets.siteconfig.middleware.SettingsMiddleware',
 'reviewboard.admin.middleware.LoadSettingsMiddleware',
 'djblets.log.middleware.LoggingMiddleware',
 'reviewboard.admin.middleware.CheckUpdatesRequiredMiddleware',
 'reviewboard.admin.middleware.X509AuthMiddleware')


Traceback:
File
"/usr/lib/python2.5/site-packages/Django-1.1.1-py2.5.egg/django/core/handlers/base.py" in
get_response
  92.                 response = callback(request, *callback_args, **callback_kwargs)
File "/usr/lib/python2.5/site-packages/Djblets-0.5.7-py2.5.egg/djblets/auth/util.py"
in _checklogin
  46.             return view_func(request, *args, **kwargs)
File
"/usr/lib/python2.5/site-packages/ReviewBoard-1.5beta1-py2.5.egg/reviewboard/reviews/views.py"
in new_review_request
  69.                     parent_diff_file=request.FILES.get('parent_diff_path'))
File
"/usr/lib/python2.5/site-packages/ReviewBoard-1.5beta1-py2.5.egg/reviewboard/reviews/forms.py"
in create
  183.                              attach_to_history=True)
File
"/usr/lib/python2.5/site-packages/ReviewBoard-1.5beta1-py2.5.egg/reviewboard/reviews/forms.py"
in create
  235.                                                      history)
File
"/usr/lib/python2.5/site-packages/ReviewBoard-1.5beta1-py2.5.egg/reviewboard/diffviewer/forms.py"
in create
  66.             raise EmptyDiffError(_("The diff file is empty"))

Exception Type: EmptyDiffError at /r/new/
Exception Value: The diff file is empty
chipx86
#4 chipx86
Are you using post-review?
  • +NeedInfo
#5 sto***@gmai***** (Google Code) (Is this you? Claim this profile.)
Not for the crash in comment 3. I think you explained this my other bug report. I'll
try to get back to this next week.
#6 sto***@gmai***** (Google Code) (Is this you? Claim this profile.)
Created review request http://reviews.reviewboard.org/r/1440/.
david
#7 david
  • -NeedInfo
    +PendingReview
david
#8 david
  • -PendingReview
    +Fixed