From 26538c9bfc5fd726d625bef5fa3f08212d50173a Mon Sep 17 00:00:00 2001 From: Sergey Poznyakoff Date: Sun, 4 Aug 2013 14:26:35 +0300 Subject: Reduce memory consuption when handling the -T option. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 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) : 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 | 2 ++ 1 file changed, 2 insertions(+) (limited to 'THANKS') diff --git a/THANKS b/THANKS index 64591577..c30df337 100644 --- a/THANKS +++ b/THANKS @@ -91,6 +91,7 @@ Christian Kirsch ck@held.mind.de Christian Laubscher christian.laubscher@tiscalinet.ch Christian T. Dum ctd@mpe-garching.mpg.de Christian von Roques roques@pond.sub.org +Christian Wetzel wetzel@phoenix-pacs.de Christoph Litauer litauer@mailhost.uni-koblenz.de Christophe Colle colle@krtkg1.rug.ac.be Christophe Kalt Christophe.Kalt@kbcfp.com @@ -350,6 +351,7 @@ Michael P Urban urban@cobra.jpl.nasa.gov Michael Schmidt michael@muc.de Michael Schwingen m.schwingen@stochastik.rwth-aachen.de Michael Smolsky fnsiguc@astro.weizmann.ac.il +Michal Žejdl zejdl@suas.cz Mike Muuss mike@brl.mil Mike Nolan nolan@lpl.arizona.edu Mike Rogers mike@demon.net -- cgit v1.2.1