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".
This commit is contained in:
Paul Eggert
2024-07-26 21:56:20 -07:00
parent 4e0deb7416
commit 9f1c32c18b
11 changed files with 40 additions and 56 deletions
+4
View File
@@ -52,10 +52,14 @@ static int record_index;
/* FIXME: The following variables should ideally be static to this
module. However, this cannot be done yet. The cleanup continues! */
extern union block *record_start;
union block *record_start; /* start of record of archive */
extern union block *record_end;
union block *record_end; /* last+1 block of archive record */
extern union block *current_block;
union block *current_block; /* current block of archive */
enum access_mode access_mode; /* how do we handle the archive */
extern off_t records_read;
off_t records_read; /* number of records read from this archive */
off_t records_written; /* likewise, for records written */
extern off_t records_skipped; /* number of records skipped at the start
+5 -5
View File
@@ -20,12 +20,16 @@
Written by John Gilmore, on 1987-04-30. */
#include <system.h>
#include <system-ioctl.h>
#if HAVE_LINUX_FD_H
# include <linux/fd.h>
#endif
#if HAVE_SYS_MTIO_H
# include <sys/ioctl.h>
# include <sys/mtio.h>
#endif
#include "common.h"
#include <quotearg.h>
#include <rmt.h>
@@ -267,7 +271,6 @@ diff_link (void)
current_stat_info.link_name));
}
#ifdef HAVE_READLINK
static void
diff_symlink (void)
{
@@ -293,7 +296,6 @@ diff_symlink (void)
if (linkbuf != buf)
free (linkbuf);
}
#endif
static void
diff_special (void)
@@ -496,11 +498,9 @@ diff_archive (void)
diff_link ();
break;
#ifdef HAVE_READLINK
case SYMTYPE:
diff_symlink ();
break;
#endif
case CHRTYPE:
case BLKTYPE:
-2
View File
@@ -1870,7 +1870,6 @@ dump_file0 (struct tar_stat_info *st, char const *name, char const *p)
return allocated;
}
#ifdef HAVE_READLINK
else if (S_ISLNK (st->stat.st_mode))
{
st->link_name = areadlinkat_with_size (parentfd, name, st->stat.st_size);
@@ -1905,7 +1904,6 @@ dump_file0 (struct tar_stat_info *st, char const *name, char const *p)
file_count_links (st);
return allocated;
}
#endif
else if (S_ISCHR (st->stat.st_mode))
{
type = CHRTYPE;
+1
View File
@@ -37,6 +37,7 @@ extern off_t records_read;
/* The number of records skipped at the start of the archive, when
passing over members that are not deleted. */
extern off_t records_skipped;
off_t records_skipped;
/* Move archive descriptor by COUNT records worth. If COUNT is
+13 -14
View File
@@ -1587,7 +1587,6 @@ extract_link (char *file_name, MAYBE_UNUSED int typeflag)
static int
extract_symlink (char *file_name, MAYBE_UNUSED int typeflag)
{
#ifdef HAVE_SYMLINK
bool interdir_made = false;
if (! absolute_names_option
@@ -1605,6 +1604,19 @@ extract_symlink (char *file_name, MAYBE_UNUSED int typeflag)
return 0;
case RECOVER_NO:
if (!implemented (errno))
{
static bool warned;
if (!warned)
{
warned = true;
WARNOPT (WARN_SYMLINK_CAST,
(0, 0,
_("Attempting extraction of symbolic links"
" as hard links")));
}
return extract_link (file_name, typeflag);
}
symlink_error (current_stat_info.link_name, file_name);
return -1;
}
@@ -1612,19 +1624,6 @@ extract_symlink (char *file_name, MAYBE_UNUSED int typeflag)
set_stat (file_name, &current_stat_info, -1, 0, 0,
SYMTYPE, false, AT_SYMLINK_NOFOLLOW);
return 0;
#else
static int warned_once;
if (!warned_once)
{
warned_once = 1;
WARNOPT (WARN_SYMLINK_CAST,
(0, 0,
_("Attempting extraction of symbolic links as hard links")));
}
return extract_link (file_name, typeflag);
#endif
}
#if S_IFCHR || S_IFBLK
+6 -2
View File
@@ -16,7 +16,11 @@
with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <system.h>
#include <system-ioctl.h>
#if HAVE_SYS_MTIO_H
# include <sys/ioctl.h>
# include <sys/mtio.h>
#endif
#include "common.h"
#include <priv-set.h>
@@ -69,7 +73,7 @@ mtioseek (bool count_files, off_t count)
return false;
}
#if MSDOS
#if !HAVE_WAITPID /* MingW, MSVC 14. */
bool
sys_get_archive_stat (void)