Rev 2559: [BUG 119330] Fix tempfile permissions error in smart server tar bundling (under windows) (Martin_) in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Thu Jun 28 06:18:31 BST 2007


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 2559
revision-id: pqm at pqm.ubuntu.com-20070628051830-re1rvfieof32tnux
parent: pqm at pqm.ubuntu.com-20070628044459-ycsqzvmdvd2u9r4d
parent: mbp at sourcefrog.net-20070628043955-24gmbiw7luul0d6y
committer: Canonical.com Patch Queue Manager<pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Thu 2007-06-28 06:18:30 +0100
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
    ------------------------------------------------------------
    revno: 2557.1.1
    merged: 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 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