PERFORCE change 149330 for review

Sam Leffler sam at FreeBSD.org
Sat Sep 6 17:09:51 UTC 2008


http://perforce.freebsd.org/chv.cgi?CH=149330

Change 149330 by sam at sam_ebb on 2008/09/06 17:09:36

	IFC @ 149329

Affected files ...

.. //depot/projects/vap/bin/setfacl/setfacl.c#3 integrate
.. //depot/projects/vap/lib/libarchive/archive_entry_link_resolver.c#4 integrate
.. //depot/projects/vap/lib/libarchive/archive_write_disk.3#5 integrate
.. //depot/projects/vap/lib/libarchive/archive_write_disk.c#13 integrate
.. //depot/projects/vap/lib/libarchive/test/test_write_disk.c#6 integrate
.. //depot/projects/vap/lib/libarchive/test/test_write_disk_hardlink.c#5 integrate
.. //depot/projects/vap/lib/libc/regex/re_format.7#3 integrate
.. //depot/projects/vap/lib/libc/stdlib/malloc.c#15 integrate
.. //depot/projects/vap/lib/librpcsec_gss/svc_rpcsec_gss.c#2 integrate
.. //depot/projects/vap/lib/libstand/stand.h#3 integrate
.. //depot/projects/vap/lib/libstand/ufs.c#3 integrate
.. //depot/projects/vap/lib/libstand/zalloc_malloc.c#3 integrate
.. //depot/projects/vap/release/Makefile.inc.docports#3 integrate
.. //depot/projects/vap/share/man/man4/Makefile#20 integrate
.. //depot/projects/vap/share/man/man4/pts.4#2 integrate
.. //depot/projects/vap/share/man/man9/CTASSERT.9#3 integrate
.. //depot/projects/vap/share/man/man9/bus_dma.9#4 integrate
.. //depot/projects/vap/share/misc/committers-ports.dot#10 integrate
.. //depot/projects/vap/sys/arm/at91/at91.c#6 integrate
.. //depot/projects/vap/sys/arm/at91/at91_mci.c#3 integrate
.. //depot/projects/vap/sys/arm/at91/at91_ssc.c#3 integrate
.. //depot/projects/vap/sys/arm/at91/kb920x_machdep.c#5 integrate
.. //depot/projects/vap/sys/boot/common/dev_net.c#4 integrate
.. //depot/projects/vap/sys/boot/common/devopen.c#5 integrate
.. //depot/projects/vap/sys/boot/powerpc/uboot/Makefile#3 integrate
.. //depot/projects/vap/sys/boot/powerpc/uboot/metadata.c#4 delete
.. //depot/projects/vap/sys/boot/powerpc/uboot/start.S#3 integrate
.. //depot/projects/vap/sys/boot/sparc64/loader/main.c#8 integrate
.. //depot/projects/vap/sys/boot/uboot/common/Makefile.inc#2 integrate
.. //depot/projects/vap/sys/boot/uboot/common/main.c#5 integrate
.. //depot/projects/vap/sys/boot/uboot/common/metadata.c#1 branch
.. //depot/projects/vap/sys/boot/uboot/lib/glue.c#5 integrate
.. //depot/projects/vap/sys/boot/uboot/lib/glue.h#4 integrate
.. //depot/projects/vap/sys/cddl/contrib/opensolaris/uts/common/fs/gfs.c#2 integrate
.. //depot/projects/vap/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c#3 integrate
.. //depot/projects/vap/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c#4 integrate
.. //depot/projects/vap/sys/conf/files.sun4v#6 integrate
.. //depot/projects/vap/sys/contrib/dev/ath/public/mipsisa32-be-elf.hal.o.uu#7 integrate
.. //depot/projects/vap/sys/dev/ata/ata-chipset.c#15 integrate
.. //depot/projects/vap/sys/dev/ata/ata-pci.h#10 integrate
.. //depot/projects/vap/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb.c#2 integrate
.. //depot/projects/vap/sys/dev/mii/e1000phy.c#5 integrate
.. //depot/projects/vap/sys/dev/mii/miidevs#13 integrate
.. //depot/projects/vap/sys/dev/re/if_re.c#16 integrate
.. //depot/projects/vap/sys/dev/usb/if_zyd.c#26 integrate
.. //depot/projects/vap/sys/dev/usb/ucom.c#9 integrate
.. //depot/projects/vap/sys/dev/usb/ucomvar.h#7 integrate
.. //depot/projects/vap/sys/dev/usb/usbdevs#27 integrate
.. //depot/projects/vap/sys/fs/tmpfs/tmpfs.h#4 integrate
.. //depot/projects/vap/sys/fs/tmpfs/tmpfs_fifoops.c#3 integrate
.. //depot/projects/vap/sys/fs/tmpfs/tmpfs_fifoops.h#3 integrate
.. //depot/projects/vap/sys/fs/tmpfs/tmpfs_subr.c#6 integrate
.. //depot/projects/vap/sys/fs/tmpfs/tmpfs_vfsops.c#6 integrate
.. //depot/projects/vap/sys/fs/tmpfs/tmpfs_vnops.c#8 integrate
.. //depot/projects/vap/sys/fs/tmpfs/tmpfs_vnops.h#3 integrate
.. //depot/projects/vap/sys/geom/part/g_part.c#9 integrate
.. //depot/projects/vap/sys/geom/part/g_part.h#8 integrate
.. //depot/projects/vap/sys/geom/part/g_part_gpt.c#7 integrate
.. //depot/projects/vap/sys/i386/include/pmc_mdep.h#6 integrate
.. //depot/projects/vap/sys/kern/kern_proc.c#12 integrate
.. //depot/projects/vap/sys/kern/kern_resource.c#9 integrate
.. //depot/projects/vap/sys/kern/tty.c#13 integrate
.. //depot/projects/vap/sys/kern/tty_compat.c#6 integrate
.. //depot/projects/vap/sys/kern/tty_pts.c#6 integrate
.. //depot/projects/vap/sys/kern/uipc_mbuf.c#11 integrate
.. //depot/projects/vap/sys/kern/uipc_mqueue.c#6 integrate
.. //depot/projects/vap/sys/kern/vfs_mount.c#21 integrate
.. //depot/projects/vap/sys/mips/adm5120/std.adm5120#2 integrate
.. //depot/projects/vap/sys/mips/conf/ADM5120#3 integrate
.. //depot/projects/vap/sys/mips/conf/IDT#4 integrate
.. //depot/projects/vap/sys/mips/conf/MALTA#3 integrate
.. //depot/projects/vap/sys/mips/conf/SENTRY5#4 integrate
.. //depot/projects/vap/sys/mips/idt/std.idt#2 integrate
.. //depot/projects/vap/sys/mips/malta/files.malta#2 integrate
.. //depot/projects/vap/sys/mips/malta/std.malta#2 integrate
.. //depot/projects/vap/sys/mips/mips/in_cksum.c#2 integrate
.. //depot/projects/vap/sys/mips/mips/intr_machdep.c#2 integrate
.. //depot/projects/vap/sys/net/route.h#8 integrate
.. //depot/projects/vap/sys/net80211/ieee80211.c#50 integrate
.. //depot/projects/vap/sys/netgraph/ng_pipe.c#1 branch
.. //depot/projects/vap/sys/netgraph/ng_pipe.h#1 branch
.. //depot/projects/vap/sys/netinet/if_ether.c#11 integrate
.. //depot/projects/vap/sys/netinet/ip_fw.h#10 integrate
.. //depot/projects/vap/sys/netinet/ip_fw2.c#16 integrate
.. //depot/projects/vap/sys/netinet6/icmp6.c#13 integrate
.. //depot/projects/vap/sys/security/audit/audit_syscalls.c#9 integrate
.. //depot/projects/vap/sys/sparc64/include/clock.h#6 integrate
.. //depot/projects/vap/sys/sparc64/include/cpu.h#5 integrate
.. //depot/projects/vap/sys/sparc64/include/cpufunc.h#8 integrate
.. //depot/projects/vap/sys/sparc64/include/dcr.h#1 branch
.. //depot/projects/vap/sys/sparc64/include/pcpu.h#9 integrate
.. //depot/projects/vap/sys/sparc64/include/smp.h#7 integrate
.. //depot/projects/vap/sys/sparc64/include/tick.h#4 integrate
.. //depot/projects/vap/sys/sparc64/include/trap.h#5 integrate
.. //depot/projects/vap/sys/sparc64/include/tte.h#4 integrate
.. //depot/projects/vap/sys/sparc64/include/ver.h#5 integrate
.. //depot/projects/vap/sys/sparc64/sparc64/cheetah.c#6 integrate
.. //depot/projects/vap/sys/sparc64/sparc64/clock.c#5 integrate
.. //depot/projects/vap/sys/sparc64/sparc64/exception.S#8 integrate
.. //depot/projects/vap/sys/sparc64/sparc64/genassym.c#7 integrate
.. //depot/projects/vap/sys/sparc64/sparc64/locore.S#7 integrate
.. //depot/projects/vap/sys/sparc64/sparc64/machdep.c#10 integrate
.. //depot/projects/vap/sys/sparc64/sparc64/mp_locore.S#6 integrate
.. //depot/projects/vap/sys/sparc64/sparc64/mp_machdep.c#12 integrate
.. //depot/projects/vap/sys/sparc64/sparc64/pmap.c#11 integrate
.. //depot/projects/vap/sys/sparc64/sparc64/tick.c#7 integrate
.. //depot/projects/vap/sys/sparc64/sparc64/trap.c#10 integrate
.. //depot/projects/vap/sys/sys/gpt.h#5 integrate
.. //depot/projects/vap/sys/sys/termios.h#6 integrate
.. //depot/projects/vap/sys/sys/tty.h#8 integrate
.. //depot/projects/vap/sys/sys/ttydevsw.h#2 integrate
.. //depot/projects/vap/usr.bin/cpio/cpio.c#7 integrate
.. //depot/projects/vap/usr.sbin/crunch/crunchide/exec_elf32.c#3 integrate

