CVS commit: src/external/bsd/libarchive/include

2010-07-14 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Wed Jul 14 22:14:17 UTC 2010

Modified Files:
src/external/bsd/libarchive/include: config_netbsd.h

Log Message:
Regen for libarchive 2.8.4


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/libarchive/include/config_netbsd.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/libarchive/include/config_netbsd.h
diff -u src/external/bsd/libarchive/include/config_netbsd.h:1.3 src/external/bsd/libarchive/include/config_netbsd.h:1.4
--- src/external/bsd/libarchive/include/config_netbsd.h:1.3	Tue Mar 30 14:43:06 2010
+++ src/external/bsd/libarchive/include/config_netbsd.h	Wed Jul 14 22:14:17 2010
@@ -1,11 +1,80 @@
 /* config.h.  Generated from config.h.in by configure.  */
 /* config.h.in.  Generated from configure.ac by autoheader.  */
 
+/* MD5 via ARCHIVE_HASH_MD5_LIBC supported. */
+#define ARCHIVE_HASH_MD5_LIBC 1
+
+/* MD5 via ARCHIVE_HASH_MD5_LIBSYSTEM supported. */
+/* #undef ARCHIVE_HASH_MD5_LIBSYSTEM */
+
+/* MD5 via ARCHIVE_HASH_MD5_OPENSSL supported. */
+/* #undef ARCHIVE_HASH_MD5_OPENSSL */
+
+/* RMD160 via ARCHIVE_HASH_RMD160_LIBC supported. */
+#define ARCHIVE_HASH_RMD160_LIBC 1
+
+/* RMD160 via ARCHIVE_HASH_RMD160_OPENSSL supported. */
+/* #undef ARCHIVE_HASH_RMD160_OPENSSL */
+
+/* SHA1 via ARCHIVE_HASH_SHA1_LIBC supported. */
+#define ARCHIVE_HASH_SHA1_LIBC 1
+
+/* SHA1 via ARCHIVE_HASH_SHA1_LIBSYSTEM supported. */
+/* #undef ARCHIVE_HASH_SHA1_LIBSYSTEM */
+
+/* SHA1 via ARCHIVE_HASH_SHA1_OPENSSL supported. */
+/* #undef ARCHIVE_HASH_SHA1_OPENSSL */
+
+/* SHA256 via ARCHIVE_HASH_SHA256_LIBC supported. */
+#define ARCHIVE_HASH_SHA256_LIBC 1
+
+/* SHA256 via ARCHIVE_HASH_SHA256_LIBC2 supported. */
+/* #undef ARCHIVE_HASH_SHA256_LIBC2 */
+
+/* SHA256 via ARCHIVE_HASH_SHA256_LIBC3 supported. */
+/* #undef ARCHIVE_HASH_SHA256_LIBC3 */
+
+/* SHA256 via ARCHIVE_HASH_SHA256_LIBSYSTEM supported. */
+/* #undef ARCHIVE_HASH_SHA256_LIBSYSTEM */
+
+/* SHA256 via ARCHIVE_HASH_SHA256_OPENSSL supported. */
+/* #undef ARCHIVE_HASH_SHA256_OPENSSL */
+
+/* SHA384 via ARCHIVE_HASH_SHA384_LIBC supported. */
+#define ARCHIVE_HASH_SHA384_LIBC 1
+
+/* SHA384 via ARCHIVE_HASH_SHA384_LIBC2 supported. */
+/* #undef ARCHIVE_HASH_SHA384_LIBC2 */
+
+/* SHA384 via ARCHIVE_HASH_SHA384_LIBC3 supported. */
+/* #undef ARCHIVE_HASH_SHA384_LIBC3 */
+
+/* SHA384 via ARCHIVE_HASH_SHA384_LIBSYSTEM supported. */
+/* #undef ARCHIVE_HASH_SHA384_LIBSYSTEM */
+
+/* SHA384 via ARCHIVE_HASH_SHA384_OPENSSL supported. */
+/* #undef ARCHIVE_HASH_SHA384_OPENSSL */
+
+/* SHA512 via ARCHIVE_HASH_SHA512_LIBC supported. */
+#define ARCHIVE_HASH_SHA512_LIBC 1
+
+/* SHA512 via ARCHIVE_HASH_SHA512_LIBC2 supported. */
+/* #undef ARCHIVE_HASH_SHA512_LIBC2 */
+
+/* SHA512 via ARCHIVE_HASH_SHA512_LIBC3 supported. */
+/* #undef ARCHIVE_HASH_SHA512_LIBC3 */
+
+/* SHA512 via ARCHIVE_HASH_SHA512_LIBSYSTEM supported. */
+/* #undef ARCHIVE_HASH_SHA512_LIBSYSTEM */
+
+/* SHA512 via ARCHIVE_HASH_SHA512_OPENSSL supported. */
+/* #undef ARCHIVE_HASH_SHA512_OPENSSL */
+
 /* Version number of bsdcpio */
-#define BSDCPIO_VERSION_STRING "2.8.2"
+#define BSDCPIO_VERSION_STRING "2.8.4"
 
 /* Version number of bsdtar */
-#define BSDTAR_VERSION_STRING "2.8.2"
+#define BSDTAR_VERSION_STRING "2.8.4"
 
 /* Define to 1 if you have the `acl_create_entry' function. */
 /* #undef HAVE_ACL_CREATE_ENTRY */
@@ -64,6 +133,10 @@
 /* Define to 1 if you have the `cygwin_conv_path' function. */
 /* #undef HAVE_CYGWIN_CONV_PATH */
 
+/* Define to 1 if you have the declaration of `EXTATTR_NAMESPACE_USER', and to
+   0 if you don't. */
+#define HAVE_DECL_EXTATTR_NAMESPACE_USER 1
+
 /* Define to 1 if you have the declaration of `INT64_MAX', and to 0 if you
don't. */
 #define HAVE_DECL_INT64_MAX 1
@@ -174,9 +247,21 @@
 /* Define to 1 if you have the `geteuid' function. */
 #define HAVE_GETEUID 1
 
+/* Define to 1 if you have the `getgrgid_r' function. */
+#define HAVE_GETGRGID_R 1
+
+/* Define to 1 if you have the `getgrnam_r' function. */
+#define HAVE_GETGRNAM_R 1
+
 /* Define to 1 if you have the `getpid' function. */
 #define HAVE_GETPID 1
 
+/* Define to 1 if you have the `getpwnam_r' function. */
+#define HAVE_GETPWNAM_R 1
+
+/* Define to 1 if you have the `getpwuid_r' function. */
+#define HAVE_GETPWUID_R 1
+
 /* Define to 1 if you have the `getxattr' function. */
 /* #undef HAVE_GETXATTR */
 
@@ -274,12 +359,6 @@
 /* Define to 1 if you have the  header file. */
 /* #undef HAVE_LZMA_H */
 
-/* Define to 1 if you have the `MD5Init' function. */
-#define HAVE_MD5INIT 1
-
-/* Define to 1 if you have the  header file. */
-#define HAVE_MD5_H 1
-
 /* Define to 1 if you have the `memmove' function. */
 #define HAVE_MEMMOVE 1
 
@@ -304,24 +383,6 @@
 /* Define to 1 if you have the `nl_langinfo' function. */
 #define HAVE_NL_LANGINFO 1
 
