]> git.ipfire.org Git - thirdparty/tar.git/log
thirdparty/tar.git
7 weeks agotar: fix current_block confusion master
Paul Eggert [Sun, 3 Mar 2024 21:27:32 +0000 (13:27 -0800)] 
tar: fix current_block confusion

Problem reported by Robert Morris in:
https://lists.gnu.org/r/bug-tar/2024-03/msg00001.html
* src/delete.c (flush_file): Simply return at EOF,
so that current_block continues to point to end of input.

7 weeks agotar: fix unlikely overflow
Paul Eggert [Sun, 3 Mar 2024 21:20:23 +0000 (13:20 -0800)] 
tar: fix unlikely overflow

* src/delete.c (flush_file): Fix arithmetic overflow if
TYPE_MAXIMUM (off_t) - BLOCKSIZE < current_stat_info.stat.st_size.

7 weeks agotar: improve diagnostic for truncated archive
Paul Eggert [Sun, 3 Mar 2024 21:17:32 +0000 (13:17 -0800)] 
tar: improve diagnostic for truncated archive

* src/buffer.c (seek_archive): If EOF has been read, don’t attempt
to seek past it.  This replaces a bogus "rmtlseek not stopped at a
record boundary" message with a better "Unexpected EOF in archive"
when I run ‘tar tvf gtar13c.tar’ using the gtar13.tar file here:
https://lists.gnu.org/r/bug-tar/2024-03/msg00001.html

3 months agoAvoid gcc 13 "unused parameter" warnings
Sergey Poznyakoff [Tue, 16 Jan 2024 12:28:19 +0000 (14:28 +0200)] 
Avoid gcc 13 "unused parameter" warnings

3 months agoRecognize suffixes .z (gzip) and .tzo (lzop)
Sergey Poznyakoff [Mon, 15 Jan 2024 20:52:27 +0000 (22:52 +0200)] 
Recognize suffixes .z (gzip) and .tzo (lzop)

3 months agoFix description of the CACHEDIR.TAG file.
Sergey Poznyakoff [Mon, 15 Jan 2024 20:26:06 +0000 (22:26 +0200)] 
Fix description of the CACHEDIR.TAG file.

3 months agoFix --exclude-ignore option.
Sergey Poznyakoff [Mon, 15 Jan 2024 19:24:34 +0000 (21:24 +0200)] 
Fix --exclude-ignore option.

This fixes https://savannah.gnu.org/bugs/?64387.

* src/exclist.c (info_attach_exclist): Always use file->flags.
(exclude_vcs_ignores): Pass flags from struct vcs_ignore_file
to excfile_add.

* tests/exclude19.at: New test.
* tests/exclude20.at: New test.
* tests/Makefile.am: Add new tests.
* tests/testsuite.at: Add new tests.

3 months agoFix missing space in the manual
Sergey Poznyakoff [Mon, 15 Jan 2024 18:21:26 +0000 (20:21 +0200)] 
Fix missing space in the manual

3 months agoWhen given -c -a, issue a warning if no compressor is associated with the suffix.
Sergey Poznyakoff [Sun, 14 Jan 2024 21:54:33 +0000 (23:54 +0200)] 
When given -c -a, issue a warning if no compressor is associated with the suffix.

* src/suffix.c (find_compression_suffix): Always return stripped
archive name length in the last argument.  Return 0 if there is no
suffix.
(find_compression_program): Remove.
(set_compression_program_by_suffix): Take third argument, controlling
whether to issue a warning if no suitable compression program is found
for the suffix.
* src/common.h (set_compression_program_by_suffix): Change prototype.
* src/buffer.c, src/tar.c: All uses of set_compression_program_by_suffix
changed.

3 months agoPort EOF detection test to macOS
Paul Eggert [Tue, 2 Jan 2024 03:09:59 +0000 (19:09 -0800)] 
Port EOF detection test to macOS

* tests/delete06.at: Don’t assume the diagnostic is
“Value too large for defined data type”, as strerror
uses a different wording on macOS 12.6.

3 months agoSkip test on macOS 12.6
Paul Eggert [Tue, 2 Jan 2024 03:09:59 +0000 (19:09 -0800)] 
Skip test on macOS 12.6

* tests/xform04.at: Skip test on macOS 12.6, which is behind the times
and doesn’t think that ⱥ (U+2C65 LATIN SMALL LETTER A WITH STROKE) is
printable.

3 months agoPort --numeric-owner basic tests to macOS
Paul Eggert [Tue, 2 Jan 2024 03:09:59 +0000 (19:09 -0800)] 
Port --numeric-owner basic tests to macOS

* tests/numeric.at: If chown fails, skip the test.
This is needed on macOS 12.6 if the user has group
ID 4294967295 (nogroup), which chown rejects.

