From db6b0fac93681b91cf5f947dcb09a4161541e0c8 Mon Sep 17 00:00:00 2001 From: Peter Avalos Date: Mon, 18 Sep 2006 01:47:10 +0000 Subject: [PATCH] Upgrade libarchive and bsdtar to 1.3.1. libarchive Makefile changes inspired by FreeBSD. --- lib/libarchive/Makefile | 36 +- lib/libarchive/config.h | 421 ++++++++++++++++-- .../patches/archive_platform.h.patch | 13 + .../patches/archive_read_extract.c.patch | 52 --- usr.bin/tar/Makefile | 10 +- usr.bin/tar/config.h | 48 -- usr.bin/tar/patches/bsdtar_platform.h.patch | 13 + usr.bin/tar/patches/write.c.patch | 189 -------- 8 files changed, 428 insertions(+), 354 deletions(-) create mode 100644 lib/libarchive/patches/archive_platform.h.patch delete mode 100644 lib/libarchive/patches/archive_read_extract.c.patch delete mode 100644 usr.bin/tar/config.h create mode 100644 usr.bin/tar/patches/bsdtar_platform.h.patch delete mode 100644 usr.bin/tar/patches/write.c.patch diff --git a/lib/libarchive/Makefile b/lib/libarchive/Makefile index 86b0c4257f..8bce8997b9 100644 --- a/lib/libarchive/Makefile +++ b/lib/libarchive/Makefile @@ -1,20 +1,18 @@ -# $DragonFly: src/lib/libarchive/Makefile,v 1.4 2005/08/05 23:43:19 swildner Exp $ +# $FreeBSD: src/lib/libarchive/Makefile,v 1.50 2006/09/05 05:59:45 kientzle Exp $ +# $DragonFly: src/lib/libarchive/Makefile,v 1.5 2006/09/18 01:47:10 pavalos Exp $ LIB= archive PATCHES!= echo ${.CURDIR}/patches/*.patch -CONTRIBDIR= ${.CURDIR}/../../contrib/libarchive +CONTRIBDIR= ${.CURDIR}/../../contrib/libarchive-1.3.1/libarchive .PATH: ${CONTRIBDIR} -VERSION= 1.01.015 -ARCHIVE_API_FEATURE= 2 -ARCHIVE_API_VERSION= 1 -SHLIB_MAJOR= 2 -CFLAGS+= -DPACKAGE_NAME=\"lib${LIB}\" -CFLAGS+= -DPACKAGE_VERSION=\"${VERSION}\" +VERSION= 1.3.1 +ARCHIVE_API_MAJOR!= echo ${VERSION} | sed -e 's/\..*//' +ARCHIVE_API_MINOR!= echo ${VERSION} | sed -e 's/[0-9]*\.//' | sed -e 's/\..*//' +SHLIB_MAJOR!= echo $$((${ARCHIVE_API_MAJOR} + ${ARCHIVE_API_MINOR})) CFLAGS+= -DHAVE_CONFIG_H - -CFLAGS+= -I${.OBJDIR} -I${.CURDIR} -I${CONTRIBDIR} +CFLAGS+= -I${.OBJDIR} -I${.CURDIR} -I${CONTRIBDIR} -I- WARNS?= 6 INCS= archive.h archive_entry.h @@ -29,6 +27,8 @@ SRCS= archive.h \ archive_read_extract.c \ archive_read_open_fd.c \ archive_read_open_file.c \ + archive_read_open_filename.c \ + archive_read_open_memory.c \ archive_read_support_compression_all.c \ archive_read_support_compression_bzip2.c \ archive_read_support_compression_compress.c \ @@ -45,6 +45,8 @@ SRCS= archive.h \ archive_write.c \ archive_write_open_fd.c \ archive_write_open_file.c \ + archive_write_open_filename.c \ + archive_write_open_memory.c \ archive_write_set_compression_bzip2.c \ archive_write_set_compression_gzip.c \ archive_write_set_compression_none.c \ @@ -133,8 +135,11 @@ MLINKS+= archive_read.3 archive_read_finish.3 MLINKS+= archive_read.3 archive_read_new.3 MLINKS+= archive_read.3 archive_read_next_header.3 MLINKS+= archive_read.3 archive_read_open.3 +MLINKS+= archive_read.3 archive_read_open2.3 +MLINKS+= archive_read.3 archive_read_open_FILE.3 MLINKS+= archive_read.3 archive_read_open_fd.3 -MLINKS+= archive_read.3 archive_read_open_file.3 +MLINKS+= archive_read.3 archive_read_open_filename.3 +MLINKS+= archive_read.3 archive_read_open_memory.3 MLINKS+= archive_read.3 archive_read_set_bytes_per_block.3 MLINKS+= archive_read.3 archive_read_support_compression_all.3 MLINKS+= archive_read.3 archive_read_support_compression_bzip2.3 @@ -159,8 +164,8 @@ MLINKS+= archive_write.3 archive_write_finish.3 MLINKS+= archive_write.3 archive_write_header.3 MLINKS+= archive_write.3 archive_write_new.3 MLINKS+= archive_write.3 archive_write_open.3 +MLINKS+= archive_write.3 archive_write_open_FILE.3 MLINKS+= archive_write.3 archive_write_open_fd.3 -MLINKS+= archive_write.3 archive_write_open_file.3 MLINKS+= archive_write.3 archive_write_prepare.3 MLINKS+= archive_write.3 archive_write_set_bytes_per_block.3 MLINKS+= archive_write.3 archive_write_set_bytes_in_last_block.3 @@ -178,8 +183,11 @@ MLINKS+= libarchive.3 archive.3 # Build archive.h from archive.h.in archive.h: archive.h.in Makefile cat ${CONTRIBDIR}/archive.h.in | \ - sed 's/@ARCHIVE_API_VERSION@/${ARCHIVE_API_VERSION}/' | \ - sed 's/@ARCHIVE_API_FEATURE@/${ARCHIVE_API_FEATURE}/' | \ + sed 's/@VERSION@/${VERSION}/g' | \ + sed 's/@SHLIB_MAJOR@/${SHLIB_MAJOR}/g' | \ + sed 's/@ARCHIVE_API_MAJOR@/${ARCHIVE_API_MAJOR}/g' | \ + sed 's/@ARCHIVE_API_MINOR@/${ARCHIVE_API_MINOR}/g' | \ + sed 's|@ARCHIVE_H_INCLUDE_INTTYPES_H@|#include /* For int64_t */|g' | \ cat > archive.h # archive.h needs to be cleaned diff --git a/lib/libarchive/config.h b/lib/libarchive/config.h index 1252b313a9..2b3adbdf85 100644 --- a/lib/libarchive/config.h +++ b/lib/libarchive/config.h @@ -1,46 +1,375 @@ -/* $DragonFly: src/lib/libarchive/config.h,v 1.1 2004/11/10 18:02:24 joerg Exp $ */ - -#define HAVE_BZLIB_H 1 -#define HAVE_CHFLAGS 1 -#define HAVE_DECL_STRERROR_R 1 -#define HAVE_EFTYPE 1 -#define HAVE_EILSEQ 1 -#define HAVE_ERRNO_H 1 -#define HAVE_FCHDIR 1 -#define HAVE_FCNTL_H 1 -#define HAVE_INTTYPES_H 1 -#define HAVE_LCHMOD 1 -#define HAVE_LCHOWN 1 -#define HAVE_LIMITS_H 1 -#define HAVE_LUTIMES 1 -#define HAVE_MALLOC 1 -#define HAVE_MEMMOVE 1 -#define HAVE_MEMORY_H 1 -#define HAVE_MEMSET 1 -#define HAVE_MKDIR 1 -#define HAVE_MKFIFO 1 -#define HAVE_PATHS_H 1 -#define HAVE_STDINT_H 1 -#define HAVE_STDLIB_H 1 -#define HAVE_STRCHR 1 -#define HAVE_STRDUP 1 -#define HAVE_STRERROR 1 -#define HAVE_STRERROR_R 1 -#define HAVE_STRINGS_H 1 -#define HAVE_STRING_H 1 -#define HAVE_STRRCHR 1 -#define HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC 1 -#define HAVE_STRUCT_STAT_ST_RDEV 1 -#define HAVE_SYS_IOCTL_H 1 -#define HAVE_SYS_STAT_H 1 -#define HAVE_SYS_TIME_H 1 -#define HAVE_SYS_TYPES_H 1 -#define HAVE_SYS_WAIT_H 1 -#define HAVE_UNISTD_H 1 -#define HAVE_VASPRINTF 1 -#define HAVE_WCHAR_H 1 -#define HAVE_ZLIB_H 1 -#define STDC_HEADERS 1 -#define TIME_WITH_SYS_TIME 1 - -#undef __FreeBSD__ +/* $DragonFly: src/lib/libarchive/config.h,v 1.2 2006/09/18 01:47:10 pavalos Exp $ */ +/* config.h. Generated by configure. */ +/* config.h.in. Generated from configure.ac by autoheader. */ + +/* Define to 1 if you have the `acl_create_entry' function. */ +/* #undef HAVE_ACL_CREATE_ENTRY */ + +/* Define to 1 if you have the `acl_get_perm' function. */ +/* #undef HAVE_ACL_GET_PERM */ + +/* Define to 1 if you have the `acl_get_perm_np' function. */ +/* #undef HAVE_ACL_GET_PERM_NP */ + +/* Define to 1 if you have the `acl_init' function. */ +/* #undef HAVE_ACL_INIT */ + +/* Define to 1 if the system has the type `acl_permset_t'. */ +/* #undef HAVE_ACL_PERMSET_T */ + +/* Define to 1 if you have the `acl_set_fd' function. */ +/* #undef HAVE_ACL_SET_FD */ + +/* Define to 1 if you have the `acl_set_fd_np' function. */ +/* #undef HAVE_ACL_SET_FD_NP */ + +/* Define to 1 if you have the `acl_set_file' function. */ +/* #undef HAVE_ACL_SET_FILE */ + +/* True for systems with POSIX ACL support */ +#define HAVE_ACL_USER 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_ATTR_XATTR_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_BZLIB_H 1 + +/* Define to 1 if you have the `chflags' function. */ +#define HAVE_CHFLAGS 1 + +/* Define to 1 if you have the declaration of `strerror_r', and to 0 if you + don't. */ +#define HAVE_DECL_STRERROR_R 1 + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +#define HAVE_DIRENT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_DLFCN_H 1 + +/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */ +/* #undef HAVE_DOPRNT */ + +/* Define to 1 if nl_langinfo supports D_MD_ORDER */ +#define HAVE_D_MD_ORDER 1 + +/* A possible errno value for invalid file format errors */ +#define HAVE_EFTYPE 1 + +/* A possible errno value for invalid file format errors */ +#define HAVE_EILSEQ 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_ERRNO_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_EXT2FS_EXT2_FS_H */ + +/* Define to 1 if you have the `fchdir' function. */ +#define HAVE_FCHDIR 1 + +/* Define to 1 if you have the `fchflags' function. */ +#define HAVE_FCHFLAGS 1 + +/* Define to 1 if you have the `fchmod' function. */ +#define HAVE_FCHMOD 1 + +/* Define to 1 if you have the `fchown' function. */ +#define HAVE_FCHOWN 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_FCNTL_H 1 + +/* Define to 1 if your system has a working POSIX `fnmatch' function. */ +#define HAVE_FNMATCH 1 + +/* Define to 1 if fnmatch(3) supports the FNM_LEADING_DIR flag */ +#define HAVE_FNM_LEADING_DIR 1 + +/* Define to 1 if you have the `fsetxattr' function. */ +/* #undef HAVE_FSETXATTR */ + +/* Define to 1 if you have the `ftruncate' function. */ +#define HAVE_FTRUNCATE 1 + +/* Define to 1 if you have the `futimes' function. */ +#define HAVE_FUTIMES 1 + +/* Define to 1 if you have the `getopt_long' function. */ +#define HAVE_GETOPT_LONG 1 + +/* Define to 1 if you have the `getxattr' function. */ +/* #undef HAVE_GETXATTR */ + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_LANGINFO_H 1 + +/* Define to 1 if you have the `lchflags' function. */ +/* #undef HAVE_LCHFLAGS */ + +/* Define to 1 if you have the `lchmod' function. */ +#define HAVE_LCHMOD 1 + +/* Define to 1 if you have the `lchown' function. */ +#define HAVE_LCHOWN 1 + +/* Define to 1 if you have the `lgetxattr' function. */ +/* #undef HAVE_LGETXATTR */ + +/* Define to 1 if you have the `acl' library (-lacl). */ +/* #undef HAVE_LIBACL */ + +/* Define to 1 if you have the `attr' library (-lattr). */ +/* #undef HAVE_LIBATTR */ + +/* Define to 1 if you have the `bz2' library (-lbz2). */ +#define HAVE_LIBBZ2 1 + +/* Define to 1 if you have the `z' library (-lz). */ +#define HAVE_LIBZ 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_LIMITS_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_LINUX_EXT2_FS_H */ + +/* Define to 1 if you have the `listxattr' function. */ +/* #undef HAVE_LISTXATTR */ + +/* Define to 1 if you have the `llistxattr' function. */ +/* #undef HAVE_LLISTXATTR */ + +/* Define to 1 if you have the header file. */ +#define HAVE_LOCALE_H 1 + +/* Define to 1 if you have the `lsetxattr' function. */ +/* #undef HAVE_LSETXATTR */ + +/* Define to 1 if `lstat' has the bug that it succeeds when given the + zero-length file name argument. */ +/* #undef HAVE_LSTAT_EMPTY_STRING_BUG */ + +/* Define to 1 if you have the `lutimes' function. */ +#define HAVE_LUTIMES 1 + +/* Define to 1 if you have the `memmove' function. */ +#define HAVE_MEMMOVE 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the `memset' function. */ +#define HAVE_MEMSET 1 + +/* Define to 1 if you have the `mkdir' function. */ +#define HAVE_MKDIR 1 + +/* Define to 1 if you have the `mkfifo' function. */ +#define HAVE_MKFIFO 1 + +/* Define to 1 if you have the header file, and it defines `DIR'. */ +/* #undef HAVE_NDIR_H */ + +/* Define to 1 if you have the `nl_langinfo' function. */ +#define HAVE_NL_LANGINFO 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_PATHS_H 1 + +/* Define to 1 if you have the `reallocf' function. */ +#define HAVE_REALLOCF 1 + +/* Define to 1 if you have the `setlocale' function. */ +#define HAVE_SETLOCALE 1 + +/* Define to 1 if `stat' has the bug that it succeeds when given the + zero-length file name argument. */ +/* #undef HAVE_STAT_EMPTY_STRING_BUG */ + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the `strchr' function. */ +#define HAVE_STRCHR 1 + +/* Define to 1 if you have the `strdup' function. */ +#define HAVE_STRDUP 1 + +/* Define to 1 if you have the `strerror' function. */ +#define HAVE_STRERROR 1 + +/* Define to 1 if you have the `strerror_r' function. */ +#define HAVE_STRERROR_R 1 + +/* Define to 1 if you have the `strftime' function. */ +#define HAVE_STRFTIME 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the `strrchr' function. */ +#define HAVE_STRRCHR 1 + +/* Define to 1 if `st_mtimespec.tv_nsec' is member of `struct stat'. */ +#define HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC 1 + +/* Define to 1 if `st_mtim.tv_nsec' is member of `struct stat'. */ +/* #undef HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC */ + +/* Define to 1 if `st_rdev' is member of `struct stat'. */ +#define HAVE_STRUCT_STAT_ST_RDEV 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_ACL_H 1 + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +/* #undef HAVE_SYS_DIR_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_IOCTL_H 1 + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +/* #undef HAVE_SYS_NDIR_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_PARAM_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TIME_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have that is POSIX.1 compatible. */ +#define HAVE_SYS_WAIT_H 1 + +/* Define to 1 if you have the `timegm' function. */ +#define HAVE_TIMEGM 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Define to 1 if you have the `vprintf' function. */ +#define HAVE_VPRINTF 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_WCHAR_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_ZLIB_H 1 + +/* Define to 1 if `lstat' dereferences a symlink specified with a trailing + slash. */ +#define LSTAT_FOLLOWS_SLASHED_SYMLINK 1 + +/* Define to 1 if `major', `minor', and `makedev' are declared in . + */ +/* #undef MAJOR_IN_MKDEV */ + +/* Define to 1 if `major', `minor', and `makedev' are declared in + . */ +/* #undef MAJOR_IN_SYSMACROS */ + +/* Define to 1 if your C compiler doesn't accept -c and -o together. */ +/* #undef NO_MINUS_C_MINUS_O */ + +/* Name of package */ +#define PACKAGE "libarchive" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "kientzle@freebsd.org" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "libarchive" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "libarchive 1.3.1" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "libarchive" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "1.3.1" + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Define to 1 if strerror_r returns char *. */ +/* #undef STRERROR_R_CHAR_P */ + +/* Define to 1 if you can safely include both and . */ +#define TIME_WITH_SYS_TIME 1 + +/* Version number of package */ +#define VERSION "1.3.1" + +/* Number of bits in a file offset, on hosts where this is settable. */ +/* #undef _FILE_OFFSET_BITS */ + +/* Define for large files, on AIX-style hosts. */ +/* #undef _LARGE_FILES */ + +/* Define to `long long' if does not define. */ +/* #undef __int64_t */ + +/* Define to `unsigned long long' if does not define. */ +/* #undef __uint64_t */ + +/* Define to `__int64_t' if does not define. */ +#define _int64_t __int64_t + +/* Define to `__uint64_t' if does not define. */ +#define _uint64_t __uint64_t + +/* Define to empty if `const' does not conform to ANSI C. */ +/* #undef const */ + +/* Define to `int' if doesn't define. */ +/* #undef gid_t */ + +/* Define to `unsigned long' if does not define. */ +/* #undef id_t */ + +/* Define to `_int64_t' if does not define. */ +/* #undef int64_t */ + +/* Define to `int64_t' if does not define. */ +/* #undef intmax_t */ + +/* Define to `int' if does not define. */ +/* #undef mode_t */ + +/* Define to `int64_t' if does not define. */ +/* #undef off_t */ + +/* Define to `unsigned' if does not define. */ +/* #undef size_t */ + +/* Define to `_uint64_t' if does not define. */ +/* #undef u_int64_t */ + +/* Define to `int' if doesn't define. */ +/* #undef uid_t */ + +/* Define to `u_int64_t' if does not define. */ +/* #undef uint64_t */ + +/* Define to `uint64_t' if does not define. */ +/* #undef uintmax_t */ diff --git a/lib/libarchive/patches/archive_platform.h.patch b/lib/libarchive/patches/archive_platform.h.patch new file mode 100644 index 0000000000..0ad4b0b728 --- /dev/null +++ b/lib/libarchive/patches/archive_platform.h.patch @@ -0,0 +1,13 @@ +$DragonFly: src/lib/libarchive/patches/Attic/archive_platform.h.patch,v 1.3 2006/09/18 01:47:10 pavalos Exp $ + +--- archive_platform.h.orig 2006-09-16 21:14:36.000000000 -0700 ++++ archive_platform.h 2006-09-16 21:15:02.000000000 -0700 +@@ -38,7 +38,7 @@ + #define ARCHIVE_PLATFORM_H_INCLUDED + + #if HAVE_CONFIG_H +-#include "../config.h" ++#include "config.h" + #else + + /* A default configuration for FreeBSD, used if there is no config.h. */ diff --git a/lib/libarchive/patches/archive_read_extract.c.patch b/lib/libarchive/patches/archive_read_extract.c.patch deleted file mode 100644 index 52522ece90..0000000000 --- a/lib/libarchive/patches/archive_read_extract.c.patch +++ /dev/null @@ -1,52 +0,0 @@ -$DragonFly: src/lib/libarchive/patches/Attic/archive_read_extract.c.patch,v 1.1 2004/11/10 18:02:24 joerg Exp $ - ---- archive_read_extract.c.orig 2004-11-09 23:59:26.000000000 +0100 -+++ archive_read_extract.c 2004-11-10 00:25:17.000000000 +0100 -@@ -77,7 +77,10 @@ - struct bucket { - char *name; - int hash; -- id_t id; -+ union { -+ uid_t uid; -+ gid_t gid; -+ } id; - }; - - struct extract { -@@ -1229,7 +1232,7 @@ - h = hash(gname); - b = &extract->gcache[h % cache_size ]; - if (b->name != NULL && b->hash == h && strcmp(gname, b->name) == 0) -- return ((gid_t)b->id); -+ return (b->id.gid); - - /* Free the cache slot for a new entry. */ - if (b->name != NULL) -@@ -1240,7 +1243,7 @@ - grent = getgrnam(gname); - if (grent != NULL) - gid = grent->gr_gid; -- b->id = gid; -+ b->id.gid = gid; - - return (gid); - } -@@ -1265,7 +1268,7 @@ - h = hash(uname); - b = &extract->ucache[h % cache_size ]; - if (b->name != NULL && b->hash == h && strcmp(uname, b->name) == 0) -- return ((uid_t)b->id); -+ return (b->id.uid); - - /* Free the cache slot for a new entry. */ - if (b->name != NULL) -@@ -1276,7 +1279,7 @@ - pwent = getpwnam(uname); - if (pwent != NULL) - uid = pwent->pw_uid; -- b->id = uid; -+ b->id.uid = uid; - - return (uid); - } diff --git a/usr.bin/tar/Makefile b/usr.bin/tar/Makefile index d750a5946e..e0fcc655d1 100644 --- a/usr.bin/tar/Makefile +++ b/usr.bin/tar/Makefile @@ -1,4 +1,4 @@ -# $DragonFly: src/usr.bin/tar/Makefile,v 1.2 2005/05/03 14:46:12 joerg Exp $ +# $DragonFly: src/usr.bin/tar/Makefile,v 1.3 2006/09/18 01:47:10 pavalos Exp $ PROG= bsdtar SRCS= bsdtar.c getdate.y matching.c read.c tree.c util.c write.c @@ -8,13 +8,13 @@ LDADD= -larchive -lbz2 -lz NOSHARED?= yes PATCHES!= echo ${.CURDIR}/patches/*.patch -CONTRIBDIR= ${.CURDIR}/../../contrib/bsdtar +CONTRIBDIR= ${.CURDIR}/../../contrib/libarchive-1.3.1/tar .PATH: ${CONTRIBDIR} SRCS+= ${PATCHES} NAME= bsdtar -VERSION= 1.01.015 -CFLAGS+= -DPACKAGE_VERSION=\"${VERSION}\" -DPACKAGE_NAME=\"${NAME}\" -CFLAGS+= -I${.CURDIR} -I${CONTRIBDIR} -DHAVE_CONFIG_H +VERSION= 1.3.1 +CFLAGS+= -I${.OBJDIR} -I${.CURDIR}/../../lib/libarchive -I${CONTRIBDIR} -I- +CFLAGS+= -DHAVE_CONFIG_H .if defined(WITH_BSDTAR) SYMLINKS= ${BINDIR}/bsdtar ${BINDIR}/tar diff --git a/usr.bin/tar/config.h b/usr.bin/tar/config.h deleted file mode 100644 index 0cfd334e64..0000000000 --- a/usr.bin/tar/config.h +++ /dev/null @@ -1,48 +0,0 @@ -/* $DragonFly: src/usr.bin/tar/Attic/config.h,v 1.1 2004/11/10 18:02:24 joerg Exp $ */ - -#define HAVE_BZLIB_H 1 -#define HAVE_CHFLAGS 1 -#define HAVE_DIRENT_H 1 -#define HAVE_D_MD_ORDER 1 -#define HAVE_FCHDIR 1 -#define HAVE_FCNTL_H 1 -#define HAVE_FNMATCH 1 -#define HAVE_FTRUNCATE 1 -#define HAVE_GETOPT_LONG 1 -#define HAVE_INTTYPES_H 1 -#define HAVE_LANGINFO_H 1 -#define HAVE_LIBARCHIVE 1 -#define HAVE_LIBBZ2 1 -#define HAVE_LIBZ 1 -#define HAVE_LIMITS_H 1 -#define HAVE_LOCALE_H 1 -#define HAVE_MALLOC 1 -#define HAVE_MEMMOVE 1 -#define HAVE_MEMORY_H 1 -#define HAVE_MEMSET 1 -#define HAVE_NL_LANGINFO 1 -#define HAVE_PATHS_H 1 -#define HAVE_SETLOCALE 1 -#define HAVE_STDINT_H 1 -#define HAVE_STDLIB_H 1 -#define HAVE_STRCHR 1 -#define HAVE_STRDUP 1 -#define HAVE_STRERROR 1 -#define HAVE_STRFTIME 1 -#define HAVE_STRINGS_H 1 -#define HAVE_STRING_H 1 -#define HAVE_STRRCHR 1 -#define HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC 1 -#define HAVE_STRUCT_STAT_ST_RDEV 1 -/* #define HAVE_SYS_ACL_H 1 */ -#define HAVE_SYS_IOCTL_H 1 -#define HAVE_SYS_PARAM_H 1 -#define HAVE_SYS_STAT_H 1 -#define HAVE_SYS_TYPES_H 1 -#define HAVE_UINTMAX_T 1 -#define HAVE_UNISTD_H 1 -#define HAVE_VPRINTF 1 -#define HAVE_ZLIB_H 1 -#define STDC_HEADERS 1 - -#undef __FreeBSD__ diff --git a/usr.bin/tar/patches/bsdtar_platform.h.patch b/usr.bin/tar/patches/bsdtar_platform.h.patch new file mode 100644 index 0000000000..b01e206e4a --- /dev/null +++ b/usr.bin/tar/patches/bsdtar_platform.h.patch @@ -0,0 +1,13 @@ +$DragonFly: src/usr.bin/tar/patches/Attic/bsdtar_platform.h.patch,v 1.1 2006/09/18 01:47:10 pavalos Exp $ + +--- bsdtar_platform.h.orig 2006-09-17 12:41:40.000000000 -0700 ++++ bsdtar_platform.h 2006-09-17 12:42:02.000000000 -0700 +@@ -36,7 +36,7 @@ + #define BSDTAR_PLATFORM_H_INCLUDED + + #if HAVE_CONFIG_H +-#include "../config.h" ++#include "config.h" + #else + + #ifdef __FreeBSD__ diff --git a/usr.bin/tar/patches/write.c.patch b/usr.bin/tar/patches/write.c.patch deleted file mode 100644 index 1cefc1ee5a..0000000000 --- a/usr.bin/tar/patches/write.c.patch +++ /dev/null @@ -1,189 +0,0 @@ -$DragonFly: src/usr.bin/tar/patches/Attic/write.c.patch,v 1.1 2004/11/10 18:02:24 joerg Exp $ - ---- write.c.orig 2004-11-10 01:04:37.000000000 +0100 -+++ write.c 2004-11-10 01:12:35.000000000 +0100 -@@ -91,7 +91,10 @@ - int hits; - size_t size; - struct { -- id_t id; -+ union { -+ uid_t uid; -+ gid_t gid; -+ } id; - const char *name; - } cache[name_cache_size]; - }; -@@ -109,12 +112,12 @@ - static void free_cache(struct name_cache *cache); - static const char * lookup_gname(struct bsdtar *bsdtar, gid_t gid); - static int lookup_gname_helper(struct bsdtar *bsdtar, -- const char **name, id_t gid); -+ const char **name, gid_t gid); - static void lookup_hardlink(struct bsdtar *, - struct archive_entry *entry, const struct stat *); - static const char * lookup_uname(struct bsdtar *bsdtar, uid_t uid); - static int lookup_uname_helper(struct bsdtar *bsdtar, -- const char **name, id_t uid); -+ const char **name, uid_t uid); - static int new_enough(struct bsdtar *, const char *path, - time_t mtime_sec, int mtime_nsec); - static void setup_acls(struct bsdtar *, struct archive_entry *, -@@ -1157,18 +1160,14 @@ - } - } - --/* -- * Lookup uid/gid from uname/gname, return NULL if no match. -- */ - static const char * --lookup_name(struct bsdtar *bsdtar, struct name_cache **name_cache_variable, -- int (*lookup_fn)(struct bsdtar *, const char **, id_t), id_t id) -+lookup_uname(struct bsdtar *bsdtar, uid_t uid) - { -- struct name_cache *cache; -+ struct name_cache **name_cache_variable = &bsdtar->uname_cache; -+ struct name_cache *cache; - const char *name; - int slot; - -- - if (*name_cache_variable == NULL) { - *name_cache_variable = malloc(sizeof(struct name_cache)); - if (*name_cache_variable == NULL) -@@ -1180,9 +1179,9 @@ - cache = *name_cache_variable; - cache->probes++; - -- slot = id % cache->size; -+ slot = uid % cache->size; - if (cache->cache[slot].name != NULL) { -- if (cache->cache[slot].id == id) { -+ if (cache->cache[slot].id.uid == uid) { - cache->hits++; - if (cache->cache[slot].name == NO_NAME) - return (NULL); -@@ -1193,15 +1192,15 @@ - cache->cache[slot].name = NULL; - } - -- if (lookup_fn(bsdtar, &name, id) == 0) { -+ if (lookup_uname_helper(bsdtar, &name, uid) == 0) { - if (name == NULL || name[0] == '\0') { - /* Cache the negative response. */ - cache->cache[slot].name = NO_NAME; -- cache->cache[slot].id = id; -+ cache->cache[slot].id.uid = uid; - } else { - cache->cache[slot].name = strdup(name); - if (cache->cache[slot].name != NULL) { -- cache->cache[slot].id = id; -+ cache->cache[slot].id.uid = uid; - return (cache->cache[slot].name); - } - /* -@@ -1214,26 +1213,17 @@ - return (NULL); - } - --static const char * --lookup_uname(struct bsdtar *bsdtar, uid_t uid) --{ -- return (lookup_name(bsdtar, &bsdtar->uname_cache, -- &lookup_uname_helper, (id_t)uid)); --} -- - static int --lookup_uname_helper(struct bsdtar *bsdtar, const char **name, id_t id) -+lookup_uname_helper(struct bsdtar *bsdtar __unused, const char **name, uid_t uid) - { - struct passwd *pwent; - -- (void)bsdtar; /* UNUSED */ -- - errno = 0; -- pwent = getpwuid((uid_t)id); -+ pwent = getpwuid(uid); - if (pwent == NULL) { - *name = NULL; - if (errno != 0) -- bsdtar_warnc(bsdtar, errno, "getpwuid(%d) failed", id); -+ bsdtar_warnc(bsdtar, errno, "getpwuid(%d) failed", uid); - return (errno); - } - -@@ -1244,23 +1234,69 @@ - static const char * - lookup_gname(struct bsdtar *bsdtar, gid_t gid) - { -- return (lookup_name(bsdtar, &bsdtar->gname_cache, -- &lookup_gname_helper, (id_t)gid)); -+ struct name_cache **name_cache_variable = &bsdtar->gname_cache; -+ struct name_cache *cache; -+ const char *name; -+ int slot; -+ -+ if (*name_cache_variable == NULL) { -+ *name_cache_variable = malloc(sizeof(struct name_cache)); -+ if (*name_cache_variable == NULL) -+ bsdtar_errc(bsdtar, 1, ENOMEM, "No more memory"); -+ memset(*name_cache_variable, 0, sizeof(struct name_cache)); -+ (*name_cache_variable)->size = name_cache_size; -+ } -+ -+ cache = *name_cache_variable; -+ cache->probes++; -+ -+ slot = gid % cache->size; -+ if (cache->cache[slot].name != NULL) { -+ if (cache->cache[slot].id.gid == gid) { -+ cache->hits++; -+ if (cache->cache[slot].name == NO_NAME) -+ return (NULL); -+ return (cache->cache[slot].name); -+ } -+ if (cache->cache[slot].name != NO_NAME) -+ free((void *)(uintptr_t)cache->cache[slot].name); -+ cache->cache[slot].name = NULL; -+ } -+ -+ if (lookup_gname_helper(bsdtar, &name, gid) == 0) { -+ if (name == NULL || name[0] == '\0') { -+ /* Cache the negative response. */ -+ cache->cache[slot].name = NO_NAME; -+ cache->cache[slot].id.gid = gid; -+ } else { -+ cache->cache[slot].name = strdup(name); -+ if (cache->cache[slot].name != NULL) { -+ cache->cache[slot].id.gid = gid; -+ return (cache->cache[slot].name); -+ } -+ /* -+ * Conveniently, NULL marks an empty slot, so -+ * if the strdup() fails, we've just failed to -+ * cache it. No recovery necessary. -+ */ -+ } -+ } -+ return (NULL); - } - - static int --lookup_gname_helper(struct bsdtar *bsdtar, const char **name, id_t id) -+lookup_gname_helper(struct bsdtar *bsdtar, const char **name, gid_t gid) - { - struct group *grent; - - (void)bsdtar; /* UNUSED */ - - errno = 0; -- grent = getgrgid((gid_t)id); -+ grent = getgrgid(gid); - if (grent == NULL) { - *name = NULL; - if (errno != 0) -- bsdtar_warnc(bsdtar, errno, "getgrgid(%d) failed", id); -+ bsdtar_warnc(bsdtar, errno, "getgrgid(%d) failed", gid); - return (errno); - } - -- 2.41.0