Tony: > Am 21.10.2015 um 14:30 schrieb Tony Olekshy <[email protected]>: > > Tony Olekshy wrote, on 2015-10-20 at 19:20 MDT: >> >> Hello. >> >> I'm having trouble understanding why I can't pipe the output of a >> tar -tzf a.tgz ... through to a tar -xzf a.tgz --files=from=- ... >> without producing what appear to be spurious messages. In practice >> I want to place a filter in that pipeline to select just what to >> extract, but the following script simplifies that out to just show >> the problem I'm encountering. > > Reuti wrote, on 2015-10-21 at 04:32 MDT: >> >> Accessing "." in the archive will move its pointer already to >> the end: >> >> $ echo . | tar tf archive.tgz --files-from=- >> ./ >> ./foo/ >> ./foo/bar > > Reuti wrote, on 2015-10-21 at 05:10 MDT: >> >> Ah, although I missed the --no-recursion at the first glance: its >> position is important. It must appear before the --files-from=- in >> your case. > > Perfect, that did it. The attached script with the --no-recursion > placed before the --files-from=- does exactly what I'm looking for, > and I've tested it with a filter between the tar -t and the tar -x > (a simple head -2 works for this testing), and it all works well. > > Thank you very much for you assistance with this matter, Reuti. Now > I understand the difference between tar's globally scoped options & > those that only apply to succeeding arguments.
A short question: did you test your script also with 1.28? While it is working in 1.26 now, I get the impression that in 1.28: 1) --files-from must be an exact match, hence --no-recursion has no meaning for it now 2) Due to 1), plain directories can't be extracted with --files-from any longer, only on the command line: $ cat lister ./foo/ $ local/tar-1.28/bin/tar --list --file=test/archive.tgz --files-from=lister local/tar-1.28/bin/tar: ./foo/: Not found in archive local/tar-1.28/bin/tar: Exiting with failure status due to previous errors $ local/tar-1.28/bin/tar --list --file=test/archive.tgz ./foo/ ./foo/ ./foo/bar $ local/tar-1.28/bin/tar --list --file=test/archive.tgz --no-recursion ./foo/ ./foo/ Can you confirm this? -- Reuti
