summaryrefslogtreecommitdiff
path: root/src/buffer.c
Commit message (Collapse)AuthorAgeFilesLines
* Update copyright yearsPaul Eggert2023-01-061-1/+1
| | | | | | | | | UPDATE_COPYRIGHT_USE_INTERVALS=1 \ gnulib/build-aux/update-copyright \ $(git ls-files | sed -e '/^gnulib$/d /^paxutils$/d /^COPYING$/d /\/fdl.texi$/d')
* Fix savannah bug #63567Sergey Poznyakoff2022-12-261-1/+2
| | | | | * src/buffer.c (short_read): Increase records_read only if a full record has been read.
* Fix savannah bug #63250Sergey Poznyakoff2022-10-221-0/+1
| | | | * src/buffer.c (magic): Add signature of LZMA files produced by xz.
* Avoid excess lseek etc.Paul Eggert2022-08-151-64/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/buffer.c, src/delete.c: Do not include system-ioctl.h. * src/buffer.c (guess_seekable_archive): Remove. This is now done by get_archive_status, in a different way. (get_archive_status): New function that gets archive_stat unless remote, and sets seekable_archive etc. (_open_archive): Prefer bool for boolean. (_open_archive, new_volume): Get archive status consistently by calling get_archive_status in both places. * src/buffer.c (backspace_output): * src/compare.c (verify_volume): * src/delete.c (move_archive): Let mtioseek worry about mtio. * src/common.h (archive_stat): New global, replacing ar_dev and ar_ino. All uses changed. * src/delete.c (move_archive): Check for integer overflow. Also report overflow if the archive position would go negative. * src/system.c: Include system-ioctl.h, for MTIOCTOP etc. (mtioseek): New function, which also checks for integer overflow. (sys_save_archive_dev_ino): Remove. (archive_stat): Now (sys_get_archive_stat): Also initialize mtioseekable_archive. (sys_file_is_archive): Don’t return true if the archive is /dev/null since it’s not a problem in that case. (sys_detect_dev_null_output): Cache dev_null_stat. doc: omit MS-DOS mentions in doc It’s really FAT32 we’re worried about now, not MS-DOS. And doschk is no longer a GNU program.
* Update copyright yearsSergey Poznyakoff2022-01-021-1/+1
|
* Pacify --enable-gcc-warnings -flto -fanalyzerPaul Eggert2021-03-011-4/+4
| | | | | | | | | | | | | | With GCC 10.2.1, ‘./configure --enable-gcc-warnings CFLAGS='-O2 -flto -fanalyzer' issued a false alarm about uninitialized variable use. Pacify GCC by using a variant of the code. * src/buffer.c (zip_program): Omit last placeholder entry. (n_zip_programs): New constant. (find_zip_program): Use it instead of placeholder. (first_decompress_program): Set *PSTATE to maximum value if skipping the table. This avoids confusing gcc -flto into thinking *PSTATE is used uninitialized. (next_decompress_program): Simplify now that *PSTATE is maximal when skipping.
* maint: port better to non-GCC compilersPaul Eggert2021-03-011-1/+1
| | | | | | | | | | | | This can be helpful in porting to compilers like Oracle Developer Studio that support some but not all GCC attributes. * lib/wordsplit.c (FALLTHROUGH): Remove; now done by attribute.h. * lib/wordsplit.h (__WORDSPLIT_ATTRIBUTE_FORMAT): Remove; all uses replaced by ATTRIBUTE_FORMAT. * lib/wordsplit.h, src/buffer.c, src/common.h, src/compare.c: * src/sparse.c, src/system.c, src/xheader.c: Prefer ATTRIBUTE_FORMAT, MAYBE_UNUSED, _Noreturn, etc. to __attribute__.
* maint: port to Fedora 33Paul Eggert2021-02-271-3/+5
| | | | | | | | | | | | | | | | | | | | | | | Fedora 33 uses GCC 10.2.1, which is a bit pickier. * configure.ac: Do not use -Wsystem-headers, as this runs afoul of netdb.h on Fedora 33. * gnulib.modules: Add ‘attribute’. * lib/wordsplit.c (wsnode_new): Return the newly allocated pointer instead of a boolean, to pacify GCC 10.2.1 which otherwise complains about use of possibly-null pointers. All uses changed. * src/buffer.c (try_new_volume): Don’t assume find_next_block succeeds. (_write_volume_label): Pacify GCC 10.2.1 with an ‘assume’, since LABEL must be nonnull here. * src/common.h (FALLTHROUGH): Remove; now in attribute.h. Include attribute.h, for ATTRIBUTE_NONNULL. * src/misc.c (assign_string_or_null): New function, taking over the old role of assign_string. (assign_string): Assume VALUE is non-null. (assign_null): New function, taking over the old role of assign_string when its VALUE was nonnull. All callers of assign_string changed to use these functions. (assign_string_n): Clear *STRING if VALUE is null, to fix a potential double-free.
* Update copyright yearsSergey Poznyakoff2021-01-061-1/+1
|
* Update copyright yearsSergey Poznyakoff2020-02-081-1/+1
|
* POSIX extended format headers do not include PID by defaultZachary Vance2019-03-281-1/+1
| | | | | | | | | | | | | | | | | | The intent is to make binary-equivalent PAX archives easy to create. If POSIXLY_CORRECT is set, the POSIX standard default is used, which embeds the pid. * src/common.h (posixly_correct): New global. * src/tar.c (decode_options): Detect the POSIXLY_CORRECT environment variable. * src/buffer.c (add_chunk_header): Change filenames of multipart files to omit the pid. * src/xheader.c (HEADER_TEMPLATE): New macro. (xheader_xhdr_name, xheader_ghdr_name): Use HEADER_TEMPLATE to select the template for the POSIX extended header name. * doc/tar.texi: Document the change. Signed-off-by: Zachary Vance <za3k@za3k.com>
* Version 1.31release_1_31Sergey Poznyakoff2019-01-021-2/+1
|
* Don't try to read past the end of header string fieldsSergey Poznyakoff2018-11-241-13/+4
| | | | | | | | | * src/common.h (assign_string_n): New proto. (ASSIGN_STRING_N): New macro. * src/misc.c (assign_string_n): New function. * gnulib.modules: Add strnlen. * src/buffer.c: Use assign_string_n where appropriate. * src/list.c: Likewise.
* maint: avoid -Wstringop-truncation warnings upcoming GCC8Jim Meyering2018-04-071-5/+9
| | | | | | | | | | | * src/buffer.c (gnu_add_multi_volume_header): Convert a use of strncpy to memcpy, to avoid this warning: In function 'strncpy', inlined from 'gnu_add_multi_volume_header' at buffer.c:1782:3, ... /usr/include/bits/string_fortified.h:106:10: error: '__builtin_strncpy'\ specified bound 100 equals destination size \ [-Werror=stringop-truncation]
* Add support for zstd compressionAdam Borowski2018-03-181-1/+4
| | | | | | | | | * configure.ac (zstd): Register compression program. * doc/tar.1: Mention --zstd. * doc/tar.texi: Document zstd support. * src/buffer.c: Register zstd compression. * src/suffix.c: Add suffixes zst and tzst. * src/tar.c: New compression option --zstd.
* Port to gcc -Wimplicit-fallthrough=5Paul Eggert2017-11-181-7/+5
| | | | | | | * src/common.h (FALLTHROUGH): New macro, for use with gcc -Wimplicit-fallthrough=5, which is now the default when used with Gnulib after commit 2017-05-16T16:23:52!eggert@cs.ucla.edu and with --enable-gcc-warnings
* Fix non-deterministic archive type detectionPavel Raiskup2017-05-291-4/+6
| | | | | | | | | | | Due to analysis of partly uninitialized read-ahead buffer (short_read call), we sometimes mistakenly classified very small compressed archives as non-compressed; which in turn caused extraction failure. * src/buffer.c (check_compressed_archive): Don't assume that archives smaller than BLOCKSIZE could be non-compressed, as tar header always has at least one block.
* Fix a bug in multi-volume archive creation.Sergey Poznyakoff2017-05-291-14/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | When creating multivolume archives, the bufmap code in buffer.c implicitly assumed that the members are stored in the archive contiguously, ignoring the member (and eventual extended) headers between them. This worked until the member header happened to be at the very beginning of the volume, in which case its length was included in the calculation of the stored size and size left to store. Due to this, the GNUFileParts extended header contained invalid GNU.volume.offset value, and the resulting archive failed to extract properly. This patch also eliminates improper listing of file part headers as regular files, when creating multivolume posix archives with -v. * src/buffer.c (bufmap): New member nblocks. Counts number of blocks of file data written since reset. (bufmap_reset): Reset nblocks to 0. (_flush_write): Update nblocks. When computing offset difference for bufmap_reset, count only data blocks, not headers. (close_archive): Flush archive until all blocks are written. (add_chunk_header): Use simple_finish_header instead of finish_header to avoid listing chunk header as regular file in verbose mode. * tests/multiv10.at: New test case. * tests/Makefile.am: Add new test. * tests/testsuite.at: Add new test.
* Update copyright yearsSergey Poznyakoff2017-01-021-2/+2
|
* Fix appending to archive with changed blocking factor.Sergey Poznyakoff2016-03-151-6/+16
| | | | | | | | | | | * src/buffer.c (flush_archive): If previous reading attempt resulted in short read, correctly use the remaining record space. (backspace_output): Fix position calculation (still has to be improved). * tests/append05.at: New test case. * tests/Makefile.am: Add new test. * tests/testsuite.at: Likewise.
* Update copyright yearsSergey Poznyakoff2016-01-201-1/+1
|
* BugfixPavel Raiskup2015-12-061-3/+6
| | | | | | * src/buffer.c (try_new_volume): Warn if user supplied malformed tar archive. Consistently use WARN (instead of ERROR) when reporting.
* Fix segfault when extracting from a multi-volume archive.Sergey Poznyakoff2015-12-061-2/+8
| | | | | | | | | Fix suggested by Pavel Raiskup. * src/buffer.c (try_new_volume): Fix dereferencing NULL pointer. * tests/multiv09.at: New testcase. * tests/Makefile.am: Add new testcase. * tests/testsuite.at: Likewise.
* Catch compressor execution errors.Sergey Poznyakoff2015-12-051-0/+10
| | | | | | | | | | | | * src/misc.c (write_fatal_details): Move to buffer.c * src/buffer.c (write_fatal_details): Close the archive and wait for the compressor program to terminate in order to catch eventual execution errors. * src/system.c (sys_child_open_for_compress): Ignore SIGPIPE so tar will not silently terminate when unable to write to the compressor. * tests/comperr.at: New file. * tests/Makefile.am: Add comperr.at * tests/testsuite.at: Include comperr.at
* Fix problems caught by static checkingPaul Eggert2015-09-241-6/+6
| | | | | | | | | | | | | | | | | | | | | | Most of these can be caught by configuring with --enable-gcc-warnings. Problem reported by Pavel Raiskup in: http://lists.gnu.org/archive/html/bug-tar/2015-09/msg00001.html * src/buffer.c (format_total_stats): Prefer pointer to const when it’s OK to use const. (default_total_format): Now const. * src/buffer.c (default_total_format): * src/exclist.c (excfile_head, excfile_tail, vcs_ignore_files): * src/misc.c (namebuf_add_dir, namebuf_finish): * src/tar.c (verbatim_files_from_option, option_set_in_cl) (optloc_eq, set_old_files_option): Now static. * src/common.h: Adjust to match the other changes described here. * src/exclist.c (info_cleanup_exclist): * src/tar.c (argp_program_version, argp_program_bug_address): Remove; unused. (parse_default_options): Define via prototype instead of old style. (parse_default_options, decode_options): Fill out incomplete initializers.
* Improve compression format recognitionSergey Poznyakoff2015-02-191-1/+4
| | | | | | | | | Some comressed archives can pass the checksum test, which makes tar treat them as uncompressed archives. * src/buffer.c (check_compressed_archive): Test the checksum only if the block we read looks like a valid tar header (i.e. has a magic string).
* Refuse to write archive contents to a tty.Sergey Poznyakoff2014-03-271-10/+17
| | | | | | * NEWS: Update. * src/buffer.c (_open_archive): Refuse to write to a tty. * tests/iotty.at: Test output to a tty.
* Fail if archive comes from a terminal.Sergey Poznyakoff2014-03-201-1/+10
| | | | | | | | | | | | Based on patch from Pavel Raiskup <praiskup@redhat.com>. * gnulib.modules: Add new modules. * src/buffer.c (_open_archive): Refuse to read archive from a tty. * tests/Makefile.am (TESTSUITE_AT): Add iotty.at (check_PROGRAMS): New program ttyemu * tests/testsuite.at: Include iotty.at * tests/iotty.at: New file. * tests/ttyemu.c: New file.
* Update copyright years.Sergey Poznyakoff2014-01-301-2/+2
|
* checkpoint actions: further improvements.Sergey Poznyakoff2014-01-221-16/+17
| | | | | | | | | | | | | | | | * NEWS: Update. * doc/tar.texi: Update. * src/buffer.c (print_stats): Avoid use of additional string buffer. Allow for text to be NULL. Call gettext if it is not. (format_total_stats): Don't use gettext when calling print_stats. * src/checkpoint.c (def_format): Change default format. (format_checkpoint_string): Implement optional arguments for T conversion. (finish_checkpoint_actions): Rename to checkpoint_flush_actions, make extern. All uses changed. * src/common.h (checkpoint_flush_actions): New proto. * src/tar.c (main): Set error_hook
* Improve checkpoint interface.Sergey Poznyakoff2014-01-221-2/+2
| | | | | | | | | | | * src/buffer.c (format_total_stats): The format arg is const All uses updated. (default_total_format): const * src/checkpoint.c (tty, tty_cleanup): New static. (format_checkpoint_string): New "canned" format %c (checkpoint_finish): New function. * src/common.h (checkpoint_finish): New proto. * src/tar.c (main): Call checkpoint_finish.`
* Implement statistics display in checkpoint actions.Sergey Poznyakoff2014-01-211-24/+58
| | | | | | | | | | | | | | | | | | | | | * NEWS: Update. * configure.ac: Version 1.27.90 * gnulib.modules: Add fprintftime. * doc/tar.texi: Document the "totals" action and new format specifiers for echo and ttyout checkpoint actions. * src/buffer.c (compute_duration): Return computed value. (print_stats): Don't print trailing newline. Return number of characters output. (format_total_stats): New function. (print_total_stats): Rewrite via format_total_stats. * src/checkpoint.c (checkpoint_opcode) <cop_totals>: New opcode. (checkpoint_compile_action): Handle cop_totals. (expand_checkpoint_string): Remove. (format_checkpoint_string): New function to be used instead of expand_checkpoint_string. All callers updated. * src/common.h (TF_READ,TF_WRITE) (TF_DELETED): New constants. (format_total_stats,print_total_stats): New protos.
* Changes for compatibility with Slackware installation scripts.Sergey Poznyakoff2013-09-231-5/+5
| | | | | | | | | | | | | | | | | | | * src/buffer.c (short_read): the "Record size" message is controlled by the WARN_RECORD_SIZE warning_option bit. * src/common.h (keep_directory_symlink_option): New global. (WARN_RECORD_SIZE): New constant. (WARN_VERBOSE_WARNINGS): Add WARN_RECORD_SIZE. * src/extract.c (extract_dir): If keep_directory_symlink_option is set, follow symlinks to directories. * src/suffix.c (compression_suffixes): Add support for txz suffix. * src/tar.c (KEEP_DIRECTORY_SYMLINK_OPTION): New constant. (options): New option --keep-directory-symlink. (parse_opt): Handle this option. * src/warning.c: Implement "record-size" warning control. * NEWS: Update. * doc/tar.texi: Document new features.
* Fix interacton of --verbose and --append.Sergey Poznyakoff2013-08-041-5/+6
| | | | | | | | | * src/buffer.c (_open_archive): don't overwrite existing archive if given the --verify option. * tests/append04.at: New file. * tests/Makefile.am: Add new testcase. * tests/testsuite.at: Add new testcase. * THANKS: Update.
* maint: update copyrights for 2013 and as per current GNU standardsPaul Eggert2012-12-311-14/+14
|
* tar: remove unused externs, or make them staticPaul Eggert2012-12-191-4/+4
| | | | | | | | | | | | | * src/buffer.c (record_buffer_aligned, flush_write_ptr, flush_read_ptr) (duration): * src/list.c (recent_global_header): * src/unlink.c (deferred_unlink_delay): * src/transform.c (transform_flags): * src/xattrs.c (acl_get_file_at, acl_set_file_at, file_has_acl_at): Now static. * src/common.h (rmt_command_option): Remove; unused. * src/tar.c (check_links_option, allocated_archive_names): Move decls here from common.h; these are now static.
* build: new configure option --enable-gcc-warningsPaul Eggert2012-12-181-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This has a similar meaning as in other GNU applications such as coreutils and Emacs. * NEWS: Document it. * .gitignore: Remove redundant build-aux. Remove gnu, since gnu/Makefile.am is now in git. Add gnu/.gitignore, gnu/charset.alias, gnu/*.h, gnu/*/ to cover autogenerated files. * bootstrap.conf (gnulib_mk): Remove. * configure.ac: Add support for --enable-gcc-warnings, taken from coreutils and simplified. * gnu/Makefile.am: New file. Formerly this was autogenerated, but the autogenerated file has been renamed to gnulib.mk, its usual name when bootstrapping from gnulib. This way, AM_CFLAGS can incorporate warning options. * gnulib.modules: Add manywarnings. * lib/Makefile.am, src/Makefile.am (AM_CFLAGS): New macro, incorporating warning options. * lib/attr-xattr.in.h (ENOATTR): New macro, if not already defined. * src/buffer.c (magic): Don't rely on incomplete initializers. * src/common.h (report_difference): Add printf format attribute. * src/system.c (sys_exec_command, sys_exec_info_script) (sys_exec_checkpoint_script): * src/tar.c (update_argv): Add casts to char * to pacify GCC warnings about using string literals in a char * context. * src/xattrs.c, src/xattrs.h (xattrs_clear_setup): Declare parameters as (void), not (). * src/xheader.c (xheader_format_name): Initialize pptr to null, to pacify GCC. Remove unnecessary test of nptr versus null.
* tar: remove lintPaul Eggert2012-03-111-7/+7
| | | | | | | | | | | | | | | | | | | | | This lint was found by GCC 4.6.2 on Fedora 15 x86-64. * src/buffer.c (buffer_write_global_xheader, mv_end, set_start_time) (compute_duration, print_total_stats, flush_read, flush_write): * src/checkpoint.c (checkpoint_finish_compile): * src/list.c (test_archive_label): * src/misc.c (chdir_count): * src/names.c (const): * src/unlink.c (finish_deferred_unlinks): Define with (void) instead of with (), for slightly-better C type checking and to avoid a GCC warning. * src/compare.c (diff_dumpdir): * src/tar.c (parse_owner_group): Remove unused local. * src/misc.c (chdir_do): * src/tar.c (add_exclude_array): Rename local to avoid shadowing. (LOW_DENSITY_NUM, MID_DENSITY_NUM, HIGH_DENSITY_NUM): Define only if needed. * src/update.c (update_archive): Initialize a local; this fixes what appears to be a real bug.
* tar: quote 'like this', not `like this'Paul Eggert2012-01-181-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes some test failures recently introduced by gnulib updates prompted by recent changes to the GNU coding standards, which now advise to use quotes 'like this' or "like this" rather than `like this'. * NEWS: Document this. * README, README-hacking, doc/Makefile.am, scripts/backup.in: * scripts/backup.sh.in, scripts/dump-remind.in: * src/buffer.c, src/checkpoint.c, src/create.c, src/incremen.c: * src/misc.c, src/names.c, src/sparse.c, src/transform.c: * tests/incr02.at, tests/incremental.at, tests/multiv08.at: * tests/sparse04.at, tests/star/README, tests/update01.at: Quote 'like this' in comments. * src/tar.h: Quote "like this" in comments, when quoting English phrases rather than code. * configure.ac: * scripts/xsparse.c (get_var, read_xheader, main): * src/compare.c (diff_archive): * src/extract.c (prepare_to_extract): * src/tar.c (request_stdin, tar_set_quoting_style, doc, options) (set_subcommand_option, report_textual_dates, parse_opt) (decode_options, main): * src/xheader.c (decx): Quote 'like this' in diagnostics. * doc/tar.texi (list, warnings, override) (Selecting Archive Members, quoting styles, after, hard links) (Sparse Recovery, Multi-Volume Archives, label): Adjust documentation to match new output. * tests/backup01.at, tests/incr01.at, tests/incr04.at: * tests/label04.at, tests/label05.at, tests/link03.at: * tests/listed02.at, tests/multiv03.at, tests/multiv05.at: * tests/rename01.at, tests/rename02.at, tests/rename03.at: * tests/volume.at: Adjust tests to match new quoting behavior.
* Run alternative decompression programs if the principal one is not available.Sergey Poznyakoff2010-11-051-12/+83
| | | | | | | | | | | | | | | | | | | | | | | | | | Some compression programs are able to handle various compression formats (e.g. `gzip' can decompress files created by `compress', `xz' is able to handle lzma, etc.) Tar tries to use such programs for decompression if the principal decompressor cannot be started. * src/buffer.c (compress_type): Swap ct_none and ct_tar. (archive_compression_type): New static variable. (zip_magic): Remove program and option fields. (zip_program): New structure and static. (compress_program): Remove macro. (find_zip_program): New static function. (first_decompress_program,next_decompress_program): New functions. (open_compressed_archive): Set archive_compression_type instead of use_compress_program_option. * src/common.h (first_decompress_program) (next_decompress_program): New functions. (WARN_DECOMPRESS_PROGRAM): New flag. (WARN_VERBOSE_WARNINGS): Include WARN_DECOMPRESS_PROGRAM. * src/warning.c (warning_args): Add "decompress-program". (warning_types): Add WARN_DECOMPRESS_PROGRAM. * src/system.c (run_decompress_program): New function. (sys_child_open_for_uncompress): Use run_decompress_program instead of calling execlp directly.
* tar: fix misspelled identifier "set_comression_program_by_suffix"Paul Eggert2010-08-231-1/+1
| | | | | | * src/suffix.c (set_compression_program_by_suffix): Renamed from set_comression_program_by_suffix. * src/buffer.c, src/common.h, src/tar.c: All uses changed.
* tar: remove trailing white space from source filesPaul Eggert2010-08-191-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * ChangeLog.1, ChangeLog.CVS, Makefile.am, NEWS, README: * README-hacking, directory, doc/Makefile.am, doc/dumpdir.texi: * doc/gendocs_template, doc/intern.texi, doc/mastermenu.el: * doc/snapshot.texi, doc/sparse.texi, doc/tar-snapshot-edit.texi: * doc/value.texi, lib/Makefile.am, scripts/backup-specs: * scripts/dump-remind.in, scripts/tar-snapshot-edit, scripts/tarcat: * scripts/xsparse.c, src/arith.h, src/buffer.c, src/compare.c: * src/create.c, src/delete.c, src/exit.c, src/suffix.c, src/tar.c: * src/tar.h, src/update.c, src/warning.c, src/xheader.c: * tests/append01.at, tests/append02.at, tests/atlocal.in: * tests/delete03.at, tests/exclude.at, tests/exclude06.at: * tests/extrac04.at, tests/extrac05.at, tests/extrac06.at: * tests/extrac07.at, tests/filerem01.at, tests/filerem02.at: * tests/incr01.at, tests/incr02.at, tests/incr03.at, tests/incr06.at: * tests/label02.at, tests/label03.at, tests/label04.at: * tests/label05.at, tests/link02.at, tests/link03.at: * tests/listed01.at, tests/listed02.at, tests/long01.at: * tests/longv7.at, tests/multiv01.at, tests/multiv02.at: * tests/multiv03.at, tests/multiv05.at, tests/multiv06.at: * tests/multiv07.at, tests/multiv08.at, tests/options.at: * tests/options02.at, tests/remfiles03.at, tests/rename01.at: * tests/rename02.at, tests/rename03.at, tests/rename04.at: * tests/rename05.at, tests/same-order01.at, tests/same-order02.at: * tests/shortfile.at, tests/shortupd.at, tests/sparse01.at: * tests/sparse02.at, tests/sparsemv.at, tests/sparsemvp.at: * tests/star/README, tests/star/gtarfail2.at: * tests/star/multi-fail.at: * tests/star/pax-big-10g.at, tests/star/quicktest.sh: * tests/star/ustar-big-2g.at, tests/star/ustar-big-8g.at: * tests/update01.at, tests/update02.at, tests/volsize.at: * tests/volume.at: Remove trailing spaces and tabs from lines, and remove trailing empty lines from files. This makes it a bit easier to share code among coreutils and other projects that do this.
* Keep a detailed map of archive members stored in the record buffer.Sergey Poznyakoff2010-07-111-111/+148
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A separate map (bufmap) provides information for creating multi-volume continuation headers. * src/buffer.c (bufmap): New struct. (bufmap_head, bufmap_tail, inhibit_map): New variables. (mv_begin_write): New function. (mv_begin): Rename to mv_begin_read. Rewrite using mv_begin_write. All callers changed. (mv_total_size): Remove. (bufmap_locate, bufmap_free, bufmap_reset): New functions. (_flush_write): Update bufmap. (close_archive): Free bufmap. (add_chunk_header): Take a bufmap argument. (gnu_add_multi_volume_header): Likewise. (add_multi_volume_header): Likewise. (_gnu_flush_write): Rewrite using bufmap. (real_s_name, real_s_totsize) (real_s_sizeleft) (save_name, save_totsize, save_sizeleft): Removed. All uses updated. (mv_size_left): Update bufmap_head. (mv_end): Rewrite. (multi_volume_sync): Remove. * src/common.h (mv_begin_write): New prototype. (mv_begin): Rename to mv_begin_read. * src/create.c: Use mv_begin_write instead of mv_begin. Remove calls to mv_size_left and mv_end. * src/sparse.c: Likewise. * tests/multiv07.at: Close stdin. * tests/spmvp00.at: Update AT_KEYWORDS. * tests/spmvp10.at: Likewise. * tests/multiv08.at: New testcase. * tests/Makefile.am, tests/testsuite.at: Add multiv08.at.
* Minor fix.Sergey Poznyakoff2010-06-281-1/+1
| | | | | * src/buffer.c (magic): Split the character constant to help cc recognize character boundaries (7 is a valid hex character).
* Minor fix.Sergey Poznyakoff2010-06-271-1/+1
| | | | * src/buffer.c (magic): Fix xz magic.
* Remove some lint, found by gcc -W etc.Paul Eggert2010-06-161-47/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/common.h (label_notfound): New decl. * src/buffer.c (set_volume_start_time, compress_type): (guess_seekable_archive, open_compressed_archive, init_buffer): (_flush_write, archive_is-dev, increase_volume_number): (change_tape_menu, try_new_volume, add_chunk_header): (multi_volume_sync): Declare as 'static' if it's not exported. Use function prototype (void) rather than old-style (). * src/checkpoint.c (expand_checkpoint_string): Likewise. * src/incremen.c (dirlist_replace_prefix, makedumpdir, read_incr_db_2): Likewise. * src/list.c (print_volume_label): Likewise. * src/misc.c (normalize_filename_x): Likewise. * src/names.c (make_name, free_name, check_name_alloc, name_next_elt): Likewise. * src/tar.c (tar_list_quoting_style, add_exclude_array): (set_stat_signal): Likewise. * src/transform.c (new_transform, _single_transform_name_to_obstack): (_transform_name_to_obstack): Likewise. * src/unlink.c (dunlink_alloc): Likewise. * src/buffer.c (struct zip_magic): Use const when appropriate. * src/incremen.c (obstack_code_rename, write_directory_file_entry): Likewise. * src/sparse.c (COPY_STRING): Likewise. * src/system.c (dec_to_env, time_to_env, oct_to_env, str_to_env): (chr_to_env): Likewise. * src/tar.c (tar_list_quoting_style, set_stat_signal): Likewise. * src/extract.c (extract_node): Don't return garbage. * src/names.c: Remove old-style declarations of getgrnam etc. All modern systems declare these, and it's not worth the hassle of ignoring the warnings on modern systems for old-style decls.
* Bugfixes.Sergey Poznyakoff2010-03-121-1/+1
| | | | | * src/buffer.c (check_label_pattern): Initialize result. * tests/remfiles01.at: Skip if run with root privileges.
* Fix `--test-label' and `--label -r' behavior.Sergey Poznyakoff2010-03-111-3/+1
| | | | | | | | | | | | | | | | | | | | * doc/tar.texi (Including a Label in the Archive): Revise the section. * NEWS: Update * src/buffer.c (open_archive): Check volume label on ACCESS_UPDATE as well. * src/list.c (test_archive_label): Rewrite to match the documentation. * src/names.c (regex_usage_warning): Return int. (names_notfound): Rewrite the conditional. (label_notfound): New function. * tests/label03.at: New testcase. * tests/label04.at: New testcase. * tests/label05.at: New testcase. * tests/Makefile.am: Add new testcases. * tests/testsuite.at: Likewise.
* Add Lzip supportAntonio Diaz Diaz2010-03-021-0/+2
| | | | | | | | | * configure.ac: Add TAR_COMPR_PROGRAM(lzip) * doc/tar.texi: Reflect lzip support. * src/buffer.c (compress_type) <ct_lzip>: New constant. (magic): Add magic for lzip. * src/suffix.c (compression_suffixes): Add lz. * src/tar.c: New option --lzip.
* BugfixSergey Poznyakoff2010-03-021-7/+7
| | | | | | * src/buffer.c (seek_archive): Rewrite size computation to prevent it from reaching negative values. Based on report by Denis Excoffier <Denis.Excoffier@free.fr>.