-/* Define to 1 if you have the  header file. */
-/* #undef HA

CVS commit: src/external/bsd/libarchive/dist/libarchive

2010-07-14 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Wed Jul 14 22:13:58 UTC 2010

Modified Files:
src/external/bsd/libarchive/dist/libarchive: archive_read.3
archive_read_disk_entry_from_file.c

Log Message:
Merge libarchive 2.8.4


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 \
src/external/bsd/libarchive/dist/libarchive/archive_read.3 \

src/external/bsd/libarchive/dist/libarchive/archive_read_disk_entry_from_file.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/libarchive/dist/libarchive/archive_read.3
diff -u src/external/bsd/libarchive/dist/libarchive/archive_read.3:1.3 src/external/bsd/libarchive/dist/libarchive/archive_read.3:1.4
--- src/external/bsd/libarchive/dist/libarchive/archive_read.3:1.3	Sat Feb 20 02:51:33 2010
+++ src/external/bsd/libarchive/dist/libarchive/archive_read.3	Wed Jul 14 22:13:58 2010
@@ -591,7 +591,7 @@
   archive_read_support_format_all(a);
   archive_read_open(a, mydata, myopen, myread, myclose);
   while (archive_read_next_header(a, &entry) == ARCHIVE_OK) {
-printf("%s\\n",archive_entry_pathname(entry));
+printf("%s\en",archive_entry_pathname(entry));
 archive_read_data_skip(a);
   }
   archive_read_finish(a);
Index: src/external/bsd/libarchive/dist/libarchive/archive_read_disk_entry_from_file.c
diff -u src/external/bsd/libarchive/dist/libarchive/archive_read_disk_entry_from_file.c:1.3 src/external/bsd/libarchive/dist/libarchive/archive_read_disk_entry_from_file.c:1.4
--- src/external/bsd/libarchive/dist/libarchive/archive_read_disk_entry_from_file.c:1.3	Sun Mar 14 19:30:50 2010
+++ src/external/bsd/libarchive/dist/libarchive/archive_read_disk_entry_from_file.c	Wed Jul 14 22:13:58 2010
@@ -210,7 +210,7 @@
 		acl = acl_get_link_np(accpath, ACL_TYPE_ACCESS);
 #else
 	else if ((!a->follow_symlinks)
-	&& (archive_entry_filetype(entry) == AE_IFLNK)))
+	&& (archive_entry_filetype(entry) == AE_IFLNK))
 		/* We can't get the ACL of a symlink, so we assume it can't
 		   have one. */
 		acl = NULL;
@@ -425,7 +425,8 @@
 	return (ARCHIVE_OK);
 }
 
