bug-tar
[Top][All Lists]
Advanced

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

[Bug-tar] Extracting only the first matching file: --occurrence bug?


From: Alex Bligh
Subject: [Bug-tar] Extracting only the first matching file: --occurrence bug?
Date: Tue, 02 Jul 2013 19:20:19 +0100

I /think/ this is a bug, but I'm not sure.

I want to extract only the first matching file of a huge tar archive
to stdout (excluding some files matching a pattern).

Assuming I do this:

echo "hello" > hello && echo "world" > world && echo "*" > star && echo "ignore" > ignore && tar cf test.tar ignore hello world

I can get the first file out like this:

$ tar -x -O --wildcards -T star --occurrence -f test.tar
ignore

However, if I want to exclude all files called 'ignore', and still
match the first occurrence of my wildcard:

$ tar -x -O --wildcards -T star --occurrence -f test.tar --exclude=ignore

I get no output.

It appears that --occurrence and --exclude aren't playing nicely
together, as an excluded file counts as an occurrence, which
seems wrong to me, as I can't see why it would ever be useful.

Is --occurrence meant to work like this, or is this a bug?

If --occurrence is meant to work like this, is there another way
to do it? Would you accept a patch for (e.g.) --extract-index=N
to extract the N'th file only (or maybe a parameter to --to-stdout
as an index).

--
Alex Bligh



reply via email to

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