Eduardo Robles Elvira added the comment:

> The example I gave is based on the idea that there is a TarVolumeSet class in 
> the tarfile module that implements all the required file-object methods (e.g. 
>  read(), write(), seek(), etc.) and acts as if the sequence of volumes is 
> actually one big file. It is passed to tarfile.open() as the fileobj 
> argument. This TarVolumeSet class is supposed to be subclassable to let the 
> user implement her/his own mode of operation. This way the open_volume() 
> method can do whatever the user wants it to do. The TarVolumeSet class might 
> as well have a new_volume() method for writing multivol archives, the example 
> only covered the case of reading a multivol archive.

This is not so easy, because for example if you want to move the logic in 
addfile() that manages volumes to the write() function, you have some issues:
 * write() will need to take into account blocks (BLOCKSIZE), just to be able 
to split the volumes correctly. This is something that usually shouldn't belong 
in a write() function as it has to do to tarfile.. and it can be messy that 
both layers deal with it (write() splitting volumes, and tarfile adding NUL at 
the end of a BLOCK..) This can be done I guess, but remember, we split a volume 
only in the middle of a big file, not in any other case (AFAIK). Hopefully you 
don't get huge pax headers or anything strange. Usually all other records are 
either in the begining or just occupy one block, but can we rule this problem 
out for good?

 * multivolume logic in write() needs read/write access to the current tarinfo 
being written (look for "tarfile" in addfile() funcion in my patch to see why). 
How do you propose this object should be accessed from write()? 

> BTW, my version of GNU tar refuses to create compressed multiple-volume 
> archives which is why I doubt the usefulness of this feature overall.

But it has multivolume support right? Which is what I am proposing here. Also, 
you can gzip (or encrypt or anything) the volumes after creating the volumes..

>> [...] because a multivol tarfile is not exactly the same as a normal tarfile 
>> chopped up.
> No, I think it is exactly that. The only purpose of the GNUTYPE_MULTIVOL 
> header that is at the start of each subsequent volume is to give GNU tar the 
> ability to detect if it is reading the correct volume. It is not essential 
> and could as well be left out.

I'm not going to discuss this, because I think that we can implement it in the 
way you propose to implement it anyway. But my patch supports it and I think 
it's an *useful* feature, so I want it in :-P

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue18321>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to