1143: Change to post-review in revision 1988 makes the captured Perforce output file unreadable on Mac

pds****@gmai***** (Google Code) (Is this you? Claim this profile.)
June 2, 2009
I downloaded the post-review script from the Subversion repository at revision 1990 and attempted 
to use it to submit a change to our server which is running a nightly snapshot from last December.  
The post-review script exited with an error when it attempted to generate the diff file from 
Perforce.  When I enabled debugging and attempted to run the failing diff command, I discovered 
that the temporary file that was being used to hold the previous version of the file had the odd 
permissions of -w-------.  After some poking around, I discovered that the _write_file method 
had been updated in revision 1988 to explicitly call os.chmod(tmpfile, stat.S_IWRITE). If I change 
the call to os.chmod(tmpfile. stat.S_IREAD | stat.S_IWRITE), then I am able to successfully post 
changes for review.

I have a attached a patch file that contains the described one line change.
--- post-review	2009-06-01 16:10:12.000000000 -0700
+++ /Users/pstout/bin/post-review	2009-06-01 16:11:34.000000000 -0700
@@ -1702,7 +1702,7 @@
         debug('Writing "%s" to "%s"' % (depot_path, tmpfile))
         execute(["p4", "print", "-o", tmpfile, "-q", depot_path])
-        os.chmod(tmpfile, stat.S_IWRITE)
+        os.chmod(tmpfile, stat.S_IREAD | stat.S_IWRITE)
     def _depot_to_local(self, depot_path):
#1 chipx86
Thanks. Sorry about the breakage.

We generally prefer that diffs be uploaded to http://reviews.review-board.org/, but
this is simple enough where I'll take this here this time.

Fixed in r1991.
  • +Fixed
  • +Component-RBTools
  • +chipx86