Rev 2558: [BUG 119330] Fix tempfile permissions error in smart server tar bundling (under windows) (Martin_) in http://sourcefrog.net/bzr/trivial

Martin Pool mbp at sourcefrog.net
Thu Jun 28 05:39:56 BST 2007


At http://sourcefrog.net/bzr/trivial

------------------------------------------------------------
revno: 2558
revision-id: mbp at sourcefrog.net-20070628043955-24gmbiw7luul0d6y
parent: pqm at pqm.ubuntu.com-20070627080723-ci6ghe3bsm0snyit
committer: Martin Pool <mbp at sourcefrog.net>
branch nick: trivial
timestamp: Thu 2007-06-28 14:39:55 +1000
message:
  [BUG 119330] Fix tempfile permissions error in smart server tar bundling (under windows) (Martin_)
modified:
  bzrlib/smart/repository.py     repository.py-20061128022038-vr5wy5bubyb8xttk-1
=== modified file 'bzrlib/smart/repository.py'
--- a/bzrlib/smart/repository.py	2007-04-26 08:15:40 +0000
+++ b/bzrlib/smart/repository.py	2007-06-28 04:39:55 +0000
@@ -213,7 +213,7 @@
     def _tarfile_response(self, tmp_dirname, compression):
         temp = tempfile.NamedTemporaryFile()
         try:
-            self._tarball_of_dir(tmp_dirname, compression, temp.name)
+            self._tarball_of_dir(tmp_dirname, compression, temp.file)
             # all finished; write the tempfile out to the network
             temp.seek(0)
             return SuccessfulSmartServerResponse(('ok',), temp.read())
@@ -222,8 +222,8 @@
         finally:
             temp.close()
 
-    def _tarball_of_dir(self, dirname, compression, tarfile_name):
-        tarball = tarfile.open(tarfile_name, mode='w:' + compression)
+    def _tarball_of_dir(self, dirname, compression, ofile):
+        tarball = tarfile.open(fileobj=ofile, mode='w|' + compression)
         try:
             # The tarball module only accepts ascii names, and (i guess)
             # packs them with their 8bit names.  We know all the files




More information about the bazaar-commits mailing list