Differences ...

==== //depot/projects/vap/bin/setfacl/setfacl.c#3 (text+ko) ====

@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/bin/setfacl/setfacl.c,v 1.13 2007/02/26 00:42:17 mckusick Exp $");
+__FBSDID("$FreeBSD: src/bin/setfacl/setfacl.c,v 1.14 2008/09/06 13:17:35 trasz Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -245,10 +245,13 @@
 			continue;
 		}
 
-		if (acl_type == ACL_TYPE_ACCESS)
+		if (acl_type == ACL_TYPE_ACCESS) {
 			final_acl = acl[ACCESS_ACL];
-		else
+			acl_free(acl[DEFAULT_ACL]);
+		} else {
 			final_acl = acl[DEFAULT_ACL];
+			acl_free(acl[ACCESS_ACL]);
+		}
 
 		if (need_mask && (set_acl_mask(&final_acl) == -1)) {
 			warnx("failed to set ACL mask on %s", file->filename);
@@ -269,8 +272,7 @@
 			}
 		}
 
-		acl_free(acl[ACCESS_ACL]);
-		acl_free(acl[DEFAULT_ACL]);
+		acl_free(final_acl);
 		free(acl);
 	}
 

==== //depot/projects/vap/lib/libarchive/archive_entry_link_resolver.c#4 (text+ko) ====

@@ -24,7 +24,7 @@
  */
 
 #include "archive_platform.h"
-__FBSDID("$FreeBSD: src/lib/libarchive/archive_entry_link_resolver.c,v 1.3 2008/06/15 04:31:43 kientzle Exp $");
+__FBSDID("$FreeBSD: src/lib/libarchive/archive_entry_link_resolver.c,v 1.4 2008/09/05 06:15:25 kientzle Exp $");
 
 #ifdef HAVE_SYS_STAT_H
 #include <sys/stat.h>