-#elif HAVE_EXTATTR_GET_FILE && HAVE_EXTATTR_LIST_FILE
+#elif HAVE_EXTATTR_GET_FILE && HAVE_EXTATTR_LIST_FILE && \
+HAVE_DECL_EXTATTR_NAMESPACE_USER
 
 /*
  * FreeBSD extattr interface.



CVS commit: src/external/bsd/libarchive/dist

2010-07-14 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Wed Jul 14 22:11:42 UTC 2010

Update of /cvsroot/src/external/bsd/libarchive/dist
In directory ivanova.netbsd.org:/tmp/cvs-serv22095

Log Message:
Import libarchive 2.8.4:
Symlink dereference fix for Linux broke the build there; corrected.
Fix issues on ancient FreeBSD, QNX, ancient NetBSD and Minix.
Improved reliability of hash function detection.

Status:

Vendor Tag: KIENTZLE
Release Tags:   libarchive-2-8-4

U src/external/bsd/libarchive/dist/README
U src/external/bsd/libarchive/dist/COPYING
U src/external/bsd/libarchive/dist/NEWS
U src/external/bsd/libarchive/dist/cpio/cmdline.c
U src/external/bsd/libarchive/dist/cpio/cpio.c
U src/external/bsd/libarchive/dist/cpio/cpio.h
U src/external/bsd/libarchive/dist/cpio/cpio_platform.h
U src/external/bsd/libarchive/dist/cpio/cpio_windows.h
U src/external/bsd/libarchive/dist/cpio/cpio_windows.c
U src/external/bsd/libarchive/dist/cpio/bsdcpio.1
U src/external/bsd/libarchive/dist/cpio/test/main.c
U src/external/bsd/libarchive/dist/cpio/test/test.h
U src/external/bsd/libarchive/dist/cpio/test/test_0.c
U src/external/bsd/libarchive/dist/cpio/test/test_basic.c
U src/external/bsd/libarchive/dist/cpio/test/test_cmdline.c
U src/external/bsd/libarchive/dist/cpio/test/test_format_newc.c
U src/external/bsd/libarchive/dist/cpio/test/test_gcpio_compat.c
U src/external/bsd/libarchive/dist/cpio/test/test_option_B_upper.c
U src/external/bsd/libarchive/dist/cpio/test/test_option_C_upper.c
U src/external/bsd/libarchive/dist/cpio/test/test_option_J_upper.c
U src/external/bsd/libarchive/dist/cpio/test/test_option_L_upper.c
U src/external/bsd/libarchive/dist/cpio/test/test_option_Z_upper.c
U src/external/bsd/libarchive/dist/cpio/test/test_option_a.c
U src/external/bsd/libarchive/dist/cpio/test/test_option_c.c
U src/external/bsd/libarchive/dist/cpio/test/test_option_d.c
U src/external/bsd/libarchive/dist/cpio/test/test_option_f.c
U src/external/bsd/libarchive/dist/cpio/test/test_option_help.c
U src/external/bsd/libarchive/dist/cpio/test/test_option_l.c
U src/external/bsd/libarchive/dist/cpio/test/test_option_m.c
U src/external/bsd/libarchive/dist/cpio/test/test_option_lzma.c
U src/external/bsd/libarchive/dist/cpio/test/test_option_t.c
U src/external/bsd/libarchive/dist/cpio/test/test_option_u.c
U src/external/bsd/libarchive/dist/cpio/test/test_option_version.c
U src/external/bsd/libarchive/dist/cpio/test/test_option_y.c
U src/external/bsd/libarchive/dist/cpio/test/test_option_z.c
U src/external/bsd/libarchive/dist/cpio/test/test_owner_parse.c
U src/external/bsd/libarchive/dist/cpio/test/test_passthrough_dotdot.c
U src/external/bsd/libarchive/dist/cpio/test/test_passthrough_reverse.c
U src/external/bsd/libarchive/dist/cpio/test/test_pathmatch.c
U src/external/bsd/libarchive/dist/cpio/test/list.h
U src/external/bsd/libarchive/dist/cpio/test/test_gcpio_compat_ref.bin.uu
U src/external/bsd/libarchive/dist/cpio/test/test_gcpio_compat_ref.crc.uu
U src/external/bsd/libarchive/dist/cpio/test/test_gcpio_compat_ref.newc.uu
U src/external/bsd/libarchive/dist/cpio/test/test_gcpio_compat_ref.ustar.uu
U src/external/bsd/libarchive/dist/cpio/test/CMakeLists.txt
N src/external/bsd/libarchive/dist/cpio/test/test_gcpio_compat_ref_nosym.bin.uu
N src/external/bsd/libarchive/dist/cpio/test/test_gcpio_compat_ref_nosym.crc.uu
N src/external/bsd/libarchive/dist/cpio/test/test_gcpio_compat_ref_nosym.newc.uu
N 
src/external/bsd/libarchive/dist/cpio/test/test_gcpio_compat_ref_nosym.ustar.uu
U src/external/bsd/libarchive/dist/cpio/test/test_option_f.cpio.uu
U src/external/bsd/libarchive/dist/cpio/test/test_option_m.cpio.uu
U src/external/bsd/libarchive/dist/cpio/test/test_option_t.cpio.uu
U src/external/bsd/libarchive/dist/cpio/test/test_option_t.stdout.uu
U src/external/bsd/libarchive/dist/cpio/test/test_option_tv.stdout.uu
U src/external/bsd/libarchive/dist/libarchive/archive.h
U src/external/bsd/libarchive/dist/libarchive/archive_entry.h
U src/external/bsd/libarchive/dist/libarchive/archive_check_magic.c
U src/external/bsd/libarchive/dist/libarchive/archive_crc32.h
U src/external/bsd/libarchive/dist/libarchive/archive_endian.h
U src/external/bsd/libarchive/dist/libarchive/archive_entry.c
U src/external/bsd/libarchive/dist/libarchive/archive_entry_copy_stat.c
U src/external/bsd/libarchive/dist/libarchive/archive_entry_link_resolver.c
U src/external/bsd/libarchive/dist/libarchive/archive_entry_private.h
U src/external/bsd/libarchive/dist/libarchive/archive_entry_stat.c
U src/external/bsd/libarchive/dist/libarchive/archive_entry_strmode.c
U src/external/bsd/libarchive/dist/libarchive/archive_entry_xattr.c
U src/external/bsd/libarchive/dist/libarchive/archive_hash.h
U src/external/bsd/libarchive/dist/libarchive/archive_platform.h
U src/external/bsd/libarchive/dist/libarchive/archive_private.h
U src/external/bsd/libarchive/dist/libarchive/archive_read.c
U src/external/bsd/libarchive/dist/libarchive/cpio.5
U src/external/bsd/libarchive/d

CVS commit: src/distrib/sets/lists/tests

2010-07-14 Thread Julio Merino
Module Name:src
Committed By:   jmmv
Date:   Wed Jul 14 21:48:32 UTC 2010

Modified Files:
src/distrib/sets/lists/tests: mi

Log Message:
Add the new kernel/t_sigaction test program.


To generate a diff of this commit:
cvs rdiff -u -r1.107 -r1.108 src/distrib/sets/lists/tests/mi

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.107 src/distrib/sets/lists/tests/mi:1.108
--- src/distrib/sets/lists/tests/mi:1.107	Wed Jul 14 21:41:32 2010
+++ src/distrib/sets/lists/tests/mi	Wed Jul 14 21:48:31 2010
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.107 2010/07/14 21:41:32 pooka Exp $
+# $NetBSD: mi,v 1.108 2010/07/14 21:48:31 jmmv Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -247,6 +247,7 @@
 ./usr/libdata/debug/usr/tests/kernel/t_poll3w.debug			tests-kernel-tests	debug,atf
 ./usr/libdata/debug/usr/tests/kernel/t_posix_fadvise.debug		tests-kernel-tests	debug,atf
 ./usr/libdata/debug/usr/tests/kernel/t_rnd.debug			tests-kernel-tests	debug,atf
+./usr/libdata/debug/usr/tests/kernel/t_sigaction.debug			tests-kernel-tests	debug,atf
 ./usr/libdata/debug/usr/tests/kernel/t_time.debug			tests-kernel-tests	debug,atf
 ./usr/libdata/debug/usr/tests/kernel/t_ucontext.debug			tests-kernel-tests	debug,atf
 ./usr/libdata/debug/usr/tests/kernel/t_writev.debug			tests-kernel-tests	debug,atf
@@ -1286,6 +1287,7 @@
 ./usr/tests/kernel/t_poll3w			tests-kernel-tests		atf
 ./usr/tests/kernel/t_posix_fadvise		tests-kernel-tests		atf
 ./usr/tests/kernel/t_rnd			tests-kernel-tests		atf
+./usr/tests/kernel/t_sigaction			tests-kernel-tests		atf
 ./usr/tests/kernel/t_time			tests-kernel-tests		atf
 ./usr/tests/kernel/t_ucontext			tests-kernel-tests		atf
 ./usr/tests/kernel/t_umount			tests-kernel-tests		atf



CVS commit: src/tests/kernel

2010-07-14 Thread Julio Merino
Module Name:src
Committed By:   jmmv
Date:   Wed Jul 14 21:47:06 UTC 2010

Modified Files:
src/tests/kernel: Makefile
Added Files:
src/tests/kernel: t_sigaction.c

Log Message:
Add a couple of simple tests for sigaction(2): one for the case where flags
is set to 0 and the other for the case where we set SA_RESETHAND.

The latter test is intended to expose PR port-macppc/43619 and is marked as
an expected failure on such platform.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/tests/kernel/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/kernel/t_sigaction.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/kernel/Makefile
diff -u src/tests/kernel/Makefile:1.6 src/tests/kernel/Makefile:1.7
--- src/tests/kernel/Makefile:1.6	Tue Jul 13 21:13:25 2010
+++ src/tests/kernel/Makefile	Wed Jul 14 21:47:06 2010
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.6 2010/07/13 21:13:25 jmmv Exp $
+# $NetBSD: Makefile,v 1.7 2010/07/14 21:47:06 jmmv Exp $
 
 NOMAN=		# defined
 
@@ -19,6 +19,7 @@
 TESTS_C+=	t_ucontext
 TESTS_C+=	t_writev
 TESTS_C+=	t_extattrctl
+TESTS_C+=	t_sigaction
 
 TESTS_SH=	t_umount
 

Added files:

Index: src/tests/kernel/t_sigaction.c
diff -u /dev/null src/tests/kernel/t_sigaction.c:1.1
--- /dev/null	Wed Jul 14 21:47:06 2010
+++ src/tests/kernel/t_sigaction.c	Wed Jul 14 21:47:06 2010
@@ -0,0 +1,128 @@
+/* $NetBSD: t_sigaction.c,v 1.1 2010/07/14 21:47:06 jmmv Exp $ */
+
+/*-
+ * Copyright (c) 2010 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include 
+__COPYRIGHT("@(#) Copyright (c) 2010\
+ The NetBSD Foundation, inc. All rights reserved.");
+__RCSID("$NetBSD: t_sigaction.c,v 1.1 2010/07/14 21:47:06 jmmv Exp $");
+
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include "../h_macros.h"
+
+static bool handler_called = false;
+
+static void
+handler(int signo)
+{
+handler_called = true;
+}
+
+static void
+sa_resethand_child(const int flags)
+{
+struct sigaction sa;
+
+sa.sa_flags = flags;
+sa.sa_handler = &handler;
+sigemptyset(&sa.sa_mask);
+
+sigaction(SIGUSR1, &sa, NULL);
+kill(getpid(), SIGUSR1);
+exit(handler_called ? EXIT_SUCCESS : EXIT_FAILURE);
+}
+
+static void
+wait_and_check_child(const pid_t pid, const char *fail_message)
+{
+	int status;
+
+	(void)waitpid(pid, &status, 0);
+
+	if (WIFEXITED(status))
+		ATF_CHECK_EQ(EXIT_SUCCESS, WEXITSTATUS(status));
+	else
+		atf_tc_fail("%s; raw exit status was %d", fail_message, status);
+}
+
+ATF_TC(sa_noflags);
+ATF_TC_HEAD(sa_noflags, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "Checks programming a signal with "
+	"sigaction(2) but without any flags");
+}
+ATF_TC_BODY(sa_noflags, tc)
+{
+	const pid_t pid = fork();
+	if (pid == -1)
+		atf_tc_fail_errno("fork(2) failed");
+	else if (pid == 0)
+		sa_resethand_child(0);
+	else
+		wait_and_check_child(pid, "Child process did not exit cleanly; "
+		"it failed to process the signal");
+}
+
+ATF_TC(sa_resethand);
+ATF_TC_HEAD(sa_resethand, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "Checks that SA_RESETHAND works");
+}
+ATF_TC_BODY(sa_resethand, tc)
+{
+	const pid_t pid = fork();
+	if (pid == -1)
+		atf_tc_fail_errno("fork(2) failed");
+	else if (pid == 0)
+		sa_resethand_child(SA_RESETHAND);
+	else {
+		if (strcmp("macppc", atf_config_get("atf_arch")) == 0)
+			atf_tc_expect_fail("PR port-macppc/43619");
+
+		wait_and_check_child(pid, "Child process did not exit cleanly; "
+		"it either failed to process the signal or SA_RESETHAND is "
+		"broken");
+	}
+}
+
+ATF_TP_ADD_TCS

CVS commit: src/tests/fs/vfs

2010-07-14 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Wed Jul 14 21:44:40 UTC 2010

Modified Files:
src/tests/fs/vfs: t_renamerace.c

Log Message:
xfail test on lfs.  It goes badaboom faster than you can find your
multipass.  Borrow PR kern/43582 used earlier for rmdirrace, as it
looks pretty much like the same problem.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/fs/vfs/t_renamerace.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/fs/vfs/t_renamerace.c
diff -u src/tests/fs/vfs/t_renamerace.c:1.1 src/tests/fs/vfs/t_renamerace.c:1.2
--- src/tests/fs/vfs/t_renamerace.c:1.1	Wed Jul 14 21:39:31 2010
+++ src/tests/fs/vfs/t_renamerace.c	Wed Jul 14 21:44:40 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_renamerace.c,v 1.1 2010/07/14 21:39:31 pooka Exp $	*/
+/*	$NetBSD: t_renamerace.c,v 1.2 2010/07/14 21:44:40 pooka Exp $	*/
 
 /*
  * Modified for rump and atf from a program supplied
@@ -69,6 +69,9 @@
 {
 	pthread_t pt1, pt2;
 
+	if (FSTYPE_LFS(tc))
+		atf_tc_expect_signal(-1, "PR kern/43582");
+
 	pthread_create(&pt1, NULL, w1, __UNCONST(mp));
 	pthread_create(&pt2, NULL, w2, __UNCONST(mp));
 



CVS commit: src/distrib/sets/lists/tests

2010-07-14 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Wed Jul 14 21:41:32 UTC 2010

Modified Files:
src/distrib/sets/lists/tests: mi

Log Message:
start converting renameraces to vfs


To generate a diff of this commit:
cvs rdiff -u -r1.106 -r1.107 src/distrib/sets/lists/tests/mi

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.106 src/distrib/sets/lists/tests/mi:1.107
--- src/distrib/sets/lists/tests/mi:1.106	Tue Jul 13 18:13:57 2010
+++ src/distrib/sets/lists/tests/mi	Wed Jul 14 21:41:32 2010
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.106 2010/07/13 18:13:57 pooka Exp $
+# $NetBSD: mi,v 1.107 2010/07/14 21:41:32 pooka Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -188,7 +188,7 @@
 ./usr/libdata/debug/usr/tests/fs/ffs	tests-fs-debug
 ./usr/libdata/debug/usr/tests/fs/ffs/t_fifos.debug			tests-fs-debug		debug,atf
 ./usr/libdata/debug/usr/tests/fs/ffs/t_mount.debug			tests-fs-debug		debug,atf
-./usr/libdata/debug/usr/tests/fs/ffs/t_renamerace.debug			tests-fs-debug		debug,atf
+./usr/libdata/debug/usr/tests/fs/ffs/t_renamerace.debug			tests-obsolete		obsolete
 ./usr/libdata/debug/usr/tests/fs/ffs/t_snapshot.debug			tests-fs-debug		debug,atf
 ./usr/libdata/debug/usr/tests/fs/kernfs	tests-fs-debug
 ./usr/libdata/debug/usr/tests/fs/kernfs/t_basic.debug			tests-fs-debug		debug,atf
@@ -217,6 +217,7 @@
 ./usr/libdata/debug/usr/tests/fs/union/t_basic.debug			tests-fs-debug		debug,atf
 ./usr/libdata/debug/usr/tests/fs/union/t_pr.debug			tests-fs-debug		debug,atf
 ./usr/libdata/debug/usr/tests/fs/vfs	tests-fs-debug
+./usr/libdata/debug/usr/tests/fs/vfs/t_renamerace.debug			tests-fs-debug		debug,atf
 ./usr/libdata/debug/usr/tests/fs/vfs/t_rmdirrace.debug			tests-fs-debug		debug,atf
 ./usr/libdata/debug/usr/tests/fs/vfs/t_vfsops.debug			tests-fs-debug		debug,atf
 ./usr/libdata/debug/usr/tests/fs/vfs/t_vnops.debug			tests-fs-debug		debug,atf
@@ -869,7 +870,7 @@
 ./usr/tests/fs/ffs/Atffile			tests-fs-tests		atf
 ./usr/tests/fs/ffs/t_fifos			tests-fs-tests		atf
 ./usr/tests/fs/ffs/t_mount			tests-fs-tests		atf
-./usr/tests/fs/ffs/t_renamerace			tests-fs-tests		atf
+./usr/tests/fs/ffs/t_renamerace			tests-obsolete		obsolete
 ./usr/tests/fs/ffs/t_snapshot			tests-fs-tests		atf
 ./usr/tests/fs/kernfstests-fs-tests
 ./usr/tests/fs/kernfs/Atffile			tests-fs-tests		atf
@@ -945,6 +946,7 @@
 ./usr/tests/fs/union/t_pr			tests-fs-tests		atf
 ./usr/tests/fs/vfstests-fs-tests
 ./usr/tests/fs/vfs/Atffile			tests-fs-tests		atf
+./usr/tests/fs/vfs/t_renamerace			tests-fs-tests		atf
 ./usr/tests/fs/vfs/t_rmdirrace			tests-fs-tests		atf
 ./usr/tests/fs/vfs/t_vfsops			tests-fs-tests		atf
 ./usr/tests/fs/vfs/t_vnops			tests-fs-tests		atf



CVS commit: src/tests/fs

2010-07-14 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Wed Jul 14 21:39:31 UTC 2010

Modified Files:
src/tests/fs/ffs: Makefile
src/tests/fs/tmpfs: t_renamerace.c
src/tests/fs/vfs: Makefile
Added Files:
src/tests/fs/vfs: t_renamerace.c
Removed Files:
src/tests/fs/ffs: t_renamerace.c

Log Message:
Convert "The Original" rename race test from to vfs and retire the
ffs/tmpfs versions.  The only difference is that the origamical
one mounted ffs with MNT_LOG (and therein actually lay the bug).


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/tests/fs/ffs/Makefile
cvs rdiff -u -r1.12 -r0 src/tests/fs/ffs/t_renamerace.c
cvs rdiff -u -r1.7 -r1.8 src/tests/fs/tmpfs/t_renamerace.c
cvs rdiff -u -r1.5 -r1.6 src/tests/fs/vfs/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/fs/vfs/t_renamerace.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/fs/ffs/Makefile
diff -u src/tests/fs/ffs/Makefile:1.8 src/tests/fs/ffs/Makefile:1.9
--- src/tests/fs/ffs/Makefile:1.8	Wed Jun 30 21:54:56 2010
+++ src/tests/fs/ffs/Makefile	Wed Jul 14 21:39:31 2010
@@ -1,10 +1,9 @@
-#	$NetBSD: Makefile,v 1.8 2010/06/30 21:54:56 njoly Exp $
+#	$NetBSD: Makefile,v 1.9 2010/07/14 21:39:31 pooka Exp $
 #
 
 TESTSDIR=	${TESTSBASE}/fs/ffs
 WARNS=		4
 
-TESTS_C=	t_renamerace
 TESTS_C+=	t_fifos
 TESTS_C+=	t_snapshot
 TESTS_C+=	t_mount

Index: src/tests/fs/tmpfs/t_renamerace.c
diff -u src/tests/fs/tmpfs/t_renamerace.c:1.7 src/tests/fs/tmpfs/t_renamerace.c:1.8
--- src/tests/fs/tmpfs/t_renamerace.c:1.7	Sun Jul  4 12:43:23 2010
+++ src/tests/fs/tmpfs/t_renamerace.c	Wed Jul 14 21:39:31 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_renamerace.c,v 1.7 2010/07/04 12:43:23 pooka Exp $	*/
+/*	$NetBSD: t_renamerace.c,v 1.8 2010/07/14 21:39:31 pooka Exp $	*/
 
 /*
  * Modified for rump and atf from a program supplied
@@ -25,56 +25,6 @@
 
 #include "../../h_macros.h"
 
-ATF_TC(renamerace);
-ATF_TC_HEAD(renamerace, tc)
-{
-	atf_tc_set_md_var(tc, "descr", "rename(2) race against files "
-	"unlinked mid-operation, kern/41128");
-}
-
-static void *
-w1(void *arg)
-{
-	int fd;
-
-	for (;;) {
-		fd = rump_sys_open("/rename.test1",
-		O_WRONLY|O_CREAT|O_TRUNC, 0666);
-		rump_sys_unlink("/rename.test1");
-		rump_sys_close(fd);
-	}
-	return NULL;
-}
-
-static void *
-w2(void *arg)
-{
-
-	for (;;) {
-		rump_sys_rename("/rename.test1", "/rename.test2");
-	}
-	return NULL;
-}
-
-ATF_TC_BODY(renamerace, tc)
-{
-	struct tmpfs_args args;
-	pthread_t pt1, pt2;
-
-	memset(&args, 0, sizeof(args));
-	args.ta_version = TMPFS_ARGS_VERSION;
-	args.ta_root_mode = 0777;
-
-	rump_init();
-	if (rump_sys_mount(MOUNT_TMPFS, "/", 0, &args, sizeof(args)) == -1)
-		atf_tc_fail_errno("could not mount tmpfs");
-
-	pthread_create(&pt1, NULL, w1, NULL);
-	pthread_create(&pt2, NULL, w2, NULL);
-
-	sleep(10);
-}
-
 ATF_TC(renamerace2);
 ATF_TC_HEAD(renamerace2, tc)
 {
@@ -169,7 +119,6 @@
 
 ATF_TP_ADD_TCS(tp)
 {
-	ATF_TP_ADD_TC(tp, renamerace);
 	ATF_TP_ADD_TC(tp, renamerace2);
 
 	return atf_no_error();

Index: src/tests/fs/vfs/Makefile
diff -u src/tests/fs/vfs/Makefile:1.5 src/tests/fs/vfs/Makefile:1.6
--- src/tests/fs/vfs/Makefile:1.5	Tue Jul 13 18:13:10 2010
+++ src/tests/fs/vfs/Makefile	Wed Jul 14 21:39:31 2010
@@ -1,10 +1,11 @@
-#	$NetBSD: Makefile,v 1.5 2010/07/13 18:13:10 pooka Exp $
+#	$NetBSD: Makefile,v 1.6 2010/07/14 21:39:31 pooka Exp $
 #
 
 TESTSDIR=	${TESTSBASE}/fs/vfs
 WARNS=		4
 
-TESTS_C=	t_rmdirrace
+TESTS_C+=	t_renamerace
+TESTS_C+=	t_rmdirrace
 TESTS_C+=	t_vfsops
 TESTS_C+=	t_vnops
 

Added files:

Index: src/tests/fs/vfs/t_renamerace.c
diff -u /dev/null src/tests/fs/vfs/t_renamerace.c:1.1
--- /dev/null	Wed Jul 14 21:39:31 2010
+++ src/tests/fs/vfs/t_renamerace.c	Wed Jul 14 21:39:31 2010
@@ -0,0 +1,90 @@
+/*	$NetBSD: t_renamerace.c,v 1.1 2010/07/14 21:39:31 pooka Exp $	*/
+
+/*
+ * Modified for rump and atf from a program supplied
+ * by Nicolas Joly in kern/40948
+ */
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include "../common/h_fsmacros.h"
+#include "../../h_macros.h"
+
+static volatile int quittingtime;
+
+static void *
+w1(void *arg)
+{
+	int fd;
+
+	rump_pub_lwp_alloc_and_switch(0, 10);
+	rump_sys_chdir(arg);
+
+	while (!quittingtime) {
+		fd = rump_sys_open("rename.test1",
+		O_WRONLY|O_CREAT|O_TRUNC, 0666);
+		if (fd == -1)
+			atf_tc_fail_errno("create");
+		rump_sys_unlink("rename.test1");
+		rump_sys_close(fd);
+	}
+
+	rump_sys_chdir("/");
+
+	return NULL;
+}
+
+static void *
+w2(void *arg)
+{
+
+	rump_pub_lwp_alloc_and_switch(0, 11);
+	rump_sys_chdir(arg);
+
+	while (!quittingtime) {
+		rump_sys_rename("rename.test1", "rename.test2");
+	}
+
+	rump_sys_chdir("/");
+
+	return NULL;
+}
+
+static void
+renamerace(const atf_tc_t *tc, const char *mp)
+{
+	pthread_t pt1, pt2;
+
+	pthread_create(&pt1, NULL, w1, __UNCONS

CVS commit: src/tests/fs/puffs/h_dtfs

2010-07-14 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Wed Jul 14 21:24:40 UTC 2010

Modified Files:
src/tests/fs/puffs/h_dtfs: dtfs_vnops.c

Log Message:
Check that nobody raced us into the source dir while it was unlocked
in preparation for rename.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/tests/fs/puffs/h_dtfs/dtfs_vnops.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/fs/puffs/h_dtfs/dtfs_vnops.c
diff -u src/tests/fs/puffs/h_dtfs/dtfs_vnops.c:1.5 src/tests/fs/puffs/h_dtfs/dtfs_vnops.c:1.6
--- src/tests/fs/puffs/h_dtfs/dtfs_vnops.c:1.5	Wed Jul 14 17:10:14 2010
+++ src/tests/fs/puffs/h_dtfs/dtfs_vnops.c	Wed Jul 14 21:24:40 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: dtfs_vnops.c,v 1.5 2010/07/14 17:10:14 pooka Exp $	*/
+/*	$NetBSD: dtfs_vnops.c,v 1.6 2010/07/14 21:24:40 pooka Exp $	*/
 
 /*
  * Copyright (c) 2006  Antti Kantee.  All Rights Reserved.
@@ -326,6 +326,11 @@
 	dfd_src = dtfs_dirgetbyname(DTFS_PTOF(pn_sdir),
 	pcn_src->pcn_name, pcn_src->pcn_namelen);
 
+	/* does it still exist, or did someone race us here? */
+	if (dfd_src == NULL) {
+		return ENOENT;
+	}
+
 	/* if there's a target file, nuke it for atomic replacement */
 	if (pn_tfile) {
 		if (pn_tfile->pn_va.va_type == VDIR) {



CVS commit: src/tests/fs/vfs

2010-07-14 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Wed Jul 14 20:45:49 UTC 2010

Modified Files:
src/tests/fs/vfs: t_vnops.c

Log Message:
Add an assortment of rename tests.  Not complete, but at least tests
something.

This contains the tests for PR kern/43616 and PR kern/43617.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/fs/vfs/t_vnops.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/fs/vfs/t_vnops.c
diff -u src/tests/fs/vfs/t_vnops.c:1.1 src/tests/fs/vfs/t_vnops.c:1.2
--- src/tests/fs/vfs/t_vnops.c:1.1	Tue Jul 13 18:13:10 2010
+++ src/tests/fs/vfs/t_vnops.c	Wed Jul 14 20:45:48 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_vnops.c,v 1.1 2010/07/13 18:13:10 pooka Exp $	*/
+/*	$NetBSD: t_vnops.c,v 1.2 2010/07/14 20:45:48 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -48,6 +48,14 @@
 #define USES_DIRS \
 if (FSTYPE_SYSVBFS(tc)) atf_tc_skip("dirs not supported by file system")
 
+static char *
+md(char *buf, const char *base, const char *tail)
+{
+
+	sprintf(buf, "%s/%s", base, tail);
+	return buf;
+}
+
 static void
 lookup_simple(const atf_tc_t *tc, const char *mountpath)
 {
@@ -139,10 +147,216 @@
 		atf_tc_fail_errno("remove directory");
 }
 
+static void
+checkfile(const char *path, struct stat *refp)
+{
+	char buf[MAXPATHLEN];
+	struct stat sb;
+	static int n = 1;
+
+	md(buf, path, "file");
+	if (rump_sys_stat(buf, &sb) == -1)
+		atf_tc_fail_errno("cannot stat file %d (%s)", n, buf);
+	if (memcmp(&sb, refp, sizeof(sb)) != 0)
+		atf_tc_fail("stat mismatch %d", n);
+	n++;
+}
+
+static void
+rename_dir(const atf_tc_t *tc, const char *mp)
+{
+	char pb1[MAXPATHLEN], pb2[MAXPATHLEN], pb3[MAXPATHLEN];
+	struct stat ref;
+
+	USES_DIRS;
+
+	md(pb1, mp, "dir1");
+	if (rump_sys_mkdir(pb1, 0777) == -1)
+		atf_tc_fail_errno("mkdir 1");
+
+	md(pb2, mp, "dir2");
+	if (rump_sys_mkdir(pb2, 0777) == -1)
+		atf_tc_fail_errno("mkdir 2");
+	md(pb2, mp, "dir2/subdir");
+	if (rump_sys_mkdir(pb2, 0777) == -1)
+		atf_tc_fail_errno("mkdir 3");
+
+	md(pb3, mp, "dir1/file");
+	if (rump_sys_mknod(pb3, S_IFREG | 0777, -1) == -1)
+		atf_tc_fail_errno("create file");
+	if (rump_sys_stat(pb3, &ref) == -1)
+		atf_tc_fail_errno("stat of file");
+
+	/*
+	 * First try ops which should succeed.
+	 */
+
+	/* rename within directory */
+	md(pb3, mp, "dir3");
+	if (rump_sys_rename(pb1, pb3) == -1)
+		atf_tc_fail_errno("rename 1");
+	checkfile(pb3, &ref);
+
+	/* rename directory onto itself (two ways, should fail) */
+	md(pb1, mp, "dir3/.");
+	if (rump_sys_rename(pb1, pb3) != -1 || errno != EINVAL)
+		atf_tc_fail_errno("rename 2");
+	if (rump_sys_rename(pb3, pb1) != -1 || errno != EISDIR)
+		atf_tc_fail_errno("rename 3");
+
+	checkfile(pb3, &ref);
+
+	/* rename father of directory into directory */
+	md(pb1, mp, "dir2/dir");
+	md(pb2, mp, "dir2");
+	if (rump_sys_rename(pb2, pb1) != -1 || errno != EINVAL)
+		atf_tc_fail_errno("rename 4");
+
+	/* same for grandfather */
+	md(pb1, mp, "dir2/subdir/dir2");
+	if (rump_sys_rename(pb2, pb1) != -1 || errno != EINVAL)
+		atf_tc_fail("rename 5");
+
+	checkfile(pb3, &ref);
+
+	/* rename directory over a non-empty directory */
+	if (rump_sys_rename(pb2, pb3) != -1 || errno != ENOTEMPTY)
+		atf_tc_fail("rename 6");
+
+	/* cross-directory rename */
+	md(pb1, mp, "dir3");
+	md(pb2, mp, "dir2/somedir");
+	if (rump_sys_rename(pb1, pb2) == -1)
+		atf_tc_fail_errno("rename 7");
+	checkfile(pb2, &ref);
+
+	/* move to parent directory */
+	md(pb1, mp, "dir2/somedir/../../dir3");
+	if (rump_sys_rename(pb2, pb1) == -1)
+		atf_tc_fail_errno("rename 8");
+	md(pb1, mp, "dir2/../dir3");
+	checkfile(pb1, &ref);
+
+	/* finally, atomic cross-directory rename */
+	md(pb3, mp, "dir2/subdir");
+	if (rump_sys_rename(pb1, pb3) == -1)
+		atf_tc_fail_errno("rename 9");
+	checkfile(pb3, &ref);
+}
+
+static void
+rename_dotdot(const atf_tc_t *tc, const char *mp)
+{
+
+	USES_DIRS;
+
+	if (rump_sys_chdir(mp) == -1)
+		atf_tc_fail_errno("chdir mountpoint");
+
+	if (rump_sys_mkdir("dir1", 0777) == -1)
+		atf_tc_fail_errno("mkdir 1");
+	if (rump_sys_mkdir("dir2", 0777) == -1)
+		atf_tc_fail_errno("mkdir 2");
+
+	/* msdosfs fails both at least currently */
+	if (FSTYPE_MSDOS(tc)) {
+		atf_tc_expect_fail("PR kern/43616");
+	}
+	if (rump_sys_rename("dir1", "dir1/..") != -1 || errno != EINVAL)
+		atf_tc_fail_errno("self-dotdot to");
+
+	if (rump_sys_rename("dir1/..", "sometarget") != -1 || errno != EINVAL)
+		atf_tc_fail_errno("self-dotdot from");
+	atf_tc_expect_pass();
+
+	if (FSTYPE_TMPFS(tc)) {
+		atf_tc_expect_fail("PR kern/43617");
+	}
+	if (rump_sys_rename("dir1", "dir2/..") != -1 || errno != EINVAL)
+		atf_tc_fail("other-dotdot");
+
+	rump_sys_chdir("/");
+}
+
+static void
+rename_reg_nodir(const atf_tc_t *tc, const char *mp)
+{
+	bool haslinks;
+	struct stat sb;
+	ino_t f1ino, f2ino;
+
+	if (rump_sys_chdir(mp) == -1)
+		atf_tc_fail_errno("chdir mountpoint");
+
+	if (FST

CVS commit: src/tests/fs/puffs/h_dtfs

2010-07-14 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Wed Jul 14 17:10:14 UTC 2010

Modified Files:
src/tests/fs/puffs/h_dtfs: dtfs_vnops.c

Log Message:
Return correct error values from a bunch of questionable renames.

There's no substitute for single-stepping do_sys_rename() into ffs
when trying to figure out what error should come from what layer...
well, at least apart from TNT.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/fs/puffs/h_dtfs/dtfs_vnops.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/fs/puffs/h_dtfs/dtfs_vnops.c
diff -u src/tests/fs/puffs/h_dtfs/dtfs_vnops.c:1.4 src/tests/fs/puffs/h_dtfs/dtfs_vnops.c:1.5
--- src/tests/fs/puffs/h_dtfs/dtfs_vnops.c:1.4	Wed Jul 14 16:59:35 2010
+++ src/tests/fs/puffs/h_dtfs/dtfs_vnops.c	Wed Jul 14 17:10:14 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: dtfs_vnops.c,v 1.4 2010/07/14 16:59:35 pooka Exp $	*/
+/*	$NetBSD: dtfs_vnops.c,v 1.5 2010/07/14 17:10:14 pooka Exp $	*/
 
 /*
  * Copyright (c) 2006  Antti Kantee.  All Rights Reserved.
@@ -314,6 +314,13 @@
 	if (pn_sfile->pn_va.va_type == VDIR) {
 		if (dtfs_isunder(pn_tdir, pn_sfile))
 			return EINVAL;
+
+		if ((pcn_src->pcn_namelen == 1 && pcn_src->pcn_name[0]=='.') ||
+		opc == src ||
+		PCNISDOTDOT(pcn_src) ||
+		PCNISDOTDOT(pcn_targ)) {
+			return EINVAL;
+		}
 	}
 
 	dfd_src = dtfs_dirgetbyname(DTFS_PTOF(pn_sdir),



CVS commit: src/tests/fs/puffs/h_dtfs

2010-07-14 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Wed Jul 14 16:59:35 UTC 2010

Modified Files:
src/tests/fs/puffs/h_dtfs: dtfs_vnops.c

Log Message:
* remove target node from right directory
* remove what i guess to be a useless if-clause (although with
  file systems you can never be sure)


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/fs/puffs/h_dtfs/dtfs_vnops.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/fs/puffs/h_dtfs/dtfs_vnops.c
diff -u src/tests/fs/puffs/h_dtfs/dtfs_vnops.c:1.3 src/tests/fs/puffs/h_dtfs/dtfs_vnops.c:1.4
--- src/tests/fs/puffs/h_dtfs/dtfs_vnops.c:1.3	Wed Jul 14 14:22:15 2010
+++ src/tests/fs/puffs/h_dtfs/dtfs_vnops.c	Wed Jul 14 16:59:35 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: dtfs_vnops.c,v 1.3 2010/07/14 14:22:15 pooka Exp $	*/
+/*	$NetBSD: dtfs_vnops.c,v 1.4 2010/07/14 16:59:35 pooka Exp $	*/
 
 /*
  * Copyright (c) 2006  Antti Kantee.  All Rights Reserved.
@@ -319,10 +319,6 @@
 	dfd_src = dtfs_dirgetbyname(DTFS_PTOF(pn_sdir),
 	pcn_src->pcn_name, pcn_src->pcn_namelen);
 
-	/* asked for "." or ".." XXX: make sure? */
-	if (!dfd_src)
-		return EINVAL;
-
 	/* if there's a target file, nuke it for atomic replacement */
 	if (pn_tfile) {
 		if (pn_tfile->pn_va.va_type == VDIR) {
@@ -330,7 +326,7 @@
 			if (!LIST_EMPTY(&df_targ->df_dirents))
 return ENOTEMPTY;
 		}
-		dtfs_nukenode(pn_tfile, pn_sdir,
+		dtfs_nukenode(pn_tfile, pn_tdir,
 		pcn_targ->pcn_name, pcn_targ->pcn_namelen);
 	}
 



CVS commit: src/sys/fs/tmpfs

2010-07-14 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Wed Jul 14 16:03:49 UTC 2010

Modified Files:
src/sys/fs/tmpfs: tmpfs_vnops.c

Log Message:
return same errno as ffs


To generate a diff of this commit:
cvs rdiff -u -r1.72 -r1.73 src/sys/fs/tmpfs/tmpfs_vnops.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/fs/tmpfs/tmpfs_vnops.c
diff -u src/sys/fs/tmpfs/tmpfs_vnops.c:1.72 src/sys/fs/tmpfs/tmpfs_vnops.c:1.73
--- src/sys/fs/tmpfs/tmpfs_vnops.c:1.72	Fri Jul  2 03:29:47 2010
+++ src/sys/fs/tmpfs/tmpfs_vnops.c	Wed Jul 14 16:03:49 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: tmpfs_vnops.c,v 1.72 2010/07/02 03:29:47 rmind Exp $	*/
+/*	$NetBSD: tmpfs_vnops.c,v 1.73 2010/07/14 16:03:49 pooka Exp $	*/
 
 /*
  * Copyright (c) 2005, 2006, 2007 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tmpfs_vnops.c,v 1.72 2010/07/02 03:29:47 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tmpfs_vnops.c,v 1.73 2010/07/14 16:03:49 pooka Exp $");
 
 #include 
 #include 
@@ -179,6 +179,11 @@
 		goto done;
 
 	} else if (cnp->cn_namelen == 1 && cnp->cn_nameptr[0] == '.') {
+		if ((cnp->cn_flags & ISLASTCN) &&
+		(cnp->cn_nameiop == RENAME)) {
+			error = EISDIR;
+			goto out;
+		}
 		vref(dvp);
 		*vpp = dvp;
 		error = 0;



CVS commit: src/sys/arch/i386/i386

2010-07-14 Thread Jean-Yves Migeon
Module Name:src
Committed By:   jym
Date:   Wed Jul 14 14:42:40 UTC 2010

Modified Files:
src/sys/arch/i386/i386: machdep.c

Log Message:
Fix typo in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.687 -r1.688 src/sys/arch/i386/i386/machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/i386/i386/machdep.c
diff -u src/sys/arch/i386/i386/machdep.c:1.687 src/sys/arch/i386/i386/machdep.c:1.688
--- src/sys/arch/i386/i386/machdep.c:1.687	Tue May  4 23:27:13 2010
+++ src/sys/arch/i386/i386/machdep.c	Wed Jul 14 14:42:40 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.687 2010/05/04 23:27:13 jym Exp $	*/
+/*	$NetBSD: machdep.c,v 1.688 2010/07/14 14:42:40 jym Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2000, 2004, 2006, 2008, 2009
@@ -67,7 +67,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.687 2010/05/04 23:27:13 jym Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.688 2010/07/14 14:42:40 jym Exp $");
 
 #include "opt_beep.h"
 #include "opt_compat_ibcs2.h"
@@ -1346,7 +1346,7 @@
 #endif
 
 	/*
-	 * Initailize PAGE_SIZE-dependent variables.
+	 * Initialize PAGE_SIZE-dependent variables.
 	 */
 	uvm_setpagesize();
 



CVS commit: src/tests/fs/puffs/h_dtfs

2010-07-14 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Wed Jul 14 14:22:16 UTC 2010

Modified Files:
src/tests/fs/puffs/h_dtfs: dtfs_vnops.c

Log Message:
check we don't rename onto a non-empty directory


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/fs/puffs/h_dtfs/dtfs_vnops.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/fs/puffs/h_dtfs/dtfs_vnops.c
diff -u src/tests/fs/puffs/h_dtfs/dtfs_vnops.c:1.2 src/tests/fs/puffs/h_dtfs/dtfs_vnops.c:1.3
--- src/tests/fs/puffs/h_dtfs/dtfs_vnops.c:1.2	Wed Jul 14 13:09:52 2010
+++ src/tests/fs/puffs/h_dtfs/dtfs_vnops.c	Wed Jul 14 14:22:15 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: dtfs_vnops.c,v 1.2 2010/07/14 13:09:52 pooka Exp $	*/
+/*	$NetBSD: dtfs_vnops.c,v 1.3 2010/07/14 14:22:15 pooka Exp $	*/
 
 /*
  * Copyright (c) 2006  Antti Kantee.  All Rights Reserved.
@@ -304,6 +304,7 @@
 	const struct puffs_cn *pcn_targ)
 {
 	struct dtfs_dirent *dfd_src;
+	struct dtfs_file *df_targ;
 	struct puffs_node *pn_sdir = opc;
 	struct puffs_node *pn_sfile = src;
 	struct puffs_node *pn_tdir = targ_dir;
@@ -325,7 +326,9 @@
 	/* if there's a target file, nuke it for atomic replacement */
 	if (pn_tfile) {
 		if (pn_tfile->pn_va.va_type == VDIR) {
-			assert(/*CONSTCOND*/0); /* XXX FIXME */
+			df_targ = DTFS_CTOF(pn_tfile);
+			if (!LIST_EMPTY(&df_targ->df_dirents))
+return ENOTEMPTY;
 		}
 		dtfs_nukenode(pn_tfile, pn_sdir,
 		pcn_targ->pcn_name, pcn_targ->pcn_namelen);



CVS commit: src/sys/fs/puffs

2010-07-14 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Wed Jul 14 14:07:37 UTC 2010

Modified Files:
src/sys/fs/puffs: puffs_vnops.c

Log Message:
RENAME lookup semantics say return EISDIR if dvp = *vpp for the
last component  obviously(!!)


To generate a diff of this commit:
cvs rdiff -u -r1.146 -r1.147 src/sys/fs/puffs/puffs_vnops.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/fs/puffs/puffs_vnops.c
diff -u src/sys/fs/puffs/puffs_vnops.c:1.146 src/sys/fs/puffs/puffs_vnops.c:1.147
--- src/sys/fs/puffs/puffs_vnops.c:1.146	Thu Jun 24 13:03:10 2010
+++ src/sys/fs/puffs/puffs_vnops.c	Wed Jul 14 14:07:37 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: puffs_vnops.c,v 1.146 2010/06/24 13:03:10 hannken Exp $	*/
+/*	$NetBSD: puffs_vnops.c,v 1.147 2010/07/14 14:07:37 pooka Exp $	*/
 
 /*
  * Copyright (c) 2005, 2006, 2007  Antti Kantee.  All Rights Reserved.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: puffs_vnops.c,v 1.146 2010/06/24 13:03:10 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: puffs_vnops.c,v 1.147 2010/07/14 14:07:37 pooka Exp $");
 
 #include 
 #include 
@@ -500,6 +500,10 @@
 	}
 
 	if (isdot) {
+		/* deal with rename lookup semantics */
+		if (cnp->cn_nameiop == RENAME && (cnp->cn_flags & ISLASTCN))
+			return EISDIR;
+
 		vp = ap->a_dvp;
 		vref(vp);
 		*ap->a_vpp = vp;



CVS commit: src/tests/fs/puffs/h_dtfs

2010-07-14 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Wed Jul 14 13:09:52 UTC 2010

Modified Files:
src/tests/fs/puffs/h_dtfs: dtfs.h dtfs_subr.c dtfs_vnops.c

Log Message:
prevent rename of source directory under itself


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/fs/puffs/h_dtfs/dtfs.h \
src/tests/fs/puffs/h_dtfs/dtfs_subr.c \
src/tests/fs/puffs/h_dtfs/dtfs_vnops.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/fs/puffs/h_dtfs/dtfs.h
diff -u src/tests/fs/puffs/h_dtfs/dtfs.h:1.1 src/tests/fs/puffs/h_dtfs/dtfs.h:1.2
--- src/tests/fs/puffs/h_dtfs/dtfs.h:1.1	Tue Jul  6 14:16:44 2010
+++ src/tests/fs/puffs/h_dtfs/dtfs.h	Wed Jul 14 13:09:52 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: dtfs.h,v 1.1 2010/07/06 14:16:44 pooka Exp $	*/
+/*	$NetBSD: dtfs.h,v 1.2 2010/07/14 13:09:52 pooka Exp $	*/
 
 /*
  * Copyright (c) 2006  Antti Kantee.  All Rights Reserved.
@@ -118,6 +118,8 @@
 void	dtfs_baseattrs(struct vattr *, enum vtype, ino_t);
 void	dtfs_updatetimes(struct puffs_node *, int, int, int);
 
+bool	dtfs_isunder(struct puffs_node *, struct puffs_node *);
+
 
 #define DTFS_CTOF(a) ((struct dtfs_file *)(((struct puffs_node *)a)->pn_data))
 #define DTFS_PTOF(a) ((struct dtfs_file *)(a->pn_data))
Index: src/tests/fs/puffs/h_dtfs/dtfs_subr.c
diff -u src/tests/fs/puffs/h_dtfs/dtfs_subr.c:1.1 src/tests/fs/puffs/h_dtfs/dtfs_subr.c:1.2
--- src/tests/fs/puffs/h_dtfs/dtfs_subr.c:1.1	Tue Jul  6 14:16:44 2010
+++ src/tests/fs/puffs/h_dtfs/dtfs_subr.c	Wed Jul 14 13:09:52 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: dtfs_subr.c,v 1.1 2010/07/06 14:16:44 pooka Exp $	*/
+/*	$NetBSD: dtfs_subr.c,v 1.2 2010/07/14 13:09:52 pooka Exp $	*/
 
 /*
  * Copyright (c) 2006  Antti Kantee.  All Rights Reserved.
@@ -338,3 +338,18 @@
 	if (domtime)
 		pn->pn_va.va_mtime = ts;
 }
+
+bool
+dtfs_isunder(struct puffs_node *pn, struct puffs_node *pn_parent)
+{
+	struct dtfs_file *df;
+
+	while (pn) {
+		if (pn == pn_parent)
+			return true;
+		df = DTFS_CTOF(pn);
+		pn = df->df_dotdot;
+	}
+
+	return false;
+}
Index: src/tests/fs/puffs/h_dtfs/dtfs_vnops.c
diff -u src/tests/fs/puffs/h_dtfs/dtfs_vnops.c:1.1 src/tests/fs/puffs/h_dtfs/dtfs_vnops.c:1.2
--- src/tests/fs/puffs/h_dtfs/dtfs_vnops.c:1.1	Tue Jul  6 14:16:44 2010
+++ src/tests/fs/puffs/h_dtfs/dtfs_vnops.c	Wed Jul 14 13:09:52 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: dtfs_vnops.c,v 1.1 2010/07/06 14:16:44 pooka Exp $	*/
+/*	$NetBSD: dtfs_vnops.c,v 1.2 2010/07/14 13:09:52 pooka Exp $	*/
 
 /*
  * Copyright (c) 2006  Antti Kantee.  All Rights Reserved.
@@ -305,9 +305,16 @@
 {
 	struct dtfs_dirent *dfd_src;
 	struct puffs_node *pn_sdir = opc;
+	struct puffs_node *pn_sfile = src;
 	struct puffs_node *pn_tdir = targ_dir;
 	struct puffs_node *pn_tfile = targ;
 
+	/* check that we don't do the old amigados trick */
+	if (pn_sfile->pn_va.va_type == VDIR) {
+		if (dtfs_isunder(pn_tdir, pn_sfile))
+			return EINVAL;
+	}
+
 	dfd_src = dtfs_dirgetbyname(DTFS_PTOF(pn_sdir),
 	pcn_src->pcn_name, pcn_src->pcn_namelen);
 



CVS commit: src/sys/dev/pci

2010-07-14 Thread John Nemeth
Module Name:src
Committed By:   jnemeth
Date:   Wed Jul 14 09:52:39 UTC 2010

Modified Files:
src/sys/dev/pci: if_cas.c

Log Message:
When searching PROM data to get a MAC address, search for National
Semiconductor Saturn data as well as Sun Cassini data.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/pci/if_cas.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/if_cas.c
diff -u src/sys/dev/pci/if_cas.c:1.10 src/sys/dev/pci/if_cas.c:1.11
--- src/sys/dev/pci/if_cas.c:1.10	Wed Jul 14 04:50:28 2010
+++ src/sys/dev/pci/if_cas.c	Wed Jul 14 09:52:39 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_cas.c,v 1.10 2010/07/14 04:50:28 jnemeth Exp $	*/
+/*	$NetBSD: if_cas.c,v 1.11 2010/07/14 09:52:39 jnemeth Exp $	*/
 /*	$OpenBSD: if_cas.c,v 1.29 2009/11/29 16:19:38 kettenis Exp $	*/
 
 /*
@@ -44,7 +44,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_cas.c,v 1.10 2010/07/14 04:50:28 jnemeth Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_cas.c,v 1.11 2010/07/14 09:52:39 jnemeth Exp $");
 
 #include "opt_inet.h"
 
@@ -187,6 +187,11 @@
 	PCI_VENDOR_SUN & 0xff, PCI_VENDOR_SUN >> 8,
 	PCI_PRODUCT_SUN_CASSINI & 0xff, PCI_PRODUCT_SUN_CASSINI >> 8
 };
+static const u_int8_t cas_promdat_ns[] = {
+	'P', 'C', 'I', 'R',
+	PCI_VENDOR_NS & 0xff, PCI_VENDOR_NS >> 8,
+	PCI_PRODUCT_NS_SATURN & 0xff, PCI_PRODUCT_NS_SATURN >> 8
+};
 
 static const u_int8_t cas_promdat2[] = {
 	0x18, 0x00,			/* structure length */
@@ -227,7 +232,8 @@
 		goto fail;
 
 	bus_space_read_region_1(romt, romh, dataoff, buf, sizeof(buf));
-	if (bcmp(buf, cas_promdat, sizeof(cas_promdat)) ||
+	if ((bcmp(buf, cas_promdat, sizeof(cas_promdat)) &&
+	 bcmp(buf, cas_promdat_ns, sizeof(cas_promdat_ns))) ||
 	bcmp(buf + PROMDATA_DATA2, cas_promdat2, sizeof(cas_promdat2)))
 		goto fail;