2065: patch fails when trying to view patch

kand****@gmai***** (Google Code) (Is this you? Claim this profile.)
Aug. 8, 2013
> What version are you running?

1.5.4

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

/r/<id>/diff/

> What steps will reproduce the problem?

1. Put console.py into a sub directory. (eg. /repo/review/)
2. Upload console.patch for review. 
3. Try to view the patch.

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

Instead of difference, a Python traceback is shown:

Traceback (most recent call last):
...
  File "/usr/lib/python2.7/site-packages/ReviewBoard-1.5.4-py2.7.egg/reviewboard/diffviewer/diffutils.py", line 378, in get_patched_file
    return patch(filediff.diff, buffer, filediff.dest_file)

(Full traceback attached.)

patch() method executes this command, imho this is wrong:

  patch -o /tmp/reviewboard.Tvwttz/tmpP37ele-new /tmp/reviewboard.Tvwttz/tmpP37ele < /tmp/reviewboard.Tvwttz/console.py.diff

patch command fails:
  "invalid output file name: /tmp/reviewboard.Tvwttz/tmpP37ele"

Changing working directory and running patch works fine:
  cd /tmp/reviewboard.Tvwttz/
  patch -o tmpP37ele-new tmpP37ele < console.py.diff

IMHO, an os.chdir() will fix this.
#1 kand****@gmai***** (Google Code) (Is this you? Claim this profile.)
Sorry, wrong file was attached.
david
#2 david
  • +Component-DiffViewer
david
#3 david
Setting the cwd shouldn't be necessary, but maybe it's something in your version of `patch`

I've pushed a fix for this to master (1db33ee). It will be available in 1.8.0
  • +Fixed