svn commit: r305014 - in projects/netbsd-tests-update-12: cddl/lib/libdtrace cddl/usr.sbin/zfsd contrib/ipfilter contrib/libarchive/libarchive contrib/libarchive/tar contrib/ncurses/ncurses/tinfo c...
Ngie Cooper
ngie at FreeBSD.org
Mon Aug 29 18:53:41 UTC 2016
Author: ngie
Date: Mon Aug 29 18:53:36 2016
New Revision: 305014
URL: https://svnweb.freebsd.org/changeset/base/305014
Log:
MFhead @ r305013
Added:
projects/netbsd-tests-update-12/lib/libc/sys/ptrace.c
- copied unchanged from r305013, head/lib/libc/sys/ptrace.c
projects/netbsd-tests-update-12/lib/libnv/tests/cnv_tests.cc
- copied unchanged from r305013, head/lib/libnv/tests/cnv_tests.cc
projects/netbsd-tests-update-12/share/man/man9/cnv.9
- copied unchanged from r305013, head/share/man/man9/cnv.9
projects/netbsd-tests-update-12/sys/contrib/libnv/cnvlist.c
- copied unchanged from r305013, head/sys/contrib/libnv/cnvlist.c
projects/netbsd-tests-update-12/sys/dev/bhnd/cores/chipc/bhnd_pmu_chipc.c
- copied unchanged from r305013, head/sys/dev/bhnd/cores/chipc/bhnd_pmu_chipc.c
projects/netbsd-tests-update-12/sys/dev/bhnd/cores/chipc/pwrctl/
- copied from r305013, head/sys/dev/bhnd/cores/chipc/pwrctl/
projects/netbsd-tests-update-12/sys/dev/bhnd/cores/pmu/
- copied from r305013, head/sys/dev/bhnd/cores/pmu/
projects/netbsd-tests-update-12/sys/dev/bhnd/pmu/
- copied from r305013, head/sys/dev/bhnd/pmu/
projects/netbsd-tests-update-12/sys/dev/hyperv/netvsc/ndis.h
- copied unchanged from r305013, head/sys/dev/hyperv/netvsc/ndis.h
projects/netbsd-tests-update-12/sys/mips/broadcom/bcm_bcma.c
- copied unchanged from r305013, head/sys/mips/broadcom/bcm_bcma.c
projects/netbsd-tests-update-12/sys/mips/broadcom/bcm_machdep.h
- copied unchanged from r305013, head/sys/mips/broadcom/bcm_machdep.h
projects/netbsd-tests-update-12/sys/mips/broadcom/bcm_mips_exts.h
- copied unchanged from r305013, head/sys/mips/broadcom/bcm_mips_exts.h
projects/netbsd-tests-update-12/sys/mips/broadcom/bcm_pmu.c
- copied unchanged from r305013, head/sys/mips/broadcom/bcm_pmu.c
projects/netbsd-tests-update-12/sys/mips/broadcom/bcm_siba.c
- copied unchanged from r305013, head/sys/mips/broadcom/bcm_siba.c
projects/netbsd-tests-update-12/sys/mips/conf/std.AR91XX
- copied unchanged from r305013, head/sys/mips/conf/std.AR91XX
projects/netbsd-tests-update-12/sys/mips/conf/std.QCA955X
- copied unchanged from r305013, head/sys/mips/conf/std.QCA955X
projects/netbsd-tests-update-12/sys/sys/cnv.h
- copied unchanged from r305013, head/sys/sys/cnv.h
Deleted:
projects/netbsd-tests-update-12/lib/libc/amd64/sys/ptrace.S
projects/netbsd-tests-update-12/lib/libc/arm/sys/ptrace.S
projects/netbsd-tests-update-12/lib/libc/i386/sys/ptrace.S
projects/netbsd-tests-update-12/lib/libc/mips/sys/ptrace.S
projects/netbsd-tests-update-12/lib/libc/powerpc/sys/ptrace.S
projects/netbsd-tests-update-12/lib/libc/powerpc64/sys/ptrace.S
projects/netbsd-tests-update-12/lib/libc/sparc64/sys/ptrace.S
projects/netbsd-tests-update-12/sys/mips/broadcom/bcm_socinfo.c
projects/netbsd-tests-update-12/sys/mips/broadcom/bcm_socinfo.h
projects/netbsd-tests-update-12/sys/mips/conf/AR91XX_BASE
projects/netbsd-tests-update-12/sys/mips/conf/QCA955X_BASE
projects/netbsd-tests-update-12/sys/modules/bhnd/cores/bhnd_chipc/
Modified:
projects/netbsd-tests-update-12/cddl/lib/libdtrace/psinfo.d
projects/netbsd-tests-update-12/cddl/usr.sbin/zfsd/vdev.h
projects/netbsd-tests-update-12/contrib/ipfilter/opts.h
projects/netbsd-tests-update-12/contrib/libarchive/libarchive/archive_read_support_format_tar.c
projects/netbsd-tests-update-12/contrib/libarchive/libarchive/archive_read_support_format_zip.c
projects/netbsd-tests-update-12/contrib/libarchive/libarchive/archive_write_disk_acl.c
projects/netbsd-tests-update-12/contrib/libarchive/libarchive/archive_write_disk_posix.c
projects/netbsd-tests-update-12/contrib/libarchive/tar/util.c
projects/netbsd-tests-update-12/contrib/ncurses/ncurses/tinfo/lib_baudrate.c
projects/netbsd-tests-update-12/contrib/netbsd-tests/usr.bin/dirname/t_dirname.sh
projects/netbsd-tests-update-12/contrib/ofed/libcxgb4/src/qp.c
projects/netbsd-tests-update-12/include/libgen.h
projects/netbsd-tests-update-12/lib/libarchive/tests/Makefile
projects/netbsd-tests-update-12/lib/libc/amd64/sys/Makefile.inc
projects/netbsd-tests-update-12/lib/libc/arm/sys/Makefile.inc
projects/netbsd-tests-update-12/lib/libc/gen/dirname.c
projects/netbsd-tests-update-12/lib/libc/i386/sys/Makefile.inc
projects/netbsd-tests-update-12/lib/libc/include/libc_private.h
projects/netbsd-tests-update-12/lib/libc/mips/sys/Makefile.inc
projects/netbsd-tests-update-12/lib/libc/net/getaddrinfo.c
projects/netbsd-tests-update-12/lib/libc/powerpc/sys/Makefile.inc
projects/netbsd-tests-update-12/lib/libc/powerpc64/sys/Makefile.inc
projects/netbsd-tests-update-12/lib/libc/sparc64/sys/Makefile.inc
projects/netbsd-tests-update-12/lib/libc/stdio/fgetln.c
projects/netbsd-tests-update-12/lib/libc/stdio/fgetwln.c
projects/netbsd-tests-update-12/lib/libc/sys/Makefile.inc
projects/netbsd-tests-update-12/lib/libc/sys/ptrace.2
projects/netbsd-tests-update-12/lib/libnv/Makefile
projects/netbsd-tests-update-12/lib/libnv/tests/Makefile
projects/netbsd-tests-update-12/lib/libstand/dosfs.c
projects/netbsd-tests-update-12/libexec/rtld-elf/mips/reloc.c
projects/netbsd-tests-update-12/release/doc/en_US.ISO8859-1/relnotes/article.xml
projects/netbsd-tests-update-12/sbin/hastd/lzf.h
projects/netbsd-tests-update-12/share/man/man9/Makefile
projects/netbsd-tests-update-12/share/mk/bsd.dep.mk
projects/netbsd-tests-update-12/share/mk/bsd.obj.mk
projects/netbsd-tests-update-12/share/mk/bsd.sys.mk
projects/netbsd-tests-update-12/share/mk/src.sys.env.mk
projects/netbsd-tests-update-12/sys/amd64/amd64/pmap.c
projects/netbsd-tests-update-12/sys/amd64/amd64/support.S
projects/netbsd-tests-update-12/sys/amd64/include/md_var.h
projects/netbsd-tests-update-12/sys/amd64/vmm/io/iommu.c
projects/netbsd-tests-update-12/sys/amd64/vmm/io/iommu.h
projects/netbsd-tests-update-12/sys/amd64/vmm/vmm.c
projects/netbsd-tests-update-12/sys/arm64/arm64/machdep.c
projects/netbsd-tests-update-12/sys/boot/i386/libi386/biosdisk.c
projects/netbsd-tests-update-12/sys/cam/ata/ata_all.c
projects/netbsd-tests-update-12/sys/conf/files
projects/netbsd-tests-update-12/sys/contrib/dev/ath/ath_hal/ar9300/ar9300phy.h
projects/netbsd-tests-update-12/sys/contrib/ipfilter/netinet/ip_compat.h
projects/netbsd-tests-update-12/sys/contrib/ipfilter/netinet/ip_fil.h
projects/netbsd-tests-update-12/sys/contrib/ipfilter/netinet/ip_log.c
projects/netbsd-tests-update-12/sys/contrib/ipfilter/netinet/ip_nat.h
projects/netbsd-tests-update-12/sys/contrib/ipfilter/netinet/ip_proxy.h
projects/netbsd-tests-update-12/sys/contrib/libnv/nvlist.c
projects/netbsd-tests-update-12/sys/contrib/libnv/nvlist_impl.h
projects/netbsd-tests-update-12/sys/ddb/db_command.c
projects/netbsd-tests-update-12/sys/ddb/db_expr.c
projects/netbsd-tests-update-12/sys/dev/bhnd/bcma/bcma.c
projects/netbsd-tests-update-12/sys/dev/bhnd/bcma/bcma_bhndb.c
projects/netbsd-tests-update-12/sys/dev/bhnd/bcma/bcma_dmp.h
projects/netbsd-tests-update-12/sys/dev/bhnd/bcma/bcma_erom.c
projects/netbsd-tests-update-12/sys/dev/bhnd/bcma/bcma_eromvar.h
projects/netbsd-tests-update-12/sys/dev/bhnd/bcma/bcma_nexus.c
projects/netbsd-tests-update-12/sys/dev/bhnd/bhnd.c
projects/netbsd-tests-update-12/sys/dev/bhnd/bhnd.h
projects/netbsd-tests-update-12/sys/dev/bhnd/bhnd_bus_if.m
projects/netbsd-tests-update-12/sys/dev/bhnd/bhnd_core.h
projects/netbsd-tests-update-12/sys/dev/bhnd/bhnd_ids.h
projects/netbsd-tests-update-12/sys/dev/bhnd/bhnd_subr.c
projects/netbsd-tests-update-12/sys/dev/bhnd/bhnd_types.h
projects/netbsd-tests-update-12/sys/dev/bhnd/bhndb/bhnd_bhndb.c
projects/netbsd-tests-update-12/sys/dev/bhnd/bhndb/bhndb.c
projects/netbsd-tests-update-12/sys/dev/bhnd/bhndb/bhndb_pci.c
projects/netbsd-tests-update-12/sys/dev/bhnd/bhndvar.h
projects/netbsd-tests-update-12/sys/dev/bhnd/cores/chipc/bhnd_chipc_if.m
projects/netbsd-tests-update-12/sys/dev/bhnd/cores/chipc/bhnd_sprom_chipc.c
projects/netbsd-tests-update-12/sys/dev/bhnd/cores/chipc/chipc.c
projects/netbsd-tests-update-12/sys/dev/bhnd/cores/chipc/chipc.h
projects/netbsd-tests-update-12/sys/dev/bhnd/cores/chipc/chipc_subr.c
projects/netbsd-tests-update-12/sys/dev/bhnd/cores/chipc/chipcreg.h
projects/netbsd-tests-update-12/sys/dev/bhnd/cores/chipc/chipcvar.h
projects/netbsd-tests-update-12/sys/dev/bhnd/nvram/nvram_map
projects/netbsd-tests-update-12/sys/dev/bhnd/siba/siba.c
projects/netbsd-tests-update-12/sys/dev/bhnd/siba/siba_bhndb.c
projects/netbsd-tests-update-12/sys/dev/bhnd/siba/siba_nexus.c
projects/netbsd-tests-update-12/sys/dev/cxgbe/adapter.h
projects/netbsd-tests-update-12/sys/dev/cxgbe/common/common.h
projects/netbsd-tests-update-12/sys/dev/cxgbe/common/t4_hw.c
projects/netbsd-tests-update-12/sys/dev/cxgbe/cxgbei/cxgbei.c
projects/netbsd-tests-update-12/sys/dev/cxgbe/cxgbei/cxgbei.h
projects/netbsd-tests-update-12/sys/dev/cxgbe/cxgbei/icl_cxgbei.c
projects/netbsd-tests-update-12/sys/dev/cxgbe/firmware/t4fw_interface.h
projects/netbsd-tests-update-12/sys/dev/cxgbe/iw_cxgbe/cm.c
projects/netbsd-tests-update-12/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h
projects/netbsd-tests-update-12/sys/dev/cxgbe/iw_cxgbe/qp.c
projects/netbsd-tests-update-12/sys/dev/cxgbe/iw_cxgbe/t4.h
projects/netbsd-tests-update-12/sys/dev/cxgbe/t4_main.c
projects/netbsd-tests-update-12/sys/dev/hyperv/netvsc/hv_net_vsc.c
projects/netbsd-tests-update-12/sys/dev/hyperv/netvsc/hv_net_vsc.h
projects/netbsd-tests-update-12/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
projects/netbsd-tests-update-12/sys/dev/hyperv/netvsc/hv_rndis.h
projects/netbsd-tests-update-12/sys/dev/hyperv/netvsc/hv_rndis_filter.c
projects/netbsd-tests-update-12/sys/dev/iwm/if_iwm.c
projects/netbsd-tests-update-12/sys/dev/iwm/if_iwmreg.h
projects/netbsd-tests-update-12/sys/dev/mfi/mfi.c
projects/netbsd-tests-update-12/sys/dev/ofw/ofw_bus_subr.c
projects/netbsd-tests-update-12/sys/dev/ofw/ofw_bus_subr.h
projects/netbsd-tests-update-12/sys/dev/syscons/syscons.c
projects/netbsd-tests-update-12/sys/dev/uart/uart_core.c
projects/netbsd-tests-update-12/sys/dev/uart/uart_cpu_powerpc.c
projects/netbsd-tests-update-12/sys/i386/i386/machdep.c
projects/netbsd-tests-update-12/sys/i386/i386/pmap.c
projects/netbsd-tests-update-12/sys/i386/i386/support.s
projects/netbsd-tests-update-12/sys/kern/vfs_lookup.c
projects/netbsd-tests-update-12/sys/kern/vnode_if.src
projects/netbsd-tests-update-12/sys/mips/broadcom/bcm_machdep.c
projects/netbsd-tests-update-12/sys/mips/broadcom/files.broadcom
projects/netbsd-tests-update-12/sys/mips/broadcom/uart_bus_chipc.c
projects/netbsd-tests-update-12/sys/mips/broadcom/uart_cpu_chipc.c
projects/netbsd-tests-update-12/sys/mips/conf/AP135
projects/netbsd-tests-update-12/sys/mips/conf/CARAMBOLA2
projects/netbsd-tests-update-12/sys/mips/conf/DIR-655A1
projects/netbsd-tests-update-12/sys/mips/conf/TL-ARCHERC7V2
projects/netbsd-tests-update-12/sys/mips/conf/TL-WDR4300
projects/netbsd-tests-update-12/sys/mips/conf/TL-WR1043NDv2
projects/netbsd-tests-update-12/sys/mips/conf/TP-WN1043ND
projects/netbsd-tests-update-12/sys/mips/conf/std.AR933X
projects/netbsd-tests-update-12/sys/mips/conf/std.AR934X
projects/netbsd-tests-update-12/sys/modules/bhnd/Makefile
projects/netbsd-tests-update-12/sys/modules/bhnd/cores/Makefile
projects/netbsd-tests-update-12/sys/modules/cloudabi32/Makefile
projects/netbsd-tests-update-12/sys/modules/cloudabi64/Makefile
projects/netbsd-tests-update-12/sys/net/rndis.h
projects/netbsd-tests-update-12/sys/netinet/sctp_input.c
projects/netbsd-tests-update-12/sys/netinet/tcp_fsm.h
projects/netbsd-tests-update-12/sys/netinet/tcp_stacks/fastpath.c
projects/netbsd-tests-update-12/sys/ofed/drivers/infiniband/core/iwcm.c
projects/netbsd-tests-update-12/sys/powerpc/powerpc/machdep.c
projects/netbsd-tests-update-12/tools/tools/net80211/wlanwds/wlanwds.c
projects/netbsd-tests-update-12/usr.bin/bsdiff/bspatch/bspatch.c
projects/netbsd-tests-update-12/usr.bin/gzip/gzip.c
projects/netbsd-tests-update-12/usr.bin/netstat/route.c
projects/netbsd-tests-update-12/usr.sbin/newsyslog/tests/legacy_test.sh
Directory Properties:
projects/netbsd-tests-update-12/ (props changed)
projects/netbsd-tests-update-12/cddl/ (props changed)
projects/netbsd-tests-update-12/contrib/ipfilter/ (props changed)
projects/netbsd-tests-update-12/contrib/libarchive/ (props changed)
projects/netbsd-tests-update-12/contrib/libarchive/libarchive/ (props changed)
projects/netbsd-tests-update-12/contrib/libarchive/tar/ (props changed)
projects/netbsd-tests-update-12/contrib/ncurses/ (props changed)
projects/netbsd-tests-update-12/contrib/netbsd-tests/ (props changed)
projects/netbsd-tests-update-12/sys/contrib/ipfilter/ (props changed)
Modified: projects/netbsd-tests-update-12/cddl/lib/libdtrace/psinfo.d
==============================================================================
--- projects/netbsd-tests-update-12/cddl/lib/libdtrace/psinfo.d Mon Aug 29 18:51:49 2016 (r305013)
+++ projects/netbsd-tests-update-12/cddl/lib/libdtrace/psinfo.d Mon Aug 29 18:53:36 2016 (r305014)
@@ -59,7 +59,7 @@ translator psinfo_t < struct proc *T > {
pr_gid = T->p_ucred->cr_rgid;
pr_egid = T->p_ucred->cr_groups[0];
pr_addr = 0;
- pr_psargs = (T->p_args->ar_args == 0) ? "" :
+ pr_psargs = (T->p_args == 0) ? "" :
memstr(T->p_args->ar_args, ' ', T->p_args->ar_length);
pr_arglen = T->p_args->ar_length;
pr_jailid = T->p_ucred->cr_prison->pr_id;
Modified: projects/netbsd-tests-update-12/cddl/usr.sbin/zfsd/vdev.h
==============================================================================
--- projects/netbsd-tests-update-12/cddl/usr.sbin/zfsd/vdev.h Mon Aug 29 18:51:49 2016 (r305013)
+++ projects/netbsd-tests-update-12/cddl/usr.sbin/zfsd/vdev.h Mon Aug 29 18:53:36 2016 (r305014)
@@ -108,6 +108,12 @@ public:
* \brief No-op copy constructor for nonexistent vdevs.
*/
Vdev();
+
+ /**
+ * \brief No-op virtual destructor, since this class has virtual
+ * functions.
+ */
+ virtual ~Vdev();
bool DoesNotExist() const;
/**
@@ -145,6 +151,10 @@ private:
extern Vdev NonexistentVdev;
//- Vdev Inline Public Methods ------------------------------------------------
+inline Vdev::~Vdev()
+{
+}
+
inline DevdCtl::Guid
Vdev::PoolGUID() const
{
Modified: projects/netbsd-tests-update-12/contrib/ipfilter/opts.h
==============================================================================
--- projects/netbsd-tests-update-12/contrib/ipfilter/opts.h Mon Aug 29 18:51:49 2016 (r305013)
+++ projects/netbsd-tests-update-12/contrib/ipfilter/opts.h Mon Aug 29 18:53:36 2016 (r305014)
@@ -12,7 +12,11 @@
#define __OPTS_H__
#ifndef SOLARIS
-#define SOLARIS (defined(sun) && (defined(__svr4__) || defined(__SVR4)))
+# if defined(sun) && (defined(__svr4__) || defined(__SVR4))
+# define SOLARIS 1
+# else
+# define SOLARIS 0
+# endif
#endif
#define OPT_REMOVE 0x000001
#define OPT_DEBUG 0x000002
Modified: projects/netbsd-tests-update-12/contrib/libarchive/libarchive/archive_read_support_format_tar.c
==============================================================================
--- projects/netbsd-tests-update-12/contrib/libarchive/libarchive/archive_read_support_format_tar.c Mon Aug 29 18:51:49 2016 (r305013)
+++ projects/netbsd-tests-update-12/contrib/libarchive/libarchive/archive_read_support_format_tar.c Mon Aug 29 18:53:36 2016 (r305014)
@@ -1128,8 +1128,15 @@ header_common(struct archive_read *a, st
if (tar->entry_bytes_remaining < 0) {
tar->entry_bytes_remaining = 0;
archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
- "Tar entry has negative size?");
- err = ARCHIVE_WARN;
+ "Tar entry has negative size");
+ return (ARCHIVE_FATAL);
+ }
+ if (tar->entry_bytes_remaining == INT64_MAX) {
+ /* Note: tar_atol returns INT64_MAX on overflow */
+ tar->entry_bytes_remaining = 0;
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
+ "Tar entry size overflow");
+ return (ARCHIVE_FATAL);
}
tar->realsize = tar->entry_bytes_remaining;
archive_entry_set_size(entry, tar->entry_bytes_remaining);
Modified: projects/netbsd-tests-update-12/contrib/libarchive/libarchive/archive_read_support_format_zip.c
==============================================================================
--- projects/netbsd-tests-update-12/contrib/libarchive/libarchive/archive_read_support_format_zip.c Mon Aug 29 18:51:49 2016 (r305013)
+++ projects/netbsd-tests-update-12/contrib/libarchive/libarchive/archive_read_support_format_zip.c Mon Aug 29 18:53:36 2016 (r305014)
@@ -418,18 +418,30 @@ zip_time(const char *p)
* id1+size1+data1 + id2+size2+data2 ...
* triplets. id and size are 2 bytes each.
*/
-static void
-process_extra(const char *p, size_t extra_length, struct zip_entry* zip_entry)
+static int
+process_extra(struct archive_read *a, const char *p, size_t extra_length, struct zip_entry* zip_entry)
{
unsigned offset = 0;
- while (offset < extra_length - 4) {
+ if (extra_length == 0) {
+ return ARCHIVE_OK;
+ }
+
+ if (extra_length < 4) {
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
+ "Too-small extra data: Need at least 4 bytes, but only found %d bytes", (int)extra_length);
+ return ARCHIVE_FAILED;
+ }
+ while (offset <= extra_length - 4) {
unsigned short headerid = archive_le16dec(p + offset);
unsigned short datasize = archive_le16dec(p + offset + 2);
offset += 4;
if (offset + datasize > extra_length) {
- break;
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
+ "Extra data overflow: Need %d bytes but only found %d bytes",
+ (int)datasize, (int)(extra_length - offset));
+ return ARCHIVE_FAILED;
}
#ifdef DEBUG
fprintf(stderr, "Header id 0x%04x, length %d\n",
@@ -715,13 +727,13 @@ process_extra(const char *p, size_t extr
}
offset += datasize;
}
-#ifdef DEBUG
- if (offset != extra_length)
- {
- fprintf(stderr,
- "Extra data field contents do not match reported size!\n");
+ if (offset != extra_length) {
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
+ "Malformed extra data: Consumed %d bytes of %d bytes",
+ (int)offset, (int)extra_length);
+ return ARCHIVE_FAILED;
}
-#endif
+ return ARCHIVE_OK;
}
/*
@@ -840,7 +852,9 @@ zip_read_local_file_header(struct archiv
return (ARCHIVE_FATAL);
}
- process_extra(h, extra_length, zip_entry);
+ if (ARCHIVE_OK != process_extra(a, h, extra_length, zip_entry)) {
+ return ARCHIVE_FATAL;
+ }
__archive_read_consume(a, extra_length);
/* Work around a bug in Info-Zip: When reading from a pipe, it
@@ -1293,7 +1307,7 @@ zip_read_data_deflate(struct archive_rea
&& bytes_avail > zip->entry_bytes_remaining) {
bytes_avail = (ssize_t)zip->entry_bytes_remaining;
}
- if (bytes_avail <= 0) {
+ if (bytes_avail < 0) {
archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
"Truncated ZIP file body");
return (ARCHIVE_FATAL);
@@ -2691,7 +2705,9 @@ slurp_central_directory(struct archive_r
"Truncated ZIP file header");
return ARCHIVE_FATAL;
}
- process_extra(p + filename_length, extra_length, zip_entry);
+ if (ARCHIVE_OK != process_extra(a, p + filename_length, extra_length, zip_entry)) {
+ return ARCHIVE_FATAL;
+ }
/*
* Mac resource fork files are stored under the
Modified: projects/netbsd-tests-update-12/contrib/libarchive/libarchive/archive_write_disk_acl.c
==============================================================================
--- projects/netbsd-tests-update-12/contrib/libarchive/libarchive/archive_write_disk_acl.c Mon Aug 29 18:51:49 2016 (r305013)
+++ projects/netbsd-tests-update-12/contrib/libarchive/libarchive/archive_write_disk_acl.c Mon Aug 29 18:53:36 2016 (r305014)
@@ -138,6 +138,7 @@ set_acl(struct archive *a, int fd, const
acl_permset_t acl_permset;
#ifdef ACL_TYPE_NFS4
acl_flagset_t acl_flagset;
+ int r;
#endif
int ret;
int ae_type, ae_permset, ae_tag, ae_id;
@@ -145,7 +146,7 @@ set_acl(struct archive *a, int fd, const
gid_t ae_gid;
const char *ae_name;
int entries;
- int i, r;
+ int i;
ret = ARCHIVE_OK;
entries = archive_acl_reset(abstract_acl, ae_requested_type);
Modified: projects/netbsd-tests-update-12/contrib/libarchive/libarchive/archive_write_disk_posix.c
==============================================================================
--- projects/netbsd-tests-update-12/contrib/libarchive/libarchive/archive_write_disk_posix.c Mon Aug 29 18:51:49 2016 (r305013)
+++ projects/netbsd-tests-update-12/contrib/libarchive/libarchive/archive_write_disk_posix.c Mon Aug 29 18:53:36 2016 (r305014)
@@ -2401,8 +2401,18 @@ check_symlinks(struct archive_write_disk
r = lstat(a->name, &st);
if (r != 0) {
/* We've hit a dir that doesn't exist; stop now. */
- if (errno == ENOENT)
+ if (errno == ENOENT) {
break;
+ } else {
+ /* Note: This effectively disables deep directory
+ * support when security checks are enabled.
+ * Otherwise, very long pathnames that trigger
+ * an error here could evade the sandbox.
+ * TODO: We could do better, but it would probably
+ * require merging the symlink checks with the
+ * deep-directory editing. */
+ return (ARCHIVE_FAILED);
+ }
} else if (S_ISLNK(st.st_mode)) {
if (c == '\0') {
/*
Modified: projects/netbsd-tests-update-12/contrib/libarchive/tar/util.c
==============================================================================
--- projects/netbsd-tests-update-12/contrib/libarchive/tar/util.c Mon Aug 29 18:51:49 2016 (r305013)
+++ projects/netbsd-tests-update-12/contrib/libarchive/tar/util.c Mon Aug 29 18:53:36 2016 (r305014)
@@ -182,7 +182,7 @@ safe_fprintf(FILE *f, const char *fmt, .
}
/* If our output buffer is full, dump it and keep going. */
- if (i > (sizeof(outbuff) - 20)) {
+ if (i > (sizeof(outbuff) - 128)) {
outbuff[i] = '\0';
fprintf(f, "%s", outbuff);
i = 0;
Modified: projects/netbsd-tests-update-12/contrib/ncurses/ncurses/tinfo/lib_baudrate.c
==============================================================================
--- projects/netbsd-tests-update-12/contrib/ncurses/ncurses/tinfo/lib_baudrate.c Mon Aug 29 18:51:49 2016 (r305013)
+++ projects/netbsd-tests-update-12/contrib/ncurses/ncurses/tinfo/lib_baudrate.c Mon Aug 29 18:53:36 2016 (r305014)
@@ -94,7 +94,7 @@ struct speed {
int sp; /* the actual speed */
};
-#define DATA(number) { B##number, number }
+#define DATA(number) { (NCURSES_OSPEED)B##number, number }
static struct speed const speeds[] =
{
Modified: projects/netbsd-tests-update-12/contrib/netbsd-tests/usr.bin/dirname/t_dirname.sh
==============================================================================
--- projects/netbsd-tests-update-12/contrib/netbsd-tests/usr.bin/dirname/t_dirname.sh Mon Aug 29 18:51:49 2016 (r305013)
+++ projects/netbsd-tests-update-12/contrib/netbsd-tests/usr.bin/dirname/t_dirname.sh Mon Aug 29 18:53:36 2016 (r305014)
@@ -32,6 +32,9 @@ basic_head()
}
basic_body()
{
+ # Begin FreeBSD
+ atf_tc_expect_fail "dirname //usr//bin doesn't return //usr like it used to; bug # 212193"
+ # End FreeBSD
atf_check -o inline:"/\n" dirname /
atf_check -o inline:"/\n" dirname //
atf_check -o inline:"/usr\n" dirname /usr/bin/
Modified: projects/netbsd-tests-update-12/contrib/ofed/libcxgb4/src/qp.c
==============================================================================
--- projects/netbsd-tests-update-12/contrib/ofed/libcxgb4/src/qp.c Mon Aug 29 18:51:49 2016 (r305013)
+++ projects/netbsd-tests-update-12/contrib/ofed/libcxgb4/src/qp.c Mon Aug 29 18:53:36 2016 (r305014)
@@ -392,11 +392,9 @@ int c4iw_post_send(struct ibv_qp *ibqp,
t4_sq_produce(&qhp->wq, len16);
idx += DIV_ROUND_UP(len16*16, T4_EQ_ENTRY_SIZE);
}
- if (t4_wq_db_enabled(&qhp->wq)) {
- t4_ring_sq_db(&qhp->wq, idx, dev_is_t5(qhp->rhp),
- len16, wqe);
- } else
- ring_kernel_db(qhp, qhp->wq.sq.qid, idx);
+
+ t4_ring_sq_db(&qhp->wq, idx, dev_is_t5(qhp->rhp),
+ len16, wqe);
qhp->wq.sq.queue[qhp->wq.sq.size].status.host_wq_pidx = \
(qhp->wq.sq.wq_pidx);
pthread_spin_unlock(&qhp->lock);
@@ -458,11 +456,9 @@ int c4iw_post_receive(struct ibv_qp *ibq
wr = wr->next;
num_wrs--;
}
- if (t4_wq_db_enabled(&qhp->wq))
- t4_ring_rq_db(&qhp->wq, idx, dev_is_t5(qhp->rhp),
- len16, wqe);
- else
- ring_kernel_db(qhp, qhp->wq.rq.qid, idx);
+
+ t4_ring_rq_db(&qhp->wq, idx, dev_is_t5(qhp->rhp),
+ len16, wqe);
qhp->wq.rq.queue[qhp->wq.rq.size].status.host_wq_pidx = \
(qhp->wq.rq.wq_pidx);
pthread_spin_unlock(&qhp->lock);
Modified: projects/netbsd-tests-update-12/include/libgen.h
==============================================================================
--- projects/netbsd-tests-update-12/include/libgen.h Mon Aug 29 18:51:49 2016 (r305013)
+++ projects/netbsd-tests-update-12/include/libgen.h Mon Aug 29 18:53:36 2016 (r305014)
@@ -39,4 +39,23 @@ char *basename_r(const char *, char *);
char *dirname(char *);
__END_DECLS
+/*
+ * In FreeBSD 12, the prototype of dirname() was modified to comply to
+ * POSIX. This function may now modify its input. Unfortunately, our
+ * copy of xinstall(8) shipped with previous versions of FreeBSD is
+ * built using the host headers and libc during the bootstrapping phase
+ * and depends on the old behavior.
+ *
+ * Apply a workaround where we explicitly link against dirname at FBSD_1.0
+ * in case this function is called on constant strings, instead of
+ * making the build fail.
+ */
+#if defined(__generic) && !defined(__cplusplus)
+__BEGIN_DECLS
+char *__old_dirname(const char *);
+__END_DECLS
+__sym_compat(dirname, __old_dirname, FBSD_1.0);
+#define dirname(x) __generic(x, const char *, __old_dirname, dirname)(x)
+#endif
+
#endif /* !_LIBGEN_H_ */
Modified: projects/netbsd-tests-update-12/lib/libarchive/tests/Makefile
==============================================================================
--- projects/netbsd-tests-update-12/lib/libarchive/tests/Makefile Mon Aug 29 18:51:49 2016 (r305013)
+++ projects/netbsd-tests-update-12/lib/libarchive/tests/Makefile Mon Aug 29 18:53:36 2016 (r305014)
@@ -211,8 +211,6 @@ TESTS_SRCS= \
test_write_disk_perms.c \
test_write_disk_secure.c \
test_write_disk_secure744.c \
- test_write_disk_secure745.c \
- test_write_disk_secure746.c \
test_write_disk_sparse.c \
test_write_disk_symlink.c \
test_write_disk_times.c \
Modified: projects/netbsd-tests-update-12/lib/libc/amd64/sys/Makefile.inc
==============================================================================
--- projects/netbsd-tests-update-12/lib/libc/amd64/sys/Makefile.inc Mon Aug 29 18:51:49 2016 (r305013)
+++ projects/netbsd-tests-update-12/lib/libc/amd64/sys/Makefile.inc Mon Aug 29 18:53:36 2016 (r305014)
@@ -4,7 +4,7 @@
SRCS+= amd64_get_fsbase.c amd64_get_gsbase.c amd64_set_fsbase.c \
amd64_set_gsbase.c
-MDASM= vfork.S brk.S cerror.S exect.S getcontext.S ptrace.S \
+MDASM= vfork.S brk.S cerror.S exect.S getcontext.S \
sbrk.S setlogin.S sigreturn.S
# Don't generate default code for these syscalls:
Modified: projects/netbsd-tests-update-12/lib/libc/arm/sys/Makefile.inc
==============================================================================
--- projects/netbsd-tests-update-12/lib/libc/arm/sys/Makefile.inc Mon Aug 29 18:51:49 2016 (r305013)
+++ projects/netbsd-tests-update-12/lib/libc/arm/sys/Makefile.inc Mon Aug 29 18:53:36 2016 (r305014)
@@ -2,7 +2,7 @@
SRCS+= __vdso_gettc.c
-MDASM= Ovfork.S brk.S cerror.S ptrace.S sbrk.S shmat.S sigreturn.S syscall.S
+MDASM= Ovfork.S brk.S cerror.S sbrk.S shmat.S sigreturn.S syscall.S
# Don't generate default code for these syscalls:
NOASM= break.o exit.o getlogin.o sstk.o vfork.o yield.o
Modified: projects/netbsd-tests-update-12/lib/libc/gen/dirname.c
==============================================================================
--- projects/netbsd-tests-update-12/lib/libc/gen/dirname.c Mon Aug 29 18:51:49 2016 (r305013)
+++ projects/netbsd-tests-update-12/lib/libc/gen/dirname.c Mon Aug 29 18:53:36 2016 (r305014)
@@ -31,7 +31,7 @@ __FBSDID("$FreeBSD$");
#include <string.h>
char *
-dirname(char *path)
+(dirname)(char *path)
{
const char *in, *prev, *begin, *end;
char *out;
Modified: projects/netbsd-tests-update-12/lib/libc/i386/sys/Makefile.inc
==============================================================================
--- projects/netbsd-tests-update-12/lib/libc/i386/sys/Makefile.inc Mon Aug 29 18:51:49 2016 (r305013)
+++ projects/netbsd-tests-update-12/lib/libc/i386/sys/Makefile.inc Mon Aug 29 18:53:36 2016 (r305014)
@@ -7,7 +7,7 @@ SRCS+= i386_clr_watch.c i386_set_watch.c
SRCS+= i386_get_fsbase.c i386_get_gsbase.c i386_get_ioperm.c i386_get_ldt.c \
i386_set_fsbase.c i386_set_gsbase.c i386_set_ioperm.c i386_set_ldt.c
-MDASM= Ovfork.S brk.S cerror.S exect.S getcontext.S ptrace.S \
+MDASM= Ovfork.S brk.S cerror.S exect.S getcontext.S \
sbrk.S setlogin.S sigreturn.S syscall.S
# Don't generate default code for these syscalls:
Modified: projects/netbsd-tests-update-12/lib/libc/include/libc_private.h
==============================================================================
--- projects/netbsd-tests-update-12/lib/libc/include/libc_private.h Mon Aug 29 18:51:49 2016 (r305013)
+++ projects/netbsd-tests-update-12/lib/libc/include/libc_private.h Mon Aug 29 18:53:36 2016 (r305014)
@@ -335,6 +335,7 @@ int __sys_openat(int, const char *, int
int __sys_pselect(int, struct fd_set *, struct fd_set *,
struct fd_set *, const struct timespec *,
const __sigset_t *);
+int __sys_ptrace(int, __pid_t, char *, int);
int __sys_poll(struct pollfd *, unsigned, int);
int __sys_ppoll(struct pollfd *, unsigned, const struct timespec *,
const __sigset_t *);
Modified: projects/netbsd-tests-update-12/lib/libc/mips/sys/Makefile.inc
==============================================================================
--- projects/netbsd-tests-update-12/lib/libc/mips/sys/Makefile.inc Mon Aug 29 18:51:49 2016 (r305013)
+++ projects/netbsd-tests-update-12/lib/libc/mips/sys/Makefile.inc Mon Aug 29 18:53:36 2016 (r305014)
@@ -3,7 +3,7 @@
SRCS+= trivial-vdso_tc.c
MDASM= Ovfork.S brk.S cerror.S exect.S \
- ptrace.S sbrk.S syscall.S
+ sbrk.S syscall.S
# Don't generate default code for these syscalls:
NOASM= break.o exit.o getlogin.o sstk.o vfork.o yield.o
Modified: projects/netbsd-tests-update-12/lib/libc/net/getaddrinfo.c
==============================================================================
--- projects/netbsd-tests-update-12/lib/libc/net/getaddrinfo.c Mon Aug 29 18:51:49 2016 (r305013)
+++ projects/netbsd-tests-update-12/lib/libc/net/getaddrinfo.c Mon Aug 29 18:53:36 2016 (r305014)
@@ -224,6 +224,7 @@ struct ai_order {
struct policyqueue *aio_dstpolicy;
struct addrinfo *aio_ai;
int aio_matchlen;
+ int aio_initial_sequence;
};
static const ns_src default_dns_files[] = {
@@ -708,6 +709,7 @@ reorder(struct addrinfo *sentinel)
aio[i].aio_dstpolicy = match_addrselectpolicy(ai->ai_addr,
&policyhead);
set_source(&aio[i], &policyhead);
+ aio[i].aio_initial_sequence = i;
}
/* perform sorting. */
@@ -1066,6 +1068,23 @@ comp_dst(const void *arg1, const void *a
}
/* Rule 10: Otherwise, leave the order unchanged. */
+
+ /*
+ * Note that qsort is unstable; so, we can't return zero and
+ * expect the order to be unchanged.
+ * That also means we can't depend on the current position of
+ * dst2 being after dst1. We must enforce the initial order
+ * with an explicit compare on the original position.
+ * The qsort specification requires that "When the same objects
+ * (consisting of width bytes, irrespective of their current
+ * positions in the array) are passed more than once to the
+ * comparison function, the results shall be consistent with one
+ * another."
+ * In other words, If A < B, then we must also return B > A.
+ */
+ if (dst2->aio_initial_sequence < dst1->aio_initial_sequence)
+ return(1);
+
return(-1);
}
Modified: projects/netbsd-tests-update-12/lib/libc/powerpc/sys/Makefile.inc
==============================================================================
--- projects/netbsd-tests-update-12/lib/libc/powerpc/sys/Makefile.inc Mon Aug 29 18:51:49 2016 (r305013)
+++ projects/netbsd-tests-update-12/lib/libc/powerpc/sys/Makefile.inc Mon Aug 29 18:53:36 2016 (r305014)
@@ -1,6 +1,6 @@
# $FreeBSD$
-MDASM+= brk.S cerror.S exect.S ptrace.S sbrk.S setlogin.S
+MDASM+= brk.S cerror.S exect.S sbrk.S setlogin.S
# Don't generate default code for these syscalls:
NOASM= break.o exit.o getlogin.o sstk.o yield.o
Modified: projects/netbsd-tests-update-12/lib/libc/powerpc64/sys/Makefile.inc
==============================================================================
--- projects/netbsd-tests-update-12/lib/libc/powerpc64/sys/Makefile.inc Mon Aug 29 18:51:49 2016 (r305013)
+++ projects/netbsd-tests-update-12/lib/libc/powerpc64/sys/Makefile.inc Mon Aug 29 18:53:36 2016 (r305014)
@@ -1,6 +1,6 @@
# $FreeBSD$
-MDASM+= brk.S cerror.S exect.S ptrace.S sbrk.S setlogin.S
+MDASM+= brk.S cerror.S exect.S sbrk.S setlogin.S
# Don't generate default code for these syscalls:
NOASM= break.o exit.o getlogin.o sstk.o yield.o
Modified: projects/netbsd-tests-update-12/lib/libc/sparc64/sys/Makefile.inc
==============================================================================
--- projects/netbsd-tests-update-12/lib/libc/sparc64/sys/Makefile.inc Mon Aug 29 18:51:49 2016 (r305013)
+++ projects/netbsd-tests-update-12/lib/libc/sparc64/sys/Makefile.inc Mon Aug 29 18:53:36 2016 (r305014)
@@ -12,7 +12,7 @@ SRCS+= __sparc_sigtramp_setup.c \
CFLAGS+= -I${LIBC_SRCTOP}/sparc64/fpu
-MDASM+= brk.S cerror.S exect.S ptrace.S sbrk.S setlogin.S sigaction1.S
+MDASM+= brk.S cerror.S exect.S sbrk.S setlogin.S sigaction1.S
# Don't generate default code for these syscalls:
NOASM= break.o exit.o getlogin.o sstk.o yield.o
Modified: projects/netbsd-tests-update-12/lib/libc/stdio/fgetln.c
==============================================================================
--- projects/netbsd-tests-update-12/lib/libc/stdio/fgetln.c Mon Aug 29 18:51:49 2016 (r305013)
+++ projects/netbsd-tests-update-12/lib/libc/stdio/fgetln.c Mon Aug 29 18:53:36 2016 (r305014)
@@ -139,8 +139,11 @@ fgetln(FILE *fp, size_t *lenp)
(void)memcpy((void *)(fp->_lb._base + off), (void *)fp->_p,
len - off);
off = len;
- if (__srefill(fp))
- break; /* EOF or error: return partial line */
+ if (__srefill(fp)) {
+ if (__sfeof(fp))
+ break;
+ goto error;
+ }
if ((p = memchr((void *)fp->_p, '\n', (size_t)fp->_r)) == NULL)
continue;
Modified: projects/netbsd-tests-update-12/lib/libc/stdio/fgetwln.c
==============================================================================
--- projects/netbsd-tests-update-12/lib/libc/stdio/fgetwln.c Mon Aug 29 18:51:49 2016 (r305013)
+++ projects/netbsd-tests-update-12/lib/libc/stdio/fgetwln.c Mon Aug 29 18:53:36 2016 (r305014)
@@ -53,7 +53,6 @@ fgetwln_l(FILE * __restrict fp, size_t *
ORIENT(fp, 1);
len = 0;
- /* WEOF or error: return partial line, see fgetln(3). */
while ((wc = __fgetwc(fp, locale)) != WEOF) {
#define GROW 512
if (len * sizeof(wchar_t) >= fp->_lb._size &&
@@ -65,7 +64,7 @@ fgetwln_l(FILE * __restrict fp, size_t *
if (wc == L'\n')
break;
}
- if (len == 0)
+ if (len == 0 || (wc == WEOF && !__sfeof(fp)))
goto error;
FUNLOCKFILE(fp);
Modified: projects/netbsd-tests-update-12/lib/libc/sys/Makefile.inc
==============================================================================
--- projects/netbsd-tests-update-12/lib/libc/sys/Makefile.inc Mon Aug 29 18:51:49 2016 (r305013)
+++ projects/netbsd-tests-update-12/lib/libc/sys/Makefile.inc Mon Aug 29 18:53:36 2016 (r305014)
@@ -48,6 +48,7 @@ INTERPOSED = \
poll \
ppoll \
pselect \
+ ptrace \
read \
readv \
recvfrom \
Modified: projects/netbsd-tests-update-12/lib/libc/sys/ptrace.2
==============================================================================
--- projects/netbsd-tests-update-12/lib/libc/sys/ptrace.2 Mon Aug 29 18:51:49 2016 (r305013)
+++ projects/netbsd-tests-update-12/lib/libc/sys/ptrace.2 Mon Aug 29 18:53:36 2016 (r305014)
@@ -2,7 +2,7 @@
.\" $NetBSD: ptrace.2,v 1.2 1995/02/27 12:35:37 cgd Exp $
.\"
.\" This file is in the public domain.
-.Dd July 28, 2016
+.Dd August 28, 2016
.Dt PTRACE 2
.Os
.Sh NAME
@@ -906,7 +906,13 @@ to return
\-1
as a non-error value; to disambiguate,
.Va errno
-can be set to 0 before the call and checked afterwards.
+is set to 0 in the libc wrapper for the
+.Fn ptrace
+system call and
+.Fn ptrace
+callers can reliably check
+.Va errno
+for non-zero value afterwards.
.Sh ERRORS
The
.Fn ptrace
Copied: projects/netbsd-tests-update-12/lib/libc/sys/ptrace.c (from r305013, head/lib/libc/sys/ptrace.c)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ projects/netbsd-tests-update-12/lib/libc/sys/ptrace.c Mon Aug 29 18:53:36 2016 (r305014, copy of r305013, head/lib/libc/sys/ptrace.c)
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2016 The FreeBSD Foundation.
+ * All rights reserved.
+ *
+ * Portions of this software were developed by Konstantin Belousov
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice(s), this list of conditions and the following disclaimer as
+ * the first lines of this file unmodified other than the possible
+ * addition of one or more copyright notices.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice(s), this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+#include <sys/ptrace.h>
+#include <errno.h>
+#include "libc_private.h"
+
+__weak_reference(_ptrace, ptrace);
+
+int
+_ptrace(int request, pid_t pid, caddr_t addr, int data)
+{
+
+ errno = 0;
+ return (__sys_ptrace(request, pid, addr, data));
+}
Modified: projects/netbsd-tests-update-12/lib/libnv/Makefile
==============================================================================
--- projects/netbsd-tests-update-12/lib/libnv/Makefile Mon Aug 29 18:51:49 2016 (r305013)
+++ projects/netbsd-tests-update-12/lib/libnv/Makefile Mon Aug 29 18:53:36 2016 (r305014)
@@ -11,7 +11,8 @@ SHLIB_MAJOR= 0
.PATH: ${.CURDIR}/../../sys/contrib/libnv ${.CURDIR}/../../sys/sys
CFLAGS+=-I${.CURDIR}/../../sys -I${.CURDIR}
-SRCS= dnvlist.c
+SRCS= cnvlist.c
+SRCS+= dnvlist.c
SRCS+= msgio.c
SRCS+= nvlist.c
SRCS+= nvpair.c
Modified: projects/netbsd-tests-update-12/lib/libnv/tests/Makefile
==============================================================================
--- projects/netbsd-tests-update-12/lib/libnv/tests/Makefile Mon Aug 29 18:51:49 2016 (r305013)
+++ projects/netbsd-tests-update-12/lib/libnv/tests/Makefile Mon Aug 29 18:53:36 2016 (r305014)
@@ -1,6 +1,7 @@
# $FreeBSD$
ATF_TESTS_CXX= \
+ cnv_tests \
dnv_tests \
nv_array_tests \
nv_tests \
Copied: projects/netbsd-tests-update-12/lib/libnv/tests/cnv_tests.cc (from r305013, head/lib/libnv/tests/cnv_tests.cc)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ projects/netbsd-tests-update-12/lib/libnv/tests/cnv_tests.cc Mon Aug 29 18:53:36 2016 (r305014, copy of r305013, head/lib/libnv/tests/cnv_tests.cc)
@@ -0,0 +1,1508 @@
+/*-
+ * Copyright (c) 2016 Adam Starak <starak.adam at gmail.com>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (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$
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/cnv.h>
+#include <sys/nv.h>
+#include <sys/types.h>
+
+#include <atf-c++.hpp>
+#include <fcntl.h>
+#include <errno.h>
+
+#define fd_is_valid(fd) (fcntl((fd), F_GETFL) != -1 || errno != EBADF)
+
+/* ATF cnvlist_get tests. */
+
+ATF_TEST_CASE_WITHOUT_HEAD(cnvlist_get_bool);
+ATF_TEST_CASE_BODY(cnvlist_get_bool)
+{
+ nvlist_t *nvl;
+ const char *key;
+ bool value;
+ void *cookie;
+ int type;
+
+ nvl = nvlist_create(0);
+ ATF_REQUIRE(nvl != NULL);
+ ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
+ ATF_REQUIRE(nvlist_empty(nvl));
+
+ cookie = NULL;
+ key = "name";
+ value = true;
+
+ nvlist_add_bool(nvl, key, value);
+ ATF_REQUIRE_EQ(strcmp(key, nvlist_next(nvl, &type, &cookie)), 0);
+ ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
+ ATF_REQUIRE_EQ(type, NV_TYPE_BOOL);
+ ATF_REQUIRE(!nvlist_empty(nvl));
+ ATF_REQUIRE(nvlist_exists(nvl, key));
+ ATF_REQUIRE(nvlist_exists_bool(nvl, key));
+
+ ATF_REQUIRE_EQ(cnvlist_get_bool(cookie), value);
+
+ ATF_REQUIRE_EQ(nvlist_next(nvl, &type, &cookie),
+ static_cast<const char *>(NULL));
+
+ nvlist_destroy(nvl);
+}
+
+ATF_TEST_CASE_WITHOUT_HEAD(cnvlist_get_number);
+ATF_TEST_CASE_BODY(cnvlist_get_number)
+{
+ nvlist_t *nvl;
+ const char *key;
+ uint64_t value;
+ void *cookie;
+ int type;
+
+ nvl = nvlist_create(0);
+ ATF_REQUIRE(nvl != NULL);
+ ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
+ ATF_REQUIRE(nvlist_empty(nvl));
+
+ cookie = NULL;
+ key = "name";
+ value = 420;
+
+ nvlist_add_number(nvl, key, value);
+ ATF_REQUIRE_EQ(strcmp(key, nvlist_next(nvl, &type, &cookie)), 0);
+ ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
+ ATF_REQUIRE_EQ(type, NV_TYPE_NUMBER);
+ ATF_REQUIRE(!nvlist_empty(nvl));
+ ATF_REQUIRE(nvlist_exists(nvl, key));
+ ATF_REQUIRE(nvlist_exists_number(nvl, key));
+
+ ATF_REQUIRE_EQ(cnvlist_get_number(cookie), value);
+
+ ATF_REQUIRE_EQ(nvlist_next(nvl, &type, &cookie),
+ static_cast<const char *>(NULL));
+
+ nvlist_destroy(nvl);
+}
+
+
+ATF_TEST_CASE_WITHOUT_HEAD(cnvlist_get_string);
+ATF_TEST_CASE_BODY(cnvlist_get_string)
+{
+ nvlist_t *nvl;
+ const char *key;
+ const char *value;
+ void *cookie;
+ int type;
+
+ nvl = nvlist_create(0);
+ ATF_REQUIRE(nvl != NULL);
+ ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
+ ATF_REQUIRE(nvlist_empty(nvl));
+
+ cookie = NULL;
+ key = "name";
+ value = "text";
+
+ nvlist_add_string(nvl, key, value);
+ ATF_REQUIRE_EQ(strcmp(key, nvlist_next(nvl, &type, &cookie)), 0);
+ ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
+ ATF_REQUIRE_EQ(type, NV_TYPE_STRING);
+ ATF_REQUIRE(!nvlist_empty(nvl));
+ ATF_REQUIRE(nvlist_exists(nvl, key));
+ ATF_REQUIRE(nvlist_exists_string(nvl, key));
+
+ ATF_REQUIRE_EQ(strcmp(cnvlist_get_string(cookie), value), 0);
+
+ ATF_REQUIRE_EQ(nvlist_next(nvl, &type, &cookie),
+ static_cast<const char *>(NULL));
+
+ nvlist_destroy(nvl);
+}
+
+ATF_TEST_CASE_WITHOUT_HEAD(cnvlist_get_nvlist);
+ATF_TEST_CASE_BODY(cnvlist_get_nvlist)
+{
+ nvlist_t *nvl, *value;
+ const nvlist_t *result;
+ const char *key, *subkey;
+ void *cookie;
+ int type;
+
+ nvl = nvlist_create(0);
+ ATF_REQUIRE(nvl != NULL);
+ ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
+ ATF_REQUIRE(nvlist_empty(nvl));
+
+ value = nvlist_create(0);
+ ATF_REQUIRE(nvl != NULL);
+ ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
+ ATF_REQUIRE(nvlist_empty(nvl));
+
+ key = "name";
+ subkey = "subname";
+ cookie = NULL;
+
+ /* Add null to 'value' nvlist. */
+ nvlist_add_null(value, subkey);
+ ATF_REQUIRE_EQ(strcmp(subkey, nvlist_next(value, &type, &cookie)), 0);
+ ATF_REQUIRE_EQ(nvlist_error(value), 0);
+ ATF_REQUIRE_EQ(type, NV_TYPE_NULL);
+ ATF_REQUIRE(!nvlist_empty(value));
+ ATF_REQUIRE(nvlist_exists(value, subkey));
+ ATF_REQUIRE(nvlist_exists_null(value, subkey));
+ ATF_REQUIRE_EQ(nvlist_next(value, &type, &cookie),
+ static_cast<const char *>(NULL));
+
+ /* Add 'value' nvlist. */
+ cookie = NULL;
+ nvlist_add_nvlist(nvl, key, value);
+ ATF_REQUIRE_EQ(strcmp(key, nvlist_next(nvl, &type, &cookie)), 0);
+ ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
+ ATF_REQUIRE_EQ(type, NV_TYPE_NVLIST);
+ ATF_REQUIRE(!nvlist_empty(nvl));
+ ATF_REQUIRE(nvlist_exists(nvl, key));
+ ATF_REQUIRE(nvlist_exists_nvlist(nvl, key));
+
+ /*
+ * Assuming nvlist_get_nvlist() is correct check if cnvlist returns
+ * the same pointer.
+ */
+ result = cnvlist_get_nvlist(cookie);
+ ATF_REQUIRE_EQ(result, nvlist_get_nvlist(nvl, key));
+ ATF_REQUIRE(result != value);
+ ATF_REQUIRE_EQ(nvlist_next(nvl, &type, &cookie),
+ static_cast<const char *>(NULL));
+
+ /* Validate data inside nvlist. */
+ cookie = NULL;
+ ATF_REQUIRE_EQ(strcmp(subkey, nvlist_next(result, &type, &cookie)), 0);
+ ATF_REQUIRE_EQ(nvlist_error(result), 0);
+ ATF_REQUIRE_EQ(type, NV_TYPE_NULL);
+ ATF_REQUIRE(!nvlist_empty(result));
+ ATF_REQUIRE(nvlist_exists(result, subkey));
+ ATF_REQUIRE(nvlist_exists_null(result, subkey));
+ ATF_REQUIRE_EQ(nvlist_next(result, &type, &cookie),
+ static_cast<const char *>(NULL));
+
+ nvlist_destroy(nvl);
+ nvlist_destroy(value);
+}
+
+ATF_TEST_CASE_WITHOUT_HEAD(cnvlist_get_descriptor);
+ATF_TEST_CASE_BODY(cnvlist_get_descriptor)
+{
+ nvlist_t *nvl;
+ const char *key;
+ void *cookie;
+ int type;
+
+ nvl = nvlist_create(0);
+ ATF_REQUIRE(nvl != NULL);
+ ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
+ ATF_REQUIRE(nvlist_empty(nvl));
+
+ cookie = NULL;
+ key = "name";
+
+ nvlist_add_descriptor(nvl, key, STDERR_FILENO);
+ ATF_REQUIRE_EQ(strcmp(key, nvlist_next(nvl, &type, &cookie)), 0);
+ ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
+ ATF_REQUIRE_EQ(type, NV_TYPE_DESCRIPTOR);
+ ATF_REQUIRE(!nvlist_empty(nvl));
+ ATF_REQUIRE(nvlist_exists(nvl, key));
+ ATF_REQUIRE(nvlist_exists_descriptor(nvl, key));
+
+ ATF_REQUIRE_EQ(fd_is_valid(cnvlist_get_descriptor(cookie)), 1);
+
+ ATF_REQUIRE_EQ(nvlist_next(nvl, &type, &cookie),
+ static_cast<const char *>(NULL));
+
+ nvlist_destroy(nvl);
+}
+
+ATF_TEST_CASE_WITHOUT_HEAD(cnvlist_get_binary);
+ATF_TEST_CASE_BODY(cnvlist_get_binary)
+{
+ nvlist_t *nvl;
+ const char *key;
+ void *in_binary;
+ const void *out_binary;
+ void *cookie;
+ int type;
+ size_t in_size, out_size;
+
+ nvl = nvlist_create(0);
+ ATF_REQUIRE(nvl != NULL);
+ ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
+ ATF_REQUIRE(nvlist_empty(nvl));
+
+ cookie = NULL;
+ key = "name";
+ in_size = 13;
+
+ in_binary = malloc(in_size);
+ ATF_REQUIRE(in_binary != NULL);
+ memset(in_binary, 0xa5, in_size);
+
+ nvlist_add_binary(nvl, key, in_binary, in_size);
+ ATF_REQUIRE_EQ(strcmp(key, nvlist_next(nvl, &type, &cookie)), 0);
+ ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
+ ATF_REQUIRE_EQ(type, NV_TYPE_BINARY);
+ ATF_REQUIRE(!nvlist_empty(nvl));
+ ATF_REQUIRE(nvlist_exists(nvl, key));
+ ATF_REQUIRE(nvlist_exists_binary(nvl, key));
+
+ out_binary = cnvlist_get_binary(cookie, &out_size);
+ ATF_REQUIRE_EQ(out_size, in_size);
+ ATF_REQUIRE_EQ(memcmp(in_binary, out_binary, out_size), 0);
+
+ ATF_REQUIRE_EQ(nvlist_next(nvl, &type, &cookie),
+ static_cast<const char *>(NULL));
+
+ nvlist_destroy(nvl);
+}
+
+/* ATF cnvlist_get array tests. */
+
+ATF_TEST_CASE_WITHOUT_HEAD(cnvlist_get_bool_array);
+ATF_TEST_CASE_BODY(cnvlist_get_bool_array)
+{
+ nvlist_t *nvl;
+ bool in_array[16];
+ const bool *out_array;
+ const char *key;
+ void *cookie;
+ int type, i;
+ size_t nitems;
+
+ for (i = 0; i < 16; i++)
+ in_array[i] = (i % 2 == 0);
+
+ nvl = nvlist_create(0);
+ ATF_REQUIRE(nvl != NULL);
+ ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
+ ATF_REQUIRE(nvlist_empty(nvl));
+
+ cookie = NULL;
+ key = "name";
+
+ nvlist_add_bool_array(nvl, key, in_array, 16);
+ ATF_REQUIRE_EQ(strcmp(key, nvlist_next(nvl, &type, &cookie)), 0);
+ ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
+ ATF_REQUIRE_EQ(type, NV_TYPE_BOOL_ARRAY);
+ ATF_REQUIRE(!nvlist_empty(nvl));
+ ATF_REQUIRE(nvlist_exists(nvl, key));
+ ATF_REQUIRE(nvlist_exists_bool_array(nvl, key));
+
+ out_array = cnvlist_get_bool_array(cookie, &nitems);
+ ATF_REQUIRE_EQ(nitems, 16);
+ ATF_REQUIRE(out_array != NULL);
+ for (i = 0; i < 16; i++)
+ ATF_REQUIRE_EQ(out_array[i], in_array[i]);
+
+ ATF_REQUIRE_EQ(nvlist_next(nvl, &type, &cookie),
+ static_cast<const char *>(NULL));
+
+ nvlist_destroy(nvl);
+}
+
+ATF_TEST_CASE_WITHOUT_HEAD(cnvlist_get_number_array);
+ATF_TEST_CASE_BODY(cnvlist_get_number_array)
+{
+ nvlist_t *nvl;
+ uint64_t in_array[16];
+ const uint64_t *out_array;
+ const char *key;
+ void *cookie;
+ int type, i;
+ size_t nitems;
+
+ for (i = 0; i < 16; i++)
+ in_array[i] = i;
+
+ nvl = nvlist_create(0);
+ ATF_REQUIRE(nvl != NULL);
+ ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
+ ATF_REQUIRE(nvlist_empty(nvl));
+
+ cookie = NULL;
+ key = "name";
+
+ nvlist_add_number_array(nvl, key, in_array, 16);
+ ATF_REQUIRE_EQ(strcmp(key, nvlist_next(nvl, &type, &cookie)), 0);
+ ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
+ ATF_REQUIRE_EQ(type, NV_TYPE_NUMBER_ARRAY);
+ ATF_REQUIRE(!nvlist_empty(nvl));
+ ATF_REQUIRE(nvlist_exists(nvl, key));
+ ATF_REQUIRE(nvlist_exists_number_array(nvl, key));
+
+ out_array = cnvlist_get_number_array(cookie, &nitems);
+ ATF_REQUIRE(out_array != NULL);
+ ATF_REQUIRE_EQ(nitems, 16);
+ for (i = 0; i < 16; i++)
+ ATF_REQUIRE_EQ(out_array[i], in_array[i]);
+
+ ATF_REQUIRE_EQ(nvlist_next(nvl, &type, &cookie),
+ static_cast<const char *>(NULL));
+
+ nvlist_destroy(nvl);
+}
+
+ATF_TEST_CASE_WITHOUT_HEAD(cnvlist_get_string_array);
+ATF_TEST_CASE_BODY(cnvlist_get_string_array)
+{
+ nvlist_t *nvl;
+ const char *in_array[4] = {"inequality", "sucks", ".", ""};
+ const char * const *out_array;
+ const char *key;
+ void *cookie;
+ int type, i;
+ size_t nitems;
+
+ nvl = nvlist_create(0);
+ ATF_REQUIRE(nvl != NULL);
+ ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
+ ATF_REQUIRE(nvlist_empty(nvl));
+
+ cookie = NULL;
+ key = "name";
+
+ nvlist_add_string_array(nvl, key, in_array, 4);
+ ATF_REQUIRE_EQ(strcmp(key, nvlist_next(nvl, &type, &cookie)), 0);
+ ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
+ ATF_REQUIRE_EQ(type, NV_TYPE_STRING_ARRAY);
+ ATF_REQUIRE(!nvlist_empty(nvl));
+ ATF_REQUIRE(nvlist_exists(nvl, key));
+ ATF_REQUIRE(nvlist_exists_string_array(nvl, key));
+
+ out_array = cnvlist_get_string_array(cookie, &nitems);
+ ATF_REQUIRE_EQ(nitems, 4);
+ ATF_REQUIRE(out_array != NULL);
+ for (i = 0; i < 4; i++) {
+ ATF_REQUIRE(out_array[i] != NULL);
+ ATF_REQUIRE_EQ(strcmp(out_array[i], in_array[i]), 0);
+ }
+
*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
More information about the svn-src-projects
mailing list