[BusyBox] Re: "tar" with a directory argument doesn't extract the directory recursively
Ben Giddings
ben+busybox at thingmagic.com
Thu May 19 20:52:38 UTC 2005
Ok, I've tracked down the problem.
The work in extracting tar files happens in get_header_tar(), at the bottom
it decides whether or not to deal with a given file using:
if (archive_handle->filter(archive_handle) == EXIT_SUCCESS) {
...
}
When a filename / dirname parameter is applied, it filters using
filter_accept_reject_list() in filter_accept_reject_list.c. That calls
find_list_entry (in find_list_entry.c)
find_list_entry calls:
if (fnmatch(list->data, filename, 0) == 0) {
Where list->data is the dirname you want extracted and filename is the name
of the file (or directory) it is testing against that pattern. If
list->data is "applets" and filename is "applets/Makefile" this test
should succeed, however if list->data is "applets" and filename is
"coreutils/Config.in" it should fail.
I could modify this function myself to do what I think it should do, but I
don't know what else I'll break in the process.
First of all, do people agree that if an tarball contains a directory 'foo'
containing a file 'README.TXT' the command
tar xf foo.tar foo
should create the directory 'foo' and put the file README.TXT into it?
If so, is the solution to change find_list_entry, or will that break other
things?
Ben
More information about the busybox
mailing list