On Thursday 14 of August 2014 08:47:15 Tim Kientzle wrote: > > On Aug 13, 2014, at 10:39 PM, Dilip Chhetri <[email protected]> wrote: > > > I have lots of large .tar.gz files and I need to extract just a single > > (small) file from it. I purposely put it at the front of .tar file so that > > extraction is fast, but if that file is gzipped, then 'tar' wants to read > > the whole .tgz file before exiting. > ... > > Q: is there any special option to make it fast. If not this would be really > > good enhancement (I saw lot of people asking for it on the web). If someone > > can post a patch to fix this behaviour, that would be really nice. I spent > > sometime reading source code for tar, but things aren't looking obvious to > > me. > > GNU tar relies on a separate program to decompress > input files and needs to allow that program to finish in > order to avoid problems in various boundary cases. In > effect, this means that GNU tar does in fact always > decompress the entire file. This is unlikely to change, > as a lot of people depend on the current behavior.
I'm just curious, what people depend on with this regard? They require the whole file is read? We could hide the optimization behind new option, possibly. The problem what can happen is that one tar file may have multiple files of the same name (so one expectation would be to read/extract only the first occurrence). Pavel
