]> git.ipfire.org Git - thirdparty/tar.git/log
thirdparty/tar.git
2 years agoNew option: --set-mtime-command
Sergey Poznyakoff [Tue, 1 Aug 2023 12:39:15 +0000 (15:39 +0300)] 
New option: --set-mtime-command

* NEWS: Document new option.
* src/common.h (COMMAND_MTIME): New constant.
* src/create.c (set_mtime_command)
(set_mtime_format): New globals.
(sys_exec_setmtime_script): New prototype.
* src/system.c (start_header): Handle COMMAND_MTIME.
* src/tar.c (sys_exec_setmtime_script): New function.

2 years ago* doc/tar.texi: Fix minor reproducibility typos.
Paul Eggert [Tue, 25 Jul 2023 16:45:46 +0000 (09:45 -0700)] 
* doc/tar.texi: Fix minor reproducibility typos.

2 years agoImprove reproducibility recipe
Paul Eggert [Tue, 25 Jul 2023 16:43:16 +0000 (09:43 -0700)] 
Improve reproducibility recipe

* doc/tar.texi (Reproducibility): Improve index.
Improve and add comments to recipe.  In the recipe,
don’t worry about file names beginning with ‘-’ for simplicity;
don’t use touch -c as it exits with status 0 even when it
does not work; and set directory timestamps too.

2 years ago* doc/tar.texi: Define reproducibility.
Sergey Poznyakoff [Tue, 25 Jul 2023 12:30:51 +0000 (14:30 +0200)] 
* doc/tar.texi: Define reproducibility.

2 years agoNew doc about reproducible archives
Paul Eggert [Mon, 24 Jul 2023 21:43:30 +0000 (14:43 -0700)] 
New doc about reproducible archives

* doc/tar.texi (Reproducibility): New section.
Spruce some other sections related to timestamps etc.

2 years agotests: fix LDADD
Paul Eggert [Wed, 19 Jul 2023 22:48:25 +0000 (15:48 -0700)] 
tests: fix LDADD

Problem reported by Christian Weisgerber <naddy@mips.inka.de> in:
https://lists.gnu.org/r/bug-tar/2023-07/msg00015.html
* tests/Makefile.am (LDADD): Add $(LIBINTL), $(LIBICONV).

2 years agotests: Fix xz tests by unsetting XZ_OPT, XZ_DEFAULTS
Sam James [Tue, 18 Jul 2023 15:51:52 +0000 (16:51 +0100)] 
tests: Fix xz tests by unsetting XZ_OPT, XZ_DEFAULTS

Copyright-paperwork-exempt: true

2 years agotests: Fix bashism in testsuite.at
Sam James [Tue, 18 Jul 2023 15:45:32 +0000 (16:45 +0100)] 
tests: Fix bashism in testsuite.at

&> is a bashism and causes various tests to fail with /bin/sh as non-bash
(e.g. dash). Use the same pattern the rest of the file uses instead of &>.

Copyright-paperwork-exempt: true

2 years agotests: fix TESTSUITE_AT
Paul Eggert [Tue, 18 Jul 2023 16:15:03 +0000 (09:15 -0700)] 
tests: fix TESTSUITE_AT

Problem reported by Lukas Javorsky <ljavorsk@redhat.com> in:
https://lists.gnu.org/r/bug-tar/2023-07/msg00002.html
* tests/Makefile.am (TESTSUITE_AT): Add exclude17.at, exclude18.at.
Remove compress.m4; all uses changed.  Add a comment saying how
to rederive this.  Sort.

2 years agoFix savannah bug #64441
Sergey Poznyakoff [Tue, 18 Jul 2023 14:02:23 +0000 (17:02 +0300)] 
Fix savannah bug #64441

* src/Makefile.am (tar_LDADD): Add libiconv libraries.

2 years agoVersion 1.35 v1.35
Sergey Poznyakoff [Tue, 18 Jul 2023 06:38:30 +0000 (09:38 +0300)] 
Version 1.35

2 years agoUse full-read instead of safe-read
Sergey Poznyakoff [Sat, 15 Jul 2023 15:06:27 +0000 (18:06 +0300)] 
Use full-read instead of safe-read

This helps handle archiving on certain filesystems where read()
returns less bytes than requested when reading from a regular
file.

References:

  https://savannah.gnu.org/bugs/index.php?64426
  https://lists.gnu.org/archive/html/bug-tar/2021-07/msg00001.html

