diff options
84 files changed, 826 insertions, 869 deletions
diff --git a/archivers/libarchive/files/Makefile.am b/archivers/libarchive/files/Makefile.am index f9e1f0bd137..5430f4f6ca5 100644 --- a/archivers/libarchive/files/Makefile.am +++ b/archivers/libarchive/files/Makefile.am @@ -254,7 +254,9 @@ libarchive_test_EXTRA_DIST=\ libarchive/test/test_read_format_gtar_sparse_1_17_posix01.tgz.uu \ libarchive/test/test_read_format_gtar_sparse_1_17_posix10.tgz.uu \ libarchive/test/test_read_format_gtar_sparse_1_17_posix10_modified.tar.uu \ - libarchive/test/test_read_format_tar_empty_filename.tar.uu + libarchive/test/test_read_format_isorr_bz2.iso.bz2.uu \ + libarchive/test/test_read_format_tar_empty_filename.tar.uu \ + libarchive/test/test_read_format_zip.zip.uu # diff --git a/archivers/libarchive/files/Makefile.in b/archivers/libarchive/files/Makefile.in index 06dba1c720d..24672995d40 100644 --- a/archivers/libarchive/files/Makefile.in +++ b/archivers/libarchive/files/Makefile.in @@ -345,7 +345,6 @@ distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ -ARCHIVE_H_INCLUDE_INTTYPES_H = @ARCHIVE_H_INCLUDE_INTTYPES_H@ ARCHIVE_LIBTOOL_VERSION = @ARCHIVE_LIBTOOL_VERSION@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ @@ -674,7 +673,9 @@ libarchive_test_EXTRA_DIST = \ libarchive/test/test_read_format_gtar_sparse_1_17_posix01.tgz.uu \ libarchive/test/test_read_format_gtar_sparse_1_17_posix10.tgz.uu \ libarchive/test/test_read_format_gtar_sparse_1_17_posix10_modified.tar.uu \ - libarchive/test/test_read_format_tar_empty_filename.tar.uu + libarchive/test/test_read_format_isorr_bz2.iso.bz2.uu \ + libarchive/test/test_read_format_tar_empty_filename.tar.uu \ + libarchive/test/test_read_format_zip.zip.uu # diff --git a/archivers/libarchive/files/NEWS b/archivers/libarchive/files/NEWS index b7e578e2902..36005fd1e9c 100644 --- a/archivers/libarchive/files/NEWS +++ b/archivers/libarchive/files/NEWS @@ -1,4 +1,12 @@ +Jul 02, 2008: libarchive 2.5.5 released + +Jul 02, 2008: libarchive 2.5.5b released +Jul 01, 2008: bsdcpio is being used by enough people, we can call it 1.0.0 now +Jun 20, 2008: bsdcpio: If a -l link fails with EXDEV, copy the file instead +Jun 19, 2008: bsdcpio: additional long options for better GNU cpio compat +Jun 15, 2008: Many small portability and bugfixes since 2.5.4b. + May 25, 2008: libarchive 2.5.4b released May 21, 2008: Joerg Sonnenberger: fix bsdtar hardlink handling for newc format diff --git a/archivers/libarchive/files/config.h.in b/archivers/libarchive/files/config.h.in index a253386b415..3aa2f3e837e 100644 --- a/archivers/libarchive/files/config.h.in +++ b/archivers/libarchive/files/config.h.in @@ -45,6 +45,9 @@ /* Define to 1 if you have the `chown' function. */ #undef HAVE_CHOWN +/* Define to 1 if you have the `chroot' function. */ +#undef HAVE_CHROOT + /* Define to 1 if you have the declaration of `INT64_MAX', and to 0 if you don't. */ #undef HAVE_DECL_INT64_MAX @@ -126,6 +129,9 @@ /* Define to 1 if fnmatch(3) supports the FNM_LEADING_DIR flag */ #undef HAVE_FNM_LEADING_DIR +/* Define to 1 if you have the `fork' function. */ +#undef HAVE_FORK + /* Define to 1 if fseeko (and presumably ftello) exists and is declared. */ #undef HAVE_FSEEKO @@ -192,9 +198,6 @@ /* Define to 1 if you have the <limits.h> header file. */ #undef HAVE_LIMITS_H -/* Define to 1 if you have the <linux/ext2_fs.h> header file. */ -#undef HAVE_LINUX_EXT2_FS_H - /* Define to 1 if you have the <linux/fs.h> header file. */ #undef HAVE_LINUX_FS_H @@ -314,12 +317,6 @@ /* 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'. */ -#undef HAVE_STRUCT_STAT_ST_RDEV - -/* Define to 1 if `tm_gmtoff' is member of `struct tm'. */ -#undef HAVE_STRUCT_TM_TM_GMTOFF - /* Define to 1 if you have the <sys/acl.h> header file. */ #undef HAVE_SYS_ACL_H @@ -406,6 +403,9 @@ /* Define to 1 if you have the `wcslen' function. */ #undef HAVE_WCSLEN +/* Define to 1 if you have the `wctomb' function. */ +#undef HAVE_WCTOMB + /* Define to 1 if you have the `wmemcmp' function. */ #undef HAVE_WMEMCMP diff --git a/archivers/libarchive/files/configure b/archivers/libarchive/files/configure index 3f49d7dbf18..0dca9a4ba2e 100755 --- a/archivers/libarchive/files/configure +++ b/archivers/libarchive/files/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.61 for libarchive 2.5.4b. +# Generated by GNU Autoconf 2.61 for libarchive 2.5.5. # # Report bugs to <kientzle@freebsd.org>. # @@ -728,8 +728,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='libarchive' PACKAGE_TARNAME='libarchive' -PACKAGE_VERSION='2.5.4b' -PACKAGE_STRING='libarchive 2.5.4b' +PACKAGE_VERSION='2.5.5' +PACKAGE_STRING='libarchive 2.5.5' PACKAGE_BUGREPORT='kientzle@freebsd.org' ac_unique_file="libarchive" @@ -885,7 +885,6 @@ BUILD_BSDCPIO_TRUE BUILD_BSDCPIO_FALSE STATIC_BSDCPIO_TRUE STATIC_BSDCPIO_FALSE -ARCHIVE_H_INCLUDE_INTTYPES_H LIBOBJS LTLIBOBJS' ac_subst_files='' @@ -1408,7 +1407,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures libarchive 2.5.4b to adapt to many kinds of systems. +\`configure' configures libarchive 2.5.5 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1478,7 +1477,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of libarchive 2.5.4b:";; + short | recursive ) echo "Configuration of libarchive 2.5.5:";; esac cat <<\_ACEOF @@ -1596,7 +1595,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -libarchive configure 2.5.4b +libarchive configure 2.5.5 generated by GNU Autoconf 2.61 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -1610,7 +1609,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by libarchive $as_me 2.5.4b, which was +It was created by libarchive $as_me 2.5.5, which was generated by GNU Autoconf 2.61. Invocation command line was $ $0 $@ @@ -2304,7 +2303,7 @@ fi # Define the identity of the package. PACKAGE='libarchive' - VERSION='2.5.4b' + VERSION='2.5.5' cat >>confdefs.h <<_ACEOF @@ -2455,41 +2454,41 @@ am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' # platforms. At least on FreeBSD, libtool uses an overly complex # convention that attempts to solve problems that most people just # don't have and which just causes confusion for most end users. -ARCHIVE_MAJOR=$(( 2005004 / 1000000 )) -ARCHIVE_MINOR=$(( (2005004 / 1000) % 1000 )) -ARCHIVE_REVISION=$(( 2005004 % 1000 )) +ARCHIVE_MAJOR=$(( 2005005 / 1000000 )) +ARCHIVE_MINOR=$(( (2005005 / 1000) % 1000 )) +ARCHIVE_REVISION=$(( 2005005 % 1000 )) ARCHIVE_LIBTOOL_MAJOR=`echo $((${ARCHIVE_MAJOR} + ${ARCHIVE_MINOR}))` ARCHIVE_LIBTOOL_VERSION=$ARCHIVE_LIBTOOL_MAJOR:$ARCHIVE_REVISION:$ARCHIVE_MINOR # Stick the version numbers into config.h cat >>confdefs.h <<\_ACEOF -#define LIBARCHIVE_VERSION_STRING "2.5.4b" +#define LIBARCHIVE_VERSION_STRING "2.5.5" _ACEOF cat >>confdefs.h <<_ACEOF -#define LIBARCHIVE_VERSION_NUMBER "2005004" +#define LIBARCHIVE_VERSION_NUMBER "2005005" _ACEOF cat >>confdefs.h <<\_ACEOF -#define BSDCPIO_VERSION_STRING "0.9.10a" +#define BSDCPIO_VERSION_STRING "1.0.0" _ACEOF cat >>confdefs.h <<\_ACEOF -#define BSDTAR_VERSION_STRING "2.5.4b" +#define BSDTAR_VERSION_STRING "2.5.5" _ACEOF # The shell variables here must be the same as the AC_SUBST() variables # below, but the shell variable names apparently cannot be the same as # the m4 macro names above. Why? Ask autoconf. -BSDCPIO_VERSION_STRING=0.9.10a -BSDTAR_VERSION_STRING=2.5.4b -LIBARCHIVE_VERSION_STRING=2.5.4b -LIBARCHIVE_VERSION_NUMBER=2005004 +BSDCPIO_VERSION_STRING=1.0.0 +BSDTAR_VERSION_STRING=2.5.5 +LIBARCHIVE_VERSION_STRING=2.5.5 +LIBARCHIVE_VERSION_NUMBER=2005005 # Substitute the above version numbers into the various files below. # Yes, I believe this is the fourth time we define what are essentially @@ -4560,7 +4559,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 4563 "configure"' > conftest.$ac_ext + echo '#line 4562 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -7291,11 +7290,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7294: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7293: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:7298: \$? = $ac_status" >&5 + echo "$as_me:7297: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -7559,11 +7558,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7562: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7561: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:7566: \$? = $ac_status" >&5 + echo "$as_me:7565: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -7663,11 +7662,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7666: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7665: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:7670: \$? = $ac_status" >&5 + echo "$as_me:7669: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -9971,7 +9970,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<EOF -#line 9974 "configure" +#line 9973 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -10071,7 +10070,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<EOF -#line 10074 "configure" +#line 10073 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -12407,11 +12406,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:12410: $lt_compile\"" >&5) + (eval echo "\"\$as_me:12409: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:12414: \$? = $ac_status" >&5 + echo "$as_me:12413: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -12511,11 +12510,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:12514: $lt_compile\"" >&5) + (eval echo "\"\$as_me:12513: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:12518: \$? = $ac_status" >&5 + echo "$as_me:12517: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -14081,11 +14080,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14084: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14083: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:14088: \$? = $ac_status" >&5 + echo "$as_me:14087: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -14185,11 +14184,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14188: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14187: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:14192: \$? = $ac_status" >&5 + echo "$as_me:14191: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -16383,11 +16382,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16386: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16385: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:16390: \$? = $ac_status" >&5 + echo "$as_me:16389: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -16651,11 +16650,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16654: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16653: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:16658: \$? = $ac_status" >&5 + echo "$as_me:16657: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -16755,11 +16754,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16758: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16757: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:16762: \$? = $ac_status" >&5 + echo "$as_me:16761: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -20283,8 +20282,7 @@ done - -for ac_header in inttypes.h langinfo.h limits.h linux/ext2_fs.h linux/fs.h +for ac_header in inttypes.h langinfo.h limits.h linux/fs.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then @@ -20428,151 +20426,6 @@ fi done -# Include inttypes.h into archive.h only if appropriate. -# We can't use the HAVE_INTTYPES_H macro here because archive.h -# gets installed as a system header and then included into client code -# that doesn't define such macros. (And we should certainly not -# define such macros in system headers!) -# Hence the following: -if test "${ac_cv_header_inttypes_h+set}" = set; then - { echo "$as_me:$LINENO: checking for inttypes.h" >&5 -echo $ECHO_N "checking for inttypes.h... $ECHO_C" >&6; } -if test "${ac_cv_header_inttypes_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -{ echo "$as_me:$LINENO: result: $ac_cv_header_inttypes_h" >&5 -echo "${ECHO_T}$ac_cv_header_inttypes_h" >&6; } -else - # Is the header compilable? -{ echo "$as_me:$LINENO: checking inttypes.h usability" >&5 -echo $ECHO_N "checking inttypes.h usability... $ECHO_C" >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -#include <inttypes.h> -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_header_compiler=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_compiler=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6; } - -# Is the header present? -{ echo "$as_me:$LINENO: checking inttypes.h presence" >&5 -echo $ECHO_N "checking inttypes.h presence... $ECHO_C" >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <inttypes.h> -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - ac_header_preproc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_preproc=no -fi - -rm -f conftest.err conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6; } - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: inttypes.h: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: inttypes.h: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: inttypes.h: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: inttypes.h: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: inttypes.h: present but cannot be compiled" >&5 -echo "$as_me: WARNING: inttypes.h: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: inttypes.h: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: inttypes.h: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: inttypes.h: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: inttypes.h: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: inttypes.h: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: inttypes.h: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: inttypes.h: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: inttypes.h: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: inttypes.h: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: inttypes.h: in the future, the compiler will take precedence" >&2;} - ( cat <<\_ASBOX -## ----------------------------------- ## -## Report this to kientzle@freebsd.org ## -## ----------------------------------- ## -_ASBOX - ) | sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -{ echo "$as_me:$LINENO: checking for inttypes.h" >&5 -echo $ECHO_N "checking for inttypes.h... $ECHO_C" >&6; } -if test "${ac_cv_header_inttypes_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_header_inttypes_h=$ac_header_preproc -fi -{ echo "$as_me:$LINENO: result: $ac_cv_header_inttypes_h" >&5 -echo "${ECHO_T}$ac_cv_header_inttypes_h" >&6; } - -fi -if test $ac_cv_header_inttypes_h = yes; then - ARCHIVE_H_INCLUDE_INTTYPES_H='#include <inttypes.h> /* For int64_t */' - -else - ARCHIVE_H_INCLUDE_INTTYPES_H='' - -fi - - @@ -21784,210 +21637,6 @@ _ACEOF fi -{ echo "$as_me:$LINENO: checking for struct stat.st_rdev" >&5 -echo $ECHO_N "checking for struct stat.st_rdev... $ECHO_C" >&6; } -if test "${ac_cv_member_struct_stat_st_rdev+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -static struct stat ac_aggr; -if (ac_aggr.st_rdev) -return 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_member_struct_stat_st_rdev=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -static struct stat ac_aggr; -if (sizeof ac_aggr.st_rdev) -return 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_member_struct_stat_st_rdev=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_member_struct_stat_st_rdev=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: result: $ac_cv_member_struct_stat_st_rdev" >&5 -echo "${ECHO_T}$ac_cv_member_struct_stat_st_rdev" >&6; } -if test $ac_cv_member_struct_stat_st_rdev = yes; then - -cat >>confdefs.h <<_ACEOF -#define HAVE_STRUCT_STAT_ST_RDEV 1 -_ACEOF - - -fi - -{ echo "$as_me:$LINENO: checking for struct tm.tm_gmtoff" >&5 -echo $ECHO_N "checking for struct tm.tm_gmtoff... $ECHO_C" >&6; } -if test "${ac_cv_member_struct_tm_tm_gmtoff+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -static struct tm ac_aggr; -if (ac_aggr.tm_gmtoff) -return 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_member_struct_tm_tm_gmtoff=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -static struct tm ac_aggr; -if (sizeof ac_aggr.tm_gmtoff) -return 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_member_struct_tm_tm_gmtoff=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_member_struct_tm_tm_gmtoff=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: result: $ac_cv_member_struct_tm_tm_gmtoff" >&5 -echo "${ECHO_T}$ac_cv_member_struct_tm_tm_gmtoff" >&6; } -if test $ac_cv_member_struct_tm_tm_gmtoff = yes; then - -cat >>confdefs.h <<_ACEOF -#define HAVE_STRUCT_TM_TM_GMTOFF 1 -_ACEOF - - -fi - # Check for high-resolution timestamps in struct stat { echo "$as_me:$LINENO: checking for struct stat.st_mtimespec.tv_nsec" >&5 echo $ECHO_N "checking for struct stat.st_mtimespec.tv_nsec... $ECHO_C" >&6; } @@ -24855,7 +24504,8 @@ done -for ac_func in chflags chown fchdir fchflags fchmod fchown fcntl fstat + +for ac_func in chflags chown chroot fchdir fchflags fchmod fchown fcntl fork do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` { echo "$as_me:$LINENO: checking for $ac_func" >&5 @@ -24953,7 +24603,8 @@ done -for ac_func in ftruncate futimes geteuid getopt_long getpid + +for ac_func in fstat ftruncate futimes geteuid getopt_long getpid do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` { echo "$as_me:$LINENO: checking for $ac_func" >&5 @@ -25540,7 +25191,8 @@ done -for ac_func in wcscpy wcslen wmemcmp wmemcpy + +for ac_func in wcscpy wcslen wctomb wmemcmp wmemcpy do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` { echo "$as_me:$LINENO: checking for $ac_func" >&5 @@ -27785,7 +27437,7 @@ exec 6>&1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by libarchive $as_me 2.5.4b, which was +This file was extended by libarchive $as_me 2.5.5, which was generated by GNU Autoconf 2.61. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -27838,7 +27490,7 @@ Report bugs to <bug-autoconf@gnu.org>." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -libarchive config.status 2.5.4b +libarchive config.status 2.5.5 configured by $0, generated by GNU Autoconf 2.61, with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" @@ -28174,12 +27826,11 @@ BUILD_BSDCPIO_TRUE!$BUILD_BSDCPIO_TRUE$ac_delim BUILD_BSDCPIO_FALSE!$BUILD_BSDCPIO_FALSE$ac_delim STATIC_BSDCPIO_TRUE!$STATIC_BSDCPIO_TRUE$ac_delim STATIC_BSDCPIO_FALSE!$STATIC_BSDCPIO_FALSE$ac_delim -ARCHIVE_H_INCLUDE_INTTYPES_H!$ARCHIVE_H_INCLUDE_INTTYPES_H$ac_delim LIBOBJS!$LIBOBJS$ac_delim LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 22; then + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 21; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 diff --git a/archivers/libarchive/files/configure.ac b/archivers/libarchive/files/configure.ac index 405490bd23f..317947b1d5d 100644 --- a/archivers/libarchive/files/configure.ac +++ b/archivers/libarchive/files/configure.ac @@ -4,13 +4,13 @@ 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],[2.5.4b]) -m4_define([LIBARCHIVE_VERSION_N],[2005004]) +m4_define([LIBARCHIVE_VERSION_S],[2.5.5]) +m4_define([LIBARCHIVE_VERSION_N],[2005005]) dnl bsdtar versioning tracks libarchive m4_define([BSDTAR_VERSION_S],LIBARCHIVE_VERSION_S()) -dnl bsdcpio is still versioning separately -m4_define([BSDCPIO_VERSION_S],[0.9.10a]) +dnl bsdcpio is still versioning separately, as it's less mature. +m4_define([BSDCPIO_VERSION_S],[1.0.0]) # # Now starts the "real" configure script. @@ -163,16 +163,7 @@ AC_HEADER_STDC AC_HEADER_DIRENT AC_HEADER_SYS_WAIT AC_CHECK_HEADERS([bzlib.h errno.h ext2fs/ext2_fs.h fcntl.h grp.h]) -AC_CHECK_HEADERS([inttypes.h langinfo.h limits.h linux/ext2_fs.h linux/fs.h]) -# Include inttypes.h into archive.h only if appropriate. -# We can't use the HAVE_INTTYPES_H macro here because archive.h -# gets installed as a system header and then included into client code -# that doesn't define such macros. (And we should certainly not -# define such macros in system headers!) -# Hence the following: -AC_CHECK_HEADER(inttypes.h, - [AC_SUBST(ARCHIVE_H_INCLUDE_INTTYPES_H,['#include <inttypes.h> /* For int64_t */'])], - [AC_SUBST(ARCHIVE_H_INCLUDE_INTTYPES_H,[''])]) +AC_CHECK_HEADERS([inttypes.h langinfo.h limits.h linux/fs.h]) AC_CHECK_HEADERS([locale.h paths.h poll.h pwd.h regex.h stdarg.h]) AC_CHECK_HEADERS([stdint.h stdlib.h string.h sys/acl.h sys/ioctl.h]) AC_CHECK_HEADERS([sys/param.h sys/poll.h sys/select.h sys/time.h sys/utime.h]) @@ -199,8 +190,6 @@ AC_CHECK_TYPE(off_t, [long long]) AC_TYPE_SIZE_T AC_CHECK_TYPE(id_t, [unsigned long]) AC_CHECK_TYPE(uintptr_t, [unsigned int]) -AC_CHECK_MEMBERS([struct stat.st_rdev]) -AC_CHECK_MEMBERS([struct tm.tm_gmtoff]) # Check for high-resolution timestamps in struct stat AC_CHECK_MEMBERS([struct stat.st_mtimespec.tv_nsec]) AC_CHECK_MEMBERS([struct stat.st_mtim.tv_nsec]) @@ -239,14 +228,14 @@ AC_FUNC_STAT AC_FUNC_STRERROR_R AC_FUNC_STRFTIME AC_FUNC_VPRINTF -AC_CHECK_FUNCS([chflags chown fchdir fchflags fchmod fchown fcntl fstat]) -AC_CHECK_FUNCS([ftruncate futimes geteuid getopt_long getpid]) +AC_CHECK_FUNCS([chflags chown chroot fchdir fchflags fchmod fchown fcntl fork]) +AC_CHECK_FUNCS([fstat ftruncate futimes geteuid getopt_long getpid]) AC_CHECK_FUNCS([lchflags lchmod lchown]) AC_CHECK_FUNCS([lutimes memmove memset mkdir mkfifo mknod]) AC_CHECK_FUNCS([nl_langinfo pipe poll select setenv setlocale]) AC_CHECK_FUNCS([strchr strdup strerror strrchr timegm]) AC_CHECK_FUNCS([tzset unsetenv utime utimes vfork]) -AC_CHECK_FUNCS([wcscpy wcslen wmemcmp wmemcpy]) +AC_CHECK_FUNCS([wcscpy wcslen wctomb wmemcmp wmemcpy]) # FreeBSD's nl_langinfo supports an option to specify whether the # current locale uses month/day or day/month ordering. It makes the diff --git a/archivers/libarchive/files/cpio/cmdline.c b/archivers/libarchive/files/cpio/cmdline.c index 4b337279271..a602e39c179 100644 --- a/archivers/libarchive/files/cpio/cmdline.c +++ b/archivers/libarchive/files/cpio/cmdline.c @@ -26,7 +26,7 @@ #include "cpio_platform.h" -__FBSDID("$FreeBSD$"); +__FBSDID("$FreeBSD: src/usr.bin/cpio/cmdline.c,v 1.3 2008/06/21 02:20:20 kientzle Exp $"); #ifdef HAVE_ERRNO_H #include <errno.h> @@ -66,7 +66,7 @@ struct option { */ -static const char *cpio_opts = "AaBC:F:O:cdE:f:H:hijLlmopR:rtuvW:yZz"; +static const char *cpio_opts = "0AaBC:F:O:cdE:f:H:hijLlmopR:rtuvW:yZz"; /* * On systems that lack getopt_long, long options can be specified @@ -82,12 +82,21 @@ static const char *cpio_opts = "AaBC:F:O:cdE:f:H:hijLlmopR:rtuvW:yZz"; * sorted, as the -W logic below relies on it. */ static const struct option cpio_longopts[] = { + { "create", no_argument, NULL, 'o' }, + { "extract", no_argument, NULL, 'i' }, { "file", required_argument, NULL, 'F' }, { "format", required_argument, NULL, 'H' }, { "help", no_argument, NULL, 'h' }, { "insecure", no_argument, NULL, OPTION_INSECURE }, + { "link", no_argument, NULL, 'l' }, + { "list", no_argument, NULL, 't' }, + { "make-directories", no_argument, NULL, 'd' }, + { "null", no_argument, NULL, '0' }, { "owner", required_argument, NULL, 'R' }, + { "pass-through", no_argument, NULL, 'p' }, + { "preserve-modification-time", no_argument, NULL, 'm' }, { "quiet", no_argument, NULL, OPTION_QUIET }, + { "unconditional", no_argument, NULL, 'u' }, { "verbose", no_argument, NULL, 'v' }, { "version", no_argument, NULL, OPTION_VERSION }, { NULL, 0, NULL, 0 } diff --git a/archivers/libarchive/files/cpio/cpio.c b/archivers/libarchive/files/cpio/cpio.c index 1d78ce1266f..76a91cf7152 100644 --- a/archivers/libarchive/files/cpio/cpio.c +++ b/archivers/libarchive/files/cpio/cpio.c @@ -26,7 +26,7 @@ #include "cpio_platform.h" -__FBSDID("$FreeBSD$"); +__FBSDID("$FreeBSD: src/usr.bin/cpio/cpio.c,v 1.4 2008/06/24 15:18:40 kientzle Exp $"); #include <sys/types.h> #include <archive.h> @@ -101,6 +101,7 @@ main(int argc, char *argv[]) cpio->gid_override = -1; cpio->argv = argv; cpio->argc = argc; + cpio->line_separator = '\n'; cpio->mode = '\0'; cpio->verbose = 0; cpio->compress = '\0'; @@ -116,6 +117,9 @@ main(int argc, char *argv[]) while ((opt = cpio_getopt(cpio)) != -1) { switch (opt) { + case '0': /* GNU convention: --null, -0 */ + cpio->line_separator = '\0'; + break; case 'A': /* NetBSD/OpenBSD */ cpio->option_append = 1; break; @@ -178,6 +182,7 @@ main(int argc, char *argv[]) break; case 'p': /* POSIX 1997 */ cpio->mode = opt; + cpio->extract_flags &= ~ARCHIVE_EXTRACT_SECURE_NODOTDOT; break; case OPTION_QUIET: /* GNU cpio */ cpio->quiet = 1; @@ -341,8 +346,10 @@ version(void) static void mode_out(struct cpio *cpio) { - struct archive_entry *entry, *spare; unsigned long blocks; + struct archive_entry *entry, *spare; + struct line_reader *lr; + const char *p; int r; if (cpio->option_append) @@ -375,7 +382,10 @@ mode_out(struct cpio *cpio) r = archive_write_open_file(cpio->archive, cpio->filename); if (r != ARCHIVE_OK) cpio_errc(1, 0, archive_error_string(cpio->archive)); - process_lines(cpio, "-", file_to_archive); + lr = process_lines_init("-", cpio->line_separator); + while ((p = process_lines_next(lr)) != NULL) + file_to_archive(cpio, p); + process_lines_free(lr); /* * The hardlink detection may have queued up a couple of entries @@ -525,17 +535,42 @@ entry_to_archive(struct cpio *cpio, struct archive_entry *entry) fprintf(stderr,"%s", destpath); /* - * Obviously, this only gets invoked in pass mode. + * Option_link only makes sense in pass mode and for + * regular files. Also note: if a link operation fails + * because of cross-device restrictions, we'll fall back + * to copy mode for that entry. + * + * TODO: Test other cpio implementations to see if they + * hard-link anything other than regular files here. */ - if (cpio->option_link) { - /* Note: link(2) doesn't create parent directories. */ - archive_entry_set_hardlink(entry, srcpath); - r = archive_write_header(cpio->archive, entry); + if (cpio->option_link + && archive_entry_filetype(entry) == AE_IFREG) + { + struct archive_entry *t; + /* Save the original entry in case we need it later. */ + t = archive_entry_clone(entry); + if (t == NULL) + cpio_errc(1, ENOMEM, "Can't create link"); + /* Note: link(2) doesn't create parent directories, + * so we use archive_write_header() instead as a + * convenience. */ + archive_entry_set_hardlink(t, srcpath); + /* This is a straight link that carries no data. */ + archive_entry_set_size(t, 0); + r = archive_write_header(cpio->archive, t); + archive_entry_free(t); if (r != ARCHIVE_OK) cpio_warnc(archive_errno(cpio->archive), archive_error_string(cpio->archive)); if (r == ARCHIVE_FATAL) exit(1); +#ifdef EXDEV + if (r != ARCHIVE_OK && archive_errno(cpio->archive) == EXDEV) { + /* Cross-device link: Just fall through and use + * the original entry to copy the file over. */ + cpio_warnc(0, "Copying file instead"); + } else +#endif return (0); } @@ -793,6 +828,8 @@ mode_list(struct cpio *cpio) static void mode_pass(struct cpio *cpio, const char *destdir) { + struct line_reader *lr; + const char *p; int r; /* Ensure target dir has a trailing '/' to simplify path surgery. */ @@ -809,7 +846,10 @@ mode_pass(struct cpio *cpio, const char *destdir) cpio_errc(1, 0, archive_error_string(cpio->archive)); cpio->linkresolver = archive_entry_linkresolver_new(); archive_write_disk_set_standard_lookup(cpio->archive); - process_lines(cpio, "-", file_to_archive); + lr = process_lines_init("-", cpio->line_separator); + while ((p = process_lines_next(lr)) != NULL) + file_to_archive(cpio, p); + process_lines_free(lr); archive_entry_linkresolver_free(cpio->linkresolver); r = archive_write_close(cpio->archive); @@ -868,79 +908,119 @@ cpio_rename(const char *name) * terminated with newlines. * * This uses a self-sizing buffer to handle arbitrarily-long lines. - * If the "process" function returns non-zero for any line, this - * function will return non-zero after attempting to process all - * remaining lines. */ -int -process_lines(struct cpio *cpio, const char *pathname, - int (*process)(struct cpio *, const char *)) -{ +struct line_reader { FILE *f; char *buff, *buff_end, *line_start, *line_end, *p; - size_t buff_length, bytes_read, bytes_wanted; + char *pathname; + size_t buff_length; int separator; int ret; +}; + +struct line_reader * +process_lines_init(const char *pathname, char separator) +{ + struct line_reader *lr; + + lr = calloc(1, sizeof(*lr)); + if (lr == NULL) + cpio_errc(1, ENOMEM, "Can't open %s", pathname); - separator = cpio->option_null ? '\0' : '\n'; - ret = 0; + lr->separator = separator; + lr->pathname = strdup(pathname); if (strcmp(pathname, "-") == 0) - f = stdin; + lr->f = stdin; else - f = fopen(pathname, "r"); - if (f == NULL) + lr->f = fopen(pathname, "r"); + if (lr->f == NULL) cpio_errc(1, errno, "Couldn't open %s", pathname); - buff_length = 8192; - buff = malloc(buff_length); - if (buff == NULL) + lr->buff_length = 8192; + lr->buff = malloc(lr->buff_length); + if (lr->buff == NULL) cpio_errc(1, ENOMEM, "Can't read %s", pathname); - line_start = line_end = buff_end = buff; + lr->line_start = lr->line_end = lr->buff_end = lr->buff; + + return (lr); +} + +const char * +process_lines_next(struct line_reader *lr) +{ + size_t bytes_wanted, bytes_read, new_buff_size; + char *line_start, *p; + for (;;) { - /* Get some more data into the buffer. */ - bytes_wanted = buff + buff_length - buff_end; - bytes_read = fread(buff_end, 1, bytes_wanted, f); - buff_end += bytes_read; - /* Process all complete lines in the buffer. */ - while (line_end < buff_end) { - if (*line_end == separator) { - *line_end = '\0'; - if ((*process)(cpio, line_start) != 0) - ret = -1; - line_start = line_end + 1; - line_end = line_start; + /* If there's a line in the buffer, return it immediately. */ + while (lr->line_end < lr->buff_end) { + if (*lr->line_end == lr->separator) { + *lr->line_end = '\0'; + line_start = lr->line_start; + lr->line_start = lr->line_end + 1; + lr->line_end = lr->line_start; + return (line_start); } else - line_end++; + lr->line_end++; } - if (feof(f)) - break; - if (ferror(f)) - cpio_errc(1, errno, "Can't read %s", pathname); - if (line_start > buff) { + + /* If we're at end-of-file, process the final data. */ + if (lr->f == NULL) { + /* If there's more text, return one last line. */ + if (lr->line_end > lr->line_start) { + *lr->line_end = '\0'; + line_start = lr->line_start; + lr->line_start = lr->line_end + 1; + lr->line_end = lr->line_start; + return (line_start); + } + /* Otherwise, we're done. */ + return (NULL); + } + + /* Buffer only has part of a line. */ + if (lr->line_start > lr->buff) { /* Move a leftover fractional line to the beginning. */ - memmove(buff, line_start, buff_end - line_start); - buff_end -= line_start - buff; - line_end -= line_start - buff; - line_start = buff; + memmove(lr->buff, lr->line_start, + lr->buff_end - lr->line_start); + lr->buff_end -= lr->line_start - lr->buff; + lr->line_end -= lr->line_start - lr->buff; + lr->line_start = lr->buff; } else { /* Line is too big; enlarge the buffer. */ - p = realloc(buff, buff_length *= 2); + new_buff_size = lr->buff_length * 2; + if (new_buff_size <= lr->buff_length) + cpio_errc(1, ENOMEM, + "Line too long in %s", lr->pathname); + lr->buff_length = new_buff_size; + p = realloc(lr->buff, new_buff_size); if (p == NULL) cpio_errc(1, ENOMEM, - "Line too long in %s", pathname); - buff_end = p + (buff_end - buff); - line_end = p + (line_end - buff); - line_start = buff = p; + "Line too long in %s", lr->pathname); + lr->buff_end = p + (lr->buff_end - lr->buff); + lr->line_end = p + (lr->line_end - lr->buff); + lr->line_start = lr->buff = p; + } + + /* Get some more data into the buffer. */ + bytes_wanted = lr->buff + lr->buff_length - lr->buff_end; + bytes_read = fread(lr->buff_end, 1, bytes_wanted, lr->f); + lr->buff_end += bytes_read; + + if (ferror(lr->f)) + cpio_errc(1, errno, "Can't read %s", lr->pathname); + if (feof(lr->f)) { + if (lr->f != stdin) + fclose(lr->f); + lr->f = NULL; } } - /* At end-of-file, handle the final line. */ - if (line_end > line_start) { - *line_end = '\0'; - if ((*process)(cpio, line_start) != 0) - ret = -1; - } - free(buff); - if (f != stdin) - fclose(f); - return (ret); +} + +void +process_lines_free(struct line_reader *lr) +{ + free(lr->buff); + free(lr->pathname); + free(lr); } diff --git a/archivers/libarchive/files/cpio/cpio.h b/archivers/libarchive/files/cpio/cpio.h index ecec2eeec8e..3afd9520309 100644 --- a/archivers/libarchive/files/cpio/cpio.h +++ b/archivers/libarchive/files/cpio/cpio.h @@ -22,7 +22,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD$ + * $FreeBSD: src/usr.bin/cpio/cpio.h,v 1.2 2008/06/21 02:20:20 kientzle Exp $ */ #ifndef CPIO_H_INCLUDED @@ -53,12 +53,12 @@ struct cpio { int extract_flags; /* Flags for extract operation */ char symlink_mode; /* H or L, per BSD conventions */ const char *compress_program; + char line_separator; /* --null ? '\0' : '\n' */ int option_append; /* -A, only relevant for -o */ int option_atime_restore; /* -a */ int option_follow_links; /* -L */ int option_link; /* -l */ int option_list; /* -t */ - int option_null; /* -0 --null */ int option_rename; /* -r */ char *destdir; size_t pass_destpath_alloc; @@ -98,9 +98,13 @@ enum { OPTION_VERSION }; +struct line_reader; + +struct line_reader *process_lines_init(const char *, char separator); +const char *process_lines_next(struct line_reader *); +void process_lines_free(struct line_reader *); + int cpio_getopt(struct cpio *cpio); -int process_lines(struct cpio *cpio, const char *pathname, - int (*process)(struct cpio *, const char *)); int include_from_file(struct cpio *, const char *); #endif diff --git a/archivers/libarchive/files/cpio/matching.c b/archivers/libarchive/files/cpio/matching.c index f98421e2df4..3e4ddc3bfdb 100644 --- a/archivers/libarchive/files/cpio/matching.c +++ b/archivers/libarchive/files/cpio/matching.c @@ -24,7 +24,7 @@ */ #include "cpio_platform.h" -__FBSDID("$FreeBSD$"); +__FBSDID("$FreeBSD: src/usr.bin/cpio/matching.c,v 1.2 2008/06/21 02:20:20 kientzle Exp $"); #ifdef HAVE_ERRNO_H #include <errno.h> @@ -107,7 +107,16 @@ include(struct cpio *cpio, const char *pattern) int include_from_file(struct cpio *cpio, const char *pathname) { - return (process_lines(cpio, pathname, &include)); + struct line_reader *lr; + const char *p; + int ret = 0; + + lr = process_lines_init(pathname, '\n'); + while ((p = process_lines_next(lr)) != NULL) + if (include(cpio, p) != 0) + ret = -1; + process_lines_free(lr); + return (ret); } static void diff --git a/archivers/libarchive/files/cpio/test/main.c b/archivers/libarchive/files/cpio/test/main.c index c88dd2ac341..e0f8c2e1175 100644 --- a/archivers/libarchive/files/cpio/test/main.c +++ b/archivers/libarchive/files/cpio/test/main.c @@ -27,13 +27,13 @@ * Various utility routines useful for test programs. * Each test program is linked against this file. */ +#include "test.h" + #include <errno.h> #include <locale.h> #include <stdarg.h> #include <time.h> -#include "test.h" - /* * This same file is used pretty much verbatim for all test harnesses. * @@ -44,7 +44,7 @@ #undef EXTRA_DUMP /* How to dump extra data */ /* How to generate extra version info. */ #define EXTRA_VERSION (systemf("%s --version", testprog) ? "" : "") -__FBSDID("$FreeBSD$"); +__FBSDID("$FreeBSD: src/usr.bin/cpio/test/main.c,v 1.2 2008/06/21 02:17:18 kientzle Exp $"); /* * "list.h" is simply created by "grep DEFINE_TEST"; it has @@ -541,6 +541,48 @@ test_assert_equal_file(const char *f1, const char *f2pattern, ...) return (0); } +int +test_assert_file_exists(const char *fpattern, ...) +{ + char f[1024]; + va_list ap; + + va_start(ap, fpattern); + vsprintf(f, fpattern, ap); + va_end(ap); + + if (!access(f, F_OK)) + return (1); + if (!previous_failures(test_filename, test_line)) { + fprintf(stderr, "%s:%d: File doesn't exist\n", + test_filename, test_line); + fprintf(stderr, " file=\"%s\"\n", f); + report_failure(test_extra); + } + return (0); +} + +int +test_assert_file_not_exists(const char *fpattern, ...) +{ + char f[1024]; + va_list ap; + + va_start(ap, fpattern); + vsprintf(f, fpattern, ap); + va_end(ap); + + if (access(f, F_OK)) + return (1); + if (!previous_failures(test_filename, test_line)) { + fprintf(stderr, "%s:%d: File exists and shouldn't\n", + test_filename, test_line); + fprintf(stderr, " file=\"%s\"\n", f); + report_failure(test_extra); + } + return (0); +} + /* assertFileContents() asserts the contents of a file. */ int test_assert_file_contents(const void *buff, int s, const char *fpattern, ...) @@ -670,8 +712,11 @@ static int test_run(int i, const char *tmpdir) { int failures_before = failures; - if (!quiet_flag) + if (!quiet_flag) { printf("%d: %s\n", i, tests[i].name); + fflush(stdout); + } + /* * Always explicitly chdir() in case the last test moved us to * a strange place. diff --git a/archivers/libarchive/files/cpio/test/test.h b/archivers/libarchive/files/cpio/test/test.h index 06e6d903fc8..431d5d7c4d5 100644 --- a/archivers/libarchive/files/cpio/test/test.h +++ b/archivers/libarchive/files/cpio/test/test.h @@ -22,7 +22,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD$ + * $FreeBSD: src/usr.bin/cpio/test/test.h,v 1.2 2008/06/21 02:17:18 kientzle Exp $ */ /* Every test program should #include "test.h" as the first thing. */ @@ -31,8 +31,18 @@ * The goal of this file (and the matching test.c) is to * simplify the very repetitive test-*.c test programs. */ -#ifndef _FILE_OFFSET_BITS -#define _FILE_OFFSET_BITS 64 +#if defined(HAVE_CONFIG_H) +/* Most POSIX platforms use the 'configure' script to build config.h */ +#include "../../config.h" +#elif defined(__FreeBSD__) +/* Building as part of FreeBSD system requires a pre-built config.h. */ +#include "../config_freebsd.h" +#elif defined(_WIN32) +/* Win32 can't run the 'configure' script. */ +#include "../config_windows.h" +#else +/* Warn if the library hasn't been (automatically or manually) configured. */ +#error Oops: No config.h and no pre-built configuration in test.h. #endif #include <dirent.h> @@ -51,20 +61,6 @@ #include <dmalloc.h> #endif -#if defined(HAVE_CONFIG_H) -/* Most POSIX platforms use the 'configure' script to build config.h */ -#include "../../config.h" -#elif defined(__FreeBSD__) -/* Building as part of FreeBSD system requires a pre-built config.h. */ -#include "../config_freebsd.h" -#elif defined(_WIN32) -/* Win32 can't run the 'configure' script. */ -#include "../config_windows.h" -#else -/* Warn if the library hasn't been (automatically or manually) configured. */ -#error Oops: No config.h and no pre-built configuration in test.h. -#endif - /* No non-FreeBSD platform will have __FBSDID, so just define it here. */ #ifdef __FreeBSD__ #include <sys/cdefs.h> /* For __FBSDID */ @@ -102,6 +98,12 @@ /* Assert that a file is empty; supports printf-style arguments. */ #define assertEmptyFile \ test_setup(__FILE__, __LINE__);test_assert_empty_file +/* Assert that a file exists; supports printf-style arguments. */ +#define assertFileExists \ + test_setup(__FILE__, __LINE__);test_assert_file_exists +/* Assert that a file exists; supports printf-style arguments. */ +#define assertFileNotExists \ + test_setup(__FILE__, __LINE__);test_assert_file_not_exists /* Assert that file contents match a string; supports printf-style arguments. */ #define assertFileContents \ test_setup(__FILE__, __LINE__);test_assert_file_contents @@ -127,6 +129,8 @@ int test_assert_equal_string(const char *, int, const char *v1, const char *, co int test_assert_equal_wstring(const char *, int, const wchar_t *v1, const char *, const wchar_t *v2, const char *, void *); int test_assert_equal_mem(const char *, int, const char *, const char *, const char *, const char *, size_t, const char *, void *); int test_assert_file_contents(const void *, int, const char *, ...); +int test_assert_file_exists(const char *, ...); +int test_assert_file_not_exists(const char *, ...); /* Like sprintf, then system() */ int systemf(const char * fmt, ...); @@ -144,4 +148,3 @@ void extract_reference_file(const char *); /* Pathname of exe to be tested. */ char *testprog; - diff --git a/archivers/libarchive/files/libarchive/archive.h b/archivers/libarchive/files/libarchive/archive.h index 6bfe81eb24a..3f9f6e1cf67 100644 --- a/archivers/libarchive/files/libarchive/archive.h +++ b/archivers/libarchive/files/libarchive/archive.h @@ -22,7 +22,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: src/lib/libarchive/archive.h.in,v 1.49 2008/03/14 22:19:50 kientzle Exp $ + * $FreeBSD: src/lib/libarchive/archive.h.in,v 1.50 2008/05/26 17:00:22 kientzle Exp $ */ #ifndef ARCHIVE_H_INCLUDED @@ -112,13 +112,13 @@ extern "C" { * (ARCHIVE_API_VERSION * 1000000 + ARCHIVE_API_FEATURE * 1000) * #endif */ -#define ARCHIVE_VERSION_NUMBER 2005004 +#define ARCHIVE_VERSION_NUMBER 2005005 __LA_DECL int archive_version_number(void); /* * Textual name/version of the library, useful for version displays. */ -#define ARCHIVE_VERSION_STRING "libarchive 2.5.4b" +#define ARCHIVE_VERSION_STRING "libarchive 2.5.5" __LA_DECL const char * archive_version_string(void); #if ARCHIVE_VERSION_NUMBER < 3000000 diff --git a/archivers/libarchive/files/libarchive/archive_endian.h b/archivers/libarchive/files/libarchive/archive_endian.h index 61af4161c37..550be164029 100644 --- a/archivers/libarchive/files/libarchive/archive_endian.h +++ b/archivers/libarchive/files/libarchive/archive_endian.h @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/lib/libarchive/archive_endian.h,v 1.2 2008/02/26 07:17:47 kientzle Exp $ + * $FreeBSD: src/lib/libarchive/archive_endian.h,v 1.3 2008/05/26 17:00:22 kientzle Exp $ * * Borrowed from FreeBSD's <sys/endian.h> */ diff --git a/archivers/libarchive/files/libarchive/archive_entry.3 b/archivers/libarchive/files/libarchive/archive_entry.3 index e2d4ab11770..9ceb18b7aad 100644 --- a/archivers/libarchive/files/libarchive/archive_entry.3 +++ b/archivers/libarchive/files/libarchive/archive_entry.3 @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: src/lib/libarchive/archive_entry.3,v 1.17 2008/03/14 23:00:53 kientzle Exp $ +.\" $FreeBSD: src/lib/libarchive/archive_entry.3,v 1.18 2008/05/26 17:00:22 kientzle Exp $ .\" .Dd May 12, 2008 .Dt archive_entry 3 diff --git a/archivers/libarchive/files/libarchive/archive_entry.c b/archivers/libarchive/files/libarchive/archive_entry.c index 210685af2b3..69921c309f1 100644 --- a/archivers/libarchive/files/libarchive/archive_entry.c +++ b/archivers/libarchive/files/libarchive/archive_entry.c @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: src/lib/libarchive/archive_entry.c,v 1.51 2008/03/14 23:19:46 kientzle Exp $"); +__FBSDID("$FreeBSD: src/lib/libarchive/archive_entry.c,v 1.52 2008/05/26 17:00:22 kientzle Exp $"); #ifdef HAVE_SYS_STAT_H #include <sys/stat.h> diff --git a/archivers/libarchive/files/libarchive/archive_entry.h b/archivers/libarchive/files/libarchive/archive_entry.h index f8601b9ee28..ee96c56a79d 100644 --- a/archivers/libarchive/files/libarchive/archive_entry.h +++ b/archivers/libarchive/files/libarchive/archive_entry.h @@ -22,7 +22,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: src/lib/libarchive/archive_entry.h,v 1.26 2008/03/14 23:00:53 kientzle Exp $ + * $FreeBSD: src/lib/libarchive/archive_entry.h,v 1.27 2008/05/26 17:00:22 kientzle Exp $ */ #ifndef ARCHIVE_ENTRY_H_INCLUDED diff --git a/archivers/libarchive/files/libarchive/archive_entry_private.h b/archivers/libarchive/files/libarchive/archive_entry_private.h index f893fb982ae..0289290b198 100644 --- a/archivers/libarchive/files/libarchive/archive_entry_private.h +++ b/archivers/libarchive/files/libarchive/archive_entry_private.h @@ -22,7 +22,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: src/lib/libarchive/archive_entry_private.h,v 1.3 2008/03/31 06:24:39 kientzle Exp $ + * $FreeBSD: src/lib/libarchive/archive_entry_private.h,v 1.4 2008/05/26 17:00:22 kientzle Exp $ */ #ifndef ARCHIVE_ENTRY_PRIVATE_H_INCLUDED diff --git a/archivers/libarchive/files/libarchive/archive_entry_strmode.c b/archivers/libarchive/files/libarchive/archive_entry_strmode.c index cfe6ae33baa..16cb3f7bb33 100644 --- a/archivers/libarchive/files/libarchive/archive_entry_strmode.c +++ b/archivers/libarchive/files/libarchive/archive_entry_strmode.c @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: src/lib/libarchive/archive_entry_strmode.c,v 1.3 2008/05/23 04:57:28 cperciva Exp $"); +__FBSDID("$FreeBSD: src/lib/libarchive/archive_entry_strmode.c,v 1.4 2008/06/15 05:14:01 kientzle Exp $"); #ifdef HAVE_SYS_STAT_H #include <sys/stat.h> @@ -57,6 +57,11 @@ archive_entry_strmode(struct archive_entry *entry) case AE_IFLNK: bp[0] = 'l'; break; case AE_IFSOCK: bp[0] = 's'; break; case AE_IFIFO: bp[0] = 'p'; break; + default: + if (archive_entry_hardlink(entry) != NULL) { + bp[0] = 'h'; + break; + } } for (i = 0; i < 9; i++) diff --git a/archivers/libarchive/files/libarchive/archive_platform.h b/archivers/libarchive/files/libarchive/archive_platform.h index 41fd4e549dc..99dfacc50f5 100644 --- a/archivers/libarchive/files/libarchive/archive_platform.h +++ b/archivers/libarchive/files/libarchive/archive_platform.h @@ -22,7 +22,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: src/lib/libarchive/archive_platform.h,v 1.29 2008/02/19 06:06:13 kientzle Exp $ + * $FreeBSD: src/lib/libarchive/archive_platform.h,v 1.30 2008/05/26 17:00:22 kientzle Exp $ */ /* diff --git a/archivers/libarchive/files/libarchive/archive_read.3 b/archivers/libarchive/files/libarchive/archive_read.3 index dbbe1f7f1e6..13063d917c7 100644 --- a/archivers/libarchive/files/libarchive/archive_read.3 +++ b/archivers/libarchive/files/libarchive/archive_read.3 @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: src/lib/libarchive/archive_read.3,v 1.36 2008/03/10 14:45:29 jkoshy Exp $ +.\" $FreeBSD: src/lib/libarchive/archive_read.3,v 1.37 2008/05/26 17:00:22 kientzle Exp $ .\" .Dd August 19, 2006 .Dt archive_read 3 diff --git a/archivers/libarchive/files/libarchive/archive_read_extract.c b/archivers/libarchive/files/libarchive/archive_read_extract.c index ab01f7df3e2..e1027995ec0 100644 --- a/archivers/libarchive/files/libarchive/archive_read_extract.c +++ b/archivers/libarchive/files/libarchive/archive_read_extract.c @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_extract.c,v 1.60 2008/01/18 04:53:45 kientzle Exp $"); +__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_extract.c,v 1.61 2008/05/26 17:00:22 kientzle Exp $"); #ifdef HAVE_SYS_TYPES_H #include <sys/types.h> diff --git a/archivers/libarchive/files/libarchive/archive_read_support_compression_bzip2.c b/archivers/libarchive/files/libarchive/archive_read_support_compression_bzip2.c index e6397df9634..824b0cdeb56 100644 --- a/archivers/libarchive/files/libarchive/archive_read_support_compression_bzip2.c +++ b/archivers/libarchive/files/libarchive/archive_read_support_compression_bzip2.c @@ -25,7 +25,7 @@ #include "archive_platform.h" -__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_support_compression_bzip2.c,v 1.17 2008/02/19 05:44:59 kientzle Exp $"); +__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_support_compression_bzip2.c,v 1.18 2008/05/26 17:00:22 kientzle Exp $"); #ifdef HAVE_ERRNO_H #include <errno.h> diff --git a/archivers/libarchive/files/libarchive/archive_read_support_compression_program.c b/archivers/libarchive/files/libarchive/archive_read_support_compression_program.c index 206215c897c..4f25d6ed561 100644 --- a/archivers/libarchive/files/libarchive/archive_read_support_compression_program.c +++ b/archivers/libarchive/files/libarchive/archive_read_support_compression_program.c @@ -24,11 +24,11 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_support_compression_program.c,v 1.2 2007/07/20 01:28:50 kientzle Exp $"); - +__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_support_compression_program.c,v 1.4 2008/06/15 10:45:57 kientzle Exp $"); /* This capability is only available on POSIX systems. */ -#if !defined(HAVE_PIPE) || !defined(HAVE_VFORK) || !defined(HAVE_FCNTL) +#if !defined(HAVE_PIPE) || !defined(HAVE_FCNTL) || \ + !(defined(HAVE_FORK) || defined(HAVE_VFORK)) /* * On non-Posix systems, allow the program to build, but choke if @@ -177,6 +177,12 @@ restart_read: state->child_in_buf_avail = ret; } + if (state->child_stdin == -1) { + fcntl(state->child_stdout, F_SETFL, 0); + __archive_check_child(state->child_stdin, state->child_stdout); + goto restart_read; + } + do { ret = write(state->child_stdin, state->child_in_buf, state->child_in_buf_avail); @@ -191,7 +197,7 @@ restart_read: goto restart_read; } else if (ret == 0 || (ret == -1 && errno == EPIPE)) { close(state->child_stdin); - state->child_stdout = -1; + state->child_stdin = -1; fcntl(state->child_stdout, F_SETFL, 0); goto restart_read; } else { diff --git a/archivers/libarchive/files/libarchive/archive_read_support_format_ar.c b/archivers/libarchive/files/libarchive/archive_read_support_format_ar.c index 15d7e7cfd72..baf80bd62fc 100644 --- a/archivers/libarchive/files/libarchive/archive_read_support_format_ar.c +++ b/archivers/libarchive/files/libarchive/archive_read_support_format_ar.c @@ -26,7 +26,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_support_format_ar.c,v 1.9 2008/03/12 21:10:26 kaiw Exp $"); +__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_support_format_ar.c,v 1.10 2008/05/26 17:00:22 kientzle Exp $"); #ifdef HAVE_SYS_STAT_H #include <sys/stat.h> diff --git a/archivers/libarchive/files/libarchive/archive_read_support_format_iso9660.c b/archivers/libarchive/files/libarchive/archive_read_support_format_iso9660.c index e0825a36e1a..481220dd47b 100644 --- a/archivers/libarchive/files/libarchive/archive_read_support_format_iso9660.c +++ b/archivers/libarchive/files/libarchive/archive_read_support_format_iso9660.c @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_support_format_iso9660.c,v 1.25 2008/02/19 06:02:01 kientzle Exp $"); +__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_support_format_iso9660.c,v 1.26 2008/05/26 17:00:22 kientzle Exp $"); #ifdef HAVE_ERRNO_H #include <errno.h> diff --git a/archivers/libarchive/files/libarchive/archive_read_support_format_mtree.c b/archivers/libarchive/files/libarchive/archive_read_support_format_mtree.c index 72232ed7e03..33597e0de6b 100644 --- a/archivers/libarchive/files/libarchive/archive_read_support_format_mtree.c +++ b/archivers/libarchive/files/libarchive/archive_read_support_format_mtree.c @@ -25,7 +25,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_support_format_mtree.c,v 1.5 2008/05/19 18:06:48 cperciva Exp $"); +__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_support_format_mtree.c,v 1.9 2008/06/21 19:06:37 kientzle Exp $"); #ifdef HAVE_SYS_STAT_H #include <sys/stat.h> @@ -308,7 +308,7 @@ process_global_unset(struct archive_read *a, size_t len; line += 6; - if ((next = strchr(line, '=')) != NULL) { + if (strchr(line, '=') != NULL) { archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, "/unset shall not contain `='"); return ARCHIVE_FATAL; @@ -663,7 +663,8 @@ parse_file(struct archive_read *a, struct archive_entry *entry, *use_next = 1; } /* Don't hold a non-regular file open. */ - close(mtree->fd); + if (mtree->fd >= 0) + close(mtree->fd); mtree->fd = -1; st = NULL; return r; @@ -759,7 +760,7 @@ parse_device(struct archive *a, struct archive_entry *entry, char *val) } ++comma1; comma2 = strchr(comma1, ','); - if (comma1 == NULL) { + if (comma2 == NULL) { archive_set_error(a, ARCHIVE_ERRNO_FILE_FORMAT, "Malformed device attribute"); return (ARCHIVE_WARN); @@ -1019,7 +1020,7 @@ skip(struct archive_read *a) } /* - * Since parsing octal escapes always makes strings shorter, + * Since parsing backslash sequences always makes strings shorter, * we can always do this conversion in-place. */ static void @@ -1040,13 +1041,57 @@ parse_escapes(char *src, struct mtree_entry *mentry) if (c == '/' && mentry != NULL) mentry->full = 1; if (c == '\\') { - if (src[0] >= '0' && src[0] <= '3' - && src[1] >= '0' && src[1] <= '7' - && src[2] >= '0' && src[2] <= '7') { - c = (src[0] - '0') << 6; - c |= (src[1] - '0') << 3; - c |= (src[2] - '0'); - src += 3; + switch (src[0]) { + case '0': + if (src[1] < '0' || src[1] > '7') { + c = 0; + ++src; + break; + } + /* FALLTHROUGH */ + case '1': + case '2': + case '3': + if (src[1] >= '0' && src[1] <= '7' && + src[2] >= '0' && src[2] <= '7') { + c = (src[0] - '0') << 6; + c |= (src[1] - '0') << 3; + c |= (src[2] - '0'); + src += 3; + } + break; + case 'a': + c = '\a'; + ++src; + break; + case 'b': + c = '\b'; + ++src; + break; + case 'f': + c = '\f'; + ++src; + break; + case 'n': + c = '\n'; + ++src; + break; + case 'r': + c = '\r'; + ++src; + break; + case 's': + c = ' '; + ++src; + break; + case 't': + c = '\t'; + ++src; + break; + case 'v': + c = '\v'; + ++src; + break; } } *dest++ = c; @@ -1189,6 +1234,7 @@ readline(struct archive_read *a, struct mtree *mtree, char **start, ssize_t limi const void *t; const char *s; void *p; + char *u; /* Accumulate line in a line buffer. */ for (;;) { @@ -1221,10 +1267,32 @@ readline(struct archive_read *a, struct mtree *mtree, char **start, ssize_t limi total_size += bytes_read; /* Null terminate. */ mtree->line.s[total_size] = '\0'; - /* If we found '\n', clean up and return. */ - if (p != NULL) { - *start = mtree->line.s; - return (total_size); + /* If we found an unescaped '\n', clean up and return. */ + if (p == NULL) + continue; + for (u = mtree->line.s; *u; ++u) { + if (u[0] == '\n') { + *start = mtree->line.s; + return total_size; + } + if (u[0] == '#') { + if (p == NULL) + break; + *start = mtree->line.s; + return total_size; + } + if (u[0] != '\\') + continue; + if (u[1] == '\\') { + ++u; + continue; + } + if (u[1] == '\n') { + memmove(u, u + 1, + total_size - (u - mtree->line.s) + 1); + --total_size; + continue; + } } } } diff --git a/archivers/libarchive/files/libarchive/archive_read_support_format_tar.c b/archivers/libarchive/files/libarchive/archive_read_support_format_tar.c index 6d7f048a40d..0c2f0077c1e 100644 --- a/archivers/libarchive/files/libarchive/archive_read_support_format_tar.c +++ b/archivers/libarchive/files/libarchive/archive_read_support_format_tar.c @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_support_format_tar.c,v 1.67 2008/03/15 01:43:58 kientzle Exp $"); +__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_support_format_tar.c,v 1.69 2008/05/27 04:46:12 kientzle Exp $"); #ifdef HAVE_ERRNO_H #include <errno.h> @@ -2362,7 +2362,7 @@ url_decode(const char *in) if (out == NULL) return (NULL); for (s = in, d = out; *s != '\0'; ) { - if (*s == '%') { + if (s[0] == '%' && s[1] != '\0' && s[2] != '\0') { /* Try to convert % escape */ int digit1 = tohex(s[1]); int digit2 = tohex(s[2]); diff --git a/archivers/libarchive/files/libarchive/archive_read_support_format_zip.c b/archivers/libarchive/files/libarchive/archive_read_support_format_zip.c index a105297ad4f..f04f69bb205 100644 --- a/archivers/libarchive/files/libarchive/archive_read_support_format_zip.c +++ b/archivers/libarchive/files/libarchive/archive_read_support_format_zip.c @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_support_format_zip.c,v 1.22 2008/02/27 06:05:59 kientzle Exp $"); +__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_support_format_zip.c,v 1.24 2008/06/15 05:15:53 kientzle Exp $"); #ifdef HAVE_ERRNO_H #include <errno.h> @@ -564,8 +564,8 @@ archive_read_format_zip_read_data(struct archive_read *a, */ r = ARCHIVE_FATAL; } else { - /* We know compressed size; just skip it. */ - archive_read_format_zip_read_data_skip(a); + /* We can't decompress this entry, but we will + * be able to skip() it and try the next entry. */ r = ARCHIVE_WARN; } break; @@ -747,6 +747,10 @@ archive_read_format_zip_read_data_skip(struct archive_read *a) zip = (struct zip *)(a->format->data); + /* If we've already read to end of data, we're done. */ + if (zip->end_of_entry_cleanup) + return (ARCHIVE_OK); + /* * If the length is at the end, we have no choice but * to decompress all the data to find the end marker. diff --git a/archivers/libarchive/files/libarchive/archive_string.c b/archivers/libarchive/files/libarchive/archive_string.c index 7c378deead4..21fe5711516 100644 --- a/archivers/libarchive/files/libarchive/archive_string.c +++ b/archivers/libarchive/files/libarchive/archive_string.c @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: src/lib/libarchive/archive_string.c,v 1.11 2007/07/15 19:13:59 kientzle Exp $"); +__FBSDID("$FreeBSD: src/lib/libarchive/archive_string.c,v 1.16 2008/06/15 11:28:56 kientzle Exp $"); /* * Basic resizable string support, to simplify manipulating arbitrary-sized @@ -41,14 +41,6 @@ __FBSDID("$FreeBSD: src/lib/libarchive/archive_string.c,v 1.11 2007/07/15 19:13: #include <wchar.h> #endif -#ifdef __sgi -/* - * The following prototype is missing on IRXI, - * even though the function is implemented in libc. - */ -size_t wcrtomb(char *, wchar_t, mbstate_t *); -#endif - #include "archive_private.h" #include "archive_string.h" @@ -172,14 +164,13 @@ __archive_strappend_int(struct archive_string *as, int d, int base) } /* - * Home-grown wcrtomb for UTF-8. + * Home-grown wctomb for UTF-8. */ -static size_t -my_wcrtomb_utf8(char *p, wchar_t wc, mbstate_t *s) +static int +my_wctomb_utf8(char *p, wchar_t wc) { - (void)s; /* UNUSED */ - if (p == NULL) + /* UTF-8 doesn't use shift states. */ return (0); if (wc <= 0x7f) { p[0] = (char)wc; @@ -208,24 +199,25 @@ my_wcrtomb_utf8(char *p, wchar_t wc, mbstate_t *s) * Awkward point: UTF-8 <-> wchar_t conversions * can actually fail. */ - return ((size_t)-1); + return (-1); } static int my_wcstombs(struct archive_string *as, const wchar_t *w, - size_t (*func)(char *, wchar_t, mbstate_t *)) + int (*func)(char *, wchar_t)) { - size_t n; + int n; char *p; - mbstate_t shift_state; char buff[256]; + /* Clear the shift state before starting. */ + (*func)(NULL, L'\0'); + /* * Convert one wide char at a time into 'buff', whenever that * fills, append it to the string. */ p = buff; - wcrtomb(NULL, L'\0', &shift_state); while (*w != L'\0') { /* Flush the buffer when we have <=16 bytes free. */ /* (No encoding has a single character >16 bytes.) */ @@ -234,8 +226,8 @@ my_wcstombs(struct archive_string *as, const wchar_t *w, archive_strcat(as, buff); p = buff; } - n = (*func)(p, *w++, &shift_state); - if (n == (size_t)-1) + n = (*func)(p, *w++); + if (n == -1) return (-1); p += n; } @@ -251,7 +243,7 @@ my_wcstombs(struct archive_string *as, const wchar_t *w, struct archive_string * __archive_strappend_w_utf8(struct archive_string *as, const wchar_t *w) { - if (my_wcstombs(as, w, my_wcrtomb_utf8)) + if (my_wcstombs(as, w, my_wctomb_utf8)) return (NULL); return (as); } @@ -260,42 +252,40 @@ __archive_strappend_w_utf8(struct archive_string *as, const wchar_t *w) * Translates a wide character string into current locale character set * and appends to the archive_string. Note: returns NULL if conversion * fails. - * - * TODO: use my_wcrtomb_utf8 if !HAVE_WCRTOMB (add configure logic first!) */ struct archive_string * __archive_strappend_w_mbs(struct archive_string *as, const wchar_t *w) { - if (my_wcstombs(as, w, wcrtomb)) +#if HAVE_WCTOMB + if (my_wcstombs(as, w, wctomb)) + return (NULL); +#else + /* TODO: Can we do better than this? Are there platforms + * that have locale support but don't have wctomb()? */ + if (my_wcstombs(as, w, my_wctomb_utf8)) return (NULL); +#endif return (as); } /* - * Home-grown mbrtowc for UTF-8. Some systems lack UTF-8 - * (or even lack mbrtowc()) and we need UTF-8 support for pax + * Home-grown mbtowc for UTF-8. Some systems lack UTF-8 + * (or even lack mbtowc()) and we need UTF-8 support for pax * format. So please don't replace this with a call to the - * standard mbrtowc() function! + * standard mbtowc() function! */ -static size_t -my_mbrtowc_utf8(wchar_t *pwc, const char *s, size_t n, mbstate_t *ps) +static int +my_mbtowc_utf8(wchar_t *pwc, const char *s, size_t n) { int ch; - /* - * This argument is here to make the prototype identical to the - * standard mbrtowc(), so I can build generic string processors - * that just accept a pointer to a suitable mbrtowc() function. - */ - (void)ps; /* UNUSED */ - /* Standard behavior: a NULL value for 's' just resets shift state. */ if (s == NULL) return (0); /* If length argument is zero, don't look at the first character. */ if (n <= 0) - return ((size_t)-2); + return (-1); /* * Decode 1-4 bytes depending on the value of the first byte. @@ -310,16 +300,16 @@ my_mbrtowc_utf8(wchar_t *pwc, const char *s, size_t n, mbstate_t *ps) } if ((ch & 0xe0) == 0xc0) { if (n < 2) - return ((size_t)-2); - if ((s[1] & 0xc0) != 0x80) return (size_t)-1; + return (-1); + if ((s[1] & 0xc0) != 0x80) return (-1); *pwc = ((ch & 0x1f) << 6) | (s[1] & 0x3f); return (2); } if ((ch & 0xf0) == 0xe0) { if (n < 3) - return ((size_t)-2); - if ((s[1] & 0xc0) != 0x80) return (size_t)-1; - if ((s[2] & 0xc0) != 0x80) return (size_t)-1; + return (-1); + if ((s[1] & 0xc0) != 0x80) return (-1); + if ((s[2] & 0xc0) != 0x80) return (-1); *pwc = ((ch & 0x0f) << 12) | ((s[1] & 0x3f) << 6) | (s[2] & 0x3f); @@ -327,10 +317,10 @@ my_mbrtowc_utf8(wchar_t *pwc, const char *s, size_t n, mbstate_t *ps) } if ((ch & 0xf8) == 0xf0) { if (n < 4) - return ((size_t)-2); - if ((s[1] & 0xc0) != 0x80) return (size_t)-1; - if ((s[2] & 0xc0) != 0x80) return (size_t)-1; - if ((s[3] & 0xc0) != 0x80) return (size_t)-1; + return (-1); + if ((s[1] & 0xc0) != 0x80) return (-1); + if ((s[2] & 0xc0) != 0x80) return (-1); + if ((s[3] & 0xc0) != 0x80) return (-1); *pwc = ((ch & 0x07) << 18) | ((s[1] & 0x3f) << 12) | ((s[2] & 0x3f) << 6) @@ -338,7 +328,7 @@ my_mbrtowc_utf8(wchar_t *pwc, const char *s, size_t n, mbstate_t *ps) return (4); } /* Invalid first byte. */ - return ((size_t)-1); + return (-1); } /* @@ -350,7 +340,7 @@ __archive_string_utf8_w(struct archive_string *as) { wchar_t *ws, *dest; const char *src; - size_t n; + int n; int err; ws = (wchar_t *)malloc((as->length + 1) * sizeof(wchar_t)); @@ -360,10 +350,10 @@ __archive_string_utf8_w(struct archive_string *as) dest = ws; src = as->s; while (*src != '\0') { - n = my_mbrtowc_utf8(dest, src, 8, NULL); + n = my_mbtowc_utf8(dest, src, 8); if (n == 0) break; - if (n == (size_t)-1 || n == (size_t)-2) { + if (n < 0) { free(ws); return (NULL); } diff --git a/archivers/libarchive/files/libarchive/archive_string.h b/archivers/libarchive/files/libarchive/archive_string.h index 61e70777f19..e59c33af198 100644 --- a/archivers/libarchive/files/libarchive/archive_string.h +++ b/archivers/libarchive/files/libarchive/archive_string.h @@ -22,7 +22,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: src/lib/libarchive/archive_string.h,v 1.10 2008/03/14 22:00:09 kientzle Exp $ + * $FreeBSD: src/lib/libarchive/archive_string.h,v 1.12 2008/06/15 05:11:08 kientzle Exp $ * */ @@ -30,6 +30,9 @@ #define ARCHIVE_STRING_H_INCLUDED #include <stdarg.h> +#ifdef HAVE_STDLIB_H +#include <stdlib.h> /* required for wchar_t on some systems */ +#endif #ifdef HAVE_STRING_H #include <string.h> #endif diff --git a/archivers/libarchive/files/libarchive/archive_util.c b/archivers/libarchive/files/libarchive/archive_util.c index 55dd1fa10c3..7fb46967715 100644 --- a/archivers/libarchive/files/libarchive/archive_util.c +++ b/archivers/libarchive/files/libarchive/archive_util.c @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: src/lib/libarchive/archive_util.c,v 1.17 2008/03/14 22:31:57 kientzle Exp $"); +__FBSDID("$FreeBSD: src/lib/libarchive/archive_util.c,v 1.18 2008/05/26 17:00:22 kientzle Exp $"); #ifdef HAVE_SYS_TYPES_H #include <sys/types.h> diff --git a/archivers/libarchive/files/libarchive/archive_write.3 b/archivers/libarchive/files/libarchive/archive_write.3 index fff84f7cddc..14003f43c36 100644 --- a/archivers/libarchive/files/libarchive/archive_write.3 +++ b/archivers/libarchive/files/libarchive/archive_write.3 @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: src/lib/libarchive/archive_write.3,v 1.23 2008/03/10 14:44:41 jkoshy Exp $ +.\" $FreeBSD: src/lib/libarchive/archive_write.3,v 1.24 2008/05/26 17:00:23 kientzle Exp $ .\" .Dd May 11, 2008 .Dt archive_write 3 diff --git a/archivers/libarchive/files/libarchive/archive_write_disk.3 b/archivers/libarchive/files/libarchive/archive_write_disk.3 index f71d7d54854..d68a0ffca3d 100644 --- a/archivers/libarchive/files/libarchive/archive_write_disk.3 +++ b/archivers/libarchive/files/libarchive/archive_write_disk.3 @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: src/lib/libarchive/archive_write_disk.3,v 1.2 2008/03/10 14:44:41 jkoshy Exp $ +.\" $FreeBSD: src/lib/libarchive/archive_write_disk.3,v 1.3 2008/05/26 17:00:23 kientzle Exp $ .\" .Dd March 2, 2007 .Dt archive_write_disk 3 diff --git a/archivers/libarchive/files/libarchive/archive_write_disk.c b/archivers/libarchive/files/libarchive/archive_write_disk.c index 8010c1330ea..238173c42a2 100644 --- a/archivers/libarchive/files/libarchive/archive_write_disk.c +++ b/archivers/libarchive/files/libarchive/archive_write_disk.c @@ -25,7 +25,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: src/lib/libarchive/archive_write_disk.c,v 1.24 2008/03/15 04:20:50 kientzle Exp $"); +__FBSDID("$FreeBSD: src/lib/libarchive/archive_write_disk.c,v 1.26 2008/06/21 19:05:29 kientzle Exp $"); #ifdef HAVE_SYS_TYPES_H #include <sys/types.h> @@ -64,9 +64,6 @@ __FBSDID("$FreeBSD: src/lib/libarchive/archive_write_disk.c,v 1.24 2008/03/15 04 #ifdef HAVE_LINUX_FS_H #include <linux/fs.h> /* for Linux file flags */ #endif -#ifdef HAVE_LINUX_EXT2_FS_H -#include <linux/ext2_fs.h> /* for Linux file flags */ -#endif #ifdef HAVE_LIMITS_H #include <limits.h> #endif @@ -613,8 +610,8 @@ _archive_write_finish_entry(struct archive *_a) /* Restore metadata. */ /* - * Look up the "real" UID only if we're going to need it. We - * need this for TODO_SGID because chown() requires both. + * Look up the "real" UID only if we're going to need it. + * TODO: the TODO_SGID condition can be dropped here, can't it? */ if (a->todo & (TODO_OWNER | TODO_SUID | TODO_SGID)) { a->uid = a->lookup_uid(a->lookup_uid_data, @@ -622,6 +619,7 @@ _archive_write_finish_entry(struct archive *_a) archive_entry_uid(a->entry)); } /* Look up the "real" GID only if we're going to need it. */ + /* TODO: the TODO_SUID condition can be dropped here, can't it? */ if (a->todo & (TODO_OWNER | TODO_SGID | TODO_SUID)) { a->gid = a->lookup_gid(a->lookup_gid_data, archive_entry_gname(a->entry), @@ -1023,7 +1021,10 @@ create_filesystem_object(struct archive_write_disk *a) a->deferred |= (a->todo & TODO_TIMES); a->todo &= ~TODO_TIMES; /* Never use an immediate chmod(). */ - if (mode != final_mode) + /* We can't avoid the chmod() entirely if EXTRACT_PERM + * because of SysV SGID inheritance. */ + if ((mode != final_mode) + || (a->flags & ARCHIVE_EXTRACT_PERM)) a->deferred |= (a->todo & TODO_MODE); a->todo &= ~TODO_MODE; } @@ -1351,7 +1352,7 @@ cleanup_pathname(struct archive_write_disk *a) if (*src == '\0') { archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, "Invalid empty pathname"); - return (ARCHIVE_WARN); + return (ARCHIVE_FAILED); } /* Skip leading '/'. */ @@ -1382,7 +1383,7 @@ cleanup_pathname(struct archive_write_disk *a) archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, "Path contains '..'"); - return (ARCHIVE_WARN); + return (ARCHIVE_FAILED); } lastdotdot = 1; } else @@ -1421,7 +1422,7 @@ cleanup_pathname(struct archive_write_disk *a) archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, "Path contains trailing '..'"); - return (ARCHIVE_WARN); + return (ARCHIVE_FAILED); } if (dest == a->name) { /* @@ -1565,8 +1566,8 @@ create_dir(struct archive_write_disk *a, char *path) /* * Note: Although we can skip setting the user id if the desired user * id matches the current user, we cannot skip setting the group, as - * many systems set the gid bit based on the containing directory. So - * we have to perform a chown syscall if we want to restore the SGID + * many systems set the gid based on the containing directory. So + * we have to perform a chown syscall if we want to set the SGID * bit. (The alternative is to stat() and then possibly chown(); it's * more efficient to skip the stat() and just always chown().) Note * that a successful chown() here clears the TODO_SGID_CHECK bit, which diff --git a/archivers/libarchive/files/libarchive/archive_write_set_compression_program.c b/archivers/libarchive/files/libarchive/archive_write_set_compression_program.c index b8b20c86cf9..69c5d428633 100644 --- a/archivers/libarchive/files/libarchive/archive_write_set_compression_program.c +++ b/archivers/libarchive/files/libarchive/archive_write_set_compression_program.c @@ -25,10 +25,12 @@ #include "archive_platform.h" -__FBSDID("$FreeBSD: src/lib/libarchive/archive_write_set_compression_program.c,v 1.1 2007/05/29 01:00:19 kientzle Exp $"); +__FBSDID("$FreeBSD: src/lib/libarchive/archive_write_set_compression_program.c,v 1.3 2008/06/15 10:45:57 kientzle Exp $"); /* This capability is only available on POSIX systems. */ -#if !defined(HAVE_PIPE) || !defined(HAVE_VFORK) || !defined(HAVE_FCNTL) +#if !defined(HAVE_PIPE) || !defined(HAVE_FCNTL) || \ + !(defined(HAVE_FORK) || defined(HAVE_VFORK)) +#include "archive.h" /* * On non-Posix systems, allow the program to build, but choke if @@ -180,6 +182,12 @@ restart_write: if (ret == -1 && errno != EAGAIN) return (-1); + if (state->child_stdout == -1) { + fcntl(state->child_stdin, F_SETFL, 0); + __archive_check_child(state->child_stdin, state->child_stdout); + goto restart_write; + } + do { ret = read(state->child_stdout, state->child_buf + state->child_buf_avail, diff --git a/archivers/libarchive/files/libarchive/archive_write_set_format_ar.c b/archivers/libarchive/files/libarchive/archive_write_set_format_ar.c index 1731844d339..7176e6e2f40 100644 --- a/archivers/libarchive/files/libarchive/archive_write_set_format_ar.c +++ b/archivers/libarchive/files/libarchive/archive_write_set_format_ar.c @@ -26,7 +26,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: src/lib/libarchive/archive_write_set_format_ar.c,v 1.6 2008/03/15 11:04:45 kientzle Exp $"); +__FBSDID("$FreeBSD: src/lib/libarchive/archive_write_set_format_ar.c,v 1.7 2008/05/26 17:00:23 kientzle Exp $"); #ifdef HAVE_ERRNO_H #include <errno.h> diff --git a/archivers/libarchive/files/libarchive/archive_write_set_format_pax.c b/archivers/libarchive/files/libarchive/archive_write_set_format_pax.c index 89f89bc9f54..3e294cdf0a8 100644 --- a/archivers/libarchive/files/libarchive/archive_write_set_format_pax.c +++ b/archivers/libarchive/files/libarchive/archive_write_set_format_pax.c @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: src/lib/libarchive/archive_write_set_format_pax.c,v 1.46 2008/03/15 11:04:45 kientzle Exp $"); +__FBSDID("$FreeBSD: src/lib/libarchive/archive_write_set_format_pax.c,v 1.47 2008/05/26 17:00:23 kientzle Exp $"); #ifdef HAVE_ERRNO_H #include <errno.h> diff --git a/archivers/libarchive/files/libarchive/archive_write_set_format_ustar.c b/archivers/libarchive/files/libarchive/archive_write_set_format_ustar.c index 970fee8db1b..8aed25d1f99 100644 --- a/archivers/libarchive/files/libarchive/archive_write_set_format_ustar.c +++ b/archivers/libarchive/files/libarchive/archive_write_set_format_ustar.c @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: src/lib/libarchive/archive_write_set_format_ustar.c,v 1.26 2008/03/15 11:04:45 kientzle Exp $"); +__FBSDID("$FreeBSD: src/lib/libarchive/archive_write_set_format_ustar.c,v 1.27 2008/05/26 17:00:23 kientzle Exp $"); #ifdef HAVE_ERRNO_H diff --git a/archivers/libarchive/files/libarchive/config_freebsd.h b/archivers/libarchive/files/libarchive/config_freebsd.h index 3d5e821612f..4182b71df47 100644 --- a/archivers/libarchive/files/libarchive/config_freebsd.h +++ b/archivers/libarchive/files/libarchive/config_freebsd.h @@ -22,7 +22,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: src/lib/libarchive/config_freebsd.h,v 1.8 2008/03/15 04:20:50 kientzle Exp $ + * $FreeBSD: src/lib/libarchive/config_freebsd.h,v 1.10 2008/06/15 05:12:47 kientzle Exp $ */ /* FreeBSD 5.0 and later have ACL support. */ @@ -87,8 +87,6 @@ #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_STRUCT_TM_TM_GMTOFF 1 #define HAVE_SYS_ACL_H 1 #define HAVE_SYS_IOCTL_H 1 #define HAVE_SYS_SELECT_H 1 @@ -108,6 +106,7 @@ #define HAVE_WCHAR_H 1 #define HAVE_WCSCPY 1 #define HAVE_WCSLEN 1 +#define HAVE_WCTOMB 1 #define HAVE_WMEMCMP 1 #define HAVE_WMEMCPY 1 #define HAVE_ZLIB_H 1 diff --git a/archivers/libarchive/files/libarchive/config_windows.h b/archivers/libarchive/files/libarchive/config_windows.h index 0ccb2f1b166..e6a6afac505 100644 --- a/archivers/libarchive/files/libarchive/config_windows.h +++ b/archivers/libarchive/files/libarchive/config_windows.h @@ -337,12 +337,6 @@ /* 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 `tm_gmtoff' is member of `struct tm'. */
-/* #undef HAVE_STRUCT_TM_TM_GMTOFF */
-
/* Define to 1 if you have the <sys/acl.h> header file. */
/* #undef HAVE_SYS_ACL_H */
diff --git a/archivers/libarchive/files/libarchive/cpio.5 b/archivers/libarchive/files/libarchive/cpio.5 index 8f024c546a5..f54462818ae 100644 --- a/archivers/libarchive/files/libarchive/cpio.5 +++ b/archivers/libarchive/files/libarchive/cpio.5 @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: src/lib/libarchive/cpio.5,v 1.1 2007/12/30 04:58:22 kientzle Exp $ +.\" $FreeBSD: src/lib/libarchive/cpio.5,v 1.2 2008/05/26 17:00:23 kientzle Exp $ .\" .Dd October 5, 2007 .Dt CPIO 5 diff --git a/archivers/libarchive/files/libarchive/filter_fork.c b/archivers/libarchive/files/libarchive/filter_fork.c index 3c2d829d052..c746a186f52 100644 --- a/archivers/libarchive/files/libarchive/filter_fork.c +++ b/archivers/libarchive/files/libarchive/filter_fork.c @@ -26,9 +26,10 @@ #include "archive_platform.h" /* This capability is only available on POSIX systems. */ -#if defined(HAVE_PIPE) && defined(HAVE_VFORK) && defined(HAVE_FCNTL) +#if defined(HAVE_PIPE) && defined(HAVE_FCNTL) && \ + (defined(HAVE_FORK) || defined(HAVE_VFORK)) -__FBSDID("$FreeBSD: src/lib/libarchive/filter_fork.c,v 1.2 2007/12/30 04:58:22 kientzle Exp $"); +__FBSDID("$FreeBSD: src/lib/libarchive/filter_fork.c,v 1.4 2008/06/15 10:45:57 kientzle Exp $"); #if defined(HAVE_POLL) # if defined(HAVE_POLL_H) @@ -75,7 +76,11 @@ __archive_create_child(const char *path, int *child_stdin, int *child_stdout) stdout_pipe[1] = tmp; } +#if HAVE_VFORK switch ((child = vfork())) { +#else + switch ((child = fork())) { +#endif case -1: goto stdout_opened; case 0: @@ -118,23 +123,35 @@ __archive_check_child(int in, int out) { #if defined(HAVE_POLL) struct pollfd fds[2]; + int idx; - fds[0].fd = in; - fds[0].events = POLLOUT; - fds[1].fd = out; - fds[1].events = POLLIN; + idx = 0; + if (in != -1) { + fds[idx].fd = in; + fds[idx].events = POLLOUT; + ++idx; + } + if (out != -1) { + fds[idx].fd = out; + fds[idx].events = POLLIN; + ++idx; + } - poll(fds, 2, -1); /* -1 == INFTIM, wait forever */ + poll(fds, idx, -1); /* -1 == INFTIM, wait forever */ #elif defined(HAVE_SELECT) fd_set fds_in, fds_out, fds_error; FD_ZERO(&fds_in); - FD_SET(out, &fds_in); FD_ZERO(&fds_out); - FD_SET(in, &fds_out); FD_ZERO(&fds_error); - FD_SET(in, &fds_error); - FD_SET(out, &fds_error); + if (out != -1) { + FD_SET(out, &fds_in); + FD_SET(out, &fds_error); + } + if (in != -1) { + FD_SET(in, &fds_out); + FD_SET(in, &fds_error); + } select(in < out ? out + 1 : in + 1, &fds_in, &fds_out, &fds_error, NULL); #else sleep(1); diff --git a/archivers/libarchive/files/libarchive/libarchive-formats.5 b/archivers/libarchive/files/libarchive/libarchive-formats.5 index f570935c824..dd054a93916 100644 --- a/archivers/libarchive/files/libarchive/libarchive-formats.5 +++ b/archivers/libarchive/files/libarchive/libarchive-formats.5 @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: src/lib/libarchive/libarchive-formats.5,v 1.15 2007/12/30 04:58:22 kientzle Exp $ +.\" $FreeBSD: src/lib/libarchive/libarchive-formats.5,v 1.16 2008/05/26 17:00:23 kientzle Exp $ .\" .Dd April 27, 2004 .Dt libarchive-formats 3 diff --git a/archivers/libarchive/files/libarchive/tar.5 b/archivers/libarchive/files/libarchive/tar.5 index c873a938f4b..06873268097 100644 --- a/archivers/libarchive/files/libarchive/tar.5 +++ b/archivers/libarchive/files/libarchive/tar.5 @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: src/lib/libarchive/tar.5,v 1.17 2007/01/09 08:05:56 kientzle Exp $ +.\" $FreeBSD: src/lib/libarchive/tar.5,v 1.18 2008/05/26 17:00:23 kientzle Exp $ .\" .Dd May 20, 2004 .Dt TAR 5 diff --git a/archivers/libarchive/files/libarchive/test/main.c b/archivers/libarchive/files/libarchive/test/main.c index 6e6ca6c8da1..83d3147d9f8 100644 --- a/archivers/libarchive/files/libarchive/test/main.c +++ b/archivers/libarchive/files/libarchive/test/main.c @@ -27,13 +27,13 @@ * Various utility routines useful for test programs. * Each test program is linked against this file. */ +#include "test.h" + #include <errno.h> #include <locale.h> #include <stdarg.h> #include <time.h> -#include "test.h" - /* * This same file is used pretty much verbatim for all test harnesses. * @@ -43,7 +43,7 @@ #define ENVBASE "LIBARCHIVE" /* Prefix for environment variables. */ #define EXTRA_DUMP(x) archive_error_string((struct archive *)(x)) #define EXTRA_VERSION archive_version() -__FBSDID("$FreeBSD: src/lib/libarchive/test/main.c,v 1.11 2008/03/12 05:12:23 kientzle Exp $"); +__FBSDID("$FreeBSD: src/lib/libarchive/test/main.c,v 1.13 2008/06/15 10:35:22 kientzle Exp $"); /* * "list.h" is simply created by "grep DEFINE_TEST"; it has @@ -540,6 +540,48 @@ test_assert_equal_file(const char *f1, const char *f2pattern, ...) return (0); } +int +test_assert_file_exists(const char *fpattern, ...) +{ + char f[1024]; + va_list ap; + + va_start(ap, fpattern); + vsprintf(f, fpattern, ap); + va_end(ap); + + if (!access(f, F_OK)) + return (1); + if (!previous_failures(test_filename, test_line)) { + fprintf(stderr, "%s:%d: File doesn't exist\n", + test_filename, test_line); + fprintf(stderr, " file=\"%s\"\n", f); + report_failure(test_extra); + } + return (0); +} + +int +test_assert_file_not_exists(const char *fpattern, ...) +{ + char f[1024]; + va_list ap; + + va_start(ap, fpattern); + vsprintf(f, fpattern, ap); + va_end(ap); + + if (access(f, F_OK)) + return (1); + if (!previous_failures(test_filename, test_line)) { + fprintf(stderr, "%s:%d: File exists and shouldn't\n", + test_filename, test_line); + fprintf(stderr, " file=\"%s\"\n", f); + report_failure(test_extra); + } + return (0); +} + /* assertFileContents() asserts the contents of a file. */ int test_assert_file_contents(const void *buff, int s, const char *fpattern, ...) @@ -669,8 +711,11 @@ static int test_run(int i, const char *tmpdir) { int failures_before = failures; - if (!quiet_flag) + if (!quiet_flag) { printf("%d: %s\n", i, tests[i].name); + fflush(stdout); + } + /* * Always explicitly chdir() in case the last test moved us to * a strange place. diff --git a/archivers/libarchive/files/libarchive/test/test.h b/archivers/libarchive/files/libarchive/test/test.h index dcb190ff3fe..fbbf10a8c3d 100644 --- a/archivers/libarchive/files/libarchive/test/test.h +++ b/archivers/libarchive/files/libarchive/test/test.h @@ -22,7 +22,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: src/lib/libarchive/test/test.h,v 1.9 2008/03/12 05:12:23 kientzle Exp $ + * $FreeBSD: src/lib/libarchive/test/test.h,v 1.10 2008/06/15 10:35:22 kientzle Exp $ */ /* Every test program should #include "test.h" as the first thing. */ @@ -31,8 +31,18 @@ * The goal of this file (and the matching test.c) is to * simplify the very repetitive test-*.c test programs. */ -#ifndef _FILE_OFFSET_BITS -#define _FILE_OFFSET_BITS 64 +#if defined(HAVE_CONFIG_H) +/* Most POSIX platforms use the 'configure' script to build config.h */ +#include "../../config.h" +#elif defined(__FreeBSD__) +/* Building as part of FreeBSD system requires a pre-built config.h. */ +#include "../config_freebsd.h" +#elif defined(_WIN32) +/* Win32 can't run the 'configure' script. */ +#include "../config_windows.h" +#else +/* Warn if the library hasn't been (automatically or manually) configured. */ +#error Oops: No config.h and no pre-built configuration in test.h. #endif #include <dirent.h> @@ -51,20 +61,6 @@ #include <dmalloc.h> #endif -#if defined(HAVE_CONFIG_H) -/* Most POSIX platforms use the 'configure' script to build config.h */ -#include "../../config.h" -#elif defined(__FreeBSD__) -/* Building as part of FreeBSD system requires a pre-built config.h. */ -#include "../config_freebsd.h" -#elif defined(_WIN32) -/* Win32 can't run the 'configure' script. */ -#include "../config_windows.h" -#else -/* Warn if the library hasn't been (automatically or manually) configured. */ -#error Oops: No config.h and no pre-built configuration in test.h. -#endif - /* No non-FreeBSD platform will have __FBSDID, so just define it here. */ #ifdef __FreeBSD__ #include <sys/cdefs.h> /* For __FBSDID */ @@ -102,6 +98,15 @@ /* Assert that a file is empty; supports printf-style arguments. */ #define assertEmptyFile \ test_setup(__FILE__, __LINE__);test_assert_empty_file +/* Assert that a file exists; supports printf-style arguments. */ +#define assertFileExists \ + test_setup(__FILE__, __LINE__);test_assert_file_exists +/* Assert that a file exists; supports printf-style arguments. */ +#define assertFileNotExists \ + test_setup(__FILE__, __LINE__);test_assert_file_not_exists +/* Assert that file contents match a string; supports printf-style arguments. */ +#define assertFileContents \ + test_setup(__FILE__, __LINE__);test_assert_file_contents /* * This would be simple with C99 variadic macros, but I don't want to @@ -124,6 +129,8 @@ int test_assert_equal_string(const char *, int, const char *v1, const char *, co int test_assert_equal_wstring(const char *, int, const wchar_t *v1, const char *, const wchar_t *v2, const char *, void *); int test_assert_equal_mem(const char *, int, const char *, const char *, const char *, const char *, size_t, const char *, void *); int test_assert_file_contents(const void *, int, const char *, ...); +int test_assert_file_exists(const char *, ...); +int test_assert_file_not_exists(const char *, ...); /* Like sprintf, then system() */ int systemf(const char * fmt, ...); diff --git a/archivers/libarchive/files/libarchive/test/test_acl_pax.c b/archivers/libarchive/files/libarchive/test/test_acl_pax.c index 6ae3dd271f1..1eb3d399a9e 100644 --- a/archivers/libarchive/files/libarchive/test/test_acl_pax.c +++ b/archivers/libarchive/files/libarchive/test/test_acl_pax.c @@ -23,7 +23,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" -__FBSDID("$FreeBSD: src/lib/libarchive/test/test_acl_pax.c,v 1.4 2007/07/06 15:43:11 kientzle Exp $"); +__FBSDID("$FreeBSD: src/lib/libarchive/test/test_acl_pax.c,v 1.5 2008/05/26 17:00:24 kientzle Exp $"); /* * Exercise the system-independent portion of the ACL support. diff --git a/archivers/libarchive/files/libarchive/test/test_archive_api_feature.c b/archivers/libarchive/files/libarchive/test/test_archive_api_feature.c index 21d189d5876..23a7083c07f 100644 --- a/archivers/libarchive/files/libarchive/test/test_archive_api_feature.c +++ b/archivers/libarchive/files/libarchive/test/test_archive_api_feature.c @@ -23,7 +23,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" -__FBSDID("$FreeBSD: src/lib/libarchive/test/test_archive_api_feature.c,v 1.4 2008/03/14 22:31:57 kientzle Exp $"); +__FBSDID("$FreeBSD: src/lib/libarchive/test/test_archive_api_feature.c,v 1.5 2008/05/26 17:00:24 kientzle Exp $"); DEFINE_TEST(test_archive_api_feature) { diff --git a/archivers/libarchive/files/libarchive/test/test_entry.c b/archivers/libarchive/files/libarchive/test/test_entry.c index 5ed3278c60b..52820923803 100644 --- a/archivers/libarchive/files/libarchive/test/test_entry.c +++ b/archivers/libarchive/files/libarchive/test/test_entry.c @@ -23,7 +23,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" -__FBSDID("$FreeBSD: src/lib/libarchive/test/test_entry.c,v 1.5 2008/03/14 23:19:46 kientzle Exp $"); +__FBSDID("$FreeBSD: src/lib/libarchive/test/test_entry.c,v 1.6 2008/05/26 17:00:24 kientzle Exp $"); #include <locale.h> diff --git a/archivers/libarchive/files/libarchive/test/test_link_resolver.c b/archivers/libarchive/files/libarchive/test/test_link_resolver.c index a51e4a4ddc9..8332c4f985b 100644 --- a/archivers/libarchive/files/libarchive/test/test_link_resolver.c +++ b/archivers/libarchive/files/libarchive/test/test_link_resolver.c @@ -23,7 +23,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" -__FBSDID("$FreeBSD$"); +__FBSDID("$FreeBSD: src/lib/libarchive/test/test_link_resolver.c,v 1.2 2008/06/15 04:31:43 kientzle Exp $"); static void test_linkify_tar(void) { @@ -68,6 +68,24 @@ static void test_linkify_tar(void) assertEqualInt(0, archive_entry_size(entry)); + /* Dirs should never be matched as hardlinks, regardless. */ + archive_entry_set_pathname(entry, "test3"); + archive_entry_set_nlink(entry, 2); + archive_entry_set_filetype(entry, AE_IFDIR); + archive_entry_set_ino(entry, 3); + archive_entry_set_hardlink(entry, NULL); + archive_entry_linkify(resolver, &entry, &e2); + /* Shouldn't be altered, since it wasn't seen before. */ + assert(e2 == NULL); + assertEqualString("test3", archive_entry_pathname(entry)); + assertEqualString(NULL, archive_entry_hardlink(entry)); + + /* Dir, so it shouldn't get matched. */ + archive_entry_linkify(resolver, &entry, &e2); + assert(e2 == NULL); + assertEqualString("test3", archive_entry_pathname(entry)); + assertEqualString(NULL, archive_entry_hardlink(entry)); + archive_entry_free(entry); archive_entry_linkresolver_free(resolver); } diff --git a/archivers/libarchive/files/libarchive/test/test_pax_filename_encoding.c b/archivers/libarchive/files/libarchive/test/test_pax_filename_encoding.c index 34c4fc8230f..aad8327431d 100644 --- a/archivers/libarchive/files/libarchive/test/test_pax_filename_encoding.c +++ b/archivers/libarchive/files/libarchive/test/test_pax_filename_encoding.c @@ -23,7 +23,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" -__FBSDID("$FreeBSD: src/lib/libarchive/test/test_pax_filename_encoding.c,v 1.1 2008/03/15 01:43:59 kientzle Exp $"); +__FBSDID("$FreeBSD: src/lib/libarchive/test/test_pax_filename_encoding.c,v 1.2 2008/05/26 17:00:24 kientzle Exp $"); #include <locale.h> diff --git a/archivers/libarchive/files/libarchive/test/test_read_extract.c b/archivers/libarchive/files/libarchive/test/test_read_extract.c index bd42fd0c967..ec8483077c2 100644 --- a/archivers/libarchive/files/libarchive/test/test_read_extract.c +++ b/archivers/libarchive/files/libarchive/test/test_read_extract.c @@ -23,7 +23,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" -__FBSDID("$FreeBSD: src/lib/libarchive/test/test_read_extract.c,v 1.3 2007/05/29 01:00:20 kientzle Exp $"); +__FBSDID("$FreeBSD: src/lib/libarchive/test/test_read_extract.c,v 1.4 2008/06/15 10:35:22 kientzle Exp $"); #define BUFF_SIZE 1000000 #define FILE_BUFF_SIZE 100000 @@ -135,12 +135,18 @@ DEFINE_TEST(test_read_extract) #endif /* Test the entries on disk. */ + /* This first entry was extracted with ARCHIVE_EXTRACT_PERM, + * so the permissions should have been restored exactly, + * including resetting the gid bit on those platforms + * where gid is inherited by subdirs. */ assert(0 == stat("dir_0775", &st)); failure("This was 0775 in archive, and should be 0775 on disk"); - assert(st.st_mode == (S_IFDIR | 0775)); + assertEqualInt(st.st_mode, S_IFDIR | 0775); + /* Everything else was extracted without ARCHIVE_EXTRACT_PERM, + * so there may be some sloppiness about gid bits on directories. */ assert(0 == stat("file", &st)); failure("st.st_mode=%o should be %o", st.st_mode, S_IFREG | 0755); - assert(st.st_mode == (S_IFREG | 0755)); + assertEqualInt(st.st_mode, S_IFREG | 0755); failure("The file extracted to disk is the wrong size."); assert(st.st_size == FILE_BUFF_SIZE); fd = open("file", O_RDONLY); @@ -153,23 +159,26 @@ DEFINE_TEST(test_read_extract) assert(memcmp(buff, file_buff, FILE_BUFF_SIZE) == 0); assert(0 == stat("dir", &st)); failure("This was 0777 in archive, but umask should make it 0755"); - assert(st.st_mode == (S_IFDIR | 0755)); + /* If EXTRACT_PERM wasn't used, be careful to ignore sgid bit + * when checking dir modes, as some systems inherit sgid bit + * from the parent dir. */ + assertEqualInt(0755, st.st_mode & 0777); assert(0 == stat("dir/file", &st)); assert(st.st_mode == (S_IFREG | 0700)); assert(0 == stat("dir2", &st)); - assert(st.st_mode == (S_IFDIR | 0755)); + assertEqualInt(0755, st.st_mode & 0777); assert(0 == stat("dir2/file", &st)); assert(st.st_mode == (S_IFREG | 0000)); assert(0 == stat("dir3", &st)); - assert(st.st_mode == (S_IFDIR | 0710)); + assertEqualInt(0710, st.st_mode & 0777); assert(0 == stat("dir4", &st)); - assert(st.st_mode == (S_IFDIR | 0755)); + assertEqualInt(0755, st.st_mode & 0777); assert(0 == stat("dir4/a", &st)); - assert(st.st_mode == (S_IFDIR | 0755)); + assertEqualInt(0755, st.st_mode & 0777); assert(0 == stat("dir4/b", &st)); - assert(st.st_mode == (S_IFDIR | 0755)); + assertEqualInt(0755, st.st_mode & 0777); assert(0 == stat("dir4/c", &st)); - assert(st.st_mode == (S_IFDIR | 0711)); + assertEqualInt(0711, st.st_mode & 0777); assert(0 == lstat("symlink", &st)); assert(S_ISLNK(st.st_mode)); #if HAVE_LCHMOD diff --git a/archivers/libarchive/files/libarchive/test/test_read_format_isorr_bz2.c b/archivers/libarchive/files/libarchive/test/test_read_format_isorr_bz2.c index 107024f5ede..5457c7fd96f 100644 --- a/archivers/libarchive/files/libarchive/test/test_read_format_isorr_bz2.c +++ b/archivers/libarchive/files/libarchive/test/test_read_format_isorr_bz2.c @@ -23,11 +23,11 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" -__FBSDID("$FreeBSD: src/lib/libarchive/test/test_read_format_isorr_bz2.c,v 1.3 2008/01/01 22:28:04 kientzle Exp $"); +__FBSDID("$FreeBSD: src/lib/libarchive/test/test_read_format_isorr_bz2.c,v 1.4 2008/06/21 19:11:51 kientzle Exp $"); /* Execute the following to rebuild the data for this program: - tail -n +5 test-read_format-isorr_bz2.c | /bin/sh + tail -n +32 test_read_format_isorr_bz2.c | /bin/sh rm -rf /tmp/iso mkdir /tmp/iso @@ -35,79 +35,37 @@ mkdir /tmp/iso/dir echo "hello" >/tmp/iso/file ln /tmp/iso/file /tmp/iso/hardlink (cd /tmp/iso; ln -s file symlink) -TZ=utc touch -afhm -t 197001010000.01 /tmp/iso /tmp/iso/file /tmp/iso/dir -TZ=utc touch -afhm -t 196912312359.58 /tmp/iso/symlink -mkhybrid -R -uid 1 -gid 2 /tmp/iso | bzip2 > data.iso.bz2 -cat data.iso.bz2 | ./maketest.pl > data.c +TZ=utc touch -afhm -t 197001020000.01 /tmp/iso /tmp/iso/file /tmp/iso/dir +TZ=utc touch -afhm -t 197001030000.02 /tmp/iso/symlink +mkhybrid -R -uid 1 -gid 2 /tmp/iso | bzip2 > test_read_format_isorr_bz2.iso.bz2 +F=test_read_format_isorr_bz2.iso.bz2 +uuencode $F $F > $F.uu exit 1 */ -static unsigned char archive[] = { -'B','Z','h','9','1','A','Y','&','S','Y','G',11,4,'c',0,0,199,255,221,255, -255,203,252,221,'c',251,248,'?',255,223,224,167,255,222,'&','!',234,'$',0, -'0',1,' ',0,'D',2,129,8,192,3,14,'2','3','$',19,184,'J',' ','F',168,244,201, -149,'6','Q',226,155,'S',212,209,160,'h','4','i',160,26,13,0,244,134,212,0, -218,'O',212,153,1,144,244,128,148,' ',147,13,' ',213,'=','1','\'',169,166, -128,'=','!',233,0,208,0,26,0,0,30,160,'h',0,'4','z',130,180,163,'@',0,0,4, -211,0,0,0,2,'b','`',0,0,0,0,0,8,146,133,'F',154,'y','A',163,'A',161,163,'@', -'z',134,'C','C','F',131,'F','@',0,0,0,0,6,154,26,'Q',24,234,180,'P',172,251, -'=',2,'P','H','&','Y','o',130,28,'"',229,210,247,227,248,200,'?','6',161, -'?',170,'H',172,'"','H','I',16,'2','"','&',148,'G',133,'T','z',224,1,215, -' ',0,191,184,10,160,24,248,180,183,244,156,'K',202,133,208,'U',5,'6','C', -26,144,'H',168,'H','H','(','"',151,'@','m',223,'(','P',169,'e',145,148,'6', -237,235,7,227,204,']','k','{',241,187,227,244,251,':','a','L',138,'#','R', -'"',221,'_',239,')',140,'*','*',172,'Q',16,1,16,207,166,251,233,'Z',169,'4', -'_',195,'a',14,18,231,'}',14,139,137,'e',213,185,'T',194,'D','`',25,'$',187, -208,'%','c',162,'~',181,'@',204,'2',238,'P',161,213,127,'I',169,3,' ','o', -6,161,16,128,'F',214,'S','m',6,244,11,229,'Z','y','.',176,'q',' ',248,167, -204,26,193,'q',211,241,214,133,221,212,'I','`',28,244,'N','N','f','H','9', -'w',245,209,'*',20,26,208,'h','(',194,156,192,'l',';',192,'X','T',151,177, -209,'0',156,16,'=',20,'k',184,144,'z',26,'j',133,194,'9',227,'<','[','^', -17,'w','p',225,220,248,'>',205,'>','[',19,'5',155,17,175,28,28,168,175,'n', -'\'','c','w',27,222,204,'k','n','x','I',23,237,'c',145,11,184,'A','(',1,169, -'0',180,189,134,'\\','Y','x',187,'C',151,'d','k','y','-','L',218,138,'s', -'*','(',12,'h',242,'*',17,'E','L',202,146,138,'l','0',217,160,'9','.','S', -214,198,143,'3','&',237,'=','t','P',168,214,210,'`','p','J',181,'H',138,149, -'1','B',206,22,164,'[','O','A',172,134,224,179,219,166,184,'X',185,'W',154, -219,19,161,'Y',184,220,237,147,'9',191,237,'&','i','_',226,146,205,160,'@', -'b',182,';',3,'!',183,'J','t',161,160,178,173,'S',235,':','2',159,':',245, -'{','U',174,'P',142,'G','(',')',9,168,185,'A','U',231,193,'g',213,'e',12, -'X',223,22,249,')',152,237,'G',150,156,3,201,245,212,'2',218,209,177,196, -235,'_','~',137,24,31,196,232,'B',172,'w',159,24,'n',156,150,225,'1','y', -22,'#',138,193,227,232,169,170,166,179,1,11,182,'i',')',160,180,198,175,128, -249,167,5,194,142,183,'f',134,206,180,'&','E','!','[',31,195,':',192,'s', -232,187,'N',131,'Y',137,243,15,'y',12,'J',163,'-',242,'5',197,151,130,163, -240,220,'T',161,'L',159,141,159,152,'4',18,128,'.','^',250,168,200,163,'P', -231,'Y','w','F','U',186,'x',190,16,'0',228,22,'9','F','t',168,157,'i',190, -'+',246,141,142,18,' ','M',174,197,'O',165,'m',224,27,'b',150,'|','W','H', -196,'.','*','Q','$',225,'I','-',148,169,'F',7,197,'m','-',130,153,0,158,21, -'(',221,221,226,206,'g',13,159,163,'y',176,'~',158,'k','4','q','d','s',177, -'7',14,217,'1',173,206,228,'t',250,200,170,162,'d','2','Z','$','e',168,224, -223,129,174,229,165,187,252,203,'-',28,'`',207,183,'-','/',127,196,230,131, -'B',30,237,' ',8,26,194,'O',132,'L','K','\\',144,'L','c',1,10,176,192,'c', -0,244,2,168,3,0,'+',233,186,16,17,'P',17,129,252,'2',0,2,154,247,255,166, -'.',228,138,'p',161,' ',142,22,8,198}; - DEFINE_TEST(test_read_format_isorr_bz2) { + const char *refname = "test_read_format_isorr_bz2.iso.bz2"; struct archive_entry *ae; struct archive *a; const void *p; size_t size; off_t offset; + + extract_reference_file(refname); assert((a = archive_read_new()) != NULL); - assert(0 == archive_read_support_compression_all(a)); - assert(0 == archive_read_support_format_all(a)); - assert(0 == archive_read_open_memory(a, archive, sizeof(archive))); + assertEqualInt(0, archive_read_support_compression_all(a)); + assertEqualInt(0, archive_read_support_format_all(a)); + assertEqualInt(0, archive_read_open_filename(a, refname, 10240)); /* First entry is '.' root directory. */ - assert(0 == archive_read_next_header(a, &ae)); + assertEqualInt(0, archive_read_next_header(a, &ae)); assertEqualString(".", archive_entry_pathname(ae)); assert(S_ISDIR(archive_entry_stat(ae)->st_mode)); assertEqualInt(2048, archive_entry_size(ae)); - assertEqualInt(1, archive_entry_mtime(ae)); + assertEqualInt(86401, archive_entry_mtime(ae)); assertEqualInt(0, archive_entry_mtime_nsec(ae)); - assertEqualInt(1, archive_entry_ctime(ae)); + assertEqualInt(86401, archive_entry_ctime(ae)); assertEqualInt(0, archive_entry_stat(ae)->st_nlink); assertEqualInt(0, archive_entry_uid(ae)); assertEqualIntA(a, ARCHIVE_EOF, @@ -115,66 +73,66 @@ DEFINE_TEST(test_read_format_isorr_bz2) assertEqualInt(size, 0); /* A directory. */ - assert(0 == archive_read_next_header(a, &ae)); + assertEqualInt(0, archive_read_next_header(a, &ae)); assertEqualString("dir", archive_entry_pathname(ae)); assert(S_ISDIR(archive_entry_stat(ae)->st_mode)); - assert(2048 == archive_entry_size(ae)); - assert(1 == archive_entry_mtime(ae)); - assert(1 == archive_entry_atime(ae)); - assert(2 == archive_entry_stat(ae)->st_nlink); - assert(1 == archive_entry_uid(ae)); - assert(2 == archive_entry_gid(ae)); + assertEqualInt(2048, archive_entry_size(ae)); + assertEqualInt(86401, archive_entry_mtime(ae)); + assertEqualInt(86401, archive_entry_atime(ae)); + assertEqualInt(2, archive_entry_stat(ae)->st_nlink); + assertEqualInt(1, archive_entry_uid(ae)); + assertEqualInt(2, archive_entry_gid(ae)); /* A regular file. */ - assert(0 == archive_read_next_header(a, &ae)); + assertEqualInt(0, archive_read_next_header(a, &ae)); assertEqualString("file", archive_entry_pathname(ae)); assert(S_ISREG(archive_entry_stat(ae)->st_mode)); - assert(6 == archive_entry_size(ae)); - assert(0 == archive_read_data_block(a, &p, &size, &offset)); - assert(6 == size); - assert(0 == offset); - assert(0 == memcmp(p, "hello\n", 6)); - assert(1 == archive_entry_mtime(ae)); - assert(1 == archive_entry_atime(ae)); - assert(2 == archive_entry_stat(ae)->st_nlink); - assert(1 == archive_entry_uid(ae)); - assert(2 == archive_entry_gid(ae)); + assertEqualInt(6, archive_entry_size(ae)); + assertEqualInt(0, archive_read_data_block(a, &p, &size, &offset)); + assertEqualInt(6, size); + assertEqualInt(0, offset); + assertEqualInt(0, memcmp(p, "hello\n", 6)); + assertEqualInt(86401, archive_entry_mtime(ae)); + assertEqualInt(86401, archive_entry_atime(ae)); + assertEqualInt(2, archive_entry_stat(ae)->st_nlink); + assertEqualInt(1, archive_entry_uid(ae)); + assertEqualInt(2, archive_entry_gid(ae)); /* A hardlink to the regular file. */ - assert(0 == archive_read_next_header(a, &ae)); + assertEqualInt(0, archive_read_next_header(a, &ae)); assertEqualString("hardlink", archive_entry_pathname(ae)); assert(S_ISREG(archive_entry_stat(ae)->st_mode)); assertEqualString("file", archive_entry_hardlink(ae)); - assert(6 == archive_entry_size(ae)); - assert(1 == archive_entry_mtime(ae)); - assert(1 == archive_entry_atime(ae)); - assert(2 == archive_entry_stat(ae)->st_nlink); - assert(1 == archive_entry_uid(ae)); - assert(2 == archive_entry_gid(ae)); + assertEqualInt(6, archive_entry_size(ae)); + assertEqualInt(86401, archive_entry_mtime(ae)); + assertEqualInt(86401, archive_entry_atime(ae)); + assertEqualInt(2, archive_entry_stat(ae)->st_nlink); + assertEqualInt(1, archive_entry_uid(ae)); + assertEqualInt(2, archive_entry_gid(ae)); /* A symlink to the regular file. */ - assert(0 == archive_read_next_header(a, &ae)); + assertEqualInt(0, archive_read_next_header(a, &ae)); assertEqualString("symlink", archive_entry_pathname(ae)); assert(S_ISLNK(archive_entry_stat(ae)->st_mode)); assertEqualString("file", archive_entry_symlink(ae)); - assert(0 == archive_entry_size(ae)); - assert(-2 == archive_entry_mtime(ae)); - assert(-2 == archive_entry_atime(ae)); - assert(1 == archive_entry_stat(ae)->st_nlink); - assert(1 == archive_entry_uid(ae)); - assert(2 == archive_entry_gid(ae)); + assertEqualInt(0, archive_entry_size(ae)); + assertEqualInt(172802, archive_entry_mtime(ae)); + assertEqualInt(172802, archive_entry_atime(ae)); + assertEqualInt(1, archive_entry_stat(ae)->st_nlink); + assertEqualInt(1, archive_entry_uid(ae)); + assertEqualInt(2, archive_entry_gid(ae)); /* End of archive. */ - assert(ARCHIVE_EOF == archive_read_next_header(a, &ae)); + assertEqualInt(ARCHIVE_EOF, archive_read_next_header(a, &ae)); /* Verify archive format. */ - assert(archive_compression(a) == ARCHIVE_COMPRESSION_BZIP2); - assert(archive_format(a) == ARCHIVE_FORMAT_ISO9660_ROCKRIDGE); + assertEqualInt(archive_compression(a), ARCHIVE_COMPRESSION_BZIP2); + assertEqualInt(archive_format(a), ARCHIVE_FORMAT_ISO9660_ROCKRIDGE); /* Close the archive. */ - assert(0 == archive_read_close(a)); + assertEqualInt(0, archive_read_close(a)); #if ARCHIVE_API_VERSION > 1 - assert(0 == archive_read_finish(a)); + assertEqualInt(0, archive_read_finish(a)); #else archive_read_finish(a); #endif diff --git a/archivers/libarchive/files/libarchive/test/test_read_format_isorr_bz2.iso.bz2.uu b/archivers/libarchive/files/libarchive/test/test_read_format_isorr_bz2.iso.bz2.uu new file mode 100644 index 00000000000..3f0cfca5021 --- /dev/null +++ b/archivers/libarchive/files/libarchive/test/test_read_format_isorr_bz2.iso.bz2.uu @@ -0,0 +1,22 @@ +begin 644 test_read_format_isorr_bz2.iso.bz2 +M0EIH.3%!629361M#:2D``,?_W?__6_Y58_GX/__?X*?OWB8AZB0`,`$@`$0" +M@0C``QP`U:!,&J>FJ>2:CR)^I'ZB#3U/4-`!H:#(:``]0P@`!H9!D!II-$,A +M&BGFJ>34]0T!IHT&AHT:#0:``!ZC$`#0T.`!H&@&AH``!IB&C30```!H9``! +MA(D0DTQ3T3$TVA-!IIZAA-'J:!H!H#0:#30:#30T;1*PHGAZ"/F;E""L"I6" +M8W&#'./D%S=_T4T96&+@94X&AL;:`Y+0C?:%=B#:8`:PP`2WF"20!EXL)6=] +M8=A)!0Q)($C&$U#8AI(&QL2!"10P4^8D$"0,8$I-.!3R8YWZ]Q1./IDR^VYN +MRJ&76*,$3PG?U(,=C;I20`D<&9/%5ILJIGI0(SWP3KRID6=#1MV*A>)(*B0$ +M$E:><!0D%K$G(WM("\:="00+`OCJ`Y0K(4B%(:1`#1-.%*`S0+)N`I4'MID+ +M$8MAN[,\.QJ`I=ZDA(5<O`KS[(+3L4-$,@&#*7!<`@AO7Y8*E9S#7L>B944( +MO-&.8&:1K;>[K$?O7R-FWA;%5+E]WBV<T&*%[O-6_,_/]:YC;<A-%^UFF09U +MP`*D@;&4KUHN&1:F_D1:YM:J-EG8L%<+BF4W%"6TU:I68MIJ6"FVH>T9PR7J +MNU2C2G2>5**"XH4HD`PF+(*DTT&47'A+)B";NS-UH>(]7G^\/G_343KU\17< +M<*""-SM"%>BVIJL8SF]7L-1.-LSRP2%=KX&C56*FC&#C$XNMGL)]3X&^$V4Z +MY`()G`%`KUR!HU8Z'"HWNE&P6MI:KZ<F%H/X3DN/F&%#`.%8#!HTK295C.#[ +M+^4C&90I^(::@`Y$=<OX=S3?,A#ZU'\'^+PYHV2PK?Q-,&8/Q$A3@$*X*=$A +MK;I2)&A^MSZ`*](@"[>^Q"H0L7.OV8ZJW409[QO=`&&D%=5&@RP`MO%R/J#Q +M-KJ*6D;EH7:DK0.48@8HF*IP(>*YMR$>!+A,)X+;`$94@@?U]B/=2T0CY-2= +M*_1FPF<-G\\@Z-_,Q>06='5:(B#3`W$8Y!:C-CE22SM9*S$00,XXJTIZ!GA( +LGTMN:F\J-,D9>?.38*!I7T>--*B_=T44HJ?#@``"1;7#_Q=R13A0D!M#:2D` +` +end diff --git a/archivers/libarchive/files/libarchive/test/test_read_format_mtree.c b/archivers/libarchive/files/libarchive/test/test_read_format_mtree.c index b2fdbb88349..954f0222ad1 100644 --- a/archivers/libarchive/files/libarchive/test/test_read_format_mtree.c +++ b/archivers/libarchive/files/libarchive/test/test_read_format_mtree.c @@ -23,7 +23,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" -__FBSDID("$FreeBSD: src/lib/libarchive/test/test_read_format_mtree.c,v 1.1 2008/01/01 22:28:04 kientzle Exp $"); +__FBSDID("$FreeBSD: src/lib/libarchive/test/test_read_format_mtree.c,v 1.2 2008/05/26 17:00:24 kientzle Exp $"); /* Single entry with a hardlink. */ static unsigned char archive[] = { diff --git a/archivers/libarchive/files/libarchive/test/test_read_format_zip.c b/archivers/libarchive/files/libarchive/test/test_read_format_zip.c index 9829217fc41..50e522bb4d5 100644 --- a/archivers/libarchive/files/libarchive/test/test_read_format_zip.c +++ b/archivers/libarchive/files/libarchive/test/test_read_format_zip.c @@ -25,26 +25,9 @@ #include "test.h" __FBSDID("$FreeBSD: src/lib/libarchive/test/test_read_format_zip.c,v 1.3 2008/01/01 22:28:04 kientzle Exp $"); -static unsigned char archive[] = { -'P','K',3,4,10,0,0,0,0,0,'Y','f',179,'6',0,0,0,0,0,0,0,0,0,0,0,0,4,0,21,0, -'d','i','r','/','U','T',9,0,3,25,'U','O','F',25,'U','O','F','U','x',4,0,232, -3,232,3,'P','K',3,4,20,0,0,0,8,0,'o','f',179,'6',':','7','f','=',10,0,0,0, -18,0,0,0,5,0,21,0,'f','i','l','e','1','U','T',9,0,3,'A','U','O','F',172,'[', -'O','F','U','x',4,0,232,3,232,3,203,'H',205,201,201,231,202,'@','"',1,'P', -'K',3,4,20,0,0,0,8,0,'Z','j',179,'6',':','7','f','=',10,0,0,0,18,0,0,0,5, -0,21,0,'f','i','l','e','2','U','T',9,0,3,172,'[','O','F',172,'[','O','F', -'U','x',4,0,232,3,232,3,203,'H',205,201,201,231,202,'@','"',1,'P','K',1,2, -23,3,10,0,0,0,0,0,'Y','f',179,'6',0,0,0,0,0,0,0,0,0,0,0,0,4,0,13,0,0,0,0, -0,0,0,16,0,237,'A',0,0,0,0,'d','i','r','/','U','T',5,0,3,25,'U','O','F','U', -'x',0,0,'P','K',1,2,23,3,20,0,0,0,8,0,'o','f',179,'6',':','7','f','=',10, -0,0,0,18,0,0,0,5,0,13,0,0,0,0,0,1,0,0,0,164,129,'7',0,0,0,'f','i','l','e', -'1','U','T',5,0,3,'A','U','O','F','U','x',0,0,'P','K',1,2,23,3,20,0,0,0,8, -0,'Z','j',179,'6',':','7','f','=',10,0,0,0,18,0,0,0,5,0,13,0,0,0,0,0,1,0, -0,0,164,129,'y',0,0,0,'f','i','l','e','2','U','T',5,0,3,172,'[','O','F','U', -'x',0,0,'P','K',5,6,0,0,0,0,3,0,3,0,191,0,0,0,187,0,0,0,0,0}; - DEFINE_TEST(test_read_format_zip) { + const char *refname = "test_read_format_zip.zip"; struct archive_entry *ae; struct archive *a; char *buff[128]; @@ -52,10 +35,11 @@ DEFINE_TEST(test_read_format_zip) size_t s; off_t o; + extract_reference_file(refname); assert((a = archive_read_new()) != NULL); assertA(0 == archive_read_support_compression_all(a)); assertA(0 == archive_read_support_format_all(a)); - assertA(0 == archive_read_open_memory(a, archive, sizeof(archive))); + assertA(0 == archive_read_open_filename(a, refname, 10240)); assertA(0 == archive_read_next_header(a, &ae)); assertEqualString("dir/", archive_entry_pathname(ae)); assertEqualInt(1179604249, archive_entry_mtime(ae)); diff --git a/archivers/libarchive/files/libarchive/test/test_read_format_zip.zip.uu b/archivers/libarchive/files/libarchive/test/test_read_format_zip.zip.uu new file mode 100644 index 00000000000..f61340e2f93 --- /dev/null +++ b/archivers/libarchive/files/libarchive/test/test_read_format_zip.zip.uu @@ -0,0 +1,13 @@ +$FreeBSD$ +begin 645 test_read_format_zip.zip +M4$L#!`H``````%EFLS8````````````````$`!4`9&ER+U54"0`#&55/1AE5 +M3T95>`0`Z`/H`U!+`P04````"`!O9K,V.C=F/0H````2````!0`5`&9I;&4Q +M550)``-!54]&K%M/1E5X!`#H`^@#RTC-R<GGRD`B`5!+`P04````"`!::K,V +M.C=F/0H````2````!0`5`&9I;&4R550)``.L6T]&K%M/1E5X!`#H`^@#RTC- +MR<GGRD`B`5!+`0(7`PH``````%EFLS8````````````````$``T````````` +M$`#M00````!D:7(O550%``,954]&57@``%!+`0(7`Q0````(`&]FLS8Z-V8] +M"@```!(````%``T```````$```"D@3<```!F:6QE,554!0`#055/1E5X``!0 +M2P$"%P,4````"`!::K,V.C=F/0H````2````!0`-```````!````I(%Y```` +H9FEL93)55`4``ZQ;3T95>```4$L%!@`````#``,`OP```+L````````` +` +end diff --git a/archivers/libarchive/files/libarchive/test/test_tar_filenames.c b/archivers/libarchive/files/libarchive/test/test_tar_filenames.c index 9b98448e4a7..e863fbd23cd 100644 --- a/archivers/libarchive/files/libarchive/test/test_tar_filenames.c +++ b/archivers/libarchive/files/libarchive/test/test_tar_filenames.c @@ -23,7 +23,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" -__FBSDID("$FreeBSD: src/lib/libarchive/test/test_tar_filenames.c,v 1.8 2008/01/01 22:28:04 kientzle Exp $"); +__FBSDID("$FreeBSD: src/lib/libarchive/test/test_tar_filenames.c,v 1.9 2008/05/26 17:00:24 kientzle Exp $"); /* * Exercise various lengths of filenames in tar archives, diff --git a/archivers/libarchive/files/libarchive/test/test_tar_large.c b/archivers/libarchive/files/libarchive/test/test_tar_large.c index a05b49f6ab5..df8a1399ad9 100644 --- a/archivers/libarchive/files/libarchive/test/test_tar_large.c +++ b/archivers/libarchive/files/libarchive/test/test_tar_large.c @@ -23,7 +23,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" -__FBSDID("$FreeBSD: src/lib/libarchive/test/test_tar_large.c,v 1.1 2008/01/01 22:28:04 kientzle Exp $"); +__FBSDID("$FreeBSD: src/lib/libarchive/test/test_tar_large.c,v 1.2 2008/05/26 17:00:24 kientzle Exp $"); #include <errno.h> #include <stdlib.h> diff --git a/archivers/libarchive/files/libarchive/test/test_write_disk.c b/archivers/libarchive/files/libarchive/test/test_write_disk.c index 480cf29b566..fe44a4538e2 100644 --- a/archivers/libarchive/files/libarchive/test/test_write_disk.c +++ b/archivers/libarchive/files/libarchive/test/test_write_disk.c @@ -23,7 +23,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" -__FBSDID("$FreeBSD: src/lib/libarchive/test/test_write_disk.c,v 1.8 2008/01/23 05:47:08 kientzle Exp $"); +__FBSDID("$FreeBSD: src/lib/libarchive/test/test_write_disk.c,v 1.9 2008/06/15 10:35:22 kientzle Exp $"); #if ARCHIVE_VERSION_STAMP >= 1009000 @@ -48,7 +48,11 @@ static void create(struct archive_entry *ae, const char *msg) assert(0 == stat(archive_entry_pathname(ae), &st)); failure("st.st_mode=%o archive_entry_mode(ae)=%o", st.st_mode, archive_entry_mode(ae)); - assert(st.st_mode == (archive_entry_mode(ae) & ~UMASK)); + /* When verifying a dir, ignore the S_ISGID bit, as some systems set + * that automatically. */ + if (archive_entry_filetype(ae) == AE_IFDIR) + st.st_mode &= ~S_ISGID; + assertEqualInt(st.st_mode, archive_entry_mode(ae) & ~UMASK); } static void create_reg_file(struct archive_entry *ae, const char *msg) diff --git a/archivers/libarchive/files/libarchive/test/test_write_disk_hardlink.c b/archivers/libarchive/files/libarchive/test/test_write_disk_hardlink.c index 0729c38a114..dda384a85a1 100644 --- a/archivers/libarchive/files/libarchive/test/test_write_disk_hardlink.c +++ b/archivers/libarchive/files/libarchive/test/test_write_disk_hardlink.c @@ -23,7 +23,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" -__FBSDID("$FreeBSD: src/lib/libarchive/test/test_write_disk_hardlink.c,v 1.1 2008/01/18 05:05:58 kientzle Exp $"); +__FBSDID("$FreeBSD: src/lib/libarchive/test/test_write_disk_hardlink.c,v 1.2 2008/05/26 17:00:24 kientzle Exp $"); #define UMASK 022 diff --git a/archivers/libarchive/files/libarchive/test/test_write_disk_perms.c b/archivers/libarchive/files/libarchive/test/test_write_disk_perms.c index 4c03c75b491..2e872a1e359 100644 --- a/archivers/libarchive/files/libarchive/test/test_write_disk_perms.c +++ b/archivers/libarchive/files/libarchive/test/test_write_disk_perms.c @@ -23,7 +23,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" -__FBSDID("$FreeBSD: src/lib/libarchive/test/test_write_disk_perms.c,v 1.8 2008/01/01 22:28:04 kientzle Exp $"); +__FBSDID("$FreeBSD: src/lib/libarchive/test/test_write_disk_perms.c,v 1.9 2008/06/15 10:35:22 kientzle Exp $"); #if ARCHIVE_VERSION_STAMP >= 1009000 @@ -186,7 +186,7 @@ DEFINE_TEST(test_write_disk_perms) /* Check original perms. */ assert(0 == stat("dir_overwrite_0744", &st)); failure("dir_overwrite_0744: st.st_mode=%o", st.st_mode); - assert((st.st_mode & 07777) == 0744); + assert((st.st_mode & 0777) == 0744); /* Overwrite shouldn't edit perms. */ assert((ae = archive_entry_new()) != NULL); archive_entry_copy_pathname(ae, "dir_overwrite_0744"); @@ -197,7 +197,7 @@ DEFINE_TEST(test_write_disk_perms) /* Make sure they're unchanged. */ assert(0 == stat("dir_overwrite_0744", &st)); failure("dir_overwrite_0744: st.st_mode=%o", st.st_mode); - assert((st.st_mode & 07777) == 0744); + assert((st.st_mode & 0777) == 0744); /* Write a regular file with SUID bit, but don't use _EXTRACT_PERM. */ assert((ae = archive_entry_new()) != NULL); @@ -385,7 +385,7 @@ DEFINE_TEST(test_write_disk_perms) assert(0 == stat("dir_overwrite_0744", &st)); failure("dir_overwrite_0744: st.st_mode=%o", st.st_mode); - assert((st.st_mode & 07777) == 0744); + assert((st.st_mode & 0777) == 0744); assert(0 == stat("file_no_suid", &st)); failure("file_0755: st.st_mode=%o", st.st_mode); diff --git a/archivers/libarchive/files/libarchive/test/test_write_disk_secure.c b/archivers/libarchive/files/libarchive/test/test_write_disk_secure.c index 80876b46c4c..2bcc95762c3 100644 --- a/archivers/libarchive/files/libarchive/test/test_write_disk_secure.c +++ b/archivers/libarchive/files/libarchive/test/test_write_disk_secure.c @@ -23,7 +23,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" -__FBSDID("$FreeBSD: src/lib/libarchive/test/test_write_disk_secure.c,v 1.3 2007/07/06 15:43:11 kientzle Exp $"); +__FBSDID("$FreeBSD: src/lib/libarchive/test/test_write_disk_secure.c,v 1.4 2008/06/15 10:35:22 kientzle Exp $"); #define UMASK 022 @@ -115,7 +115,7 @@ DEFINE_TEST(test_write_disk_secure) /* Test the entries on disk. */ assert(0 == lstat("dir", &st)); failure("dir: st.st_mode=%o", st.st_mode); - assert((st.st_mode & 07777) == 0755); + assert((st.st_mode & 0777) == 0755); assert(0 == lstat("link_to_dir", &st)); failure("link_to_dir: st.st_mode=%o", st.st_mode); @@ -137,7 +137,7 @@ DEFINE_TEST(test_write_disk_secure) failure("link_to_dir2 should have been re-created as a true dir"); assert(S_ISDIR(st.st_mode)); failure("link_to_dir2: Implicit dir creation should obey umask, but st.st_mode=%o", st.st_mode); - assert((st.st_mode & 07777) == 0755); + assert((st.st_mode & 0777) == 0755); assert(0 == lstat("link_to_dir2/filec", &st)); assert(S_ISREG(st.st_mode)); diff --git a/archivers/libarchive/files/libarchive/test/test_write_format_ar.c b/archivers/libarchive/files/libarchive/test/test_write_format_ar.c index 4bb84a6a615..a60a0cd8800 100644 --- a/archivers/libarchive/files/libarchive/test/test_write_format_ar.c +++ b/archivers/libarchive/files/libarchive/test/test_write_format_ar.c @@ -26,7 +26,7 @@ */ #include "test.h" -__FBSDID("$FreeBSD: src/lib/libarchive/test/test_write_format_ar.c,v 1.6 2008/03/12 21:10:26 kaiw Exp $"); +__FBSDID("$FreeBSD: src/lib/libarchive/test/test_write_format_ar.c,v 1.7 2008/05/26 17:00:24 kientzle Exp $"); char buff[4096]; char buff2[64]; diff --git a/archivers/libarchive/files/tar/bsdtar.1 b/archivers/libarchive/files/tar/bsdtar.1 index 542b0f3f509..e790d60ccb9 100644 --- a/archivers/libarchive/files/tar/bsdtar.1 +++ b/archivers/libarchive/files/tar/bsdtar.1 @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: src/usr.bin/tar/bsdtar.1,v 1.42 2008/05/17 15:55:29 cperciva Exp $ +.\" $FreeBSD: src/usr.bin/tar/bsdtar.1,v 1.43 2008/05/26 17:10:10 kientzle Exp $ .\" .Dd May 15, 2008 .Dt BSDTAR 1 diff --git a/archivers/libarchive/files/tar/bsdtar.c b/archivers/libarchive/files/tar/bsdtar.c index 2491dda6bca..1c13cc6bfbe 100644 --- a/archivers/libarchive/files/tar/bsdtar.c +++ b/archivers/libarchive/files/tar/bsdtar.c @@ -24,7 +24,7 @@ */ #include "bsdtar_platform.h" -__FBSDID("$FreeBSD: src/usr.bin/tar/bsdtar.c,v 1.90 2008/05/19 18:38:01 cperciva Exp $"); +__FBSDID("$FreeBSD: src/usr.bin/tar/bsdtar.c,v 1.91 2008/05/26 17:10:10 kientzle Exp $"); #ifdef HAVE_SYS_PARAM_H #include <sys/param.h> diff --git a/archivers/libarchive/files/tar/bsdtar.h b/archivers/libarchive/files/tar/bsdtar.h index 9d4733c5045..4153a44f946 100644 --- a/archivers/libarchive/files/tar/bsdtar.h +++ b/archivers/libarchive/files/tar/bsdtar.h @@ -22,7 +22,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: src/usr.bin/tar/bsdtar.h,v 1.32 2008/05/22 21:08:36 cperciva Exp $ + * $FreeBSD: src/usr.bin/tar/bsdtar.h,v 1.33 2008/05/26 17:10:10 kientzle Exp $ */ #include "bsdtar_platform.h" diff --git a/archivers/libarchive/files/tar/matching.c b/archivers/libarchive/files/tar/matching.c index 59be17b9a3a..952055fe8a2 100644 --- a/archivers/libarchive/files/tar/matching.c +++ b/archivers/libarchive/files/tar/matching.c @@ -24,7 +24,7 @@ */ #include "bsdtar_platform.h" -__FBSDID("$FreeBSD: src/usr.bin/tar/matching.c,v 1.12 2008/03/18 06:18:49 kientzle Exp $"); +__FBSDID("$FreeBSD: src/usr.bin/tar/matching.c,v 1.13 2008/05/26 17:10:10 kientzle Exp $"); #ifdef HAVE_ERRNO_H #include <errno.h> diff --git a/archivers/libarchive/files/tar/read.c b/archivers/libarchive/files/tar/read.c index e1905b24867..fbb82533a72 100644 --- a/archivers/libarchive/files/tar/read.c +++ b/archivers/libarchive/files/tar/read.c @@ -24,7 +24,7 @@ */ #include "bsdtar_platform.h" -__FBSDID("$FreeBSD: src/usr.bin/tar/read.c,v 1.37 2008/05/18 06:24:47 cperciva Exp $"); +__FBSDID("$FreeBSD: src/usr.bin/tar/read.c,v 1.38 2008/05/26 17:10:10 kientzle Exp $"); #ifdef HAVE_SYS_TYPES_H #include <sys/types.h> @@ -388,7 +388,7 @@ list_item_verbose(struct bsdtar *bsdtar, FILE *out, struct archive_entry *entry) if (abs(tim - now) > (365/2)*86400) fmt = bsdtar->day_first ? "%e %b %Y" : "%b %e %Y"; else - fmt = bsdtar->day_first ? "%e %b %R" : "%b %e %R"; + fmt = bsdtar->day_first ? "%e %b %H:%M" : "%b %e %H:%M"; strftime(tmp, sizeof(tmp), fmt, localtime(&tim)); fprintf(out, " %s ", tmp); safe_fprintf(out, "%s", archive_entry_pathname(entry)); diff --git a/archivers/libarchive/files/tar/subst.c b/archivers/libarchive/files/tar/subst.c index 4543b6f7526..1c32fb0752b 100644 --- a/archivers/libarchive/files/tar/subst.c +++ b/archivers/libarchive/files/tar/subst.c @@ -24,7 +24,7 @@ */ #include "bsdtar_platform.h" -__FBSDID("$FreeBSD$"); +__FBSDID("$FreeBSD: src/usr.bin/tar/subst.c,v 1.4 2008/06/15 10:08:16 kientzle Exp $"); #if HAVE_REGEX_H #include "bsdtar.h" @@ -42,7 +42,7 @@ struct subst_rule { struct subst_rule *next; regex_t re; char *result; - int global:1, print:1, symlink:1; + unsigned int global:1, print:1, symlink:1; }; struct substitution { diff --git a/archivers/libarchive/files/tar/test/main.c b/archivers/libarchive/files/tar/test/main.c index 3856f3a3c79..27bb48d4094 100644 --- a/archivers/libarchive/files/tar/test/main.c +++ b/archivers/libarchive/files/tar/test/main.c @@ -27,13 +27,13 @@ * Various utility routines useful for test programs. * Each test program is linked against this file. */ +#include "test.h" + #include <errno.h> #include <locale.h> #include <stdarg.h> #include <time.h> -#include "test.h" - /* * This same file is used pretty much verbatim for all test harnesses. * @@ -44,7 +44,7 @@ #undef EXTRA_DUMP /* How to dump extra data */ /* How to generate extra version info. */ #define EXTRA_VERSION (systemf("%s --version", testprog) ? "" : "") -__FBSDID("$FreeBSD$"); +__FBSDID("$FreeBSD: src/usr.bin/tar/test/main.c,v 1.3 2008/06/15 10:07:54 kientzle Exp $"); /* * "list.h" is simply created by "grep DEFINE_TEST"; it has @@ -712,8 +712,11 @@ static int test_run(int i, const char *tmpdir) { int failures_before = failures; - if (!quiet_flag) + if (!quiet_flag) { printf("%d: %s\n", i, tests[i].name); + fflush(stdout); + } + /* * Always explicitly chdir() in case the last test moved us to * a strange place. diff --git a/archivers/libarchive/files/tar/test/test.h b/archivers/libarchive/files/tar/test/test.h index 416f0dd62e7..30321e845d6 100644 --- a/archivers/libarchive/files/tar/test/test.h +++ b/archivers/libarchive/files/tar/test/test.h @@ -22,7 +22,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD$ + * $FreeBSD: src/usr.bin/tar/test/test.h,v 1.3 2008/06/15 10:07:54 kientzle Exp $ */ /* Every test program should #include "test.h" as the first thing. */ @@ -31,8 +31,18 @@ * The goal of this file (and the matching test.c) is to * simplify the very repetitive test-*.c test programs. */ -#ifndef _FILE_OFFSET_BITS -#define _FILE_OFFSET_BITS 64 +#if defined(HAVE_CONFIG_H) +/* Most POSIX platforms use the 'configure' script to build config.h */ +#include "../../config.h" +#elif defined(__FreeBSD__) +/* Building as part of FreeBSD system requires a pre-built config.h. */ +#include "../config_freebsd.h" +#elif defined(_WIN32) +/* Win32 can't run the 'configure' script. */ +#include "../config_windows.h" +#else +/* Warn if the library hasn't been (automatically or manually) configured. */ +#error Oops: No config.h and no pre-built configuration in test.h. #endif #include <dirent.h> @@ -51,20 +61,6 @@ #include <dmalloc.h> #endif -#if defined(HAVE_CONFIG_H) -/* Most POSIX platforms use the 'configure' script to build config.h */ -#include "../../config.h" -#elif defined(__FreeBSD__) -/* Building as part of FreeBSD system requires a pre-built config.h. */ -#include "../config_freebsd.h" -#elif defined(_WIN32) -/* Win32 can't run the 'configure' script. */ -#include "../config_windows.h" -#else -/* Warn if the library hasn't been (automatically or manually) configured. */ -#error Oops: No config.h and no pre-built configuration in test.h. -#endif - /* No non-FreeBSD platform will have __FBSDID, so just define it here. */ #ifdef __FreeBSD__ #include <sys/cdefs.h> /* For __FBSDID */ @@ -108,6 +104,9 @@ /* Assert that a file exists; supports printf-style arguments. */ #define assertFileNotExists \ test_setup(__FILE__, __LINE__);test_assert_file_not_exists +/* Assert that file contents match a string; supports printf-style arguments. */ +#define assertFileContents \ + test_setup(__FILE__, __LINE__);test_assert_file_contents /* * This would be simple with C99 variadic macros, but I don't want to diff --git a/archivers/libarchive/files/tar/test/test_0.c b/archivers/libarchive/files/tar/test/test_0.c index 7a72af1c8ed..36c8b1ebe1f 100644 --- a/archivers/libarchive/files/tar/test/test_0.c +++ b/archivers/libarchive/files/tar/test/test_0.c @@ -23,7 +23,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" -__FBSDID("$FreeBSD$"); +__FBSDID("$FreeBSD: src/usr.bin/tar/test/test_0.c,v 1.2 2008/05/26 17:10:10 kientzle Exp $"); /* * This first test does basic sanity checks on the environment. For diff --git a/archivers/libarchive/files/tar/test/test_basic.c b/archivers/libarchive/files/tar/test/test_basic.c index 50be2890c0e..fff51123019 100644 --- a/archivers/libarchive/files/tar/test/test_basic.c +++ b/archivers/libarchive/files/tar/test/test_basic.c @@ -23,7 +23,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" -__FBSDID("$FreeBSD$"); +__FBSDID("$FreeBSD: src/usr.bin/tar/test/test_basic.c,v 1.2 2008/05/26 17:10:10 kientzle Exp $"); static void diff --git a/archivers/libarchive/files/tar/test/test_copy.c b/archivers/libarchive/files/tar/test/test_copy.c index 52b9b786673..b2eef8cf791 100644 --- a/archivers/libarchive/files/tar/test/test_copy.c +++ b/archivers/libarchive/files/tar/test/test_copy.c @@ -23,7 +23,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" -__FBSDID("$FreeBSD$"); +__FBSDID("$FreeBSD: src/usr.bin/tar/test/test_copy.c,v 1.2 2008/05/26 17:10:10 kientzle Exp $"); static void create_tree(void) diff --git a/archivers/libarchive/files/tar/test/test_getdate.c b/archivers/libarchive/files/tar/test/test_getdate.c index 7ed447b9c26..d75119cc33a 100644 --- a/archivers/libarchive/files/tar/test/test_getdate.c +++ b/archivers/libarchive/files/tar/test/test_getdate.c @@ -23,7 +23,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" -__FBSDID("$FreeBSD$"); +__FBSDID("$FreeBSD: src/usr.bin/tar/test/test_getdate.c,v 1.2 2008/05/26 17:10:10 kientzle Exp $"); /* * Verify that the getdate() function works. diff --git a/archivers/libarchive/files/tar/test/test_help.c b/archivers/libarchive/files/tar/test/test_help.c index c547dbc4799..163e2127f26 100644 --- a/archivers/libarchive/files/tar/test/test_help.c +++ b/archivers/libarchive/files/tar/test/test_help.c @@ -23,7 +23,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" -__FBSDID("$FreeBSD$"); +__FBSDID("$FreeBSD: src/usr.bin/tar/test/test_help.c,v 1.2 2008/05/26 17:10:10 kientzle Exp $"); /* * Test that "--help", "-h", and "-W help" options all work and diff --git a/archivers/libarchive/files/tar/test/test_option_T.c b/archivers/libarchive/files/tar/test/test_option_T.c index eec40bb4587..6c9007b24a9 100644 --- a/archivers/libarchive/files/tar/test/test_option_T.c +++ b/archivers/libarchive/files/tar/test/test_option_T.c @@ -23,7 +23,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" -__FBSDID("$FreeBSD$"); +__FBSDID("$FreeBSD: src/usr.bin/tar/test/test_option_T.c,v 1.2 2008/05/26 17:10:10 kientzle Exp $"); static int touch(const char *fn) diff --git a/archivers/libarchive/files/tar/test/test_stdio.c b/archivers/libarchive/files/tar/test/test_stdio.c index 2d24ae35032..d770cf11f40 100644 --- a/archivers/libarchive/files/tar/test/test_stdio.c +++ b/archivers/libarchive/files/tar/test/test_stdio.c @@ -23,7 +23,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" -__FBSDID("$FreeBSD$"); +__FBSDID("$FreeBSD: src/usr.bin/tar/test/test_stdio.c,v 1.2 2008/05/26 17:10:10 kientzle Exp $"); DEFINE_TEST(test_stdio) { diff --git a/archivers/libarchive/files/tar/test/test_version.c b/archivers/libarchive/files/tar/test/test_version.c index 6f2f6a0b5a0..6ed656d8024 100644 --- a/archivers/libarchive/files/tar/test/test_version.c +++ b/archivers/libarchive/files/tar/test/test_version.c @@ -23,7 +23,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" -__FBSDID("$FreeBSD$"); +__FBSDID("$FreeBSD: src/usr.bin/tar/test/test_version.c,v 1.2 2008/05/26 17:10:10 kientzle Exp $"); /* * Test that --version option works and generates reasonable output. diff --git a/archivers/libarchive/files/tar/util.c b/archivers/libarchive/files/tar/util.c index 1d50dcd8010..ee1e40dbf2d 100644 --- a/archivers/libarchive/files/tar/util.c +++ b/archivers/libarchive/files/tar/util.c @@ -24,7 +24,7 @@ */ #include "bsdtar_platform.h" -__FBSDID("$FreeBSD: src/usr.bin/tar/util.c,v 1.18 2008/01/02 00:21:27 kientzle Exp $"); +__FBSDID("$FreeBSD: src/usr.bin/tar/util.c,v 1.20 2008/06/09 14:03:55 cperciva Exp $"); #ifdef HAVE_SYS_STAT_H #include <sys/stat.h> @@ -369,9 +369,11 @@ edit_pathname(struct bsdtar *bsdtar, struct archive_entry *entry) } if (r == 1) { archive_entry_copy_pathname(entry, subst_name); - free(subst_name); - if (*subst_name == '\0') + if (*subst_name == '\0') { + free(subst_name); return -1; + } else + free(subst_name); name = archive_entry_pathname(entry); } diff --git a/archivers/libarchive/files/tar/write.c b/archivers/libarchive/files/tar/write.c index 432612ac7a0..1a6e9289abe 100644 --- a/archivers/libarchive/files/tar/write.c +++ b/archivers/libarchive/files/tar/write.c @@ -24,7 +24,7 @@ */ #include "bsdtar_platform.h" -__FBSDID("$FreeBSD: src/usr.bin/tar/write.c,v 1.69 2008/05/23 05:07:22 cperciva Exp $"); +__FBSDID("$FreeBSD: src/usr.bin/tar/write.c,v 1.70 2008/05/26 17:10:10 kientzle Exp $"); #ifdef HAVE_SYS_TYPES_H #include <sys/types.h> @@ -62,9 +62,6 @@ __FBSDID("$FreeBSD: src/usr.bin/tar/write.c,v 1.69 2008/05/23 05:07:22 cperciva #ifdef HAVE_LINUX_FS_H #include <linux/fs.h> /* for Linux file flags */ #endif -#ifdef HAVE_LINUX_EXT2_FS_H -#include <linux/ext2_fs.h> /* for Linux file flags */ -#endif #ifdef HAVE_PWD_H #include <pwd.h> #endif diff --git a/archivers/libarchive/files/version b/archivers/libarchive/files/version index bd20368be50..b50fb110a51 100644 --- a/archivers/libarchive/files/version +++ b/archivers/libarchive/files/version @@ -1 +1 @@ -2005004b +2005005 |