Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 185305 | Differences between
and this patch

Collapse All | Expand All

(-)tarfile.py (-14 / +12 lines)
Lines 1179-1195 Link Here
1179
1179
1180
        # Fill the TarInfo object with all
1180
        # Fill the TarInfo object with all
1181
        # information we can get.
1181
        # information we can get.
1182
        tarinfo.name  = arcname
1182
        tarinfo.name = arcname
1183
        tarinfo.mode  = stmd
1183
        tarinfo.mode = stmd
1184
        tarinfo.uid   = statres.st_uid
1184
        tarinfo.uid = statres.st_uid
1185
        tarinfo.gid   = statres.st_gid
1185
        tarinfo.gid = statres.st_gid
1186
        if stat.S_ISDIR(stmd):
1186
        if stat.S_ISREG(stmd):
1187
            # For a directory, the size must be 0
1188
            tarinfo.size  = 0
1189
        else:
1190
            tarinfo.size = statres.st_size
1187
            tarinfo.size = statres.st_size
1188
        else:
1189
            tarinfo.size = 0L
1191
        tarinfo.mtime = statres.st_mtime
1190
        tarinfo.mtime = statres.st_mtime
1192
        tarinfo.type  = type
1191
        tarinfo.type = type
1193
        tarinfo.linkname = linkname
1192
        tarinfo.linkname = linkname
1194
        if pwd:
1193
        if pwd:
1195
            try:
1194
            try:
Lines 1280-1295 Link Here
1280
            self.addfile(tarinfo, f)
1279
            self.addfile(tarinfo, f)
1281
            f.close()
1280
            f.close()
1282
1281
1283
        if tarinfo.type in (LNKTYPE, SYMTYPE, FIFOTYPE, CHRTYPE, BLKTYPE):
1282
        elif tarinfo.isdir():
1284
            tarinfo.size = 0L
1285
            self.addfile(tarinfo)
1286
1287
        if tarinfo.isdir():
1288
            self.addfile(tarinfo)
1283
            self.addfile(tarinfo)
1289
            if recursive:
1284
            if recursive:
1290
                for f in os.listdir(name):
1285
                for f in os.listdir(name):
1291
                    self.add(os.path.join(name, f), os.path.join(arcname, f))
1286
                    self.add(os.path.join(name, f), os.path.join(arcname, f))
1292
1287
1288
        else:
1289
            self.addfile(tarinfo)
1290
1293
    def addfile(self, tarinfo, fileobj=None):
1291
    def addfile(self, tarinfo, fileobj=None):
1294
        """Add the TarInfo object `tarinfo' to the archive. If `fileobj' is
1292
        """Add the TarInfo object `tarinfo' to the archive. If `fileobj' is
1295
           given, tarinfo.size bytes are read from it and added to the archive.
1293
           given, tarinfo.size bytes are read from it and added to the archive.

Return to bug 185305