]> git.ipfire.org Git - thirdparty/tar.git/log
thirdparty/tar.git
7 years agoAvoid some resource leaks
Pavel Raiskup [Tue, 31 Jul 2018 09:06:09 +0000 (12:06 +0300)] 
Avoid some resource leaks

* src/incremen.c (store_rename): Free temp_name, leaked before for
each renamed directory with --listed-incremental.
* src/transform.c (add_literal_segment): Tighten arguments by
const.
(parse_transform_expr): Free 'str', leaked storage for each
--transform option before.
* src/utf8.c (utf8_convert): Deallocate buffer for failed iconv()
call so callers don't have to.

7 years agoSync wordsplit and paxutils with the most recent versions
Sergey Poznyakoff [Tue, 31 Jul 2018 08:53:00 +0000 (11:53 +0300)] 
Sync wordsplit and paxutils with the most recent versions

7 years ago* doc/tar.1: Fix font typo noted by esr.
Paul Eggert [Wed, 13 Jun 2018 22:06:43 +0000 (15:06 -0700)] 
* doc/tar.1: Fix font typo noted by esr.

7 years ago* doc/tar.1: Don't refer to nonexistent tar(5).
Paul Eggert [Wed, 16 May 2018 16:03:47 +0000 (09:03 -0700)] 
* doc/tar.1: Don't refer to nonexistent tar(5).

7 years ago--one-top-level: avoid a heap-buffer-overflow
Jim Meyering [Sat, 7 Apr 2018 15:41:46 +0000 (08:41 -0700)] 
--one-top-level: avoid a heap-buffer-overflow

* NEWS: Mention this.
* src/suffix.c (strip_compression_suffix): Fix string comparison guard.
Without this change, some ASAN-enabled test runs would fail with the
following.  Also, strip an additional .tar suffix only if the just-
stripped suffix did not match /^\.t/".

==30815==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6020000002ed at pc 0x00000049d1f4 bp 0x7ffeb5906d50 sp 0x7ffeb5906500
READ of size 1 at 0x6020000002ed thread T0
SCARINESS: 12 (1-byte-read-heap-buffer-overflow)
    #0 0x49d1f3 in __interceptor_strncmp /j/gcc/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:407
    #1 0x5670f3 in strip_compression_suffix /j/tar/src/suffix.c:107
    #2 0x575788 in decode_options /j/tar/src/tar.c:2545
    #3 0x5760c0 in main /j/tar/src/tar.c:2708
    #4 0x7f105090df29 in __libc_start_main ../csu/libc-start.c:308
    #5 0x408629 in _start (/j/tar/src/tar+0x408629)

0x6020000002ed is located 3 bytes to the left of 6-byte region [0x6020000002f0,0x6020000002f6)
allocated by thread T0 here:
    #0 0x4d0710 in __interceptor_malloc /j/gcc/libsanitizer/asan/asan_malloc_linux.cc:86
    #1 0x4908ad in __interceptor_strndup /j/gcc/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:326
    #2 0x5cbcbd in xstrndup /j/tar/gnu/xstrndup.c:32
    #3 0x5a325b in base_name /j/tar/gnu/basename.c:57
    #4 0x575772 in decode_options /j/tar/src/tar.c:2544
    #5 0x5760c0 in main /j/tar/src/tar.c:2708
    #6 0x7f105090df29 in __libc_start_main ../csu/libc-start.c:308

7 years agoTiny fix
Andrew Hounsell [Sat, 7 Apr 2018 08:07:57 +0000 (11:07 +0300)] 
Tiny fix

* doc/snapshot.texi: Fix a typo
* scripts/tar-snapshot-edit: Fix a typo

7 years agotests: avoid test failure with non-ancient autoconf
Jim Meyering [Sun, 25 Mar 2018 20:29:13 +0000 (13:29 -0700)] 
tests: avoid test failure with non-ancient autoconf

