mainGNU tar - Support: sr #106915, new option to export tar headers...


sr #106915: new option to export tar headers upon extraction (patch attached)

Submitter:  None
Submitted:  Thu 25 Jun 2009 07:58:47 PM UTC
Category:  None Priority:  5 - Normal
Severity:  1 - Wish Status:  None
Privacy:  Public Assigned to:  None
Originator Email:  -email is unavailable- Open/Closed:  Open
Operating System:  GNU/Linux
* Mandatory Fields

Add a New Comment Rich Markup

Thu 25 Jun 2009 07:58:47 PM UTC, original submission:  

Problem: When extracting files from an archive, one sometimes needs to pipe them to another process as an archive. More specifically, one sometimes requires a subset of an archive, still in the form of an archive.

Example Problem: I have a 300GB archive on a machine called 'server'. I'd like to extract a very small subset of this archive (let's say 100MB) to a machine called 'client'. In this case, ownership and permissions are critical; therefore, temporary extraction onto the file system is impractical (translation: root won't be running the extraction.) Transmitting the entire archive across the network is even more impractical. At present, no standard program can solve this dilemma.

Solution: Patch 'tar' (or on your case, use my patch) to so it can export the headers when it extracts files to standard output. I added the option `--export-headers' (`-Q') to be used in conjunction with `--to-stdout' (`-O').  It will also work with `--to-command'.

Solution to Example: Because I have my new `--export-headers' option, the following allows me to extract a subset of the large archive across the network without any loss of archive information:

    > tar -xOQf huge.tar smallfile | ssh me@client tar -x

(Realistically, it's a script on the other end; not 'tar' by itself.)

This simple patch solves what otherwise requires a horrendous solution. I hope you accept it! I'll certainly be using it, either way.
Kevin P. Barry []

PS  I wrote this today and the diff should be against the most recent 'git' revision.



(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

Attached Files
file #18337:  tar-plus-export-headers3.diff added by None (9KiB - application/octet-stream - This one handles extended headers. - Kevin P. Barry)
file #18324:  tar-plus-export-headers2.diff added by None (6KiB - application/octet-stream - The previous patch didn't handle non-regular files; this one does. Sorry! - Kevin P. Barry)
file #18322:  tar-plus-export-headers.diff added by None (4KiB - text/x-diff)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by None (Submitted the item)

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.


    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2009-06-28 None Attached File- Added tar-plus-export-headers3.diff, #18337
    2009-06-26 None Attached File- Added tar-plus-export-headers2.diff, #18324
    2009-06-25 None Attached File- Added tar-plus-export-headers.diff, #18322

    Back to the top

    Powered by Savane 3.13-b921.
    Corresponding source code