From owner-svn-src-vendor@freebsd.org Fri Aug 12 01:05:10 2016 Return-Path: Delivered-To: svn-src-vendor@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 97102BB67B7; Fri, 12 Aug 2016 01:05:10 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3D3291A96; Fri, 12 Aug 2016 01:05:10 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7C159gh073942; Fri, 12 Aug 2016 01:05:09 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7C158oX073929; Fri, 12 Aug 2016 01:05:08 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201608120105.u7C158oX073929@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Fri, 12 Aug 2016 01:05:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r303980 - in vendor/NetBSD/tests/dist: . bin/cat bin/sh bin/sh/dotcmd crypto/opencrypto dev dev/audio dev/dm dev/fss dev/fss/CVS dev/md dev/scsipi dev/sysmon dev/usb dev/usb/CVS dev/usb... X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Aug 2016 01:05:10 -0000 Author: ngie Date: Fri Aug 12 01:05:07 2016 New Revision: 303980 URL: https://svnweb.freebsd.org/changeset/base/303980 Log: Update ^/vendor/NetBSD/tests/dist to a more recent snapshot Pulled on "Thu Aug 11 18:01:19 PDT 2016" Added: vendor/NetBSD/tests/dist/bin/cat/d_se_output.in (contents, props changed) vendor/NetBSD/tests/dist/bin/cat/d_se_output.out vendor/NetBSD/tests/dist/bin/sh/t_arith.sh (contents, props changed) vendor/NetBSD/tests/dist/bin/sh/t_cmdsub.sh (contents, props changed) vendor/NetBSD/tests/dist/bin/sh/t_option.sh (contents, props changed) vendor/NetBSD/tests/dist/bin/sh/t_redir.sh (contents, props changed) vendor/NetBSD/tests/dist/bin/sh/t_redircloexec.sh (contents, props changed) vendor/NetBSD/tests/dist/bin/sh/t_shift.sh (contents, props changed) vendor/NetBSD/tests/dist/bin/sh/t_varval.sh (contents, props changed) vendor/NetBSD/tests/dist/dev/fss/ vendor/NetBSD/tests/dist/dev/fss/CVS/ vendor/NetBSD/tests/dist/dev/fss/CVS/Entries vendor/NetBSD/tests/dist/dev/fss/CVS/Repository vendor/NetBSD/tests/dist/dev/fss/CVS/Root vendor/NetBSD/tests/dist/dev/fss/CVS/Tag vendor/NetBSD/tests/dist/dev/fss/Makefile (contents, props changed) vendor/NetBSD/tests/dist/dev/fss/t_fss.sh (contents, props changed) vendor/NetBSD/tests/dist/dev/usb/ vendor/NetBSD/tests/dist/dev/usb/CVS/ vendor/NetBSD/tests/dist/dev/usb/CVS/Entries vendor/NetBSD/tests/dist/dev/usb/CVS/Repository vendor/NetBSD/tests/dist/dev/usb/CVS/Root vendor/NetBSD/tests/dist/dev/usb/CVS/Tag vendor/NetBSD/tests/dist/dev/usb/Makefile (contents, props changed) vendor/NetBSD/tests/dist/dev/usb/libhid/ vendor/NetBSD/tests/dist/dev/usb/libhid/CVS/ vendor/NetBSD/tests/dist/dev/usb/libhid/CVS/Entries vendor/NetBSD/tests/dist/dev/usb/libhid/CVS/Repository vendor/NetBSD/tests/dist/dev/usb/libhid/CVS/Root vendor/NetBSD/tests/dist/dev/usb/libhid/CVS/Tag vendor/NetBSD/tests/dist/dev/usb/libhid/Makefile (contents, props changed) vendor/NetBSD/tests/dist/dev/usb/t_hid/ vendor/NetBSD/tests/dist/dev/usb/t_hid.c (contents, props changed) vendor/NetBSD/tests/dist/dev/usb/t_hid/CVS/ vendor/NetBSD/tests/dist/dev/usb/t_hid/CVS/Entries vendor/NetBSD/tests/dist/dev/usb/t_hid/CVS/Repository vendor/NetBSD/tests/dist/dev/usb/t_hid/CVS/Root vendor/NetBSD/tests/dist/dev/usb/t_hid/CVS/Tag vendor/NetBSD/tests/dist/dev/usb/t_hid/Makefile (contents, props changed) vendor/NetBSD/tests/dist/fs/nfs/Makefile.inc (contents, props changed) vendor/NetBSD/tests/dist/include/sys/t_pslist.c (contents, props changed) vendor/NetBSD/tests/dist/kernel/kqueue/t_vnode.c (contents, props changed) vendor/NetBSD/tests/dist/lib/libc/db/h_lfsr.c (contents, props changed) vendor/NetBSD/tests/dist/lib/libc/db/t_db_hash_seq.c (contents, props changed) vendor/NetBSD/tests/dist/lib/libc/hash/t_hmac.c (contents, props changed) vendor/NetBSD/tests/dist/lib/libc/inet/t_inet_addr.c (contents, props changed) vendor/NetBSD/tests/dist/lib/libc/stdio/t_open_memstream.c (contents, props changed) vendor/NetBSD/tests/dist/lib/libc/stdlib/t_strtoi.c (contents, props changed) vendor/NetBSD/tests/dist/lib/libc/sync/cpp_atomic_ops_linkable.cc (contents, props changed) vendor/NetBSD/tests/dist/lib/libc/sys/t_bind.c (contents, props changed) vendor/NetBSD/tests/dist/lib/libc/sys/t_getsockname.c (contents, props changed) vendor/NetBSD/tests/dist/lib/libc/sys/t_posix_fallocate.c (contents, props changed) vendor/NetBSD/tests/dist/lib/libc/sys/t_wait.c (contents, props changed) vendor/NetBSD/tests/dist/lib/libm/t_fenv.c (contents, props changed) vendor/NetBSD/tests/dist/lib/libm/t_hypot.c (contents, props changed) vendor/NetBSD/tests/dist/lib/libusbhid/ vendor/NetBSD/tests/dist/lib/libusbhid/CVS/ vendor/NetBSD/tests/dist/lib/libusbhid/CVS/Entries vendor/NetBSD/tests/dist/lib/libusbhid/CVS/Repository vendor/NetBSD/tests/dist/lib/libusbhid/CVS/Root vendor/NetBSD/tests/dist/lib/libusbhid/CVS/Tag vendor/NetBSD/tests/dist/lib/libusbhid/Makefile (contents, props changed) vendor/NetBSD/tests/dist/lib/libusbhid/hid_test_data.c (contents, props changed) vendor/NetBSD/tests/dist/lib/libusbhid/t_usbhid.c (contents, props changed) vendor/NetBSD/tests/dist/lib/libusbhid/test_usb_hid_usages vendor/NetBSD/tests/dist/net/arp/ vendor/NetBSD/tests/dist/net/arp/CVS/ vendor/NetBSD/tests/dist/net/arp/CVS/Entries vendor/NetBSD/tests/dist/net/arp/CVS/Repository vendor/NetBSD/tests/dist/net/arp/CVS/Root vendor/NetBSD/tests/dist/net/arp/CVS/Tag vendor/NetBSD/tests/dist/net/arp/Makefile (contents, props changed) vendor/NetBSD/tests/dist/net/arp/t_arp.sh (contents, props changed) vendor/NetBSD/tests/dist/net/arp/t_dad.sh (contents, props changed) vendor/NetBSD/tests/dist/net/icmp/t_icmp6_redirect.sh (contents, props changed) vendor/NetBSD/tests/dist/net/icmp/t_icmp_redirect.sh (contents, props changed) vendor/NetBSD/tests/dist/net/if/ifconf.c (contents, props changed) vendor/NetBSD/tests/dist/net/if/t_ifconf.sh (contents, props changed) vendor/NetBSD/tests/dist/net/if/t_ifconfig.sh (contents, props changed) vendor/NetBSD/tests/dist/net/if_gif/ vendor/NetBSD/tests/dist/net/if_gif/CVS/ vendor/NetBSD/tests/dist/net/if_gif/CVS/Entries vendor/NetBSD/tests/dist/net/if_gif/CVS/Repository vendor/NetBSD/tests/dist/net/if_gif/CVS/Root vendor/NetBSD/tests/dist/net/if_gif/CVS/Tag vendor/NetBSD/tests/dist/net/if_gif/Makefile (contents, props changed) vendor/NetBSD/tests/dist/net/if_gif/t_gif.sh (contents, props changed) vendor/NetBSD/tests/dist/net/if_pppoe/ vendor/NetBSD/tests/dist/net/if_pppoe/CVS/ vendor/NetBSD/tests/dist/net/if_pppoe/CVS/Entries vendor/NetBSD/tests/dist/net/if_pppoe/CVS/Repository vendor/NetBSD/tests/dist/net/if_pppoe/CVS/Root vendor/NetBSD/tests/dist/net/if_pppoe/CVS/Tag vendor/NetBSD/tests/dist/net/if_pppoe/Makefile (contents, props changed) vendor/NetBSD/tests/dist/net/if_pppoe/t_pppoe.sh (contents, props changed) vendor/NetBSD/tests/dist/net/if_tap/ vendor/NetBSD/tests/dist/net/if_tap/CVS/ vendor/NetBSD/tests/dist/net/if_tap/CVS/Entries vendor/NetBSD/tests/dist/net/if_tap/CVS/Repository vendor/NetBSD/tests/dist/net/if_tap/CVS/Root vendor/NetBSD/tests/dist/net/if_tap/CVS/Tag vendor/NetBSD/tests/dist/net/if_tap/Makefile (contents, props changed) vendor/NetBSD/tests/dist/net/if_tap/t_tap.sh (contents, props changed) vendor/NetBSD/tests/dist/net/in_cksum/ vendor/NetBSD/tests/dist/net/in_cksum/CVS/ vendor/NetBSD/tests/dist/net/in_cksum/CVS/Entries vendor/NetBSD/tests/dist/net/in_cksum/CVS/Repository vendor/NetBSD/tests/dist/net/in_cksum/CVS/Root vendor/NetBSD/tests/dist/net/in_cksum/CVS/Tag vendor/NetBSD/tests/dist/net/in_cksum/Makefile (contents, props changed) vendor/NetBSD/tests/dist/net/in_cksum/assym.h (contents, props changed) vendor/NetBSD/tests/dist/net/in_cksum/in_cksum.c (contents, props changed) vendor/NetBSD/tests/dist/net/in_cksum/t_in_cksum.sh (contents, props changed) vendor/NetBSD/tests/dist/net/mcast/ vendor/NetBSD/tests/dist/net/mcast/CVS/ vendor/NetBSD/tests/dist/net/mcast/CVS/Entries vendor/NetBSD/tests/dist/net/mcast/CVS/Repository vendor/NetBSD/tests/dist/net/mcast/CVS/Root vendor/NetBSD/tests/dist/net/mcast/CVS/Tag vendor/NetBSD/tests/dist/net/mcast/Makefile (contents, props changed) vendor/NetBSD/tests/dist/net/mcast/mcast.c (contents, props changed) vendor/NetBSD/tests/dist/net/mcast/t_mcast.sh (contents, props changed) vendor/NetBSD/tests/dist/net/mpls/t_mpls_fw6.sh (contents, props changed) vendor/NetBSD/tests/dist/net/mpls/t_mpls_fw64.sh (contents, props changed) vendor/NetBSD/tests/dist/net/ndp/ vendor/NetBSD/tests/dist/net/ndp/CVS/ vendor/NetBSD/tests/dist/net/ndp/CVS/Entries vendor/NetBSD/tests/dist/net/ndp/CVS/Repository vendor/NetBSD/tests/dist/net/ndp/CVS/Root vendor/NetBSD/tests/dist/net/ndp/CVS/Tag vendor/NetBSD/tests/dist/net/ndp/Makefile (contents, props changed) vendor/NetBSD/tests/dist/net/ndp/t_dad.sh (contents, props changed) vendor/NetBSD/tests/dist/net/ndp/t_ndp.sh (contents, props changed) vendor/NetBSD/tests/dist/net/ndp/t_ra.sh (contents, props changed) vendor/NetBSD/tests/dist/net/net/t_forwarding.sh (contents, props changed) vendor/NetBSD/tests/dist/net/net/t_ipaddress.sh (contents, props changed) vendor/NetBSD/tests/dist/net/net/t_ipv6_lifetime.sh (contents, props changed) vendor/NetBSD/tests/dist/net/net/t_ipv6address.sh (contents, props changed) vendor/NetBSD/tests/dist/net/route/t_flags.sh (contents, props changed) vendor/NetBSD/tests/dist/net/route/t_flags6.sh (contents, props changed) vendor/NetBSD/tests/dist/net/route/t_route.sh (contents, props changed) vendor/NetBSD/tests/dist/rump/rumpkern/Makefile.inc (contents, props changed) vendor/NetBSD/tests/dist/sbin/gpt/ vendor/NetBSD/tests/dist/sbin/gpt/CVS/ vendor/NetBSD/tests/dist/sbin/gpt/CVS/Entries vendor/NetBSD/tests/dist/sbin/gpt/CVS/Repository vendor/NetBSD/tests/dist/sbin/gpt/CVS/Root vendor/NetBSD/tests/dist/sbin/gpt/CVS/Tag vendor/NetBSD/tests/dist/sbin/gpt/Makefile (contents, props changed) vendor/NetBSD/tests/dist/sbin/gpt/gpt.2part.show.label vendor/NetBSD/tests/dist/sbin/gpt/gpt.2part.show.normal vendor/NetBSD/tests/dist/sbin/gpt/gpt.2part.show.uuid vendor/NetBSD/tests/dist/sbin/gpt/gpt.backup (contents, props changed) vendor/NetBSD/tests/dist/sbin/gpt/gpt.disklabel vendor/NetBSD/tests/dist/sbin/gpt/gpt.disklabel.show.normal vendor/NetBSD/tests/dist/sbin/gpt/gpt.empty.show.normal vendor/NetBSD/tests/dist/sbin/gpt/gpt.removepart.show.normal vendor/NetBSD/tests/dist/sbin/gpt/gpt.resizedisk.show.normal vendor/NetBSD/tests/dist/sbin/gpt/gpt.resizepart.show.normal vendor/NetBSD/tests/dist/sbin/gpt/t_gpt.sh (contents, props changed) vendor/NetBSD/tests/dist/sbin/resize_ffs/t_check.sh (contents, props changed) vendor/NetBSD/tests/dist/sys/net/ vendor/NetBSD/tests/dist/sys/net/CVS/ vendor/NetBSD/tests/dist/sys/net/CVS/Entries vendor/NetBSD/tests/dist/sys/net/CVS/Repository vendor/NetBSD/tests/dist/sys/net/CVS/Root vendor/NetBSD/tests/dist/sys/net/CVS/Tag vendor/NetBSD/tests/dist/sys/net/Makefile (contents, props changed) vendor/NetBSD/tests/dist/sys/net/t_print.c (contents, props changed) vendor/NetBSD/tests/dist/sys/netatalk/ vendor/NetBSD/tests/dist/sys/netatalk/CVS/ vendor/NetBSD/tests/dist/sys/netatalk/CVS/Entries vendor/NetBSD/tests/dist/sys/netatalk/CVS/Repository vendor/NetBSD/tests/dist/sys/netatalk/CVS/Root vendor/NetBSD/tests/dist/sys/netatalk/CVS/Tag vendor/NetBSD/tests/dist/sys/netatalk/Makefile (contents, props changed) vendor/NetBSD/tests/dist/sys/netatalk/t_print.c (contents, props changed) vendor/NetBSD/tests/dist/sys/netinet/ vendor/NetBSD/tests/dist/sys/netinet/CVS/ vendor/NetBSD/tests/dist/sys/netinet/CVS/Entries vendor/NetBSD/tests/dist/sys/netinet/CVS/Repository vendor/NetBSD/tests/dist/sys/netinet/CVS/Root vendor/NetBSD/tests/dist/sys/netinet/CVS/Tag vendor/NetBSD/tests/dist/sys/netinet/Makefile (contents, props changed) vendor/NetBSD/tests/dist/sys/netinet/t_print.c (contents, props changed) vendor/NetBSD/tests/dist/sys/netinet6/ vendor/NetBSD/tests/dist/sys/netinet6/CVS/ vendor/NetBSD/tests/dist/sys/netinet6/CVS/Entries vendor/NetBSD/tests/dist/sys/netinet6/CVS/Repository vendor/NetBSD/tests/dist/sys/netinet6/CVS/Root vendor/NetBSD/tests/dist/sys/netinet6/CVS/Tag vendor/NetBSD/tests/dist/sys/netinet6/Makefile (contents, props changed) vendor/NetBSD/tests/dist/sys/netinet6/t_print.c (contents, props changed) vendor/NetBSD/tests/dist/usr.bin/config/d_min vendor/NetBSD/tests/dist/usr.bin/config/support/conf/Makefile.kern.inc (contents, props changed) vendor/NetBSD/tests/dist/usr.bin/gdb/ vendor/NetBSD/tests/dist/usr.bin/gdb/CVS/ vendor/NetBSD/tests/dist/usr.bin/gdb/CVS/Entries vendor/NetBSD/tests/dist/usr.bin/gdb/CVS/Repository vendor/NetBSD/tests/dist/usr.bin/gdb/CVS/Root vendor/NetBSD/tests/dist/usr.bin/gdb/CVS/Tag vendor/NetBSD/tests/dist/usr.bin/gdb/Makefile (contents, props changed) vendor/NetBSD/tests/dist/usr.bin/gdb/t_regress.sh (contents, props changed) vendor/NetBSD/tests/dist/usr.bin/ld/ vendor/NetBSD/tests/dist/usr.bin/ld/CVS/ vendor/NetBSD/tests/dist/usr.bin/ld/CVS/Entries vendor/NetBSD/tests/dist/usr.bin/ld/CVS/Repository vendor/NetBSD/tests/dist/usr.bin/ld/CVS/Root vendor/NetBSD/tests/dist/usr.bin/ld/CVS/Tag vendor/NetBSD/tests/dist/usr.bin/ld/Makefile (contents, props changed) vendor/NetBSD/tests/dist/usr.bin/ld/t_script.sh (contents, props changed) vendor/NetBSD/tests/dist/usr.bin/ld/t_section.sh (contents, props changed) vendor/NetBSD/tests/dist/usr.bin/netpgpverify/Testspec vendor/NetBSD/tests/dist/usr.bin/xlint/lint1/d_c99_anon_struct.c (contents, props changed) vendor/NetBSD/tests/dist/usr.bin/xlint/lint1/d_c99_compound_literal_comma.c (contents, props changed) vendor/NetBSD/tests/dist/usr.bin/xlint/lint1/d_c99_flex_array_packed.c (contents, props changed) vendor/NetBSD/tests/dist/usr.bin/xlint/lint1/d_c99_nested_struct.c (contents, props changed) vendor/NetBSD/tests/dist/usr.bin/xlint/lint1/d_c99_union_init4.c (contents, props changed) vendor/NetBSD/tests/dist/usr.bin/xlint/lint1/d_cast_fun_array_param.c (contents, props changed) vendor/NetBSD/tests/dist/usr.bin/xlint/lint1/d_type_question_colon.c (contents, props changed) vendor/NetBSD/tests/dist/usr.bin/xlint/lint1/d_typefun.c (contents, props changed) Deleted: vendor/NetBSD/tests/dist/bin/sh/t_compexit.sh vendor/NetBSD/tests/dist/dev/Makefile.inc vendor/NetBSD/tests/dist/fs/nfs/nfsservice/mountd.c vendor/NetBSD/tests/dist/fs/nfs/nfsservice/nfsd.c vendor/NetBSD/tests/dist/fs/nfs/nfsservice/rpcbind/ Modified: vendor/NetBSD/tests/dist/Makefile vendor/NetBSD/tests/dist/bin/cat/Makefile vendor/NetBSD/tests/dist/bin/cat/d_align.in vendor/NetBSD/tests/dist/bin/cat/d_align.out vendor/NetBSD/tests/dist/bin/cat/t_cat.sh vendor/NetBSD/tests/dist/bin/sh/Makefile vendor/NetBSD/tests/dist/bin/sh/dotcmd/Makefile vendor/NetBSD/tests/dist/bin/sh/dotcmd/scoped_command vendor/NetBSD/tests/dist/bin/sh/dotcmd/t_dotcmd.sh vendor/NetBSD/tests/dist/bin/sh/t_evaltested.sh vendor/NetBSD/tests/dist/bin/sh/t_exit.sh vendor/NetBSD/tests/dist/bin/sh/t_expand.sh vendor/NetBSD/tests/dist/bin/sh/t_fsplit.sh vendor/NetBSD/tests/dist/bin/sh/t_here.sh vendor/NetBSD/tests/dist/bin/sh/t_set_e.sh vendor/NetBSD/tests/dist/bin/sh/t_ulimit.sh vendor/NetBSD/tests/dist/bin/sh/t_varquote.sh vendor/NetBSD/tests/dist/bin/sh/t_wait.sh vendor/NetBSD/tests/dist/crypto/opencrypto/t_opencrypto.sh vendor/NetBSD/tests/dist/dev/Makefile vendor/NetBSD/tests/dist/dev/audio/Makefile vendor/NetBSD/tests/dist/dev/audio/t_pad_output.bz2.uue vendor/NetBSD/tests/dist/dev/dm/Makefile vendor/NetBSD/tests/dist/dev/dm/h_dm.c vendor/NetBSD/tests/dist/dev/md/Makefile vendor/NetBSD/tests/dist/dev/scsipi/Makefile vendor/NetBSD/tests/dist/dev/sysmon/Makefile vendor/NetBSD/tests/dist/dev/sysmon/t_swsensor.sh vendor/NetBSD/tests/dist/dev/sysmon/t_swwdog.c vendor/NetBSD/tests/dist/fs/Makefile.inc vendor/NetBSD/tests/dist/fs/common/fstest_lfs.c vendor/NetBSD/tests/dist/fs/common/h_fsmacros.h vendor/NetBSD/tests/dist/fs/ffs/Makefile vendor/NetBSD/tests/dist/fs/msdosfs/Makefile vendor/NetBSD/tests/dist/fs/nfs/Makefile vendor/NetBSD/tests/dist/fs/nfs/nfsservice/Makefile vendor/NetBSD/tests/dist/fs/nfs/nfsservice/rumpnfsd.c vendor/NetBSD/tests/dist/fs/nfs/t_rquotad.sh vendor/NetBSD/tests/dist/fs/puffs/h_dtfs/Makefile vendor/NetBSD/tests/dist/fs/tmpfs/t_vnd.sh vendor/NetBSD/tests/dist/fs/vfs/Makefile vendor/NetBSD/tests/dist/fs/vfs/t_io.c vendor/NetBSD/tests/dist/fs/vfs/t_renamerace.c vendor/NetBSD/tests/dist/fs/vfs/t_unpriv.c vendor/NetBSD/tests/dist/fs/vfs/t_vnops.c vendor/NetBSD/tests/dist/games/t_factor.sh vendor/NetBSD/tests/dist/h_macros.h vendor/NetBSD/tests/dist/include/sys/Makefile vendor/NetBSD/tests/dist/include/sys/t_bitops.c vendor/NetBSD/tests/dist/include/sys/t_cdefs.c vendor/NetBSD/tests/dist/include/sys/t_socket.c vendor/NetBSD/tests/dist/include/t_paths.c vendor/NetBSD/tests/dist/ipf/expected/n14 vendor/NetBSD/tests/dist/ipf/expected/n14_6 vendor/NetBSD/tests/dist/ipf/t_filter_parse.sh vendor/NetBSD/tests/dist/ipf/t_nat_exec.sh vendor/NetBSD/tests/dist/kernel/Makefile vendor/NetBSD/tests/dist/kernel/kqueue/Makefile vendor/NetBSD/tests/dist/kernel/kqueue/t_ioctl.c vendor/NetBSD/tests/dist/kernel/kqueue/t_proc1.c vendor/NetBSD/tests/dist/kernel/kqueue/t_proc2.c vendor/NetBSD/tests/dist/kernel/kqueue/t_proc3.c vendor/NetBSD/tests/dist/kernel/t_rnd.c vendor/NetBSD/tests/dist/kernel/tty/Makefile vendor/NetBSD/tests/dist/lib/Makefile vendor/NetBSD/tests/dist/lib/csu/Makefile vendor/NetBSD/tests/dist/lib/libbpfjit/Makefile vendor/NetBSD/tests/dist/lib/libbpfjit/t_bpfjit.c vendor/NetBSD/tests/dist/lib/libc/arch/ia64/return_one.S vendor/NetBSD/tests/dist/lib/libc/arch/powerpc/return_one.S vendor/NetBSD/tests/dist/lib/libc/arch/riscv/return_one.S vendor/NetBSD/tests/dist/lib/libc/db/Makefile vendor/NetBSD/tests/dist/lib/libc/db/t_db.sh vendor/NetBSD/tests/dist/lib/libc/gen/Makefile vendor/NetBSD/tests/dist/lib/libc/gen/execve/t_execve.c vendor/NetBSD/tests/dist/lib/libc/gen/isqemu.h vendor/NetBSD/tests/dist/lib/libc/gen/posix_spawn/t_spawn.c vendor/NetBSD/tests/dist/lib/libc/gen/t_floatunditf.c vendor/NetBSD/tests/dist/lib/libc/gen/t_fnmatch.c vendor/NetBSD/tests/dist/lib/libc/gen/t_fpsetmask.c vendor/NetBSD/tests/dist/lib/libc/gen/t_isnan.c vendor/NetBSD/tests/dist/lib/libc/gen/t_randomid.c vendor/NetBSD/tests/dist/lib/libc/gen/t_siginfo.c vendor/NetBSD/tests/dist/lib/libc/gen/t_sleep.c vendor/NetBSD/tests/dist/lib/libc/gen/t_time.c vendor/NetBSD/tests/dist/lib/libc/gen/t_vis.c vendor/NetBSD/tests/dist/lib/libc/hash/Makefile vendor/NetBSD/tests/dist/lib/libc/inet/Makefile vendor/NetBSD/tests/dist/lib/libc/inet/t_inet_network.c vendor/NetBSD/tests/dist/lib/libc/net/t_servent.sh vendor/NetBSD/tests/dist/lib/libc/rpc/t_rpc.c vendor/NetBSD/tests/dist/lib/libc/stdio/Makefile vendor/NetBSD/tests/dist/lib/libc/stdlib/Makefile vendor/NetBSD/tests/dist/lib/libc/stdlib/t_getenv.c vendor/NetBSD/tests/dist/lib/libc/stdlib/t_posix_memalign.c vendor/NetBSD/tests/dist/lib/libc/stdlib/t_strtod.c vendor/NetBSD/tests/dist/lib/libc/stdlib/t_strtol.c vendor/NetBSD/tests/dist/lib/libc/string/t_memset.c vendor/NetBSD/tests/dist/lib/libc/sync/Makefile vendor/NetBSD/tests/dist/lib/libc/sys/Makefile vendor/NetBSD/tests/dist/lib/libc/sys/t_connect.c vendor/NetBSD/tests/dist/lib/libc/sys/t_getrusage.c vendor/NetBSD/tests/dist/lib/libc/sys/t_kevent.c vendor/NetBSD/tests/dist/lib/libc/sys/t_mlock.c vendor/NetBSD/tests/dist/lib/libc/sys/t_mmap.c vendor/NetBSD/tests/dist/lib/libc/sys/t_mprotect.c vendor/NetBSD/tests/dist/lib/libc/sys/t_setrlimit.c vendor/NetBSD/tests/dist/lib/libc/sys/t_sigaction.c vendor/NetBSD/tests/dist/lib/libc/sys/t_sigqueue.c vendor/NetBSD/tests/dist/lib/libc/time/t_strptime.c vendor/NetBSD/tests/dist/lib/libc/tls/Makefile vendor/NetBSD/tests/dist/lib/libcurses/director/testlang_parse.y vendor/NetBSD/tests/dist/lib/libexecinfo/Makefile vendor/NetBSD/tests/dist/lib/libexecinfo/t_backtrace.c vendor/NetBSD/tests/dist/lib/libm/Makefile vendor/NetBSD/tests/dist/lib/libm/t_exp.c vendor/NetBSD/tests/dist/lib/libm/t_fmod.c vendor/NetBSD/tests/dist/lib/libm/t_ldexp.c vendor/NetBSD/tests/dist/lib/libm/t_log.c vendor/NetBSD/tests/dist/lib/libm/t_pow.c vendor/NetBSD/tests/dist/lib/libm/t_precision.c vendor/NetBSD/tests/dist/lib/libpthread/t_cond.c vendor/NetBSD/tests/dist/lib/libpthread/t_mutex.c vendor/NetBSD/tests/dist/lib/libpthread/t_rwlock.c vendor/NetBSD/tests/dist/lib/libpthread/t_sem.c vendor/NetBSD/tests/dist/lib/librumpclient/Makefile vendor/NetBSD/tests/dist/lib/librumpclient/t_exec.sh vendor/NetBSD/tests/dist/lib/librumpclient/t_fd.c vendor/NetBSD/tests/dist/lib/librumphijack/t_tcpip.sh vendor/NetBSD/tests/dist/lib/libsljit/Makefile vendor/NetBSD/tests/dist/lib/libutil/t_parsedate.c vendor/NetBSD/tests/dist/lib/semaphore/Makefile vendor/NetBSD/tests/dist/lib/semaphore/pthread/Makefile vendor/NetBSD/tests/dist/modules/Makefile vendor/NetBSD/tests/dist/modules/Makefile.inc vendor/NetBSD/tests/dist/net/Makefile vendor/NetBSD/tests/dist/net/Makefile.inc vendor/NetBSD/tests/dist/net/bpfilter/t_bpfilter.c vendor/NetBSD/tests/dist/net/bpfjit/Makefile vendor/NetBSD/tests/dist/net/bpfjit/t_bpfjit.c vendor/NetBSD/tests/dist/net/carp/Makefile vendor/NetBSD/tests/dist/net/icmp/Makefile vendor/NetBSD/tests/dist/net/icmp/t_forward.c vendor/NetBSD/tests/dist/net/icmp/t_ping.c vendor/NetBSD/tests/dist/net/icmp/t_ping2.sh vendor/NetBSD/tests/dist/net/if/Makefile vendor/NetBSD/tests/dist/net/if_bridge/t_bridge.sh vendor/NetBSD/tests/dist/net/if_loop/Makefile vendor/NetBSD/tests/dist/net/mpls/Makefile vendor/NetBSD/tests/dist/net/mpls/t_ldp_regen.sh vendor/NetBSD/tests/dist/net/mpls/t_mpls_fw.sh vendor/NetBSD/tests/dist/net/mpls/t_rfc4182.sh vendor/NetBSD/tests/dist/net/net/Makefile vendor/NetBSD/tests/dist/net/net/t_tcp.c vendor/NetBSD/tests/dist/net/route/Makefile vendor/NetBSD/tests/dist/net/route/t_change.sh vendor/NetBSD/tests/dist/rump/Makefile.inc vendor/NetBSD/tests/dist/rump/modautoload/Makefile vendor/NetBSD/tests/dist/rump/modautoload/t_modautoload.c vendor/NetBSD/tests/dist/rump/rumpkern/h_server/Makefile vendor/NetBSD/tests/dist/rump/rumpkern/h_server/h_simpleserver.c vendor/NetBSD/tests/dist/rump/rumpkern/t_lwproc.c vendor/NetBSD/tests/dist/rump/rumpkern/t_sp.sh vendor/NetBSD/tests/dist/rump/rumpnet/t_shmif.sh vendor/NetBSD/tests/dist/rump/rumpvfs/t_p2kifs.c vendor/NetBSD/tests/dist/sbin/Makefile vendor/NetBSD/tests/dist/sbin/resize_ffs/Makefile vendor/NetBSD/tests/dist/sbin/resize_ffs/common.sh vendor/NetBSD/tests/dist/sbin/resize_ffs/t_grow.sh vendor/NetBSD/tests/dist/sbin/resize_ffs/t_grow_swapped.sh vendor/NetBSD/tests/dist/sbin/resize_ffs/t_shrink.sh vendor/NetBSD/tests/dist/sbin/resize_ffs/t_shrink_swapped.sh vendor/NetBSD/tests/dist/sbin/sysctl/t_perm.sh vendor/NetBSD/tests/dist/share/mk/t_lib.sh vendor/NetBSD/tests/dist/share/mk/t_prog.sh vendor/NetBSD/tests/dist/share/mk/t_test.sh vendor/NetBSD/tests/dist/sys/Makefile vendor/NetBSD/tests/dist/usr.bin/Makefile vendor/NetBSD/tests/dist/usr.bin/cc/t_hello.sh vendor/NetBSD/tests/dist/usr.bin/config/Makefile vendor/NetBSD/tests/dist/usr.bin/config/support/arch/regress/conf/Makefile.regress vendor/NetBSD/tests/dist/usr.bin/config/support/conf/Makefile vendor/NetBSD/tests/dist/usr.bin/config/support/conf/files vendor/NetBSD/tests/dist/usr.bin/config/t_config.sh vendor/NetBSD/tests/dist/usr.bin/make/t_make.sh vendor/NetBSD/tests/dist/usr.bin/netpgpverify/t_netpgpverify.sh vendor/NetBSD/tests/dist/usr.bin/sed/t_sed.sh vendor/NetBSD/tests/dist/usr.bin/sort/d_any_char_dflag_out.txt (contents, props changed) vendor/NetBSD/tests/dist/usr.bin/sort/d_any_char_fflag_out.txt (contents, props changed) vendor/NetBSD/tests/dist/usr.bin/sort/d_any_char_iflag_out.txt (contents, props changed) vendor/NetBSD/tests/dist/usr.bin/xlint/lint1/Makefile vendor/NetBSD/tests/dist/usr.sbin/traceroute/t_traceroute.sh Modified: vendor/NetBSD/tests/dist/Makefile ============================================================================== --- vendor/NetBSD/tests/dist/Makefile Fri Aug 12 00:00:08 2016 (r303979) +++ vendor/NetBSD/tests/dist/Makefile Fri Aug 12 01:05:07 2016 (r303980) @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.44 2013/02/25 00:33:19 jmmv Exp $ +# $NetBSD: Makefile,v 1.45 2015/06/22 00:05:23 matt Exp $ .include @@ -9,7 +9,7 @@ TESTSDIR= ${TESTSBASE} TESTS_SUBDIRS= bin dev games include kernel lib libexec net TESTS_SUBDIRS+= sbin sys usr.bin usr.sbin -. if (${MKRUMP} != "no") +. if (${MKRUMP} != "no") && !defined(BSD_MK_COMPAT_FILE) TESTS_SUBDIRS+= fs rump . if ${MKKMOD} != "no" Modified: vendor/NetBSD/tests/dist/bin/cat/Makefile ============================================================================== --- vendor/NetBSD/tests/dist/bin/cat/Makefile Fri Aug 12 00:00:08 2016 (r303979) +++ vendor/NetBSD/tests/dist/bin/cat/Makefile Fri Aug 12 01:05:07 2016 (r303980) @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.1 2012/03/27 08:16:33 jruoho Exp $ +# $NetBSD: Makefile,v 1.2 2016/06/16 01:04:58 sevan Exp $ .include @@ -8,5 +8,7 @@ TESTS_SH= t_cat FILESDIR= ${TESTSDIR} FILES+= d_align.in FILES+= d_align.out +FILES+= d_se_output.in +FILES+= d_se_output.out .include Modified: vendor/NetBSD/tests/dist/bin/cat/d_align.in ============================================================================== --- vendor/NetBSD/tests/dist/bin/cat/d_align.in Fri Aug 12 00:00:08 2016 (r303979) +++ vendor/NetBSD/tests/dist/bin/cat/d_align.in Fri Aug 12 01:05:07 2016 (r303980) @@ -1,3 +1,5 @@ a b c + 1 2 3 + x y z Modified: vendor/NetBSD/tests/dist/bin/cat/d_align.out ============================================================================== --- vendor/NetBSD/tests/dist/bin/cat/d_align.out Fri Aug 12 00:00:08 2016 (r303979) +++ vendor/NetBSD/tests/dist/bin/cat/d_align.out Fri Aug 12 01:05:07 2016 (r303980) @@ -1,3 +1,5 @@ 1 a b c$ + $ 2 1 2 3$ + $ 3 x y z$ Added: vendor/NetBSD/tests/dist/bin/cat/d_se_output.in ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/NetBSD/tests/dist/bin/cat/d_se_output.in Fri Aug 12 01:05:07 2016 (r303980) @@ -0,0 +1,3 @@ + +Of course it runs NetBSD + Added: vendor/NetBSD/tests/dist/bin/cat/d_se_output.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/NetBSD/tests/dist/bin/cat/d_se_output.out Fri Aug 12 01:05:07 2016 (r303980) @@ -0,0 +1,3 @@ +$ +Of course it runs NetBSD$ +$ Modified: vendor/NetBSD/tests/dist/bin/cat/t_cat.sh ============================================================================== --- vendor/NetBSD/tests/dist/bin/cat/t_cat.sh Fri Aug 12 00:00:08 2016 (r303979) +++ vendor/NetBSD/tests/dist/bin/cat/t_cat.sh Fri Aug 12 01:05:07 2016 (r303980) @@ -1,4 +1,4 @@ -# $NetBSD: t_cat.sh,v 1.2 2012/03/27 17:57:02 jruoho Exp $ +# $NetBSD: t_cat.sh,v 1.3 2016/06/16 01:04:58 sevan Exp $ # # Copyright (c) 2012 The NetBSD Foundation, Inc. # All rights reserved. @@ -52,8 +52,20 @@ nonexistent_body() { -x "cat /some/name/that/does/not/exist" } +atf_test_case se_output +se_output_head() { + atf_set "descr" "Test that cat(1) prints a $ sign " \ + "on blank lines with options '-se' (PR bin/51250)" +} + +se_output_body() { + atf_check -s ignore -o file:$(atf_get_srcdir)/d_se_output.out \ + -x "cat -se $(atf_get_srcdir)/d_se_output.in" +} + atf_init_test_cases() { atf_add_test_case align atf_add_test_case nonexistent + atf_add_test_case se_output } Modified: vendor/NetBSD/tests/dist/bin/sh/Makefile ============================================================================== --- vendor/NetBSD/tests/dist/bin/sh/Makefile Fri Aug 12 00:00:08 2016 (r303979) +++ vendor/NetBSD/tests/dist/bin/sh/Makefile Fri Aug 12 01:05:07 2016 (r303980) @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.4 2014/09/11 18:25:30 dholland Exp $ +# $NetBSD: Makefile,v 1.11 2016/03/20 22:57:04 christos Exp $ # .include @@ -7,15 +7,21 @@ TESTSDIR = ${TESTSBASE}/bin/sh TESTS_SUBDIRS += dotcmd -TESTS_SH= t_compexit +TESTS_SH+= t_arith +TESTS_SH+= t_cmdsub +TESTS_SH+= t_evaltested TESTS_SH+= t_exit TESTS_SH+= t_expand -TESTS_SH+= t_evaltested TESTS_SH+= t_fsplit TESTS_SH+= t_here +TESTS_SH+= t_option +TESTS_SH+= t_redir +TESTS_SH+= t_redircloexec TESTS_SH+= t_set_e +TESTS_SH+= t_shift TESTS_SH+= t_ulimit TESTS_SH+= t_varquote +TESTS_SH+= t_varval TESTS_SH+= t_wait .include Modified: vendor/NetBSD/tests/dist/bin/sh/dotcmd/Makefile ============================================================================== --- vendor/NetBSD/tests/dist/bin/sh/dotcmd/Makefile Fri Aug 12 00:00:08 2016 (r303979) +++ vendor/NetBSD/tests/dist/bin/sh/dotcmd/Makefile Fri Aug 12 01:05:07 2016 (r303980) @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.2 2014/07/27 14:24:17 apb Exp $ +# $NetBSD: Makefile,v 1.3 2016/03/27 14:57:50 christos Exp $ # .include @@ -7,6 +7,10 @@ TESTSDIR = ${TESTSBASE}/bin/sh/dotcmd TESTS_SH = t_dotcmd +.if !defined(TEST_SH) +TEST_SH = ${HOST_SH} +.endif + FILESDIR = ${TESTSDIR}/out # Testing scripts: dotcmd in various scopes includes a file with @@ -19,7 +23,7 @@ FILESDIR_${cmd}_${cmd_scope} = ${TESTSDI FILESBUILD_${cmd}_${cmd_scope} = yes ${cmd}_${cmd_scope}: scoped_command - ${HOST_SH} ${.CURDIR}/scoped_command '${cmd_scope}' '${cmd}' '${cmd}' \ + ${TEST_SH} ${.CURDIR}/scoped_command '${cmd_scope}' '${cmd}' '${cmd}' \ >'${.TARGET}' . for dot_scope in case compound file for func subshell until while @@ -31,7 +35,7 @@ FILESBUILD_${dot_scope}_${cmd}_${cmd_sco FILESMODE_${dot_scope}_${cmd}_${cmd_scope} = ${BINMODE} ${dot_scope}_${cmd}_${cmd_scope}: scoped_command - ${HOST_SH} ${.CURDIR}/scoped_command '${dot_scope}' \ + ${TEST_SH} ${.CURDIR}/scoped_command '${dot_scope}' \ '. "${cmd}_${cmd_scope}"' 'dotcmd' 'dotcmd' >'${.TARGET}' . endfor . endfor Modified: vendor/NetBSD/tests/dist/bin/sh/dotcmd/scoped_command ============================================================================== --- vendor/NetBSD/tests/dist/bin/sh/dotcmd/scoped_command Fri Aug 12 00:00:08 2016 (r303979) +++ vendor/NetBSD/tests/dist/bin/sh/dotcmd/scoped_command Fri Aug 12 01:05:07 2016 (r303980) @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: scoped_command,v 1.1 2014/05/31 14:29:06 christos Exp $ +# $NetBSD: scoped_command,v 1.2 2016/03/27 14:57:50 christos Exp $ # # Copyright (c) 2014 The NetBSD Foundation, Inc. # All rights reserved. @@ -30,6 +30,27 @@ # POSSIBILITY OF SUCH DAMAGE. # +: ${TEST_SH:=/bin/sh} + +sane_sh() +{ + set -- ${TEST_SH} + case "$#" in + (0) set /bin/sh;; + (1|2) ;; + (*) set "$1";; # Just ignore options if we cannot make them work + esac + + case "$1" in + /*) TEST_SH="$1${2+ }$2";; + ./*) TEST_SH="${PWD}${1#.}${2+ }$2";; + */*) TEST_SH="${PWD}/$1${2+ }$2";; + *) TEST_SH="$( command -v "$1" )${2+ }$2";; + esac +} + +sane_sh + set -e # USAGE: @@ -52,7 +73,7 @@ cmd="echo 'before ${3}' ${2} echo 'after ${3}, return value:' ${?}" -echo "#!/bin/sh" +echo "#!${TEST_SH}" [ 'func' = "${1}" ] && cat </dev/null + then + # 16 bits or less, or hex unsupported, just give up... + return + fi + test $( ${TEST_SH} -c 'echo $(( 0x1FFFF ))' ) = 131071 || return + + # when attempting to exceed the number of available bits + # the shell may react in any of 3 (rational) ways + # 1. syntax error (maybe even core dump...) and fail + # 2. represent a positive number input as negative value + # 3. keep the number positive, but not the value expected + # (perhaps pegged at the max possible value) + # any of those may be accompanied by a message to stderr + + # Must check all 3 possibilities for each plausible size + # Tests do not use 0x8000... because that value can have weird + # other side effects that are not relevant to discover here. + # But we do want to try and force the sign bit set. + + if ! ${TEST_SH} -c ': $(( 0xC0000000 ))' 2>/dev/null + then + # proobably shell detected overflow and complained + ARITH_BITS=32 + return + fi + if ${TEST_SH} 2>/dev/null \ + -c 'case $(( 0xC0000000 )); in (-*) exit 0;; esac; exit 1' + then + ARITH_BITS=32 + return + fi + if ${TEST_SH} -c '[ $(( 0xC0000000 )) != 3221225472 ]' 2>/dev/null + then + ARITH_BITS=32 + return + fi + + if ! ${TEST_SH} -c ': $(( 0xC000000000000000 ))' 2>/dev/null + then + ARITH_BITS=64 + return + fi + if ${TEST_SH} 2>/dev/null \ + -c 'case $(( 0xC000000000000000 )); in (-*) exit 0;; esac; exit 1' + then + ARITH_BITS=64 + return + fi + if ${TEST_SH} 2>/dev/null \ + -c '[ $((0xC000000000000000)) != 13835058055282163712 ]' + then + ARITH_BITS=64 + return + fi + + if ${TEST_SH} 2>/dev/null -c \ + '[ $((0x123456781234567812345678)) = 5634002657842756053938493048 ]' + then + # just assume... (for now anyway, revisit when it happens...) + ARITH_BITS=96 + return + fi +} + +atf_test_case constants +constants_head() +{ + atf_set "descr" "Tests that arithmetic expansion can handle constants" +} +constants_body() +{ + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 1 ))' + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0 ))' + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $((0x0))' + + # atf_expect_fail "PR bin/50959" + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $((0X0))' + # atf_expect_pass + + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $((000))' + + atf_check -s exit:0 -o inline:'1\n' -e empty \ + ${TEST_SH} -c 'echo $(( 000000001 ))' + atf_check -s exit:0 -o inline:'0\n' -e empty \ + ${TEST_SH} -c 'echo $(( 0x000000 ))' + + atf_check -s exit:0 -o inline:'99999\n' -e empty \ + ${TEST_SH} -c 'echo $((99999))' + + [ ${ARITH_BITS} -gt 44 ] && + atf_check -s exit:0 -o inline:'9191919191919\n' -e empty \ + ${TEST_SH} -c 'echo $((9191919191919))' + + atf_check -s exit:0 -o inline:'13\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0xD ))' + atf_check -s exit:0 -o inline:'11\n' -e empty ${TEST_SH} -c \ + 'echo $(( 013 ))' + atf_check -s exit:0 -o inline:'7\n' -e empty ${TEST_SH} -c \ + 'x=7;echo $(($x))' + atf_check -s exit:0 -o inline:'9\n' -e empty ${TEST_SH} -c \ + 'x=9;echo $((x))' + + atf_check -s exit:0 -o inline:'11\n' -e empty \ + ${TEST_SH} -c 'x=0xB; echo $(( $x ))' + atf_check -s exit:0 -o inline:'27\n' -e empty \ + ${TEST_SH} -c 'x=0X1B; echo $(( x ))' + atf_check -s exit:0 -o inline:'27\n' -e empty \ + ${TEST_SH} -c 'X=033; echo $(( $X ))' + atf_check -s exit:0 -o inline:'219\n' -e empty \ + ${TEST_SH} -c 'X=0333; echo $(( X ))' + atf_check -s exit:0 -o inline:'0\n' -e empty \ + ${TEST_SH} -c 'NULL=; echo $(( NULL ))' + + # Not clear if this is 0, nothing, or an error, so omit for now + # atf_check -s exit:0 -o inline:'0\n' -e empty \ + # ${TEST_SH} -c 'echo $(( ))' + + # not clear whether this should return 0 or an error, so omit for now + # atf_check -s exit:0 -o inline:'0\n' -e empty \ + # ${TEST_SH} -c 'echo $(( UNDEFINED_VAR ))' +} + + +atf_test_case do_unary_plus +do_unary_plus_head() +{ + atf_set "descr" "Tests that unary plus works as expected" +} +do_unary_plus_body() +{ + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( +0 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( +1 ))' + atf_check -s exit:0 -o inline:'6\n' -e empty ${TEST_SH} -c \ + 'echo $(( + 6 ))' + atf_check -s exit:0 -o inline:'4321\n' -e empty ${TEST_SH} -c \ + 'echo $(( + 4321 ))' + atf_check -s exit:0 -o inline:'17185\n' -e empty ${TEST_SH} -c \ + 'echo $(( + 0x4321 ))' +} + +atf_test_case do_unary_minus +do_unary_minus_head() +{ + atf_set "descr" "Tests that unary minus works as expected" +} +do_unary_minus_body() +{ + atf_check -s exit:0 -o inline:'-1\n' -e empty ${TEST_SH} -c \ + 'echo $(( -1 ))' + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( - 0 ))' + atf_check -s exit:0 -o inline:'-1\n' -e empty ${TEST_SH} -c \ + 'echo $(( - 1 ))' + atf_check -s exit:0 -o inline:'-6\n' -e empty ${TEST_SH} -c \ + 'echo $(( - 6 ))' + atf_check -s exit:0 -o inline:'-4321\n' -e empty ${TEST_SH} -c \ + 'echo $(( - 4321 ))' + atf_check -s exit:0 -o inline:'-2257\n' -e empty ${TEST_SH} -c \ + 'echo $(( - 04321 ))' + atf_check -s exit:0 -o inline:'-7\n' -e empty ${TEST_SH} -c \ + 'echo $((-7))' +} + +atf_test_case do_unary_not +do_unary_not_head() +{ + atf_set "descr" "Tests that unary not (boolean) works as expected" +} +do_unary_not_body() +{ + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( ! 1 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( ! 0 ))' + + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( !1234 ))' + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( !0xFFFF ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( ! 000000 ))' +} + +atf_test_case do_unary_tilde +do_unary_tilde_head() +{ + atf_set "descr" "Tests that unary not (bitwise) works as expected" +} +do_unary_tilde_body() +{ + # definitely 2's complement arithmetic here... + + atf_check -s exit:0 -o inline:'-1\n' -e empty ${TEST_SH} -c \ + 'echo $(( ~ 0 ))' + atf_check -s exit:0 -o inline:'-2\n' -e empty ${TEST_SH} -c \ + 'echo $(( ~ 1 ))' + + atf_check -s exit:0 -o inline:'-1235\n' -e empty ${TEST_SH} -c \ + 'echo $(( ~1234 ))' + atf_check -s exit:0 -o inline:'-256\n' -e empty ${TEST_SH} -c \ + 'echo $(( ~0xFF ))' +} + +atf_test_case elementary_add +elementary_add_head() +{ + atf_set "descr" "Tests that simple addition works as expected" +} +elementary_add_body() +{ + # some of these tests actually test unary ops & op precedence... + + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0 + 0 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 1 + 0 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0 + 1 ))' + atf_check -s exit:0 -o inline:'2\n' -e empty ${TEST_SH} -c \ + 'echo $(( 1 + 1 ))' + atf_check -s exit:0 -o inline:'10\n' -e empty ${TEST_SH} -c \ + 'echo $(( 4 + 6 ))' + atf_check -s exit:0 -o inline:'10\n' -e empty ${TEST_SH} -c \ + 'echo $(( 6 + 4 ))' + atf_check -s exit:0 -o inline:'5555\n' -e empty ${TEST_SH} -c \ + 'echo $(( 1234 + 4321 ))' + atf_check -s exit:0 -o inline:'3333\n' -e empty ${TEST_SH} -c \ + 'echo $((1111+2222))' + atf_check -s exit:0 -o inline:'5555\n' -e empty ${TEST_SH} -c \ + 'echo $((+3333+2222))' + atf_check -s exit:0 -o inline:'7777\n' -e empty ${TEST_SH} -c \ + 'echo $((+3333 + +4444))' + atf_check -s exit:0 -o inline:'-7777\n' -e empty ${TEST_SH} -c \ + 'echo -$((+4125+ +3652))' +} + +atf_test_case elementary_sub +elementary_sub_head() +{ + atf_set "descr" "Tests that simple subtraction works as expected" +} +elementary_sub_body() +{ + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0 - 0 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 1 - 0 ))' + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 1 - 1 ))' + atf_check -s exit:0 -o inline:'-1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0 - 1 ))' + atf_check -s exit:0 -o inline:'488\n' -e empty ${TEST_SH} -c \ + 'echo $(( 1066 - 578 ))' + atf_check -s exit:0 -o inline:'-3662\n' -e empty ${TEST_SH} -c \ + 'echo $(( 2016-5678 ))' + atf_check -s exit:0 -o inline:'-3662\n' -e empty ${TEST_SH} -c \ + 'echo $(( 2016+-5678 ))' + atf_check -s exit:0 -o inline:'-3662\n' -e empty ${TEST_SH} -c \ + 'echo $(( 2016-+5678 ))' + atf_check -s exit:0 -o inline:'-7694\n' -e empty ${TEST_SH} -c \ + 'echo $(( -2016-5678 ))' + atf_check -s exit:0 -o inline:'--1\n' -e empty ${TEST_SH} -c \ + 'echo -$(( -1018 - -1017 ))' +} + +atf_test_case elementary_mul +elementary_mul_head() +{ + atf_set "descr" "Tests that simple multiplication works as expected" +} +elementary_mul_body() +{ + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0 * 0 ))' + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 1 * 0 ))' + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0 * 1 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 1 * 1 ))' + atf_check -s exit:0 -o inline:'-1\n' -e empty ${TEST_SH} -c \ + 'echo $(( -1 * 1 ))' + atf_check -s exit:0 -o inline:'-1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 1 * -1 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( -1 * -1 ))' + atf_check -s exit:0 -o inline:'391\n' -e empty ${TEST_SH} -c \ + 'echo $(( 17 * 23 ))' + atf_check -s exit:0 -o inline:'169\n' -e empty ${TEST_SH} -c \ + 'echo $(( 13*13 ))' + atf_check -s exit:0 -o inline:'-11264\n' -e empty ${TEST_SH} -c \ + 'echo $(( -11 *1024 ))' + atf_check -s exit:0 -o inline:'-16983\n' -e empty ${TEST_SH} -c \ + 'echo $(( 17* -999 ))' + atf_check -s exit:0 -o inline:'9309\n' -e empty ${TEST_SH} -c \ + 'echo $(( -29*-321 ))' +} + +atf_test_case elementary_div +elementary_div_head() +{ + atf_set "descr" "Tests that simple division works as expected" +} +elementary_div_body() +{ + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0 / 1 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 1 / 1 ))' + test ${ARITH_BITS} -ge 38 && + atf_check -s exit:0 -o inline:'99999999999\n' -e empty \ + ${TEST_SH} -c 'echo $(( 99999999999 / 1 ))' + atf_check -s exit:0 -o inline:'2\n' -e empty ${TEST_SH} -c \ + 'echo $(( 2 / 1 ))' + + atf_check -s exit:0 -o inline:'3\n' -e empty ${TEST_SH} -c \ + 'echo $(( 3 / 1 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 3 / 2 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 3 / 3 ))' + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 3 / 4 ))' + + atf_check -s exit:0 -o inline:'173\n' -e empty ${TEST_SH} -c \ + 'echo $(( 123456 / 713 ))' + atf_check -s exit:0 -o inline:'13\n' -e empty ${TEST_SH} -c \ + 'echo $(( 169 / 13 ))' +} + +atf_test_case elementary_rem +elementary_rem_head() +{ + atf_set "descr" "Tests that simple modulus works as expected" +} +elementary_rem_body() +{ + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0 % 1 ))' + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 1 % 1 ))' + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 2 % 1 ))' + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 9999 % 1 ))' + + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0 % 2 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 1 % 2 ))' + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 2 % 2 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0xFFFF % 2 ))' + + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0 % 3 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 1 % 3 ))' + atf_check -s exit:0 -o inline:'2\n' -e empty ${TEST_SH} -c \ + 'echo $(( 2 % 3 ))' + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 3 % 3 ))' + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 3123 % 3 ))' + + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 9999 % 2 ))' + + atf_check -s exit:0 -o inline:'107\n' -e empty ${TEST_SH} -c \ + 'echo $(( 123456%173 ))' + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $((169%13))' +} + +atf_test_case elementary_shl +elementary_shl_head() +{ + atf_set "descr" "Tests that simple shift left works as expected" +} +elementary_shl_body() +{ + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0 << 0 ))' + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0 << 1 ))' + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0 << 17 ))' + + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 1 << 0 ))' + atf_check -s exit:0 -o inline:'2\n' -e empty ${TEST_SH} -c \ + 'echo $(( 1 << 1 ))' + atf_check -s exit:0 -o inline:'131072\n' -e empty ${TEST_SH} -c \ + 'echo $(( 1 << 17 ))' + + atf_check -s exit:0 -o inline:'2021161080\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0x3C3C3C3C << 1 ))' + + test "${ARITH_BITS}" -ge 40 && + atf_check -s exit:0 -o inline:'129354309120\n' -e empty \ + ${TEST_SH} -c 'echo $(( 0x3C3C3C3C << 7 ))' + test "${ARITH_BITS}" -ge 72 && + atf_check -s exit:0 -o inline:'1111145054534149079040\n' \ + -e empty ${TEST_SH} -c 'echo $(( 0x3C3C3C3C << 40 ))' + + return 0 +} + +atf_test_case elementary_shr +elementary_shr_head() +{ + atf_set "descr" "Tests that simple shift right works as expected" +} +elementary_shr_body() +{ + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0 >> 0 ))' + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0 >> 1 ))' + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0 >> 17 ))' + + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 1 >> 0 ))' + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 1 >> 1 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 2 >> 1 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 3 >> 1 ))' + + atf_check -s exit:0 -o inline:'4\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0x10 >> 2 ))' + atf_check -s exit:0 -o inline:'4\n' -e empty ${TEST_SH} -c \ + 'echo $(( 022 >> 2 ))' + + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 131072 >> 17 ))' + + test ${ARITH_BITS} -ge 40 && + atf_check -s exit:0 -o inline:'8\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0x4000000000 >> 35 ))' + test ${ARITH_BITS} -ge 80 && + atf_check -s exit:0 -o inline:'4464\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0x93400FACE005C871000 >> 64 ))' + + return 0 +} + +atf_test_case elementary_eq +elementary_eq_head() +{ + atf_set "descr" "Tests that simple equality test works as expected" +} +elementary_eq_body() +{ + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0 == 0 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0 == 0000 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0 == 0x00 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 1 == 1 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'X=30; Y=0x1E; echo $(( X == Y ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0x1234 == 4660 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0x1234 == 011064 ))' + + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0 == 1 ))' + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0 == 0000000000000001 ))' + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0 == 0x10000000000000 ))' + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 1 == 2 ))' + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'X=3; Y=7; echo $(( X == Y ))' + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 1234 == 0x4660 ))' + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 01234 == 0x11064 ))' +} +atf_test_case elementary_ne +elementary_ne_head() +{ + atf_set "descr" "Tests that simple inequality test works as expected" +} +elementary_ne_body() +{ + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 1 != 0 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0x71 != 17 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 1234 != 01234 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0x1234 != 01234 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'X=3; echo $(( X != 0 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'X=3; Y=0x11; echo $(( X != Y ))' + + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 3 != 3 ))' + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0 != 0x0 ))' + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0xA != 012 ))' + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'X=1; echo $(( X != 1 ))' + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'X=0xC; Y=014; echo $(( X != Y ))' +} +atf_test_case elementary_lt +elementary_lt_head() +{ + atf_set "descr" "Tests that simple less than test works as expected" +} +elementary_lt_body() +{ + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0 < 1 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( -1 < 0 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0 < 10 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 100 < 101 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0xA1 < 200 ))' + + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0 < 0 ))' + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 1 < 0 ))' + + test ${ARITH_BITS} -ge 40 && + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0x1BEEFF00D < 0x1FACECAFE ))' + + return 0 +} +atf_test_case elementary_le +elementary_le_head() +{ + atf_set "descr" "Tests that simple less or equal test works as expected" +} +elementary_le_body() +{ + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0 <= 1 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( -1 <= 0 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0 <= 0 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0 <= 10 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 100 <= 101 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0xA1 <= 161 ))' + + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 1 <= 0 ))' + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( -100 <= -200 ))' + + test ${ARITH_BITS} -ge 40 && + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'cost=; AUD=; echo $(( $cost 0x2FEEDBABE <= $AUD 12866927294 ))' + + return 0 +} +atf_test_case elementary_gt +elementary_gt_head() +{ + atf_set "descr" "Tests that simple greater than works as expected" +} +elementary_gt_body() +{ + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 1 > 0 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 1 > -1 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 11 > 012 ))' + + # atf_expect_fail "PR bin/50959" + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 2147483647 > 0X7FFFFF0 ))' + # atf_expect_pass + + test ${ARITH_BITS} -gt 32 && + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0x80000000 > 0x7FFFFFFF ))' + + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0 > 0 ))' + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0 > 1 ))' + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( -1 > 0 ))' + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0 > 10 ))' + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 2015 > 2016 ))' + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0xA1 > 200 ))' + + test ${ARITH_BITS} -ge 44 && + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0x7F07F07F0 > 34099628014 ))' + + return 0 +} +atf_test_case elementary_ge +elementary_ge_head() +{ + atf_set "descr" "Tests that simple greater or equal works as expected" +} +elementary_ge_body() +{ + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0 >= 0 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 1 >= 0 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( -100 >= -101 ))' + + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( -1 >= 0 ))' +} + +atf_test_case fiddle_bits_and +fiddle_bits_and_head() +{ + atf_set "descr" "Test bitwise and operations in arithmetic expressions" +} +fiddle_bits_and_body() +{ + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0 & 0 ))' + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 1 & 0 ))' + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0 & 1 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 1 & 1 ))' + + atf_check -s exit:0 -o inline:'255\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0xFF & 0xFF ))' + atf_check -s exit:0 -o inline:'255\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0xFFFF & 0377 ))' + + test "${ARITH_BITS}" -ge 48 && + atf_check -s exit:0 -o inline:'70377641607203\n' -e empty \ + ${TEST_SH} -c 'echo $(( 0x5432FEDC0123 & 0x42871357BAB3 ))' + + return 0 +} +atf_test_case fiddle_bits_or +fiddle_bits_or_head() +{ + atf_set "descr" "Test bitwise or operations in arithmetic expressions" +} +fiddle_bits_or_body() +{ + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0 | 0 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 1 | 0 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0 | 1 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 1 | 1 ))' + + atf_check -s exit:0 -o inline:'4369\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0x1111 | 0x1111 ))' + atf_check -s exit:0 -o inline:'255\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0xAA | 0125 ))' + + test "${ARITH_BITS}" -ge 48 && + atf_check -s exit:0 -o inline:'95348271856563\n' -e empty \ + ${TEST_SH} -c 'echo $(( 0x5432FEDC0123 | 0x42871357BAB3 ))' + + return 0 +} +atf_test_case fiddle_bits_xor +fiddle_bits_xor_head() +{ + atf_set "descr" "Test bitwise xor operations in arithmetic expressions" +} +fiddle_bits_xor_body() +{ + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0 ^ 0 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 1 ^ 0 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0 ^ 1 ))' + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 1 ^ 1 ))' + + atf_check -s exit:0 -o inline:'255\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0xF0 ^ 0x0F ))' + atf_check -s exit:0 -o inline:'15\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0xF0 ^ 0xFF ))' + + test "${ARITH_BITS}" -ge 48 && + atf_check -s exit:0 -o inline:'24970630249360\n' -e empty \ + ${TEST_SH} -c 'echo $(( 0x5432FEDC0123 ^ 0x42871357BAB3 ))' + + return 0 +} + +atf_test_case logical_and *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-vendor@freebsd.org Fri Aug 12 06:16:15 2016 Return-Path: Delivered-To: svn-src-vendor@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AD750BB75DF; Fri, 12 Aug 2016 06:16:15 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7C2A41B40; Fri, 12 Aug 2016 06:16:15 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7C6GEpB088886; Fri, 12 Aug 2016 06:16:14 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7C6GERs088885; Fri, 12 Aug 2016 06:16:14 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201608120616.u7C6GERs088885@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Fri, 12 Aug 2016 06:16:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r303986 - in vendor/NetBSD/tests/dist: dev/fss/CVS dev/usb/CVS dev/usb/libhid/CVS dev/usb/t_hid/CVS lib/libusbhid/CVS net/arp/CVS net/if_gif/CVS net/if_pppoe/CVS net/if_tap/CVS net/in_c... X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Aug 2016 06:16:15 -0000 Author: ngie Date: Fri Aug 12 06:16:14 2016 New Revision: 303986 URL: https://svnweb.freebsd.org/changeset/base/303986 Log: Remove CVS directories accidentally added in r303980 Deleted: vendor/NetBSD/tests/dist/dev/fss/CVS/ vendor/NetBSD/tests/dist/dev/usb/CVS/ vendor/NetBSD/tests/dist/dev/usb/libhid/CVS/ vendor/NetBSD/tests/dist/dev/usb/t_hid/CVS/ vendor/NetBSD/tests/dist/lib/libusbhid/CVS/ vendor/NetBSD/tests/dist/net/arp/CVS/ vendor/NetBSD/tests/dist/net/if_gif/CVS/ vendor/NetBSD/tests/dist/net/if_pppoe/CVS/ vendor/NetBSD/tests/dist/net/if_tap/CVS/ vendor/NetBSD/tests/dist/net/in_cksum/CVS/ vendor/NetBSD/tests/dist/net/mcast/CVS/ vendor/NetBSD/tests/dist/net/ndp/CVS/ vendor/NetBSD/tests/dist/sbin/gpt/CVS/ vendor/NetBSD/tests/dist/sys/net/CVS/ vendor/NetBSD/tests/dist/sys/netatalk/CVS/ vendor/NetBSD/tests/dist/sys/netinet/CVS/ vendor/NetBSD/tests/dist/sys/netinet6/CVS/ vendor/NetBSD/tests/dist/usr.bin/gdb/CVS/ vendor/NetBSD/tests/dist/usr.bin/ld/CVS/ From owner-svn-src-vendor@freebsd.org Fri Aug 12 06:19:42 2016 Return-Path: Delivered-To: svn-src-vendor@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 093D3BB7643; Fri, 12 Aug 2016 06:19:42 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B40AF1CCC; Fri, 12 Aug 2016 06:19:41 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7C6Je3x089037; Fri, 12 Aug 2016 06:19:40 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7C6Jevc089036; Fri, 12 Aug 2016 06:19:40 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201608120619.u7C6Jevc089036@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Fri, 12 Aug 2016 06:19:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r303987 - vendor/NetBSD/tests/08.11.2016_18.01 X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Aug 2016 06:19:42 -0000 Author: ngie Date: Fri Aug 12 06:19:40 2016 New Revision: 303987 URL: https://svnweb.freebsd.org/changeset/base/303987 Log: Copy snapshot of .../dist to .../08.11.2016_18.01 Added: vendor/NetBSD/tests/08.11.2016_18.01/ - copied from r303986, vendor/NetBSD/tests/dist/ From owner-svn-src-vendor@freebsd.org Sat Aug 13 19:54:33 2016 Return-Path: Delivered-To: svn-src-vendor@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 77AE4BB96CA; Sat, 13 Aug 2016 19:54:33 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 470081C9D; Sat, 13 Aug 2016 19:54:33 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7DJsWAN029547; Sat, 13 Aug 2016 19:54:32 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7DJsWnE029546; Sat, 13 Aug 2016 19:54:32 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201608131954.u7DJsWnE029546@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sat, 13 Aug 2016 19:54:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r304056 - vendor/illumos/dist/lib/libdtrace/common X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Aug 2016 19:54:33 -0000 Author: markj Date: Sat Aug 13 19:54:32 2016 New Revision: 304056 URL: https://svnweb.freebsd.org/changeset/base/304056 Log: 5396 fix longjmp clobbering errors illumos/illumos-gate@67a4bb8f9ad4c49e9aa9e21e2114a7c093c3a73a Reviewed by: Josef 'Jeff' Sipek Reviewed by: Igor Kozhukhov Approved by: Richard Lowe Author: Gary Mills Modified: vendor/illumos/dist/lib/libdtrace/common/dt_cc.c Modified: vendor/illumos/dist/lib/libdtrace/common/dt_cc.c ============================================================================== --- vendor/illumos/dist/lib/libdtrace/common/dt_cc.c Sat Aug 13 19:51:00 2016 (r304055) +++ vendor/illumos/dist/lib/libdtrace/common/dt_cc.c Sat Aug 13 19:54:32 2016 (r304056) @@ -23,6 +23,7 @@ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2013, Joyent Inc. All rights reserved. * Copyright (c) 2012 by Delphix. All rights reserved. + * Copyright 2015 Gary Mills */ /* @@ -2335,7 +2336,7 @@ dt_compile(dtrace_hdl_t *dtp, int contex dt_node_t *dnp; dt_decl_t *ddp; dt_pcb_t pcb; - void *rv; + void *volatile rv; int err; if ((fp == NULL && s == NULL) || (cflags & ~DTRACE_C_MASK) != 0) { From owner-svn-src-vendor@freebsd.org Sat Aug 13 19:57:38 2016 Return-Path: Delivered-To: svn-src-vendor@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EB7DCBB97B3; Sat, 13 Aug 2016 19:57:38 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B53171E6F; Sat, 13 Aug 2016 19:57:38 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7DJvck6029766; Sat, 13 Aug 2016 19:57:38 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7DJvbZA029750; Sat, 13 Aug 2016 19:57:37 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201608131957.u7DJvbZA029750@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sat, 13 Aug 2016 19:57:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r304057 - in vendor/illumos/dist: cmd/dtrace/test/cmd/scripts cmd/dtrace/test/tst/common/sugar lib/libdtrace/common X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Aug 2016 19:57:39 -0000 Author: markj Date: Sat Aug 13 19:57:36 2016 New Revision: 304057 URL: https://svnweb.freebsd.org/changeset/base/304057 Log: 7085 add support for "if" and "else" statements in dtrace illumos/illumos-gate@c3bd3abd8856e8e75d820f65c58031cd6cbac818 Add syntactic sugar to dtrace: "if" and "else" statements. The sugar is baked down to standard dtrace features by adding additional clauses with the appropriate predicates. Reviewed by: Adam Leventhal Reviewed by: Sebastien Roy Reviewed by: Paul Dagnelie Reviewed by: Bryan Cantrill Approved by: Richard Lowe Author: Matthew Ahrens Added: vendor/illumos/dist/cmd/dtrace/test/tst/common/sugar/ vendor/illumos/dist/cmd/dtrace/test/tst/common/sugar/tst.else.d vendor/illumos/dist/cmd/dtrace/test/tst/common/sugar/tst.if.d vendor/illumos/dist/cmd/dtrace/test/tst/common/sugar/tst.if2.d vendor/illumos/dist/cmd/dtrace/test/tst/common/sugar/tst.if_before_after.d vendor/illumos/dist/cmd/dtrace/test/tst/common/sugar/tst.if_nested.d vendor/illumos/dist/cmd/dtrace/test/tst/common/sugar/tst.if_trailing_semicolon.d vendor/illumos/dist/cmd/dtrace/test/tst/common/sugar/tst.if_trailing_semicolon2.d vendor/illumos/dist/lib/libdtrace/common/dt_sugar.c Modified: vendor/illumos/dist/cmd/dtrace/test/cmd/scripts/dstyle.pl vendor/illumos/dist/lib/libdtrace/common/dt_cc.c vendor/illumos/dist/lib/libdtrace/common/dt_grammar.y vendor/illumos/dist/lib/libdtrace/common/dt_impl.h vendor/illumos/dist/lib/libdtrace/common/dt_open.c vendor/illumos/dist/lib/libdtrace/common/dt_parser.c vendor/illumos/dist/lib/libdtrace/common/dt_parser.h vendor/illumos/dist/lib/libdtrace/common/dtrace.h Modified: vendor/illumos/dist/cmd/dtrace/test/cmd/scripts/dstyle.pl ============================================================================== --- vendor/illumos/dist/cmd/dtrace/test/cmd/scripts/dstyle.pl Sat Aug 13 19:54:32 2016 (r304056) +++ vendor/illumos/dist/cmd/dtrace/test/cmd/scripts/dstyle.pl Sat Aug 13 19:57:36 2016 (r304057) @@ -25,6 +25,10 @@ # Use is subject to license terms. # +# +# Copyright (c) 2014, 2016 by Delphix. All rights reserved. +# + require 5.8.4; $PNAME = $0; @@ -131,7 +135,8 @@ sub dstyle } if (!/^enum/ && !/^\t*struct/ && !/^\t*union/ && !/^typedef/ && - !/^translator/ && !/^provider/) { + !/^translator/ && !/^provider/ && !/\tif / && + !/ else /) { if (/[\w\s]+{/) { err "left brace not on its own line"; } @@ -141,7 +146,7 @@ sub dstyle } } - if (!/;$/) { + if (!/;$/ && !/\t*}$/ && !/ else /) { if (/[\w\s]+}/) { err "right brace not on its own line"; } Added: vendor/illumos/dist/cmd/dtrace/test/tst/common/sugar/tst.else.d ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/illumos/dist/cmd/dtrace/test/tst/common/sugar/tst.else.d Sat Aug 13 19:57:36 2016 (r304057) @@ -0,0 +1,33 @@ +/* + * CDDL HEADER START + * + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + * + * CDDL HEADER END + */ + +/* + * Copyright (c) 2014, 2016 by Delphix. All rights reserved. + */ + +/* + * ASSERTION: + * "else" statement is executed + */ + +BEGIN +{ + if (0) { + n = 1; + } else { + n = 0; + } + exit(n) +} Added: vendor/illumos/dist/cmd/dtrace/test/tst/common/sugar/tst.if.d ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/illumos/dist/cmd/dtrace/test/tst/common/sugar/tst.if.d Sat Aug 13 19:57:36 2016 (r304057) @@ -0,0 +1,33 @@ +/* + * CDDL HEADER START + * + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + * + * CDDL HEADER END + */ + +/* + * Copyright (c) 2014, 2016 by Delphix. All rights reserved. + */ + +/* + * ASSERTION: + * "if" statement executes the correct body. + */ + +BEGIN +{ + if (1) { + n = 0; + } else { + n = 1; + } + exit(n) +} Added: vendor/illumos/dist/cmd/dtrace/test/tst/common/sugar/tst.if2.d ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/illumos/dist/cmd/dtrace/test/tst/common/sugar/tst.if2.d Sat Aug 13 19:57:36 2016 (r304057) @@ -0,0 +1,33 @@ +/* + * CDDL HEADER START + * + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + * + * CDDL HEADER END + */ + +/* + * Copyright (c) 2014, 2016 by Delphix. All rights reserved. + */ + +/* + * ASSERTION: + * "if" statement executes the correct body. + * parses single-statement, braceless bodies correctly. + */ + +BEGIN +{ + if (1) + n = 0; + else + n = 1; + exit(n) +} Added: vendor/illumos/dist/cmd/dtrace/test/tst/common/sugar/tst.if_before_after.d ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/illumos/dist/cmd/dtrace/test/tst/common/sugar/tst.if_before_after.d Sat Aug 13 19:57:36 2016 (r304057) @@ -0,0 +1,46 @@ +/* + * CDDL HEADER START + * + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + * + * CDDL HEADER END + */ + +/* + * Copyright (c) 2014, 2016 by Delphix. All rights reserved. + */ + +/* + * ASSERTION: + * statements before and after an if statement are executed. + */ + +BEGIN +{ + i = 1; + if (1) { + i++; + } else { + i++; + } + i++; +} + +BEGIN +/i == 3/ +{ + exit(0); +} + +BEGIN +/i != 3/ +{ + exit(1); +} Added: vendor/illumos/dist/cmd/dtrace/test/tst/common/sugar/tst.if_nested.d ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/illumos/dist/cmd/dtrace/test/tst/common/sugar/tst.if_nested.d Sat Aug 13 19:57:36 2016 (r304057) @@ -0,0 +1,38 @@ +/* + * CDDL HEADER START + * + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + * + * CDDL HEADER END + */ + +/* + * Copyright (c) 2014, 2016 by Delphix. All rights reserved. + */ + +/* + * ASSERTION: + * nested "if" statement executes the correct body. + */ + +BEGIN +{ + if (0) { + exit(1); + } else { + if (0) { + exit(1); + } else { + exit(0); + } + exit(1); + } + exit(1); +} Added: vendor/illumos/dist/cmd/dtrace/test/tst/common/sugar/tst.if_trailing_semicolon.d ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/illumos/dist/cmd/dtrace/test/tst/common/sugar/tst.if_trailing_semicolon.d Sat Aug 13 19:57:36 2016 (r304057) @@ -0,0 +1,30 @@ +/* + * CDDL HEADER START + * + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + * + * CDDL HEADER END + */ + +/* + * Copyright (c) 2014, 2016 by Delphix. All rights reserved. + */ + +/* + * ASSERTION: + * "if" body without trailing semicolon parses correctly + */ + +BEGIN +{ + if (1) { + exit(0) + } +} Added: vendor/illumos/dist/cmd/dtrace/test/tst/common/sugar/tst.if_trailing_semicolon2.d ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/illumos/dist/cmd/dtrace/test/tst/common/sugar/tst.if_trailing_semicolon2.d Sat Aug 13 19:57:36 2016 (r304057) @@ -0,0 +1,31 @@ +/* + * CDDL HEADER START + * + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + * + * CDDL HEADER END + */ + +/* + * Copyright (c) 2014, 2016 by Delphix. All rights reserved. + */ + +/* + * ASSERTION: + * "if" body without trailing semicolon parses correctly + */ + +BEGIN +{ + if (1) { + i = 1; + exit(0) + } +} Modified: vendor/illumos/dist/lib/libdtrace/common/dt_cc.c ============================================================================== --- vendor/illumos/dist/lib/libdtrace/common/dt_cc.c Sat Aug 13 19:54:32 2016 (r304056) +++ vendor/illumos/dist/lib/libdtrace/common/dt_cc.c Sat Aug 13 19:57:36 2016 (r304057) @@ -21,8 +21,8 @@ /* * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2016 by Delphix. All rights reserved. * Copyright (c) 2013, Joyent Inc. All rights reserved. - * Copyright (c) 2012 by Delphix. All rights reserved. * Copyright 2015 Gary Mills */ @@ -119,7 +119,6 @@ static const dtrace_diftype_t dt_int_rty static void *dt_compile(dtrace_hdl_t *, int, dtrace_probespec_t, void *, uint_t, int, char *const[], FILE *, const char *); - /*ARGSUSED*/ static int dt_idreset(dt_idhash_t *dhp, dt_ident_t *idp, void *ignored) @@ -2419,6 +2418,28 @@ dt_compile(dtrace_hdl_t *dtp, int contex } /* + * Perform sugar transformations (for "if" / "else") and replace the + * existing clause chain with the new one. + */ + if (context == DT_CTX_DPROG) { + dt_node_t *dnp, *next_dnp; + dt_node_t *new_list = NULL; + + for (dnp = yypcb->pcb_root->dn_list; + dnp != NULL; dnp = next_dnp) { + /* remove this node from the list */ + next_dnp = dnp->dn_list; + dnp->dn_list = NULL; + + if (dnp->dn_kind == DT_NODE_CLAUSE) + dnp = dt_compile_sugar(dtp, dnp); + /* append node to the new list */ + new_list = dt_node_link(new_list, dnp); + } + yypcb->pcb_root->dn_list = new_list; + } + + /* * If we have successfully created a parse tree for a D program, loop * over the clauses and actions and instantiate the corresponding * libdtrace program. If we are parsing a D expression, then we @@ -2438,6 +2459,8 @@ dt_compile(dtrace_hdl_t *dtp, int contex for (; dnp != NULL; dnp = dnp->dn_list) { switch (dnp->dn_kind) { case DT_NODE_CLAUSE: + if (DT_TREEDUMP_PASS(dtp, 4)) + dt_printd(dnp, stderr, 0); dt_compile_clause(dtp, dnp); break; case DT_NODE_XLATOR: Modified: vendor/illumos/dist/lib/libdtrace/common/dt_grammar.y ============================================================================== --- vendor/illumos/dist/lib/libdtrace/common/dt_grammar.y Sat Aug 13 19:54:32 2016 (r304056) +++ vendor/illumos/dist/lib/libdtrace/common/dt_grammar.y Sat Aug 13 19:57:36 2016 (r304057) @@ -23,8 +23,9 @@ * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ + /* - * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2014, 2016 by Delphix. All rights reserved. * Copyright (c) 2013, Joyent, Inc. All rights reserved. */ @@ -155,6 +156,8 @@ %type probe_specifier_list %type probe_specifier %type statement_list +%type statement_list_impl +%type statement_or_block %type statement %type declaration %type init_declarator_list @@ -317,9 +320,11 @@ probe_definition: "or actions following probe description\n"); } $$ = dt_node_clause($1, NULL, NULL); + yybegin(YYS_CLAUSE); } | probe_specifiers '{' statement_list '}' { $$ = dt_node_clause($1, NULL, $3); + yybegin(YYS_CLAUSE); } | probe_specifiers DT_TOK_DIV expression DT_TOK_EPRED { dnerror($3, D_SYNTAX, "expected actions { } following " @@ -328,6 +333,7 @@ probe_definition: | probe_specifiers DT_TOK_DIV expression DT_TOK_EPRED '{' statement_list '}' { $$ = dt_node_clause($1, $3, $6); + yybegin(YYS_CLAUSE); } ; @@ -347,12 +353,30 @@ probe_specifier: | DT_TOK_INT { $$ = dt_node_pdesc_by_id($1); } ; -statement_list: statement { $$ = $1; } - | statement_list ';' statement { $$ = LINK($1, $3); } +statement_list_impl: /* empty */ { $$ = NULL; } + | statement_list_impl statement { $$ = LINK($1, $2); } + ; + +statement_list: + statement_list_impl { $$ = $1; } + | statement_list_impl expression { + $$ = LINK($1, dt_node_statement($2)); + } ; -statement: /* empty */ { $$ = NULL; } - | expression { $$ = dt_node_statement($1); } +statement_or_block: + statement + | '{' statement_list '}' { $$ = $2; } + +statement: ';' { $$ = NULL; } + | expression ';' { $$ = dt_node_statement($1); } + | DT_KEY_IF DT_TOK_LPAR expression DT_TOK_RPAR statement_or_block { + $$ = dt_node_if($3, $5, NULL); + } + | DT_KEY_IF DT_TOK_LPAR expression DT_TOK_RPAR + statement_or_block DT_KEY_ELSE statement_or_block { + $$ = dt_node_if($3, $5, $7); + } ; argument_expression_list: Modified: vendor/illumos/dist/lib/libdtrace/common/dt_impl.h ============================================================================== --- vendor/illumos/dist/lib/libdtrace/common/dt_impl.h Sat Aug 13 19:54:32 2016 (r304056) +++ vendor/illumos/dist/lib/libdtrace/common/dt_impl.h Sat Aug 13 19:57:36 2016 (r304057) @@ -26,7 +26,7 @@ /* * Copyright (c) 2013, Joyent, Inc. All rights reserved. - * Copyright (c) 2012 by Delphix. All rights reserved. + * Copyright (c) 2011, 2016 by Delphix. All rights reserved. */ #ifndef _DT_IMPL_H @@ -320,6 +320,7 @@ struct dtrace_hdl { int dt_indent; /* recommended flow indent */ dtrace_epid_t dt_last_epid; /* most recently consumed EPID */ uint64_t dt_last_timestamp; /* most recently consumed timestamp */ + boolean_t dt_has_sugar; /* syntactic sugar used? */ }; /* Modified: vendor/illumos/dist/lib/libdtrace/common/dt_open.c ============================================================================== --- vendor/illumos/dist/lib/libdtrace/common/dt_open.c Sat Aug 13 19:54:32 2016 (r304056) +++ vendor/illumos/dist/lib/libdtrace/common/dt_open.c Sat Aug 13 19:57:36 2016 (r304057) @@ -22,7 +22,7 @@ /* * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2013, Joyent, Inc. All rights reserved. - * Copyright (c) 2012 by Delphix. All rights reserved. + * Copyright (c) 2012, 2016 by Delphix. All rights reserved. */ #include @@ -115,8 +115,9 @@ #define DT_VERS_1_11 DT_VERSION_NUMBER(1, 11, 0) #define DT_VERS_1_12 DT_VERSION_NUMBER(1, 12, 0) #define DT_VERS_1_12_1 DT_VERSION_NUMBER(1, 12, 1) -#define DT_VERS_LATEST DT_VERS_1_12_1 -#define DT_VERS_STRING "Sun D 1.12.1" +#define DT_VERS_1_13 DT_VERSION_NUMBER(1, 13, 0) +#define DT_VERS_LATEST DT_VERS_1_13 +#define DT_VERS_STRING "Sun D 1.13" const dt_version_t _dtrace_versions[] = { DT_VERS_1_0, /* D API 1.0.0 (PSARC 2001/466) Solaris 10 FCS */ @@ -142,6 +143,7 @@ const dt_version_t _dtrace_versions[] = DT_VERS_1_11, /* D API 1.11 */ DT_VERS_1_12, /* D API 1.12 */ DT_VERS_1_12_1, /* D API 1.12.1 */ + DT_VERS_1_13, /* D API 1.13 */ 0 }; Modified: vendor/illumos/dist/lib/libdtrace/common/dt_parser.c ============================================================================== --- vendor/illumos/dist/lib/libdtrace/common/dt_parser.c Sat Aug 13 19:54:32 2016 (r304056) +++ vendor/illumos/dist/lib/libdtrace/common/dt_parser.c Sat Aug 13 19:57:36 2016 (r304057) @@ -22,7 +22,7 @@ /* * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2013, Joyent Inc. All rights reserved. - * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2012, 2016 by Delphix. All rights reserved. */ /* @@ -2137,6 +2137,17 @@ dt_node_statement(dt_node_t *expr) } dt_node_t * +dt_node_if(dt_node_t *pred, dt_node_t *acts, dt_node_t *else_acts) +{ + dt_node_t *dnp = dt_node_alloc(DT_NODE_IF); + dnp->dn_conditional = pred; + dnp->dn_body = acts; + dnp->dn_alternate_body = else_acts; + + return (dnp); +} + +dt_node_t * dt_node_pdesc_by_name(char *spec) { dtrace_hdl_t *dtp = yypcb->pcb_hdl; @@ -2205,7 +2216,6 @@ dt_node_clause(dt_node_t *pdescs, dt_nod dnp->dn_pred = pred; dnp->dn_acts = acts; - yybegin(YYS_CLAUSE); return (dnp); } @@ -3197,8 +3207,9 @@ dt_cook_op2(dt_node_t *dnp, uint_t idfla dt_xcook_ident(lp, dhp, idkind, B_TRUE); else dt_xcook_ident(lp, dhp, idp->di_kind, B_FALSE); - } else + } else { lp = dnp->dn_left = dt_node_cook(lp, 0); + } /* * Switch op to '+' for *(E1 + E2) array mode in these cases: @@ -3212,10 +3223,12 @@ dt_cook_op2(dt_node_t *dnp, uint_t idfla if (lp->dn_ident->di_kind == DT_IDENT_ARRAY) { if (lp->dn_args != NULL) op = DT_TOK_ADD; - } else if (!dt_ident_unref(lp->dn_ident)) + } else if (!dt_ident_unref(lp->dn_ident)) { op = DT_TOK_ADD; - } else if (lp->dn_kind != DT_NODE_AGG) + } + } else if (lp->dn_kind != DT_NODE_AGG) { op = DT_TOK_ADD; + } } switch (op) { @@ -3639,45 +3652,34 @@ asgn_common: case DT_TOK_PTR: /* - * If the left-hand side of operator -> is the name "self", - * then we permit a TLS variable to be created or referenced. + * If the left-hand side of operator -> is one of the scoping + * keywords, permit a local or thread variable to be created or + * referenced. */ - if (lp->dn_kind == DT_NODE_IDENT && - strcmp(lp->dn_string, "self") == 0) { - if (rp->dn_kind != DT_NODE_VAR) { - dt_xcook_ident(rp, dtp->dt_tls, - DT_IDENT_SCALAR, B_TRUE); - } - - if (idflags != 0) - rp = dt_node_cook(rp, idflags); - - dnp->dn_right = dnp->dn_left; /* avoid freeing rp */ - dt_node_free(dnp); - return (rp); - } + if (lp->dn_kind == DT_NODE_IDENT) { + dt_idhash_t *dhp = NULL; - /* - * If the left-hand side of operator -> is the name "this", - * then we permit a local variable to be created or referenced. - */ - if (lp->dn_kind == DT_NODE_IDENT && - strcmp(lp->dn_string, "this") == 0) { - if (rp->dn_kind != DT_NODE_VAR) { - dt_xcook_ident(rp, yypcb->pcb_locals, - DT_IDENT_SCALAR, B_TRUE); + if (strcmp(lp->dn_string, "self") == 0) { + dhp = dtp->dt_tls; + } else if (strcmp(lp->dn_string, "this") == 0) { + dhp = yypcb->pcb_locals; } + if (dhp != NULL) { + if (rp->dn_kind != DT_NODE_VAR) { + dt_xcook_ident(rp, dhp, + DT_IDENT_SCALAR, B_TRUE); + } - if (idflags != 0) - rp = dt_node_cook(rp, idflags); + if (idflags != 0) + rp = dt_node_cook(rp, idflags); - dnp->dn_right = dnp->dn_left; /* avoid freeing rp */ - dt_node_free(dnp); - return (rp); + /* avoid freeing rp */ + dnp->dn_right = dnp->dn_left; + dt_node_free(dnp); + return (rp); + } } - /*FALLTHRU*/ - case DT_TOK_DOT: lp = dnp->dn_left = dt_node_cook(lp, DT_IDFLG_REF); @@ -4496,7 +4498,8 @@ static dt_node_t *(*dt_cook_funcs[])(dt_ dt_cook_xlator, /* DT_NODE_XLATOR */ dt_cook_none, /* DT_NODE_PROBE */ dt_cook_provider, /* DT_NODE_PROVIDER */ - dt_cook_none /* DT_NODE_PROG */ + dt_cook_none, /* DT_NODE_PROG */ + dt_cook_none, /* DT_NODE_IF */ }; /* @@ -4511,6 +4514,8 @@ dt_node_cook(dt_node_t *dnp, uint_t idfl yylineno = dnp->dn_line; + assert(dnp->dn_kind < + sizeof (dt_cook_funcs) / sizeof (dt_cook_funcs[0])); dnp = dt_cook_funcs[dnp->dn_kind](dnp, idflags); dnp->dn_flags |= DT_NF_COOKED; @@ -4613,6 +4618,181 @@ dt_node_diftype(dtrace_hdl_t *dtp, const tp->dtdt_size = ctf_type_size(dnp->dn_ctfp, dnp->dn_type); } +/* + * Output the parse tree as D. The "-xtree=8" argument will call this + * function to print out the program after any syntactic sugar + * transformations have been applied (e.g. to implement "if"). The + * resulting output can be used to understand the transformations + * applied by these features, or to run such a script on a system that + * does not support these features + * + * Note that the output does not express precisely the same program as + * the input. In particular: + * - Only the clauses are output. #pragma options, variable + * declarations, etc. are excluded. + * - Command argument substitution has already been done, so the output + * will not contain e.g. $$1, but rather the substituted string. + */ +void +dt_printd(dt_node_t *dnp, FILE *fp, int depth) +{ + dt_node_t *arg; + + switch (dnp->dn_kind) { + case DT_NODE_INT: + (void) fprintf(fp, "0x%llx", (u_longlong_t)dnp->dn_value); + if (!(dnp->dn_flags & DT_NF_SIGNED)) + (void) fprintf(fp, "u"); + break; + + case DT_NODE_STRING: { + char *escd = strchr2esc(dnp->dn_string, strlen(dnp->dn_string)); + (void) fprintf(fp, "\"%s\"", escd); + free(escd); + break; + } + + case DT_NODE_IDENT: + (void) fprintf(fp, "%s", dnp->dn_string); + break; + + case DT_NODE_VAR: + (void) fprintf(fp, "%s%s", + (dnp->dn_ident->di_flags & DT_IDFLG_LOCAL) ? "this->" : + (dnp->dn_ident->di_flags & DT_IDFLG_TLS) ? "self->" : "", + dnp->dn_ident->di_name); + + if (dnp->dn_args != NULL) { + (void) fprintf(fp, "["); + + for (arg = dnp->dn_args; arg != NULL; + arg = arg->dn_list) { + dt_printd(arg, fp, 0); + if (arg->dn_list != NULL) + (void) fprintf(fp, ", "); + } + + (void) fprintf(fp, "]"); + } + break; + + case DT_NODE_SYM: { + const dtrace_syminfo_t *dts = dnp->dn_ident->di_data; + (void) fprintf(fp, "%s`%s", dts->dts_object, dts->dts_name); + break; + } + case DT_NODE_FUNC: + (void) fprintf(fp, "%s(", dnp->dn_ident->di_name); + + for (arg = dnp->dn_args; arg != NULL; arg = arg->dn_list) { + dt_printd(arg, fp, 0); + if (arg->dn_list != NULL) + (void) fprintf(fp, ", "); + } + (void) fprintf(fp, ")"); + break; + + case DT_NODE_OP1: + (void) fprintf(fp, "%s(", opstr(dnp->dn_op)); + dt_printd(dnp->dn_child, fp, 0); + (void) fprintf(fp, ")"); + break; + + case DT_NODE_OP2: + (void) fprintf(fp, "("); + dt_printd(dnp->dn_left, fp, 0); + if (dnp->dn_op == DT_TOK_LPAR) { + (void) fprintf(fp, ")"); + dt_printd(dnp->dn_right, fp, 0); + break; + } + if (dnp->dn_op == DT_TOK_PTR || dnp->dn_op == DT_TOK_DOT || + dnp->dn_op == DT_TOK_LBRAC) + (void) fprintf(fp, "%s", opstr(dnp->dn_op)); + else + (void) fprintf(fp, " %s ", opstr(dnp->dn_op)); + dt_printd(dnp->dn_right, fp, 0); + if (dnp->dn_op == DT_TOK_LBRAC) { + dt_node_t *ln = dnp->dn_right; + while (ln->dn_list != NULL) { + (void) fprintf(fp, ", "); + dt_printd(ln->dn_list, fp, depth); + ln = ln->dn_list; + } + (void) fprintf(fp, "]"); + } + (void) fprintf(fp, ")"); + break; + + case DT_NODE_OP3: + (void) fprintf(fp, "("); + dt_printd(dnp->dn_expr, fp, 0); + (void) fprintf(fp, " ? "); + dt_printd(dnp->dn_left, fp, 0); + (void) fprintf(fp, " : "); + dt_printd(dnp->dn_right, fp, 0); + (void) fprintf(fp, ")"); + break; + + case DT_NODE_DEXPR: + case DT_NODE_DFUNC: + (void) fprintf(fp, "%*s", depth * 8, ""); + dt_printd(dnp->dn_expr, fp, depth + 1); + (void) fprintf(fp, ";\n"); + break; + + case DT_NODE_PDESC: + (void) fprintf(fp, "%s:%s:%s:%s", + dnp->dn_desc->dtpd_provider, dnp->dn_desc->dtpd_mod, + dnp->dn_desc->dtpd_func, dnp->dn_desc->dtpd_name); + break; + + case DT_NODE_CLAUSE: + for (arg = dnp->dn_pdescs; arg != NULL; arg = arg->dn_list) { + dt_printd(arg, fp, 0); + if (arg->dn_list != NULL) + (void) fprintf(fp, ","); + (void) fprintf(fp, "\n"); + } + + if (dnp->dn_pred != NULL) { + (void) fprintf(fp, "/"); + dt_printd(dnp->dn_pred, fp, 0); + (void) fprintf(fp, "/\n"); + } + (void) fprintf(fp, "{\n"); + + for (arg = dnp->dn_acts; arg != NULL; arg = arg->dn_list) + dt_printd(arg, fp, depth + 1); + (void) fprintf(fp, "}\n"); + (void) fprintf(fp, "\n"); + break; + + case DT_NODE_IF: + (void) fprintf(fp, "%*sif (", depth * 8, ""); + dt_printd(dnp->dn_conditional, fp, 0); + (void) fprintf(fp, ") {\n"); + + for (arg = dnp->dn_body; arg != NULL; arg = arg->dn_list) + dt_printd(arg, fp, depth + 1); + if (dnp->dn_alternate_body == NULL) { + (void) fprintf(fp, "%*s}\n", depth * 8, ""); + } else { + (void) fprintf(fp, "%*s} else {\n", depth * 8, ""); + for (arg = dnp->dn_alternate_body; arg != NULL; + arg = arg->dn_list) + dt_printd(arg, fp, depth + 1); + (void) fprintf(fp, "%*s}\n", depth * 8, ""); + } + + break; + + default: + (void) fprintf(fp, "/* bad node %p, kind %d */\n", + (void *)dnp, dnp->dn_kind); + } +} + void dt_node_printr(dt_node_t *dnp, FILE *fp, int depth) { @@ -4723,6 +4903,13 @@ dt_node_printr(dt_node_t *dnp, FILE *fp, (void) fprintf(fp, "OP2 %s (%s)\n", opstr(dnp->dn_op), buf); dt_node_printr(dnp->dn_left, fp, depth + 1); dt_node_printr(dnp->dn_right, fp, depth + 1); + if (dnp->dn_op == DT_TOK_LBRAC) { + dt_node_t *ln = dnp->dn_right; + while (ln->dn_list != NULL) { + dt_node_printr(ln->dn_list, fp, depth + 1); + ln = ln->dn_list; + } + } break; case DT_NODE_OP3: @@ -4784,6 +4971,7 @@ dt_node_printr(dt_node_t *dnp, FILE *fp, for (arg = dnp->dn_acts; arg != NULL; arg = arg->dn_list) dt_node_printr(arg, fp, depth + 1); + (void) fprintf(fp, "\n"); break; case DT_NODE_INLINE: @@ -4834,6 +5022,24 @@ dt_node_printr(dt_node_t *dnp, FILE *fp, dt_node_printr(arg, fp, depth + 1); break; + case DT_NODE_IF: + (void) fprintf(fp, "IF attr=%s CONDITION:\n", a); + + dt_node_printr(dnp->dn_conditional, fp, depth + 1); + + (void) fprintf(fp, "%*sIF BODY: \n", depth * 2, ""); + for (arg = dnp->dn_body; arg != NULL; arg = arg->dn_list) + dt_node_printr(arg, fp, depth + 1); + + if (dnp->dn_alternate_body != NULL) { + (void) fprintf(fp, "%*sIF ELSE: \n", depth * 2, ""); + for (arg = dnp->dn_alternate_body; arg != NULL; + arg = arg->dn_list) + dt_node_printr(arg, fp, depth + 1); + } + + break; + default: (void) fprintf(fp, "\n", (void *)dnp, dnp->dn_kind); Modified: vendor/illumos/dist/lib/libdtrace/common/dt_parser.h ============================================================================== --- vendor/illumos/dist/lib/libdtrace/common/dt_parser.h Sat Aug 13 19:54:32 2016 (r304056) +++ vendor/illumos/dist/lib/libdtrace/common/dt_parser.h Sat Aug 13 19:57:36 2016 (r304057) @@ -23,7 +23,7 @@ * Use is subject to license terms. */ /* - * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2013, 2016 by Delphix. All rights reserved. * Copyright (c) 2013 Joyent, Inc. All rights reserved. */ @@ -105,6 +105,12 @@ typedef struct dt_node { struct dt_node *_probes; /* list of probe nodes */ int _redecl; /* provider redeclared */ } _provider; + + struct { + struct dt_node *_conditional; + struct dt_node *_body; + struct dt_node *_alternate_body; + } _conditional; } dn_u; struct dt_node *dn_list; /* parse tree list link */ @@ -140,6 +146,11 @@ typedef struct dt_node { #define dn_provred dn_u._provider._redecl /* DT_NODE_PROVIDER */ #define dn_probes dn_u._provider._probes /* DT_NODE_PROVIDER */ +/* DT_NODE_IF: */ +#define dn_conditional dn_u._conditional._conditional +#define dn_body dn_u._conditional._body +#define dn_alternate_body dn_u._conditional._alternate_body + #define DT_NODE_FREE 0 /* unused node (waiting to be freed) */ #define DT_NODE_INT 1 /* integer value */ #define DT_NODE_STRING 2 /* string value */ @@ -162,6 +173,7 @@ typedef struct dt_node { #define DT_NODE_PROBE 19 /* probe definition */ #define DT_NODE_PROVIDER 20 /* provider definition */ #define DT_NODE_PROG 21 /* program translation unit */ +#define DT_NODE_IF 22 /* if statement */ #define DT_NF_SIGNED 0x01 /* data is a signed quantity (else unsigned) */ #define DT_NF_COOKED 0x02 /* data is a known type (else still cooking) */ @@ -213,6 +225,7 @@ extern dt_node_t *dt_node_xlator(dt_decl extern dt_node_t *dt_node_probe(char *, int, dt_node_t *, dt_node_t *); extern dt_node_t *dt_node_provider(char *, dt_node_t *); extern dt_node_t *dt_node_program(dt_node_t *); +extern dt_node_t *dt_node_if(dt_node_t *, dt_node_t *, dt_node_t *); extern dt_node_t *dt_node_link(dt_node_t *, dt_node_t *); extern dt_node_t *dt_node_cook(dt_node_t *, uint_t); @@ -237,6 +250,7 @@ extern void dt_node_promote(dt_node_t *, extern void dt_node_diftype(dtrace_hdl_t *, const dt_node_t *, dtrace_diftype_t *); extern void dt_node_printr(dt_node_t *, FILE *, int); +extern void dt_printd(dt_node_t *, FILE *, int); extern const char *dt_node_name(const dt_node_t *, char *, size_t); extern int dt_node_root(dt_node_t *); Added: vendor/illumos/dist/lib/libdtrace/common/dt_sugar.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/illumos/dist/lib/libdtrace/common/dt_sugar.c Sat Aug 13 19:57:36 2016 (r304057) @@ -0,0 +1,516 @@ +/* + * CDDL HEADER START + * + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + * + * CDDL HEADER END + */ + +/* + * Copyright (c) 2012, 2016 by Delphix. All rights reserved. + */ + +/* + * Syntactic sugar features are implemented by transforming the D parse tree + * such that it only uses the subset of D that is supported by the rest of the + * compiler / the kernel. A clause containing these language features is + * referred to as a "super-clause", and its transformation typically entails + * creating several "sub-clauses" to implement it. For diagnosability, the + * sub-clauses will be printed if the "-xtree=8" flag is specified. + * + * Currently, the only syntactic sugar feature is "if/else" statements. Each + * basic block (e.g. the body of the "if" and "else" statements, and the + * statements before and after) is turned into its own sub-clause, with a + * predicate that causes it to be executed only if the code flows to this point. + * Nested if/else statements are supported. + * + * This infrastructure is designed to accommodate other syntactic sugar features + * in the future. + */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +typedef struct dt_sugar_parse { + dtrace_hdl_t *dtsp_dtp; /* dtrace handle */ + dt_node_t *dtsp_pdescs; /* probe descriptions */ + int dtsp_num_conditions; /* number of condition variables */ + int dtsp_num_ifs; /* number of "if" statements */ + dt_node_t *dtsp_clause_list; /* list of clauses */ +} dt_sugar_parse_t; + +static void dt_sugar_visit_stmts(dt_sugar_parse_t *, dt_node_t *, int); + +/* + * Return a node for "self->%error". + * + * Note that the "%" is part of the variable name, and is included so that + * this variable name can not collide with any user-specified variable. + * + * This error variable is used to keep track of if there has been an error + * in any of the sub-clauses, and is used to prevent execution of subsequent + * sub-clauses following an error. + */ +static dt_node_t * *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-vendor@freebsd.org Sat Aug 13 21:20:11 2016 Return-Path: Delivered-To: svn-src-vendor@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A383FBB6916; Sat, 13 Aug 2016 21:20:11 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 41C67121B; Sat, 13 Aug 2016 21:20:11 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7DLKANW059563; Sat, 13 Aug 2016 21:20:10 GMT (envelope-from mm@FreeBSD.org) Received: (from mm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7DLK71Y059530; Sat, 13 Aug 2016 21:20:07 GMT (envelope-from mm@FreeBSD.org) Message-Id: <201608132120.u7DLK71Y059530@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mm set sender to mm@FreeBSD.org using -f From: Martin Matuska Date: Sat, 13 Aug 2016 21:20:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r304060 - in vendor/libarchive/dist: . build/cmake cat/test cpio cpio/test libarchive libarchive/test tar tar/test X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Aug 2016 21:20:11 -0000 Author: mm Date: Sat Aug 13 21:20:06 2016 New Revision: 304060 URL: https://svnweb.freebsd.org/changeset/base/304060 Log: Update vendor/libarchive to git 6a0d970f70102fe50ee9f1e51a2e4c048985e616 Vendor issues fixed: Issue #744: Very long pathnames evade symlink checks Issue #748: libarchive can compress, but cannot decompress zip some files PR #750: ustar: fix out of bounds read on empty string ("") filename PR #755: fix use of acl_get_flagset_np() on FreeBSD Added: vendor/libarchive/dist/libarchive/test/test_read_format_zip_high_compression.c (contents, props changed) vendor/libarchive/dist/libarchive/test/test_read_format_zip_high_compression.zip.uu vendor/libarchive/dist/libarchive/test/test_write_disk_secure744.c (contents, props changed) vendor/libarchive/dist/libarchive/test/test_write_disk_secure745.c (contents, props changed) vendor/libarchive/dist/libarchive/test/test_write_disk_secure746.c (contents, props changed) Modified: vendor/libarchive/dist/CMakeLists.txt vendor/libarchive/dist/Makefile.am vendor/libarchive/dist/build/cmake/config.h.in vendor/libarchive/dist/cat/test/test_version.c vendor/libarchive/dist/cpio/cmdline.c vendor/libarchive/dist/cpio/test/test_option_version.c vendor/libarchive/dist/libarchive/archive_match.c vendor/libarchive/dist/libarchive/archive_ppmd7_private.h vendor/libarchive/dist/libarchive/archive_read_add_passphrase.c vendor/libarchive/dist/libarchive/archive_read_disk_entry_from_file.c vendor/libarchive/dist/libarchive/archive_read_disk_posix.c vendor/libarchive/dist/libarchive/archive_read_disk_windows.c vendor/libarchive/dist/libarchive/archive_read_private.h vendor/libarchive/dist/libarchive/archive_read_support_filter_lz4.c vendor/libarchive/dist/libarchive/archive_read_support_format_lha.c vendor/libarchive/dist/libarchive/archive_read_support_format_warc.c vendor/libarchive/dist/libarchive/archive_util.c vendor/libarchive/dist/libarchive/archive_write_disk_acl.c vendor/libarchive/dist/libarchive/archive_write_disk_posix.c vendor/libarchive/dist/libarchive/archive_write_set_format_iso9660.c vendor/libarchive/dist/libarchive/archive_write_set_format_ustar.c vendor/libarchive/dist/libarchive/test/CMakeLists.txt vendor/libarchive/dist/libarchive/test/main.c vendor/libarchive/dist/libarchive/test/test.h vendor/libarchive/dist/libarchive/test/test_archive_string_conversion.c vendor/libarchive/dist/libarchive/test/test_fuzz.c vendor/libarchive/dist/libarchive/test/test_read_format_rar.c vendor/libarchive/dist/tar/cmdline.c vendor/libarchive/dist/tar/test/test_version.c Modified: vendor/libarchive/dist/CMakeLists.txt ============================================================================== --- vendor/libarchive/dist/CMakeLists.txt Sat Aug 13 20:21:32 2016 (r304059) +++ vendor/libarchive/dist/CMakeLists.txt Sat Aug 13 21:20:06 2016 (r304060) @@ -1274,6 +1274,10 @@ CHECK_FUNCTION_EXISTS(wmemmove HAVE_WMEM CMAKE_POP_CHECK_STATE() # Restore the state of the variables +CHECK_C_SOURCE_COMPILES( + "#include \n#include \nint main(void) { struct vfsconf v; return sizeof(v);}" + HAVE_STRUCT_VFSCONF) + # Make sure we have the POSIX version of readdir_r, not the # older 2-argument version. CHECK_C_SOURCE_COMPILES( @@ -1299,6 +1303,10 @@ CHECK_C_SOURCE_COMPILES( "#include \nint main() { return major(256); }" MAJOR_IN_SYSMACROS) +CHECK_C_SOURCE_COMPILES( + "#include \n#if LZMA_VERSION < 50020000\n#error unsupported\n#endif\nint main(void){lzma_stream_encoder_mt(0, 0); return 0;}" + HAVE_LZMA_STREAM_ENCODER_MT) + IF(HAVE_STRERROR_R) SET(HAVE_DECL_STRERROR_R 1) ENDIF(HAVE_STRERROR_R) Modified: vendor/libarchive/dist/Makefile.am ============================================================================== --- vendor/libarchive/dist/Makefile.am Sat Aug 13 20:21:32 2016 (r304059) +++ vendor/libarchive/dist/Makefile.am Sat Aug 13 21:20:06 2016 (r304060) @@ -475,6 +475,7 @@ libarchive_test_SOURCES= \ libarchive/test/test_read_format_zip_encryption_partially.c \ libarchive/test/test_read_format_zip_encryption_header.c \ libarchive/test/test_read_format_zip_filename.c \ + libarchive/test/test_read_format_zip_high_compression.c \ libarchive/test/test_read_format_zip_mac_metadata.c \ libarchive/test/test_read_format_zip_malformed.c \ libarchive/test/test_read_format_zip_msdos.c \ @@ -509,6 +510,9 @@ libarchive_test_SOURCES= \ libarchive/test/test_write_disk_no_hfs_compression.c \ libarchive/test/test_write_disk_perms.c \ libarchive/test/test_write_disk_secure.c \ + libarchive/test/test_write_disk_secure744.c \ + libarchive/test/test_write_disk_secure745.c \ + libarchive/test/test_write_disk_secure746.c \ libarchive/test/test_write_disk_sparse.c \ libarchive/test/test_write_disk_symlink.c \ libarchive/test/test_write_disk_times.c \ Modified: vendor/libarchive/dist/build/cmake/config.h.in ============================================================================== --- vendor/libarchive/dist/build/cmake/config.h.in Sat Aug 13 20:21:32 2016 (r304059) +++ vendor/libarchive/dist/build/cmake/config.h.in Sat Aug 13 21:20:06 2016 (r304060) @@ -721,6 +721,9 @@ typedef uint64_t uintmax_t; /* Define to 1 if you have the header file. */ #cmakedefine HAVE_LZMA_H 1 +/* Define to 1 if you have a working `lzma_stream_encoder_mt' function. */ +#cmakedefine HAVE_LZMA_STREAM_ENCODER_MT 1 + /* Define to 1 if you have the header file. */ #cmakedefine HAVE_LZO_LZO1X_H 1 @@ -923,6 +926,9 @@ typedef uint64_t uintmax_t; /* Define to 1 if `__tm_gmtoff' is a member of `struct tm'. */ #cmakedefine HAVE_STRUCT_TM___TM_GMTOFF 1 +/* Define to 1 if you have `struct vfsconf'. */ +#cmakedefine HAVE_STRUCT_VFSCONF 1 + /* Define to 1 if you have the `symlink' function. */ #cmakedefine HAVE_SYMLINK 1 Modified: vendor/libarchive/dist/cat/test/test_version.c ============================================================================== --- vendor/libarchive/dist/cat/test/test_version.c Sat Aug 13 20:21:32 2016 (r304059) +++ vendor/libarchive/dist/cat/test/test_version.c Sat Aug 13 21:20:06 2016 (r304060) @@ -83,7 +83,7 @@ DEFINE_TEST(test_version) if (*q == 'a' || *q == 'b' || *q == 'c' || *q == 'd') ++q; /* Skip arbitrary third-party version numbers. */ - while (s > 0 && (*q == ' ' || *q == '/' || *q == '.' || isalnum(*q))) { + while (s > 0 && (*q == ' ' || *q == '-' || *q == '/' || *q == '.' || isalnum(*q))) { ++q; --s; } Modified: vendor/libarchive/dist/cpio/cmdline.c ============================================================================== --- vendor/libarchive/dist/cpio/cmdline.c Sat Aug 13 20:21:32 2016 (r304059) +++ vendor/libarchive/dist/cpio/cmdline.c Sat Aug 13 21:20:06 2016 (r304060) @@ -63,6 +63,7 @@ static const struct option { } cpio_longopts[] = { { "b64encode", 0, OPTION_B64ENCODE }, { "create", 0, 'o' }, + { "dereference", 0, 'L' }, { "dot", 0, 'V' }, { "extract", 0, 'i' }, { "file", 1, 'F' }, Modified: vendor/libarchive/dist/cpio/test/test_option_version.c ============================================================================== --- vendor/libarchive/dist/cpio/test/test_option_version.c Sat Aug 13 20:21:32 2016 (r304059) +++ vendor/libarchive/dist/cpio/test/test_option_version.c Sat Aug 13 21:20:06 2016 (r304060) @@ -75,7 +75,7 @@ verify(const char *p, size_t s) if (*q == 'a' || *q == 'b' || *q == 'c' || *q == 'd') ++q; /* Skip arbitrary third-party version numbers. */ - while (s > 0 && (*q == ' ' || *q == '/' || *q == '.' || isalnum(*q))) { + while (s > 0 && (*q == ' ' || *q == '-' || *q == '/' || *q == '.' || isalnum(*q))) { ++q; --s; } Modified: vendor/libarchive/dist/libarchive/archive_match.c ============================================================================== --- vendor/libarchive/dist/libarchive/archive_match.c Sat Aug 13 20:21:32 2016 (r304059) +++ vendor/libarchive/dist/libarchive/archive_match.c Sat Aug 13 21:20:06 2016 (r304060) @@ -655,7 +655,7 @@ add_pattern_from_file(struct archive_mat } } - /* If something error happend, report it immediately. */ + /* If an error occurred, report it immediately. */ if (r < ARCHIVE_OK) { archive_copy_error(&(a->archive), ar); archive_read_free(ar); Modified: vendor/libarchive/dist/libarchive/archive_ppmd7_private.h ============================================================================== --- vendor/libarchive/dist/libarchive/archive_ppmd7_private.h Sat Aug 13 20:21:32 2016 (r304059) +++ vendor/libarchive/dist/libarchive/archive_ppmd7_private.h Sat Aug 13 21:20:06 2016 (r304060) @@ -19,7 +19,7 @@ If you need the compatibility with origi #define PPMD7_MAX_ORDER 64 #define PPMD7_MIN_MEM_SIZE (1 << 11) -#define PPMD7_MAX_MEM_SIZE (0xFFFFFFFF - 12 * 3) +#define PPMD7_MAX_MEM_SIZE (0xFFFFFFFFu - 12 * 3) struct CPpmd7_Context_; Modified: vendor/libarchive/dist/libarchive/archive_read_add_passphrase.c ============================================================================== --- vendor/libarchive/dist/libarchive/archive_read_add_passphrase.c Sat Aug 13 20:21:32 2016 (r304059) +++ vendor/libarchive/dist/libarchive/archive_read_add_passphrase.c Sat Aug 13 21:20:06 2016 (r304060) @@ -125,7 +125,7 @@ void __archive_read_reset_passphrase(struct archive_read *a) { - a->passphrases.candiate = -1; + a->passphrases.candidate = -1; } /* @@ -137,31 +137,31 @@ __archive_read_next_passphrase(struct ar struct archive_read_passphrase *p; const char *passphrase; - if (a->passphrases.candiate < 0) { + if (a->passphrases.candidate < 0) { /* Count out how many passphrases we have. */ int cnt = 0; for (p = a->passphrases.first; p != NULL; p = p->next) cnt++; - a->passphrases.candiate = cnt; + a->passphrases.candidate = cnt; p = a->passphrases.first; - } else if (a->passphrases.candiate > 1) { + } else if (a->passphrases.candidate > 1) { /* Rotate a passphrase list. */ - a->passphrases.candiate--; + a->passphrases.candidate--; p = remove_passphrases_from_head(a); add_passphrase_to_tail(a, p); - /* Pick a new passphrase candiate up. */ + /* Pick a new passphrase candidate up. */ p = a->passphrases.first; - } else if (a->passphrases.candiate == 1) { - /* This case is that all cadiates failed to decryption. */ - a->passphrases.candiate = 0; + } else if (a->passphrases.candidate == 1) { + /* This case is that all candidates failed to decrypt. */ + a->passphrases.candidate = 0; if (a->passphrases.first->next != NULL) { /* Rotate a passphrase list. */ p = remove_passphrases_from_head(a); add_passphrase_to_tail(a, p); } p = NULL; - } else /* There is no passphrase candaite. */ + } else /* There is no passphrase candidate. */ p = NULL; if (p != NULL) @@ -177,7 +177,7 @@ __archive_read_next_passphrase(struct ar if (p == NULL) return (NULL); insert_passphrase_to_head(a, p); - a->passphrases.candiate = 1; + a->passphrases.candidate = 1; } } else passphrase = NULL; Modified: vendor/libarchive/dist/libarchive/archive_read_disk_entry_from_file.c ============================================================================== --- vendor/libarchive/dist/libarchive/archive_read_disk_entry_from_file.c Sat Aug 13 20:21:32 2016 (r304059) +++ vendor/libarchive/dist/libarchive/archive_read_disk_entry_from_file.c Sat Aug 13 21:20:06 2016 (r304060) @@ -642,13 +642,16 @@ translate_acl(struct archive_read_disk * * Libarchive stores "flag" (NFSv4 inheritance bits) * in the ae_perm bitmap. */ - acl_get_flagset_np(acl_entry, &acl_flagset); - for (i = 0; i < (int)(sizeof(acl_inherit_map) / sizeof(acl_inherit_map[0])); ++i) { - if (acl_get_flag_np(acl_flagset, - acl_inherit_map[i].platform_inherit)) - ae_perm |= acl_inherit_map[i].archive_inherit; - - } + // XXX acl_get_flagset_np on FreeBSD returns EINVAL for + // non-NFSv4 ACLs + r = acl_get_flagset_np(acl_entry, &acl_flagset); + if (r == 0) { + for (i = 0; i < (int)(sizeof(acl_inherit_map) / sizeof(acl_inherit_map[0])); ++i) { + if (acl_get_flag_np(acl_flagset, + acl_inherit_map[i].platform_inherit)) + ae_perm |= acl_inherit_map[i].archive_inherit; + } + } #endif acl_get_permset(acl_entry, &acl_permset); Modified: vendor/libarchive/dist/libarchive/archive_read_disk_posix.c ============================================================================== --- vendor/libarchive/dist/libarchive/archive_read_disk_posix.c Sat Aug 13 20:21:32 2016 (r304059) +++ vendor/libarchive/dist/libarchive/archive_read_disk_posix.c Sat Aug 13 21:20:06 2016 (r304060) @@ -938,7 +938,7 @@ next_entry(struct archive_read_disk *a, r = archive_match_path_excluded(a->matching, entry); if (r < 0) { archive_set_error(&(a->archive), errno, - "Faild : %s", archive_error_string(a->matching)); + "Failed : %s", archive_error_string(a->matching)); return (r); } if (r) { @@ -1041,7 +1041,7 @@ next_entry(struct archive_read_disk *a, r = archive_match_time_excluded(a->matching, entry); if (r < 0) { archive_set_error(&(a->archive), errno, - "Faild : %s", archive_error_string(a->matching)); + "Failed : %s", archive_error_string(a->matching)); return (r); } if (r) { @@ -1067,7 +1067,7 @@ next_entry(struct archive_read_disk *a, r = archive_match_owner_excluded(a->matching, entry); if (r < 0) { archive_set_error(&(a->archive), errno, - "Faild : %s", archive_error_string(a->matching)); + "Failed : %s", archive_error_string(a->matching)); return (r); } if (r) { Modified: vendor/libarchive/dist/libarchive/archive_read_disk_windows.c ============================================================================== --- vendor/libarchive/dist/libarchive/archive_read_disk_windows.c Sat Aug 13 20:21:32 2016 (r304059) +++ vendor/libarchive/dist/libarchive/archive_read_disk_windows.c Sat Aug 13 21:20:06 2016 (r304060) @@ -803,7 +803,7 @@ next_entry(struct archive_read_disk *a, r = archive_match_path_excluded(a->matching, entry); if (r < 0) { archive_set_error(&(a->archive), errno, - "Faild : %s", archive_error_string(a->matching)); + "Failed : %s", archive_error_string(a->matching)); return (r); } if (r) { @@ -875,7 +875,7 @@ next_entry(struct archive_read_disk *a, r = archive_match_time_excluded(a->matching, entry); if (r < 0) { archive_set_error(&(a->archive), errno, - "Faild : %s", archive_error_string(a->matching)); + "Failed : %s", archive_error_string(a->matching)); return (r); } if (r) { @@ -901,7 +901,7 @@ next_entry(struct archive_read_disk *a, r = archive_match_owner_excluded(a->matching, entry); if (r < 0) { archive_set_error(&(a->archive), errno, - "Faild : %s", archive_error_string(a->matching)); + "Failed : %s", archive_error_string(a->matching)); return (r); } if (r) { Modified: vendor/libarchive/dist/libarchive/archive_read_private.h ============================================================================== --- vendor/libarchive/dist/libarchive/archive_read_private.h Sat Aug 13 20:21:32 2016 (r304059) +++ vendor/libarchive/dist/libarchive/archive_read_private.h Sat Aug 13 21:20:06 2016 (r304060) @@ -221,7 +221,7 @@ struct archive_read { struct { struct archive_read_passphrase *first; struct archive_read_passphrase **last; - int candiate; + int candidate; archive_passphrase_callback *callback; void *client_data; } passphrases; Modified: vendor/libarchive/dist/libarchive/archive_read_support_filter_lz4.c ============================================================================== --- vendor/libarchive/dist/libarchive/archive_read_support_filter_lz4.c Sat Aug 13 20:21:32 2016 (r304059) +++ vendor/libarchive/dist/libarchive/archive_read_support_filter_lz4.c Sat Aug 13 21:20:06 2016 (r304060) @@ -595,7 +595,7 @@ lz4_filter_read_data_block(struct archiv #endif } - /* Check if an error happend in decompression process. */ + /* Check if an error occurred in the decompression process. */ if (uncompressed_size < 0) { archive_set_error(&(self->archive->archive), ARCHIVE_ERRNO_MISC, "lz4 decompression failed"); Modified: vendor/libarchive/dist/libarchive/archive_read_support_format_lha.c ============================================================================== --- vendor/libarchive/dist/libarchive/archive_read_support_format_lha.c Sat Aug 13 20:21:32 2016 (r304059) +++ vendor/libarchive/dist/libarchive/archive_read_support_format_lha.c Sat Aug 13 21:20:06 2016 (r304060) @@ -1715,8 +1715,11 @@ lha_crc16(uint16_t crc, const void *pp, #undef bswap16 #if defined(_MSC_VER) && _MSC_VER >= 1400 /* Visual Studio */ # define bswap16(x) _byteswap_ushort(x) -#elif (defined(__GNUC__) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 8) \ - || defined(__clang__) +#elif defined(__GNUC__) && ((__GNUC__ == 4 && __GNUC_MINOR__ >= 8) || __GNUC__ > 4) +/* GCC 4.8 and later has __builtin_bswap16() */ +# define bswap16(x) __builtin_bswap16(x) +#elif defined(__clang__) +/* All clang versions have __builtin_bswap16() */ # define bswap16(x) __builtin_bswap16(x) #else # define bswap16(x) ((((x) >> 8) & 0xff) | ((x) << 8)) Modified: vendor/libarchive/dist/libarchive/archive_read_support_format_warc.c ============================================================================== --- vendor/libarchive/dist/libarchive/archive_read_support_format_warc.c Sat Aug 13 20:21:32 2016 (r304059) +++ vendor/libarchive/dist/libarchive/archive_read_support_format_warc.c Sat Aug 13 21:20:06 2016 (r304060) @@ -318,7 +318,7 @@ start_over: } memcpy(w->pool.str, fnam.str, fnam.len); w->pool.str[fnam.len] = '\0'; - /* let noone else know about the pool, it's a secret, shhh */ + /* let no one else know about the pool, it's a secret, shhh */ fnam.str = w->pool.str; /* snarf mtime or deduce from rtime Modified: vendor/libarchive/dist/libarchive/archive_util.c ============================================================================== --- vendor/libarchive/dist/libarchive/archive_util.c Sat Aug 13 20:21:32 2016 (r304059) +++ vendor/libarchive/dist/libarchive/archive_util.c Sat Aug 13 21:20:06 2016 (r304060) @@ -580,7 +580,7 @@ void __archive_ensure_cloexec_flag(int fd) { #if defined(_WIN32) && !defined(__CYGWIN__) - (void)fd; /* UNSED */ + (void)fd; /* UNUSED */ #else int flags; Modified: vendor/libarchive/dist/libarchive/archive_write_disk_acl.c ============================================================================== --- vendor/libarchive/dist/libarchive/archive_write_disk_acl.c Sat Aug 13 20:21:32 2016 (r304059) +++ vendor/libarchive/dist/libarchive/archive_write_disk_acl.c Sat Aug 13 21:20:06 2016 (r304060) @@ -145,7 +145,7 @@ set_acl(struct archive *a, int fd, const gid_t ae_gid; const char *ae_name; int entries; - int i; + int i, r; ret = ARCHIVE_OK; entries = archive_acl_reset(abstract_acl, ae_requested_type); @@ -223,12 +223,16 @@ set_acl(struct archive *a, int fd, const } #ifdef ACL_TYPE_NFS4 - acl_get_flagset_np(acl_entry, &acl_flagset); - acl_clear_flags_np(acl_flagset); - for (i = 0; i < (int)(sizeof(acl_inherit_map) / sizeof(acl_inherit_map[0])); ++i) { - if (ae_permset & acl_inherit_map[i].archive_inherit) - acl_add_flag_np(acl_flagset, - acl_inherit_map[i].platform_inherit); + // XXX acl_get_flagset_np on FreeBSD returns EINVAL for + // non-NFSv4 ACLs + r = acl_get_flagset_np(acl_entry, &acl_flagset); + if (r == 0) { + acl_clear_flags_np(acl_flagset); + for (i = 0; i < (int)(sizeof(acl_inherit_map) / sizeof(acl_inherit_map[0])); ++i) { + if (ae_permset & acl_inherit_map[i].archive_inherit) + acl_add_flag_np(acl_flagset, + acl_inherit_map[i].platform_inherit); + } } #endif } Modified: vendor/libarchive/dist/libarchive/archive_write_disk_posix.c ============================================================================== --- vendor/libarchive/dist/libarchive/archive_write_disk_posix.c Sat Aug 13 20:21:32 2016 (r304059) +++ vendor/libarchive/dist/libarchive/archive_write_disk_posix.c Sat Aug 13 21:20:06 2016 (r304060) @@ -1796,7 +1796,7 @@ edit_deep_directories(struct archive_wri char *tail = a->name; /* If path is short, avoid the open() below. */ - if (strlen(tail) <= PATH_MAX) + if (strlen(tail) < PATH_MAX) return; /* Try to record our starting dir. */ @@ -1806,7 +1806,7 @@ edit_deep_directories(struct archive_wri return; /* As long as the path is too long... */ - while (strlen(tail) > PATH_MAX) { + while (strlen(tail) >= PATH_MAX) { /* Locate a dir prefix shorter than PATH_MAX. */ tail += PATH_MAX - 8; while (tail > a->name && *tail != '/') Modified: vendor/libarchive/dist/libarchive/archive_write_set_format_iso9660.c ============================================================================== --- vendor/libarchive/dist/libarchive/archive_write_set_format_iso9660.c Sat Aug 13 20:21:32 2016 (r304059) +++ vendor/libarchive/dist/libarchive/archive_write_set_format_iso9660.c Sat Aug 13 21:20:06 2016 (r304060) @@ -436,7 +436,7 @@ struct iso_option { * Type : string * Default: Auto detect * : We check a size of boot image; - * : If ths size is just 1.22M/1.44M/2.88M, + * : If the size is just 1.22M/1.44M/2.88M, * : we assume boot_type is 'fd'; * : otherwise boot_type is 'no-emulation'. * COMPAT : Modified: vendor/libarchive/dist/libarchive/archive_write_set_format_ustar.c ============================================================================== --- vendor/libarchive/dist/libarchive/archive_write_set_format_ustar.c Sat Aug 13 20:21:32 2016 (r304059) +++ vendor/libarchive/dist/libarchive/archive_write_set_format_ustar.c Sat Aug 13 21:20:06 2016 (r304060) @@ -307,7 +307,7 @@ archive_write_ustar_header(struct archiv * case getting WCS failed. On POSIX, this is a * normal operation. */ - if (p != NULL && p[strlen(p) - 1] != '/') { + if (p != NULL && p[0] != '\0' && p[strlen(p) - 1] != '/') { struct archive_string as; archive_string_init(&as); Modified: vendor/libarchive/dist/libarchive/test/CMakeLists.txt ============================================================================== --- vendor/libarchive/dist/libarchive/test/CMakeLists.txt Sat Aug 13 20:21:32 2016 (r304059) +++ vendor/libarchive/dist/libarchive/test/CMakeLists.txt Sat Aug 13 21:20:06 2016 (r304060) @@ -6,7 +6,7 @@ IF(ENABLE_TEST) SET(libarchive_test_SOURCES ../../test_utils/test_utils.c - main.c + main.c read_open_memory.c test.h test_acl_freebsd_nfs4.c @@ -164,6 +164,7 @@ IF(ENABLE_TEST) test_read_format_zip_encryption_header.c test_read_format_zip_encryption_partially.c test_read_format_zip_filename.c + test_read_format_zip_high_compression.c test_read_format_zip_mac_metadata.c test_read_format_zip_malformed.c test_read_format_zip_msdos.c @@ -198,6 +199,9 @@ IF(ENABLE_TEST) test_write_disk_no_hfs_compression.c 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: vendor/libarchive/dist/libarchive/test/main.c ============================================================================== --- vendor/libarchive/dist/libarchive/test/main.c Sat Aug 13 20:21:32 2016 (r304059) +++ vendor/libarchive/dist/libarchive/test/main.c Sat Aug 13 21:20:06 2016 (r304060) @@ -1440,6 +1440,31 @@ assertion_file_size(const char *file, in return (0); } +/* Verify mode of 'pathname'. */ +int +assertion_file_mode(const char *file, int line, const char *pathname, int expected_mode) +{ + int mode; + int r; + + assertion_count(file, line); +#if defined(_WIN32) && !defined(__CYGWIN__) + failure_start(file, line, "assertFileMode not yet implemented for Windows"); +#else + { + struct stat st; + r = lstat(pathname, &st); + mode = (int)(st.st_mode & 0777); + } + if (r == 0 && mode == expected_mode) + return (1); + failure_start(file, line, "File %s has mode %o, expected %o", + pathname, mode, expected_mode); +#endif + failure_finish(NULL); + return (0); +} + /* Assert that 'pathname' is a dir. If mode >= 0, verify that too. */ int assertion_is_dir(const char *file, int line, const char *pathname, int mode) Modified: vendor/libarchive/dist/libarchive/test/test.h ============================================================================== --- vendor/libarchive/dist/libarchive/test/test.h Sat Aug 13 20:21:32 2016 (r304059) +++ vendor/libarchive/dist/libarchive/test/test.h Sat Aug 13 21:20:06 2016 (r304060) @@ -182,6 +182,8 @@ assertion_file_nlinks(__FILE__, __LINE__, pathname, nlinks) #define assertFileSize(pathname, size) \ assertion_file_size(__FILE__, __LINE__, pathname, size) +#define assertFileMode(pathname, mode) \ + assertion_file_mode(__FILE__, __LINE__, pathname, mode) #define assertTextFileContents(text, pathname) \ assertion_text_file_contents(__FILE__, __LINE__, text, pathname) #define assertFileContainsLinesAnyOrder(pathname, lines) \ @@ -246,6 +248,7 @@ int assertion_file_mtime_recent(const ch int assertion_file_nlinks(const char *, int, const char *, int); int assertion_file_not_exists(const char *, int, const char *); int assertion_file_size(const char *, int, const char *, long); +int assertion_file_mode(const char *, int, const char *, int); int assertion_is_dir(const char *, int, const char *, int); int assertion_is_hardlink(const char *, int, const char *, const char *); int assertion_is_not_hardlink(const char *, int, const char *, const char *); Modified: vendor/libarchive/dist/libarchive/test/test_archive_string_conversion.c ============================================================================== --- vendor/libarchive/dist/libarchive/test/test_archive_string_conversion.c Sat Aug 13 20:21:32 2016 (r304059) +++ vendor/libarchive/dist/libarchive/test/test_archive_string_conversion.c Sat Aug 13 21:20:06 2016 (r304060) @@ -800,8 +800,8 @@ DEFINE_TEST(test_archive_string_conversi assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assert((fp = fopen(testdata, "w")) != NULL); while ((size = archive_read_data(a, buff, 512)) > 0) - fwrite(buff, 1, size, fp); - fclose(fp); + assertEqualInt(size, fwrite(buff, 1, size, fp)); + assertEqualInt(0, fclose(fp)); assertEqualInt(ARCHIVE_OK, archive_read_free(a)); test_archive_string_normalization_nfc(testdata); Modified: vendor/libarchive/dist/libarchive/test/test_fuzz.c ============================================================================== --- vendor/libarchive/dist/libarchive/test/test_fuzz.c Sat Aug 13 20:21:32 2016 (r304059) +++ vendor/libarchive/dist/libarchive/test/test_fuzz.c Sat Aug 13 21:20:06 2016 (r304060) @@ -110,13 +110,17 @@ test_fuzz(const struct files *filesets) for (i = 0; filesets[n].names[i] != NULL; ++i) { tmp = slurpfile(&size, filesets[n].names[i]); - rawimage = (char *)realloc(rawimage, oldsize + size); + char *newraw = (char *)realloc(rawimage, oldsize + size); + if (!assert(newraw != NULL)) + { + free(rawimage); + continue; + } + rawimage = newraw; memcpy(rawimage + oldsize, tmp, size); oldsize += size; size = oldsize; free(tmp); - if (!assert(rawimage != NULL)) - continue; } } if (size == 0) Modified: vendor/libarchive/dist/libarchive/test/test_read_format_rar.c ============================================================================== --- vendor/libarchive/dist/libarchive/test/test_read_format_rar.c Sat Aug 13 20:21:32 2016 (r304059) +++ vendor/libarchive/dist/libarchive/test/test_read_format_rar.c Sat Aug 13 21:20:06 2016 (r304060) @@ -3603,7 +3603,7 @@ DEFINE_TEST(test_read_format_rar_multivo assertEqualIntA(a, 0, archive_read_data(a, buff, sizeof(buff))); /* - * Eigth header. + * Eighth header. */ assertA(0 == archive_read_next_header(a, &ae)); assertEqualString("testdir/testsymlink6", archive_entry_pathname(ae)); Added: vendor/libarchive/dist/libarchive/test/test_read_format_zip_high_compression.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/libarchive/dist/libarchive/test/test_read_format_zip_high_compression.c Sat Aug 13 21:20:06 2016 (r304060) @@ -0,0 +1,143 @@ +/*- + * Copyright (c) 2016 Tim Kientzle + * 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 AUTHOR(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 AUTHOR(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 "test.h" +__FBSDID("$FreeBSD"); + +#include + + +/* + * Github Issue 748 reported problems with end-of-entry handling + * with highly-compressible data. This resulted in the end of the + * data being truncated (extracted as zero bytes). + */ + +/* + * Extract the specific test archive that was used to diagnose + * Issue 748: + */ +DEFINE_TEST(test_read_format_zip_high_compression) +{ + const char *refname = "test_read_format_zip_high_compression.zip"; + char *p; + size_t archive_size; + struct archive *a; + struct archive_entry *entry; + + const void *pv; + size_t s; + int64_t o; + + extract_reference_file(refname); + p = slurpfile(&archive_size, refname); + + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_zip(a)); + assertEqualIntA(a, ARCHIVE_OK, read_open_memory_seek(a, p, archive_size, 16 * 1024)); + assertEqualInt(ARCHIVE_OK, archive_read_next_header(a, &entry)); + + assertEqualInt(ARCHIVE_OK, archive_read_data_block(a, &pv, &s, &o)); + assertEqualInt(262144, s); + assertEqualInt(0, o); + + assertEqualInt(ARCHIVE_OK, archive_read_data_block(a, &pv, &s, &o)); + assertEqualInt(160, s); + assertEqualInt(262144, o); + + assertEqualInt(ARCHIVE_EOF, archive_read_data_block(a, &pv, &s, &o)); + + assertEqualInt(ARCHIVE_OK, archive_free(a)); + free(p); +} + +/* + * Synthesize a lot of varying inputs that are highly compressible. + */ +DEFINE_TEST(test_read_format_zip_high_compression2) +{ + const size_t body_size = 1024 * 1024; + const size_t buff_size = 2 * 1024 * 1024; + char *body, *body_read, *buff; + int n; + + assert((body = malloc(body_size)) != NULL); + assert((body_read = malloc(body_size)) != NULL); + assert((buff = malloc(buff_size)) != NULL); + + /* Highly-compressible data: all bytes 255, except for a + * single 1 byte. + * The body is always 256k + 6 bytes long (the internal deflation + * buffer is exactly 256k). + */ + + for(n = 1024; n < (int)body_size; n += 1024) { + struct archive *a; + struct archive_entry *entry; + size_t used = 0; + const void *pv; + size_t s; + int64_t o; + + memset(body, 255, body_size); + body[n] = 1; + + /* Write an archive with a single entry of n bytes. */ + assert((a = archive_write_new()) != NULL); + assertEqualInt(ARCHIVE_OK, archive_write_set_format_zip(a)); + assertEqualInt(ARCHIVE_OK, archive_write_open_memory(a, buff, buff_size, &used)); + + entry = archive_entry_new2(a); + archive_entry_set_pathname(entry, "test"); + archive_entry_set_filetype(entry, AE_IFREG); + archive_entry_set_size(entry, 262150); + assertEqualInt(ARCHIVE_OK, archive_write_header(a, entry)); + archive_entry_free(entry); + assertEqualInt(262150, archive_write_data(a, body, 262150)); + assertEqualInt(ARCHIVE_OK, archive_write_free(a)); + + /* Read back the entry and verify the contents. */ + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); + assertEqualIntA(a, ARCHIVE_OK, read_open_memory(a, buff, used, 17)); + assertEqualInt(ARCHIVE_OK, archive_read_next_header(a, &entry)); + + assertEqualInt(ARCHIVE_OK, archive_read_data_block(a, &pv, &s, &o)); + assertEqualInt(262144, s); + assertEqualInt(0, o); + + assertEqualInt(ARCHIVE_OK, archive_read_data_block(a, &pv, &s, &o)); + assertEqualInt(6, s); + assertEqualInt(262144, o); + + assertEqualInt(ARCHIVE_EOF, archive_read_data_block(a, &pv, &s, &o)); + + assertEqualInt(ARCHIVE_OK, archive_free(a)); + } + + free(body); + free(body_read); + free(buff); +} Added: vendor/libarchive/dist/libarchive/test/test_read_format_zip_high_compression.zip.uu ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/libarchive/dist/libarchive/test/test_read_format_zip_high_compression.zip.uu Sat Aug 13 21:20:06 2016 (r304060) @@ -0,0 +1,18 @@ +begin 644 test_read_format_zip_high_compression.zip +M4$L#!!0`"``(`*=Y]4@``````````*``!``(`"``8VAA +MD5>>))%7GB215W5X"P`!!/8!```$%````.W=06K#,!`%T&E)P8LL?*2XC@N% +M)#5QO>AM@9WDJ6!%\6$K/Q6T3LAX]N/GQ'Z9G&KA^*K1'S +M.`[GOIM*[TP_Q_>O0[G_:3X.Y\^^V/X2<>))%7=7@+``$$]@$```04````4$L%!@`````!``$`5@````L"```` +!```` +` +end Added: vendor/libarchive/dist/libarchive/test/test_write_disk_secure744.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/libarchive/dist/libarchive/test/test_write_disk_secure744.c Sat Aug 13 21:20:06 2016 (r304060) @@ -0,0 +1,95 @@ +/*- + * Copyright (c) 2003-2007,2016 Tim Kientzle + * 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 AUTHOR(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 AUTHOR(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 "test.h" +__FBSDID("$FreeBSD$"); + +#define UMASK 022 + +/* + * Github Issue #744 describes a bug in the sandboxing code that + * causes very long pathnames to not get checked for symlinks. + */ + +DEFINE_TEST(test_write_disk_secure744) +{ +#if defined(_WIN32) && !defined(__CYGWIN__) + skipping("archive_write_disk security checks not supported on Windows"); +#else + struct archive *a; + struct archive_entry *ae; + size_t buff_size = 8192; + char *buff = malloc(buff_size); + char *p = buff; + int n = 0; + int t; + + assert(buff != NULL); + + /* Start with a known umask. */ + assertUmask(UMASK); + + /* Create an archive_write_disk object. */ + assert((a = archive_write_disk_new()) != NULL); + archive_write_disk_set_options(a, ARCHIVE_EXTRACT_SECURE_SYMLINKS); + + while (p + 500 < buff + buff_size) { + memset(p, 'x', 100); + p += 100; + p[0] = '\0'; + + buff[0] = ((n / 1000) % 10) + '0'; + buff[1] = ((n / 100) % 10)+ '0'; + buff[2] = ((n / 10) % 10)+ '0'; + buff[3] = ((n / 1) % 10)+ '0'; + buff[4] = '_'; + ++n; + + /* Create a symlink pointing to the testworkdir */ + assert((ae = archive_entry_new()) != NULL); + archive_entry_copy_pathname(ae, buff); + archive_entry_set_mode(ae, S_IFREG | 0777); + archive_entry_copy_symlink(ae, testworkdir); + assertEqualIntA(a, ARCHIVE_OK, archive_write_header(a, ae)); + archive_entry_free(ae); + + *p++ = '/'; + sprintf(p, "target%d", n); + + /* Try to create a file through the symlink, should fail. */ + assert((ae = archive_entry_new()) != NULL); + archive_entry_copy_pathname(ae, buff); + archive_entry_set_mode(ae, S_IFDIR | 0777); + + t = archive_write_header(a, ae); + archive_entry_free(ae); + failure("Attempt to create target%d via %d-character symlink should have failed", n, (int)strlen(buff)); + if(!assertEqualInt(ARCHIVE_FAILED, t)) { + break; + } + } + archive_free(a); + free(buff); +#endif +} Added: vendor/libarchive/dist/libarchive/test/test_write_disk_secure745.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/libarchive/dist/libarchive/test/test_write_disk_secure745.c Sat Aug 13 21:20:06 2016 (r304060) @@ -0,0 +1,76 @@ +/*- + * Copyright (c) 2003-2007,2016 Tim Kientzle + * 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 AUTHOR(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 AUTHOR(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 "test.h" +__FBSDID("$FreeBSD$"); + +#define UMASK 022 + +/* + * Github Issue #745 describes a bug in the sandboxing code that + * allows one to use a symlink to edit the permissions on a file or + * directory outside of the sandbox. + */ + +DEFINE_TEST(test_write_disk_secure745) +{ +#if defined(_WIN32) && !defined(__CYGWIN__) + skipping("archive_write_disk security checks not supported on Windows"); +#else + struct archive *a; + struct archive_entry *ae; + + /* Start with a known umask. */ + assertUmask(UMASK); + + /* Create an archive_write_disk object. */ + assert((a = archive_write_disk_new()) != NULL); + archive_write_disk_set_options(a, ARCHIVE_EXTRACT_SECURE_SYMLINKS); + + /* The target dir: The one we're going to try to change permission on */ + assertMakeDir("target", 0700); + + /* The sandbox dir we're going to run inside of. */ + assertMakeDir("sandbox", 0700); + assertChdir("sandbox"); + + /* Create a symlink pointing to the target directory */ + assert((ae = archive_entry_new()) != NULL); + archive_entry_copy_pathname(ae, "sym"); + archive_entry_set_mode(ae, S_IFREG | 0777); + archive_entry_copy_symlink(ae, "../target"); + assert(0 == archive_write_header(a, ae)); + archive_entry_free(ae); + + /* Try to alter the target dir through the symlink; this should fail. */ + assert((ae = archive_entry_new()) != NULL); + archive_entry_copy_pathname(ae, "sym"); + archive_entry_set_mode(ae, S_IFDIR | 0777); + assert(0 == archive_write_header(a, ae)); + archive_entry_free(ae); + + /* Permission of target dir should not have changed. */ + assertFileMode("../target", 0700); +#endif +} Added: vendor/libarchive/dist/libarchive/test/test_write_disk_secure746.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/libarchive/dist/libarchive/test/test_write_disk_secure746.c Sat Aug 13 21:20:06 2016 (r304060) @@ -0,0 +1,125 @@ +/*- + * Copyright (c) 2003-2007,2016 Tim Kientzle + * 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 AUTHOR(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 AUTHOR(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 "test.h" +__FBSDID("$FreeBSD$"); + +#define UMASK 022 + +/* + * Github Issue #746 describes a problem in which hardlink targets are + * not adequately checked and can be used to modify entries outside of + * the sandbox. + */ + +/* + * Verify that ARCHIVE_EXTRACT_SECURE_NODOTDOT disallows '..' in hardlink + * targets. + */ +DEFINE_TEST(test_write_disk_secure746a) +{ +#if defined(_WIN32) && !defined(__CYGWIN__) + skipping("archive_write_disk security checks not supported on Windows"); +#else + struct archive *a; + struct archive_entry *ae; + + /* Start with a known umask. */ + assertUmask(UMASK); + + /* The target directory we're going to try to affect. */ + assertMakeDir("target", 0700); + assertMakeFile("target/foo", 0700, "unmodified"); + + /* The sandbox dir we're going to work within. */ + assertMakeDir("sandbox", 0700); + assertChdir("sandbox"); + + /* Create an archive_write_disk object. */ + assert((a = archive_write_disk_new()) != NULL); + archive_write_disk_set_options(a, ARCHIVE_EXTRACT_SECURE_NODOTDOT); + + /* Attempt to hardlink to the target directory. */ + assert((ae = archive_entry_new()) != NULL); + archive_entry_copy_pathname(ae, "bar"); + archive_entry_set_mode(ae, S_IFREG | 0777); + archive_entry_set_size(ae, 8); + archive_entry_copy_hardlink(ae, "../target/foo"); + assertEqualInt(ARCHIVE_FAILED, archive_write_header(a, ae)); + assertEqualInt(ARCHIVE_FAILED, archive_write_data(a, "modified", 8)); + archive_entry_free(ae); + + /* Verify that target file contents are unchanged. */ + assertTextFileContents("unmodified", "../target/foo"); +#endif +} + +/* + * Verify that ARCHIVE_EXTRACT_SECURE_NOSYMLINK disallows symlinks in hardlink + * targets. + */ +DEFINE_TEST(test_write_disk_secure746b) +{ +#if defined(_WIN32) && !defined(__CYGWIN__) + skipping("archive_write_disk security checks not supported on Windows"); +#else + struct archive *a; + struct archive_entry *ae; + + /* Start with a known umask. */ + assertUmask(UMASK); + + /* The target directory we're going to try to affect. */ + assertMakeDir("target", 0700); + assertMakeFile("target/foo", 0700, "unmodified"); + + /* The sandbox dir we're going to work within. */ + assertMakeDir("sandbox", 0700); + assertChdir("sandbox"); + + /* Create an archive_write_disk object. */ + assert((a = archive_write_disk_new()) != NULL); + archive_write_disk_set_options(a, ARCHIVE_EXTRACT_SECURE_SYMLINKS); + + /* Create a symlink to the target directory. */ + assert((ae = archive_entry_new()) != NULL); + archive_entry_copy_pathname(ae, "symlink"); + archive_entry_copy_symlink(ae, "../target"); + assertEqualInt(ARCHIVE_FAILED, archive_write_header(a, ae)); + archive_entry_free(ae); + + /* Attempt to hardlink to the target directory via the symlink. */ + assert((ae = archive_entry_new()) != NULL); + archive_entry_copy_pathname(ae, "bar"); + archive_entry_set_mode(ae, S_IFREG | 0777); + archive_entry_set_size(ae, 8); + archive_entry_copy_hardlink(ae, "symlink/foo"); + assertEqualInt(ARCHIVE_FAILED, archive_write_header(a, ae)); + assertEqualInt(ARCHIVE_FAILED, archive_write_data(a, "modified", 8)); + archive_entry_free(ae); + + /* Verify that target file contents are unchanged. */ + assertTextFileContents("unmodified", "../target/foo"); *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***