]> git.ipfire.org Git - thirdparty/tar.git/log
thirdparty/tar.git
12 months agoBetter overflow checking for blocking factor
Paul Eggert [Tue, 30 Jul 2024 15:31:45 +0000 (08:31 -0700)] 
Better overflow checking for blocking factor

* src/tar.c (parse_opt): Use ckd_add and ckd_mul instead of
less-obvious code that relies on implementation-defined
conversions.

12 months agoxsparse cleanup, including integer overflow
Paul Eggert [Tue, 30 Jul 2024 03:56:27 +0000 (20:56 -0700)] 
xsparse cleanup, including integer overflow

* scripts/xsparse.c: Include inttypes.h, for strtoimax.
Don’t include stdint.h, since inttypes.h includes it.
Sort include directives.
Make all extern functions and vars static, except for ‘main’.
(string_to_off): Use strtoimax instead of doing overflow
checking by hand, incorrectly (it relied on undefined behavior).
(string_to_size): New arg MAXSIZE.  All callers changed.
(get_var): Return bool not int.  Fix unlikely integer overflow.
Use strncmp instead of memcmp, to avoid unlikely pointer overflow.
(read_xheader, read_map, main): Avoid unlikely integer overflow.
Check for I/O errors more consistently.
(main): Prefer bool to int, and put vars near use.

12 months agomaint: fix some unlikely wordsplit overflows
Paul Eggert [Mon, 29 Jul 2024 22:36:47 +0000 (15:36 -0700)] 
maint: fix some unlikely wordsplit overflows

* gnulib.modules: Add reallocarray.
* lib/wordsplit.c: Include stdckdint.h.
(ISDELIM, expvar, isglob, scan_word):
Defend against strchr (s, 0) always succeeding.
(alloc_space, wsplit_assign_vars):
Fix some unlikely integer overflows, partly by using reallocarray.
(alloc_space): Avoid quadratic worst-case behavior.
(isglob): Return bool, not int.  Accept size_t, not int.
(to_num): Remove; no longer used.
(xtonum): Clarify the code the bit.  Rely on portable
conversion to unsigned char rather than problematic pointer cast.

12 months agomaint: prefer C23 if available
Paul Eggert [Sun, 28 Jul 2024 20:51:45 +0000 (13:51 -0700)] 
maint: prefer C23 if available

* gnulib.modules: Add std-gnu23.

12 months agoAdd some gnulib.modules
Paul Eggert [Sun, 28 Jul 2024 20:50:37 +0000 (13:50 -0700)] 
Add some gnulib.modules

* gnulib.modules: Add errno, limits-h, safe-read, sys_stat.
Not sure about the relationship between gnulib.modules
and paxutils/gnulib.modules, but anyway tar itself uses
these so we should depend on them.  (Perhaps it would be
better if there was just one Gnulib module list for tar;
that would be less confusing.)

12 months agobuild: update gnulib and paxutils submodules to latest
Paul Eggert [Sun, 28 Jul 2024 00:59:59 +0000 (17:59 -0700)] 
build: update gnulib and paxutils submodules to latest

12 months agoPacify gcc 14 -Wanalyzer-null-argument
Paul Eggert [Sat, 27 Jul 2024 07:26:15 +0000 (00:26 -0700)] 
Pacify gcc 14 -Wanalyzer-null-argument

* src/tar.c (optloc_eq): Add another ‘assume’.

12 months agoPacify gcc 14 -Wanalyzer-infinite-loop
Paul Eggert [Sat, 27 Jul 2024 07:05:49 +0000 (00:05 -0700)] 
Pacify gcc 14 -Wanalyzer-infinite-loop

* gnulib.modules: Add stddef, for ‘unreachable’.
* src/compare.c (dumpdir_cmp): Tell GCC that the default case
is unreachable.  Make just one pass through the string,
instead of two passes (one via strcmp, another via strlen).

12 months agomaint: make a few funcs and vars static
Paul Eggert [Sat, 27 Jul 2024 06:42:59 +0000 (23:42 -0700)] 
maint: make a few funcs and vars static

* src/buffer.c (last_stat_time, write_fatal_details):
* src/tar.c (name_more_files):
* src/xattrs.c (xheader_xattr_add):
Now static.

12 months agomaint: remove GLOBAL as per GCC 14
Paul Eggert [Sat, 27 Jul 2024 06:26:24 +0000 (23:26 -0700)] 
maint: remove GLOBAL as per GCC 14

* src/common.h (GLOBAL): Remove this macro, and all its uses.
It collides with GCC 14 and -Wmissing-variable-declarations.
Change all uses of GLOBAL to use extern instead,
and declare the variables in their respective .c files.
Move .c file’s extern declarations here, so that they
appear only once and are checked against definitions.
* src/names.c (unconsumed_option_tail): Now static.

