bug-tar
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 1/2] add option to set the offset of the archive


From: Matteo Croce
Subject: Re: [PATCH 1/2] add option to set the offset of the archive
Date: Thu, 24 Oct 2024 19:09:57 +0200

Il giorno gio 24 ott 2024 alle ore 18:56 Marius Spix
<marius.spix@web.de> ha scritto:
>
> Mhhhh,
>
> char *buf = xmalloc (offset_option);
> ...
> free (buf);
>
> Reading lots of data into a huge buffer just to free it later does not sound 
> like a good idea. There are more efficient ways to fast-forward a tape or to 
> receive a file stream starting at a certain offset (pipe dd through tar).
>

Hi,
yes, the buffer could be big. A better option could be to lseek(), but
that won't work with pipes.
Alternatively, I could create a decent sized buffer, e.g. a few Kb,
and read in a loop until needed.

I know that it's possible to pipe the stream with an external process,
but there are some use cases where a seekable file descriptor is
preferable.
One for all, listing the content of a huge archive is much faster when
tar can seek forward.

> Regards,
>
> Marius
>
>
>

Regards,
-- 
Matteo Croce

perl -e 'for($t=0;;$t++){print chr($t*($t>>8|$t>>13)&255)}' |aplay



reply via email to

[Prev in Thread] Current Thread [Next in Thread]