svn commit: r348971 - in vendor/libarchive/dist: . build build/ci build/cmake contrib libarchive libarchive_fe tar
Martin Matuska
mm at FreeBSD.org
Tue Jun 11 23:16:18 UTC 2019
Author: mm
Date: Tue Jun 11 23:16:13 2019
New Revision: 348971
URL: https://svnweb.freebsd.org/changeset/base/348971
Log:
Update vendor/libarchive/dist to git 614110e76d9dbb9ed3e159a71cbd75fa3b23efe3
Relevant vendor changes (release 3.4.0):
- check_symlinks_fsobj() without chdir() and fchdir()
- bsdtar.1 manpage fixes
- patches from OpenBSD to libarchive_fe/passphrase.c
Modified:
vendor/libarchive/dist/.gitignore
vendor/libarchive/dist/CMakeLists.txt
vendor/libarchive/dist/NEWS
vendor/libarchive/dist/README.md
vendor/libarchive/dist/build/ci/build.sh
vendor/libarchive/dist/build/cmake/config.h.in
vendor/libarchive/dist/build/version
vendor/libarchive/dist/configure.ac
vendor/libarchive/dist/contrib/libarchive.spec
vendor/libarchive/dist/libarchive/archive.h
vendor/libarchive/dist/libarchive/archive_entry.h
vendor/libarchive/dist/libarchive/archive_write_add_filter_b64encode.c
vendor/libarchive/dist/libarchive/archive_write_disk_posix.c
vendor/libarchive/dist/libarchive/archive_write_disk_windows.c
vendor/libarchive/dist/libarchive_fe/line_reader.c
vendor/libarchive/dist/libarchive_fe/passphrase.c
vendor/libarchive/dist/tar/bsdtar.1
Modified: vendor/libarchive/dist/.gitignore
==============================================================================
--- vendor/libarchive/dist/.gitignore Tue Jun 11 23:00:55 2019 (r348970)
+++ vendor/libarchive/dist/.gitignore Tue Jun 11 23:16:13 2019 (r348971)
@@ -1,19 +1,19 @@
*~
*.o
*.exe
+*.la
*.lo
*.cmake
+.deps/
.libs/
+.dirstamp
Makefile
Makefile.in
aclocal.m4
autom4te.cache/
bsdcat
-bsdcat_test
bsdcpio
-bsdcpio_test
bsdtar
-bsdtar_test
build/autoconf/compile
build/autoconf/config.guess
build/autoconf/config.sub
@@ -27,50 +27,22 @@ build/autoconf/ltversion.m4
build/autoconf/lt~obsolete.m4
build/autoconf/missing
build/pkgconfig/libarchive.pc
-cat/.deps/
-cat/.dirstamp
-cat/test/.deps/
-cat/test/.dirstamp
cat/test/list.h
+config.cache
config.h
config.h.in
config.log
config.status
configure
-cpio/.deps/
-cpio/.dirstamp
-cpio/test/.deps/
-cpio/test/.dirstamp
cpio/test/list.h
-libarchive.la
-libarchive/.deps/
-libarchive/.dirstamp
-libarchive/test/.deps/
-libarchive/test/.dirstamp
libarchive/test/list.h
-libarchive_fe.la
-libarchive_fe/.deps/
-libarchive_fe/.dirstamp
-libarchive_test
libtool
stamp-h1
-tar/.deps/
-tar/.dirstamp
-tar/test/.deps/
-tar/test/.dirstamp
tar/test/list.h
CMakeCache.txt
CMakeFiles/
DartConfiguration.tcl
cmake.tmp/
-cpio/CMakeFiles/
-cpio/test/CMakeFiles/
-libarchive/CMakeFiles/
-libarchive/test/CMakeFiles/
-tar/CMakeFiles/
-tar/test/CMakeFiles/
-test_utils/.deps/
-test_utils/.dirstamp
doc/html/*.html
doc/man/*.1
@@ -90,15 +62,10 @@ libarchive/libarchive.so.*
.DS_Store
-bsdcat_test.log
-bsdcat_test.trs
-bsdcpio_test.log
-bsdcpio_test.trs
-bsdtar_test.log
-bsdtar_test.trs
+/*_test
+/*_test.log
+/*_test.trs
build/autoconf/test-driver
-libarchive_test.log
-libarchive_test.trs
test-suite.log
.sw?
Modified: vendor/libarchive/dist/CMakeLists.txt
==============================================================================
--- vendor/libarchive/dist/CMakeLists.txt Tue Jun 11 23:00:55 2019 (r348970)
+++ vendor/libarchive/dist/CMakeLists.txt Tue Jun 11 23:16:13 2019 (r348971)
@@ -18,7 +18,7 @@ endif()
# RelWithDebInfo : Release build with Debug Info
# MinSizeRel : Release Min Size build
IF(NOT CMAKE_BUILD_TYPE)
- SET(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Build Type" FORCE)
+ SET(CMAKE_BUILD_TYPE "Release" CACHE STRING "Build Type" FORCE)
ENDIF(NOT CMAKE_BUILD_TYPE)
# Set a value type to properly display CMAKE_BUILD_TYPE on GUI if the
# value type is "UNINITIALIZED".
@@ -1350,6 +1350,7 @@ CHECK_FUNCTION_EXISTS_GLIBC(strrchr HAVE_STRRCHR)
CHECK_FUNCTION_EXISTS_GLIBC(symlink HAVE_SYMLINK)
CHECK_FUNCTION_EXISTS_GLIBC(timegm HAVE_TIMEGM)
CHECK_FUNCTION_EXISTS_GLIBC(tzset HAVE_TZSET)
+CHECK_FUNCTION_EXISTS_GLIBC(unlinkat HAVE_UNLINKAT)
CHECK_FUNCTION_EXISTS_GLIBC(unsetenv HAVE_UNSETENV)
CHECK_FUNCTION_EXISTS_GLIBC(utime HAVE_UTIME)
CHECK_FUNCTION_EXISTS_GLIBC(utimes HAVE_UTIMES)
Modified: vendor/libarchive/dist/NEWS
==============================================================================
--- vendor/libarchive/dist/NEWS Tue Jun 11 23:00:55 2019 (r348970)
+++ vendor/libarchive/dist/NEWS Tue Jun 11 23:16:13 2019 (r348971)
@@ -1,3 +1,7 @@
+Jun 11, 2019: libarchive 3.4.0 released
+
+May 18, 2019: Fixes for reading Android APK and JAR archives
+
Apr 16, 2019: Support for non-recursive list and extract
Apr 14, 2019: New tar option: --exclude-vcs
@@ -6,7 +10,7 @@ Mar 27, 2019: Support for file and directory symlinks
Mar 12, 2019: Important fixes for storing file attributes and flags
-Jan 20, 2019: Support for xz, lzma, ppmd8 and bzip2 compression in zip archives
+Jan 20, 2019: Support for xz, lzma, ppmd8 and bzip2 decompression in ZIP files
Oct 06, 2018: RAR 5.0 reader
Modified: vendor/libarchive/dist/README.md
==============================================================================
--- vendor/libarchive/dist/README.md Tue Jun 11 23:00:55 2019 (r348970)
+++ vendor/libarchive/dist/README.md Tue Jun 11 23:16:13 2019 (r348971)
@@ -81,6 +81,7 @@ Currently, the library automatically detects and reads
* Binary cpio (big-endian or little-endian)
* ISO9660 CD-ROM images (with optional Rockridge or Joliet extensions)
* ZIP archives (with uncompressed or "deflate" compressed entries, including support for encrypted Zip archives)
+ * ZIPX archives (with support for bzip2, ppmd8, lzma and xz compressed entries)
* GNU and BSD 'ar' archives
* 'mtree' format
* 7-Zip archives
Modified: vendor/libarchive/dist/build/ci/build.sh
==============================================================================
--- vendor/libarchive/dist/build/ci/build.sh Tue Jun 11 23:00:55 2019 (r348970)
+++ vendor/libarchive/dist/build/ci/build.sh Tue Jun 11 23:16:13 2019 (r348971)
@@ -75,7 +75,7 @@ if [ -n "${DEBUG}" ]; then
else
export CFLAGS="-g -fsanitize=address"
fi
- if ["${BS}" = "cmake" ]; then
+ if [ "${BS}" = "cmake" ]; then
CONFIGURE_ARGS="${CONFIGURE_ARGS} -DCMAKE_C_CFLAGS=-g -fsanitize=address"
fi
fi
Modified: vendor/libarchive/dist/build/cmake/config.h.in
==============================================================================
--- vendor/libarchive/dist/build/cmake/config.h.in Tue Jun 11 23:00:55 2019 (r348970)
+++ vendor/libarchive/dist/build/cmake/config.h.in Tue Jun 11 23:16:13 2019 (r348971)
@@ -1111,6 +1111,9 @@ typedef uint64_t uintmax_t;
/* Define to 1 if you have the <unistd.h> header file. */
#cmakedefine HAVE_UNISTD_H 1
+/* Define to 1 if you have the `unlinkat' function. */
+#cmakedefine HAVE_UNLINKAT 1
+
/* Define to 1 if you have the `unsetenv' function. */
#cmakedefine HAVE_UNSETENV 1
Modified: vendor/libarchive/dist/build/version
==============================================================================
--- vendor/libarchive/dist/build/version Tue Jun 11 23:00:55 2019 (r348970)
+++ vendor/libarchive/dist/build/version Tue Jun 11 23:16:13 2019 (r348971)
@@ -1 +1 @@
-3003004dev
+3004000
Modified: vendor/libarchive/dist/configure.ac
==============================================================================
--- vendor/libarchive/dist/configure.ac Tue Jun 11 23:00:55 2019 (r348970)
+++ vendor/libarchive/dist/configure.ac Tue Jun 11 23:16:13 2019 (r348971)
@@ -4,8 +4,8 @@ dnl First, define all of the version numbers up front.
dnl In particular, this allows the version macro to be used in AC_INIT
dnl These first two version numbers are updated automatically on each release.
-m4_define([LIBARCHIVE_VERSION_S],[3.3.4dev])
-m4_define([LIBARCHIVE_VERSION_N],[3003004])
+m4_define([LIBARCHIVE_VERSION_S],[3.4.0])
+m4_define([LIBARCHIVE_VERSION_N],[3004000])
dnl bsdtar and bsdcpio versioning tracks libarchive
m4_define([BSDTAR_VERSION_S],LIBARCHIVE_VERSION_S())
@@ -636,7 +636,7 @@ AC_CHECK_FUNCS([nl_langinfo openat pipe poll posix_spa
AC_CHECK_FUNCS([readpassphrase])
AC_CHECK_FUNCS([select setenv setlocale sigaction statfs statvfs])
AC_CHECK_FUNCS([strchr strdup strerror strncpy_s strrchr symlink timegm])
-AC_CHECK_FUNCS([tzset unsetenv utime utimensat utimes vfork])
+AC_CHECK_FUNCS([tzset unlinkat unsetenv utime utimensat utimes vfork])
AC_CHECK_FUNCS([wcrtomb wcscmp wcscpy wcslen wctomb wmemcmp wmemcpy wmemmove])
AC_CHECK_FUNCS([_ctime64_s _fseeki64])
AC_CHECK_FUNCS([_get_timezone _localtime64_s _mkgmtime64])
Modified: vendor/libarchive/dist/contrib/libarchive.spec
==============================================================================
--- vendor/libarchive/dist/contrib/libarchive.spec Tue Jun 11 23:00:55 2019 (r348970)
+++ vendor/libarchive/dist/contrib/libarchive.spec Tue Jun 11 23:16:13 2019 (r348971)
@@ -1,105 +1,216 @@
-Summary: Library to create and read several different archive formats
-Name: libarchive
-Version: 3.1.2
-Release: 1
+Name: {{{ git_name }}}
+Version: {{{ git_version lead=3 follow=4 }}}
+Release: 1%{?dist}
+Summary: A library for handling streaming archive formats
+
License: BSD
-Group: Libraries
-Source0: http://libarchive.org/downloads/%{name}-%{version}.tar.gz
-URL: http:/libarchive.org/
-Requires: glibc
-Requires: zlib
-Requires: bzip2
+URL: http://www.libarchive.org/
+Source: {{{ git_pack }}}
+
+VCS: {{{ git_vcs }}}
+
+BuildRequires: automake
+BuildRequires: bison
+BuildRequires: bzip2-devel
+BuildRequires: e2fsprogs-devel
BuildRequires: gcc
-BuildRequires: gcc-c++
-BuildRequires: gawk
+BuildRequires: libacl-devel
+BuildRequires: libattr-devel
+BuildRequires: libtool
+BuildRequires: libxml2-devel
+BuildRequires: libzstd-devel
+BuildRequires: lz4-devel
+BuildRequires: lzo-devel
+BuildRequires: openssl-devel
+BuildRequires: sharutils
+BuildRequires: xz-devel
BuildRequires: zlib-devel
-BuildRequires: bzip2
-BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
-Libarchive is a programming library that can create and read several
-different streaming archive formats, including most popular TAR
-variants and several CPIO formats. It can also write SHAR archives.
+Libarchive is a programming library that can create and read several different
+streaming archive formats, including most popular tar variants, several cpio
+formats, and both BSD and GNU ar variants. It can also write shar archives and
+read ISO9660 CDROM images and ZIP archives.
+
%package devel
-Summary: Header files for libarchive library
-Group: Development/Libraries
-Requires: %{name} = %{version}-%{release}
+Summary: Development files for %{name}
+Requires: %{name}%{?_isa} = %{version}-%{release}
%description devel
-Header files for libarchive library.
+The %{name}-devel package contains libraries and header files for
+developing applications that use %{name}.
-%package static
-Summary: Static libarchive library
-Group: Development/Libraries
-Requires: %{name}-devel = %{version}-%{release}
-%description static
-Static libarchive library.
-
%package -n bsdtar
-Summary: bsdtar - tar(1) implementation based on libarchive
-Group: Applications/Archiving
-Requires: %{name} = %{version}-%{release}
+Summary: Manipulate tape archives
+Requires: %{name}%{?_isa} = %{version}-%{release}
%description -n bsdtar
-bsdtar - tar(1) implementation based on libarchive.
+The bsdtar package contains standalone bsdtar utility split off regular
+libarchive packages.
+
%package -n bsdcpio
-Summary: bsdcpio - cpio(1) implementation based on libarchive
-Group: Applications/Archiving
-Requires: %{name} = %{version}-%{release}
+Summary: Copy files to and from archives
+Requires: %{name}%{?_isa} = %{version}-%{release}
%description -n bsdcpio
-bsdcpio - cpio(1) implementation based on libarchive
+The bsdcpio package contains standalone bsdcpio utility split off regular
+libarchive packages.
+
+%package -n bsdcat
+Summary: Expand files to standard output
+Requires: %{name}%{?_isa} = %{version}-%{release}
+
+%description -n bsdcat
+The bsdcat program typically takes a filename as an argument or reads standard
+input when used in a pipe. In both cases decompressed data it written to
+standard output.
+
+
%prep
-%setup -q
+{{{ git_setup_macro }}}
+%autosetup -p1
+
%build
-mkdir -p %{buildroot}
-./configure \
---prefix=%{_prefix} \
---libexecdir=%{_libexecdir} \
---libdir=%{_libdir} \
---mandir=%{_mandir} \
---infodir=%{_infodir} \
---enable-shared=yes \
---enable-static=yes \
-| tee %{buildroot}/config.log
-make | tee %{buildroot}/make.log
+build/autogen.sh
+%configure --disable-static --without-nettle LT_SYS_LIBRARY_PATH=%_libdir
+%make_build
+
%install
-[ "%buildroot" != "/" ] && [ -d %buildroot ] && rm -rf %buildroot;
-make DESTDIR=%buildroot install
+make install DESTDIR=$RPM_BUILD_ROOT
+find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';'
-%clean
-rm -fr %buildroot
+# rhbz#1294252
+replace ()
+{
+ filename=$1
+ file=`basename "$filename"`
+ binary=${file%%.*}
+ pattern=${binary##bsd}
-%files
-%{_libdir}/libarchive.so*
+ awk "
+ # replace the topic
+ /^.Dt ${pattern^^} 1/ {
+ print \".Dt ${binary^^} 1\";
+ next;
+ }
+ # replace the first occurence of \"$pattern\" by \"$binary\"
+ !stop && /^.Nm $pattern/ {
+ print \".Nm $binary\" ;
+ stop = 1 ;
+ next;
+ }
+ # print remaining lines
+ 1;
+ " "$filename" > "$filename.new"
+ mv "$filename".new "$filename"
+}
-%files static
-%{_libdir}/libarchive.a
+for manpage in bsdtar.1 bsdcpio.1
+do
+ installed_manpage=`find "$RPM_BUILD_ROOT" -name "$manpage"`
+ replace "$installed_manpage"
+done
+
+%check
+%if %{with check}
+logfiles ()
+{
+ find -name '*_test.log' -or -name test-suite.log
+}
+
+tempdirs ()
+{
+ cat `logfiles` \
+ | awk "match(\$0, /[^[:space:]]*`date -I`[^[:space:]]*/) { print substr(\$0, RSTART, RLENGTH); }" \
+ | sort | uniq
+}
+
+cat_logs ()
+{
+ for i in `logfiles`
+ do
+ echo "=== $i ==="
+ cat "$i"
+ done
+}
+
+run_testsuite ()
+{
+ rc=0
+ %make_build check -j1 || {
+ # error happened - try to extract in koji as much info as possible
+ cat_logs
+
+ for i in `tempdirs`; do
+ if test -d "$i" ; then
+ find $i -printf "%p\n ~> a: %a\n ~> c: %c\n ~> t: %t\n ~> %s B\n"
+ cat $i/*.log
+ fi
+ done
+ return 1
+ }
+ cat_logs
+}
+
+# On a ppc/ppc64 is some race condition causing 'make check' fail on ppc
+# when both 32 and 64 builds are done in parallel on the same machine in
+# koji. Try to run once again if failed.
+%ifarch ppc
+run_testsuite || run_testsuite
+%else
+run_testsuite
+%endif
+%endif
+
+
+%files
+%{!?_licensedir:%global license %%doc}
+%license COPYING
+%doc NEWS README.md
+%{_libdir}/libarchive.so.13*
+%{_mandir}/*/cpio.*
+%{_mandir}/*/mtree.*
+%{_mandir}/*/tar.*
+
%files devel
-%{_libdir}/pkgconfig/libarchive.pc
-%{_libdir}/libarchive.la
%{_includedir}/*.h
-%doc %{_mandir}/man3/*
-%doc %{_mandir}/man5/*
+%{_mandir}/*/archive*
+%{_mandir}/*/libarchive*
+%{_libdir}/libarchive.so
+%{_libdir}/pkgconfig/libarchive.pc
%files -n bsdtar
-%attr(755,root,root) %{_bindir}/bsdtar
-%doc %{_mandir}/man1/bsdtar.1*
+%{!?_licensedir:%global license %%doc}
+%license COPYING
+%doc NEWS README.md
+%{_bindir}/bsdtar
+%{_mandir}/*/bsdtar*
%files -n bsdcpio
-%attr(755,root,root) %{_bindir}/bsdcpio
-%doc %{_mandir}/man1/bsdcpio.1*
+%{!?_licensedir:%global license %%doc}
+%license COPYING
+%doc NEWS README.md
+%{_bindir}/bsdcpio
+%{_mandir}/*/bsdcpio*
+%files -n bsdcat
+%{!?_licensedir:%global license %%doc}
+%license COPYING
+%doc NEWS README.md
+%{_bindir}/bsdcat
+%{_mandir}/*/bsdcat*
+
+
+
%changelog
-* Wed May 01 2013 Nikolai Lifanov <lifanov at mail.lifanov.com> - 3.1.2-1
-- Initial package
-- contrib/libarchive.spec by PLD team overhaul
-- Added "bsdcpio" package
-- Fixed build on x86_64 platform
+* Thu Mar 28 2019 Pavel Raiskup <praiskup at redhat.com> - 3.3.3-7
+- simplify libtool hacks
+
+{{ git_changelog }}
Modified: vendor/libarchive/dist/libarchive/archive.h
==============================================================================
--- vendor/libarchive/dist/libarchive/archive.h Tue Jun 11 23:00:55 2019 (r348970)
+++ vendor/libarchive/dist/libarchive/archive.h Tue Jun 11 23:16:13 2019 (r348971)
@@ -36,7 +36,7 @@
* assert that ARCHIVE_VERSION_NUMBER >= 2012108.
*/
/* Note: Compiler will complain if this does not match archive_entry.h! */
-#define ARCHIVE_VERSION_NUMBER 3003004
+#define ARCHIVE_VERSION_NUMBER 3004000
#include <sys/stat.h>
#include <stddef.h> /* for wchar_t */
@@ -155,7 +155,7 @@ __LA_DECL int archive_version_number(void);
/*
* Textual name/version of the library, useful for version displays.
*/
-#define ARCHIVE_VERSION_ONLY_STRING "3.3.4dev"
+#define ARCHIVE_VERSION_ONLY_STRING "3.4.0"
#define ARCHIVE_VERSION_STRING "libarchive " ARCHIVE_VERSION_ONLY_STRING
__LA_DECL const char * archive_version_string(void);
Modified: vendor/libarchive/dist/libarchive/archive_entry.h
==============================================================================
--- vendor/libarchive/dist/libarchive/archive_entry.h Tue Jun 11 23:00:55 2019 (r348970)
+++ vendor/libarchive/dist/libarchive/archive_entry.h Tue Jun 11 23:16:13 2019 (r348971)
@@ -30,7 +30,7 @@
#define ARCHIVE_ENTRY_H_INCLUDED
/* Note: Compiler will complain if this does not match archive.h! */
-#define ARCHIVE_VERSION_NUMBER 3003004
+#define ARCHIVE_VERSION_NUMBER 3004000
/*
* Note: archive_entry.h is for use outside of libarchive; the
Modified: vendor/libarchive/dist/libarchive/archive_write_add_filter_b64encode.c
==============================================================================
--- vendor/libarchive/dist/libarchive/archive_write_add_filter_b64encode.c Tue Jun 11 23:00:55 2019 (r348970)
+++ vendor/libarchive/dist/libarchive/archive_write_add_filter_b64encode.c Tue Jun 11 23:16:13 2019 (r348971)
@@ -60,7 +60,7 @@ static int archive_filter_b64encode_write(struct archi
const void *, size_t);
static int archive_filter_b64encode_close(struct archive_write_filter *);
static int archive_filter_b64encode_free(struct archive_write_filter *);
-static void b64_encode(struct archive_string *, const unsigned char *, size_t);
+static void la_b64_encode(struct archive_string *, const unsigned char *, size_t);
static int64_t atol8(const char *, size_t);
static const char base64[] = {
@@ -180,7 +180,7 @@ archive_filter_b64encode_open(struct archive_write_fil
}
static void
-b64_encode(struct archive_string *as, const unsigned char *p, size_t len)
+la_b64_encode(struct archive_string *as, const unsigned char *p, size_t len)
{
int c;
@@ -234,12 +234,12 @@ archive_filter_b64encode_write(struct archive_write_fi
}
if (state->hold_len < LBYTES)
return (ret);
- b64_encode(&state->encoded_buff, state->hold, LBYTES);
+ la_b64_encode(&state->encoded_buff, state->hold, LBYTES);
state->hold_len = 0;
}
for (; length >= LBYTES; length -= LBYTES, p += LBYTES)
- b64_encode(&state->encoded_buff, p, LBYTES);
+ la_b64_encode(&state->encoded_buff, p, LBYTES);
/* Save remaining bytes. */
if (length > 0) {
@@ -270,7 +270,7 @@ archive_filter_b64encode_close(struct archive_write_fi
/* Flush remaining bytes. */
if (state->hold_len != 0)
- b64_encode(&state->encoded_buff, state->hold, state->hold_len);
+ la_b64_encode(&state->encoded_buff, state->hold, state->hold_len);
archive_string_sprintf(&state->encoded_buff, "====\n");
/* Write the last block */
archive_write_set_bytes_in_last_block(f->archive, 1);
Modified: vendor/libarchive/dist/libarchive/archive_write_disk_posix.c
==============================================================================
--- vendor/libarchive/dist/libarchive/archive_write_disk_posix.c Tue Jun 11 23:00:55 2019 (r348970)
+++ vendor/libarchive/dist/libarchive/archive_write_disk_posix.c Tue Jun 11 23:16:13 2019 (r348971)
@@ -165,6 +165,10 @@ __FBSDID("$FreeBSD$");
#define O_NOFOLLOW 0
#endif
+#ifndef AT_FDCWD
+#define AT_FDCWD -100
+#endif
+
struct fixup_entry {
struct fixup_entry *next;
struct archive_acl acl;
@@ -348,6 +352,8 @@ struct archive_write_disk {
#define HFS_BLOCKS(s) ((s) >> 12)
+
+static int la_opendirat(int, const char *);
static void fsobj_error(int *, struct archive_string *, int, const char *,
const char *);
static int check_symlinks_fsobj(char *, int *, struct archive_string *,
@@ -401,6 +407,37 @@ static ssize_t _archive_write_disk_data_block(struct a
size_t, int64_t);
static int
+la_opendirat(int fd, const char *path) {
+ const int flags = O_CLOEXEC
+#if defined(O_BINARY)
+ | O_BINARY
+#endif
+#if defined(O_DIRECTORY)
+ | O_DIRECTORY
+#endif
+#if defined(O_PATH)
+ | O_PATH
+#elif defined(O_SEARCH)
+ | O_SEARCH
+#elif defined(O_EXEC)
+ | O_EXEC
+#else
+ | O_RDONLY
+#endif
+ ;
+
+#if !defined(HAVE_OPENAT)
+ if (fd != AT_FDCWD) {
+ errno = ENOTSUP;
+ return (-1);
+ } else
+ return (open(fd, path, flags));
+#else
+ return (openat(fd, path, flags));
+#endif
+}
+
+static int
lazy_stat(struct archive_write_disk *a)
{
if (a->pst != NULL) {
@@ -1909,7 +1946,7 @@ edit_deep_directories(struct archive_write_disk *a)
return;
/* Try to record our starting dir. */
- a->restore_pwd = open(".", O_RDONLY | O_BINARY | O_CLOEXEC);
+ a->restore_pwd = la_opendirat(AT_FDCWD, ".");
__archive_ensure_cloexec_flag(a->restore_pwd);
if (a->restore_pwd < 0)
return;
@@ -2342,7 +2379,7 @@ _archive_write_disk_close(struct archive *_a)
{
struct archive_write_disk *a = (struct archive_write_disk *)_a;
struct fixup_entry *next, *p;
- int ret;
+ int fd, ret;
archive_check_magic(&a->archive, ARCHIVE_WRITE_DISK_MAGIC,
ARCHIVE_STATE_HEADER | ARCHIVE_STATE_DATA,
@@ -2353,21 +2390,33 @@ _archive_write_disk_close(struct archive *_a)
p = sort_dir_list(a->fixup_list);
while (p != NULL) {
+ fd = -1;
a->pst = NULL; /* Mark stat cache as out-of-date. */
+ if (p->fixup &
+ (TODO_TIMES | TODO_MODE_BASE | TODO_ACLS | TODO_FFLAGS)) {
+ fd = open(p->name,
+ O_WRONLY | O_BINARY | O_NOFOLLOW | O_CLOEXEC);
+ }
if (p->fixup & TODO_TIMES) {
- set_times(a, -1, p->mode, p->name,
+ set_times(a, fd, p->mode, p->name,
p->atime, p->atime_nanos,
p->birthtime, p->birthtime_nanos,
p->mtime, p->mtime_nanos,
p->ctime, p->ctime_nanos);
}
- if (p->fixup & TODO_MODE_BASE)
+ if (p->fixup & TODO_MODE_BASE) {
+#ifdef HAVE_FCHMOD
+ if (fd >= 0)
+ fchmod(fd, p->mode);
+ else
+#endif
chmod(p->name, p->mode);
+ }
if (p->fixup & TODO_ACLS)
- archive_write_disk_set_acls(&a->archive, -1, p->name,
- &p->acl, p->mode);
+ archive_write_disk_set_acls(&a->archive, fd,
+ p->name, &p->acl, p->mode);
if (p->fixup & TODO_FFLAGS)
- set_fflags_platform(a, -1, p->name,
+ set_fflags_platform(a, fd, p->name,
p->mode, p->fflags_set, 0);
if (p->fixup & TODO_MAC_METADATA)
set_mac_metadata(a, p->name, p->mac_metadata,
@@ -2376,6 +2425,8 @@ _archive_write_disk_close(struct archive *_a)
archive_acl_clear(&p->acl);
free(p->mac_metadata);
free(p->name);
+ if (fd >= 0)
+ close(fd);
free(p);
p = next;
}
@@ -2540,8 +2591,6 @@ fsobj_error(int *a_eno, struct archive_string *a_estr,
* scan the path and both can be optimized by comparing against other
* recent paths.
*/
-/* TODO: Extend this to support symlinks on Windows Vista and later. */
-
/*
* Checks the given path to see if any elements along it are symlinks. Returns
* ARCHIVE_OK if there are none, otherwise puts an error in errmsg.
@@ -2550,7 +2599,8 @@ static int
check_symlinks_fsobj(char *path, int *a_eno, struct archive_string *a_estr,
int flags)
{
-#if !defined(HAVE_LSTAT)
+#if !defined(HAVE_LSTAT) && \
+ !(defined(HAVE_OPENAT) && defined(HAVE_FSTATAT) && defined(HAVE_UNLINKAT))
/* Platform doesn't have lstat, so we can't look for symlinks. */
(void)path; /* UNUSED */
(void)error_number; /* UNUSED */
@@ -2565,7 +2615,10 @@ check_symlinks_fsobj(char *path, int *a_eno, struct ar
char c;
int r;
struct stat st;
- int restore_pwd;
+ int chdir_fd;
+#if defined(HAVE_OPENAT) && defined(HAVE_FSTATAT) && defined(HAVE_UNLINKAT)
+ int fd;
+#endif
/* Nothing to do here if name is empty */
if(path[0] == '\0')
@@ -2586,9 +2639,9 @@ check_symlinks_fsobj(char *path, int *a_eno, struct ar
* c holds what used to be in *tail
* last is 1 if this is the last tail
*/
- restore_pwd = open(".", O_RDONLY | O_BINARY | O_CLOEXEC);
- __archive_ensure_cloexec_flag(restore_pwd);
- if (restore_pwd < 0) {
+ chdir_fd = la_opendirat(AT_FDCWD, ".");
+ __archive_ensure_cloexec_flag(chdir_fd);
+ if (chdir_fd < 0) {
fsobj_error(a_eno, a_estr, errno,
"Could not open ", path);
return (ARCHIVE_FATAL);
@@ -2621,7 +2674,11 @@ check_symlinks_fsobj(char *path, int *a_eno, struct ar
c = tail[0];
tail[0] = '\0';
/* Check that we haven't hit a symlink. */
+#if defined(HAVE_OPENAT) && defined(HAVE_FSTATAT) && defined(HAVE_UNLINKAT)
+ r = fstatat(chdir_fd, head, &st, AT_SYMLINK_NOFOLLOW);
+#else
r = lstat(head, &st);
+#endif
if (r != 0) {
tail[0] = c;
/* We've hit a dir that doesn't exist; stop now. */
@@ -2647,7 +2704,19 @@ check_symlinks_fsobj(char *path, int *a_eno, struct ar
}
} else if (S_ISDIR(st.st_mode)) {
if (!last) {
- if (chdir(head) != 0) {
+#if defined(HAVE_OPENAT) && defined(HAVE_FSTATAT) && defined(HAVE_UNLINKAT)
+ fd = la_opendirat(chdir_fd, head);
+ if (fd < 0)
+ r = -1;
+ else {
+ r = 0;
+ close(chdir_fd);
+ chdir_fd = fd;
+ }
+#else
+ r = chdir(head);
+#endif
+ if (r != 0) {
tail[0] = c;
fsobj_error(a_eno, a_estr, errno,
"Could not chdir ", path);
@@ -2664,7 +2733,12 @@ check_symlinks_fsobj(char *path, int *a_eno, struct ar
* so we can overwrite it with the
* item being extracted.
*/
- if (unlink(head)) {
+#if defined(HAVE_OPENAT) && defined(HAVE_FSTATAT) && defined(HAVE_UNLINKAT)
+ r = unlinkat(chdir_fd, head, 0);
+#else
+ r = unlink(head);
+#endif
+ if (r != 0) {
tail[0] = c;
fsobj_error(a_eno, a_estr, errno,
"Could not remove symlink ",
@@ -2694,7 +2768,12 @@ check_symlinks_fsobj(char *path, int *a_eno, struct ar
break;
} else if (flags & ARCHIVE_EXTRACT_UNLINK) {
/* User asked us to remove problems. */
- if (unlink(head) != 0) {
+#if defined(HAVE_OPENAT) && defined(HAVE_FSTATAT) && defined(HAVE_UNLINKAT)
+ r = unlinkat(chdir_fd, head, 0);
+#else
+ r = unlink(head);
+#endif
+ if (r != 0) {
tail[0] = c;
fsobj_error(a_eno, a_estr, 0,
"Cannot remove intervening "
@@ -2712,7 +2791,11 @@ check_symlinks_fsobj(char *path, int *a_eno, struct ar
* This is needed to extract hardlinks over
* symlinks.
*/
+#if defined(HAVE_OPENAT) && defined(HAVE_FSTATAT) && defined(HAVE_UNLINKAT)
+ r = fstatat(chdir_fd, head, &st, 0);
+#else
r = la_stat(head, &st);
+#endif
if (r != 0) {
tail[0] = c;
if (errno == ENOENT) {
@@ -2725,7 +2808,19 @@ check_symlinks_fsobj(char *path, int *a_eno, struct ar
break;
}
} else if (S_ISDIR(st.st_mode)) {
- if (chdir(head) != 0) {
+#if defined(HAVE_OPENAT) && defined(HAVE_FSTATAT) && defined(HAVE_UNLINKAT)
+ fd = la_opendirat(chdir_fd, head);
+ if (fd < 0)
+ r = -1;
+ else {
+ r = 0;
+ close(chdir_fd);
+ chdir_fd = fd;
+ }
+#else
+ r = chdir(head);
+#endif
+ if (r != 0) {
tail[0] = c;
fsobj_error(a_eno, a_estr,
errno,
@@ -2761,16 +2856,21 @@ check_symlinks_fsobj(char *path, int *a_eno, struct ar
}
/* Catches loop exits via break */
tail[0] = c;
-#ifdef HAVE_FCHDIR
+#if defined(HAVE_OPENAT) && defined(HAVE_FSTATAT) && defined(HAVE_UNLINKAT)
+ /* If we operate with openat(), fstatat() and unlinkat() there was
+ * no chdir(), so just close the fd */
+ if (chdir_fd >= 0)
+ close(chdir_fd);
+#elif HAVE_FCHDIR
/* If we changed directory above, restore it here. */
- if (restore_pwd >= 0) {
- r = fchdir(restore_pwd);
+ if (chdir_fd >= 0) {
+ r = fchdir(chdir_fd);
if (r != 0) {
fsobj_error(a_eno, a_estr, errno,
"chdir() failure", "");
}
- close(restore_pwd);
- restore_pwd = -1;
+ close(chdir_fd);
+ chdir_fd = -1;
if (r != 0) {
res = (ARCHIVE_FATAL);
}
@@ -3387,6 +3487,7 @@ static int
set_mode(struct archive_write_disk *a, int mode)
{
int r = ARCHIVE_OK;
+ int r2;
mode &= 07777; /* Strip off file type bits. */
if (a->todo & TODO_SGID_CHECK) {
@@ -3443,16 +3544,26 @@ set_mode(struct archive_write_disk *a, int mode)
}
if (S_ISLNK(a->mode)) {
-#ifdef HAVE_LCHMOD
/*
- * If this is a symlink, use lchmod(). If the
+ * If this is a symlink, use fchmod() or lchmod(). If the
* platform doesn't support lchmod(), just skip it. A
* platform that doesn't provide a way to set
* permissions on symlinks probably ignores
* permissions on symlinks, so a failure here has no
* impact.
*/
- if (lchmod(a->name, mode) != 0) {
+#ifdef HAVE_FCHMOD
+ if (a->fd > 0)
+ r2 = fchmod(a->fd, mode);
+ else
+#endif
+#ifdef HAVE_LCHMOD
+ r2 = lchmod(a->name, mode);
+#else
+ /* We don't have lchmod() here and a fd is not given */
+ r2 = 0;
+#endif
+ if (r2 != 0) {
switch (errno) {
case ENOTSUP:
case ENOSYS:
@@ -3471,7 +3582,6 @@ set_mode(struct archive_write_disk *a, int mode)
r = ARCHIVE_WARN;
}
}
-#endif
} else if (!S_ISDIR(a->mode)) {
/*
* If it's not a symlink and not a dir, then use
@@ -3480,21 +3590,19 @@ set_mode(struct archive_write_disk *a, int mode)
* post-extract fixup, which is handled elsewhere.
*/
#ifdef HAVE_FCHMOD
- if (a->fd >= 0) {
- if (fchmod(a->fd, mode) != 0) {
- archive_set_error(&a->archive, errno,
- "Can't set permissions to 0%o", (int)mode);
- r = ARCHIVE_WARN;
- }
- } else
+ if (a->fd >= 0)
+ r2 = fchmod(a->fd, mode);
+ else
#endif
- /* If this platform lacks fchmod(), then
- * we'll just use chmod(). */
- if (chmod(a->name, mode) != 0) {
- archive_set_error(&a->archive, errno,
- "Can't set permissions to 0%o", (int)mode);
- r = ARCHIVE_WARN;
- }
+ /* If this platform lacks fchmod(), then
+ * we'll just use chmod(). */
+ r2 = chmod(a->name, mode);
+
+ if (r2 != 0) {
+ archive_set_error(&a->archive, errno,
+ "Can't set permissions to 0%o", (int)mode);
+ r = ARCHIVE_WARN;
+ }
}
return (r);
}
Modified: vendor/libarchive/dist/libarchive/archive_write_disk_windows.c
==============================================================================
--- vendor/libarchive/dist/libarchive/archive_write_disk_windows.c Tue Jun 11 23:00:55 2019 (r348970)
+++ vendor/libarchive/dist/libarchive/archive_write_disk_windows.c Tue Jun 11 23:16:13 2019 (r348971)
@@ -1948,7 +1948,6 @@ current_fixup(struct archive_write_disk *a, const wcha
return (a->current_fixup);
}
-/* TODO: Make this work. */
/*
* TODO: The deep-directory support bypasses this; disable deep directory
* support if we're doing symlink checks.
@@ -1958,7 +1957,6 @@ current_fixup(struct archive_write_disk *a, const wcha
* scan the path and both can be optimized by comparing against other
* recent paths.
*/
-/* TODO: Extend this to support symlinks on Windows Vista and later. */
static int
check_symlinks(struct archive_write_disk *a)
{
Modified: vendor/libarchive/dist/libarchive_fe/line_reader.c
==============================================================================
--- vendor/libarchive/dist/libarchive_fe/line_reader.c Tue Jun 11 23:00:55 2019 (r348970)
+++ vendor/libarchive/dist/libarchive_fe/line_reader.c Tue Jun 11 23:16:13 2019 (r348971)
@@ -49,11 +49,10 @@ __FBSDID("$FreeBSD$");
*/
struct lafe_line_reader {
FILE *f;
- char *buff, *buff_end, *line_start, *line_end, *p;
+ char *buff, *buff_end, *line_start, *line_end;
char *pathname;
size_t buff_length;
int nullSeparator; /* Lines separated by null, not CR/CRLF/etc. */
- int ret;
};
struct lafe_line_reader *
Modified: vendor/libarchive/dist/libarchive_fe/passphrase.c
==============================================================================
--- vendor/libarchive/dist/libarchive_fe/passphrase.c Tue Jun 11 23:00:55 2019 (r348970)
+++ vendor/libarchive/dist/libarchive_fe/passphrase.c Tue Jun 11 23:16:13 2019 (r348971)
@@ -23,9 +23,11 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-/* $OpenBSD: readpassphrase.c,v 1.22 2010/01/13 10:20:54 dtucker Exp $ */
+/* $OpenBSD: readpassphrase.c,v 1.27 2019/01/25 00:19:25 millert Exp $ */
+
/*
- * Copyright (c) 2000-2002, 2007 Todd C. Miller <Todd.Miller at courtesan.com>
+ * Copyright (c) 2000-2002, 2007, 2010
+ * Todd C. Miller <millert at openbsd.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -199,6 +201,27 @@ restart:
}
/*
+ * Turn off echo if possible.
+ * If we are using a tty but are not the foreground pgrp this will
+ * generate SIGTTOU, so do it *before* installing the signal handlers.
+ */
+ if (input != STDIN_FILENO && tcgetattr(input, &oterm) == 0) {
+ memcpy(&term, &oterm, sizeof(term));
+ if (!(flags & RPP_ECHO_ON))
+ term.c_lflag &= ~(ECHO | ECHONL);
+#ifdef VSTATUS
+ if (term.c_cc[VSTATUS] != _POSIX_VDISABLE)
+ term.c_cc[VSTATUS] = _POSIX_VDISABLE;
+#endif
+ (void)tcsetattr(input, _T_FLUSH, &term);
+ } else {
+ memset(&term, 0, sizeof(term));
+ term.c_lflag |= ECHO;
+ memset(&oterm, 0, sizeof(oterm));
+ oterm.c_lflag |= ECHO;
+ }
*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
More information about the svn-src-all
mailing list