From owner-svn-src-user@freebsd.org  Sun Oct  9 18:39:14 2016
Return-Path: <owner-svn-src-user@freebsd.org>
Delivered-To: svn-src-user@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 62BB3C07D07
 for <svn-src-user@mailman.ysv.freebsd.org>;
 Sun,  9 Oct 2016 18:39:14 +0000 (UTC) (envelope-from alc@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 329C8E1D;
 Sun,  9 Oct 2016 18:39:14 +0000 (UTC) (envelope-from alc@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u99IdDh7056433;
 Sun, 9 Oct 2016 18:39:13 GMT (envelope-from alc@FreeBSD.org)
Received: (from alc@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id u99IdD9A056432;
 Sun, 9 Oct 2016 18:39:13 GMT (envelope-from alc@FreeBSD.org)
Message-Id: <201610091839.u99IdD9A056432@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org
 using -f
From: Alan Cox <alc@FreeBSD.org>
Date: Sun, 9 Oct 2016 18:39:13 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
Subject: svn commit: r306908 - user/alc/PQ_LAUNDRY/sys/vm
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.23
Precedence: list
List-Id: "SVN commit messages for the experimental &quot; user&quot;
 src tree" <svn-src-user.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-user>,
 <mailto:svn-src-user-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-user/>
List-Post: <mailto:svn-src-user@freebsd.org>
List-Help: <mailto:svn-src-user-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-user>,
 <mailto:svn-src-user-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sun, 09 Oct 2016 18:39:14 -0000

Author: alc
Date: Sun Oct  9 18:39:13 2016
New Revision: 306908
URL: https://svnweb.freebsd.org/changeset/base/306908

Log:
  By the time that we've laundered a page, it has gone unreferenced for a
  long time, especially if it was background laundered.  So, it makes more
  sense to place the page nearer the head of the inactive queue than the
  tail.
  
  Reviewed by:	markj

Modified:
  user/alc/PQ_LAUNDRY/sys/vm/swap_pager.c

Modified: user/alc/PQ_LAUNDRY/sys/vm/swap_pager.c
==============================================================================
--- user/alc/PQ_LAUNDRY/sys/vm/swap_pager.c	Sun Oct  9 13:59:38 2016	(r306907)
+++ user/alc/PQ_LAUNDRY/sys/vm/swap_pager.c	Sun Oct  9 18:39:13 2016	(r306908)
@@ -1549,13 +1549,16 @@ swp_pager_async_iodone(struct buf *bp)
 			 * For write success, clear the dirty
 			 * status, then finish the I/O ( which decrements the
 			 * busy count and possibly wakes waiter's up ).
+			 * A page is only written to swap after a period of
+			 * inactivity.  Therefore, we do not expect it to be
+			 * reused.
 			 */
 			KASSERT(!pmap_page_is_write_mapped(m),
 			    ("swp_pager_async_iodone: page %p is not write"
 			    " protected", m));
 			vm_page_undirty(m);
 			vm_page_lock(m);
-			vm_page_deactivate(m);
+			vm_page_deactivate_noreuse(m);
 			vm_page_unlock(m);
 			vm_page_sunbusy(m);
 		}

From owner-svn-src-user@freebsd.org  Mon Oct 10 08:46:28 2016
Return-Path: <owner-svn-src-user@freebsd.org>
Delivered-To: svn-src-user@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 968F7C0B360
 for <svn-src-user@mailman.ysv.freebsd.org>;
 Mon, 10 Oct 2016 08:46:28 +0000 (UTC) (envelope-from pho@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 56CAA7A5;
 Mon, 10 Oct 2016 08:46:28 +0000 (UTC) (envelope-from pho@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9A8kRNp079530;
 Mon, 10 Oct 2016 08:46:27 GMT (envelope-from pho@FreeBSD.org)
Received: (from pho@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9A8kQtt079523;
 Mon, 10 Oct 2016 08:46:26 GMT (envelope-from pho@FreeBSD.org)
Message-Id: <201610100846.u9A8kQtt079523@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: pho set sender to pho@FreeBSD.org
 using -f
From: Peter Holm <pho@FreeBSD.org>
Date: Mon, 10 Oct 2016 08:46:26 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
Subject: svn commit: r306943 - user/pho/stress2/misc
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.23
Precedence: list
List-Id: "SVN commit messages for the experimental &quot; user&quot;
 src tree" <svn-src-user.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-user>,
 <mailto:svn-src-user-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-user/>
List-Post: <mailto:svn-src-user@freebsd.org>
List-Help: <mailto:svn-src-user-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-user>,
 <mailto:svn-src-user-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 10 Oct 2016 08:46:28 -0000

Author: pho
Date: Mon Oct 10 08:46:26 2016
New Revision: 306943
URL: https://svnweb.freebsd.org/changeset/base/306943

Log:
  Exit tests if mdconfig(8) fail.
  
  Sponsored by:	Dell EMC Isilon

Modified:
  user/pho/stress2/misc/mount2.sh
  user/pho/stress2/misc/mountro.sh
  user/pho/stress2/misc/mountro2.sh
  user/pho/stress2/misc/mountro3.sh
  user/pho/stress2/misc/newfs3.sh
  user/pho/stress2/misc/umountf4.sh
  user/pho/stress2/misc/umountf6.sh

Modified: user/pho/stress2/misc/mount2.sh
==============================================================================
--- user/pho/stress2/misc/mount2.sh	Mon Oct 10 07:19:16 2016	(r306942)
+++ user/pho/stress2/misc/mount2.sh	Mon Oct 10 08:46:26 2016	(r306943)
@@ -42,11 +42,12 @@ if [ $# -eq 0 ]; then
 	for i in `jot $mounts`; do
 		m=$(( i + mdstart - 1 ))
 		[ ! -d ${mntpoint}$m ] && mkdir ${mntpoint}$m
-		mount | grep "${mntpoint}" | grep -q md$m && umount ${mntpoint}$m
+		mount | grep "${mntpoint}" | grep -q md$m &&
+		    umount ${mntpoint}$m
 		mdconfig -l | grep -q md$m &&  mdconfig -d -u $m
 
 		dd if=/dev/zero of=$D$m bs=1m count=1 > /dev/null 2>&1
-		mdconfig -a -t vnode -f $D$m -u $m
+		mdconfig -a -t vnode -f $D$m -u $m || { rm -f $D$m; exit 1; }
 		bsdlabel -w md$m auto
 		newfs md${m}${part} > /dev/null 2>&1
 	done

Modified: user/pho/stress2/misc/mountro.sh
==============================================================================
--- user/pho/stress2/misc/mountro.sh	Mon Oct 10 07:19:16 2016	(r306942)
+++ user/pho/stress2/misc/mountro.sh	Mon Oct 10 08:46:26 2016	(r306943)
@@ -39,7 +39,7 @@ dede $D 1m 128 || exit
 mount | grep "$mntpoint"    | grep -q /md  && umount -f ${mntpoint}
 mdconfig -l | grep -q ${mdstart}  &&  mdconfig -d -u $mdstart
 
-mdconfig -a -t vnode -f $D -u $mdstart
+mdconfig -a -t vnode -f $D -u $mdstart || { rm -f $D; exit 1; }
 
 bsdlabel -w md${mdstart} auto
 newfs $newfs_flags md${mdstart}${part} > /dev/null 2>&1

Modified: user/pho/stress2/misc/mountro2.sh
==============================================================================
--- user/pho/stress2/misc/mountro2.sh	Mon Oct 10 07:19:16 2016	(r306942)
+++ user/pho/stress2/misc/mountro2.sh	Mon Oct 10 08:46:26 2016	(r306943)
@@ -41,7 +41,7 @@ dede $D 1m 20 || exit
 mount | grep "$mntpoint"    | grep -q /md  && umount -f ${mntpoint}
 mdconfig -l | grep -q ${mdstart}  &&  mdconfig -d -u $mdstart
 
-mdconfig -a -t vnode -f $D -u $mdstart
+mdconfig -a -t vnode -f $D -u $mdstart || { rm -f $D; exit 1; }
 
 bsdlabel -w md${mdstart} auto
 newfs $newfs_flags md${mdstart}${part} > /dev/null 2>&1

Modified: user/pho/stress2/misc/mountro3.sh
==============================================================================
--- user/pho/stress2/misc/mountro3.sh	Mon Oct 10 07:19:16 2016	(r306942)
+++ user/pho/stress2/misc/mountro3.sh	Mon Oct 10 08:46:26 2016	(r306943)
@@ -41,7 +41,7 @@ dede $D 1m 64 || exit 1
 mount | grep "$mntpoint" | grep md${mdstart}${part} > /dev/null && umount $mntpoint
 mdconfig -l | grep md${mdstart} > /dev/null &&  mdconfig -d -u ${mdstart}
 
-mdconfig -a -t vnode -f $D -u ${mdstart}
+mdconfig -a -t vnode -f $D -u ${mdstart} || { rm -f $D; exit 1; }
 bsdlabel -w md${mdstart} auto
 newfs $newfs_flags md${mdstart}${part} > /dev/null 2>&1
 

Modified: user/pho/stress2/misc/newfs3.sh
==============================================================================
--- user/pho/stress2/misc/newfs3.sh	Mon Oct 10 07:19:16 2016	(r306942)
+++ user/pho/stress2/misc/newfs3.sh	Mon Oct 10 08:46:26 2016	(r306943)
@@ -51,7 +51,8 @@ while [ $size -le $((128 * 1024 * 1024))
 	rm -f $diskimage
 	dd if=/dev/zero of=$diskimage bs=1m count=$mb 2>&1 |
 	    egrep -v "records|transferred"
-	mdconfig -a -t vnode -f $diskimage -u $mdstart
+	mdconfig -a -t vnode -f $diskimage -u $mdstart ||
+	    { rm -f $diskimage; exit 1; }
 	bsdlabel -w md$mdstart auto
 	blocksize=4096
 	while [ $blocksize -le 65536 ]; do

Modified: user/pho/stress2/misc/umountf4.sh
==============================================================================
--- user/pho/stress2/misc/umountf4.sh	Mon Oct 10 07:19:16 2016	(r306942)
+++ user/pho/stress2/misc/umountf4.sh	Mon Oct 10 08:46:26 2016	(r306943)
@@ -46,7 +46,8 @@ if [ $# -eq 0 ]; then
 		mdconfig -l | grep -q md$m &&  mdconfig -d -u $m
 
 		dede $D$m 1m 10
-		mdconfig -a -t vnode -f $D$m -u $m
+		mdconfig -a -t vnode -f $D$m -u $m ||
+		    { rm -f $D$m; exit 1; }
 		bsdlabel -w md$m auto
 		newfs md${m}${part} > /dev/null 2>&1
 	done

Modified: user/pho/stress2/misc/umountf6.sh
==============================================================================
--- user/pho/stress2/misc/umountf6.sh	Mon Oct 10 07:19:16 2016	(r306942)
+++ user/pho/stress2/misc/umountf6.sh	Mon Oct 10 08:46:26 2016	(r306943)
@@ -48,7 +48,8 @@ if [ $# -eq 0 ]; then
 		dede $D$m 1m 10
 		dd if=/dev/zero of=$D$m bs=1m count=10 2>&1 |
 			egrep -v "records|transferred"
-		mdconfig -a -t vnode -f $D$m -u $m
+		mdconfig -a -t vnode -f $D$m -u $m ||
+		    { rm -f $D$m; exit 1; }
 		bsdlabel -w md$m auto
 		newfs $newfs_flags md${m}$part > /dev/null 2>&1
 	done

From owner-svn-src-user@freebsd.org  Mon Oct 10 10:58:21 2016
Return-Path: <owner-svn-src-user@freebsd.org>
Delivered-To: svn-src-user@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 5D810C07762
 for <svn-src-user@mailman.ysv.freebsd.org>;
 Mon, 10 Oct 2016 10:58:21 +0000 (UTC) (envelope-from pho@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 398F4A37;
 Mon, 10 Oct 2016 10:58:21 +0000 (UTC) (envelope-from pho@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9AAwKWl029261;
 Mon, 10 Oct 2016 10:58:20 GMT (envelope-from pho@FreeBSD.org)
Received: (from pho@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9AAwIbL029243;
 Mon, 10 Oct 2016 10:58:18 GMT (envelope-from pho@FreeBSD.org)
Message-Id: <201610101058.u9AAwIbL029243@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: pho set sender to pho@FreeBSD.org
 using -f
From: Peter Holm <pho@FreeBSD.org>
Date: Mon, 10 Oct 2016 10:58:18 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
Subject: svn commit: r306945 - user/pho/stress2/misc
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.23
Precedence: list
List-Id: "SVN commit messages for the experimental &quot; user&quot;
 src tree" <svn-src-user.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-user>,
 <mailto:svn-src-user-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-user/>
List-Post: <mailto:svn-src-user@freebsd.org>
List-Help: <mailto:svn-src-user-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-user>,
 <mailto:svn-src-user-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 10 Oct 2016 10:58:21 -0000

Author: pho
Date: Mon Oct 10 10:58:18 2016
New Revision: 306945
URL: https://svnweb.freebsd.org/changeset/base/306945

Log:
  Fix or add cleanup after tests.
  
  Sponsored by:	Dell EMC Isilon

Modified:
  user/pho/stress2/misc/core.sh
  user/pho/stress2/misc/core2.sh
  user/pho/stress2/misc/core3.sh
  user/pho/stress2/misc/credleak.sh
  user/pho/stress2/misc/crossmp6.sh
  user/pho/stress2/misc/link.sh
  user/pho/stress2/misc/mmap2.sh
  user/pho/stress2/misc/mmap27.sh
  user/pho/stress2/misc/mmap28.sh
  user/pho/stress2/misc/pfl.sh
  user/pho/stress2/misc/pthread9.sh
  user/pho/stress2/misc/rename10.sh
  user/pho/stress2/misc/rename7.sh
  user/pho/stress2/misc/suj10.sh
  user/pho/stress2/misc/symlink.sh
  user/pho/stress2/misc/symlink2.sh
  user/pho/stress2/misc/tmpfs9.sh
  user/pho/stress2/misc/truss.sh

Modified: user/pho/stress2/misc/core.sh
==============================================================================
--- user/pho/stress2/misc/core.sh	Mon Oct 10 09:54:01 2016	(r306944)
+++ user/pho/stress2/misc/core.sh	Mon Oct 10 10:58:18 2016	(r306945)
@@ -49,7 +49,7 @@ for i in `jot 2`; do
 		wait
 	done
 done
-rm -f core
+rm -f /tmp/core
 exit
 EOF
 #include <err.h>

Modified: user/pho/stress2/misc/core2.sh
==============================================================================
--- user/pho/stress2/misc/core2.sh	Mon Oct 10 09:54:01 2016	(r306944)
+++ user/pho/stress2/misc/core2.sh	Mon Oct 10 10:58:18 2016	(r306945)
@@ -62,7 +62,7 @@ wait
 mount | grep -q "on $mntpoint " &&
     umount -f $mntpoint
 mdconfig -d -u $mdstart
-rm -f core2
+rm -f /tmp/core2
 exit
 EOF
 #include <sys/mman.h>

Modified: user/pho/stress2/misc/core3.sh
==============================================================================
--- user/pho/stress2/misc/core3.sh	Mon Oct 10 09:54:01 2016	(r306944)
+++ user/pho/stress2/misc/core3.sh	Mon Oct 10 10:58:18 2016	(r306945)
@@ -96,7 +96,7 @@ status=$?
 mount | grep -q "on $mntpoint " &&
     umount -f $mntpoint
 
-rm -f core3
+rm -f /tmp/core3
 exit $status
 EOF
 #include <sys/mman.h>

Modified: user/pho/stress2/misc/credleak.sh
==============================================================================
--- user/pho/stress2/misc/credleak.sh	Mon Oct 10 09:54:01 2016	(r306944)
+++ user/pho/stress2/misc/credleak.sh	Mon Oct 10 10:58:18 2016	(r306945)
@@ -64,7 +64,7 @@ done > /dev/null 2>&1
 while mount | grep $mntpoint | grep -q tmpfs; do
 	umount $mntpoint || sleep 1
 done
-[ -n "`ls $mntpoint`" ] && find $mntpoint/* -delete
+[ -d "$mntpoint" ] && (cd $mntpoint && find . -delete)
 rm -f /tmp/credleak
 
 s=0
@@ -145,8 +145,10 @@ main(int argc, char **argv)
 {
 	int i, j;
 
-	if (argc != 2)
-		errx(1, "Usage: %s <full path to dir>", argv[0]);
+	if (argc != 2) {
+		fprintf(stderr, "Usage: %s <full path to dir>", argv[0]);
+		exit(1);
+	}
 	dir = argv[1];
 
 	for (j = 0; j < LOOPS; j++) {

Modified: user/pho/stress2/misc/crossmp6.sh
==============================================================================
--- user/pho/stress2/misc/crossmp6.sh	Mon Oct 10 09:54:01 2016	(r306944)
+++ user/pho/stress2/misc/crossmp6.sh	Mon Oct 10 10:58:18 2016	(r306945)
@@ -63,8 +63,10 @@ if [ $# -eq 0 ]; then
 	wait
 	mount -t nfs -o tcp -o nfsv3 -o retrycnt=1 -o soft,timeout=1 \
 	    -o rw $nfs_export $mntpoint || exit 0
-	rm -f /mnt/$0.*
+	sleep .5
+	rm -f $mntpoint/$0.*
 	umount $mntpoint
+	rm -f $mntpoint*/$0.*
 	exit 0
 else
 	if [ $1 = find ]; then

Modified: user/pho/stress2/misc/link.sh
==============================================================================
--- user/pho/stress2/misc/link.sh	Mon Oct 10 09:54:01 2016	(r306944)
+++ user/pho/stress2/misc/link.sh	Mon Oct 10 10:58:18 2016	(r306945)
@@ -87,6 +87,7 @@ done > /dev/null 2>&1
 while mount | grep $mntpoint | grep -q tmpfs; do
 	umount $mntpoint || sleep 1
 done
+[ -d "$mntpoint" ] && (cd $mntpoint && find . -delete)
 rm -f /tmp/link
 exit 0
 EOF

Modified: user/pho/stress2/misc/mmap2.sh
==============================================================================
--- user/pho/stress2/misc/mmap2.sh	Mon Oct 10 09:54:01 2016	(r306944)
+++ user/pho/stress2/misc/mmap2.sh	Mon Oct 10 10:58:18 2016	(r306945)
@@ -45,7 +45,7 @@ start=`date '+%s'`
 while [ $((`date '+%s'` - start)) -lt 600 ]; do
 	./mmap2
 done
-rm -f ./mmap2
+rm -f ./mmap2*
 exit
 
 EOF

Modified: user/pho/stress2/misc/mmap27.sh
==============================================================================
--- user/pho/stress2/misc/mmap27.sh	Mon Oct 10 09:54:01 2016	(r306944)
+++ user/pho/stress2/misc/mmap27.sh	Mon Oct 10 10:58:18 2016	(r306945)
@@ -48,7 +48,7 @@ sleep 2
 while pgrep -q swap; do
 	pkill -9 swap
 done
-rm -f ./mmap27 /tmp/mmap27.0*
+rm -f ./mmap27 /tmp/mmap27.0* /tmp/mmap27
 exit 0
 
 EOF

Modified: user/pho/stress2/misc/mmap28.sh
==============================================================================
--- user/pho/stress2/misc/mmap28.sh	Mon Oct 10 09:54:01 2016	(r306944)
+++ user/pho/stress2/misc/mmap28.sh	Mon Oct 10 10:58:18 2016	(r306945)
@@ -51,7 +51,7 @@ cd $odir
 
 (cd /tmp; ./mmap28)
 
-rm -f /tmp/mmap28 /tmp/mmap28.0*
+rm -f /tmp/mmap28 /tmp/mmap28.0* /tmp/mmap28.core
 exit 0
 
 EOF

Modified: user/pho/stress2/misc/pfl.sh
==============================================================================
--- user/pho/stress2/misc/pfl.sh	Mon Oct 10 09:54:01 2016	(r306944)
+++ user/pho/stress2/misc/pfl.sh	Mon Oct 10 10:58:18 2016	(r306945)
@@ -91,6 +91,7 @@ mdconfig -d -u $md2
 while mount | grep "$mp1 " | grep -q /dev/md; do
 	umount $mp1 || sleep 1
 done
+rm -f /tmp/pfl
 mdconfig -d -u $md1
 exit
 

Modified: user/pho/stress2/misc/pthread9.sh
==============================================================================
--- user/pho/stress2/misc/pthread9.sh	Mon Oct 10 09:54:01 2016	(r306944)
+++ user/pho/stress2/misc/pthread9.sh	Mon Oct 10 10:58:18 2016	(r306945)
@@ -49,6 +49,7 @@ if ping -c 2 `echo $nfs_export | sed 's/
 	mount -t nfs -o nfsv3,tcp,nolockd,retrycnt=3,intr $nfs_export \
 	    $mntpoint || exit 1
 	sleep .5
+	echo "Expect core dumps"
 	(cd $mntpoint; /tmp/pthread9) &
 	sleep 200
 	if pgrep -q pthread9; then
@@ -60,7 +61,7 @@ if ping -c 2 `echo $nfs_export | sed 's/
 	wait
 fi
 
-rm -f /tmp/pthread9
+rm -f /tmp/pthread9 /tmp/pthread9.core
 exit $status
 EOF
 #include <sys/types.h>

Modified: user/pho/stress2/misc/rename10.sh
==============================================================================
--- user/pho/stress2/misc/rename10.sh	Mon Oct 10 09:54:01 2016	(r306944)
+++ user/pho/stress2/misc/rename10.sh	Mon Oct 10 10:58:18 2016	(r306945)
@@ -73,6 +73,7 @@ while mount | grep "on $mntpoint " | gre
 done
 
 checkfs /dev/md${mdstart}$part
+rm -f /tmp/rename10
 mdconfig -d -u $mdstart
 exit 0
 EOF

Modified: user/pho/stress2/misc/rename7.sh
==============================================================================
--- user/pho/stress2/misc/rename7.sh	Mon Oct 10 09:54:01 2016	(r306944)
+++ user/pho/stress2/misc/rename7.sh	Mon Oct 10 10:58:18 2016	(r306945)
@@ -63,7 +63,7 @@ if mount | grep -q md${mdstart}$part; th
 	echo "Test failed"
 	exit 1
 fi
-rm -d /tmp/rename7
+rm -f /tmp/rename7
 exit 0
 EOF
 #include <err.h>

Modified: user/pho/stress2/misc/suj10.sh
==============================================================================
--- user/pho/stress2/misc/suj10.sh	Mon Oct 10 09:54:01 2016	(r306944)
+++ user/pho/stress2/misc/suj10.sh	Mon Oct 10 10:58:18 2016	(r306945)
@@ -81,7 +81,7 @@ fsck -t ufs -y -v /dev/md${mdstart}$part
 dumpfs /dev/md${mdstart}$part | grep -v UFS2 > /tmp/dumpfs.2
 diff -c /tmp/dumpfs.1 /tmp/dumpfs.2 || cat /tmp/fsck.log
 mdconfig -d -u $mdstart
-rm -f /tmp/fsck.log /tmp/dumpfs.?
+rm -f /tmp/fsck.log /tmp/dumpfs.? /tmp/suj10
 exit
 EOF
 #include <err.h>

Modified: user/pho/stress2/misc/symlink.sh
==============================================================================
--- user/pho/stress2/misc/symlink.sh	Mon Oct 10 09:54:01 2016	(r306944)
+++ user/pho/stress2/misc/symlink.sh	Mon Oct 10 10:58:18 2016	(r306945)
@@ -80,6 +80,7 @@ for i in "" "-U"; do
 
 	umount -f ${mntpoint}
 done
+rm -f /tmp/symlink
 mdconfig -d -u $mdstart
 exit
 EOF

Modified: user/pho/stress2/misc/symlink2.sh
==============================================================================
--- user/pho/stress2/misc/symlink2.sh	Mon Oct 10 09:54:01 2016	(r306944)
+++ user/pho/stress2/misc/symlink2.sh	Mon Oct 10 10:58:18 2016	(r306945)
@@ -71,6 +71,7 @@ for i in "" "-U"; do
 
 	umount -f ${mntpoint}
 done
+rm -f /tmp/symlink2 $D
 mdconfig -d -u $mdstart
 exit
 EOF

Modified: user/pho/stress2/misc/tmpfs9.sh
==============================================================================
--- user/pho/stress2/misc/tmpfs9.sh	Mon Oct 10 09:54:01 2016	(r306944)
+++ user/pho/stress2/misc/tmpfs9.sh	Mon Oct 10 10:58:18 2016	(r306945)
@@ -56,7 +56,7 @@ wait
 while mount | grep $mntpoint | grep -q tmpfs; do
 	umount $mntpoint || sleep 1
 done
-rm -d /tmp/tmpfs9
+rm -f /tmp/tmpfs9
 exit
 EOF
 #include <sys/types.h>

Modified: user/pho/stress2/misc/truss.sh
==============================================================================
--- user/pho/stress2/misc/truss.sh	Mon Oct 10 09:54:01 2016	(r306944)
+++ user/pho/stress2/misc/truss.sh	Mon Oct 10 10:58:18 2016	(r306945)
@@ -76,11 +76,11 @@ sleep 2
 if pgrep -q ttruss; then
 	echo FAIL
 	ps -lH | grep -v grep | grep ttruss
-	exit 1
+	s=1
 fi
 
-rm -rf /tmp/ttruss
-exit
+rm -rf /tmp/ttruss /tmp/ttruss.core
+exit $s
 
 EOF
 #include <sys/param.h>

From owner-svn-src-user@freebsd.org  Mon Oct 10 20:51:06 2016
Return-Path: <owner-svn-src-user@freebsd.org>
Delivered-To: svn-src-user@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 C909DC0C342
 for <svn-src-user@mailman.ysv.freebsd.org>;
 Mon, 10 Oct 2016 20:51:06 +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 7352D321;
 Mon, 10 Oct 2016 20:51:06 +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 u9AKp50P064481;
 Mon, 10 Oct 2016 20:51:05 GMT (envelope-from markj@FreeBSD.org)
Received: (from markj@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9AKp4qW064466;
 Mon, 10 Oct 2016 20:51:04 GMT (envelope-from markj@FreeBSD.org)
Message-Id: <201610102051.u9AKp4qW064466@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: markj set sender to
 markj@FreeBSD.org using -f
From: Mark Johnston <markj@FreeBSD.org>
Date: Mon, 10 Oct 2016 20:51:04 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
Subject: svn commit: r307006 - in user/alc/PQ_LAUNDRY: . bin/sh
 bin/sh/tests/parameters contrib/mdocml contrib/tzcode/zic contrib/tzdata
 release/doc/en_US.ISO8859-1/hardware sbin/devd sbin/ifconfig share/ma...
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.23
Precedence: list
List-Id: "SVN commit messages for the experimental &quot; user&quot;
 src tree" <svn-src-user.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-user>,
 <mailto:svn-src-user-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-user/>
List-Post: <mailto:svn-src-user@freebsd.org>
List-Help: <mailto:svn-src-user-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-user>,
 <mailto:svn-src-user-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 10 Oct 2016 20:51:06 -0000

Author: markj
Date: Mon Oct 10 20:51:04 2016
New Revision: 307006
URL: https://svnweb.freebsd.org/changeset/base/307006

Log:
  MFH r307005

Added:
  user/alc/PQ_LAUNDRY/bin/sh/tests/parameters/ifs1.0
     - copied unchanged from r307005, head/bin/sh/tests/parameters/ifs1.0
  user/alc/PQ_LAUNDRY/sys/arm/arm/identcpu-v4.c
     - copied unchanged from r307005, head/sys/arm/arm/identcpu-v4.c
  user/alc/PQ_LAUNDRY/sys/arm/arm/identcpu-v6.c
     - copied unchanged from r307005, head/sys/arm/arm/identcpu-v6.c
Deleted:
  user/alc/PQ_LAUNDRY/sys/arm/arm/identcpu.c
  user/alc/PQ_LAUNDRY/tools/build/options/WITH_FMAKE
Modified:
  user/alc/PQ_LAUNDRY/Makefile.inc1
  user/alc/PQ_LAUNDRY/ObsoleteFiles.inc
  user/alc/PQ_LAUNDRY/bin/sh/sh.1
  user/alc/PQ_LAUNDRY/bin/sh/tests/parameters/Makefile
  user/alc/PQ_LAUNDRY/bin/sh/var.c
  user/alc/PQ_LAUNDRY/contrib/mdocml/mandocdb.c
  user/alc/PQ_LAUNDRY/contrib/tzcode/zic/zdump.c
  user/alc/PQ_LAUNDRY/contrib/tzcode/zic/zic.c
  user/alc/PQ_LAUNDRY/contrib/tzdata/africa
  user/alc/PQ_LAUNDRY/contrib/tzdata/antarctica
  user/alc/PQ_LAUNDRY/contrib/tzdata/asia
  user/alc/PQ_LAUNDRY/contrib/tzdata/australasia
  user/alc/PQ_LAUNDRY/contrib/tzdata/backward
  user/alc/PQ_LAUNDRY/contrib/tzdata/etcetera
  user/alc/PQ_LAUNDRY/contrib/tzdata/europe
  user/alc/PQ_LAUNDRY/contrib/tzdata/factory
  user/alc/PQ_LAUNDRY/contrib/tzdata/leap-seconds.list
  user/alc/PQ_LAUNDRY/contrib/tzdata/leapseconds
  user/alc/PQ_LAUNDRY/contrib/tzdata/northamerica
  user/alc/PQ_LAUNDRY/contrib/tzdata/southamerica
  user/alc/PQ_LAUNDRY/contrib/tzdata/zone.tab
  user/alc/PQ_LAUNDRY/contrib/tzdata/zone1970.tab
  user/alc/PQ_LAUNDRY/release/doc/en_US.ISO8859-1/hardware/article.xml
  user/alc/PQ_LAUNDRY/sbin/devd/devd.conf.5
  user/alc/PQ_LAUNDRY/sbin/ifconfig/af_inet.c
  user/alc/PQ_LAUNDRY/sbin/ifconfig/af_inet6.c
  user/alc/PQ_LAUNDRY/sbin/ifconfig/ifieee80211.c
  user/alc/PQ_LAUNDRY/share/man/man5/src.conf.5
  user/alc/PQ_LAUNDRY/share/man/man9/Makefile
  user/alc/PQ_LAUNDRY/share/man/man9/ifnet.9
  user/alc/PQ_LAUNDRY/share/man/man9/mbuf.9
  user/alc/PQ_LAUNDRY/share/man/man9/mbuf_tags.9
  user/alc/PQ_LAUNDRY/share/misc/bsd-family-tree
  user/alc/PQ_LAUNDRY/share/misc/pci_vendors
  user/alc/PQ_LAUNDRY/sys/arm/allwinner/a10_gpio.c
  user/alc/PQ_LAUNDRY/sys/arm/allwinner/aw_wdog.c
  user/alc/PQ_LAUNDRY/sys/arm/amlogic/aml8726/aml8726_machdep.c
  user/alc/PQ_LAUNDRY/sys/arm/amlogic/aml8726/aml8726_wdt.c
  user/alc/PQ_LAUNDRY/sys/arm/arm/cpuinfo.c
  user/alc/PQ_LAUNDRY/sys/arm/arm/gic.c
  user/alc/PQ_LAUNDRY/sys/arm/at91/at91_aic.c
  user/alc/PQ_LAUNDRY/sys/arm/at91/at91_cfata.c
  user/alc/PQ_LAUNDRY/sys/arm/at91/at91_mci.c
  user/alc/PQ_LAUNDRY/sys/arm/at91/at91_pit.c
  user/alc/PQ_LAUNDRY/sys/arm/at91/at91_pmc.c
  user/alc/PQ_LAUNDRY/sys/arm/at91/at91_st.c
  user/alc/PQ_LAUNDRY/sys/arm/broadcom/bcm2835/bcm2835_dma.c
  user/alc/PQ_LAUNDRY/sys/arm/broadcom/bcm2835/bcm2835_ft5406.c
  user/alc/PQ_LAUNDRY/sys/arm/broadcom/bcm2835/bcm2835_spi.c
  user/alc/PQ_LAUNDRY/sys/arm/broadcom/bcm2835/bcm2835_wdog.c
  user/alc/PQ_LAUNDRY/sys/arm/freescale/imx/imx51_ipuv3.c
  user/alc/PQ_LAUNDRY/sys/arm/freescale/imx/imx51_ipuv3_fbd.c
  user/alc/PQ_LAUNDRY/sys/arm/include/cpuinfo.h
  user/alc/PQ_LAUNDRY/sys/arm/lpc/lpc_fb.c
  user/alc/PQ_LAUNDRY/sys/arm/lpc/lpc_gpio.c
  user/alc/PQ_LAUNDRY/sys/arm/lpc/lpc_mmc.c
  user/alc/PQ_LAUNDRY/sys/arm/lpc/lpc_spi.c
  user/alc/PQ_LAUNDRY/sys/arm/mv/mpic.c
  user/alc/PQ_LAUNDRY/sys/arm/nvidia/tegra_pcie.c
  user/alc/PQ_LAUNDRY/sys/arm/rockchip/rk30xx_gpio.c
  user/alc/PQ_LAUNDRY/sys/arm/rockchip/rk30xx_wdog.c
  user/alc/PQ_LAUNDRY/sys/arm/ti/am335x/am335x_gpio.c
  user/alc/PQ_LAUNDRY/sys/arm/ti/am335x/am335x_lcd_syscons.c
  user/alc/PQ_LAUNDRY/sys/arm/ti/am335x/am335x_scm_padconf.c
  user/alc/PQ_LAUNDRY/sys/arm/ti/omap4/omap4_prcm_clks.c
  user/alc/PQ_LAUNDRY/sys/arm/ti/ti_cpuid.c
  user/alc/PQ_LAUNDRY/sys/arm/ti/ti_pinmux.c
  user/alc/PQ_LAUNDRY/sys/arm/ti/ti_prcm.c
  user/alc/PQ_LAUNDRY/sys/arm/ti/ti_scm.c
  user/alc/PQ_LAUNDRY/sys/arm/ti/twl/twl.c
  user/alc/PQ_LAUNDRY/sys/arm/ti/twl/twl_clks.c
  user/alc/PQ_LAUNDRY/sys/arm/ti/twl/twl_vreg.c
  user/alc/PQ_LAUNDRY/sys/arm/xscale/i8134x/i80321_timer.c
  user/alc/PQ_LAUNDRY/sys/arm/xscale/i8134x/i80321_wdog.c
  user/alc/PQ_LAUNDRY/sys/arm/xscale/ixp425/avila_ata.c
  user/alc/PQ_LAUNDRY/sys/arm/xscale/ixp425/ixp425_intr.h
  user/alc/PQ_LAUNDRY/sys/arm/xscale/ixp425/ixp425_npe.c
  user/alc/PQ_LAUNDRY/sys/arm/xscale/ixp425/ixp425_qmgr.c
  user/alc/PQ_LAUNDRY/sys/arm/xscale/ixp425/ixp425_timer.c
  user/alc/PQ_LAUNDRY/sys/arm/xscale/ixp425/ixp425_wdog.c
  user/alc/PQ_LAUNDRY/sys/conf/files.arm
  user/alc/PQ_LAUNDRY/sys/conf/kern.mk
  user/alc/PQ_LAUNDRY/sys/contrib/ipfilter/netinet/fil.c
  user/alc/PQ_LAUNDRY/sys/contrib/ipfilter/netinet/ip_compat.h
  user/alc/PQ_LAUNDRY/sys/contrib/ncsw/inc/xx_ext.h
  user/alc/PQ_LAUNDRY/sys/contrib/ncsw/user/env/xx.c
  user/alc/PQ_LAUNDRY/sys/dev/evdev/evdev.c
  user/alc/PQ_LAUNDRY/sys/dev/evdev/evdev.h
  user/alc/PQ_LAUNDRY/sys/dev/evdev/evdev_mt.c
  user/alc/PQ_LAUNDRY/sys/dev/evdev/evdev_private.h
  user/alc/PQ_LAUNDRY/sys/dev/hyperv/netvsc/hv_net_vsc.h
  user/alc/PQ_LAUNDRY/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
  user/alc/PQ_LAUNDRY/sys/dev/hyperv/netvsc/hv_rndis_filter.c
  user/alc/PQ_LAUNDRY/sys/dev/hyperv/netvsc/if_hnvar.h
  user/alc/PQ_LAUNDRY/sys/dev/hyperv/netvsc/ndis.h
  user/alc/PQ_LAUNDRY/sys/dev/iwm/if_iwm.c
  user/alc/PQ_LAUNDRY/sys/dev/otus/if_otus.c
  user/alc/PQ_LAUNDRY/sys/dev/sfxge/common/ef10_nic.c
  user/alc/PQ_LAUNDRY/sys/dev/sfxge/common/ef10_tlv_layout.h
  user/alc/PQ_LAUNDRY/sys/dev/usb/wlan/if_rsu.c
  user/alc/PQ_LAUNDRY/sys/dev/wpi/if_wpi.c
  user/alc/PQ_LAUNDRY/sys/dev/wpi/if_wpivar.h
  user/alc/PQ_LAUNDRY/sys/kern/vfs_mount.c
  user/alc/PQ_LAUNDRY/sys/kern/vfs_subr.c
  user/alc/PQ_LAUNDRY/sys/modules/dtb/allwinner/Makefile
  user/alc/PQ_LAUNDRY/sys/net/rndis.h
  user/alc/PQ_LAUNDRY/sys/net80211/ieee80211_freebsd.h
  user/alc/PQ_LAUNDRY/sys/net80211/ieee80211_input.c
  user/alc/PQ_LAUNDRY/sys/powerpc/mpc85xx/fsl_diu.c
  user/alc/PQ_LAUNDRY/sys/sys/module.h
  user/alc/PQ_LAUNDRY/tests/sys/kern/kern_copyin.c
  user/alc/PQ_LAUNDRY/tests/sys/kern/pipe/pipe_fstat_bug_test.c
  user/alc/PQ_LAUNDRY/tools/build/mk/OptionalObsoleteFiles.inc
  user/alc/PQ_LAUNDRY/tools/build/options/WITHOUT_MANDOCDB
  user/alc/PQ_LAUNDRY/usr.sbin/chown/chown.c
Directory Properties:
  user/alc/PQ_LAUNDRY/   (props changed)
  user/alc/PQ_LAUNDRY/contrib/mdocml/   (props changed)
  user/alc/PQ_LAUNDRY/contrib/tzcode/zic/   (props changed)
  user/alc/PQ_LAUNDRY/contrib/tzdata/   (props changed)
  user/alc/PQ_LAUNDRY/sys/contrib/ipfilter/   (props changed)

Modified: user/alc/PQ_LAUNDRY/Makefile.inc1
==============================================================================
--- user/alc/PQ_LAUNDRY/Makefile.inc1	Mon Oct 10 20:48:21 2016	(r307005)
+++ user/alc/PQ_LAUNDRY/Makefile.inc1	Mon Oct 10 20:51:04 2016	(r307006)
@@ -1586,7 +1586,7 @@ _strfile=	usr.bin/fortune/strfile
 _gperf=		gnu/usr.bin/gperf
 .endif
 
-.if ${MK_GROFF} != "no"
+.if ${MK_SHAREDOCS} != "no" || ${MK_GROFF} != "no"
 _groff=		gnu/usr.bin/groff \
 		usr.bin/soelim
 .endif

Modified: user/alc/PQ_LAUNDRY/ObsoleteFiles.inc
==============================================================================
--- user/alc/PQ_LAUNDRY/ObsoleteFiles.inc	Mon Oct 10 20:48:21 2016	(r307005)
+++ user/alc/PQ_LAUNDRY/ObsoleteFiles.inc	Mon Oct 10 20:51:04 2016	(r307006)
@@ -38,6 +38,8 @@
 #   xargs -n1 | sort | uniq -d;
 # done
 
+# 20161010: remove link to removed m_getclr(9) macro
+OLD_FILES+=usr/share/man/man9/m_getclr.9.gz
 # 20161003: MK_ELFCOPY_AS_OBJCOPY option retired
 OLD_FILES+=usr/bin/elfcopy
 OLD_FILES+=usr/share/man/man1/elfcopy.1.gz

Modified: user/alc/PQ_LAUNDRY/bin/sh/sh.1
==============================================================================
--- user/alc/PQ_LAUNDRY/bin/sh/sh.1	Mon Oct 10 20:48:21 2016	(r307005)
+++ user/alc/PQ_LAUNDRY/bin/sh/sh.1	Mon Oct 10 20:51:04 2016	(r307006)
@@ -32,7 +32,7 @@
 .\"	from: @(#)sh.1	8.6 (Berkeley) 5/4/95
 .\" $FreeBSD$
 .\"
-.Dd May 30, 2016
+.Dd October 8, 2016
 .Dt SH 1
 .Os
 .Sh NAME
@@ -1349,13 +1349,13 @@ used in tilde expansion and as a default
 built-in.
 .It Va IFS
 Input Field Separators.
-The default value is
+This is initialized at startup to
 .Aq space ,
 .Aq tab ,
 and
 .Aq newline
 in that order.
-This default also applies if
+This value also applies if
 .Va IFS
 is unset, but not if it is set to the empty string.
 See the

Modified: user/alc/PQ_LAUNDRY/bin/sh/tests/parameters/Makefile
==============================================================================
--- user/alc/PQ_LAUNDRY/bin/sh/tests/parameters/Makefile	Mon Oct 10 20:48:21 2016	(r307005)
+++ user/alc/PQ_LAUNDRY/bin/sh/tests/parameters/Makefile	Mon Oct 10 20:51:04 2016	(r307006)
@@ -9,6 +9,7 @@ ATF_TESTS_SH=	functional_test
 
 ${PACKAGE}FILES+=	env1.0
 ${PACKAGE}FILES+=	exitstatus1.0
+${PACKAGE}FILES+=	ifs1.0
 ${PACKAGE}FILES+=	mail1.0
 ${PACKAGE}FILES+=	mail2.0
 ${PACKAGE}FILES+=	optind1.0

Copied: user/alc/PQ_LAUNDRY/bin/sh/tests/parameters/ifs1.0 (from r307005, head/bin/sh/tests/parameters/ifs1.0)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/alc/PQ_LAUNDRY/bin/sh/tests/parameters/ifs1.0	Mon Oct 10 20:51:04 2016	(r307006, copy of r307005, head/bin/sh/tests/parameters/ifs1.0)
@@ -0,0 +1,10 @@
+# $FreeBSD$
+
+env IFS=_ ${SH} -c '
+rc=2
+nosuchtool_function() {
+	rc=0
+}
+v=nosuchtool_function
+$v && exit "$rc"
+'

Modified: user/alc/PQ_LAUNDRY/bin/sh/var.c
==============================================================================
--- user/alc/PQ_LAUNDRY/bin/sh/var.c	Mon Oct 10 20:48:21 2016	(r307005)
+++ user/alc/PQ_LAUNDRY/bin/sh/var.c	Mon Oct 10 20:51:04 2016	(r307006)
@@ -186,6 +186,7 @@ initvar(void)
 		}
 	}
 	setvareq_const("OPTIND=1", 0);
+	setvareq_const("IFS= \t\n", 0);
 }
 
 /*

Modified: user/alc/PQ_LAUNDRY/contrib/mdocml/mandocdb.c
==============================================================================
--- user/alc/PQ_LAUNDRY/contrib/mdocml/mandocdb.c	Mon Oct 10 20:48:21 2016	(r307005)
+++ user/alc/PQ_LAUNDRY/contrib/mdocml/mandocdb.c	Mon Oct 10 20:51:04 2016	(r307006)
@@ -103,6 +103,7 @@ struct	mpage {
 	char		*arch;    /* architecture from file content */
 	char		*title;   /* title from file content */
 	char		*desc;    /* description from file content */
+	struct mpage	*next;    /* singly linked list */
 	struct mlink	*mlinks;  /* singly linked list */
 	int		 form;    /* format from file content */
 	int		 name_head_done;
@@ -146,6 +147,7 @@ static	void	 dbadd_mlink_name(const stru
 static	int	 dbopen(int);
 static	void	 dbprune(void);
 static	void	 filescan(const char *);
+static	int	 fts_compare(const FTSENT *const *, const FTSENT *const *);
 static	void	 mlink_add(struct mlink *, const struct stat *);
 static	void	 mlink_check(struct mpage *, struct mlink *);
 static	void	 mlink_free(struct mlink *);
@@ -204,6 +206,7 @@ static	struct ohash	 strings; /* table o
 static	sqlite3		*db = NULL; /* current database */
 static	sqlite3_stmt	*stmts[STMT__MAX]; /* current statements */
 static	uint64_t	 name_mask;
+static	struct mpage	*mpage_head;
 
 static	const struct mdoc_handler mdocs[MDOC_MAX] = {
 	{ NULL, 0 },  /* Ap */
@@ -571,6 +574,20 @@ usage:
 	return (int)MANDOCLEVEL_BADARG;
 }
 
+static int
+fts_compare(const FTSENT *const *a, const FTSENT *const *b)
+{
+
+	/*
+	 * The mpage list is processed in the opposite order to which pages are
+	 * added, so traverse the hierarchy in reverse alpha order, resulting
+	 * in database inserts in alpha order. This is not required for correct
+	 * operation, but is helpful when inspecting the database during
+	 * development.
+	 */
+	return -strcmp((*a)->fts_name, (*b)->fts_name);
+}
+
 /*
  * Scan a directory tree rooted at "basedir" for manpages.
  * We use fts(), scanning directory parts along the way for clues to our
@@ -600,8 +617,8 @@ treescan(void)
 	argv[0] = ".";
 	argv[1] = (char *)NULL;
 
-	f = fts_open((char * const *)argv,
-	    FTS_PHYSICAL | FTS_NOCHDIR, NULL);
+	f = fts_open((char * const *)argv, FTS_PHYSICAL | FTS_NOCHDIR,
+	    fts_compare);
 	if (f == NULL) {
 		exitcode = (int)MANDOCLEVEL_SYSERR;
 		say("", "&fts_open");
@@ -966,6 +983,8 @@ mlink_add(struct mlink *mlink, const str
 		mpage = mandoc_calloc(1, sizeof(struct mpage));
 		mpage->inodev.st_ino = inodev.st_ino;
 		mpage->inodev.st_dev = inodev.st_dev;
+		mpage->next = mpage_head;
+		mpage_head = mpage;
 		ohash_insert(&mpages, slot, mpage);
 	} else
 		mlink->next = mpage->mlinks;
@@ -989,20 +1008,18 @@ mpages_free(void)
 {
 	struct mpage	*mpage;
 	struct mlink	*mlink;
-	unsigned int	 slot;
 
-	mpage = ohash_first(&mpages, &slot);
-	while (NULL != mpage) {
+	while (NULL != (mpage = mpage_head)) {
 		while (NULL != (mlink = mpage->mlinks)) {
 			mpage->mlinks = mlink->next;
 			mlink_free(mlink);
 		}
+		mpage_head = mpage->next;
 		free(mpage->sec);
 		free(mpage->arch);
 		free(mpage->title);
 		free(mpage->desc);
 		free(mpage);
-		mpage = ohash_next(&mpages, &slot);
 	}
 }
 
@@ -1123,16 +1140,14 @@ mpages_merge(struct mparse *mp)
 	char			*sodest;
 	char			*cp;
 	int			 fd;
-	unsigned int		 pslot;
 
 	if ( ! nodb)
 		SQL_EXEC("BEGIN TRANSACTION");
 
-	mpage = ohash_first(&mpages, &pslot);
-	while (mpage != NULL) {
+	for (mpage = mpage_head; mpage != NULL; mpage = mpage->next) {
 		mlinks_undupe(mpage);
 		if ((mlink = mpage->mlinks) == NULL) {
-			mpage = ohash_next(&mpages, &pslot);
+			mpage = mpage->next;
 			continue;
 		}
 
@@ -1256,7 +1271,6 @@ mpages_merge(struct mparse *mp)
 nextpage:
 		ohash_delete(&strings);
 		ohash_delete(&names);
-		mpage = ohash_next(&mpages, &pslot);
 	}
 
 	if (0 == nodb)

Modified: user/alc/PQ_LAUNDRY/contrib/tzcode/zic/zdump.c
==============================================================================
--- user/alc/PQ_LAUNDRY/contrib/tzcode/zic/zdump.c	Mon Oct 10 20:48:21 2016	(r307005)
+++ user/alc/PQ_LAUNDRY/contrib/tzcode/zic/zdump.c	Mon Oct 10 20:51:04 2016	(r307006)
@@ -212,24 +212,16 @@ const char * const	zone;
 		return;
 	cp = abbrp;
 	wp = NULL;
-	while (isascii((unsigned char) *cp) && isalpha((unsigned char) *cp))
+	while (isascii((unsigned char) *cp) &&
+		(isalnum((unsigned char)*cp) || *cp == '-' || *cp == '+'))
 		++cp;
-	if (cp - abbrp == 0)
-		wp = _("lacks alphabetic at start");
-	else if (cp - abbrp < 3)
-		wp = _("has fewer than 3 alphabetics");
+	if (cp - abbrp < 3)
+		wp = _("has fewer than 3 characters");
 	else if (cp - abbrp > 6)
-		wp = _("has more than 6 alphabetics");
-	if (wp == NULL && (*cp == '+' || *cp == '-')) {
-		++cp;
-		if (isascii((unsigned char) *cp) &&
-			isdigit((unsigned char) *cp))
-				if (*cp++ == '1' && *cp >= '0' && *cp <= '4')
-					++cp;
-		if (*cp != '\0')
-			wp = _("differs from POSIX standard");
-	}
-	if (wp == NULL)
+		wp = _("has more than 6 characters");
+	else if (*cp)
+		wp = "has characters other than ASCII alphanumerics, '-' or '+'";
+	else
 		return;
 	(void) fflush(stdout);
 	(void) fprintf(stderr,

Modified: user/alc/PQ_LAUNDRY/contrib/tzcode/zic/zic.c
==============================================================================
--- user/alc/PQ_LAUNDRY/contrib/tzcode/zic/zic.c	Mon Oct 10 20:48:21 2016	(r307005)
+++ user/alc/PQ_LAUNDRY/contrib/tzcode/zic/zic.c	Mon Oct 10 20:51:04 2016	(r307006)
@@ -2615,29 +2615,15 @@ const char * const	string;
 		register const char *	cp;
 		register char *		wp;
 
-		/*
-		** Want one to ZIC_MAX_ABBR_LEN_WO_WARN alphabetics
-		** optionally followed by a + or - and a number from 1 to 14.
-		*/
 		cp = string;
 		wp = NULL;
 		while (isascii((unsigned char) *cp) &&
-			isalpha((unsigned char) *cp))
+			(isalnum((unsigned char)*cp) || *cp == '-' || *cp == '+'))
 				++cp;
-		if (cp - string == 0)
-wp = _("time zone abbreviation lacks alphabetic at start");
 		if (noise && cp - string > 3)
-wp = _("time zone abbreviation has more than 3 alphabetics");
+wp = _("time zone abbreviation has more than 3 characters");
 		if (cp - string > ZIC_MAX_ABBR_LEN_WO_WARN)
-wp = _("time zone abbreviation has too many alphabetics");
-		if (wp == NULL && (*cp == '+' || *cp == '-')) {
-			++cp;
-			if (isascii((unsigned char) *cp) &&
-				isdigit((unsigned char) *cp))
-					if (*cp++ == '1' &&
-						*cp >= '0' && *cp <= '4')
-							++cp;
-		}
+wp = _("time zone abbreviation has too many characters");
 		if (*cp != '\0')
 wp = _("time zone abbreviation differs from POSIX standard");
 		if (wp != NULL) {

Modified: user/alc/PQ_LAUNDRY/contrib/tzdata/africa
==============================================================================
--- user/alc/PQ_LAUNDRY/contrib/tzdata/africa	Mon Oct 10 20:48:21 2016	(r307005)
+++ user/alc/PQ_LAUNDRY/contrib/tzdata/africa	Mon Oct 10 20:51:04 2016	(r307006)
@@ -343,6 +343,12 @@ Rule	Egypt	2007	only	-	Sep	Thu>=1	24:00	
 # decision to abandon DST permanently.  See Ahram Online 2015-04-24.
 # http://english.ahram.org.eg/NewsContent/1/64/128509/Egypt/Politics-/Sisi-cancels-daylight-saving-time-in-Egypt.aspx
 
+# From Steffen Thorsen (2016-04-29):
+# Egypt will have DST from July 7 until the end of October....
+# http://english.ahram.org.eg/NewsContentP/1/204655/Egypt/Daylight-savings-time-returning-to-Egypt-on--July.aspx
+# From Mina Samuel (2016-07-04):
+# Egyptian government took the decision to cancel the DST,
+
 Rule	Egypt	2008	only	-	Aug	lastThu	24:00	0	-
 Rule	Egypt	2009	only	-	Aug	20	24:00	0	-
 Rule	Egypt	2010	only	-	Aug	10	24:00	0	-
@@ -458,7 +464,7 @@ Zone	Africa/Monrovia	-0:43:08 -	LMT	1882
 # http://www.libyaherald.com/2013/10/24/correction-no-time-change-tomorrow/
 #
 # From Paul Eggert (2013-10-25):
-# For now, assume they're reverting to the pre-2012 rules of permanent UTC+2.
+# For now, assume they're reverting to the pre-2012 rules of permanent UT +02.
 
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule	Libya	1951	only	-	Oct	14	2:00	1:00	S
@@ -858,11 +864,11 @@ Rule	Morocco	2009	only	-	Aug	21	 0:00	0	
 Rule	Morocco	2010	only	-	May	 2	 0:00	1:00	S
 Rule	Morocco	2010	only	-	Aug	 8	 0:00	0	-
 Rule	Morocco	2011	only	-	Apr	 3	 0:00	1:00	S
-Rule	Morocco	2011	only	-	Jul	31	 0	0	-
+Rule	Morocco	2011	only	-	Jul	31	 0:00	0	-
 Rule	Morocco	2012	2013	-	Apr	lastSun	 2:00	1:00	S
-Rule	Morocco	2012	only	-	Sep	30	 3:00	0	-
 Rule	Morocco	2012	only	-	Jul	20	 3:00	0	-
 Rule	Morocco	2012	only	-	Aug	20	 2:00	1:00	S
+Rule	Morocco	2012	only	-	Sep	30	 3:00	0	-
 Rule	Morocco	2013	only	-	Jul	 7	 3:00	0	-
 Rule	Morocco	2013	only	-	Aug	10	 2:00	1:00	S
 Rule	Morocco	2013	max	-	Oct	lastSun	 3:00	0	-

Modified: user/alc/PQ_LAUNDRY/contrib/tzdata/antarctica
==============================================================================
--- user/alc/PQ_LAUNDRY/contrib/tzdata/antarctica	Mon Oct 10 20:48:21 2016	(r307005)
+++ user/alc/PQ_LAUNDRY/contrib/tzdata/antarctica	Mon Oct 10 20:51:04 2016	(r307006)
@@ -10,10 +10,8 @@
 # http://www.spri.cam.ac.uk/bob/periant.htm
 # for information.
 # Unless otherwise specified, we have no time zone information.
-#
-# Except for the French entries,
-# I made up all time zone abbreviations mentioned here; corrections welcome!
-# FORMAT is 'zzz' and GMTOFF is 0 for locations while uninhabited.
+
+# FORMAT is '-00' and GMTOFF is 0 for locations while uninhabited.
 
 # Argentina - year-round bases
 # Belgrano II, Confin Coast, -770227-0343737, since 1972-02-05
@@ -29,7 +27,7 @@
 #	previously sealers and scientific personnel wintered
 #	Margaret Turner reports
 #	http://web.archive.org/web/20021204222245/http://www.dstc.qut.edu.au/DST/marg/daylight.html
-#	(1999-09-30) that they're UTC+5, with no DST;
+#	(1999-09-30) that they're UT +05, with no DST;
 #	presumably this is when they have visitors.
 #
 # year-round bases
@@ -67,24 +65,23 @@
 # http://www.timeanddate.com/news/time/antartica-time-changes-2010.html
 
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone Antarctica/Casey	0	-	zzz	1969
-			8:00	-	AWST	2009 Oct 18  2:00
-						# Australian Western Std Time
-			11:00	-	CAST	2010 Mar  5  2:00  # Casey Time
-			8:00	-	AWST	2011 Oct 28  2:00
-			11:00	-	CAST	2012 Feb 21 17:00u
-			8:00	-	AWST
-Zone Antarctica/Davis	0	-	zzz	1957 Jan 13
-			7:00	-	DAVT	1964 Nov    # Davis Time
-			0	-	zzz	1969 Feb
-			7:00	-	DAVT	2009 Oct 18  2:00
-			5:00	-	DAVT	2010 Mar 10 20:00u
-			7:00	-	DAVT	2011 Oct 28  2:00
-			5:00	-	DAVT	2012 Feb 21 20:00u
-			7:00	-	DAVT
-Zone Antarctica/Mawson	0	-	zzz	1954 Feb 13
-			6:00	-	MAWT	2009 Oct 18  2:00 # Mawson Time
-			5:00	-	MAWT
+Zone Antarctica/Casey	0	-	-00	1969
+			8:00	-	+08	2009 Oct 18  2:00
+			11:00	-	+11	2010 Mar  5  2:00
+			8:00	-	+08	2011 Oct 28  2:00
+			11:00	-	+11	2012 Feb 21 17:00u
+			8:00	-	+08
+Zone Antarctica/Davis	0	-	-00	1957 Jan 13
+			7:00	-	+07	1964 Nov
+			0	-	-00	1969 Feb
+			7:00	-	+07	2009 Oct 18  2:00
+			5:00	-	+05	2010 Mar 10 20:00u
+			7:00	-	+07	2011 Oct 28  2:00
+			5:00	-	+05	2012 Feb 21 20:00u
+			7:00	-	+07
+Zone Antarctica/Mawson	0	-	-00	1954 Feb 13
+			6:00	-	+06	2009 Oct 18  2:00
+			5:00	-	+05
 # References:
 # Casey Weather (1998-02-26)
 # http://www.antdiv.gov.au/aad/exop/sfo/casey/casey_aws.html
@@ -137,8 +134,8 @@ Zone Antarctica/Mawson	0	-	zzz	1954 Feb 
 #	fishing stations operated variously 1819/1931
 #
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone Indian/Kerguelen	0	-	zzz	1950 # Port-aux-Français
-			5:00	-	TFT	# ISO code TF Time
+Zone Indian/Kerguelen	0	-	-00	1950 # Port-aux-Français
+			5:00	-	+05
 #
 # year-round base in the main continent
 # Dumont d'Urville, Île des Pétrels, -6640+14001, since 1956-11
@@ -148,10 +145,10 @@ Zone Indian/Kerguelen	0	-	zzz	1950 # Por
 # It was destroyed by fire on 1952-01-14.
 #
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone Antarctica/DumontDUrville 0 -	zzz	1947
-			10:00	-	PMT	1952 Jan 14 # Port-Martin Time
-			0	-	zzz	1956 Nov
-			10:00	-	DDUT	# Dumont-d'Urville Time
+Zone Antarctica/DumontDUrville 0 -	-00	1947
+			10:00	-	+10	1952 Jan 14
+			0	-	-00	1956 Nov
+			10:00	-	+10
 
 # France & Italy - year-round base
 # Concordia, -750600+1232000, since 2005
@@ -176,8 +173,8 @@ Zone Antarctica/DumontDUrville 0 -	zzz	1
 # was established on 1957-01-29.  Since Syowa station is still the main
 # station of Japan, it's appropriate for the principal location.
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone Antarctica/Syowa	0	-	zzz	1957 Jan 29
-			3:00	-	SYOT	# Syowa Time
+Zone Antarctica/Syowa	0	-	-00	1957 Jan 29
+			3:00	-	+03
 # See:
 # NIPR Antarctic Research Activities (1999-08-17)
 # http://www.nipr.ac.jp/english/ara01.html
@@ -214,19 +211,19 @@ Zone Antarctica/Syowa	0	-	zzz	1957 Jan 2
 # correct, but they should be quite close to the actual dates.
 #
 # From Paul Eggert (2014-03-21):
-# The CET-switching Troll rules require zic from tzcode 2014b or later, so as
+# The CET-switching Troll rules require zic from tz 2014b or later, so as
 # suggested by Bengt-Inge Larsson comment them out for now, and approximate
 # with only UTC and CEST.  Uncomment them when 2014b is more prevalent.
 #
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
-#Rule	Troll	2005	max	-	Mar	 1	1:00u	1:00	CET
-Rule	Troll	2005	max	-	Mar	lastSun	1:00u	2:00	CEST
-#Rule	Troll	2005	max	-	Oct	lastSun	1:00u	1:00	CET
-#Rule	Troll	2004	max	-	Nov	 7	1:00u	0:00	UTC
+#Rule	Troll	2005	max	-	Mar	 1	1:00u	1:00	+01
+Rule	Troll	2005	max	-	Mar	lastSun	1:00u	2:00	+02
+#Rule	Troll	2005	max	-	Oct	lastSun	1:00u	1:00	+01
+#Rule	Troll	2004	max	-	Nov	 7	1:00u	0:00	+00
 # Remove the following line when uncommenting the above '#Rule' lines.
-Rule	Troll	2004	max	-	Oct	lastSun	1:00u	0:00	UTC
+Rule	Troll	2004	max	-	Oct	lastSun	1:00u	0:00	+00
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone Antarctica/Troll	0	-	zzz	2005 Feb 12
+Zone Antarctica/Troll	0	-	-00	2005 Feb 12
 			0:00	Troll	%s
 
 # Poland - year-round base
@@ -265,10 +262,10 @@ Zone Antarctica/Troll	0	-	zzz	2005 Feb 1
 # changes during the year and does not necessarily correspond to mean
 # solar noon.  So the Vostok time might have been whatever the clocks
 # happened to be during their visit.  So we still don't really know what time
-# it is at Vostok.  But we'll guess UTC+6.
+# it is at Vostok.  But we'll guess +06.
 #
-Zone Antarctica/Vostok	0	-	zzz	1957 Dec 16
-			6:00	-	VOST	# Vostok time
+Zone Antarctica/Vostok	0	-	-00	1957 Dec 16
+			6:00	-	+06
 
 # S Africa - year-round bases
 # Marion Island, -4653+03752
@@ -300,8 +297,8 @@ Zone Antarctica/Vostok	0	-	zzz	1957 Dec 
 # <http://webexhibits.org/daylightsaving/g.html> says Rothera is -03 all year.
 #
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone Antarctica/Rothera	0	-	zzz	1976 Dec  1
-			-3:00	-	ROTT	# Rothera time
+Zone Antarctica/Rothera	0	-	-00	1976 Dec  1
+			-3:00	-	-03
 
 # Uruguay - year round base
 # Artigas, King George Island, -621104-0585107

Modified: user/alc/PQ_LAUNDRY/contrib/tzdata/asia
==============================================================================
--- user/alc/PQ_LAUNDRY/contrib/tzdata/asia	Mon Oct 10 20:48:21 2016	(r307005)
+++ user/alc/PQ_LAUNDRY/contrib/tzdata/asia	Mon Oct 10 20:51:04 2016	(r307006)
@@ -79,13 +79,9 @@ Rule E-EurAsia	1979	1995	-	Sep	lastSun	 
 Rule E-EurAsia	1996	max	-	Oct	lastSun	 0:00	0	-
 Rule RussiaAsia	1981	1984	-	Apr	1	 0:00	1:00	S
 Rule RussiaAsia	1981	1983	-	Oct	1	 0:00	0	-
-Rule RussiaAsia	1984	1991	-	Sep	lastSun	 2:00s	0	-
-Rule RussiaAsia	1985	1991	-	Mar	lastSun	 2:00s	1:00	S
-Rule RussiaAsia	1992	only	-	Mar	lastSat	23:00	1:00	S
-Rule RussiaAsia	1992	only	-	Sep	lastSat	23:00	0	-
-Rule RussiaAsia	1993	max	-	Mar	lastSun	 2:00s	1:00	S
-Rule RussiaAsia	1993	1995	-	Sep	lastSun	 2:00s	0	-
-Rule RussiaAsia	1996	max	-	Oct	lastSun	 2:00s	0	-
+Rule RussiaAsia	1984	1995	-	Sep	lastSun	 2:00s	0	-
+Rule RussiaAsia	1985	2011	-	Mar	lastSun	 2:00s	1:00	S
+Rule RussiaAsia	1996	2011	-	Oct	lastSun	 2:00s	0	-
 
 # Afghanistan
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
@@ -120,31 +116,37 @@ Zone	Asia/Kabul	4:36:48 -	LMT	1890
 # http://www.worldtimezone.com/dst_news/dst_news_armenia03.html
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Asia/Yerevan	2:58:00 -	LMT	1924 May  2
-			3:00	-	YERT	1957 Mar    # Yerevan Time
-			4:00 RussiaAsia YER%sT	1991 Mar 31  2:00s
-			3:00	1:00	YERST	1991 Sep 23 # independence
-			3:00 RussiaAsia	AM%sT	1995 Sep 24  2:00s
-			4:00	-	AMT	1997
-			4:00 RussiaAsia	AM%sT	2012 Mar 25  2:00s
-			4:00	-	AMT
+			3:00	-	+03	1957 Mar
+			4:00 RussiaAsia +04/+05	1991 Mar 31  2:00s
+			3:00 RussiaAsia	+03/+04	1995 Sep 24  2:00s
+			4:00	-	+04	1997
+			4:00 RussiaAsia	+04/+05
 
 # Azerbaijan
+
 # From Rustam Aliyev of the Azerbaijan Internet Forum (2005-10-23):
 # According to the resolution of Cabinet of Ministers, 1997
 # From Paul Eggert (2015-09-17): It was Resolution No. 21 (1997-03-17).
 # http://code.az/files/daylight_res.pdf
+
+# From Steffen Thorsen (2016-03-17):
+# ... the Azerbaijani Cabinet of Ministers has cancelled switching to
+# daylight saving time....
+# http://www.azernews.az/azerbaijan/94137.html
+# http://vestnikkavkaza.net/news/Azerbaijani-Cabinet-of-Ministers-cancels-daylight-saving-time.html
+# http://en.apa.az/xeber_azerbaijan_abolishes_daylight_savings_ti_240862.html
+
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
-Rule	Azer	1997	max	-	Mar	lastSun	 4:00	1:00	S
-Rule	Azer	1997	max	-	Oct	lastSun	 5:00	0	-
+Rule	Azer	1997	2015	-	Mar	lastSun	 4:00	1:00	S
+Rule	Azer	1997	2015	-	Oct	lastSun	 5:00	0	-
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Asia/Baku	3:19:24 -	LMT	1924 May  2
-			3:00	-	BAKT	1957 Mar    # Baku Time
-			4:00 RussiaAsia BAK%sT	1991 Mar 31  2:00s
-			3:00	1:00	BAKST	1991 Aug 30 # independence
-			3:00 RussiaAsia	AZ%sT	1992 Sep lastSat 23:00
-			4:00	-	AZT	1996     # Azerbaijan Time
-			4:00	EUAsia	AZ%sT	1997
-			4:00	Azer	AZ%sT
+			3:00	-	+03	1957 Mar
+			4:00 RussiaAsia +04/+05	1991 Mar 31  2:00s
+			3:00 RussiaAsia	+03/+04	1992 Sep lastSun  2:00s
+			4:00	-	+04	1996
+			4:00	EUAsia	+04/+05	1997
+			4:00	Azer	+04/+05
 
 # Bahrain
 # See Asia/Qatar.
@@ -263,7 +265,7 @@ Zone	Asia/Brunei	7:39:40 -	LMT	1926 Mar 
 # Milne says 6:24:40 was the meridian of the time ball observatory at Rangoon.
 
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone	Asia/Rangoon	6:24:40 -	LMT	1880        # or Yangon
+Zone	Asia/Yangon	6:24:40 -	LMT	1880        # or Rangoon
 			6:24:40	-	RMT	1920        # Rangoon Mean Time?
 			6:30	-	BURT	1942 May    # Burma Time
 			9:00	-	JST	1945 May  3
@@ -378,7 +380,7 @@ Rule	PRC	1987	1991	-	Apr	Sun>=10	0:00	1:
 # Lewiston (ME) Daily Sun (1939-05-29), p 17, said "Even the time is
 # different - the occupied districts going by Tokyo time, an hour
 # ahead of that prevailing in the rest of Shanghai."  Guess that the
-# Xujiahui Observatory was under French control and stuck with UT+8.
+# Xujiahui Observatory was under French control and stuck with UT +08.
 #
 # In earlier versions of this file, China had many separate Zone entries, but
 # this was based on what were apparently incorrect data in Shanks & Pottenger.
@@ -387,26 +389,26 @@ Rule	PRC	1987	1991	-	Apr	Sun>=10	0:00	1:
 # Proposed in 1918 and theoretically in effect until 1949 (although in practice
 # mainly observed in coastal areas), the five zones were:
 #
-# Changbai Time ("Long-white Time", Long-white = Heilongjiang area) UT+8.5
+# Changbai Time ("Long-white Time", Long-white = Heilongjiang area) UT +08:30
 # Asia/Harbin (currently a link to Asia/Shanghai)
 # Heilongjiang (except Mohe county), Jilin
 #
-# Zhongyuan Time ("Central plain Time") UT+8
+# Zhongyuan Time ("Central plain Time") UT +08
 # Asia/Shanghai
 # most of China
 # This currently represents most other zones as well,
 # as apparently these regions have been the same since 1970.
 # Milne gives 8:05:43.2 for Xujiahui Observatory time; round to nearest.
-# Guo says Shanghai switched to UT+8 "from the end of the 19th century".
+# Guo says Shanghai switched to UT +08 "from the end of the 19th century".
 #
-# Long-shu Time (probably due to Long and Shu being two names of that area) UT+7
+# Long-shu Time (probably due to Long and Shu being two names of the area) UT +07
 # Asia/Chongqing (currently a link to Asia/Shanghai)
 # Guangxi, Guizhou, Hainan, Ningxia, Sichuan, Shaanxi, and Yunnan;
 # most of Gansu; west Inner Mongolia; west Qinghai; and the Guangdong
 # counties Deqing, Enping, Kaiping, Luoding, Taishan, Xinxing,
 # Yangchun, Yangjiang, Yu'nan, and Yunfu.
 #
-# Xin-zang Time ("Xinjiang-Tibet Time") UT+6
+# Xin-zang Time ("Xinjiang-Tibet Time") UT +06
 # Asia/Urumqi
 # This currently represents Kunlun Time as well,
 # as apparently the two regions have been the same since 1970.
@@ -419,7 +421,7 @@ Rule	PRC	1987	1991	-	Apr	Sun>=10	0:00	1:
 # Shihezi, Changji, Yanqi, Heshuo, Tuokexun, Tulufan, Shanshan, Hami,
 # Fukang, Kuitun, Kumukuli, Miquan, Qitai, and Turfan.
 #
-# Kunlun Time UT+5.5
+# Kunlun Time UT +05:30
 # Asia/Kashgar (currently a link to Asia/Urumqi)
 # West Tibet, including Pulan, Aheqi, Shufu, Shule;
 # West Xinjiang, including Aksu, Atushi, Yining, Hetian, Cele, Luopu, Nileke,
@@ -435,7 +437,7 @@ Rule	PRC	1987	1991	-	Apr	Sun>=10	0:00	1:
 #
 # On the other hand, ethnic Uyghurs, who make up about half the
 # population of Xinjiang, typically use "Xinjiang time" which is two
-# hours behind Beijing time, or UTC +0600. The government of the Xinjiang
+# hours behind Beijing time, or UT +06. The government of the Xinjiang
 # Uyghur Autonomous Region, (XAUR, or just Xinjiang for short) as well as
 # local governments such as the Ürümqi city government use both times in
 # publications, referring to what is popularly called Xinjiang time as
@@ -491,8 +493,8 @@ Rule	PRC	1987	1991	-	Apr	Sun>=10	0:00	1:
 # having the same time as Beijing.
 
 # From Paul Eggert (2014-06-30):
-# In the early days of the PRC, Tibet was given its own time zone (UT+6) but
-# this was withdrawn in 1959 and never reinstated; see Tubten Khétsun,
+# In the early days of the PRC, Tibet was given its own time zone (UT +06)
+# but this was withdrawn in 1959 and never reinstated; see Tubten Khétsun,
 # Memories of life in Lhasa under Chinese Rule, Columbia U Press, ISBN
 # 978-0231142861 (2008), translator's introduction by Matthew Akester, p x.
 # As this is before our 1970 cutoff, Tibet doesn't need a separate zone.
@@ -506,12 +508,12 @@ Rule	PRC	1987	1991	-	Apr	Sun>=10	0:00	1:
 # Republics, the Soviet Union, the Kuomintang, and the People's Republic of
 # China, and tracking down all these organizations' timekeeping rules would be
 # quite a trick.  Approximate this lost history by a transition from LMT to
-# XJT at the start of 1928, the year of accession of the warlord Jin Shuren,
+# UT +06 at the start of 1928, the year of accession of the warlord Jin Shuren,
 # which happens to be the date given by Shanks & Pottenger (no doubt as a
-# guess) as the transition from LMT.  Ignore the usage of UT+8 before
-# 1986-02-01 under the theory that the transition date to UT+8 is unknown and
+# guess) as the transition from LMT.  Ignore the usage of +08 before
+# 1986-02-01 under the theory that the transition date to +08 is unknown and
 # that the sort of users who prefer Asia/Urumqi now typically ignored the
-# UT+8 mandate back then.
+# +08 mandate back then.
 
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 # Beijing time, used throughout China; represented by Shanghai.
@@ -716,7 +718,7 @@ Zone	Asia/Hong_Kong	7:36:42 -	LMT	1904 O
 # be found from historical government announcement database.
 
 # From Paul Eggert (2014-07-03):
-# As per Yu-Cheng Chuang, say that Taiwan was at UT+9 from 1937-10-01
+# As per Yu-Cheng Chuang, say that Taiwan was at UT +09 from 1937-10-01
 # until 1945-09-21 at 01:00, overriding Shanks & Pottenger.
 # Likewise, use Yu-Cheng Chuang's data for DST in Taiwan.
 
@@ -830,16 +832,15 @@ Link	Asia/Nicosia	Europe/Nicosia
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Asia/Tbilisi	2:59:11 -	LMT	1880
 			2:59:11	-	TBMT	1924 May  2 # Tbilisi Mean Time
-			3:00	-	TBIT	1957 Mar    # Tbilisi Time
-			4:00 RussiaAsia TBI%sT	1991 Mar 31  2:00s
-			3:00	1:00	TBIST	1991 Apr  9 # independence
-			3:00 RussiaAsia GE%sT	1992        # Georgia Time
-			3:00 E-EurAsia	GE%sT	1994 Sep lastSun
-			4:00 E-EurAsia	GE%sT	1996 Oct lastSun
-			4:00	1:00	GEST	1997 Mar lastSun
-			4:00 E-EurAsia	GE%sT	2004 Jun 27
-			3:00 RussiaAsia	GE%sT	2005 Mar lastSun  2:00
-			4:00	-	GET
+			3:00	-	+03	1957 Mar
+			4:00 RussiaAsia +04/+05	1991 Mar 31  2:00s
+			3:00 RussiaAsia +03/+04	1992
+			3:00 E-EurAsia	+03/+04	1994 Sep lastSun
+			4:00 E-EurAsia	+04/+05	1996 Oct lastSun
+			4:00	1:00	+05	1997 Mar lastSun
+			4:00 E-EurAsia	+04/+05	2004 Jun 27
+			3:00 RussiaAsia	+03/+04	2005 Mar lastSun  2:00
+			4:00	-	+04
 
 # East Timor
 
@@ -874,6 +875,15 @@ Zone	Asia/Dili	8:22:20 -	LMT	1912 Jan  1
 			9:00	-	TLT
 
 # India
+
+# From Ian P. Beacock, in "A brief history of (modern) time", The Atlantic
+# http://www.theatlantic.com/technology/archive/2015/12/the-creation-of-modern-time/421419/
+# (2015-12-22):
+# In January 1906, several thousand cotton-mill workers rioted on the
+# outskirts of Bombay....  They were protesting the proposed abolition of
+# local time in favor of Indian Standard Time....  Journalists called this
+# dispute the "Battle of the Clocks."  It lasted nearly half a century.
+
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Asia/Kolkata	5:53:28 -	LMT	1880        # Kolkata
 			5:53:20	-	HMT	1941 Oct    # Howrah Mean Time?
@@ -907,7 +917,7 @@ Zone	Asia/Kolkata	5:53:28 -	LMT	1880    
 # These would be the earliest possible times for a change.
 # Régimes horaires pour le monde entier, by Henri Le Corre, (Éditions
 # Traditionnelles, 1987, Paris) says that Java and Madura switched
-# from JST to UTC+07:30 on 1945-09-23, and gives 1944-09-01 for Jayapura
+# from UT +09 to +07:30 on 1945-09-23, and gives 1944-09-01 for Jayapura
 # (Hollandia).  For now, assume all Indonesian locations other than Jayapura
 # switched on 1945-09-23.
 #
@@ -918,11 +928,11 @@ Zone	Asia/Kolkata	5:53:28 -	LMT	1880    
 # summary published by the Time and Frequency Laboratory of the
 # Research Center for Calibration, Instrumentation and Metrology,
 # Indonesia, <http://time.kim.lipi.go.id/time-eng.php> (2006-09-29).
-# The abbreviations are:
+# The time zone abbreviations and UT offsets are:
 #
-# WIB  - UTC+7 - Waktu Indonesia Barat (Indonesia western time)
-# WITA - UTC+8 - Waktu Indonesia Tengah (Indonesia central time)
-# WIT  - UTC+9 - Waktu Indonesia Timur (Indonesia eastern time)
+# WIB  - +07 - Waktu Indonesia Barat (Indonesia western time)
+# WITA - +08 - Waktu Indonesia Tengah (Indonesia central time)
+# WIT  - +09 - Waktu Indonesia Timur (Indonesia eastern time)
 #
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 # Java, Sumatra
@@ -1084,8 +1094,15 @@ Rule	Iran	2032	2033	-	Mar	21	0:00	1:00	D
 Rule	Iran	2032	2033	-	Sep	21	0:00	0	S
 Rule	Iran	2034	2035	-	Mar	22	0:00	1:00	D
 Rule	Iran	2034	2035	-	Sep	22	0:00	0	S
-Rule	Iran	2036	2037	-	Mar	21	0:00	1:00	D
-Rule	Iran	2036	2037	-	Sep	21	0:00	0	S
+#
+# The following rules are approximations starting in the year 2038.
+# These are the best post-2037 approximations available, given the
+# restrictions of a single rule using a Gregorian-based data format.
+# At some point this table will need to be extended, though quite
+# possibly Iran will change the rules first.
+Rule	Iran	2036	max	-	Mar	21	0:00	1:00	D
+Rule	Iran	2036	max	-	Sep	21	0:00	0	S
+
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Asia/Tehran	3:25:44	-	LMT	1916
 			3:25:44	-	TMT	1946     # Tehran Mean Time
@@ -1542,23 +1559,6 @@ Zone	Asia/Amman	2:23:44 -	LMT	1931
 
 # Kazakhstan
 
-# From Paul Eggert (1996-11-22):
-# Andrew Evtichov (1996-04-13) writes that Kazakhstan
-# stayed in sync with Moscow after 1990, and that Aqtobe (formerly Aktyubinsk)
-# and Aqtau (formerly Shevchenko) are the largest cities in their zones.
-# Guess that Aqtau and Aqtobe diverged in 1995, since that's the first time
-# IATA SSIM mentions a third time zone in Kazakhstan.
-
-# From Paul Eggert (2006-03-22):
-# German Iofis, ELSI, Almaty (2001-10-09) reports that Kazakhstan uses
-# RussiaAsia rules, instead of switching at 00:00 as the IATA has it.
-# Go with Shanks & Pottenger, who have them always using RussiaAsia rules.
-# Also go with the following claims of Shanks & Pottenger:
-#
-# - Kazakhstan did not observe DST in 1991.
-# - Qyzylorda switched from +5:00 to +6:00 on 1992-01-19 02:00.
-# - Oral switched from +5:00 to +4:00 in spring 1989.
-
 # From Kazakhstan Embassy's News Bulletin No. 11
 # <http://www.kazsociety.org.uk/news/2005/03/30.htm> (2005-03-21):
 # The Government of Kazakhstan passed a resolution March 15 abolishing
@@ -1575,61 +1575,232 @@ Zone	Asia/Amman	2:23:44 -	LMT	1931
 # everything else....  I guess that would make Kazakhstan time zones
 # de jure UTC+5 and UTC+6 respectively.
 
+# From Stepan Golosunov (2016-03-27) ([*] means see later comments below):
+# Review of the linked documents from http://adilet.zan.kz/
+# produced the following data for post-1991 Kazakhstan:
+#
+# 0. Act of the Cabinet of Ministers of the USSR
+# from 1991-02-04 No. 20
+# http://pravo.gov.ru/proxy/ips/?docbody=&nd=102010545
+# removed the extra hour ("decree time") on the territory of the USSR
+# starting with the last Sunday of March 1991.
+# It also allowed (but not mandated) Kazakh SSR, Kirghiz SSR, Tajik SSR,
+# Turkmen SSR and Uzbek SSR to not have "summer" time.
+#
+# The 1992-01-13 act also refers to the act of the Cabinet of Ministers
+# of the Kazakh SSR from 1991-03-20 No. 170 "About the act of the Cabinet
+# of Ministers of the USSR from 1991-02-04 No. 20" but I didn't found its
+# text.
+#
+# According to Izvestia newspaper No. 68 (23334) from 1991-03-20
+# (page 6; available at http://libinfo.org/newsr/newsr2574.djvu via
+# http://libinfo.org/index.php?id=58564) on 1991-03-31 at 2:00 during
+# transition to "summer" time:
+# Republic of Georgia, Latvian SSR, Lithuanian SSR, SSR Moldova,
+# Estonian SSR; Komi ASSR; Kaliningrad oblast; Nenets autonomous okrug
+# were to move clocks 1 hour forward.
+# Kazakh SSR (excluding Uralsk oblast); Republic of Kyrgyzstan, Tajik
+# SSR; Andijan, Jizzakh, Namangan, Sirdarya, Tashkent, Fergana oblasts
+# of the Uzbek SSR were to move clocks 1 hour backwards.
+# Other territories were to not move clocks.
+# When the "summer" time would end on 1991-09-29, clocks were to be
+# moved 1 hour backwards on the territory of the USSR excluding
+# Kazakhstan, Kirghizia, Uzbekistan, Turkmenia, Tajikistan.
+#
+# Apparently there were last minute changes. Apparently Kazakh act No. 170
+# was one of such changes.
+#
+# https://ru.wikipedia.org/wiki/Декретное время
+# claims that Sovetskaya Rossiya newspaper on 1991-03-29 published that
+# Nenets autonomous okrug, Komi and Kazakhstan (excluding Uralsk oblast)
+# were to not move clocks and Uralsk oblast was to move clocks
+# forward; on 1991-09-29 Kazakhstan was to move clocks backwards.
+# (Probably there were changes even after that publication. There is an
+# article claiming that Kaliningrad oblast decided on 1991-03-29 to not
+# move clocks.)
+#
+# This implies that on 1991-03-31 Asia/Oral remained on +04/+05 while
+# the rest of Kazakhstan switched from +06/+07 to +05/06 or from +05/06
+# to +04/+05. It's unclear how Kzyl-Orda oblast moved into the fifth
+# time belt. (By switching from +04/+05 to +05/+06 on 1991-09-29?) ...
+#
+# 1. Act of the Cabinet of Ministers of the Republic of Kazakhstan
+# from 1992-01-13 No. 28
+# http://adilet.zan.kz/rus/docs/P920000028_
+# (text includes modification from the 1996 act)
+# introduced new rules for calculation of time, mirroring Russian
+# 1992-01-08 act.  It specified that time would be calculated
+# according to time belts plus extra hour ("decree time"), moved clocks
+# on the whole territory of Kazakhstan 1 hour forward on 1992-01-19 at
+# 2:00, specified DST rules.  It acknowledged that Kazakhstan was
+# located in the fourth and the fifth time belts and specified the
+# border between them to be located east of Kustanay and Aktyubinsk
+# oblasts (notably including Turgai and Kzyl-Orda oblasts into the fifth
+# time belt).
+#
+# This means switch on 1992-01-19 at 2:00 from +04/+05 to +05/+06 for
+# Asia/Aqtau, Asia/Aqtobe, Asia/Oral, Atyrau and Kustanay oblasts; from
+# +05/+06 to +06/+07 for Asia/Almaty and Asia/Qyzylorda (and Arkalyk) [*]....
+#
+# 2. Act of the Cabinet of Ministers of the Republic of Kazakhstan
+# from 1992-03-27 No. 284
+# http://adilet.zan.kz/rus/docs/P920000284_
+# cancels extra hour ("decree time") for Uralsk and Kzyl-Orda oblasts
+# since the last Sunday of March 1992, while keeping them in the fourth
+# and the fifth time belts respectively.
+#
+# 3. Order of the Prime Minister of the Republic of Kazakhstan
+# from 1994-09-23 No. 384
+# http://adilet.zan.kz/rus/docs/R940000384_
+# cancels the extra hour ("decree time") on the territory of Mangystau
+# oblast since the last Sunday of September 1994 (saying that time on
+# the territory would correspond to the third time belt as a
+# result)....
+#
+# 4. Act of the Government of the Republic of Kazakhstan
+# from 1996-05-08 No. 575
+# http://adilet.zan.kz/rus/docs/P960000575_
+# amends the 1992-01-13 act to end summer time in October instead
+# of September, mirroring identical Russian change from 1996-04-23 act.
+#
+# 5. Act of the Government of the Republic of Kazakhstan
+# from 1999-03-26 No. 305
+# http://adilet.zan.kz/rus/docs/P990000305_
+# cancels the extra hour ("decree time") for Atyrau oblast since the
+# last Sunday of March 1999 while retaining the oblast in the fourth
+# time belt.
+#
+# This means change from +05/+06 to +04/+05.
+#
+# There is no zone for Atyrau currently (listed under Asia/Aqtau in
+# zone1970.tab).[*]
+#
+# 6. Act of the Government of the Republic of Kazakhstan
+# from 2000-11-23 No. 1749
+# http://adilet.zan.kz/rus/archive/docs/P000001749_/23.11.2000
+# replaces the previous five documents.
+#
+# The only changes I noticed are in definition of the border between the
+# fourth and the fifth time belts.  They account for changes in spelling
+# and administrative division (splitting of Turgai oblast in 1997
+# probably changed time in territories incorporated into Kostanay oblast
+# (including Arkalyk) from +06/+07 to +05/+06) and move Kyzylorda oblast
+# from being in the fifth time belt and not using decree time into the
+# fourth time belt (no change in practice).[*]
+#
+# 7. Act of the Government of the Republic of Kazakhstan
+# from 2003-12-29 No. 1342
+# http://adilet.zan.kz/rus/docs/P030001342_
+# modified the 2000-11-23 act.  No relevant changes, apparently.
+#
+# 8. Act of the Government of the Republic of Kazakhstan
+# from 2004-07-20 No. 775
+# http://adilet.zan.kz/rus/archive/docs/P040000775_/20.07.2004
+# modified the 2000-11-23 act to move Kostanay and Kyzylorda oblasts into
+# the fifth time belt and add Aktobe oblast to the list of regions not
+# using extra hour ("decree time"), leaving Kazakhstan with only 2 time
+# zones (+04/+05 and +06/+07).  The changes were to be implemented
+# during DST transitions in 2004 and 2005 but the acts got radically
+# amended before implementation happened.
+#
+# 9. Act of the Government of the Republic of Kazakhstan
+# from 2004-09-15 No. 1059
+# http://adilet.zan.kz/rus/docs/P040001059_
+# modified the 2000-11-23 act to remove exceptions from the "decree time"
+# (leaving Kazakhstan in +05/+06 and +06/+07 zones), amended the
+# 2004-07-20 act to implement changes for Atyrau, West Kazakhstan,
+# Kostanay, Kyzylorda and Mangystau oblasts by not moving clocks
+# during the 2014 transition to "winter" time.
+#
+# This means transition from +04/+05 to +05/+06 for Atyrau oblast (no
+# zone currently), Asia/Oral, Asia/Aqtau and transition from +05/+06 to
+# +06/+07 for Kostanay oblast (Kostanay and Arkalyk, no zones currently)
+# and Asia/Qyzylorda on 2004-10-31 at 3:00....[*]
+#
+# 10. Act of the Government of the Republic of Kazakhstan
+# from 2005-03-15 No. 231
+# http://adilet.zan.kz/rus/docs/P050000231_
+# removes DST provisions from the 2000-11-23 act, removes most of the
+# (already implemented) provisions from the 2004-07-20 and 2004-09-15
+# acts, comes into effect 10 days after official publication.
+# The only practical effect seems to be the abolition of the summer
+# time.
+#
+# Unamended version of the act of the Government of the Russian Federation
+# No. 23 from 1992-01-08 [See 'europe' file for details].
+# Kazakh 1992-01-13 act appears to provide the same rules and 1992-03-27
+# act was to be enacted on the last Sunday of March 1992.
+
+# From Paul Eggert (2016-04-15):
+# The tables below should reflect Stepan Golosunov's remarks above,
+# except for the items marked "[*]" which I haven't gotten to yet.
+# It looks like we will need new zones Asia/Atyrau and Asia/Qostanay
+# to handle changes from 1992 through 2004 that we did not previously
+# know about.
+
 #
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 #
 # Almaty (formerly Alma-Ata), representing most locations in Kazakhstan
+# This includes KZ-AKM, KZ-ALA, KZ-ALM, KZ-AST, KZ-BAY, KZ-VOS, KZ-ZHA,
+# KZ-KAR, KZ-SEV, KZ-PAV, and KZ-YUZ.
 Zone	Asia/Almaty	5:07:48 -	LMT	1924 May  2 # or Alma-Ata
-			5:00	-	ALMT	1930 Jun 21 # Alma-Ata Time
-			6:00 RussiaAsia ALM%sT	1991
-			6:00	-	ALMT	1992
-			6:00 RussiaAsia	ALM%sT	2005 Mar 15
-			6:00	-	ALMT
-# Qyzylorda (aka Kyzylorda, Kizilorda, Kzyl-Orda, etc.)
+			5:00	-	+05	1930 Jun 21
+			6:00 RussiaAsia +06/+07	1991 Mar 31  2:00s
+			5:00 RussiaAsia	+05/+06	1992 Jan 19  2:00s
+			6:00 RussiaAsia	+06/+07	2004 Oct 31  2:00s
+			6:00	-	+06
+# Qyzylorda (aka Kyzylorda, Kizilorda, Kzyl-Orda, etc.) (KZ-KZY)
 Zone	Asia/Qyzylorda	4:21:52 -	LMT	1924 May  2
-			4:00	-	KIZT	1930 Jun 21 # Kizilorda Time
-			5:00	-	KIZT	1981 Apr  1
-			5:00	1:00	KIZST	1981 Oct  1
-			6:00	-	KIZT	1982 Apr  1
-			5:00 RussiaAsia	KIZ%sT	1991
-			5:00	-	KIZT	1991 Dec 16 # independence
-			5:00	-	QYZT	1992 Jan 19  2:00
-			6:00 RussiaAsia	QYZ%sT	2005 Mar 15
-			6:00	-	QYZT
-# Aqtobe (aka Aktobe, formerly Aktyubinsk)
+			4:00	-	+04	1930 Jun 21
+			5:00	-	+05	1981 Apr  1
+			5:00	1:00	+06	1981 Oct  1
+			6:00	-	+06	1982 Apr  1
+			5:00 RussiaAsia	+05/+06	1991 Mar 31  2:00s
+			4:00 RussiaAsia	+04/+05	1991 Sep 29  2:00s
+			5:00 RussiaAsia	+05/+06	1992 Jan 19  2:00s
+			6:00 RussiaAsia	+06/+07	1992 Mar 29  2:00s
+			5:00 RussiaAsia	+05/+06	2004 Oct 31  2:00s
+			6:00	-	+06
+# Aqtobe (aka Aktobe, formerly Aktyubinsk) (KZ-AKT)
 Zone	Asia/Aqtobe	3:48:40	-	LMT	1924 May  2
-			4:00	-	AKTT	1930 Jun 21 # Aktyubinsk Time
-			5:00	-	AKTT	1981 Apr  1
-			5:00	1:00	AKTST	1981 Oct  1
-			6:00	-	AKTT	1982 Apr  1
-			5:00 RussiaAsia	AKT%sT	1991
-			5:00	-	AKTT	1991 Dec 16 # independence
-			5:00 RussiaAsia	AQT%sT	2005 Mar 15 # Aqtobe Time
-			5:00	-	AQTT
-# Mangghystau
+			4:00	-	+04	1930 Jun 21
+			5:00	-	+05	1981 Apr  1
+			5:00	1:00	+06	1981 Oct  1
+			6:00	-	+06	1982 Apr  1
+			5:00 RussiaAsia	+05/+06	1991 Mar 31  2:00s
+			4:00 RussiaAsia	+04/+05	1992 Jan 19  2:00s
+			5:00 RussiaAsia	+05/+06	2004 Oct 31  2:00s
+			5:00	-	+05
+# Qostanay (KZ-KUS)
+
+# Mangghystau (KZ-MAN)
 # Aqtau was not founded until 1963, but it represents an inhabited region,
 # so include time stamps before 1963.
 Zone	Asia/Aqtau	3:21:04	-	LMT	1924 May  2
-			4:00	-	FORT	1930 Jun 21 # Fort Shevchenko T
-			5:00	-	FORT	1963
-			5:00	-	SHET	1981 Oct  1 # Shevchenko Time
-			6:00	-	SHET	1982 Apr  1
-			5:00 RussiaAsia	SHE%sT	1991
-			5:00	-	SHET	1991 Dec 16 # independence
-			5:00 RussiaAsia	AQT%sT	1995 Mar lastSun  2:00 # Aqtau Time
-			4:00 RussiaAsia	AQT%sT	2005 Mar 15
-			5:00	-	AQTT
-# West Kazakhstan
+			4:00	-	+04	1930 Jun 21
+			5:00	-	+05	1963
+			5:00	-	+05	1981 Oct  1
+			6:00	-	+06	1982 Apr  1
+			5:00 RussiaAsia	+05/+06	1991 Mar 31  2:00s
+			4:00 RussiaAsia	+04/+05	1992 Jan 19  2:00s
+			5:00 RussiaAsia	+05/+06	1994 Sep 25  2:00s
+			4:00 RussiaAsia	+04/+05	2004 Oct 31  2:00s
+			5:00	-	+05

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***

From owner-svn-src-user@freebsd.org  Thu Oct 13 18:32:24 2016
Return-Path: <owner-svn-src-user@freebsd.org>
Delivered-To: svn-src-user@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 2CF13C10A49
 for <svn-src-user@mailman.ysv.freebsd.org>;
 Thu, 13 Oct 2016 18:32:24 +0000 (UTC)
 (envelope-from glebius@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 F0CB3F0A;
 Thu, 13 Oct 2016 18:32:23 +0000 (UTC)
 (envelope-from glebius@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9DIWNnX070497;
 Thu, 13 Oct 2016 18:32:23 GMT (envelope-from glebius@FreeBSD.org)
Received: (from glebius@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9DIWM4j070495;
 Thu, 13 Oct 2016 18:32:22 GMT (envelope-from glebius@FreeBSD.org)
Message-Id: <201610131832.u9DIWM4j070495@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: glebius set sender to
 glebius@FreeBSD.org using -f
From: Gleb Smirnoff <glebius@FreeBSD.org>
Date: Thu, 13 Oct 2016 18:32:22 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
Subject: svn commit: r307228 - in
 user/cperciva/freebsd-update-build/scripts/11.0-RELEASE: amd64 i386
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.23
Precedence: list
List-Id: "SVN commit messages for the experimental &quot; user&quot;
 src tree" <svn-src-user.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-user>,
 <mailto:svn-src-user-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-user/>
List-Post: <mailto:svn-src-user@freebsd.org>
List-Help: <mailto:svn-src-user-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-user>,
 <mailto:svn-src-user-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 13 Oct 2016 18:32:24 -0000

Author: glebius
Date: Thu Oct 13 18:32:22 2016
New Revision: 307228
URL: https://svnweb.freebsd.org/changeset/base/307228

Log:
  11.0-RELEASE was re-released.

Modified:
  user/cperciva/freebsd-update-build/scripts/11.0-RELEASE/amd64/build.conf
  user/cperciva/freebsd-update-build/scripts/11.0-RELEASE/i386/build.conf

Modified: user/cperciva/freebsd-update-build/scripts/11.0-RELEASE/amd64/build.conf
==============================================================================
--- user/cperciva/freebsd-update-build/scripts/11.0-RELEASE/amd64/build.conf	Thu Oct 13 18:25:40 2016	(r307227)
+++ user/cperciva/freebsd-update-build/scripts/11.0-RELEASE/amd64/build.conf	Thu Oct 13 18:32:22 2016	(r307228)
@@ -1,4 +1,4 @@
-export RELH=307692f26ef259eb9d488617d212eadee38f080b83ef191edbe69253bf22c10e883985859df176d01d6446bb3a62873c0208a4a295f39592275ab0f3ec09b355
+export RELH=0021c15ec1b3a15666cd0cb20f4d8855cf629136085f3454c797a0240c0818878f2e16ca0cba4c8567150ba95843360fb50fd92b0c459851fdff06e1bc43d5e8
 export FTP=https://people.freebsd.org/~gjb/11.0-RELEASE/
  
 # Components of the world, source, and kernels

Modified: user/cperciva/freebsd-update-build/scripts/11.0-RELEASE/i386/build.conf
==============================================================================
--- user/cperciva/freebsd-update-build/scripts/11.0-RELEASE/i386/build.conf	Thu Oct 13 18:25:40 2016	(r307227)
+++ user/cperciva/freebsd-update-build/scripts/11.0-RELEASE/i386/build.conf	Thu Oct 13 18:32:22 2016	(r307228)
@@ -1,4 +1,4 @@
-export RELH=04a17010185244ef77b99de2eac2ade68e15da4a953c90ba49d07bea8554cbe7ad33474daa13781d35d97197bfffbcfab78376ec7e5deb075ef11864c2dc66fa
+export RELH=9245d50d2d79ee24eaccc19cb93d66b71fe0efe37f80cbfb2d545c3496e365658a0e0832a0ef5911479b854b1a742e6f81862775e1e3f51ceb0a73c0adbed568
 export FTP=https://people.freebsd.org/~gjb/11.0-RELEASE/
  
 # Components of the world, source, and kernels

From owner-svn-src-user@freebsd.org  Thu Oct 13 18:34:41 2016
Return-Path: <owner-svn-src-user@freebsd.org>
Delivered-To: svn-src-user@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 632EEC10BA6
 for <svn-src-user@mailman.ysv.freebsd.org>;
 Thu, 13 Oct 2016 18:34:41 +0000 (UTC)
 (envelope-from glebius@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 2A89C10D4;
 Thu, 13 Oct 2016 18:34:41 +0000 (UTC)
 (envelope-from glebius@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9DIYeJT070633;
 Thu, 13 Oct 2016 18:34:40 GMT (envelope-from glebius@FreeBSD.org)
Received: (from glebius@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9DIYesr070630;
 Thu, 13 Oct 2016 18:34:40 GMT (envelope-from glebius@FreeBSD.org)
Message-Id: <201610131834.u9DIYesr070630@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: glebius set sender to
 glebius@FreeBSD.org using -f
From: Gleb Smirnoff <glebius@FreeBSD.org>
Date: Thu, 13 Oct 2016 18:34:40 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
Subject: svn commit: r307229 - in user/cperciva/freebsd-update-build/patches:
 10.1-RELEASE 10.2-RELEASE 10.3-RELEASE 11.0-RELEASE 9.3-RELEASE
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.23
Precedence: list
List-Id: "SVN commit messages for the experimental &quot; user&quot;
 src tree" <svn-src-user.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-user>,
 <mailto:svn-src-user-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-user/>
List-Post: <mailto:svn-src-user@freebsd.org>
List-Help: <mailto:svn-src-user-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-user>,
 <mailto:svn-src-user-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 13 Oct 2016 18:34:41 -0000

Author: glebius
Date: Thu Oct 13 18:34:39 2016
New Revision: 307229
URL: https://svnweb.freebsd.org/changeset/base/307229

Log:
  Save the latest patch queue.

Added:
  user/cperciva/freebsd-update-build/patches/10.1-RELEASE/40-SA-16:29.bspatch
  user/cperciva/freebsd-update-build/patches/10.1-RELEASE/40-SA-16:30.portsnap
  user/cperciva/freebsd-update-build/patches/10.1-RELEASE/40-SA-16:31.libarchive
  user/cperciva/freebsd-update-build/patches/10.2-RELEASE/23-SA-16:29.bspatch
  user/cperciva/freebsd-update-build/patches/10.2-RELEASE/23-SA-16:30.portsnap
  user/cperciva/freebsd-update-build/patches/10.2-RELEASE/23-SA-16:31.libarchive
  user/cperciva/freebsd-update-build/patches/10.3-RELEASE/10-SA-16:29.bspatch
  user/cperciva/freebsd-update-build/patches/10.3-RELEASE/10-SA-16:30.portsnap
  user/cperciva/freebsd-update-build/patches/10.3-RELEASE/10-SA-16:31.libarchive
  user/cperciva/freebsd-update-build/patches/11.0-RELEASE/
  user/cperciva/freebsd-update-build/patches/11.0-RELEASE/0-EN-16:99.newvers
  user/cperciva/freebsd-update-build/patches/9.3-RELEASE/48-SA-16:28.bind
  user/cperciva/freebsd-update-build/patches/9.3-RELEASE/48-SA-16:29.bspatch
  user/cperciva/freebsd-update-build/patches/9.3-RELEASE/48-SA-16:30.portsnap

Added: user/cperciva/freebsd-update-build/patches/10.1-RELEASE/40-SA-16:29.bspatch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/cperciva/freebsd-update-build/patches/10.1-RELEASE/40-SA-16:29.bspatch	Thu Oct 13 18:34:39 2016	(r307229)
@@ -0,0 +1,325 @@
+--- usr.bin/bsdiff/bspatch/bspatch.c.orig
++++ usr.bin/bsdiff/bspatch/bspatch.c
+@@ -27,56 +27,133 @@
+ #include <sys/cdefs.h>
+ __FBSDID("$FreeBSD$");
+ 
++#if defined(__FreeBSD__)
++#include <sys/param.h>
++#if __FreeBSD_version >= 1001511
++#include <sys/capsicum.h>
++#define HAVE_CAPSICUM
++#endif
++#endif
++
+ #include <bzlib.h>
+-#include <stdlib.h>
++#include <err.h>
++#include <errno.h>
++#include <fcntl.h>
++#include <libgen.h>
++#include <limits.h>
++#include <stdint.h>
+ #include <stdio.h>
++#include <stdlib.h>
+ #include <string.h>
+-#include <err.h>
+ #include <unistd.h>
+-#include <fcntl.h>
+ 
+ #ifndef O_BINARY
+ #define O_BINARY 0
+ #endif
++#define HEADER_SIZE 32
++
++static char *newfile;
++static int dirfd = -1;
++
++static void
++exit_cleanup(void)
++{
++
++	if (dirfd != -1 && newfile != NULL)
++		if (unlinkat(dirfd, newfile, 0))
++			warn("unlinkat");
++}
+ 
+ static off_t offtin(u_char *buf)
+ {
+ 	off_t y;
+ 
+-	y=buf[7]&0x7F;
+-	y=y*256;y+=buf[6];
+-	y=y*256;y+=buf[5];
+-	y=y*256;y+=buf[4];
+-	y=y*256;y+=buf[3];
+-	y=y*256;y+=buf[2];
+-	y=y*256;y+=buf[1];
+-	y=y*256;y+=buf[0];
++	y = buf[7] & 0x7F;
++	y = y * 256; y += buf[6];
++	y = y * 256; y += buf[5];
++	y = y * 256; y += buf[4];
++	y = y * 256; y += buf[3];
++	y = y * 256; y += buf[2];
++	y = y * 256; y += buf[1];
++	y = y * 256; y += buf[0];
+ 
+-	if(buf[7]&0x80) y=-y;
++	if (buf[7] & 0x80)
++		y = -y;
+ 
+-	return y;
++	return (y);
+ }
+ 
+-int main(int argc,char * argv[])
++int main(int argc, char *argv[])
+ {
+-	FILE * f, * cpf, * dpf, * epf;
+-	BZFILE * cpfbz2, * dpfbz2, * epfbz2;
++	FILE *f, *cpf, *dpf, *epf;
++	BZFILE *cpfbz2, *dpfbz2, *epfbz2;
++	char *directory, *namebuf;
+ 	int cbz2err, dbz2err, ebz2err;
+-	int fd;
+-	ssize_t oldsize,newsize;
+-	ssize_t bzctrllen,bzdatalen;
+-	u_char header[32],buf[8];
++	int newfd, oldfd;
++	off_t oldsize, newsize;
++	off_t bzctrllen, bzdatalen;
++	u_char header[HEADER_SIZE], buf[8];
+ 	u_char *old, *new;
+-	off_t oldpos,newpos;
++	off_t oldpos, newpos;
+ 	off_t ctrl[3];
+-	off_t lenread;
+-	off_t i;
++	off_t i, lenread, offset;
++#ifdef HAVE_CAPSICUM
++	cap_rights_t rights_dir, rights_ro, rights_wr;
++#endif
+ 
+ 	if(argc!=4) errx(1,"usage: %s oldfile newfile patchfile\n",argv[0]);
+ 
+ 	/* Open patch file */
+ 	if ((f = fopen(argv[3], "rb")) == NULL)
+ 		err(1, "fopen(%s)", argv[3]);
++	/* Open patch file for control block */
++	if ((cpf = fopen(argv[3], "rb")) == NULL)
++		err(1, "fopen(%s)", argv[3]);
++	/* open patch file for diff block */
++	if ((dpf = fopen(argv[3], "rb")) == NULL)
++		err(1, "fopen(%s)", argv[3]);
++	/* open patch file for extra block */
++	if ((epf = fopen(argv[3], "rb")) == NULL)
++		err(1, "fopen(%s)", argv[3]);
++	/* open oldfile */
++	if ((oldfd = open(argv[1], O_RDONLY | O_BINARY, 0)) < 0)
++		err(1, "open(%s)", argv[1]);
++	/* open directory where we'll write newfile */
++	if ((namebuf = strdup(argv[2])) == NULL ||
++	    (directory = dirname(namebuf)) == NULL ||
++	    (dirfd = open(directory, O_DIRECTORY)) < 0)
++		err(1, "open %s", argv[2]);
++	free(namebuf);
++	if ((newfile = basename(argv[2])) == NULL)
++		err(1, "basename");
++	/* open newfile */
++	if ((newfd = openat(dirfd, newfile,
++	    O_CREAT | O_TRUNC | O_WRONLY | O_BINARY, 0666)) < 0)
++		err(1, "open(%s)", argv[2]);
++	atexit(exit_cleanup);
++
++#ifdef HAVE_CAPSICUM
++	if (cap_enter() < 0) {
++		/* Failed to sandbox, fatal if CAPABILITY_MODE enabled */
++		if (errno != ENOSYS)
++			err(1, "failed to enter security sandbox");
++	} else {
++		/* Capsicum Available */
++		cap_rights_init(&rights_ro, CAP_READ, CAP_FSTAT, CAP_SEEK);
++		cap_rights_init(&rights_wr, CAP_WRITE);
++		cap_rights_init(&rights_dir, CAP_UNLINKAT);
++
++		if (cap_rights_limit(fileno(f), &rights_ro) < 0 ||
++		    cap_rights_limit(fileno(cpf), &rights_ro) < 0 ||
++		    cap_rights_limit(fileno(dpf), &rights_ro) < 0 ||
++		    cap_rights_limit(fileno(epf), &rights_ro) < 0 ||
++		    cap_rights_limit(oldfd, &rights_ro) < 0 ||
++		    cap_rights_limit(newfd, &rights_wr) < 0 ||
++		    cap_rights_limit(dirfd, &rights_dir) < 0)
++			err(1, "cap_rights_limit() failed, could not restrict"
++			    " capabilities");
++	}
++#endif
+ 
+ 	/*
+ 	File format:
+@@ -93,99 +170,99 @@
+ 	*/
+ 
+ 	/* Read header */
+-	if (fread(header, 1, 32, f) < 32) {
++	if (fread(header, 1, HEADER_SIZE, f) < HEADER_SIZE) {
+ 		if (feof(f))
+-			errx(1, "Corrupt patch\n");
++			errx(1, "Corrupt patch");
+ 		err(1, "fread(%s)", argv[3]);
+ 	}
+ 
+ 	/* Check for appropriate magic */
+ 	if (memcmp(header, "BSDIFF40", 8) != 0)
+-		errx(1, "Corrupt patch\n");
++		errx(1, "Corrupt patch");
+ 
+ 	/* Read lengths from header */
+-	bzctrllen=offtin(header+8);
+-	bzdatalen=offtin(header+16);
+-	newsize=offtin(header+24);
+-	if((bzctrllen<0) || (bzdatalen<0) || (newsize<0))
+-		errx(1,"Corrupt patch\n");
++	bzctrllen = offtin(header + 8);
++	bzdatalen = offtin(header + 16);
++	newsize = offtin(header + 24);
++	if (bzctrllen < 0 || bzctrllen > OFF_MAX - HEADER_SIZE ||
++	    bzdatalen < 0 || bzctrllen + HEADER_SIZE > OFF_MAX - bzdatalen ||
++	    newsize < 0 || newsize > SSIZE_MAX)
++		errx(1, "Corrupt patch");
+ 
+ 	/* Close patch file and re-open it via libbzip2 at the right places */
+ 	if (fclose(f))
+ 		err(1, "fclose(%s)", argv[3]);
+-	if ((cpf = fopen(argv[3], "rb")) == NULL)
+-		err(1, "fopen(%s)", argv[3]);
+-	if (fseeko(cpf, 32, SEEK_SET))
+-		err(1, "fseeko(%s, %lld)", argv[3],
+-		    (long long)32);
++	offset = HEADER_SIZE;
++	if (fseeko(cpf, offset, SEEK_SET))
++		err(1, "fseeko(%s, %jd)", argv[3], (intmax_t)offset);
+ 	if ((cpfbz2 = BZ2_bzReadOpen(&cbz2err, cpf, 0, 0, NULL, 0)) == NULL)
+ 		errx(1, "BZ2_bzReadOpen, bz2err = %d", cbz2err);
+-	if ((dpf = fopen(argv[3], "rb")) == NULL)
+-		err(1, "fopen(%s)", argv[3]);
+-	if (fseeko(dpf, 32 + bzctrllen, SEEK_SET))
+-		err(1, "fseeko(%s, %lld)", argv[3],
+-		    (long long)(32 + bzctrllen));
++	offset += bzctrllen;
++	if (fseeko(dpf, offset, SEEK_SET))
++		err(1, "fseeko(%s, %jd)", argv[3], (intmax_t)offset);
+ 	if ((dpfbz2 = BZ2_bzReadOpen(&dbz2err, dpf, 0, 0, NULL, 0)) == NULL)
+ 		errx(1, "BZ2_bzReadOpen, bz2err = %d", dbz2err);
+-	if ((epf = fopen(argv[3], "rb")) == NULL)
+-		err(1, "fopen(%s)", argv[3]);
+-	if (fseeko(epf, 32 + bzctrllen + bzdatalen, SEEK_SET))
+-		err(1, "fseeko(%s, %lld)", argv[3],
+-		    (long long)(32 + bzctrllen + bzdatalen));
++	offset += bzdatalen;
++	if (fseeko(epf, offset, SEEK_SET))
++		err(1, "fseeko(%s, %jd)", argv[3], (intmax_t)offset);
+ 	if ((epfbz2 = BZ2_bzReadOpen(&ebz2err, epf, 0, 0, NULL, 0)) == NULL)
+ 		errx(1, "BZ2_bzReadOpen, bz2err = %d", ebz2err);
+ 
+-	if(((fd=open(argv[1],O_RDONLY|O_BINARY,0))<0) ||
+-		((oldsize=lseek(fd,0,SEEK_END))==-1) ||
+-		((old=malloc(oldsize+1))==NULL) ||
+-		(lseek(fd,0,SEEK_SET)!=0) ||
+-		(read(fd,old,oldsize)!=oldsize) ||
+-		(close(fd)==-1)) err(1,"%s",argv[1]);
+-	if((new=malloc(newsize+1))==NULL) err(1,NULL);
++	if ((oldsize = lseek(oldfd, 0, SEEK_END)) == -1 ||
++	    oldsize > SSIZE_MAX ||
++	    (old = malloc(oldsize)) == NULL ||
++	    lseek(oldfd, 0, SEEK_SET) != 0 ||
++	    read(oldfd, old, oldsize) != oldsize ||
++	    close(oldfd) == -1)
++		err(1, "%s", argv[1]);
++	if ((new = malloc(newsize)) == NULL)
++		err(1, NULL);
+ 
+-	oldpos=0;newpos=0;
+-	while(newpos<newsize) {
++	oldpos = 0;
++	newpos = 0;
++	while (newpos < newsize) {
+ 		/* Read control data */
+-		for(i=0;i<=2;i++) {
++		for (i = 0; i <= 2; i++) {
+ 			lenread = BZ2_bzRead(&cbz2err, cpfbz2, buf, 8);
+ 			if ((lenread < 8) || ((cbz2err != BZ_OK) &&
+ 			    (cbz2err != BZ_STREAM_END)))
+-				errx(1, "Corrupt patch\n");
+-			ctrl[i]=offtin(buf);
++				errx(1, "Corrupt patch");
++			ctrl[i] = offtin(buf);
+ 		};
+ 
+ 		/* Sanity-check */
+-		if ((ctrl[0] < 0) || (ctrl[1] < 0))
+-			errx(1,"Corrupt patch\n");
++		if (ctrl[0] < 0 || ctrl[0] > INT_MAX ||
++		    ctrl[1] < 0 || ctrl[1] > INT_MAX)
++			errx(1, "Corrupt patch");
+ 
+ 		/* Sanity-check */
+-		if(newpos+ctrl[0]>newsize)
+-			errx(1,"Corrupt patch\n");
++		if (newpos + ctrl[0] > newsize)
++			errx(1, "Corrupt patch");
+ 
+ 		/* Read diff string */
+ 		lenread = BZ2_bzRead(&dbz2err, dpfbz2, new + newpos, ctrl[0]);
+ 		if ((lenread < ctrl[0]) ||
+ 		    ((dbz2err != BZ_OK) && (dbz2err != BZ_STREAM_END)))
+-			errx(1, "Corrupt patch\n");
++			errx(1, "Corrupt patch");
+ 
+ 		/* Add old data to diff string */
+-		for(i=0;i<ctrl[0];i++)
+-			if((oldpos+i>=0) && (oldpos+i<oldsize))
+-				new[newpos+i]+=old[oldpos+i];
++		for (i = 0; i < ctrl[0]; i++)
++			if ((oldpos + i >= 0) && (oldpos + i < oldsize))
++				new[newpos + i] += old[oldpos + i];
+ 
+ 		/* Adjust pointers */
+-		newpos+=ctrl[0];
+-		oldpos+=ctrl[0];
++		newpos += ctrl[0];
++		oldpos += ctrl[0];
+ 
+ 		/* Sanity-check */
+-		if(newpos+ctrl[1]>newsize)
+-			errx(1,"Corrupt patch\n");
++		if (newpos + ctrl[1] > newsize)
++			errx(1, "Corrupt patch");
+ 
+ 		/* Read extra string */
+ 		lenread = BZ2_bzRead(&ebz2err, epfbz2, new + newpos, ctrl[1]);
+ 		if ((lenread < ctrl[1]) ||
+ 		    ((ebz2err != BZ_OK) && (ebz2err != BZ_STREAM_END)))
+-			errx(1, "Corrupt patch\n");
++			errx(1, "Corrupt patch");
+ 
+ 		/* Adjust pointers */
+ 		newpos+=ctrl[1];
+@@ -200,12 +277,13 @@
+ 		err(1, "fclose(%s)", argv[3]);
+ 
+ 	/* Write the new file */
+-	if(((fd=open(argv[2],O_CREAT|O_TRUNC|O_WRONLY|O_BINARY,0666))<0) ||
+-		(write(fd,new,newsize)!=newsize) || (close(fd)==-1))
+-		err(1,"%s",argv[2]);
++	if (write(newfd, new, newsize) != newsize || close(newfd) == -1)
++		err(1, "%s", argv[2]);
++	/* Disable atexit cleanup */
++	newfile = NULL;
+ 
+ 	free(new);
+ 	free(old);
+ 
+-	return 0;
++	return (0);
+ }

Added: user/cperciva/freebsd-update-build/patches/10.1-RELEASE/40-SA-16:30.portsnap
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/cperciva/freebsd-update-build/patches/10.1-RELEASE/40-SA-16:30.portsnap	Thu Oct 13 18:34:39 2016	(r307229)
@@ -0,0 +1,49 @@
+--- usr.sbin/portsnap/portsnap/portsnap.sh.orig
++++ usr.sbin/portsnap/portsnap/portsnap.sh
+@@ -646,7 +646,7 @@
+ # Verify a list of files
+ fetch_snapshot_verify() {
+ 	while read F; do
+-		if [ "`gunzip -c snap/${F} | ${SHA256} -q`" != ${F} ]; then
++		if [ "`gunzip -c < snap/${F}.gz | ${SHA256} -q`" != ${F} ]; then
+ 			echo "snapshot corrupt."
+ 			return 1
+ 		fi
+@@ -681,11 +681,18 @@
+ 	cut -f 2 -d '|' tINDEX.new | fetch_snapshot_verify || return 1
+ # Extract the index
+ 	rm -f INDEX.new
+-	gunzip -c snap/`look INDEX tINDEX.new |
++	gunzip -c < snap/`look INDEX tINDEX.new |
+ 	    cut -f 2 -d '|'`.gz > INDEX.new
+ 	fetch_index_sanity || return 1
+ # Verify the snapshot contents
+ 	cut -f 2 -d '|' INDEX.new | fetch_snapshot_verify || return 1
++	cut -f 2 -d '|' tINDEX.new INDEX.new | sort -u > files.expected
++	find snap -mindepth 1 | sed -E 's^snap/(.*)\.gz^\1^' | sort > files.snap
++	if ! cmp -s files.expected files.snap; then
++		echo "unexpected files in snapshot."
++		return 1
++	fi
++	rm files.expected files.snap
+ 	echo "done."
+ 
+ # Move files into their proper locations
+@@ -777,7 +784,7 @@
+ 
+ # Extract the index
+ 	echo -n "Extracting index... " 1>${QUIETREDIR}
+-	gunzip -c files/`look INDEX tINDEX.new |
++	gunzip -c < files/`look INDEX tINDEX.new |
+ 	    cut -f 2 -d '|'`.gz > INDEX.new
+ 	fetch_index_sanity || return 1
+ 
+@@ -897,7 +904,7 @@
+ 		echo -n "$1 not provided by portsnap server; "
+ 		echo "$2 not being generated."
+ 	else
+-	gunzip -c "${WORKDIR}/files/`look $1 ${WORKDIR}/tINDEX |
++	gunzip -c < "${WORKDIR}/files/`look $1 ${WORKDIR}/tINDEX |
+ 	    cut -f 2 -d '|'`.gz" |
+ 	    cat - ${LOCALDESC} |
+ 	    ${MKINDEX} /dev/stdin > ${PORTSDIR}/$2

Added: user/cperciva/freebsd-update-build/patches/10.1-RELEASE/40-SA-16:31.libarchive
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/cperciva/freebsd-update-build/patches/10.1-RELEASE/40-SA-16:31.libarchive	Thu Oct 13 18:34:39 2016	(r307229)
@@ -0,0 +1,1270 @@
+--- contrib/libarchive/libarchive/archive_read_disk_entry_from_file.c.orig
++++ contrib/libarchive/libarchive/archive_read_disk_entry_from_file.c
+@@ -409,9 +409,7 @@
+ {
+ 	const char	*accpath;
+ 	acl_t		 acl;
+-#if HAVE_ACL_IS_TRIVIAL_NP
+ 	int		r;
+-#endif
+ 
+ 	accpath = archive_entry_sourcepath(entry);
+ 	if (accpath == NULL)
+@@ -443,9 +441,13 @@
+ 	}
+ #endif
+ 	if (acl != NULL) {
+-		translate_acl(a, entry, acl, ARCHIVE_ENTRY_ACL_TYPE_NFS4);
++		r = translate_acl(a, entry, acl, ARCHIVE_ENTRY_ACL_TYPE_NFS4);
+ 		acl_free(acl);
+-		return (ARCHIVE_OK);
++		if (r != ARCHIVE_OK) {
++			archive_set_error(&a->archive, errno,
++			    "Couldn't translate NFSv4 ACLs: %s", accpath);
++		}
++		return (r);
+ 	}
+ 
+ 	/* Retrieve access ACL from file. */
+@@ -464,18 +466,29 @@
+ 	else
+ 		acl = acl_get_file(accpath, ACL_TYPE_ACCESS);
+ 	if (acl != NULL) {
+-		translate_acl(a, entry, acl,
++		r = translate_acl(a, entry, acl,
+ 		    ARCHIVE_ENTRY_ACL_TYPE_ACCESS);
+ 		acl_free(acl);
++		if (r != ARCHIVE_OK) {
++			archive_set_error(&a->archive, errno,
++			    "Couldn't translate access ACLs: %s", accpath);
++			return (r);
++		}
+ 	}
+ 
+ 	/* Only directories can have default ACLs. */
+ 	if (S_ISDIR(archive_entry_mode(entry))) {
+ 		acl = acl_get_file(accpath, ACL_TYPE_DEFAULT);
+ 		if (acl != NULL) {
+-			translate_acl(a, entry, acl,
++			r = translate_acl(a, entry, acl,
+ 			    ARCHIVE_ENTRY_ACL_TYPE_DEFAULT);
+ 			acl_free(acl);
++			if (r != ARCHIVE_OK) {
++				archive_set_error(&a->archive, errno,
++				    "Couldn't translate default ACLs: %s",
++				    accpath);
++				return (r);
++			}
+ 		}
+ 	}
+ 	return (ARCHIVE_OK);
+@@ -536,7 +549,11 @@
+ 	// FreeBSD "brands" ACLs as POSIX.1e or NFSv4
+ 	// Make sure the "brand" on this ACL is consistent
+ 	// with the default_entry_acl_type bits provided.
+-	acl_get_brand_np(acl, &brand);
++	if (acl_get_brand_np(acl, &brand) != 0) {
++		archive_set_error(&a->archive, errno,
++		    "Failed to read ACL brand");
++		return (ARCHIVE_WARN);
++	}
+ 	switch (brand) {
+ 	case ACL_BRAND_POSIX:
+ 		switch (default_entry_acl_type) {
+@@ -544,30 +561,42 @@
+ 		case ARCHIVE_ENTRY_ACL_TYPE_DEFAULT:
+ 			break;
+ 		default:
+-			// XXX set warning message?
+-			return ARCHIVE_FAILED;
++			archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
++			    "Invalid ACL entry type for POSIX.1e ACL");
++			return (ARCHIVE_WARN);
+ 		}
+ 		break;
+ 	case ACL_BRAND_NFS4:
+ 		if (default_entry_acl_type & ~ARCHIVE_ENTRY_ACL_TYPE_NFS4) {
+-			// XXX set warning message?
+-			return ARCHIVE_FAILED;
++			archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
++			    "Invalid ACL entry type for NFSv4 ACL");
++			return (ARCHIVE_WARN);
+ 		}
+ 		break;
+ 	default:
+-		// XXX set warning message?
+-		return ARCHIVE_FAILED;
++		archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
++		    "Unknown ACL brand");
++		return (ARCHIVE_WARN);
+ 		break;
+ 	}
+ 
+ 
+ 	s = acl_get_entry(acl, ACL_FIRST_ENTRY, &acl_entry);
++	if (s == -1) {
++		archive_set_error(&a->archive, errno,
++		    "Failed to get first ACL entry");
++		return (ARCHIVE_WARN);
++	}
+ 	while (s == 1) {
+ 		ae_id = -1;
+ 		ae_name = NULL;
+ 		ae_perm = 0;
+ 
+-		acl_get_tag_type(acl_entry, &acl_tag);
++		if (acl_get_tag_type(acl_entry, &acl_tag) != 0) {
++			archive_set_error(&a->archive, errno,
++			    "Failed to get ACL tag type");
++			return (ARCHIVE_WARN);
++		}
+ 		switch (acl_tag) {
+ 		case ACL_USER:
+ 			ae_id = (int)*(uid_t *)acl_get_qualifier(acl_entry);
+@@ -600,12 +629,17 @@
+ 			continue;
+ 		}
+ 
+-		// XXX acl type maps to allow/deny/audit/YYYY bits
+-		// XXX acl_get_entry_type_np on FreeBSD returns EINVAL for
+-		// non-NFSv4 ACLs
++		// XXX acl_type maps to allow/deny/audit/YYYY bits
+ 		entry_acl_type = default_entry_acl_type;
+-		r = acl_get_entry_type_np(acl_entry, &acl_type);
+-		if (r == 0) {
++		if (default_entry_acl_type & ARCHIVE_ENTRY_ACL_TYPE_NFS4) {
++			/*
++			 * acl_get_entry_type_np() falis with non-NFSv4 ACLs
++			 */
++			if (acl_get_entry_type_np(acl_entry, &acl_type) != 0) {
++				archive_set_error(&a->archive, errno, "Failed "
++				    "to get ACL type from a NFSv4 ACL entry");
++				return (ARCHIVE_WARN);
++			}
+ 			switch (acl_type) {
+ 			case ACL_ENTRY_TYPE_ALLOW:
+ 				entry_acl_type = ARCHIVE_ENTRY_ACL_TYPE_ALLOW;
+@@ -619,28 +653,52 @@
+ 			case ACL_ENTRY_TYPE_ALARM:
+ 				entry_acl_type = ARCHIVE_ENTRY_ACL_TYPE_ALARM;
+ 				break;
++			default:
++				archive_set_error(&a->archive, errno,
++				    "Invalid NFSv4 ACL entry type");
++				return (ARCHIVE_WARN);
+ 			}
+-		}
+-
+-		/*
+-		 * 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;
+ 
+-                }
++			/*
++			 * Libarchive stores "flag" (NFSv4 inheritance bits)
++			 * in the ae_perm bitmap.
++			 *
++			 * acl_get_flagset_np() fails with non-NFSv4 ACLs
++			 */
++			if (acl_get_flagset_np(acl_entry, &acl_flagset) != 0) {
++				archive_set_error(&a->archive, errno,
++				    "Failed to get flagset from a NFSv4 ACL entry");
++				return (ARCHIVE_WARN);
++			}
++	                for (i = 0; i < (int)(sizeof(acl_inherit_map) / sizeof(acl_inherit_map[0])); ++i) {
++				r = acl_get_flag_np(acl_flagset,
++				    acl_inherit_map[i].platform_inherit);
++				if (r == -1) {
++					archive_set_error(&a->archive, errno,
++					    "Failed to check flag in a NFSv4 "
++					    "ACL flagset");
++					return (ARCHIVE_WARN);
++				} else if (r)
++					ae_perm |= acl_inherit_map[i].archive_inherit;
++                	}
++		}
+ 
+-		acl_get_permset(acl_entry, &acl_permset);
+-                for (i = 0; i < (int)(sizeof(acl_perm_map) / sizeof(acl_perm_map[0])); ++i) {
++		if (acl_get_permset(acl_entry, &acl_permset) != 0) {
++			archive_set_error(&a->archive, errno,
++			    "Failed to get ACL permission set");
++			return (ARCHIVE_WARN);
++		}
++		for (i = 0; i < (int)(sizeof(acl_perm_map) / sizeof(acl_perm_map[0])); ++i) {
+ 			/*
+ 			 * acl_get_perm() is spelled differently on different
+ 			 * platforms; see above.
+ 			 */
+-			if (ACL_GET_PERM(acl_permset, acl_perm_map[i].platform_perm))
++			r = ACL_GET_PERM(acl_permset, acl_perm_map[i].platform_perm);
++			if (r == -1) {
++				archive_set_error(&a->archive, errno,
++				    "Failed to check permission in an ACL permission set");
++				return (ARCHIVE_WARN);
++			} else if (r)
+ 				ae_perm |= acl_perm_map[i].archive_perm;
+ 		}
+ 
+@@ -649,6 +707,11 @@
+ 					    ae_id, ae_name);
+ 
+ 		s = acl_get_entry(acl, ACL_NEXT_ENTRY, &acl_entry);
++		if (s == -1) {
++			archive_set_error(&a->archive, errno,
++			    "Failed to get next ACL entry");
++			return (ARCHIVE_WARN);
++		}
+ 	}
+ 	return (ARCHIVE_OK);
+ }
+--- contrib/libarchive/libarchive/archive_read_support_format_tar.c.orig
++++ contrib/libarchive/libarchive/archive_read_support_format_tar.c
+@@ -136,6 +136,7 @@
+ 	int64_t			 entry_padding;
+ 	int64_t 		 entry_bytes_unconsumed;
+ 	int64_t			 realsize;
++	int			 sparse_allowed;
+ 	struct sparse_block	*sparse_list;
+ 	struct sparse_block	*sparse_last;
+ 	int64_t			 sparse_offset;
+@@ -1216,6 +1217,14 @@
+ 		 * sparse information in the extended area.
+ 		 */
+ 		/* FALLTHROUGH */
++	case '0':
++		/*
++		 * Enable sparse file "read" support only for regular
++		 * files and explicit GNU sparse files.  However, we
++		 * don't allow non-standard file types to be sparse.
++		 */
++		tar->sparse_allowed = 1;
++		/* FALLTHROUGH */
+ 	default: /* Regular file  and non-standard types */
+ 		/*
+ 		 * Per POSIX: non-recognized types should always be
+@@ -1675,6 +1684,14 @@
+ #endif
+ 	switch (key[0]) {
+ 	case 'G':
++		/* Reject GNU.sparse.* headers on non-regular files. */
++		if (strncmp(key, "GNU.sparse", 10) == 0 &&
++		    !tar->sparse_allowed) {
++			archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
++			    "Non-regular file cannot be sparse");
++			return (ARCHIVE_FATAL);
++		}
++
+ 		/* GNU "0.0" sparse pax format. */
+ 		if (strcmp(key, "GNU.sparse.numblocks") == 0) {
+ 			tar->sparse_offset = -1;
+--- contrib/libarchive/libarchive/archive_write_disk_acl.c.orig
++++ contrib/libarchive/libarchive/archive_write_disk_acl.c
+@@ -131,6 +131,7 @@
+ 	acl_entry_t	 acl_entry;
+ 	acl_permset_t	 acl_permset;
+ 	acl_flagset_t	 acl_flagset;
++	int		 r;
+ 	int		 ret;
+ 	int		 ae_type, ae_permset, ae_tag, ae_id;
+ 	uid_t		 ae_uid;
+@@ -144,9 +145,19 @@
+ 	if (entries == 0)
+ 		return (ARCHIVE_OK);
+ 	acl = acl_init(entries);
++	if (acl == (acl_t)NULL) {
++		archive_set_error(a, errno,
++		    "Failed to initialize ACL working storage");
++		return (ARCHIVE_FAILED);
++	}
+ 	while (archive_acl_next(a, abstract_acl, ae_requested_type, &ae_type,
+ 		   &ae_permset, &ae_tag, &ae_id, &ae_name) == ARCHIVE_OK) {
+-		acl_create_entry(&acl, &acl_entry);
++		if (acl_create_entry(&acl, &acl_entry) != 0) {
++			archive_set_error(a, errno,
++			    "Failed to create a new ACL entry");
++			ret = ARCHIVE_FAILED;
++			goto exit_free;
++		}
+ 
+ 		switch (ae_tag) {
+ 		case ARCHIVE_ENTRY_ACL_USER:
+@@ -175,47 +186,95 @@
+ 			acl_set_tag_type(acl_entry, ACL_EVERYONE);
+ 			break;
+ 		default:
+-			/* XXX */
+-			break;
++			archive_set_error(a, ARCHIVE_ERRNO_MISC,
++			    "Unknown ACL tag");
++			ret = ARCHIVE_FAILED;
++			goto exit_free;
+ 		}
+ 
++		r = 0;
+ 		switch (ae_type) {
+ 		case ARCHIVE_ENTRY_ACL_TYPE_ALLOW:
+-			acl_set_entry_type_np(acl_entry, ACL_ENTRY_TYPE_ALLOW);
++			r = acl_set_entry_type_np(acl_entry, ACL_ENTRY_TYPE_ALLOW);
+ 			break;
+ 		case ARCHIVE_ENTRY_ACL_TYPE_DENY:
+-			acl_set_entry_type_np(acl_entry, ACL_ENTRY_TYPE_DENY);
++			r = acl_set_entry_type_np(acl_entry, ACL_ENTRY_TYPE_DENY);
+ 			break;
+ 		case ARCHIVE_ENTRY_ACL_TYPE_AUDIT:
+-			acl_set_entry_type_np(acl_entry, ACL_ENTRY_TYPE_AUDIT);
++			r = acl_set_entry_type_np(acl_entry, ACL_ENTRY_TYPE_AUDIT);
+ 			break;
+ 		case ARCHIVE_ENTRY_ACL_TYPE_ALARM:
+-			acl_set_entry_type_np(acl_entry, ACL_ENTRY_TYPE_ALARM);
++			r = acl_set_entry_type_np(acl_entry, ACL_ENTRY_TYPE_ALARM);
+ 			break;
+ 		case ARCHIVE_ENTRY_ACL_TYPE_ACCESS:
+ 		case ARCHIVE_ENTRY_ACL_TYPE_DEFAULT:
+ 			// These don't translate directly into the system ACL.
+ 			break;
+ 		default:
+-			// XXX error handling here.
+-			break;
++			archive_set_error(a, ARCHIVE_ERRNO_MISC,
++			    "Unknown ACL entry type");
++			ret = ARCHIVE_FAILED;
++			goto exit_free;
++		}
++		if (r != 0) {
++			archive_set_error(a, errno,
++			    "Failed to set ACL entry type");
++			ret = ARCHIVE_FAILED;
++			goto exit_free;
+ 		}
+ 
+-		acl_get_permset(acl_entry, &acl_permset);
+-		acl_clear_perms(acl_permset);
++		if (acl_get_permset(acl_entry, &acl_permset) != 0) {
++			archive_set_error(a, errno,
++			    "Failed to get ACL permission set");
++			ret = ARCHIVE_FAILED;
++			goto exit_free;
++		}
++		if (acl_clear_perms(acl_permset) != 0) {
++			archive_set_error(a, errno,
++			    "Failed to clear ACL permissions");
++			ret = ARCHIVE_FAILED;
++			goto exit_free;
++		}
+ 
+ 		for (i = 0; i < (int)(sizeof(acl_perm_map) / sizeof(acl_perm_map[0])); ++i) {
+ 			if (ae_permset & acl_perm_map[i].archive_perm)
+-				acl_add_perm(acl_permset,
+-					     acl_perm_map[i].platform_perm);
++				if (acl_add_perm(acl_permset,
++				    acl_perm_map[i].platform_perm) != 0) {
++					archive_set_error(a, errno,
++					    "Failed to add ACL permission");
++					ret = ARCHIVE_FAILED;
++					goto exit_free;
++				}
+ 		}
+ 
+ 		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);
++		if (acl_type == ACL_TYPE_NFS4) {
++			/*
++			 * acl_get_flagset_np() fails with non-NFSv4 ACLs
++			 */
++			if (acl_get_flagset_np(acl_entry, &acl_flagset) != 0) {
++				archive_set_error(a, errno,
++				    "Failed to get flagset from an NFSv4 ACL entry");
++				ret = ARCHIVE_FAILED;
++				goto exit_free;
++			}
++			if (acl_clear_flags_np(acl_flagset) != 0) {
++				archive_set_error(a, errno,
++				    "Failed to clear flags from an NFSv4 ACL flagset");
++				ret = ARCHIVE_FAILED;
++				goto exit_free;
++			}
++			for (i = 0; i < (int)(sizeof(acl_inherit_map) / sizeof(acl_inherit_map[0])); ++i) {
++				if (ae_permset & acl_inherit_map[i].archive_inherit) {
++					if (acl_add_flag_np(acl_flagset,
++							acl_inherit_map[i].platform_inherit) != 0) {
++						archive_set_error(a, errno,
++						    "Failed to add flag to NFSv4 ACL flagset");
++						ret = ARCHIVE_FAILED;
++						goto exit_free;
++					}
++				}
++			}
+ 		}
+ 	}
+ 
+@@ -243,6 +302,7 @@
+ 		ret = ARCHIVE_WARN;
+ 	}
+ #endif
++exit_free:
+ 	acl_free(acl);
+ 	return (ret);
+ }
+--- contrib/libarchive/libarchive/archive_write_disk_posix.c.orig
++++ contrib/libarchive/libarchive/archive_write_disk_posix.c
+@@ -140,7 +140,17 @@
+ #define O_BINARY 0
+ #endif
+ #ifndef O_CLOEXEC
+-#define O_CLOEXEC	0
++#define O_CLOEXEC 0
++#endif
++
++/* Ignore non-int O_NOFOLLOW constant. */
++/* gnulib's fcntl.h does this on AIX, but it seems practical everywhere */
++#if defined O_NOFOLLOW && !(INT_MIN <= O_NOFOLLOW && O_NOFOLLOW <= INT_MAX)
++#undef O_NOFOLLOW
++#endif
++
++#ifndef O_NOFOLLOW
++#define O_NOFOLLOW 0
+ #endif
+ 
+ struct fixup_entry {
+@@ -326,12 +336,14 @@
+ 
+ #define HFS_BLOCKS(s)	((s) >> 12)
+ 
++static int	check_symlinks_fsobj(char *path, int *error_number, struct archive_string *error_string, int flags);
+ static int	check_symlinks(struct archive_write_disk *);
+ static int	create_filesystem_object(struct archive_write_disk *);
+ static struct fixup_entry *current_fixup(struct archive_write_disk *, const char *pathname);
+ #if defined(HAVE_FCHDIR) && defined(PATH_MAX)
+ static void	edit_deep_directories(struct archive_write_disk *ad);
+ #endif
++static int	cleanup_pathname_fsobj(char *path, int *error_number, struct archive_string *error_string, int flags);
+ static int	cleanup_pathname(struct archive_write_disk *);
+ static int	create_dir(struct archive_write_disk *, char *);
+ static int	create_parent_dir(struct archive_write_disk *, char *);
+@@ -1791,7 +1803,7 @@
+ 	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. */
+@@ -1801,7 +1813,7 @@
+ 		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 != '/')
+@@ -1996,6 +2008,10 @@
+ 	const char *linkname;
+ 	mode_t final_mode, mode;
+ 	int r;
++	/* these for check_symlinks_fsobj */
++	char *linkname_copy;	/* non-const copy of linkname */
++	struct archive_string error_string;
++	int error_number;
+ 
+ 	/* We identify hard/symlinks according to the link names. */
+ 	/* Since link(2) and symlink(2) don't handle modes, we're done here. */
+@@ -2004,6 +2020,27 @@
+ #if !HAVE_LINK
+ 		return (EPERM);
+ #else
++		archive_string_init(&error_string);
++		linkname_copy = strdup(linkname);
++		if (linkname_copy == NULL) {
++		    return (EPERM);
++		}
++		/* TODO: consider using the cleaned-up path as the link target? */
++		r = cleanup_pathname_fsobj(linkname_copy, &error_number, &error_string, a->flags);
++		if (r != ARCHIVE_OK) {
++			archive_set_error(&a->archive, error_number, "%s", error_string.s);
++			free(linkname_copy);
++			/* EPERM is more appropriate than error_number for our callers */
++			return (EPERM);
++		}
++		r = check_symlinks_fsobj(linkname_copy, &error_number, &error_string, a->flags);
++		if (r != ARCHIVE_OK) {
++			archive_set_error(&a->archive, error_number, "%s", error_string.s);
++			free(linkname_copy);
++			/* EPERM is more appropriate than error_number for our callers */
++			return (EPERM);
++		}
++		free(linkname_copy);
+ 		r = link(linkname, a->name) ? errno : 0;
+ 		/*
+ 		 * New cpio and pax formats allow hardlink entries
+@@ -2022,7 +2059,7 @@
+ 			a->deferred = 0;
+ 		} else if (r == 0 && a->filesize > 0) {
+ 			a->fd = open(a->name,
+-				     O_WRONLY | O_TRUNC | O_BINARY | O_CLOEXEC);
++				     O_WRONLY | O_TRUNC | O_BINARY | O_CLOEXEC | O_NOFOLLOW);
+ 			__archive_ensure_cloexec_flag(a->fd);
+ 			if (a->fd < 0)
+ 				r = errno;
+@@ -2332,110 +2369,233 @@
+ 	return (a->current_fixup);
+ }
+ 
+-/* TODO: Make this work. */
+-/*
+- * TODO: The deep-directory support bypasses this; disable deep directory
+- * support if we're doing symlink checks.
+- */
+ /*
+  * TODO: Someday, integrate this with the deep dir support; they both
+  * scan the path and both can be optimized by comparing against other
+  * recent paths.
+  */
+ /* TODO: Extend this to support symlinks on Windows Vista and later. */
++
++/*
++ * Checks the given path to see if any elements along it are symlinks.  Returns
++ * ARCHIVE_OK if there are none, otherwise puts an error in errmsg.
++ */
+ static int
+-check_symlinks(struct archive_write_disk *a)
++check_symlinks_fsobj(char *path, int *error_number, struct archive_string *error_string, int flags)
+ {
+ #if !defined(HAVE_LSTAT)
+ 	/* Platform doesn't have lstat, so we can't look for symlinks. */
+-	(void)a; /* UNUSED */
++	(void)path; /* UNUSED */
++	(void)error_number; /* UNUSED */
++	(void)error_string; /* UNUSED */
++	(void)flags; /* UNUSED */
+ 	return (ARCHIVE_OK);
+ #else
+-	char *pn;
++	int res = ARCHIVE_OK;
++	char *tail;
++	char *head;
++	int last;
+ 	char c;
+ 	int r;
+ 	struct stat st;
++	int restore_pwd;
++
++	/* Nothing to do here if name is empty */
++	if(path[0] == '\0')
++	    return (ARCHIVE_OK);
+ 
+ 	/*
+ 	 * Guard against symlink tricks.  Reject any archive entry whose
+ 	 * destination would be altered by a symlink.
++	 *
++	 * Walk the filename in chunks separated by '/'.  For each segment:
++	 *  - if it doesn't exist, continue
++	 *  - if it's symlink, abort or remove it
++	 *  - if it's a directory and it's not the last chunk, cd into it
++	 * As we go:
++	 *  head points to the current (relative) path
++	 *  tail points to the temporary \0 terminating the segment we're currently examining
++	 *  c holds what used to be in *tail
++	 *  last is 1 if this is the last tail
++	 */
++	restore_pwd = open(".", O_RDONLY | O_BINARY | O_CLOEXEC);
++	__archive_ensure_cloexec_flag(restore_pwd);
++	if (restore_pwd < 0)
++		return (ARCHIVE_FATAL);
++	head = path;
++	tail = path;
++	last = 0;
++	/* TODO: reintroduce a safe cache here? */
++	/* Skip the root directory if the path is absolute. */
++	if(tail == path && tail[0] == '/')
++		++tail;
++	/* Keep going until we've checked the entire name.
++	 * head, tail, path all alias the same string, which is
++	 * temporarily zeroed at tail, so be careful restoring the
++	 * stashed (c=tail[0]) for error messages.
++	 * Exiting the loop with break is okay; continue is not.
+ 	 */
+-	/* Whatever we checked last time doesn't need to be re-checked. */
+-	pn = a->name;
+-	if (archive_strlen(&(a->path_safe)) > 0) {
+-		char *p = a->path_safe.s;
+-		while ((*pn != '\0') && (*p == *pn))
+-			++p, ++pn;
+-	}
+-	c = pn[0];
+-	/* Keep going until we've checked the entire name. */
+-	while (pn[0] != '\0' && (pn[0] != '/' || pn[1] != '\0')) {
++	while (!last) {
++		/* Skip the separator we just consumed, plus any adjacent ones */
++		while (*tail == '/')
++		    ++tail;
+ 		/* Skip the next path element. */
+-		while (*pn != '\0' && *pn != '/')
+-			++pn;
+-		c = pn[0];
+-		pn[0] = '\0';

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***