* gnulib.modules: Add full-read.
* src/common.h: Include full-read.h
* src/misc.c: Use full_read.
* src/sparse.c: Likewise.
* src/update.c: Likewise.

2 years agoFix typo in comments
Sergey Poznyakoff [Tue, 11 Jul 2023 06:12:47 +0000 (09:12 +0300)] 
Fix typo in comments

This and the bug fixed by the previous commit were reported by
Benno Schulenberg.

2 years agoFix --update --wildcards
Sergey Poznyakoff [Mon, 10 Jul 2023 18:09:57 +0000 (21:09 +0300)] 
Fix --update --wildcards

* src/common.h (name): New field: is_wildcard.
(name_scan): Change protoype.
* src/delete.c: Update calls to name_scan.
* src/names.c (addname, add_starting_file): Initialize is_wildcard.
(namelist_match): Take two arguments.  If second one is true, return
only exact matches.
(name_scan): Likewise.  All callers updated.
(name_from_list): Skip patterns.
* src/update.c (remove_exact_name): New function.
(update_archive): Do not remove matching name, if it is a pattern.
Instead, add a new entry with the matching file name.

* tests/update04.at: New test.
* tests/Makefile.am: Add new test.
* tests/testsuite.at: Include new test.

* NEWS: Update.

2 years agoVarious fixes in the documentation
Benno Schulenberg [Mon, 10 Jul 2023 07:39:48 +0000 (10:39 +0300)] 
Various fixes in the documentation

* doc/tar.1: Add missing dots, use plural when necessary,
tweak a wording.  Remove an incorrect observation, three times.
Add some missing articles, correct some formatting,
and expand the opaque descriptions of two options.
* doc/tar.texi: Drop a stray `cd` command from an example.
Correct two cross references, correct the paragraph
about the manpage, and unbreak a URL.
* src/names.c: Correct and shorten an error message: "non-optional"
means "mandatory", but "non-option" is what was meant.  And the
phrase "in archive create or update mode" was both unneeded and
incomplete.
* tests/positional01.at: Change expected error text.
* tests/positional02.at: Likewise.
* tests/positional03.at: Likewise.

2 years agobuild: update gnulib submodule to latest
Paul Eggert [Wed, 28 Jun 2023 18:31:23 +0000 (11:31 -0700)] 
build: update gnulib submodule to latest

2 years agotar: extract delayed links in order
Paul Eggert [Sun, 25 Jun 2023 19:54:20 +0000 (12:54 -0700)] 
tar: extract delayed links in order

Extract delayed links in tar file order, rather than
in hash table order with modifications.
This is simpler and more likely to use the kernel’s
cached filesystem data, assuming related delayed links
are nearby in the tar file.
* src/extract.c (struct delayed_link.has_predecessor):
Remove.  All uses removed.
(delayed_link_head, delayed_link_tail): New static vars.
This resurrects delayed_link_head’s old function
except that the linked list is now in forward order, not reverse.
(find_delayed_link_source): Now simply returns bool,
since the callers no longer need the pointer.
(create_placeholder_file):
Put the delayed link at the end of the linked list.
Omit no-longer-needed last arg.  All callers changed.
(apply_delayed_links): Simplify now that we can just iterate
through the delayed_link_head list.

2 years agotar: make safe for -Wunused-parameter
Paul Eggert [Sun, 25 Jun 2023 20:54:14 +0000 (13:54 -0700)] 
tar: make safe for -Wunused-parameter

This also ports to C23 [[maybe_unused]].
* configure.ac (WARN_CFLAGS): Do not add -Wno-unused-parameter.
Add MAYBE_UNUSED where needed in source code.
Also, put it at the front where C23 requires it.

2 years ago* po/.gitignore: Omit redundant *~ entries.
Paul Eggert [Sun, 25 Jun 2023 18:35:49 +0000 (11:35 -0700)] 
* po/.gitignore: Omit redundant *~ entries.

2 years agotar: omit unnecessary freeing
Paul Eggert [Sun, 25 Jun 2023 18:33:01 +0000 (11:33 -0700)] 
tar: omit unnecessary freeing

* src/tar.c (main): Omit unnecessary freeing.

2 years agoMake sure each delayed link entry is visited once
Sergey Poznyakoff [Sat, 17 Jun 2023 08:16:12 +0000 (11:16 +0300)] 
Make sure each delayed link entry is visited once

* src/extract.c (create_placeholder_file): Use FLEXNSIZEOF (overlooked
by c542d3d0c8)
(apply_delayed_links): Don't follow the "next" chain after its entries
have been applied.

