Patchwork [01,of,12] archival: tarit should never close the dest passed to it

login
register
mail settings
Submitter Mads Kiilerich
Date Jan. 11, 2013, 11:32 p.m.
Message ID <0a7d8aa24714c134ebdc.1357947165@mk-desktop>
Download mbox | patch
Permalink /patch/561/
State Accepted
Commit 87923db0ecffaf9c231bde69058e005225b2a2fc
Headers show

Comments

Mads Kiilerich - Jan. 11, 2013, 11:32 p.m.
# HG changeset patch
# User Mads Kiilerich <madski@unity3d.com>
# Date 1357947109 -3600
# Node ID 0a7d8aa24714c134ebdcb06dc1e583e04fd85d10
# Parent  16c642a6f07d1d4ba5ab325323ed1b58c6b27224
archival: tarit should never close the dest passed to it

Some archive types closed the open file passed to it, some didn't.

This could cause either missing or duplicate close and cause problems in hgweb.

The fix in 14f3795a5ed7 should only have closed the compressors and archivers -
not the underlying file itself if no compressor is used.

Patch

diff --git a/mercurial/archival.py b/mercurial/archival.py
--- a/mercurial/archival.py
+++ b/mercurial/archival.py
@@ -106,7 +106,6 @@ 
                 self.fileobj = gzfileobj
                 return tarfile.TarFile.taropen(name, mode, gzfileobj)
             else:
-                self.fileobj = fileobj
                 return tarfile.open(name, mode + kind, fileobj)
 
         if isinstance(dest, str):