]> git.ipfire.org Git - thirdparty/tar.git/log
thirdparty/tar.git
3 years agoFormat ` and ' more nicely in doc
Paul Eggert [Mon, 13 Dec 2021 23:44:26 +0000 (15:44 -0800)] 
Format ` and ' more nicely in doc

Use @documentencoding and set txicodequoteundirected and
txicodequotebacktick to get nicer-looking quoting in the manual.

3 years agoDon’t recommend delete=mtime
Paul Eggert [Mon, 13 Dec 2021 23:27:52 +0000 (15:27 -0800)] 
Don’t recommend delete=mtime

That stops working after the year 2242.

3 years agoMore reproducible tarball doc
Paul Eggert [Mon, 13 Dec 2021 20:42:11 +0000 (12:42 -0800)] 
More reproducible tarball doc

* doc/tar.texi (PAX keywords): Improve discussion of how
to generate reproducible tarballs.

3 years agoRaise version number
Sergey Poznyakoff [Mon, 13 Dec 2021 14:14:26 +0000 (16:14 +0200)] 
Raise version number

3 years ago.gitignore maintenance (some automated)
Paul Eggert [Mon, 13 Dec 2021 08:44:01 +0000 (00:44 -0800)] 
.gitignore maintenance (some automated)

3 years agobootstrap: copy from Gnulib
Paul Eggert [Mon, 13 Dec 2021 07:34:06 +0000 (23:34 -0800)] 
bootstrap: copy from Gnulib

3 years agobuild: update gnulib and paxutils submodules to latest
Paul Eggert [Mon, 13 Dec 2021 00:04:39 +0000 (16:04 -0800)] 
build: update gnulib and paxutils submodules to latest

3 years agoAdd NEWS items for changes since 1.34
Paul Eggert [Sun, 12 Dec 2021 21:03:36 +0000 (13:03 -0800)] 
Add NEWS items for changes since 1.34

3 years agoOmit unnecessary devmajor and devminor setting
Paul Eggert [Sun, 12 Dec 2021 23:30:49 +0000 (15:30 -0800)] 
Omit unnecessary devmajor and devminor setting

* src/create.c (dump_file0): Omit redundant setting of devmajor
and devminor; start_header already does this.

3 years agoOmit devmajor and devminor for non-special files
Paul Eggert [Sun, 12 Dec 2021 20:40:03 +0000 (12:40 -0800)] 
Omit devmajor and devminor for non-special files

* src/create.c (start_header): Leave the devmajor and devminor
fields empty for files that are not character and block special
devices, even when the archive format is pax, ustar or v7.
This avoids generating irrelevant differences which helps with
reproducible builds, and is more compatible with what Solaris 10
tar does.

3 years agoUse ‘bool’ in create.c
Paul Eggert [Sun, 12 Dec 2021 19:50:26 +0000 (11:50 -0800)] 
Use ‘bool’ in create.c

* src/create.c: Prefer ‘bool’, ‘true’, ‘false’ for booleans.

3 years ago* gnulib.modules: Add year2038.
Paul Eggert [Wed, 13 Oct 2021 21:45:55 +0000 (14:45 -0700)] 
* gnulib.modules: Add year2038.

3 years agobuild: improve build-from-git for older GCCs
Paul Eggert [Mon, 20 Sep 2021 20:11:36 +0000 (13:11 -0700)] 
build: improve build-from-git for older GCCs

configure.ac: Bump GCC version from 4.6 to 11.2 when deciding whether
to default to enabling GCC warnings when --enable-gcc-warnings is not
specified, as older GCCs can generate too many false alarms.  From
a suggestion by Christian Schoenebeck.

3 years agoSimplify wordsplit code a bit
Paul Eggert [Sun, 19 Sep 2021 14:34:53 +0000 (07:34 -0700)] 
Simplify wordsplit code a bit

These changes pacify gcc -Wanalyzer-null-dereference on x86-64 gcc
11.2.1 20210728 (Red Hat 11.2.1-1).
* lib/wordsplit.c (wsnode_tail): Remove unnecessary test.
(coalesce_segment): Coalesce calls to wsnode_len.

3 years agobuild: document WERROR_CFLAGS
Paul Eggert [Sat, 18 Sep 2021 15:16:04 +0000 (08:16 -0700)] 
build: document WERROR_CFLAGS

* README-hacking: Mention 'make WERROR_CFLAGS='.

3 years agobuild: update paxutils submodule to latest
Paul Eggert [Fri, 17 Sep 2021 19:27:29 +0000 (12:27 -0700)] 
build: update paxutils submodule to latest

3 years agobuild: update gnulib submodule to latest
Paul Eggert [Fri, 17 Sep 2021 18:41:55 +0000 (11:41 -0700)] 
build: update gnulib submodule to latest

* src/common.h (get_directory_entries):
Add _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE.
Problem found by gcc -Wsuggest-attribute=malloc and
current Gnulib.