2 years agoOmit unnecessary freeing
Paul Eggert [Sat, 17 Jun 2023 07:37:08 +0000 (00:37 -0700)] 
Omit unnecessary freeing

* src/extract.c (apply_delayed_link): Don’t bother to
free memory, as we’re about to exit.

2 years agoPort to strict C99 struct hack
Paul Eggert [Fri, 16 Jun 2023 23:34:19 +0000 (16:34 -0700)] 
Port to strict C99 struct hack

Portability bug caught by GCC 13 -fstrict-flex-arrays.
* gnulib.modules: Add flexmember.
* src/create.c (struct link):
* src/exclist.c (struct excfile):
* src/extract.c (struct delayed_link, struct string_list):
Include <flexmember.h>.  Use FLEXIBLE_ARRAY_MEMBER, for
portability to strict C99 or later.  All storage
allocations changed to use FLEXNSIZEOF.

2 years agoUse Gnulib ‘dup2’ module
Paul Eggert [Fri, 16 Jun 2023 23:34:19 +0000 (16:34 -0700)] 
Use Gnulib ‘dup2’ module

This simplifies code that would otherwise use dup and close.
* gnulib.modules: Add dup2.
* src/system.c: Add #pragma to pacify GCC 13.
(xdup2): Simplify by using dup2.

2 years agoUse Gnulib ‘free-posix’ module
Paul Eggert [Fri, 16 Jun 2023 23:34:19 +0000 (16:34 -0700)] 
Use Gnulib ‘free-posix’ module

Paxutils uses it so we should too.
* gnulib.modules: Add ‘free-posix’.
* src/misc.c (remove_any_file): Assume ‘free’ keeps errno.

2 years ago* buffer.c: work around GCC bug 109856
Paul Eggert [Fri, 16 Jun 2023 23:34:19 +0000 (16:34 -0700)] 
* buffer.c: work around GCC bug 109856

2 years agoRecommend Y2038 safety
Paul Eggert [Fri, 16 Jun 2023 23:34:19 +0000 (16:34 -0700)] 
Recommend Y2038 safety

2 years agobuild: update gnulib and paxutils submodules to latest
Paul Eggert [Fri, 16 Jun 2023 23:34:19 +0000 (16:34 -0700)] 
build: update gnulib and paxutils submodules to latest

2 years ago* .gitignore: Add slash, as bootstrap does this now.
Paul Eggert [Fri, 16 Jun 2023 03:42:04 +0000 (20:42 -0700)] 
* .gitignore: Add slash, as bootstrap does this now.

2 years agoSync bootstrap from Gnulib
Paul Eggert [Fri, 16 Jun 2023 03:25:22 +0000 (20:25 -0700)] 
Sync bootstrap from Gnulib

2 years agoComment a bit on the xattr extraction logic
Pavel Raiskup [Thu, 18 May 2023 12:30:08 +0000 (14:30 +0200)] 
Comment a bit on the xattr extraction logic

* src/extract.c (extract_file): Document why we pre-create with S_IWUSR.
(set_xattr): Drop the INVERT_PERMISSIONS doc leftover.

2 years agoFix --xattr-include='*' documentation
Pavel Raiskup [Tue, 6 Jun 2023 09:33:27 +0000 (12:33 +0300)] 
Fix --xattr-include='*' documentation

* doc/tar.texi (Extended File Attributes): The default extraction
pattern consists of just 'user.*' namespace only.  While on it, try
to explain the reasons for this default behavior.

2 years agoHonor --numeric-owner when storing ACL entries
Sergey Poznyakoff [Thu, 18 May 2023 10:35:50 +0000 (13:35 +0300)] 
Honor --numeric-owner when storing ACL entries

Based on patch from Fabian Grünbichler <f.gruenbichler@proxmox.com>

* src/xattrs.c (acls_get_text): New function.  If given --numeric-owner,
use acl_to_any_text to convert ACL to textual representation.  Print
warning if that function is not available.
(xattrs__acls_get_a, xattrs__acls_get_d): Use acls_get_text.

2 years agoUpgrade paxutils to d50ea31268
Sergey Poznyakoff [Thu, 18 May 2023 08:41:52 +0000 (11:41 +0300)] 
Upgrade paxutils to d50ea31268

This fixes two bugs related to remote archives:

1. Access from unprivileged user accounts.
2. Malfunctioning seek (L) command.

