]> Dogcows Code - chaz/tar/commit
Reduce memory consuption when handling the -T option.
authorSergey Poznyakoff <gray@gnu.org.ua>
Sun, 4 Aug 2013 11:26:35 +0000 (14:26 +0300)
committerSergey Poznyakoff <gray@gnu.org.ua>
Sun, 4 Aug 2013 15:22:02 +0000 (18:22 +0300)
commit26538c9bfc5fd726d625bef5fa3f08212d50173a
treebe2e826b9842dd24c6953f9ad5a0dfcf3c3f7f26
parent8a834dfa1037758cb42123fd710048cebdc13e7b
Reduce memory consuption when handling the -T option.

The commit cdb27293 made the -T option more flexible, but
incurred a very considerable memory overhead by storing
all file names in the argument array.  In case of very
big file lists this caused tar to run out of memory.  This
was reported by Christian Wetzel <wetzel@phoenix-pacs.de>
on March 14, 2013
(http://lists.gnu.org/archive/html/bug-tar/2013-03/msg00018.html).

On the other hand, Michal Žeidl discovered that tar misfunctioned
when given empty file lists or lists with the trailing newline
misssing in the last entry.  This was reported by Pavel Raiskup
on July 23
(http://lists.gnu.org/archive/html/bug-tar/2013-07/msg00009.html and
msg00010.html).

This change fixes both issues.

* src/common.h (name_add_file,request_stdin): New prototype.
(more_options): New prototype.
* src/names.c (NELT_FILE): New entry type.
(name_elt) <file>: New union member.
(name_add_file): New function.
(read_name_from_file): New function, a rewrite of
the same function from tar.c
(read_next_name,copy_name): New static functions.
(name_next_elt): Handle NELT_FILE entries.
* src/tar.c (request_stdin): Make extern.
(read_name_from_file,add_file_id)
(update_argv): Removed.
(parse_opt): Change handling of the -T option.
(more_options): New function.

* tests/T-null.at: Rewrite test.
* tests/T-zfile.at: New file.
* tests/T-nonl.at: New file.
* tests/Makefile.am: Add new testcases.
* tests/testsuite.at: Likewise.

* THANKS: Update.
THANKS
src/common.h
src/names.c
src/tar.c
tests/Makefile.am
tests/T-empty.at
tests/T-nonl.at [new file with mode: 0644]
tests/T-null.at
tests/T-zfile.at [new file with mode: 0644]
tests/testsuite.at
This page took 0.03177 seconds and 4 git commands to generate.