@@ -189,7 +189,7 @@
 	case ARCHIVE_ENTRY_LINKIFY_LIKE_TAR:
 		le = find_entry(res, *e);
 		if (le != NULL) {
-			archive_entry_set_size(*e, 0);
+			archive_entry_unset_size(*e);
 			archive_entry_copy_hardlink(*e,
 			    archive_entry_pathname(le->canonical));
 		} else
@@ -217,7 +217,7 @@
 			*e = le->entry;
 			le->entry = t;
 			/* Make the old entry into a hardlink. */
-			archive_entry_set_size(*e, 0);
+			archive_entry_unset_size(*e);
 			archive_entry_copy_hardlink(*e,
 			    archive_entry_pathname(le->canonical));
 			/* If we ran out of links, return the

==== //depot/projects/vap/lib/libarchive/archive_write_disk.3#5 (text+ko) ====

@@ -22,9 +22,9 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $FreeBSD: src/lib/libarchive/archive_write_disk.3,v 1.3 2008/05/26 17:00:23 kientzle Exp $
+.\" $FreeBSD: src/lib/libarchive/archive_write_disk.3,v 1.4 2008/09/04 05:22:00 kientzle Exp $
 .\"
-.Dd March 2, 2007
+.Dd August 5, 2008
 .Dt archive_write_disk 3
 .Os
 .Sh NAME
@@ -169,11 +169,11 @@
 Note that paths ending in
 .Pa ..
 always cause an error, regardless of this flag.
-.El
 .It Cm ARCHIVE_EXTRACT_SPARSE
 Scan data for blocks of NUL bytes and try to recreate them with holes.
 This results in sparse files, independent of whether the archive format
 supports or uses them.
+.El
 .It Xo
 .Fn archive_write_disk_set_group_lookup ,
 .Fn archive_write_disk_set_user_lookup

==== //depot/projects/vap/lib/libarchive/archive_write_disk.c#13 (text+ko) ====

@@ -25,7 +25,7 @@
  */
 
 #include "archive_platform.h"
-__FBSDID("$FreeBSD: src/lib/libarchive/archive_write_disk.c,v 1.33 2008/09/01 02:50:24 kientzle Exp $");
+__FBSDID("$FreeBSD: src/lib/libarchive/archive_write_disk.c,v 1.35 2008/09/05 06:13:11 kientzle Exp $");
 
 #ifdef HAVE_SYS_TYPES_H
 #include <sys/types.h>
@@ -176,7 +176,7 @@
 	int			 fd;
 	/* Current offset for writing data to the file. */
 	off_t			 offset;
-	/* Maximum size of file. */
+	/* Maximum size of file, -1 if unknown. */
 	off_t			 filesize;
 	/* Dir we were in before this restore; only for deep paths. */
 	int			 restore_pwd;
@@ -231,8 +231,9 @@
 static struct fixup_entry *sort_dir_list(struct fixup_entry *p);
 static gid_t	trivial_lookup_gid(void *, const char *, gid_t);
 static uid_t	trivial_lookup_uid(void *, const char *, uid_t);
+static ssize_t	write_data_block(struct archive_write_disk *,
+		    const char *, size_t, off_t);
 
-
 static struct archive_vtable *archive_write_disk_vtable(void);
 
 static int	_archive_write_close(struct archive *);
@@ -337,7 +338,10 @@
 	a->offset = 0;
 	a->uid = a->user_uid;
 	a->mode = archive_entry_mode(a->entry);
-	a->filesize = archive_entry_size(a->entry);
+	if (archive_entry_size_is_set(a->entry))
+		a->filesize = archive_entry_size(a->entry);
+	else
+		a->filesize = -1;
 	archive_strcpy(&(a->_name_data), archive_entry_pathname(a->entry));
 	a->name = a->_name_data.s;
 	archive_clear_error(&a->archive);
@@ -439,15 +443,25 @@
 		fe->mode = a->mode;
 	}
 