Running "make check" would fail with this:
  T-nonl.at:30: error: m4_divert_push: cannot change diversion
  to `GROW' inside m4_expand
* tests/T-nonl.at: Use printf in place of AS_ECHO_N.
These days, printf should work for everyone.

7 years agomaint: avoid -Wstringop-truncation warnings from upcoming GCC8
Jim Meyering [Mon, 19 Mar 2018 04:32:19 +0000 (21:32 -0700)] 
maint: avoid -Wstringop-truncation warnings from upcoming GCC8

* src/create.c (start_private_header, start_header): Convert
trivial uses of strncpy to memcpy, to avoid warnings like this:
In function 'strncpy',
    inlined from 'start_private_header' at create.c:522:3:
/usr/include/bits/string_fortified.h:106:10: warning: \
  '__builtin_strncpy' output truncated before terminating nul \
  copying 2 bytes from a string of the same length \
  [-Wstringop-truncation]

7 years agomaint: avoid -Wstringop-truncation warnings upcoming GCC8
Jim Meyering [Mon, 19 Mar 2018 04:20:28 +0000 (21:20 -0700)] 
maint: avoid -Wstringop-truncation warnings upcoming GCC8

* 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]

7 years agomaint: avoid warnings from upcoming GCC8
Jim Meyering [Mon, 19 Mar 2018 00:59:25 +0000 (17:59 -0700)] 
maint: avoid warnings from upcoming GCC8

* src/transform.c (_single_transform_name_to_obstack): Mark with
FALLTHROUGH statement rather than /* FALL THROUGH */ comment.
Only the former works with gcc-8.
* src/extract.c (maybe_recoverable): Call abort to tell gcc-8 that
this code is unreachable.

7 years agoRewrite struct tm formatting
Sergey Poznyakoff [Sat, 7 Apr 2018 07:33:27 +0000 (10:33 +0300)] 
Rewrite struct tm formatting

* src/list.c (tartime): Use strftime instead of manually formatting
fields of the struct tm. This should also suppress some gcc warnings.

7 years agotests: add coverage for new --zstd and all other compression tools
Jim Meyering [Mon, 26 Mar 2018 04:17:18 +0000 (21:17 -0700)] 
tests: add coverage for new --zstd and all other compression tools

* tests/compress.at.in: New file: template from which each
per-compression-tool test is derived.
* tests/Makefile.am (TESTSUITE_AT): Add it.
(EXTRA_DIST): Add compress.at.in.
(compress-*.at): New rules to generate a file/tests for each compression tool.
* tests/testsuite.at (Compression): Add each of these generated
files in a new section.
* tests/.gitignore: Ignore the new generated files.

7 years agoFix typo
Aaron Schrab [Sun, 18 Mar 2018 10:06:36 +0000 (12:06 +0200)] 
Fix typo

7 years agoVersion 1.30.90
Sergey Poznyakoff [Sun, 18 Mar 2018 08:38:16 +0000 (10:38 +0200)] 
Version 1.30.90

* NEWS: Update.
* configure.ac: Update.
* THANKS: Add Adam Borowski.

7 years agoAdd support for zstd compression
Adam Borowski [Sun, 18 Mar 2018 08:24:13 +0000 (10:24 +0200)] 
Add support for zstd compression

* 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.

7 years agotests: fix race in dirrem01 and dirrem02
Pavel Raiskup [Thu, 4 Jan 2018 17:55:12 +0000 (18:55 +0100)] 
tests: fix race in dirrem01 and dirrem02

Previously the '--checkpoint-action=echo' was triggered after
'--checkpoint-action=sleep=1' - so the order of events *usually*
was (for --format='gnu'):

  ...
  1. checkpoint handler before write of 'dir/sub' member
  2. one-second delay
  3. stderr write: 'tar: Write checkpoint 3'
  4. write the member 'dir/sub' into the archive
  5. check that the member's ctime has not been changed
  6. genfile's detecting 'Write checkpoint', doing unlink
  ...

But sometimes, the genfile was fast enough to win the race and
unlinked the directory before the member was written into the
archive (IOW, the order was 1-2-3-6-4-5).  This led to the
occasional warning 'tar: dir/sub: file changed as we read it'.

Swap the order of 'sleep=1' and 'echo' actions so the genfile
utility has (hopefully) enough time to do the unlink before
writing the file into the archive (enforce 1-2-3-6-4-5 order).

* tests/dirrem01.at: Swap 'sleep=1' and 'echo' actions.
* tests/dirrem02.at: Likewise.

7 years agoFix typos in the docs
Sergey Poznyakoff [Tue, 13 Mar 2018 20:20:53 +0000 (22:20 +0200)] 
Fix typos in the docs

7 years agoProvide a way to skip tests that create very large files
Sergey Poznyakoff [Tue, 13 Mar 2018 19:55:37 +0000 (21:55 +0200)] 
Provide a way to skip tests that create very large files

Define environment variable TARTEST_SKIP_LARGE_FILES=1 in order
to skip tests that require lots of disk space.

* tests/testsuite.at (AT_SKIP_LARGE_FILES): New macro.
* tests/sparse03.at: Mark test with AT_SKIP_LARGE_FILES.
* tests/sparse05.at: Likewise.
* tests/star/pax-big-10g.at: Likewise.
* tests/star/ustar-big-2g.at: Likewise.
* tests/star/ustar-big-8g.at: Likewise.

7 years agoTestsuite bugfix
Sergey Poznyakoff [Tue, 13 Mar 2018 07:59:11 +0000 (09:59 +0200)] 
Testsuite bugfix

* tests/difflink.at: Define order of files within tested archive.

7 years agotestsuite: account for absolute file names starting with double slash
Sergey Poznyakoff [Tue, 13 Mar 2018 06:08:44 +0000 (08:08 +0200)] 
testsuite: account for absolute file names starting with double slash

* tests/incr08.at: Absolute file names can start with //
* tests/xform03.at: Likewise.

7 years agoVersion 1.30 release_1_30
Sergey Poznyakoff [Sun, 17 Dec 2017 10:28:30 +0000 (12:28 +0200)] 
Version 1.30

* configure.ac: Set version 1.30
* NEWS: Update.

7 years agoFix "concatenating" typo.
Paul Eggert [Mon, 20 Nov 2017 19:09:48 +0000 (11:09 -0800)] 
Fix "concatenating" typo.

Problem reported by Rodrigo Queiro in:
https://lists.gnu.org/r/bug-tar/2017-11/msg00021.html
* doc/intern.texi (Extensions): Fix typo.

7 years agoPort to gcc -Wimplicit-fallthrough=5
Paul Eggert [Sat, 18 Nov 2017 16:39:33 +0000 (08:39 -0800)] 
Port to gcc -Wimplicit-fallthrough=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

7 years agoPort to Texinfo 6.4
Paul Eggert [Sat, 18 Nov 2017 16:39:33 +0000 (08:39 -0800)] 
Port to Texinfo 6.4

* doc/tar.texi (Sparse Recovery): Omit ‘.’ from anchor name,
as ‘makeinfo’ now complains about it.  All uses changed.

7 years agoDocument base-256 representation in GNU format
Paul Eggert [Sat, 18 Nov 2017 16:39:33 +0000 (08:39 -0800)] 
Document base-256 representation in GNU format

Problem reported by Rodrigo Queiro in:
https://lists.gnu.org/r/bug-tar/2017-11/msg00018.html
* doc/intern.texi (Standard, Extensions):
Document base-256 representations.

7 years agobuild: update gnulib submodule to latest
Paul Eggert [Sat, 18 Nov 2017 16:39:33 +0000 (08:39 -0800)] 
build: update gnulib submodule to latest

7 years agoFix typo caught by GCC 7.2.1
Paul Eggert [Sat, 18 Nov 2017 16:39:33 +0000 (08:39 -0800)] 
Fix typo caught by GCC 7.2.1

* lib/wordsplit.c (wordsplit_perror): Add missing "break;".

7 years agoUpdate docs
Sergey Poznyakoff [Thu, 16 Nov 2017 16:12:36 +0000 (18:12 +0200)] 
Update docs

* doc/Makefile.am: Add recipes.texi
* doc/recipes.texi: New file.
* doc/tar.texi: New appendix "Recipes"

7 years agotests: more deterministic xattr07
Pavel Raiskup [Mon, 28 Nov 2016 08:01:03 +0000 (09:01 +0100)] 
tests: more deterministic xattr07

* tests/xattr07.at: Define order of files within tested archive.

7 years agoMinor improvements in the docs.
Sergey Poznyakoff [Thu, 16 Nov 2017 12:31:53 +0000 (14:31 +0200)] 
Minor improvements in the docs.

7 years agoNew option --warning=failed-read
Sergey Poznyakoff [Thu, 16 Nov 2017 11:55:15 +0000 (13:55 +0200)] 
New option --warning=failed-read

* NEWS: Document the --warning=failed-read option.
* doc/tar.texi: Likewise.
* doc/tar.1: Likewise.
* src/common.h (WARN_FAILED_READ): New constant.
(WARNING_ENABLED): New macro.
* src/misc.c (close_diag, open_diag)
(read_diag_details, readlink_diag)
(savedir_diag, seek_diag_details)
(stat_diag): Suppress warnings if WARN_FAILED_READ is set.
* src/warning.c (failed-read): New keyword.

7 years agoFix docs
Sergey Poznyakoff [Thu, 16 Nov 2017 09:56:19 +0000 (11:56 +0200)] 
Fix docs

* doc/tar.texi: Fix description of the argument to --xattrs-exclude
and --xattrs-include option. It is a globbing pattern, not a regex.

Fix a typo (LZOP)

7 years agoFix the --delay-directory-restore option
Sergey Poznyakoff [Thu, 16 Nov 2017 09:26:44 +0000 (11:26 +0200)] 
Fix the --delay-directory-restore option

* src/extract.c (find_direct_ancestor): New function.
(create_placeholder_file): Set after_links member on delayed_set_stat
entries starting from the direct ancestor of the placeholder file.

* tests/extrac21.at: New testcase.
* tests/testsuite.at: Add extrac21
* tests/Makefile.am: Likewise.

* NEWS: Update.

7 years agoFix reporting of hardlink mismatch during compare
Sergey Poznyakoff [Thu, 9 Nov 2017 07:55:43 +0000 (09:55 +0200)] 
Fix reporting of hardlink mismatch during compare

* src/common.h (quote_n_colon): New prototype.
* src/misc.c (quote_n_colon): New function.
* src/compare.c (report_difference, diff_link): Use quote_n_colon.

* tests/difflink.at: New file.
* tests/Makefile.am: Add difflink.at
* tests/testsuite.at: Likewise.

7 years agoFix --verbatim-files-from
Sergey Poznyakoff [Thu, 9 Nov 2017 06:59:36 +0000 (08:59 +0200)] 
Fix --verbatim-files-from

* src/names.c (read_next_name): Don't unquote name read from the
file, if --verbatim-files-from option is in effect.
(names_options): improve description of --verbatim-files-from
* tests/T-null2.at: Test the change.

7 years agoFix typo
Sergey Poznyakoff [Thu, 9 Nov 2017 06:35:34 +0000 (08:35 +0200)] 
Fix typo

* doc/tar.texi

8 years agoFix the effect of --transform over hard link targets without the --absolute-names
Sergey Poznyakoff [Sat, 30 Sep 2017 07:04:02 +0000 (10:04 +0300)] 
Fix the effect of --transform over hard link targets without the --absolute-names

* src/create.c (file_count_links): Apply safer_name_suffix to the
hard link name prior to transforming it.
* tests/xform03.at: New test case.
* tests/Makefile.am: Add xform03.at
* tests/testsuite.at: Likewise.

8 years agoBugfix
Sergey Poznyakoff [Thu, 24 Aug 2017 19:18:39 +0000 (22:18 +0300)] 
Bugfix

* src/tar.c (tar_help_filter): Add missing break statement

8 years agoFix typo
Troels Thomsen [Thu, 29 Jun 2017 10:50:09 +0000 (12:50 +0200)] 
Fix typo

8 years agoFix non-deterministic archive type detection
Pavel Raiskup [Thu, 30 Mar 2017 11:30:15 +0000 (13:30 +0200)] 
Fix non-deterministic archive type detection

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.

8 years agoFix handling of directories removed during incremental tar run
Jonas Julino [Mon, 10 Apr 2017 14:37:39 +0000 (16:37 +0200)] 
Fix handling of directories removed during incremental tar run

Co-authored-by: Sergey Poznyakoff <gray@gnu.org.ua>
* paxutils: Upgrade
* src/create.c (create_archive): Use file_removed_diag
instead of calling the corresponding *_diag function
directly.
* tests/dirrem01.at: New testcase.
* tests/dirrem02.at: New testcase.
* tests/Makefile.am: Add new tests.
* tests/testsuite.at: Likewise.

8 years agoFix a bug in multi-volume archive creation.
Sergey Poznyakoff [Mon, 29 May 2017 08:31:12 +0000 (11:31 +0300)] 
Fix a bug in multi-volume archive creation.

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.

8 years ago--numeric-owner now affects private headers too
Paul Eggert [Fri, 7 Apr 2017 01:16:51 +0000 (18:16 -0700)] 
--numeric-owner now affects private headers too

Problem reported by Daniel Peebles in:
http://lists.gnu.org/archive/html/bug-tar/2017-04/msg00004.html
* NEWS: Document this.
* src/create.c (write_gnu_long_link): If --numeric-owner,
leave the user and group empty in a private header.  Cache the
names for 0.

8 years agoTest and document --keep-directory-symlink
Pavel Raiskup [Tue, 28 Feb 2017 08:55:09 +0000 (09:55 +0100)] 
Test and document --keep-directory-symlink

* doc/tar.1: Document the option.
* tests/extrac20.at: New testcase.
* tests/Makefile.am: Mention extrac20.
* tests/testsuite.at: Likewise.

8 years agoFix incompatibility with PGI 16.10
Paul Eggert [Tue, 14 Feb 2017 16:55:05 +0000 (08:55 -0800)] 
Fix incompatibility with PGI 16.10

* src/tar.c (options): Fix incompatibility with the C standard,
which says that arguments to macro calls cannot contain # directives.

8 years agoUpdate copyright years
Sergey Poznyakoff [Mon, 2 Jan 2017 12:49:55 +0000 (14:49 +0200)] 
Update copyright years

8 years agoFix description of the "escape" quoting style
Sergey Poznyakoff [Sat, 12 Nov 2016 10:49:10 +0000 (12:49 +0200)] 
Fix description of the "escape" quoting style

8 years agoBetter error checking in the backup script.
Sergey Poznyakoff [Sat, 12 Nov 2016 10:31:24 +0000 (12:31 +0200)] 
Better error checking in the backup script.

* scripts/backup.in: Check exit code of MT_BEGIN
* scripts/backup.sh.in (backup_host): Return meaningful code
in case of remote execution.  See the comment, though.

8 years agoMinor documentation fix
Sergey Poznyakoff [Sat, 12 Nov 2016 09:46:43 +0000 (11:46 +0200)] 
Minor documentation fix

* doc/tar.texi: Fix example about use of --no-recursion with -T

8 years agoFix the --add-file option.
Sergey Poznyakoff [Sat, 12 Nov 2016 09:20:47 +0000 (11:20 +0200)] 
Fix the --add-file option.

* src/common.h (name_more_files): New proto.
(files_from_option): Remove.
* src/names.c (name_more_files): New file.
(names_options): Fix declaration of the
add-file option.
(names_parse_opt): Handle --add-file.
* src/tar.c (struct tar_args): Remove the input_files member.
Change all uses: use name_more_files() instead.
* tests/Makefile.am: Add new test.
* tests/add-file.at: New testcase.
* tests/testsuite.at: Add new test.

8 years agoAdd missing files
Sergey Poznyakoff [Fri, 11 Nov 2016 11:29:55 +0000 (13:29 +0200)] 
Add missing files

8 years agodon't set xattrs when --skip-old-files is used
Pavel Raiskup [Fri, 11 Nov 2016 10:30:35 +0000 (12:30 +0200)] 
don't set xattrs when --skip-old-files is used

* src/extract.c (set_xattr): Properly handle maybe_recoverable()
output.  Throw warnings to not complicate caller.
(extract_file): Don't handle set_xattr's error.
* tests/xattr07.at: New testcase.
* tests/Makefile.am: Mention new testcase.
* tests/testsuite.at: Likewise.
* THANKS: Dawid.

8 years agoMinor fix
Sergey Poznyakoff [Fri, 11 Nov 2016 10:16:59 +0000 (12:16 +0200)] 
Minor fix

* src/tar.h (tar_stat_info): Change type of real_size_set to bool

8 years agosparse: fix pax extraction for unicode filenames
Pavel Raiskup [Thu, 30 Jun 2016 14:17:29 +0000 (16:17 +0200)] 
sparse: fix pax extraction for unicode filenames

Make sure that 'GNU.sparse.name' header has higher priority than
(for sparse-purposes artificially modified) 'path' pax header.

Historically, the 'GNU.sparse.name' header comes before 'path';
this caused that modified 'path' header won and that is not what
we want in sparse "capable" tar implementation.

* src/tar.h (tar_stat_info): New argument sparse_name_done.
* src/xheader.c (raw_path_decoder): Move here the unconditional
code from path_decoder.
(path_decoder): Apply raw_path_decoder only if sparse_path_decoder
was not yet called.
(sparse_path_decoder): New wrapper around raw_path_decoder.
* tests/sparse07.at: New testcase.
* tests/testsuite.at: Mention new testcase.
* tests/Makefile.am: Likewise.

8 years ago* tests/xattr06.at: Test include/exclude during archive/exctract.
Pavel Raiskup [Thu, 2 Jun 2016 06:00:10 +0000 (08:00 +0200)] 
* tests/xattr06.at: Test include/exclude during archive/exctract.

8 years agoBugfix - fix xattr exclude/include for archive create
Ian McLeod [Mon, 30 May 2016 22:11:35 +0000 (17:11 -0500)] 
Bugfix - fix xattr exclude/include for archive create

This makes archive create behavior consistent with the
documentation.  Without this change xattr include/exclude options
are accepted when creating an archive but are silently ignored.

* src/xattrs.c (xattrs_xattrs_get): Apply exclude/include mask
when fetching extended attributes
* tests/Makefile.am: Add new test case.
* tests/testsuite.at: Likewise.

8 years agoWhen extracting, skip ".." members
Paul Eggert [Sun, 30 Oct 2016 04:04:40 +0000 (21:04 -0700)] 
When extracting, skip ".." members

* NEWS: Document this.
* src/extract.c (extract_archive): Skip members whose names
contain "..".

9 years agoMark all tests related to -C option with the "chdir" keyword
Sergey Poznyakoff [Mon, 26 Sep 2016 11:00:12 +0000 (14:00 +0300)] 
Mark all tests related to -C option with the "chdir" keyword

9 years agoFix interaction of -u with -C
Sergey Poznyakoff [Mon, 26 Sep 2016 10:17:26 +0000 (13:17 +0300)] 
Fix interaction of -u with -C

* src/update.c (update_archive): Pass correct change_dir
value for addname
* tests/update03.at: New file.
* tests/Makefile.am: Add update03.at
* tests/testsuite.at: Include update03.at

9 years agoFix passing string values via TAR_OPTIONS
Sergey Poznyakoff [Wed, 21 Sep 2016 05:54:53 +0000 (08:54 +0300)] 
Fix passing string values via TAR_OPTIONS

* src/tar.c (parse_default_options): Don't free parsed words.
* tests/options03.at: New testcase.
* tests/Makefile.am: Add options03.at
* tests/testsuite.at: Include options03.at

9 years agoTiny bugfix
Sergey Poznyakoff [Fri, 27 May 2016 22:05:07 +0000 (01:05 +0300)] 
Tiny bugfix

9 years agoReport positional options that were used but had no effect during archive creation
Sergey Poznyakoff [Fri, 27 May 2016 07:39:49 +0000 (10:39 +0300)] 
Report positional options that were used but had no effect during archive creation

* src/names.c (file_selection_option)
(file_selection_option_name): New functions.
(unconsumed_option_push, unconsumed_option_free)
(unconsumed_option_report): New functions.
(name_list_advance): Maintain a list
of eventually unconsumed options during archive creation.
Report unconsumed options, if any.

* tests/positional01.at: New test case.
* tests/positional02.at: New test case.
* tests/positional03.at: New test case.
* tests/Makefile.am: Add new test cases.
* tests/testsuite.at: Likewise.

* NEWS: Document the changes.
* configure.ac: Version 1.29.90
* doc/tar.texi: Document the changes.

9 years agoVersion 1.29 release_1_29
Sergey Poznyakoff [Mon, 16 May 2016 06:57:39 +0000 (09:57 +0300)] 
Version 1.29

9 years agoMinor fix
Sergey Poznyakoff [Mon, 16 May 2016 08:50:19 +0000 (11:50 +0300)] 
Minor fix

* src/names.c (new_name): rename to make_file_name. All uses changed.

9 years agoFix argument handling when running external commands.
Sergey Poznyakoff [Thu, 14 Apr 2016 08:51:38 +0000 (11:51 +0300)] 
Fix argument handling when running external commands.

* src/system.c (xexec): Use sh -c to run the command.  This fixed
bug introduced by 7b5e80396 (tar 1.27)
* doc/tar.texi: Fix checkpoint examples: (1) $TAR_FILENAME
is not available when creating archive and (2) --checkpoint
can't be used as abbreviation of --checkpoint-action

9 years agoRemove iotty test
Sergey Poznyakoff [Wed, 6 Apr 2016 05:34:55 +0000 (08:34 +0300)] 
Remove iotty test

The auxiliary utility ttyemu proved to be unreliable.  Given existing
differences between pty implementations and termios ioctls on various
platforms, writing it in a portable way requires effort disproportional
to its actual purpose.

* configure.ac: Remove check for grantpt
* gnulib.modules: Remove posix_openpt, ptsname, and unlockpt
* tests/Makefile.am (TESTSUITE_AT): Remove iotty.at
(check_PROGRAMS): Remove ttyemu.
* tests/testsuite.at: Remove iotty.at
* tests/iotty.at: Remove.
* tests/ttyemu.c: Remove.

9 years agoxattrs: fix build on Darwin
Pavel Raiskup [Tue, 5 Apr 2016 14:53:47 +0000 (17:53 +0300)] 
xattrs: fix build on Darwin

Be careful to define HAVE_XATTRS when not all needed xattr-related
functions are properly defined either in libc or libattr.

Reported independently by Denis Excoffier and Dominyk Tille.

* acinclude.m4 (TAR_HEADERS_ATTR_XATTR_H): Check for each xattr
function separately.  Don't AC_CHECK_LIB (LIBS is filled by
AC_SEARCH_LIBS when necessary).
* src/Makefile.am: The LDADD -lattr was redundant.

9 years agoRemove --preserve option
Sergey Poznyakoff [Thu, 24 Mar 2016 06:39:52 +0000 (08:39 +0200)] 
Remove --preserve option

* src/tar.c: Remove --preserve option
* NEWS: Update.
* doc/tar.texi: Update.

9 years agoFix testcase
Sergey Poznyakoff [Thu, 24 Mar 2016 06:38:38 +0000 (08:38 +0200)] 
Fix testcase

* tests/time02.at: Sort tar -d output

9 years agoUpdate THANKS file
Sergey Poznyakoff [Thu, 24 Mar 2016 05:30:16 +0000 (07:30 +0200)] 
Update THANKS file

9 years agoNew option --clamp-mtime
Jeremy Bobbio [Thu, 24 Mar 2016 05:11:28 +0000 (07:11 +0200)] 
New option --clamp-mtime

The new `--clamp-mtime` option will change the behavior of `--mtime` to only
use the time specified if the file mtime is newer than the given time.
The `--clamp-mtime` option can only be used together with `--mtime`.

Typical use case is to make builds reproducible: to loose less
information, it's better to keep the original date of an archive, except for
files modified during the build process. In that case, using a reference
(and thus reproducible) timestamps for the latter is good enough. See
<https://wiki.debian.org/ReproducibleBuilds> for more information.

Patch submitted by Jeremy Bobbio and
Daniel Kahn Gillmor <dkg@fifthhorseman.net>

* doc/tar.1: Document --clamp-mtime
* doc/tar.texi: Likewise.

* src/common.h (set_mtime_option_mode): New enum
(set_mtime_option): Change type to enum set_mtime_option_mode.
(NEWER_OPTION_INITIALIZED): Rename to NEWER_OPTION_INITIALIZED.
* src/create.c (start_header): Set mtime depending on set_mtime_option.
* src/tar.c (options,parse_opt): New option --clamp-mtime
(decode_options): Initialize mtime_option

* tests/time02.at: New testcase.
* tests/Makefile.am: Add new testcase
* tests/testsuite.at: Likewise.

9 years agoAcknowledgments
Sergey Poznyakoff [Mon, 21 Mar 2016 18:46:19 +0000 (20:46 +0200)] 
Acknowledgments

* THANKS: Add Dagobert Michelsen

9 years agoFix the testsuite
Sergey Poznyakoff [Mon, 21 Mar 2016 18:33:26 +0000 (20:33 +0200)] 
Fix the testsuite

* tests/sparse06.at: Don't use timeout: depending on the filesystem
mounted, current LA and lots of other factors, creation of archive can
take much more time than the expected 2 seconds.

9 years agoFix ckmtime
Sergey Poznyakoff [Mon, 21 Mar 2016 11:35:32 +0000 (13:35 +0200)] 
Fix ckmtime

* gnulib.modules: Use timespec-sub
* tests/ckmtime.c: Use second resolution.

9 years agoFix the testsuite
Sergey Poznyakoff [Sat, 19 Mar 2016 20:32:34 +0000 (22:32 +0200)] 
Fix the testsuite

* tests/sparse05.at: Use autom4te magic to generate mapfile,
instead of the shell command seq, which is not always available.
* tests/listed03.at: Skip the test if xgetcwd fails.
* tests/ckmtime.c: New file.
* tests/Makefile.am: Build ckmtime
* tests/testsuite.at (AT_CHECK_TIMESTAMP): Check whether newly created
files have timestamps consistent with the creation time.  Skip the test
if not.
* tests/incr01.at: Use AT_CHECK_TIMESTAMP
* tests/incr02.at: Likewise.
* tests/incr03.at: Likewise.
* tests/incr04.at: Likewise.
* tests/incr05.at: Likewise.
* tests/incr06.at: Likewise.
* tests/incr07.at: Likewise.
* tests/incr08.at: Likewise.
* tests/incr09.at: Likewise.
* tests/incr10.at: Likewise.
* tests/incr11.at: Likewise.
* tests/incremental.at: Likewise.
* tests/listed01.at: Likewise.
* tests/listed02.at: Likewise.
* tests/listed04.at: Likewise.
* tests/listed05.at: Likewise.

9 years agoTestsuite fixes.
Sergey Poznyakoff [Fri, 18 Mar 2016 20:18:58 +0000 (22:18 +0200)] 
Testsuite fixes.

* paxutils: Update.
* src/unlink.c (flush_deferred_unlinks): OpenSolaris sets EEXIST
instead of ENOTEMPTY if trying to remove a non-empty directory.
* tests/numeric.at: Avoid using awk -v: some older awks don't support
that option.  Also fix environment variable usage.
* tests/onetop05.at: Skip test if unable to set initial directory
mode bits.
* tests/sparse06.at: Use --quiet option.

9 years agoRevise docs
Sergey Poznyakoff [Fri, 18 Mar 2016 12:27:27 +0000 (14:27 +0200)] 
Revise docs

9 years agoFix build with --enable-gcc-warnings
Sergey Poznyakoff [Fri, 18 Mar 2016 11:08:39 +0000 (13:08 +0200)] 
Fix build with --enable-gcc-warnings

* configure.ac: Disable stack-protector warnings

9 years agoImprove testsuite
Sergey Poznyakoff [Thu, 17 Mar 2016 12:22:35 +0000 (14:22 +0200)] 
Improve testsuite

* tests/iotty.at: Skip test if ttyemu can't do its job

9 years agoDocument xattrs, ACL and SELinux-related options.
Sergey Poznyakoff [Wed, 16 Mar 2016 18:08:00 +0000 (20:08 +0200)] 
Document xattrs, ACL and SELinux-related options.

* doc/tar.1: Document all options.
* doc/tar.texi: Likewise.

9 years agoFix appending to archive with changed blocking factor.
Sergey Poznyakoff [Mon, 14 Mar 2016 22:02:40 +0000 (00:02 +0200)] 
Fix appending to archive with changed blocking factor.

* 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.

9 years agoFix coredump on parsing invalid traditional option
Sergey Poznyakoff [Mon, 14 Mar 2016 11:13:04 +0000 (13:13 +0200)] 
Fix coredump on parsing invalid traditional option

* src/tar.c (find_argp_option): Fix loop termination condition.

9 years agoUpdate copyright years
Sergey Poznyakoff [Wed, 20 Jan 2016 09:29:17 +0000 (11:29 +0200)] 
Update copyright years

9 years agoAllow escaped delimiters in transform expressions.
Sergey Poznyakoff [Wed, 20 Jan 2016 09:16:02 +0000 (11:16 +0200)] 
Allow escaped delimiters in transform expressions.

Patch provided by Charles McGarvey and Flavio Poletti.

* src/transform.c (parse_transform_expr): Allow escaped delimiters
in transform expressions.
* tests/xform02.at: New test case.
* tests/Makefile.am: Add xform02.at
* tests/testsuite.at: Include xform02.at
* THANKS: Update.

9 years agoFix eventual dereference of uninitialized pointer.
Sergey Poznyakoff [Thu, 17 Dec 2015 14:04:40 +0000 (16:04 +0200)] 
Fix eventual dereference of uninitialized pointer.

* src/exclist.c (hg_initfn): Initialize hgopt.

9 years agosparse: fix use of indeterminate value
Pavel Raiskup [Thu, 17 Dec 2015 14:01:18 +0000 (16:01 +0200)] 
sparse: fix use of indeterminate value

* src/xheader.c (sparse_map_decoder): Move 'e' up from loop-block.

9 years agofix a typo
Sergey Poznyakoff [Fri, 11 Dec 2015 13:21:04 +0000 (15:21 +0200)] 
fix a typo

* doc/tar.texi (Incremental Dumps): Add missing --file to the
'--list' example.

9 years agoMinor fixes.
Sergey Poznyakoff [Fri, 11 Dec 2015 12:19:44 +0000 (14:19 +0200)] 
Minor fixes.

* doc/tar.texi: Document position-sensitive options in a
separate subsection.
* src/names.c (names_argp,names_argp_children): Explicitly initialize
all members.

9 years agoMinor fix
Sergey Poznyakoff [Thu, 10 Dec 2015 23:10:43 +0000 (01:10 +0200)] 
Minor fix

9 years agoFix handling of filename-selection options.
Sergey Poznyakoff [Thu, 10 Dec 2015 22:37:17 +0000 (00:37 +0200)] 
Fix handling of filename-selection options.

Filename-selection options are --wildcards, --recursive, etc. (see
names.c for a complete list).  These options are position-sensitive,
i.e. each such option affects all filenames and filename-selection
options that appear after it until eventually cancelled by a
corresponding counterpart option.

These options can appear in "file-from" file lists, which means that
they cannot be handled right away, but instead should be put on
the "name_elt" list and processed sequentionally, as file name arguments
are.

* src/common.h (warn_regex_usage): Remove.
(name_add_name): Change signature.
(name_add_dir, name_add_file): Remove prototypes.
* src/names.c (name_add_option, name_add_dir)
(name_add_file): Static functions.
(names_options, is_file_selection_option, names_parse_opt): Static functions.
(names_argp_children): New variable.
(NELT_NAME, NELT_CHDIR)
(NELT_FILE, NELT_NOOP): Redefine as enum nelt_type.
(NELT_FMASK): Remove.
(NELT_OPTION): New constant.
(name_elt) <type>: Change type.
<v.opt>: New member.
(name_elt_alloc_matflags): Remove.
(name_add_name): Take one argument.
(name_add_option): New static function.
(name_add_file): Take one argument.
(read_next_name): Use filename_terminator and
verbatim_files_from_option to initialize file.term and file.verbatim.
* src/tar.c: Move handling of filename-selection options to names.c

* tests/T-dir00.at: Fix typo.
* tests/T-recurse.at: Remove expected failure.

9 years agobetter test --{,no-}recursion options
Pavel Raiskup [Thu, 10 Dec 2015 12:55:34 +0000 (14:55 +0200)] 
better test --{,no-}recursion options

* tests/recurs02.at: Also test --list mode.
* tests/T-recurse.at: New test case.  Test that -T option works
correctly together with --{,no-}recursion.
* tests/Makefile.am: Mention new test T-recurse.at.
* tests/testsuite.at: Likewise.

9 years agoBugfix
Pavel Raiskup [Sun, 6 Dec 2015 20:12:20 +0000 (22:12 +0200)] 
Bugfix

* src/buffer.c (try_new_volume): Warn if user supplied malformed
tar archive.
Consistently use WARN (instead of ERROR) when reporting.

9 years agoFix segfault when extracting from a multi-volume archive.
Sergey Poznyakoff [Sun, 6 Dec 2015 20:02:16 +0000 (22:02 +0200)] 
Fix segfault when extracting from a multi-volume archive.

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.

9 years agoFix NEWS
Sergey Poznyakoff [Sun, 6 Dec 2015 19:20:48 +0000 (21:20 +0200)] 
Fix NEWS

9 years agonumeric-owner: print big UID/GID correctly
Pavel Raiskup [Sun, 6 Dec 2015 19:18:51 +0000 (21:18 +0200)] 
numeric-owner: print big UID/GID correctly

* src/list.c (simple_print_header): Do not parse ustar header
for UID/GID again (tar_stat_info has already been correctly
filled with respect to possible uid/gid extended headers).
* tests/numeric.at: New testcase for --numeric-owner option.
* tests/Makefile.am: Add new testcase.
* tests/testsuite.at: Likewise.

9 years agoUse SEEK_HOLE for hole detection
Sergey Poznyakoff [Sat, 5 Dec 2015 21:36:22 +0000 (23:36 +0200)] 
Use SEEK_HOLE for hole detection

Based on patch by Pavel Raiskup.

Use SEEK_HOLE/SEEK_DATA feature of lseek on systems that support
it.  This can make archiving of sparse files much faster.

Implement the --hole-detection option to allow users to select
hole-detection method.

* src/common.h (hole_detection_method): New enum.
(hole_detection): New global.
* src/sparse.c  (sparse_scan_file_wholesparse): New function as a
method for detecting sparse files without any data.
(sparse_scan_file_raw): Rename from sparse_scan_file; with edits.
(sparse_scan_file_seek): New function.
(sparse_scan_file): Reimplement function.
* src/tar.c: New option --hole-detection

* tests/checkseekhole.c: New file.
* tests/.gitignore: Mention two test binaries.
* tests/Makefile.am: Add new tests.
* tests/testsuite.at (AT_SEEKHOLE_PREREQ): New macro.
Include sparse06.at.
* tests/sparse06.at: New test case.
* tests/sparse02.at: Force raw hole-detection method.
* tests/sparsemv.at: Likewise.
* tests/sparsemvp.at: Likewise.

* doc/tar.1: Document --hole-detection option.
* doc/tar.texi: Document hole-detection algorithms and
command-line options.
* NEWS: Document hole-detection.

9 years agoCatch compressor execution errors.
Sergey Poznyakoff [Sat, 5 Dec 2015 14:54:26 +0000 (16:54 +0200)] 
Catch compressor execution errors.

* 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

9 years agoUpgrade paxutils
Sergey Poznyakoff [Sat, 5 Dec 2015 06:48:03 +0000 (08:48 +0200)] 
Upgrade paxutils

9 years agoFix extraction from concatenated incremental archives with renamed directories.
Sergey Poznyakoff [Sun, 29 Nov 2015 18:51:08 +0000 (20:51 +0200)] 
Fix extraction from concatenated incremental archives with renamed directories.

Complements 15c02c2b.

* src/extract.c (delayed_set_stat): Change type of file_name.
(delay_set_stat): Allocate file_name member.
(free_delayed_set_stat): Free file_name.
(fixup_delayed_set_stat): New function.
(rename_directory): Call fixup_delayed_set_stat on success.

* tests/incr11.at: New testcase.
* tests/incr10.at: Improve description.
* tests/Makefile.am: Add incr11.at
* tests/testsuite.at: Add incr11.at

9 years agoFix bug in the inplementation of --one-top-level.
Sergey Poznyakoff [Sat, 21 Nov 2015 19:56:49 +0000 (21:56 +0200)] 
Fix bug in the inplementation of --one-top-level.

When extracting an archive that contains './' with the --one-top-level option,
the mode and ownership of '.' would be incorrectly applied to the current
working directory, instead of the requested top-level directory.

* src/list.c (enforce_one_top_level): Map '.' to the top-level
directory.
* tests/Makefile.am: Add onetop05.at
* tests/testsuite.at: Include onetop05.at.
* tests/onetop05.at: New file.
* tests/onetop01.at: Fix keywords.
* tests/onetop02.at: Likewise.
* tests/onetop03.at: Likewise.
* tests/onetop04.at: Likewise.