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:
28
configure.ac
28
configure.ac
@@ -34,19 +34,7 @@ AC_PROG_YACC
|
|||||||
gl_EARLY
|
gl_EARLY
|
||||||
AC_CHECK_TOOLS([AR], [ar])
|
AC_CHECK_TOOLS([AR], [ar])
|
||||||
|
|
||||||
AC_SYS_LARGEFILE
|
AC_CHECK_HEADERS_ONCE([linux/fd.h sys/mtio.h])
|
||||||
|
|
||||||
AC_CHECK_HEADERS_ONCE(fcntl.h linux/fd.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/mtio.h sys/time.h sys/tprintf.h sys/tape.h \
|
|
||||||
unistd.h locale.h)
|
|
||||||
|
|
||||||
AC_CHECK_HEADERS([sys/buf.h], [], [],
|
|
||||||
[#if HAVE_SYS_PARAM_H
|
|
||||||
#include <sys/param.h>
|
|
||||||
#endif])
|
|
||||||
|
|
||||||
AC_HEADER_MAJOR
|
AC_HEADER_MAJOR
|
||||||
|
|
||||||
@@ -234,13 +222,7 @@ fi
|
|||||||
|
|
||||||
TAR_HEADERS_ATTR_XATTR_H
|
TAR_HEADERS_ATTR_XATTR_H
|
||||||
|
|
||||||
AC_CHECK_FUNCS_ONCE([fchmod fchown fsync lstat mkfifo readlink symlink])
|
AC_CHECK_FUNCS_ONCE([fchmod fchown fsync mkfifo waitpid])
|
||||||
|
|
||||||
AC_CHECK_DECLS([getgrgid],,, [#include <grp.h>])
|
|
||||||
AC_CHECK_DECLS([getpwuid],,, [#include <pwd.h>])
|
|
||||||
AC_CHECK_DECLS([time],,, [#include <time.h>])
|
|
||||||
|
|
||||||
AC_REPLACE_FUNCS(waitpid)
|
|
||||||
|
|
||||||
AC_ARG_VAR([RSH], [Configure absolute path to default remote shell binary])
|
AC_ARG_VAR([RSH], [Configure absolute path to default remote shell binary])
|
||||||
AC_CACHE_CHECK(for remote shell, tar_cv_path_RSH,
|
AC_CACHE_CHECK(for remote shell, tar_cv_path_RSH,
|
||||||
@@ -264,9 +246,7 @@ AC_CACHE_CHECK(for remote shell, tar_cv_path_RSH,
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
fi])
|
fi])
|
||||||
if test $tar_cv_path_RSH = no; then
|
if test $tar_cv_path_RSH != "no"; then
|
||||||
AC_CHECK_HEADERS(netdb.h)
|
|
||||||
else
|
|
||||||
AC_DEFINE_UNQUOTED(REMOTE_SHELL, "$tar_cv_path_RSH",
|
AC_DEFINE_UNQUOTED(REMOTE_SHELL, "$tar_cv_path_RSH",
|
||||||
[Define to the full path of your rsh, if any.])
|
[Define to the full path of your rsh, if any.])
|
||||||
fi
|
fi
|
||||||
@@ -360,7 +340,7 @@ AC_DEFINE_UNQUOTED(DEFAULT_QUOTING_STYLE, $DEFAULT_QUOTING_STYLE,
|
|||||||
|
|
||||||
# Iconv
|
# Iconv
|
||||||
AM_ICONV
|
AM_ICONV
|
||||||
AC_CHECK_HEADERS(iconv.h)
|
AC_CHECK_HEADERS_ONCE([iconv.h])
|
||||||
AC_CHECK_TYPE(iconv_t,:,
|
AC_CHECK_TYPE(iconv_t,:,
|
||||||
AC_DEFINE(iconv_t, int,
|
AC_DEFINE(iconv_t, int,
|
||||||
[Conversion descriptor type]),
|
[Conversion descriptor type]),
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ human
|
|||||||
idx
|
idx
|
||||||
inttostr
|
inttostr
|
||||||
inttypes
|
inttypes
|
||||||
|
largefile
|
||||||
lchown
|
lchown
|
||||||
linkat
|
linkat
|
||||||
localcharset
|
localcharset
|
||||||
|
|||||||
1
lib/.gitignore
vendored
1
lib/.gitignore
vendored
@@ -6,5 +6,4 @@ paxnames.c
|
|||||||
rmt-command.h
|
rmt-command.h
|
||||||
rmt.h
|
rmt.h
|
||||||
rtapelib.c
|
rtapelib.c
|
||||||
system-ioctl.h
|
|
||||||
system.h
|
system.h
|
||||||
|
|||||||
@@ -33,7 +33,6 @@ noinst_HEADERS = \
|
|||||||
paxlib.h\
|
paxlib.h\
|
||||||
rmt.h\
|
rmt.h\
|
||||||
system.h\
|
system.h\
|
||||||
system-ioctl.h\
|
|
||||||
wordsplit.h\
|
wordsplit.h\
|
||||||
xattr-at.h
|
xattr-at.h
|
||||||
|
|
||||||
@@ -41,7 +40,7 @@ libtar_a_SOURCES = \
|
|||||||
paxerror.c paxexit-status.c paxlib.h paxnames.c \
|
paxerror.c paxexit-status.c paxlib.h paxnames.c \
|
||||||
rtapelib.c \
|
rtapelib.c \
|
||||||
rmt.h \
|
rmt.h \
|
||||||
system.h system-ioctl.h \
|
system.h \
|
||||||
wordsplit.c\
|
wordsplit.c\
|
||||||
xattr-at.c
|
xattr-at.c
|
||||||
|
|
||||||
|
|||||||
@@ -193,7 +193,7 @@ wordsplit_init0 (struct wordsplit *wsp)
|
|||||||
wsp->ws_errno = 0;
|
wsp->ws_errno = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
char wordsplit_c_escape_tab[] = "\\\\\"\"a\ab\bf\fn\nr\rt\tv\v";
|
static char wordsplit_c_escape_tab[] = "\\\\\"\"a\ab\bf\fn\nr\rt\tv\v";
|
||||||
|
|
||||||
static int
|
static int
|
||||||
wordsplit_init (struct wordsplit *wsp, const char *input, size_t len,
|
wordsplit_init (struct wordsplit *wsp, const char *input, size_t len,
|
||||||
@@ -2513,7 +2513,7 @@ wordsplit_get_words (struct wordsplit *ws, size_t *wordc, char ***wordv)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *_wordsplit_errstr[] = {
|
static char const *const wordsplit_errstr[] = {
|
||||||
N_("no error"),
|
N_("no error"),
|
||||||
N_("missing closing quote"),
|
N_("missing closing quote"),
|
||||||
N_("memory exhausted"),
|
N_("memory exhausted"),
|
||||||
@@ -2524,16 +2524,15 @@ const char *_wordsplit_errstr[] = {
|
|||||||
N_("unbalanced parenthesis"),
|
N_("unbalanced parenthesis"),
|
||||||
N_("globbing error")
|
N_("globbing error")
|
||||||
};
|
};
|
||||||
int _wordsplit_nerrs =
|
enum { wordsplit_nerrs = sizeof wordsplit_errstr / sizeof *wordsplit_errstr };
|
||||||
sizeof (_wordsplit_errstr) / sizeof (_wordsplit_errstr[0]);
|
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
wordsplit_strerror (struct wordsplit *ws)
|
wordsplit_strerror (struct wordsplit *ws)
|
||||||
{
|
{
|
||||||
if (ws->ws_errno == WRDSE_USERERR)
|
if (ws->ws_errno == WRDSE_USERERR)
|
||||||
return ws->ws_usererr;
|
return ws->ws_usererr;
|
||||||
if (ws->ws_errno < _wordsplit_nerrs)
|
if (ws->ws_errno < wordsplit_nerrs)
|
||||||
return _wordsplit_errstr[ws->ws_errno];
|
return wordsplit_errstr[ws->ws_errno];
|
||||||
return N_("unknown error");
|
return N_("unknown error");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -52,10 +52,14 @@ static int record_index;
|
|||||||
/* FIXME: The following variables should ideally be static to this
|
/* FIXME: The following variables should ideally be static to this
|
||||||
module. However, this cannot be done yet. The cleanup continues! */
|
module. However, this cannot be done yet. The cleanup continues! */
|
||||||
|
|
||||||
|
extern union block *record_start;
|
||||||
union block *record_start; /* start of record of archive */
|
union block *record_start; /* start of record of archive */
|
||||||
|
extern union block *record_end;
|
||||||
union block *record_end; /* last+1 block of archive record */
|
union block *record_end; /* last+1 block of archive record */
|
||||||
|
extern union block *current_block;
|
||||||
union block *current_block; /* current block of archive */
|
union block *current_block; /* current block of archive */
|
||||||
enum access_mode access_mode; /* how do we handle the 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_read; /* number of records read from this archive */
|
||||||
off_t records_written; /* likewise, for records written */
|
off_t records_written; /* likewise, for records written */
|
||||||
extern off_t records_skipped; /* number of records skipped at the start
|
extern off_t records_skipped; /* number of records skipped at the start
|
||||||
|
|||||||
@@ -20,12 +20,16 @@
|
|||||||
Written by John Gilmore, on 1987-04-30. */
|
Written by John Gilmore, on 1987-04-30. */
|
||||||
|
|
||||||
#include <system.h>
|
#include <system.h>
|
||||||
#include <system-ioctl.h>
|
|
||||||
|
|
||||||
#if HAVE_LINUX_FD_H
|
#if HAVE_LINUX_FD_H
|
||||||
# include <linux/fd.h>
|
# include <linux/fd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if HAVE_SYS_MTIO_H
|
||||||
|
# include <sys/ioctl.h>
|
||||||
|
# include <sys/mtio.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include <quotearg.h>
|
#include <quotearg.h>
|
||||||
#include <rmt.h>
|
#include <rmt.h>
|
||||||
@@ -267,7 +271,6 @@ diff_link (void)
|
|||||||
current_stat_info.link_name));
|
current_stat_info.link_name));
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_READLINK
|
|
||||||
static void
|
static void
|
||||||
diff_symlink (void)
|
diff_symlink (void)
|
||||||
{
|
{
|
||||||
@@ -293,7 +296,6 @@ diff_symlink (void)
|
|||||||
if (linkbuf != buf)
|
if (linkbuf != buf)
|
||||||
free (linkbuf);
|
free (linkbuf);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
diff_special (void)
|
diff_special (void)
|
||||||
@@ -496,11 +498,9 @@ diff_archive (void)
|
|||||||
diff_link ();
|
diff_link ();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef HAVE_READLINK
|
|
||||||
case SYMTYPE:
|
case SYMTYPE:
|
||||||
diff_symlink ();
|
diff_symlink ();
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
|
|
||||||
case CHRTYPE:
|
case CHRTYPE:
|
||||||
case BLKTYPE:
|
case BLKTYPE:
|
||||||
|
|||||||
@@ -1870,7 +1870,6 @@ dump_file0 (struct tar_stat_info *st, char const *name, char const *p)
|
|||||||
|
|
||||||
return allocated;
|
return allocated;
|
||||||
}
|
}
|
||||||
#ifdef HAVE_READLINK
|
|
||||||
else if (S_ISLNK (st->stat.st_mode))
|
else if (S_ISLNK (st->stat.st_mode))
|
||||||
{
|
{
|
||||||
st->link_name = areadlinkat_with_size (parentfd, name, st->stat.st_size);
|
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);
|
file_count_links (st);
|
||||||
return allocated;
|
return allocated;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
else if (S_ISCHR (st->stat.st_mode))
|
else if (S_ISCHR (st->stat.st_mode))
|
||||||
{
|
{
|
||||||
type = CHRTYPE;
|
type = CHRTYPE;
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ extern off_t records_read;
|
|||||||
|
|
||||||
/* The number of records skipped at the start of the archive, when
|
/* The number of records skipped at the start of the archive, when
|
||||||
passing over members that are not deleted. */
|
passing over members that are not deleted. */
|
||||||
|
extern off_t records_skipped;
|
||||||
off_t records_skipped;
|
off_t records_skipped;
|
||||||
|
|
||||||
/* Move archive descriptor by COUNT records worth. If COUNT is
|
/* Move archive descriptor by COUNT records worth. If COUNT is
|
||||||
|
|||||||
@@ -1587,7 +1587,6 @@ extract_link (char *file_name, MAYBE_UNUSED int typeflag)
|
|||||||
static int
|
static int
|
||||||
extract_symlink (char *file_name, MAYBE_UNUSED int typeflag)
|
extract_symlink (char *file_name, MAYBE_UNUSED int typeflag)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_SYMLINK
|
|
||||||
bool interdir_made = false;
|
bool interdir_made = false;
|
||||||
|
|
||||||
if (! absolute_names_option
|
if (! absolute_names_option
|
||||||
@@ -1605,6 +1604,19 @@ extract_symlink (char *file_name, MAYBE_UNUSED int typeflag)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case RECOVER_NO:
|
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);
|
symlink_error (current_stat_info.link_name, file_name);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -1612,19 +1624,6 @@ extract_symlink (char *file_name, MAYBE_UNUSED int typeflag)
|
|||||||
set_stat (file_name, ¤t_stat_info, -1, 0, 0,
|
set_stat (file_name, ¤t_stat_info, -1, 0, 0,
|
||||||
SYMTYPE, false, AT_SYMLINK_NOFOLLOW);
|
SYMTYPE, false, AT_SYMLINK_NOFOLLOW);
|
||||||
return 0;
|
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
|
#if S_IFCHR || S_IFBLK
|
||||||
|
|||||||
@@ -16,7 +16,11 @@
|
|||||||
with this program. If not, see <http://www.gnu.org/licenses/>. */
|
with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
#include <system.h>
|
#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 "common.h"
|
||||||
#include <priv-set.h>
|
#include <priv-set.h>
|
||||||
@@ -69,7 +73,7 @@ mtioseek (bool count_files, off_t count)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if MSDOS
|
#if !HAVE_WAITPID /* MingW, MSVC 14. */
|
||||||
|
|
||||||
bool
|
bool
|
||||||
sys_get_archive_stat (void)
|
sys_get_archive_stat (void)
|
||||||
|
|||||||
Reference in New Issue
Block a user