-	if (a->deferred & TODO_TIMES) {
+	if ((a->deferred & TODO_TIMES)
+		&& (archive_entry_mtime_is_set(entry)
+		    || archive_entry_atime_is_set(entry))) {
 		fe = current_fixup(a, archive_entry_pathname(entry));
 		fe->fixup |= TODO_TIMES;
-		fe->mtime = archive_entry_mtime(entry);
-		fe->mtime_nanos = archive_entry_mtime_nsec(entry);
-		fe->atime = archive_entry_atime(entry);
-		fe->atime_nanos = archive_entry_atime_nsec(entry);
-		if (fe->atime == 0 && fe->atime_nanos == 0)
+		if (archive_entry_mtime_is_set(entry)) {
+			fe->mtime = archive_entry_mtime(entry);
+			fe->mtime_nanos = archive_entry_mtime_nsec(entry);
+		} else {
+			fe->mtime = a->start_time;
+			fe->mtime_nanos = 0;
+		}
+		if (archive_entry_atime_is_set(entry)) {
+			fe->atime = archive_entry_atime(entry);
+			fe->atime_nanos = archive_entry_atime_nsec(entry);
+		} else {
 			fe->atime = a->start_time;
+			fe->atime_nanos = 0;
+		}
 	}
 
 	if (a->deferred & TODO_FFLAGS) {
@@ -486,89 +500,113 @@
 }
 
 static ssize_t
-_archive_write_data_block(struct archive *_a,
-    const void *buff, size_t size, off_t offset)
+write_data_block(struct archive_write_disk *a,
+    const char *buff, size_t size, off_t offset)
 {
-	struct archive_write_disk *a = (struct archive_write_disk *)_a;
 	ssize_t bytes_written = 0;
-	ssize_t block_size, bytes_to_write;
-	int r = ARCHIVE_OK;
+	ssize_t block_size = 0, bytes_to_write;
+	int r;
 
-	__archive_check_magic(&a->archive, ARCHIVE_WRITE_DISK_MAGIC,
-	    ARCHIVE_STATE_DATA, "archive_write_disk_block");
-	if (a->fd < 0) {
-		archive_set_error(&a->archive, 0, "File not open");
+	if (a->filesize == 0 || a->fd < 0) {
+		archive_set_error(&a->archive, 0,
+		    "Attempt to write to an empty file");
 		return (ARCHIVE_WARN);
 	}
-	archive_clear_error(&a->archive);
 
 	if (a->flags & ARCHIVE_EXTRACT_SPARSE) {
 		if ((r = _archive_write_disk_lazy_stat(a)) != ARCHIVE_OK)
 			return (r);
 		block_size = a->pst->st_blksize;
-	} else
-		block_size = -1;
+	}
 
-	if ((off_t)(offset + size) > a->filesize) {
-		size = (size_t)(a->filesize - a->offset);
-		archive_set_error(&a->archive, 0,
-		    "Write request too large");
-		r = ARCHIVE_WARN;
-	}
+	if (a->filesize >= 0 && (off_t)(offset + size) > a->filesize)
+		size = (size_t)(a->filesize - offset);
 
 	/* Write the data. */
 	while (size > 0) {
-		if (block_size != -1) {
-			const char *buf;
+		if (block_size == 0) {
+			bytes_to_write = size;
+		} else {
+			/* We're sparsifying the file. */
+			const char *p, *end;
+			off_t block_end;
 
-			for (buf = buff; size; ++buf, --size, ++offset) {
-				if (*buf != '\0')
+			/* Skip leading zero bytes. */
+			for (p = buff, end = buff + size; p < end; ++p) {
+				if (*p != '\0')
 					break;
 			}
+			offset += p - buff;
+			size -= p - buff;
+			buff = p;
 			if (size == 0)
 				break;
-			bytes_to_write = block_size - offset % block_size;
-			buff = buf;
-		} else
+
+			/* Calculate next block boundary after offset. */
+			block_end
+			    = (offset / block_size) * block_size + block_size;
+
+			/* If the adjusted write would cross block boundary,
+			 * truncate it to the block boundary. */
 			bytes_to_write = size;
+			if (offset + bytes_to_write > block_end)
+				bytes_to_write = block_end - offset;
+		}
+
 		/* Seek if necessary to the specified offset. */
 		if (offset != a->last_offset) {
 			if (lseek(a->fd, offset, SEEK_SET) < 0) {
-				archive_set_error(&a->archive, errno, "Seek failed");
+				archive_set_error(&a->archive, errno,
+				    "Seek failed");
 				return (ARCHIVE_FATAL);
 			}
  		}
-		bytes_written = write(a->fd, buff, size);
+		bytes_written = write(a->fd, buff, bytes_to_write);
 		if (bytes_written < 0) {
 			archive_set_error(&a->archive, errno, "Write failed");
 			return (ARCHIVE_WARN);
 		}
-		buff = (const char *)buff + bytes_written;
+		buff += bytes_written;
 		size -= bytes_written;
 		offset += bytes_written;
 		a->archive.file_position += bytes_written;
 		a->archive.raw_position += bytes_written;
 		a->last_offset = a->offset = offset;
 	}
-	a->offset = offset;
-	return (r);
+	return (bytes_written);
+}
+
+static ssize_t
+_archive_write_data_block(struct archive *_a,
+    const void *buff, size_t size, off_t offset)
+{
+	struct archive_write_disk *a = (struct archive_write_disk *)_a;
+	ssize_t r;
+
+	__archive_check_magic(&a->archive, ARCHIVE_WRITE_DISK_MAGIC,
+	    ARCHIVE_STATE_DATA, "archive_write_disk_block");
+
+	r = write_data_block(a, buff, size, offset);
+
+	if (r < 0)
+		return (r);
+	if ((size_t)r < size) {
+		archive_set_error(&a->archive, 0,
+		    "Write request too large");
+		return (ARCHIVE_WARN);
+	}
+	return (ARCHIVE_OK);
 }
 
 static ssize_t
 _archive_write_data(struct archive *_a, const void *buff, size_t size)
 {
 	struct archive_write_disk *a = (struct archive_write_disk *)_a;
-	int r;
 
 	__archive_check_magic(&a->archive, ARCHIVE_WRITE_DISK_MAGIC,
 	    ARCHIVE_STATE_DATA, "archive_write_data");
-	if (a->fd < 0)
-		return (ARCHIVE_OK);
 
-	r = _archive_write_data_block(_a, buff, size, a->offset);
-	if (r < ARCHIVE_OK)
-		return (r);
-	return size;
+	return (write_data_block(a, buff, size, a->offset));
 }
 
 static int
@@ -584,7 +622,15 @@
 		return (ARCHIVE_OK);
 	archive_clear_error(&a->archive);
 
-	if (a->last_offset != a->filesize && a->fd >= 0) {
+	/* Pad or truncate file to the right size. */
+	if (a->fd < 0) {
+		/* There's no file. */
+	} else if (a->filesize < 0) {
+		/* File size is unknown, so we can't set the size. */
+	} else if (a->last_offset == a->filesize) {
+		/* Last write ended at exactly the filesize; we're done. */
+		/* Hopefully, this is the common case. */
+	} else {
 		if (ftruncate(a->fd, a->filesize) == -1 &&
 		    a->filesize == 0) {
 			archive_set_error(&a->archive, errno,
@@ -601,7 +647,8 @@
 		if (a->st.st_size != a->filesize) {
 			const char nul = '\0';
 			if (lseek(a->fd, a->st.st_size - 1, SEEK_SET) < 0) {
-				archive_set_error(&a->archive, errno, "Seek failed");
+				archive_set_error(&a->archive, errno,
+				    "Seek failed");
 				return (ARCHIVE_FATAL);
 			}
 			if (write(a->fd, &nul, 1) < 0) {
@@ -609,6 +656,7 @@
 				    "Write to restore size failed");
 				return (ARCHIVE_FATAL);
 			}
+			a->pst = NULL;
 		}
 	}
 
@@ -963,7 +1011,7 @@
 		 * If the hardlink does carry data, let the last
 		 * archive entry decide ownership.
 		 */
-		if (r == 0 && a->filesize == 0) {
+		if (r == 0 && a->filesize <= 0) {
 			a->todo = 0;
 			a->deferred = 0;
 		} if (r == 0 && a->filesize > 0) {
@@ -1623,18 +1671,31 @@
 {
 	struct timeval times[2];
 
-	times[1].tv_sec = archive_entry_mtime(a->entry);
-	times[1].tv_usec = archive_entry_mtime_nsec(a->entry) / 1000;
+	/* If no time was provided, we're done. */
+	if (!archive_entry_atime_is_set(a->entry)
+	    && !archive_entry_mtime_is_set(a->entry))
+		return (ARCHIVE_OK);
 
-	times[0].tv_sec = archive_entry_atime(a->entry);
-	times[0].tv_usec = archive_entry_atime_nsec(a->entry) / 1000;
+	/* We know at least one is set, so... */
+	if (archive_entry_mtime_is_set(a->entry)) {
+		times[1].tv_sec = archive_entry_mtime(a->entry);
+		times[1].tv_usec = archive_entry_mtime_nsec(a->entry) / 1000;
+	} else {
+		times[1].tv_sec = a->start_time;
+		times[1].tv_usec = 0;
+	}
 
 	/* If no atime was specified, use start time instead. */
 	/* In theory, it would be marginally more correct to use
 	 * time(NULL) here, but that would cost us an extra syscall
 	 * for little gain. */
-	if (times[0].tv_sec == 0 && times[0].tv_usec == 0)
+	if (archive_entry_atime_is_set(a->entry)) {
+		times[0].tv_sec = archive_entry_atime(a->entry);
+		times[0].tv_usec = archive_entry_atime_nsec(a->entry) / 1000;
+	} else {
 		times[0].tv_sec = a->start_time;
+		times[0].tv_usec = 0;
+	}
 
 #ifdef HAVE_FUTIMES
 	if (a->fd >= 0 && futimes(a->fd, times) == 0) {
@@ -1672,10 +1733,24 @@
 {
 	struct utimbuf times;
 
-	times.modtime = archive_entry_mtime(a->entry);
-	times.actime = archive_entry_atime(a->entry);
-	if (times.actime == 0)
+	/* If no time was provided, we're done. */
+	if (!archive_entry_atime_is_set(a->entry)
+	    && !archive_entry_mtime_is_set(a->entry))
+		return (ARCHIVE_OK);
+
+	/* We know at least one is set, so... */
+	/* Set mtime from mtime if set, else start time. */
+	if (archive_entry_mtime_is_set(a->entry))
+		times.modtime = archive_entry_mtime(a->entry);
+	else
+		times.modtime = a->start_time;
+
+	/* Set atime from provided atime, else mtime. */
+	if (archive_entry_atime_is_set(a->entry))
+		times.actime = archive_entry_atime(a->entry);
+	else
 		times.actime = a->start_time;
+
 	if (!S_ISLNK(a->mode) && utime(a->name, &times) != 0) {
 		archive_set_error(&a->archive, errno,
 		    "Can't update time for %s", a->name);

==== //depot/projects/vap/lib/libarchive/test/test_write_disk.c#6 (text+ko) ====

@@ -23,7 +23,7 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 #include "test.h"
-__FBSDID("$FreeBSD: src/lib/libarchive/test/test_write_disk.c,v 1.13 2008/09/01 05:38:33 kientzle Exp $");
+__FBSDID("$FreeBSD: src/lib/libarchive/test/test_write_disk.c,v 1.14 2008/09/05 06:13:11 kientzle Exp $");
 
 #if ARCHIVE_VERSION_NUMBER >= 1009000
 
@@ -84,7 +84,7 @@
 	 * the entry being a maximum size.
 	 */
 	archive_entry_set_size(ae, sizeof(data));
-        archive_entry_set_mtime(ae, 123456789, 0);
+	archive_entry_set_mtime(ae, 123456789, 0);
 	assertEqualIntA(ad, 0, archive_write_header(ad, ae));
 	assertEqualInt(sizeof(data), archive_write_data(ad, data, sizeof(data)));
 	assertEqualIntA(ad, 0, archive_write_finish_entry(ad));
@@ -152,8 +152,63 @@
 	free(compare);
 	free(data);
 }
+
+static void create_reg_file3(struct archive_entry *ae, const char *msg)
+{
+	static const char data[]="abcdefghijklmnopqrstuvwxyz";
+	struct archive *ad;
+	struct stat st;
+
+	/* Write the entry to disk. */
+	assert((ad = archive_write_disk_new()) != NULL);
+	failure("%s", msg);
+	/* Set the size smaller than the data and verify the truncation. */
+	archive_entry_set_size(ae, 5);
+	assertEqualIntA(ad, 0, archive_write_header(ad, ae));
+	assertEqualInt(5, archive_write_data(ad, data, sizeof(data)));
+	assertEqualIntA(ad, 0, archive_write_finish_entry(ad));
+#if ARCHIVE_VERSION_NUMBER < 2000000
+	archive_write_finish(ad);
+#else
+	assertEqualInt(0, archive_write_finish(ad));
 #endif
+	/* Test the entry on disk. */
+	assert(0 == stat(archive_entry_pathname(ae), &st));
+	failure("st.st_mode=%o archive_entry_mode(ae)=%o",
+	    st.st_mode, archive_entry_mode(ae));
+	assertEqualInt(st.st_mode, (archive_entry_mode(ae) & ~UMASK));
+	assertEqualInt(st.st_size, 5);
+}
+
+
+static void create_reg_file4(struct archive_entry *ae, const char *msg)
+{
+	static const char data[]="abcdefghijklmnopqrstuvwxyz";
+	struct archive *ad;
+	struct stat st;
 
+	/* Write the entry to disk. */
+	assert((ad = archive_write_disk_new()) != NULL);
+	/* Leave the size unset.  The data should not be truncated. */
+	assertEqualIntA(ad, 0, archive_write_header(ad, ae));
+	assertEqualInt(ARCHIVE_OK,
+	    archive_write_data_block(ad, data, sizeof(data), 0));
+	assertEqualIntA(ad, 0, archive_write_finish_entry(ad));
+#if ARCHIVE_VERSION_NUMBER < 2000000
+	archive_write_finish(ad);
+#else
+	assertEqualInt(0, archive_write_finish(ad));
+#endif
+	/* Test the entry on disk. */
+	assert(0 == stat(archive_entry_pathname(ae), &st));
+	failure("st.st_mode=%o archive_entry_mode(ae)=%o",
+	    st.st_mode, archive_entry_mode(ae));
+	assertEqualInt(st.st_mode, (archive_entry_mode(ae) & ~UMASK));
+	failure(msg);
+	assertEqualInt(st.st_size, sizeof(data));
+}
+#endif
+
 DEFINE_TEST(test_write_disk)
 {
 #if ARCHIVE_VERSION_NUMBER < 1009000
@@ -178,6 +233,20 @@
 	create_reg_file2(ae, "Test creating another regular file");
 	archive_entry_free(ae);
 
+	/* A regular file with a size restriction */
+	assert((ae = archive_entry_new()) != NULL);
+	archive_entry_copy_pathname(ae, "file3");
+	archive_entry_set_mode(ae, S_IFREG | 0755);
+	create_reg_file3(ae, "Regular file with size restriction");
+	archive_entry_free(ae);
+
+	/* A regular file with an unspecified size */
+	assert((ae = archive_entry_new()) != NULL);
+	archive_entry_copy_pathname(ae, "file3");
+	archive_entry_set_mode(ae, S_IFREG | 0755);
+	create_reg_file4(ae, "Regular file with unspecified size");
+	archive_entry_free(ae);
+
 	/* A regular file over an existing file */
 	assert((ae = archive_entry_new()) != NULL);
 	archive_entry_copy_pathname(ae, "file");

==== //depot/projects/vap/lib/libarchive/test/test_write_disk_hardlink.c#5 (text+ko) ====

@@ -23,7 +23,7 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 #include "test.h"
-__FBSDID("$FreeBSD: src/lib/libarchive/test/test_write_disk_hardlink.c,v 1.4 2008/09/01 05:38:33 kientzle Exp $");
+__FBSDID("$FreeBSD: src/lib/libarchive/test/test_write_disk_hardlink.c,v 1.5 2008/09/05 06:13:11 kientzle Exp $");
 
 #define UMASK 022
 
@@ -61,18 +61,48 @@
 	archive_entry_set_mode(ae, S_IFREG | 0755);
 	archive_entry_set_size(ae, sizeof(data));
 	assertEqualIntA(ad, 0, archive_write_header(ad, ae));
-	assertEqualInt(sizeof(data), archive_write_data(ad, data, sizeof(data)));
+	assertEqualInt(sizeof(data),
+	    archive_write_data(ad, data, sizeof(data)));
 	assertEqualIntA(ad, 0, archive_write_finish_entry(ad));
 	archive_entry_free(ae);
 
-	/* Link. */
+	/* Link.  Size of zero means this doesn't carry data. */
 	assert((ae = archive_entry_new()) != NULL);
 	archive_entry_copy_pathname(ae, "link1b");
-	archive_entry_set_mode(ae, S_IFREG | 0600);
+	archive_entry_set_mode(ae, S_IFREG | 0642);
 	archive_entry_set_size(ae, 0);
 	archive_entry_copy_hardlink(ae, "link1a");
 	assertEqualIntA(ad, 0, archive_write_header(ad, ae));
-	assertEqualInt(0, archive_write_data(ad, data, sizeof(data)));
+	assertEqualInt(ARCHIVE_WARN,
+	    archive_write_data(ad, data, sizeof(data)));
+	assertEqualIntA(ad, 0, archive_write_finish_entry(ad));
+	archive_entry_free(ae);
+
+	/*
+	 * Repeat tar approach test, but use unset to mark the
+	 * hardlink as having no data.
+	 */
+
+	/* Regular file. */
+	assert((ae = archive_entry_new()) != NULL);
+	archive_entry_copy_pathname(ae, "link2a");
+	archive_entry_set_mode(ae, S_IFREG | 0755);
+	archive_entry_set_size(ae, sizeof(data));
+	assertEqualIntA(ad, 0, archive_write_header(ad, ae));
+	assertEqualInt(sizeof(data),
+	    archive_write_data(ad, data, sizeof(data)));
+	assertEqualIntA(ad, 0, archive_write_finish_entry(ad));
+	archive_entry_free(ae);
+
+	/* Link.  Unset size means this doesn't carry data. */
+	assert((ae = archive_entry_new()) != NULL);
+	archive_entry_copy_pathname(ae, "link2b");
+	archive_entry_set_mode(ae, S_IFREG | 0642);
+	archive_entry_unset_size(ae);
+	archive_entry_copy_hardlink(ae, "link2a");
+	assertEqualIntA(ad, 0, archive_write_header(ad, ae));
+	assertEqualInt(ARCHIVE_WARN,
+	    archive_write_data(ad, data, sizeof(data)));
 	assertEqualIntA(ad, 0, archive_write_finish_entry(ad));
 	archive_entry_free(ae);
 
@@ -83,7 +113,7 @@
 
 	/* Regular file. */
 	assert((ae = archive_entry_new()) != NULL);
-	archive_entry_copy_pathname(ae, "link2a");
+	archive_entry_copy_pathname(ae, "link3a");
 	archive_entry_set_mode(ae, S_IFREG | 0600);
 	archive_entry_set_size(ae, sizeof(data));
 	assertEqualIntA(ad, 0, archive_write_header(ad, ae));
@@ -93,10 +123,10 @@
 
 	/* Link. */
 	assert((ae = archive_entry_new()) != NULL);
-	archive_entry_copy_pathname(ae, "link2b");
+	archive_entry_copy_pathname(ae, "link3b");
 	archive_entry_set_mode(ae, S_IFREG | 0755);
 	archive_entry_set_size(ae, sizeof(data));
-	archive_entry_copy_hardlink(ae, "link2a");
+	archive_entry_copy_hardlink(ae, "link3a");
 	assertEqualIntA(ad, 0, archive_write_header(ad, ae));
 	assertEqualInt(sizeof(data), archive_write_data(ad, data, sizeof(data)));
 	assertEqualIntA(ad, 0, archive_write_finish_entry(ad));
@@ -109,7 +139,7 @@
 
 	/* Regular file. */
 	assert((ae = archive_entry_new()) != NULL);
-	archive_entry_copy_pathname(ae, "link3a");
+	archive_entry_copy_pathname(ae, "link4a");
 	archive_entry_set_mode(ae, S_IFREG | 0600);
 	archive_entry_set_size(ae, 0);
 	assertEqualIntA(ad, 0, archive_write_header(ad, ae));
@@ -123,10 +153,10 @@
 
 	/* Link. */
 	assert((ae = archive_entry_new()) != NULL);
-	archive_entry_copy_pathname(ae, "link3b");
+	archive_entry_copy_pathname(ae, "link4b");
 	archive_entry_set_mode(ae, S_IFREG | 0755);
 	archive_entry_set_size(ae, sizeof(data));
-	archive_entry_copy_hardlink(ae, "link3a");
+	archive_entry_copy_hardlink(ae, "link4a");
 	assertEqualIntA(ad, 0, archive_write_header(ad, ae));
 	assertEqualInt(sizeof(data), archive_write_data(ad, data, sizeof(data)));
 	assertEqualIntA(ad, 0, archive_write_finish_entry(ad));
@@ -138,36 +168,63 @@
 #endif
 
 	/* Test the entries on disk. */
+
+	/* Test #1 */
 	assert(0 == stat("link1a", &st));
+	/* If the hardlink was successfully created and the archive
+	 * doesn't carry data for it, we consider it to be
+	 * non-authoritive for meta data as well.  This is consistent
+	 * with GNU tar and BSD pax.  */
 	assertEqualInt(st.st_mode, (S_IFREG | 0755) & ~UMASK);
 	assertEqualInt(st.st_size, sizeof(data));
 	assertEqualInt(st.st_nlink, 2);
 
 	assert(0 == stat("link1b", &st2));
-	assertEqualInt(st2.st_mode, (S_IFREG | 0755) & ~UMASK);
-	assertEqualInt(st2.st_size, sizeof(data));
-	assertEqualInt(st2.st_nlink, 2);
+	assertEqualInt(st.st_mode, st2.st_mode);
+	assertEqualInt(st.st_size, st2.st_size);
+	assertEqualInt(st.st_nlink, st2.st_nlink);
 	assertEqualInt(st.st_ino, st2.st_ino);
 	assertEqualInt(st.st_dev, st2.st_dev);
 
+	/* Test #2: Should produce identical results to test #1 */
+	/* Note that marking a hardlink with size = 0 is treated the
+	 * same as having an unset size.  This is partly for backwards
+	 * compatibility (we used to not have unset tracking, so
+	 * relied on size == 0) and partly to match the model used by
+	 * common file formats that store a size of zero for
+	 * hardlinks. */
 	assert(0 == stat("link2a", &st));
 	assertEqualInt(st.st_mode, (S_IFREG | 0755) & ~UMASK);
 	assertEqualInt(st.st_size, sizeof(data));
 	assertEqualInt(st.st_nlink, 2);
 
 	assert(0 == stat("link2b", &st2));
+	assertEqualInt(st.st_mode, st2.st_mode);
+	assertEqualInt(st.st_size, st2.st_size);
+	assertEqualInt(st.st_nlink, st2.st_nlink);
+	assertEqualInt(st.st_ino, st2.st_ino);
+	assertEqualInt(st.st_dev, st2.st_dev);
+
+	/* Test #3 */
+	assert(0 == stat("link3a", &st));
+	assertEqualInt(st.st_mode, (S_IFREG | 0755) & ~UMASK);
+	assertEqualInt(st.st_size, sizeof(data));
+	assertEqualInt(st.st_nlink, 2);
+
+	assert(0 == stat("link3b", &st2));
 	assertEqualInt(st2.st_mode, (S_IFREG | 0755) & ~UMASK);
 	assertEqualInt(st2.st_size, sizeof(data));
 	assertEqualInt(st2.st_nlink, 2);
 	assertEqualInt(st.st_ino, st2.st_ino);
 	assertEqualInt(st.st_dev, st2.st_dev);
 
-	assert(0 == stat("link3a", &st));
+	/* Test #4 */
+	assert(0 == stat("link4a", &st));
 	assertEqualInt(st.st_mode, (S_IFREG | 0755) & ~UMASK);
 	assertEqualInt(st.st_size, sizeof(data));
 	assertEqualInt(st.st_nlink, 2);
 
-	assert(0 == stat("link3b", &st2));
+	assert(0 == stat("link4b", &st2));
 	assertEqualInt(st2.st_mode, (S_IFREG | 0755) & ~UMASK);
 	assertEqualInt(st2.st_size, sizeof(data));
 	assertEqualInt(st2.st_nlink, 2);

==== //depot/projects/vap/lib/libc/regex/re_format.7#3 (text+ko) ====

@@ -34,7 +34,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"	@(#)re_format.7	8.3 (Berkeley) 3/20/94
-.\" $FreeBSD: src/lib/libc/regex/re_format.7,v 1.11 2004/07/02 23:52:12 ru Exp $
+.\" $FreeBSD: src/lib/libc/regex/re_format.7,v 1.12 2008/09/05 17:41:20 keramida Exp $
 .\"
 .Dd March 20, 1994
 .Dt RE_FORMAT 7
@@ -288,6 +288,14 @@
 A locale may provide others.
 A character class may not be used as an endpoint of a range.
 .Pp
+A bracketed expression like
+.Ql [[:class:]]
+can be used to match a single character that belongs to a character
+class.
+The reverse, matching any character that does not belong to a specific
+class, the negation operator of bracket expressions may be used:
+.Ql [^[:class:]] .
+.Pp
 There are two special cases\(dd of bracket expressions:
 the bracket expressions
 .Ql [[:<:]]

==== //depot/projects/vap/lib/libc/stdlib/malloc.c#15 (text+ko) ====

@@ -156,7 +156,7 @@
 #define	MALLOC_DSS
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdlib/malloc.c,v 1.177 2008/08/27 02:00:53 jasone Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/stdlib/malloc.c,v 1.178 2008/09/06 05:26:31 marcel Exp $");
 
 #include "libc_private.h"
 #ifdef MALLOC_DEBUG
@@ -226,7 +226,7 @@
 #  define CPU_SPINWAIT		__asm__ volatile("pause")
 #endif
 #ifdef __ia64__
-#  define PAGESIZE_2POW		12
+#  define PAGESIZE_2POW		13
 #  define QUANTUM_2POW		4
 #  define SIZEOF_PTR_2POW	3
 #endif

==== //depot/projects/vap/lib/librpcsec_gss/svc_rpcsec_gss.c#2 (text+ko) ====

@@ -23,7 +23,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- *	$FreeBSD: src/lib/librpcsec_gss/svc_rpcsec_gss.c,v 1.2 2008/08/06 17:11:12 dfr Exp $
+ *	$FreeBSD: src/lib/librpcsec_gss/svc_rpcsec_gss.c,v 1.3 2008/09/04 14:54:22 dfr Exp $
  */
 /*
   svc_rpcsec_gss.c
@@ -883,7 +883,7 @@
 	u_int32_t offset;
 	int word, bit;
 
-	if (seq < client->cl_seqlast) {
+	if (seq <= client->cl_seqlast) {
 		/*
 		 * The request sequence number is less than
 		 * the largest we have seen so far. If it is

==== //depot/projects/vap/lib/libstand/stand.h#3 (text+ko) ====

@@ -23,7 +23,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/lib/libstand/stand.h,v 1.42 2007/01/09 01:02:04 imp Exp $
+ * $FreeBSD: src/lib/libstand/stand.h,v 1.43 2008/09/04 10:05:44 raj Exp $
  * From	$NetBSD: stand.h,v 1.22 1997/06/26 19:17:40 drochner Exp $	
  */
 
@@ -235,9 +235,6 @@
 extern void	*realloc(void *ptr, size_t size);
 extern void	*reallocf(void *ptr, size_t size);
 extern void	mallocstats(void);
-#ifdef __alpha__
-extern void	free_region(void *start, void *end);
-#endif
 
 /* disklabel support (undocumented, may be junk) */
 struct		disklabel;

==== //depot/projects/vap/lib/libstand/ufs.c#3 (text+ko) ====

@@ -68,7 +68,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libstand/ufs.c,v 1.16 2007/01/09 01:02:04 imp Exp $");
+__FBSDID("$FreeBSD: src/lib/libstand/ufs.c,v 1.17 2008/09/04 10:05:44 raj Exp $");
 
 /*
  *	Stand-alone file reading package.
@@ -83,10 +83,6 @@
 #include "stand.h"
 #include "string.h"
 
-#ifdef __alpha__
-#define COMPAT_UFS		/* DUX has old format file systems */
-#endif
-
 static int	ufs_open(const char *path, struct open_file *f);
 static int	ufs_write(struct open_file *f, void *buf, size_t size, size_t *resid);
 static int	ufs_close(struct open_file *f);

==== //depot/projects/vap/lib/libstand/zalloc_malloc.c#3 (text+ko) ====

@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libstand/zalloc_malloc.c,v 1.9 2004/02/25 00:52:14 grehan Exp $");
+__FBSDID("$FreeBSD: src/lib/libstand/zalloc_malloc.c,v 1.10 2008/09/04 10:05:44 raj Exp $");
 
 /*
  * MALLOC.C - malloc equivalent, runs on top of zalloc and uses sbrk
@@ -50,15 +50,6 @@
 #undef free
 #endif
 
-#ifdef __alpha__
-void
-free_region(void *start, void *end)
-{
-    zextendPool(&MallocPool, start, (caddr_t)end - (caddr_t)start);
-    zfree(&MallocPool, start, (caddr_t)end - (caddr_t)start);
-}
-#endif
-
 void *
 Malloc(size_t bytes, const char *file, int line)
 {

==== //depot/projects/vap/release/Makefile.inc.docports#3 (text+ko) ====

@@ -1,4 +1,4 @@
-# $FreeBSD: src/release/Makefile.inc.docports,v 1.27 2007/04/11 15:24:58 ru Exp $
+# $FreeBSD: src/release/Makefile.inc.docports,v 1.28 2008/09/06 10:12:52 jhay Exp $
 #
 # List of (dependent) ports that are minimally required to be
 # checked out from CVS in order to get ${DOCPORTS} built and
@@ -38,8 +38,8 @@
 	ports/graphics/scr2png \
 	ports/graphics/tiff \
 	ports/print/freetype2 \
-	ports/print/ghostscript-gpl \
-	ports/print/ghostscript-gpl-nox11 \
+	ports/print/ghostscript8 \
+	ports/print/ghostscript8-nox11 \
 	ports/print/gsfonts \
 	ports/textproc/docbook-410 \
 	ports/textproc/docbook-xml \


>>> TRUNCATED FOR MAIL (1000 lines) <<<


More information about the p4-projects mailing list