12 months agoModernize use of Gnulib, paxutils
Paul Eggert [Sat, 27 Jul 2024 04:55:31 +0000 (21:55 -0700)] 
Modernize use of Gnulib, paxutils

* configure.ac: Omit stuff no longer needed now that Gnulib or
paxlib does it, or the code no longer needs the configure-time checks.
Do not use AC_SYS_LARGEFILE (Gnulib largefile does this) or check
for fcntl.h, memory.h, net/errno.h, sgtty.h, string.h,
sys/param.h, sys/device.h, sys/gentape.h, sys/inet.h,
sys/io/trioctl.h, sys/time.h, sys/tprintf.h, sys/tape.h, unistd.h,
locale.h, netdb.h; these are all now standard, or old ways of getting
at magtapes are no longer needed and we now have only sys/mtio.h.
Do not check for lstat, readlink, symlink, and check only for
waitpid’s existence rather than attempting to replace it.
Do not check for decls of getgrgid, getpwuid, or time.
Check just once for iconv.h.
* gnulib.modules: Add largefile.
* lib/.gitignore, lib/Makefile.am (noinst_HEADERS, libtar_a_SOURCES):
Remove system-ioctl.h, which is no longer in paxlib.
All includes now changed to just check HAVE_SYS_MTIO_H directly.
* lib/wordsplit.c (wordsplit_c_escape_tab, wordsplit_errstr)
(wordsplit_nerrs):
Now static or an enum, and without any leading "_" in the name.
* src/buffer.c (record_start, record_end, current_block, records_read):
* src/delete.c (records_skipped): Add extern decl to pacify GCC.
* src/compare.c, src/create.c, src/extract.c: Omit uses of
HAVE_READLINK and HAVE_SYMLINK since we now let Gnulib deal with
platforms lacking readlinkat and symlinkat.
* src/system.c: Use "#if !HAVE_WAITPID" instead of "#if MSDOS".

12 months agobuild: update gnulib and paxutils submodules to latest
Paul Eggert [Fri, 26 Jul 2024 20:27:46 +0000 (13:27 -0700)] 
build: update gnulib and paxutils submodules to latest

12 months agomaint: higher-precision checkpoint timestamps
Paul Eggert [Wed, 24 Jul 2024 16:45:46 +0000 (09:45 -0700)] 
maint: higher-precision checkpoint timestamps

* src/checkpoint.c (format_checkpoint_string):
Use current_timespec to get nanosecond resolution.
This also frees us from the necessity of including <sys/time.h>
to use gettimeofday, which is removed in POSIX.1-2024.

12 months agobuild: update gnulib and paxutils submodules to latest
Paul Eggert [Wed, 24 Jul 2024 02:54:08 +0000 (19:54 -0700)] 
build: update gnulib and paxutils submodules to latest

12 months agoSync bootstrap from Gnulib
Paul Eggert [Wed, 24 Jul 2024 02:52:33 +0000 (19:52 -0700)] 
Sync bootstrap from Gnulib

12 months agoSync bootstrap from Gnulib
Paul Eggert [Mon, 15 Jul 2024 21:53:10 +0000 (14:53 -0700)] 
Sync bootstrap from Gnulib

12 months agomaint: adjust to Gnulib -Wsystem-headers change
Paul Eggert [Mon, 15 Jul 2024 21:51:53 +0000 (14:51 -0700)] 
maint: adjust to Gnulib -Wsystem-headers change

* configure.ac: Do not suppress -Wsystem-headers, as
Gnulib no longer enables it.

12 months agobuild: update gnulib submodule to latest
Paul Eggert [Mon, 15 Jul 2024 21:50:55 +0000 (14:50 -0700)] 
build: update gnulib submodule to latest

14 months agoVarious formatting fixes
Sergey Poznyakoff [Thu, 6 Jun 2024 21:05:00 +0000 (00:05 +0300)] 
Various formatting fixes

14 months agoFix spurious diagnostic during extraction of . with --keep-newer-files
Sergey Poznyakoff [Wed, 5 Jun 2024 15:19:10 +0000 (18:19 +0300)] 
Fix spurious diagnostic during extraction of . with --keep-newer-files

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

Bug introduced by 79d1ac38c1.

* src/extract.c (make_directories): Restore second argument.  This
reverts the change made in 79d1ac38c1.
(maybe_recoverable, rename_directory): Update calls to make_directories.
* tests/extrac27.at: New file.
* tests/Makefile.am: Add new test.
* tests/testsuite.at: Likewise.

17 months agotar: fix current_block confusion
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.

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

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

18 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

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

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

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

18 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

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

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

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

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

19 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

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

19 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

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

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

22 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).

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

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

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

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

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

23 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

23 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

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

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

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

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

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

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

23 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

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

2 years 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.

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