3 months agoUpdate copyright years
Paul Eggert [Tue, 2 Jan 2024 03:01:15 +0000 (19:01 -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')
sed -i '2000,${
    /^Copyright @copyright/d
    s/^[0-9]*--\(2024 Free Software Foundation, Inc.\)/Copyright (C) \1/
  }' doc/tar.texi

3 months agodoc: fix date in example
Paul Eggert [Tue, 2 Jan 2024 02:54:58 +0000 (18:54 -0800)] 
doc: fix date in example

* doc/tar.texi: Fix copyright date in example.

3 months agobuild: update gnulib submodule to latest
Paul Eggert [Tue, 2 Jan 2024 02:35:11 +0000 (18:35 -0800)] 
build: update gnulib submodule to latest

7 months agoSupport multi-byte --transform='...\L...' etc
Paul Eggert [Wed, 13 Sep 2023 04:21:18 +0000 (23:21 -0500)] 
Support multi-byte --transform='...\L...' etc

Support upcasing and downcasing in multi-byte locales.
* gnulib.modules: Add c32rtomb, c32tolower, c32toupper,
mbrtoc32-regular.
* src/transform.c: Do not include ctype.h.  Include mcel.h.
(stk, stk_init): Move up.
(run_case_conv): Return void, not char *.  Append result to
stk directly; this avoids the need for a separate allocation.
All callers changed.  Do not assume a single-byte locale.
* tests/xform04.at: New test.
* tests/Makefile.am (TESTSUITE_AT):
* tests/testsuite.at: Add it.

7 months agoSimplify wordsplit_string_unquote_copy
Paul Eggert [Tue, 12 Sep 2023 05:33:55 +0000 (00:33 -0500)] 
Simplify wordsplit_string_unquote_copy

* lib/wordsplit.c (wordsplit_string_unquote_copy): Simplify.

7 months agoParse in a more locale-independent way
Paul Eggert [Tue, 12 Sep 2023 05:15:52 +0000 (00:15 -0500)] 
Parse in a more locale-independent way

update submodules to latest
* gnulib.modules: Add c-ctype.
* lib/wordsplit.c, src/buffer.c, src/exclist.c, src/incremen.c:
* src/list.c, src/misc.c, src/names.c, src/sparse.c, src/tar.c:
* src/xheader.c:
Include c-ctype.h, and use its API rather than ctype.h’s.
This is more likely to work when oddball locales are used.
* src/transform.c: Include ctype.h, since this module still uses
tolower and toupper (this is probably wrong - should be multi-byte).

7 months agoUse single is_octal_digit function
Paul Eggert [Tue, 12 Sep 2023 05:33:15 +0000 (00:33 -0500)] 
Use single is_octal_digit function

* src/list.c (ISOCTAL): Remove.
(is_octal_digit): New static function.
All uses of ISOCTAL and ISODIGIT replaced with is_octal_digit.

7 months agomaint: fix THANKS misspellings
Paul Eggert [Mon, 11 Sep 2023 14:32:18 +0000 (09:32 -0500)] 
maint: fix THANKS misspellings

* THANKS: Fix recently-introduced misspellings.

7 months agoFix pointer bug in drop_volume_label_suffix
Paul Eggert [Mon, 11 Sep 2023 06:17:02 +0000 (01:17 -0500)] 
Fix pointer bug in drop_volume_label_suffix

Problem reported by Marc Espie in:
https://lists.gnu.org/r/bug-tar/2023-09/msg00003.html
* src/buffer.c (drop_volume_label_suffix):
Redo to not compute a pointer before the start of a buffer,
as this is not portable.

7 months agoquote unknown header keywords in diagnostics
Paul Eggert [Mon, 11 Sep 2023 06:17:02 +0000 (01:17 -0500)] 
quote unknown header keywords in diagnostics

* src/xheader.c (decx): Quote unknown header in warning, as it may
contain control characters.  Problem reported by Wicher Minnaard.

7 months agoPrefer mcel to mbuiter
Paul Eggert [Sun, 10 Sep 2023 17:10:52 +0000 (10:10 -0700)] 
Prefer mcel to mbuiter

Prefer the lighter-weight mcel implementation to the heavier-weight
mbuiter that GNU tar does not need.
* bootstrap.conf (avoided_gnulib_modules): Avoid mbuiter, mbuiterf.
* gnulib.modules: Add mcel-prefer.

7 months agobuild: update gnulib submodule to latest
Paul Eggert [Sun, 10 Sep 2023 16:38:29 +0000 (09:38 -0700)] 
build: update gnulib submodule to latest

7 months ago.gitmodules: switch to HTTPS
Markus Mayer [Thu, 7 Sep 2023 20:30:58 +0000 (13:30 -0700)] 
.gitmodules: switch to HTTPS

HTTPS is not only encrypted but also better suited for corporate
firewalls. Let's use it to clone submodules.
Copyright-paperwork-exempt: yes

8 months agodocs: replace references to fileutils with coreutils.
Sergey Poznyakoff [Tue, 22 Aug 2023 20:55:09 +0000 (23:55 +0300)] 
docs: replace references to fileutils with coreutils.

GNU fileutils is decommissioned and superseded by coreutils.
This fixes Savannah bug #64495.

8 months agoFix Savane bug #64581
Sergey Poznyakoff [Tue, 22 Aug 2023 15:18:31 +0000 (18:18 +0300)] 
Fix Savane bug #64581

This reverts commit 4f3824743f50808a0079e6057107de53c4a25f22.

8 months agoBump extrac26 timeout
Paul Eggert [Mon, 21 Aug 2023 20:41:42 +0000 (13:41 -0700)] 
Bump extrac26 timeout

* tests/extrac26.at: Increase timeout from 15 to 60 s.
On my old machine it took 15 s.

8 months agoSimplify recently-added hash code
Paul Eggert [Mon, 21 Aug 2023 20:40:37 +0000 (13:40 -0700)] 
Simplify recently-added hash code

* src/extract.c (delay_set_stat): Simplify hash lookup;
no need to initialize members other than file_name.
Avoid assignment in ‘if’ when it’s easy.
(extract_finish): Do not bother to free when we are about to exit.

8 months agoFix O(n^2) time bug in --delay-directory-restore
Benjamin Woodruff [Mon, 21 Aug 2023 20:06:45 +0000 (13:06 -0700)] 
Fix O(n^2) time bug in --delay-directory-restore

delayed_set_stat avoids inserting duplicate entries into
delayed_set_stat_head. It was doing this by scanning the entire
list.

Normally this list is small, but if --delay-directory-restore is
used (including automatically for incremental archives), this list
grows with the total number of directories in the archive.

The entire scan takes O(n) time. Extracting an archive with n
directories could therefore take O(n^2) time.

The included test uses AT_SKIP_LARGE_FILES, allowing it to optionally be
skipped. It may execute slowly on certain filesystems or disks, as it
creates thousands of directories.

There are still potentially problematic O(n) scans in
find_direct_ancestor and remove_delayed_set_stat, which this patch does
not attempt to fix.

* NEWS: Update.
* src/extract.c (delayed_set_stat_table): Create a table for O(1)
lookups of entries in the delayed_set_stat_head list. The list
remains, as tracking insertion order is important.
(dl_hash, dl_compare): New hash table helper functions.
(delay_set_stat): Create the hash table, replace the O(n) list scan
with a hash_lookup, insert new entries into the hash table.
(remove_delayed_set_stat): Also remove entry from hash table.
(apply_nonancestor_delayed_set_stat): Also remove entry from hash
table.
(extract_finish): Free the (empty) hash table.
* tests/extrac26.at: New file.
* tests/Makefile.am (TESTSUITE_AT): Include extrac26.at.
* tests/testsuite.at: Include extrac26.at.

8 months agoPacify gcc -Wanalyzer-fd-use-without-check
Paul Eggert [Mon, 21 Aug 2023 19:52:14 +0000 (12:52 -0700)] 
Pacify gcc -Wanalyzer-fd-use-without-check

* src/system.c (sys_exec_setmtime_script):
Treat fds with more care.

8 months agobuild: update gnulib submodule to latest
Paul Eggert [Mon, 21 Aug 2023 19:36:34 +0000 (12:36 -0700)] 
build: update gnulib submodule to latest

8 months agoRevert "Fix savannah bug #63567"
Sergey Poznyakoff [Fri, 11 Aug 2023 18:35:30 +0000 (21:35 +0300)] 
Revert "Fix savannah bug #63567"

Commit e89c7a45eb broke deletion from archives. The reported number
of bytes read is rounded to the nearest record anyway, revert the
commit and document the fact.

Reported by Ed Santiago. See
https://bugzilla.redhat.com/show_bug.cgi?id=2230127

* doc/tar.texi: Document the fact that --totals rounds up the
number of bytes reads to the nearest record.
* src/buffer.c: Revert changes.
* tests/delete06.at: Fix expected status code and stderr.

8 months agoStop using alloca
Paul Eggert [Wed, 2 Aug 2023 15:41:12 +0000 (08:41 -0700)] 
Stop using alloca

* gnulib.modules: Remove alloca.
* src/create.c (dump_file0): Return address of any allocated
storage.  Caller changed to free it.  Use xmalloc instead
of alloca, to obtain this storage.
* src/list.c (from_header): Use quote_mem instead of quote,
removing the need to use alloca.

8 months 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.

9 months 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.

9 months 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.

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

9 months 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.

9 months 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).

9 months 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

9 months 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

9 months 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.

9 months 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.

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

9 months 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.

9 months 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.

9 months 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.

9 months 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.

9 months 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

10 months 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.

10 months 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.

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

10 months 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.

10 months 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.

10 months 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.

10 months 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.

10 months 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.

10 months 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.

10 months 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

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

10 months 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

10 months 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.

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

10 months 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.

10 months 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.

11 months 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.

11 months 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.

11 months 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.

11 months 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.

12 months 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

12 months 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

14 months 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.

14 months 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.

14 months 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.

14 months 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.

15 months 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.

15 months 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

15 months 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.

15 months 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’.

15 months 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')

15 months 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

15 months 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

15 months 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.

17 months 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.

17 months 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.

17 months 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.

18 months 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.

18 months 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.

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

18 months 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.

18 months 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

19 months 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.

19 months 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.

19 months 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.

19 months 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.

19 months 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.

19 months 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.

20 months 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.

20 months 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.