3 years agoPacify gcc -Warray-parameter
Paul Eggert [Fri, 17 Sep 2021 19:48:30 +0000 (12:48 -0700)] 
Pacify gcc -Warray-parameter

* src/common.h (code_timespec): Declare sbuf arg to be an array,
to be consistent with definition.

3 years agoFix null rereference if low-memory
Paul Eggert [Fri, 17 Sep 2021 19:36:13 +0000 (12:36 -0700)] 
Fix null rereference if low-memory

* src/incremen.c (read_incr_db_01): Use xstrdup not strdup.
Problem found by gcc -Wanalyzer-possible-null-argument.

3 years agoProvide functions for manipulating arrays of extended attributes
Sergey Poznyakoff [Thu, 2 Sep 2021 17:41:28 +0000 (20:41 +0300)] 
Provide functions for manipulating arrays of extended attributes

* src/common.h (xheader_xattr_free,xheader_xattr_copy): Remove protos.
(xattr_map_init,xattr_map_copy)
(xattr_map_add,xattr_map_free): New protos.
* src/tar.h (xattr_map): New struct.
(tar_stat_info): Replace xattr_map_size and xattr_map with one
field: xattr_map.
* src/xattrs.c (XATTRS_PREFIX,XATTRS_PREFIX_LEN): New defines.
(xheader_xattr_init,xattr_map_init)
(xattr_map_free,xattr_map_add)
(xheader_xattr_add,xattr_map_copy): New functions.
All uses changed.
* src/create.c (start_header): Update to use struct xattr_map.
* src/extract.c: Update to use struct xattr_map.
* src/tar.c: Likewise.
* src/xheader.c (xheader_xattr_init,xheader_xattr_free)
(xheader_xattr_add,xheader_xattr_copy): Remove.
(xattr_coder,xattr_decoder): Use xattr_map_ functions.

3 years agoFix handling of extended header prefixes
Sergey Poznyakoff [Sat, 28 Aug 2021 13:02:12 +0000 (16:02 +0300)] 
Fix handling of extended header prefixes

* src/xheader.c (locate_handler): Recognize prefix keywords only
when followed by a dot.
(xattr_decoder): Use xmalloc/xstrdup instead of alloc

3 years agoHandle invalid sparse entries in pax header
Sergey Poznyakoff [Sat, 28 Aug 2021 11:15:25 +0000 (14:15 +0300)] 
Handle invalid sparse entries in pax header

* src/sparse.c (pax_decode_header): Check if sp.offset+sp.numbytes
falls within the reported file size.  Check for possible integer
overflow.

3 years agotransform: fix replacement of particular pattern instance
Sergey Poznyakoff [Sat, 28 Aug 2021 06:13:05 +0000 (09:13 +0300)] 
transform: fix replacement of particular pattern instance

This fixes handling of expressions like 's/s/@/2'

Fix suggested by Anthony Heading.

* src/transform.c (_single_transform_name_to_obstack): Avoid duplicating
initial prefix if replace is not needed.

4 years agoFix crash on invalid command line argument
Samanta Navarro [Fri, 11 Jun 2021 11:52:31 +0000 (11:52 +0000)] 
Fix crash on invalid command line argument

The copy_string_unquote function does not handle arguments which only
consist of a single quote. A string is only quoted if two quoting
characters exist.

How to reproduce:

tar --checkpoint-action exec=\"

4 years agoFix the use of options with trailing slash in files-from list
Sergey Poznyakoff [Thu, 1 Jul 2021 06:38:35 +0000 (09:38 +0300)] 
Fix the use of options with trailing slash in files-from list

* src/names.c (read_name_from_file): Do not remove trailing slash
here, since name_buffer might contain an option (e.g. -C /).
(read_next_name): Remove trailing slash when we're sure we're dealing
with a file name.
See 163e96a0.

4 years agoMinor fix
Sergey Poznyakoff [Tue, 1 Jun 2021 16:01:31 +0000 (19:01 +0300)] 
Minor fix