2 years agoDon't copy DISTFILES during bootstrapping
Sergey Poznyakoff [Thu, 18 May 2023 04:49:04 +0000 (07:49 +0300)] 
Don't copy DISTFILES during bootstrapping

DISTFILES are necessary only during bootstrapping and should not be
distributed.

This partially reverts commit 9f0e54ab2.

2 years agoAdd missing option to manpage and remove duplicate operation
Benno Schulenberg [Mon, 1 May 2023 09:42:04 +0000 (11:42 +0200)] 
Add missing option to manpage and remove duplicate operation

* doc/tar.1: Add needed option -f after operation -A, sort operation -t
  alphabetically, add --file after --concatenate, consistently use long
  option --file in the GNU-style section, and delete duplicate --update.
* doc/tar.texi: Add small missing word, and lowercase a letter.

2 years agoChange some wording in doc/intern.texi
Sergey Poznyakoff [Tue, 18 Apr 2023 08:15:44 +0000 (11:15 +0300)] 
Change some wording in doc/intern.texi

2 years agoExclude VCS directory with writing from an archive
Anton Makrushin [Mon, 20 Mar 2023 14:35:42 +0000 (20:05 +0530)] 
Exclude VCS directory with writing from an archive

See https://savannah.gnu.org/bugs/?62859

2 years agoDetect EOF when deleting from archive.
Sergey Poznyakoff [Tue, 21 Feb 2023 11:57:36 +0000 (13:57 +0200)] 
Detect EOF when deleting from archive.

See https://savannah.gnu.org/bugs/?63823

* src/delete.c (flush_file): Break the loop on EOF.
* tests/delete06.at: New test.
* tests/Makefile.am: Add new test.
* tests/testsuite.at: Likewise.

2 years agoChanges in extended header decoder
Sergey Poznyakoff [Sat, 11 Feb 2023 12:21:05 +0000 (14:21 +0200)] 
Changes in extended header decoder

* src/xheader.c (decode_time): Fix error detection.
(raw_path_decoder): Ignore empty paths.

2 years agoPrevent dead loop in extract_file
Sergey Poznyakoff [Sat, 11 Feb 2023 11:03:23 +0000 (13:03 +0200)] 
Prevent dead loop in extract_file

* src/extract.c (maybe_recoverable): If make_directories indicates
success, suppose some intermediate directories have been made, even
if in fact they have not.  That's necessary to avoid dead loops when
maybe_recoverable is called with the same arguments again.

2 years agoFix boundary checking in base-256 decoder
Sergey Poznyakoff [Sat, 11 Feb 2023 09:57:39 +0000 (11:57 +0200)] 
Fix boundary checking in base-256 decoder

* src/list.c (from_header): Base-256 encoding is at least 2 bytes
long.

2 years agoAdjust to Gnulib macro renaming
Paul Eggert [Fri, 6 Jan 2023 20:49:29 +0000 (12:49 -0800)] 
Adjust to Gnulib macro renaming

* src/Makefile.am, tests/Makefile.am (LDADD):
Gnulib renamed LIB_HAS_ACL to FILE_HAS_ACL_LIB.

2 years agobuild: update gnulib, paxutils submodules to latest
Paul Eggert [Fri, 6 Jan 2023 20:49:29 +0000 (12:49 -0800)] 
build: update gnulib, paxutils submodules to latest

2 years agoGo back to single-file bootstrap
Paul Eggert [Fri, 6 Jan 2023 20:47:09 +0000 (12:47 -0800)] 
Go back to single-file bootstrap

Gnulib now supports a single-file bootstrap with --pull
and --gen options, in place of the three files
autopull.sh, autogen.sh, bootstrap-funclib.sh.
This keeps the top level a bit cleaner.
* bootstrap: Sync from Gnulib build-aux/bootstrap
instead of from top/bootstrap.
* autopull.sh, autogen.sh, bootstrap-funclib.sh: Remove.

2 years agoFix ‘assume’ include
Paul Eggert [Fri, 6 Jan 2023 20:47:09 +0000 (12:47 -0800)] 
Fix ‘assume’ include

* src/tar.c: Include verify.h, needed for ‘assume’.

2 years agoUpdate copyright years
Paul Eggert [Fri, 6 Jan 2023 20:47:09 +0000 (12:47 -0800)] 
Update copyright years