* scripts/backup-specs: Set standard paths for rsh (patch#9275).

4 years agoFix typos
Samanta Navarro [Tue, 1 Jun 2021 11:32:02 +0000 (11:32 +0000)] 
Fix typos

Typos found with codespell

4 years agoMinor changes.
Samanta Navarro [Tue, 1 Jun 2021 15:38:21 +0000 (18:38 +0300)] 
Minor changes.

* src/xheader.c (decode_record): Fix format specification.
(xattr_encode_keyword): Allocate space for terminating \0.

4 years agoFix gendocs_template
Sergey Poznyakoff [Wed, 24 Mar 2021 18:56:54 +0000 (20:56 +0200)] 
Fix gendocs_template

4 years agoTune for single-threaded tar
Paul Eggert [Mon, 8 Mar 2021 02:29:00 +0000 (18:29 -0800)] 
Tune for single-threaded tar

This takes advantage of recent optimizations in Gnulib
for single-threaded programs.
* configure.ac (GNULIB_EXCLUDE_SINGLE_THREAD)
(GNULIB_MBRTOWC_SINGLE_THREAD, GNULIB_REGEX_SINGLE_THREAD)
(GNULIB_WCHAR_SINGLE_LOCALE): Define.

4 years agoPort linking to AIX 7.1
Paul Eggert [Mon, 8 Mar 2021 01:58:58 +0000 (17:58 -0800)] 
Port linking to AIX 7.1

* src/Makefile.am (LDADD): Remove, folding into tar_LDADD.
* src/Makefile.am (tar_LDADD), tests/Makefile.am (LDADD):
Add the libraries gnulib-tool currently recommends: LIB_ACL,
LIB_CLOCK_GETTIME, LIB_GETRANDOM, LIB_HARD_LOCALE, LIB_HAS_ACL,
LIB_MBRTOWC, LIB_SETLOCALE_NULL.  Otherwise, tar won’t link on AIX
7.1 with xlc because the -lpthread option is missing.

4 years agoPort xattr-at.h to AIX 7.1
Paul Eggert [Mon, 8 Mar 2021 01:55:45 +0000 (17:55 -0800)] 
Port xattr-at.h to AIX 7.1

* lib/xattr-at.h: Include <errno.h> before testing whether
ENOATTR is defined.

4 years agobuild: update gnulib submodule to latest
Paul Eggert [Sun, 7 Mar 2021 23:12:51 +0000 (15:12 -0800)] 
build: update gnulib submodule to latest

4 years agoFix building the online version of the manual.
Sergey Poznyakoff [Mon, 1 Mar 2021 18:30:56 +0000 (20:30 +0200)] 
Fix building the online version of the manual.

* doc/Makefile.am (GENDOCS): Use the version from the tar repository.
(manual): Set the DISTRIN rendition.
(manual-rebuild): New goal.
* doc/README.manual: New file. Instructions for maintainers on how to
update web documentation.
* doc/gendocs.sh: A version from gnulib fixed as per
https://lists.gnu.org/archive/html/bug-gnulib/2021-03/msg00002.html.
* doc/gendocs_template: Updated version from gnulib.
* doc/intern.texi: Fix the use of UNREVISED.
* doc/tar.texi: Fix the use of GNUTAR.

4 years agoFix unlikely uninitalized var bug with sparse file
Paul Eggert [Mon, 1 Mar 2021 07:23:16 +0000 (23:23 -0800)] 
Fix unlikely uninitalized var bug with sparse file

* src/sparse.c (sparse_extract_file): Set *SIZE to
stat.st_size so that the caller does not use *SIZE
when uninitalized.  Problem found with GCC 10 and
--enable-gcc-warnings CFLAGS='-O2 -flto -fanalyzer'.

4 years agoPacify --enable-gcc-warnings -flto -fanalyzer
Paul Eggert [Mon, 1 Mar 2021 07:21:27 +0000 (23:21 -0800)] 
Pacify --enable-gcc-warnings -flto -fanalyzer

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.

4 years agoPacify clang for unreachable ‘return’
Paul Eggert [Sun, 28 Feb 2021 21:43:58 +0000 (13:43 -0800)] 
Pacify clang for unreachable ‘return’

* src/sparse.c (sparse_scan_file_seek): Omit unreachable statement.

4 years agoPacify clang char conversion
Paul Eggert [Sun, 28 Feb 2021 21:42:49 +0000 (13:42 -0800)] 
Pacify clang char conversion

* src/create.c (to_chars): Pacify ‘clang’ about assigning
128 to ‘char’.

4 years agoOmit most uses of ‘inline’
Paul Eggert [Sun, 28 Feb 2021 21:34:55 +0000 (13:34 -0800)] 
Omit most uses of ‘inline’

With today’s compilers ‘inline’ is typically not needed for
performance (at least the way GNU Tar uses it) and it gets in the
way of portability.
* configure.ac: Omit AC_C_INLINE; no longer needed here.
* lib/attr-xattr.in.h (setxattr, lsetxattr, fsetxattr, getxattr)
(lgetxattr, fgetxattr, listxattr, llistxattr, flistxattr):
* lib/wordsplit.c (skip_delim_internal, skip_delim)
(skip_delim_real, exptab_matches):
* src/delete.c (flush_file):
* src/extract.c (safe_dir_mode):
* src/misc.c (ptr_align):
Now just static, not static inline.
* lib/wordsplit.h (wordsplit_getwords): Remove; no longer used.
* src/common.h (name_more_files): Now COMMON_INLINE, not
extern inline - which is not portable according to C99,
the way we were using it.

4 years agomaint: port better to non-GCC compilers
Paul Eggert [Sun, 28 Feb 2021 02:42:58 +0000 (18:42 -0800)] 
maint: port better to non-GCC compilers

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

4 years agoUpdate paxutils from upstream
Paul Eggert [Sun, 28 Feb 2021 02:42:58 +0000 (18:42 -0800)] 
Update paxutils from upstream

4 years agomaint: 1.34 announcement update
Paul Eggert [Sun, 28 Feb 2021 02:40:49 +0000 (18:40 -0800)] 
maint: 1.34 announcement update

Hand-install 1.34 changes into master.
Evidently these changes were not pushed to savannah,
before I installed further changes today.

4 years agomaint: port to Fedora 33
Paul Eggert [Sun, 28 Feb 2021 00:41:12 +0000 (16:41 -0800)] 
maint: port to Fedora 33

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.

4 years agoUpdate gnulib and paxutils from upstream
Paul Eggert [Sat, 27 Feb 2021 23:37:40 +0000 (15:37 -0800)] 
Update gnulib and paxutils from upstream

4 years agoxattrs: fix capabilities root test
Pavel Raiskup [Mon, 8 Feb 2021 15:50:31 +0000 (17:50 +0200)] 
xattrs: fix capabilities root test

Related discussion in the Fedora pull-request:
https://src.fedoraproject.org/rpms/tar/pull-request/8

* tests/capabs_raw01.at: Newer systems (currently e.g. Fedora 34)
print getcap output in format CAP=VAL, not CAP+VAL.

4 years agoGracefully handle duplicate symlinks when extracting
Sergey Poznyakoff [Mon, 8 Feb 2021 14:11:41 +0000 (16:11 +0200)] 
Gracefully handle duplicate symlinks when extracting

If the archive being extracted contains multiple copies
of the same symlink, extract only the first of them and
skip the rest.  The use case is described in

https://lists.gnu.org/archive/html/bug-tar/2021-01/msg00026.html

The bug was introduced by 2d3396c3ea.

* src/extract.c (create_placeholder_file): If placeholder already
exists and is registered in the delayed_link list, return immediately.

4 years agoFix savannah bug #60002
Sergey Poznyakoff [Thu, 4 Feb 2021 14:51:38 +0000 (16:51 +0200)] 
Fix savannah bug #60002

Bug was introduced by commit 34d15af1.

* src/extract.c (prepare_to_extract): When extracting over pipe,
process only regular files.
* tests/extrac24.at: New test case.
* tests/Makefile.am: Add new test case.
* tests/testsuite.at: Likewise.

4 years agoFix memory leak in read_header
Sergey Poznyakoff [Sun, 17 Jan 2021 18:41:11 +0000 (20:41 +0200)] 
Fix memory leak in read_header

Bug reported in https://savannah.gnu.org/bugs/?59897

* src/list.c (read_header): Don't return directly from the loop.
Instead set the status and break.  Return the status.  Free
next_long_name and next_long_link before returning.

4 years agoFix improper argument reference.
Sergey Poznyakoff [Sun, 17 Jan 2021 17:02:47 +0000 (19:02 +0200)] 
Fix improper argument reference.

(bug introduced by 1ff0b63f)

* src/tar.c (parse_default_options): Pass args as is to the argp_parse.

4 years agoFix regression itroduced by 66162927.
Sergey Poznyakoff [Sat, 16 Jan 2021 12:36:40 +0000 (14:36 +0200)] 
Fix regression itroduced by 66162927.

* src/misc.c (chdir_arg): Initialize the abspath field to NULL.
(tar_getcdpath): Actually initialize the abspath field here.

4 years agoFixes in the delete_archive_members function
Sergey Poznyakoff [Thu, 14 Jan 2021 07:00:12 +0000 (09:00 +0200)] 
Fixes in the delete_archive_members function

* src/delete.c (delete_archive_members): Clean-up the code. Avoid
entering the loop from the middle.  Free the memory allocated for
current_stat_info.

4 years agoUse stdopen from gnulib
Sergey Poznyakoff [Fri, 8 Jan 2021 16:48:17 +0000 (18:48 +0200)] 
Use stdopen from gnulib

* gnulib.modules: Request stdopen
* lib/Makefile.am: Remove stdopen.c and stdopen.h
* lib/stdopen.c: Remove.
* lib/stdopen.h: Remove.
* src/tar.c: stdopen returns 0 on success.

4 years agoActually prefer /dev/full over /dev/null as a replacement for stdin
Sergey Poznyakoff [Fri, 8 Jan 2021 15:34:19 +0000 (17:34 +0200)] 
Actually prefer /dev/full over /dev/null as a replacement for stdin

* lib/stdopen.c (stdopen): Fix improper condition.
Avoid leaking extra file descriptor.
* src/tar.c (main): Set name of the stdout for diagnostics.
Bail out if stdopen fails.

4 years agoVersion 1.33 release_1_33
Sergey Poznyakoff [Thu, 7 Jan 2021 14:23:16 +0000 (16:23 +0200)] 
Version 1.33

* NEWS: Update.
* configure.ac: Raise version number. Require automake 1.15 and
autoconf 2.64.
* gnulib: pull v0.1-4333-g30820c2
* src/names.c: Use hash_remove instead of the deprecated hash_delete.

4 years agoUpdate copyright years
Sergey Poznyakoff [Wed, 6 Jan 2021 15:55:16 +0000 (17:55 +0200)] 
Update copyright years

5 years agoFix typo in the manpage
Sergey Poznyakoff [Mon, 13 Jul 2020 06:01:29 +0000 (09:01 +0300)] 
Fix typo in the manpage

* doc/tar.1: Fix description of the --newer option

5 years agoBugfix --sparse --diff mode
Pavel Raiskup [Thu, 9 Jul 2020 19:22:10 +0000 (21:22 +0200)] 
Bugfix --sparse --diff mode

Originally reported in:
https://bugzilla.redhat.com/show_bug.cgi?id=1853469

* src/sparse.c (check_data_region): Only compare the part of buffer
really fed by safe_read(), not whole rdsize.

5 years agoAccept only position-sensitive (file-selection) options in file list files.
Sergey Poznyakoff [Wed, 24 Jun 2020 13:43:26 +0000 (16:43 +0300)] 
Accept only position-sensitive (file-selection) options in file list files.

Using such options as -f, -z, etc. is senseless in the file list file
and bypasses the option consistency checks in decode_options.  Therefore,
only options related to file selection (a.k.a position-sensitive options)
are allowed in files.

* doc/tar.texi: Document changes.
* src/common.h (tar_args): Move from tar.c
(TAR_ARGS_INITIALIZER): New macro.
* src/names.c: Declare option group identifiers as an enum.
(names_parse_opt): Special handling for ARGP_KEY_ERROR.
(names_argp): Remove static qualifier.
(names_argp_children): Remove.
* src/tar.c: Declare option group identifiers as an enum.
(parse_opt): Special handling for ARGP_KEY_INIT.
(argp_children): New static variable.
(args): Remove static variable.
(more_options): Allow only options from names_argp.
(parse_default_options): Take a pointer to struct tar_args as argument.
Replace the loc member during the call to argp_parse and restore it
afterwards.
(decode_options): Use automatic variable for args.

5 years agoFix the logic of prepare_to_extract.
Sergey Poznyakoff [Mon, 22 Jun 2020 19:17:46 +0000 (22:17 +0300)] 
Fix the logic of prepare_to_extract.

* src/extract.c (prepare_to_extract): Return true to proceed with
the extraction, and false to skip the current member.  If extracting
over a pipe, skip unlinking logic.
(extract_archive): Update accordingly.

5 years agoMake sure link counting works for file names supplied with -T
Sergey Poznyakoff [Mon, 15 Jun 2020 18:10:46 +0000 (21:10 +0300)] 
Make sure link counting works for file names supplied with -T

* src/common.h (name_count): Remove extern.
(files_count): New enum.
(filename_args): New extern.
* src/names.c (name_count): Remove.
(files_count): New variable.
(name_add_name,name_add_file): Update filename_args.
* src/create.c (create_archive): Set trivial_link_count depending on
the filename_args.

5 years agoRemove freemanuals.texi
Alfred M. Szmidt [Wed, 10 Jun 2020 12:26:45 +0000 (08:26 -0400)] 
Remove freemanuals.texi

* doc/Makefile.am (tar_TEXINFOS): Remove freemanuals.texi.
* doc/freemanuals.texi: Delete file.
* doc/tar.texi (Free Software Needs Free Documentation): Remove
appendix.

5 years agoFix typo in docs
Sergey Poznyakoff [Wed, 3 Jun 2020 07:55:51 +0000 (10:55 +0300)] 
Fix typo in docs

5 years agoBugfix
Sergey Poznyakoff [Wed, 3 Jun 2020 06:31:41 +0000 (09:31 +0300)] 
Bugfix

* src/sparse.c (sparse_diff_file): Fix return value.

5 years agotar: avoid read overrun
Paul Eggert [Tue, 19 May 2020 18:52:01 +0000 (11:52 -0700)] 
tar: avoid read overrun

Problem reported by Timotej Kapus in:
https://lists.gnu.org/r/bug-tar/2020-05/msg00001.html
* src/transform.c (parse_transform_expr):
Diagnose ‘--transform='s'’ instead of continuing past '\0'.

5 years agoFix handling of linked rename chains in incremental backups
Sergey Poznyakoff [Sat, 15 Feb 2020 08:57:35 +0000 (10:57 +0200)] 
Fix handling of linked rename chains in incremental backups

* src/incremen.c: Change the meaning of the DIRF_RENAMED flag.  Now it
marks a directory which is the last one in a chain of renames.
Regular renamed directories are recognized by their orig member being
non-NULL.  Directories marked with DIRF_RENAMED start encoding of renames.
(procdir): Clear DIRF_RENAMED flag on directories which are origins for
renames.
(makedumpdir): Use the orig member to check if the directory is a
result of a rename.
(store_rename): Move the check for DIR_IS_RENAMED to the caller. Don't
clear the DIRF_RENAMED, it is not needed any more.

* tests/rename06.at: New test.
* tests/Makefile.am: Add rename06.at
* tests/testsuite.at: Likewise.

5 years agoUpdate copyright years
Sergey Poznyakoff [Sat, 8 Feb 2020 11:21:13 +0000 (13:21 +0200)] 
Update copyright years

5 years agoFix the --no-overwrite-dir option
Sergey Poznyakoff [Sat, 8 Feb 2020 11:01:47 +0000 (13:01 +0200)] 
Fix the --no-overwrite-dir option

Given this option, tar failed to preserve permissions of empty directories
and to create files under directories owned by the current user that did
not have the S_IWUSR bit set.

* src/extract.c (fd_chmod): Rename to fd_i_chmod.
(fd_chmod): New function.
(safe_dir_mode): New function.
(extract_dir): Special handling for existing directories in
--no-overwrite-dir mode.
* tests/extrac23.at: New file.
* tests/Makefile.am: Add new test case.
* tests/testsuite.at: Likewise.

5 years agoWildcards in exclude-vcs-ignore mode should not match slash
Sergey Poznyakoff [Tue, 3 Dec 2019 07:55:02 +0000 (09:55 +0200)] 
Wildcards in exclude-vcs-ignore mode should not match slash

* src/exclist.c (info_attach_exclist): Use the FNM_FILE_NAME flag.

5 years agoVersion 1.32.90
Sergey Poznyakoff [Wed, 27 Nov 2019 16:51:58 +0000 (18:51 +0200)] 
Version 1.32.90

5 years agoTestsuite fixes
Sergey Poznyakoff [Mon, 25 Nov 2019 06:01:04 +0000 (08:01 +0200)] 
Testsuite fixes

* tests/sparse06.at: Skip the test if genfile is unable to create
sparse files.
* tests/sptrcreat.at: Likewise.
* tests/sptrdiff00.at: Likewise.
* tests/sptrdiff01.at: Likewise.

5 years agoAnother testsuite fix.
Sergey Poznyakoff [Thu, 14 Nov 2019 05:58:17 +0000 (07:58 +0200)] 
Another testsuite fix.

* tests/extrac11.at: Skip test if ulimit fails.

5 years agoTestsuite fix.
Sergey Poznyakoff [Wed, 13 Nov 2019 06:37:41 +0000 (08:37 +0200)] 
Testsuite fix.

* tests/remfiles10.at: Don't expect EINVAL when trying to remove
CWD.

5 years agoConsistently use x2realloc for buffer reallocation
Sergey Poznyakoff [Sun, 25 Aug 2019 11:41:17 +0000 (14:41 +0300)] 
Consistently use x2realloc for buffer reallocation

* src/create.c (create_archive): Use x2realloc
* src/names.c (copy_name)
(add_hierarchy_to_namelist): Use x2realloc

5 years agoFix extraction of symbolic links hardlinked to another symbolic links
Sergey Poznyakoff [Sun, 18 Aug 2019 20:40:54 +0000 (23:40 +0300)] 
Fix extraction of symbolic links hardlinked to another symbolic links

* src/extract.c (create_placeholder_file): Take additional argument:
the delayed_link entry after which to the newly created one.
(extract_link): Create a placeholder file if the target link name
exists in the delayed_link list.

6 years agoFix --delay-directory-restore on archives with reversed member ordering.
Sergey Poznyakoff [Thu, 11 Apr 2019 10:45:32 +0000 (13:45 +0300)] 
Fix --delay-directory-restore on archives with reversed member ordering.

* src/extract.c (find_direct_ancestor): Remove useless test.
(delay_set_stat): If the file name being added is already in
the list, update stored data instead of creating a new entry.
This works for archives with reversed order of members.
* tests/extrac22.at: New testcase.
* tests/Makefile.am: Add new testcase.
* tests/testsuite.at: Include new testcase.

6 years agoMinor change
Sergey Poznyakoff [Thu, 28 Mar 2019 12:01:58 +0000 (14:01 +0200)] 
Minor change
* scripts/backup.in: Fix typo

6 years agoTypesetting fixes in the manpage
Sergey Poznyakoff [Thu, 28 Mar 2019 11:58:44 +0000 (13:58 +0200)] 
Typesetting fixes in the manpage

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
6 years agoPOSIX extended format headers do not include PID by default
Zachary Vance [Mon, 11 Mar 2019 02:12:19 +0000 (19:12 -0700)] 
POSIX extended format headers do not include PID by default

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>
6 years agoCheck return value from xgetcwd
Sergey Poznyakoff [Sun, 3 Mar 2019 07:02:20 +0000 (09:02 +0200)] 
Check return value from xgetcwd

* src/misc.c (chdir_arg,tar_getcdpath): Check for non-NULL
return from xgetcwd. The function returns NULL for any
error originating from getcwd.

6 years agoVersion 1.32 release_1_32
Sergey Poznyakoff [Sat, 23 Feb 2019 12:54:53 +0000 (14:54 +0200)] 
Version 1.32

6 years agoMinor fixes in docs.
Sergey Poznyakoff [Mon, 4 Feb 2019 19:30:00 +0000 (21:30 +0200)] 
Minor fixes in docs.

* doc/tar.1: Remove description of the --preserve option
Document verbosity levels.
* doc/tar.texi: Fix description of the -o option.

6 years agoFix typos in the documentation
Daniel Le [Sun, 8 Apr 2018 09:06:33 +0000 (17:06 +0800)] 
Fix typos in the documentation

Short option "t" was mistranslated to "--test" instead of "--list" in commit
67cad0792b4e6cf22c6cb1b167b149cd176d49f9.

6 years agoFix build on AIX
Sergey Poznyakoff [Tue, 15 Jan 2019 13:21:03 +0000 (15:21 +0200)] 
Fix build on AIX

* src/unlink.c (flush_deferred_unlinks): Avoid possible duplicate case
(if ENOTEMPTY==EEXIST)

6 years agoVersion 1.31.90
Sergey Poznyakoff [Tue, 15 Jan 2019 12:38:02 +0000 (14:38 +0200)] 
Version 1.31.90

6 years agoEnsure gnu format when running checkpoint tests
Sergey Poznyakoff [Mon, 14 Jan 2019 21:32:15 +0000 (23:32 +0200)] 
Ensure gnu format when running checkpoint tests

6 years agoFix compression tests
Sergey Poznyakoff [Mon, 14 Jan 2019 16:08:21 +0000 (18:08 +0200)] 
Fix compression tests

Existing compression tests used tar with compiled-in defaults. However,
some of the defaults are sure to create archives that are not byte-to-byte
reproducible (e.g. DEFAULT_ARCHIVE_FORMAT=POSIX, because the name field
in posix extended headers uses PID of the creating process by default).
Moreover, some compressors (e.g. gzip) store current timestamp in
the file header when compressing from stdin, so that using cmp on the
two created archives as the tests did is error-prone. Another problem
is that the tests implicitly assumed that tar uses archive suffix to
recognize its format when extracting, which isn't the case. Finally,
there's hardly any reason in using sed to create m4 sources, when
everything can be achieved by m4 itself.

* tests/Makefile.am: Remove generation of compress-*.at files.
* tests/compress.at.in: Remove.
* tests/compress.m4: New file.
* tests/testsuite.at: Include compress.m4, use TAR_CHECK_COMPRESS to
check compression options.

6 years agoFix possible NULL dereference (savannah bug #55369)
Sergey Poznyakoff [Mon, 14 Jan 2019 13:22:09 +0000 (15:22 +0200)] 
Fix possible NULL dereference (savannah bug #55369)

* src/sparse.c (pax_decode_header): Check return from find_next_block.

6 years agoFix compilation without iconv.
Sergey Poznyakoff [Mon, 14 Jan 2019 12:46:43 +0000 (14:46 +0200)] 
Fix compilation without iconv.

6 years agoFix iconv usage.
Sergey Poznyakoff [Mon, 14 Jan 2019 11:59:39 +0000 (13:59 +0200)] 
Fix iconv usage.

Patch by Christian Weisgerber.

* src/utf8.c (utf8_convert): non-zero return from iconv means failure.

6 years agotests: fix numeric.at for BSD
Pavel Raiskup [Thu, 2 Jun 2016 05:28:01 +0000 (07:28 +0200)] 
tests: fix numeric.at for BSD

While creating file, BSD kernels inherit the group ownership from
parent directory.
http://lists.gnu.org/archive/html/bug-tar/2016-06/msg00000.html

* tests/numeric.at: Attempt to 'chown' the newly created directory
to proper group (at least on affected machines that command is
expected to succeed).

6 years agoFix typo in manpage.
Sergey Poznyakoff [Mon, 14 Jan 2019 10:48:16 +0000 (12:48 +0200)] 
Fix typo in manpage.

6 years agoFix expected output in dirrem tests.
Sergey Poznyakoff [Mon, 14 Jan 2019 10:26:59 +0000 (12:26 +0200)] 
Fix expected output in dirrem tests.

In both tests, the "file changed as we read it" warning might be
produced for dir/sub, depending on the ctime resolution and timing.
The problem was fixed by 64b43fdf70d82c39eb2ca900cd4f8e49, but regressed
after e7cd377f7801d42aa8e07addff93d2150666c237, which removed 1 second
delays between each pair of checkpoints. Since the presense or absense
of this warning is irrelevant for the test, it is now suppressed.

* tests/dirrem01.at: Suppress the file-changed warning.
* tests/dirrem02.at: Likewise.

6 years agoFix the use of --checkpoint without explicit --checkpoint-action
Sergey Poznyakoff [Sat, 12 Jan 2019 07:41:44 +0000 (09:41 +0200)] 
Fix the use of --checkpoint without explicit --checkpoint-action

* src/checkpoint.c (checkpoint_finish_compile): Set default action,
if necessary.
* tests/checkpoint/defaults.at: New testcase.
* tests/checkpoint/dot-compat.at: New testcase.
* tests/checkpoint/dot-int.at: New testcase.
* tests/checkpoint/dot.at: New testcase.
* tests/checkpoint/interval.at: New testcase.
* tests/Makefile.am: Add new testcases.
* tests/testsuite.at Include new testcases.

6 years agoRemove erroneous abort() call
Sergey Poznyakoff [Thu, 10 Jan 2019 16:18:49 +0000 (18:18 +0200)] 
Remove erroneous abort() call

The call was introduced by commit ccef8581. It caused tar to abort
on perfectly normal operations, like untarring archives containing
./ with the -U option,

See http://lists.gnu.org/archive/html/bug-tar/2019-01/msg00019.html
for details.

* src/extract.c (maybe_recoverable): Remove misplaced call to abort().

6 years agoVersion 1.31 release_1_31
Sergey Poznyakoff [Wed, 2 Jan 2019 18:01:10 +0000 (20:01 +0200)] 
Version 1.31

6 years agoFix the difflink test
Sergey Poznyakoff [Fri, 28 Dec 2018 15:53:35 +0000 (17:53 +0200)] 
Fix the difflink test

Hardlinking a symlink produces hardlink on BSD and symlink
on GNU/Linux. Avoid the ambiguity.

* tests/difflink.at: Create hard link from a regular file.

6 years agoWork over a bug in gnulib error()
Sergey Poznyakoff [Fri, 28 Dec 2018 15:49:08 +0000 (17:49 +0200)] 
Work over a bug in gnulib error()

The error() function from glibc correctly prefixes each message it
prints with program_name as set by set_program_name. However, its
replacement from gnulib, which is linked in on systems where this
function is not available, prints the name returned by getprogname()
instead. Due to this messages output by tar subprocess (which sets its
program name to 'tar (child)') become indiscernible from those printed
by the main process. In particular, this breaks the remfiles01.at and
remfiles02.at test cases.

* configure.ac: Define ENABLE_ERROR_PRINT_PROGNAME if using
gnulib error().
* src/tar.c [ENABLE_ERROR_PRINT_PROGNAME] (tar_print_progname): New function.
(main) [ENABLE_ERROR_PRINT_PROGNAME]: Set error_print_progname.

6 years agoImplement the "wait" checkpoint action.
Sergey Poznyakoff [Fri, 28 Dec 2018 11:17:44 +0000 (13:17 +0200)] 
Implement the "wait" checkpoint action.

This action instructs tar to pause until given signal is delivered.
The newer genfile tool uses this action for communication between
genfile and tar in exec mode. This eliminates race conitions and
speeds up the tests based on exec mode.

* doc/tar.texi: Document changes.
* paxutils: Upgrade.
* src/checkpoint.c: Implement the wait action.
* src/common.h (decode_signal): New proto.
* src/tar.c (decode_signal): New function.
(set_stat_signal): Rewrite.
* tests/dirrem01.at: Adjust genfile and tar command line arguments
to use the new feature.
* tests/dirrem02.at: Likewise.
* tests/filerem01.at: Likewise.
* tests/filerem02.at: Likewise.
* tests/grow.at: Likewise.
* tests/sptrcreat.at: Likewise.
* tests/sptrdiff00.at: Likewise.
* tests/sptrdiff01.at: Likewise.
* tests/truncate.at: Likewise.

6 years agoFix CVE-2018-20482
Sergey Poznyakoff [Thu, 27 Dec 2018 15:48:57 +0000 (17:48 +0200)] 
Fix CVE-2018-20482

* NEWS: Update.
* src/sparse.c (sparse_dump_region): Handle short read condition.
(sparse_extract_region,check_data_region): Fix dumped_size calculation.
Handle short read condition.
(pax_decode_header): Fix dumped_size calculation.
* tests/Makefile.am: Add new testcases.
* tests/testsuite.at: Likewise.

* tests/sptrcreat.at: New file.
* tests/sptrdiff00.at: New file.
* tests/sptrdiff01.at: New file.

6 years agoDisallow modifications to the global pax extended header in update mode.
Sergey Poznyakoff [Fri, 21 Dec 2018 12:18:14 +0000 (14:18 +0200)] 
Disallow modifications to the global pax extended header in update mode.

Updating global headers in update mode is not possible, because:

1) If the original archive was not in PAX format, writing the
global header would overwrite first member header (and eventually
data blocks) in the archive.
2) Otherwise, using the --pax-option can make the updated header
occupy more blocks than the original one, which would lead to the
same effect as in 1.

This also fixes
  http://lists.gnu.org/archive/html/bug-tar/2018-12/msg00007.html

* src/xheader.c (xheader_forbid_global): New function.
* src/common.h (xheader_forbid_global): New prototype.
* src/update.c (update_archive): Use xheader_forbid_global, instead
of trying to write global extended header record.