UPDATE_COPYRIGHT_USE_INTERVALS=1 \
gnulib/build-aux/update-copyright \
  $(git ls-files | sed -e '/^gnulib$/d
                           /^paxutils$/d
   /^COPYING$/d
   /\/fdl.texi$/d')

2 years agoOptionally warn about missing zero blocks at the end of the archive
Sergey Poznyakoff [Thu, 29 Dec 2022 14:34:45 +0000 (16:34 +0200)] 
Optionally warn about missing zero blocks at the end of the archive

(In response to savannah bug #63574)

* doc/intern.texi: Document actual tar behaviour in regard to
missing end-of-file marker.
* doc/tar.texi: Rewrite the "warnings" section.  Document
--warning=missing-zero-blocks
* src/common.h (WARN_MISSING_ZERO_BLOCKS): New constant.
(WARN_ALL): Include all warning bits.
* src/list.c (read_and): If EOF is reached without seeing end-of-file
blocks and the "missing-zero-blocks" warning is requested, warn about
the fact.
* src/warning.c: New warnings: "missing-zero-blocks", "verbose".
(warning_option): Change definition to reflect changes in common.h

2 years agoFix example use of find command in documentation
Sergey Poznyakoff [Tue, 27 Dec 2022 11:02:05 +0000 (13:02 +0200)] 
Fix example use of find command in documentation

2 years agoFix savannah bug #63567
Sergey Poznyakoff [Mon, 26 Dec 2022 21:44:40 +0000 (23:44 +0200)] 
Fix savannah bug #63567

* src/buffer.c (short_read): Increase records_read only if a full
record has been read.

2 years agoFix -Af F bug when F is not a regular file
Paul Eggert [Fri, 4 Nov 2022 06:07:11 +0000 (23:07 -0700)] 
Fix -Af F bug when F is not a regular file

Problem reported by Boris Gjenero in:
https://lists.gnu.org/r/bug-tar/2022-11/msg00001.html
* src/update.c (append_file): Don’t assume that FILE_NAME is a
regular file whose size can be determined before reading.
Instead, simply read from the file until its end is reached.

2 years agoFix README-* files
Paul Eggert [Fri, 4 Nov 2022 05:56:18 +0000 (22:56 -0700)] 
Fix README-* files

README-alpha is for alpha releases, which are not from Git or CVS, so
omit mention of that.  I'm not sure we'll ever do alpha releases, but
if we do, README-alpha assumes the tarballs are already bit.

Update README-hacking with info that was mistakenly put into
README-alpha.  Also mention Bison, needed for parse-date.y.

2 years agoFix undefined behavior on bad extended header
Paul Eggert [Thu, 27 Oct 2022 20:14:52 +0000 (13:14 -0700)] 
Fix undefined behavior on bad extended header

* src/xheader.c (locate_handler): Avoid undefined behavior
if strlen(keyword) < kwlen.

2 years agoFix savannah bug #63123
Sergey Poznyakoff [Sat, 22 Oct 2022 09:06:45 +0000 (12:06 +0300)] 
Fix savannah bug #63123

The bug was introduced by commit 79d1ac38c1, which didn't take into
account all the consequences of returning RECOVER_OK on EEXIST, in
particular interactions with the delayed_set_stat logic.

The commit 79d1ac38c1 is reverted (the bug it was intended to fix
was actually fixed by 79a442d7b0).  Instead:

* src/extract.c (maybe_recoverable): Don't call maybe_recoverable
if EEXIST is reported when UNLINK_FIRST_OLD_FILES option is set.

2 years agoFix savannah bug #63250
Sergey Poznyakoff [Sat, 22 Oct 2022 08:14:53 +0000 (11:14 +0300)] 
Fix savannah bug #63250

* src/buffer.c (magic): Add signature of LZMA files produced by xz.

2 years agoMention previous bug fix
Paul Eggert [Fri, 7 Oct 2022 22:55:44 +0000 (15:55 -0700)] 
Mention previous bug fix

2 years agotests: check for recently-fixed bug
Paul Eggert [Fri, 7 Oct 2022 22:22:07 +0000 (15:22 -0700)] 
tests: check for recently-fixed bug

* tests/exclude17.at: New file.
* tests/testsuite.at (AT_CHECK_TIMESTAMP): Add it.

2 years agotar: fix --exclude-vcs-ignores memory
Aurélien Martin [Fri, 7 Oct 2022 19:08:40 +0000 (21:08 +0200)] 
tar: fix --exclude-vcs-ignores memory

The function frees the patterns' wordsplit structure without asking
add_exclude to reallocate the strings.  In many cases, this leads to
each file name in the directory being checked against the memory
location where it just got reallocated.
* src/exclist.c: Use EXCLUDE_ALLOC.
Copyright-paperwork-exempt: Yes

2 years agobuild: update submodules to latest
Paul Eggert [Sat, 10 Sep 2022 21:44:36 +0000 (16:44 -0500)] 
build: update submodules to latest

* src/common.h: Include <inttostr.h> since paxutils no longer does.
(STRINGIFY_BIGINT): New macro, copied from older paxutils.
(UINTMAX_STRSIZE_BOUND): New constant, also from older paxutils.

2 years agoFix bootstrap.conf when no paxutils
Paul Eggert [Sat, 10 Sep 2022 21:32:40 +0000 (16:32 -0500)] 
Fix bootstrap.conf when no paxutils

* bootstrap.conf: Don’t assume the paxutils subdirectory already
exists, when bootstrapping.

2 years agoFix data loss when acting as filter
Paul Eggert [Sat, 3 Sep 2022 23:22:34 +0000 (18:22 -0500)] 
Fix data loss when acting as filter

This bug was introduced by the recent lseek-related changes.
* src/delete.c (delete_archive_members):
* src/update.c (update_archive):
Copy the member if acting as a filter, rather than lseeking over
it, which is possible if stdin is a regular file.
* src/list.c (skim_file, skim_member):
* src/sparse.c (sparse_skim_file):
New functions, for copying when a filter.
* src/list.c (skip_file): Remove; replaced with skim_file.
All callers changed.
(skip_member): Reimplement in terms of skim_member.
* src/sparse.c (sparse_skip_file):
Remove; replaced with sparse_skim_file.  All callers changed.
* src/update.c (acting_as_filter): New static var.
(update_archive): Set it; this is like delete.c.
* tests/delete01.at (deleting a member after a big one):
* tests/delete02.at (deleting a member from stdin archive):
Also test filter case.

2 years agoFix --delete bug with short reads
Paul Eggert [Fri, 2 Sep 2022 21:32:27 +0000 (16:32 -0500)] 
Fix --delete bug with short reads

* gnulib.modules: Add idx.
* src/common.h: Include idx.h.
* src/delete.c (move_archive): Don’t botch short reads.

2 years agoDo not diagnose same xattr file twice
Paul Eggert [Fri, 26 Aug 2022 21:38:29 +0000 (16:38 -0500)] 
Do not diagnose same xattr file twice

* src/extract.c (set_xattr): Simplify, by having it do only
the mknodat and xattrs_xattrs_set, rather than also
trying to recover from failure.  Caller simplified too.
* tests/xattr07.at (xattrs: xattrs and --skip-old-files):
Adjust test to match fixed behavior.

2 years agoFix bug with -x --xattr read-only files
Paul Eggert [Fri, 26 Aug 2022 20:23:23 +0000 (15:23 -0500)] 
Fix bug with -x --xattr read-only files

Problem reported by Kevin Raymond in:
https://bugzilla.redhat.com/show_bug.cgi?id=1886540
* src/extract.c (open_output_file): If we already created the
empty file, do not open with O_EXCL, or with O_CREAT or O_TRUNC
for that matter.  Instead, use only O_NOFOLLOW to avoid some
races.  When estimating current mode, use openflag & O_EXCL rather
than overwriting_old_files.
(extract_file): Also invert S_IWUSR if it’s not set.
* tests/xattr08.at: New test.
* tests/Makefile.am, tests/testsuite.at: Add it.

2 years agoAvoid quadratic behavior with delayed links
Paul Eggert [Mon, 15 Aug 2022 07:05:53 +0000 (00:05 -0700)] 
Avoid quadratic behavior with delayed links

Do this by searching a hash table instead of a linked list.
Problem reported by Martin Dørum in https://mort.coffee/home/tar/
via Gavin Smith in:
https://lists.gnu.org/r/bug-tar/2022-07/msg00003.html
* src/extract.c: Include hash.h.
Improve performance a bit on non-birthtime hosts
(struct delayed_link.has_predecessor): New member.
(delayed_link_head): Remove, replacing with ...
(delayed_link_table): ... this new variable.  All uses
of linked list replaced with hash table.
(dl_hash, dl_compare): New functions for hash table.
(create_placeholder_file): Initialize has_predecessor.
(apply_delayed_link): New function, with body taken from
most of the old apply_delayed_link.
(apply_delayed_links): Use it.  Respect has_predecessor.
Don’t bother freeing as we are about to exit.

2 years agoImprove performance a bit on non-birthtime hosts
Paul Eggert [Mon, 15 Aug 2022 06:16:42 +0000 (23:16 -0700)] 
Improve performance a bit on non-birthtime hosts

* src/extract.c (HAVE_BIRTHTIME, BIRTHTIME_EQ): New macros.
(struct delayed_link, create_placeholder_file, extract_link)
(apply_delayed_links): Avoid unnecessary work on platforms
like GNU/Linux that lack birthtime.

2 years agoAvoid excess lseek etc.
Paul Eggert [Sun, 14 Aug 2022 23:32:26 +0000 (16:32 -0700)] 
Avoid excess lseek etc.

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

2 years agoOmit MS-DOS mentions in doc
Paul Eggert [Mon, 25 Jul 2022 23:15:20 +0000 (16:15 -0700)] 
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.

3 years agoWork around GCC bug 106436
Paul Eggert [Mon, 25 Jul 2022 16:41:49 +0000 (09:41 -0700)] 
Work around GCC bug 106436

* src/tar.c (optloc_eq): Use ‘assume’ to pacify GCC bug.

3 years agoAvoid unlikely crash when xasprintf returns 0
Paul Eggert [Sun, 24 Jul 2022 23:18:03 +0000 (16:18 -0700)] 
Avoid unlikely crash when xasprintf returns 0

Problem caught by GCC 12.
* src/tar.c (easprintf): New static function, which never returns
a null pointer.  All uses of xasprintf replaced by uses of this
function.

3 years agoUpdate .gitignore
Paul Eggert [Sun, 24 Jul 2022 22:50:36 +0000 (15:50 -0700)] 
Update .gitignore

* .gitignore: Redo for current sources.

3 years agoFix minor type confusion
Paul Eggert [Sun, 24 Jul 2022 21:51:12 +0000 (14:51 -0700)] 
Fix minor type confusion

* src/tar.c (decode_options): Don’t assign ‘false’ to a pointer.

3 years agoWork around GCC bug 106428
Paul Eggert [Sun, 24 Jul 2022 21:39:11 +0000 (14:39 -0700)] 
Work around GCC bug 106428

* src/names.c (read_next_name): Reword and clarify
to avoid GCC bug 106428.

3 years agoWork around GCC bug 106427
Paul Eggert [Sun, 24 Jul 2022 21:38:34 +0000 (14:38 -0700)] 
Work around GCC bug 106427

* lib/wordsplit.c (coalesce_segment): Reword to avoid
GCC bug 106427.

3 years agoAdjust to Gnulib bootstrap revamp
Paul Eggert [Sun, 24 Jul 2022 18:44:12 +0000 (11:44 -0700)] 
Adjust to Gnulib bootstrap revamp

* autogen.sh, autopull.sh, bootstrap-funclib.sh:
New files, copied from gnulib/top.
* bootstrap: Copy from gnulib/top/bootstrap (as opposed
to copying from gnulib/build-aux/bootstrap, as we used to).
* bootstrap.conf (bootstrap_post_pull_hook)
(bootstrap_post_import_hook): New functions.
Move commands into these functions as needed.

3 years ago* doc/tar.1: Fix --xattrs-exclude typo.
Paul Eggert [Mon, 11 Jul 2022 15:34:25 +0000 (10:34 -0500)] 
* doc/tar.1: Fix --xattrs-exclude typo.

3 years agoAvoid EOVERFLOW problems in some symlink tests
Paul Eggert [Tue, 14 Jun 2022 00:02:54 +0000 (17:02 -0700)] 
Avoid EOVERFLOW problems in some symlink tests

* src/extract.c (is_directory_link): New arg ST.  Caller changed.
(is_directory_link, open_output_file):
Use readlinkat, not fstatat, to determine whether a string
names a symlink.  This avoids EOVERFLOW issues.
(extract_dir): Avoid duplicate calls to fstatat when
keep_directory_symlink_option && fstatat_flags == 0
and the file is a symlink to an existing file.

3 years agoFix ‘make dist-xz’ bug
Paul Eggert [Mon, 13 Jun 2022 23:49:55 +0000 (16:49 -0700)] 
Fix ‘make dist-xz’ bug

Problem reported by Pavel Raiskup in:
https://lists.gnu.org/r/bug-tar/2022-06/msg00014.html
* bootstrap.conf (copy_files): Also copy DISTFILES.

3 years agoFix commentary in new test case
Paul Eggert [Mon, 13 Jun 2022 21:56:45 +0000 (14:56 -0700)] 
Fix commentary in new test case

3 years agoFix doc -c typo
Paul Eggert [Mon, 13 Jun 2022 03:33:09 +0000 (20:33 -0700)] 
Fix doc -c typo

https://lists.gnu.org/r/bug-tar/2022-06/msg00006.html
* doc/tar.texi (Extended File Attributes): Fix typo.

3 years agoUpdate to current Autoconf & Gettext
Paul Eggert [Mon, 13 Jun 2022 00:51:35 +0000 (17:51 -0700)] 
Update to current Autoconf & Gettext

* acinclude.m4, configure.ac:
Use AS_HELP_STRING, not AC_HELP_STRING.
* bootstrap: Sync from Gnulib.
* configure.ac: Require Autoconf 2.71 and Gettext 0.21.
Use AC_PROG_CC, not AC_PROG_CC_STDC.
Prefer AC_COMPILE_IFELSE to AC_TRY_COMPILE.
Use AC_CONFIG_FILES.
* gnulib.modules: Use gettext-h, not gettext.

3 years agobuild: update gnulib and paxutils submodules to latest
Paul Eggert [Sun, 12 Jun 2022 21:14:13 +0000 (14:14 -0700)] 
build: update gnulib and paxutils submodules to latest

3 years agotar: fix race condition
James Abbatiello [Sat, 11 Jun 2022 01:25:13 +0000 (18:25 -0700)] 
tar: fix race condition

Problem reported in:
https://lists.gnu.org/r/bug-tar/2022-03/msg00000.html
* src/extract.c (make_directories): Retry the file creation as
long as the directory exists, regardless of whether tar itself
created the directory.
Copyright-paperwork-exempt: Yes

3 years agotar: fix race condition
Paul Eggert [Fri, 10 Jun 2022 05:09:34 +0000 (22:09 -0700)] 
tar: fix race condition

Problem reported by James Abbatiello in:
https://lists.gnu.org/r/bug-tar/2022-03/msg00000.html
* src/extract.c (make_directories): Do not assume that when
mkdirat fails with errno == EEXIST that there is an existing file
that can be statted.  It could be a dangling symlink.  Instead,
wait until the end and stat it.

3 years agotest: new test extrac25.at
Paul Eggert [Fri, 10 Jun 2022 22:12:17 +0000 (15:12 -0700)] 
test: new test extrac25.at

* tests/Makefile.am (TESTSUITE_AT): Add extrac25.at.
* tests/extrac25.at: New file.
* tests/testsuite.at: Include it.

3 years agoWarn “file changed as we read it” less often
Paul Eggert [Thu, 9 Jun 2022 22:50:06 +0000 (15:50 -0700)] 
Warn “file changed as we read it” less often

* src/create.c (dump_file0): Remove an fstatat call that is
unnecessary because the file wasn’t read so we can treat the first
fstatat as atomic.  Warn “file changed” when the file’s size,
mtime, user ID, group ID, or mode changes, instead of when the
file’s size or ctime changes.  Also, when such a change happens,
do not change exit status if --ignore-failed-read.  Finally, don’t
attempt to change atime back if it didn’t change.

3 years agoModernize NEWS hook to current Emacs
Paul Eggert [Thu, 9 Jun 2022 21:42:14 +0000 (14:42 -0700)] 
Modernize NEWS hook to current Emacs

3 years agodoc: fix abrupt sentence in HTML
Paul Eggert [Tue, 3 May 2022 22:25:03 +0000 (15:25 -0700)] 
doc: fix abrupt sentence in HTML

Typo reported by Jackson Dougherty in:
https://lists.gnu.org/r/bug-tar/2022-05/msg00000.html
* doc/tar.texi: Don’t assume that tex and info are the only two
formats.

3 years agotar: revamp "file is the archive" diagnostic
Paul Eggert [Wed, 16 Feb 2022 01:40:34 +0000 (17:40 -0800)] 
tar: revamp "file is the archive" diagnostic

* src/create.c (dump_file0): For clarity, change diagnostic
wording from "file is the archive; not dumped" to "archive cannot
contain itself; not dumped".  All test cases and documentation changed.

3 years agoUpdate copyright years
Sergey Poznyakoff [Sun, 2 Jan 2022 08:25:29 +0000 (10:25 +0200)] 
Update copyright years

3 years agoCopy COPYING and fdl.texi from upstream
Paul Eggert [Mon, 13 Dec 2021 23:45:52 +0000 (15:45 -0800)] 
Copy COPYING and fdl.texi from upstream

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.