Module Name: src
Committed By: jmmv
Date: Fri Jun 4 08:32:15 UTC 2010
Modified Files:
src/external/bsd/atf/dist/atf-c: dynstr.c fs.c tc.c
src/external/bsd/atf/dist/atf-version: atf-version.cpp
Removed Files:
src/external/bsd/atf/dist/atf-c: object.c object.h
src/external/bsd/atf/dist/atf-compile: atf-compile.1 atf-compile.cpp
atf-host-compile.sh
src/external/bsd/atf/dist/atf-run: atf-run.hooks
src/external/bsd/atf/dist/atf-sh: atf.footer.subr atf.header.subr
atf.init.subr
src/external/bsd/atf/dist/data: atf-c++.pc.in atf-c.pc.in atf-run.hooks
tests-results.css tests-results.dtd tests-results.xsl
src/external/bsd/atf/dist/doc: roadmap.xml
src/external/bsd/atf/dist/doc/standalone: roadmap.html
src/external/bsd/atf/dist/doc/text: roadmap.txt
src/external/bsd/atf/dist/tests/atf/atf-c: d_include_object_h.c
src/external/bsd/atf/dist/tests/atf/atf-compile: Atffile h_mode.cpp
t_integration.sh
src/external/bsd/atf/dist/tests/atf/data: Atffile t_pkg_config.sh
Log Message:
Fix import conflicts for atf 0.9.
To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/atf/dist/atf-c/dynstr.c \
src/external/bsd/atf/dist/atf-c/fs.c
cvs rdiff -u -r1.1.1.2 -r0 src/external/bsd/atf/dist/atf-c/object.c \
src/external/bsd/atf/dist/atf-c/object.h
cvs rdiff -u -r1.4 -r1.5 src/external/bsd/atf/dist/atf-c/tc.c
cvs rdiff -u -r1.1.1.1 -r0 \
src/external/bsd/atf/dist/atf-compile/atf-compile.1 \
src/external/bsd/atf/dist/atf-compile/atf-compile.cpp \
src/external/bsd/atf/dist/atf-compile/atf-host-compile.sh
cvs rdiff -u -r1.1.1.1 -r0 src/external/bsd/atf/dist/atf-run/atf-run.hooks
cvs rdiff -u -r1.2 -r0 src/external/bsd/atf/dist/atf-sh/atf.footer.subr
cvs rdiff -u -r1.1.1.1 -r0 src/external/bsd/atf/dist/atf-sh/atf.header.subr \
src/external/bsd/atf/dist/atf-sh/atf.init.subr
cvs rdiff -u -r1.2 -r1.3 \
src/external/bsd/atf/dist/atf-version/atf-version.cpp
cvs rdiff -u -r1.1.1.1 -r0 src/external/bsd/atf/dist/data/atf-c++.pc.in \
src/external/bsd/atf/dist/data/atf-c.pc.in \
src/external/bsd/atf/dist/data/atf-run.hooks \
src/external/bsd/atf/dist/data/tests-results.css \
src/external/bsd/atf/dist/data/tests-results.dtd \
src/external/bsd/atf/dist/data/tests-results.xsl
cvs rdiff -u -r1.1.1.2 -r0 src/external/bsd/atf/dist/doc/roadmap.xml
cvs rdiff -u -r1.1.1.2 -r0 \
src/external/bsd/atf/dist/doc/standalone/roadmap.html
cvs rdiff -u -r1.1.1.2 -r0 src/external/bsd/atf/dist/doc/text/roadmap.txt
cvs rdiff -u -r1.1.1.1 -r0 \
src/external/bsd/atf/dist/tests/atf/atf-c/d_include_object_h.c
cvs rdiff -u -r1.1.1.1 -r0 \
src/external/bsd/atf/dist/tests/atf/atf-compile/Atffile \
src/external/bsd/atf/dist/tests/atf/atf-compile/h_mode.cpp \
src/external/bsd/atf/dist/tests/atf/atf-compile/t_integration.sh
cvs rdiff -u -r1.1.1.1 -r0 src/external/bsd/atf/dist/tests/atf/data/Atffile
cvs rdiff -u -r1.1.1.2 -r0 \
src/external/bsd/atf/dist/tests/atf/data/t_pkg_config.sh
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/atf/dist/atf-c/dynstr.c
diff -u src/external/bsd/atf/dist/atf-c/dynstr.c:1.3 src/external/bsd/atf/dist/atf-c/dynstr.c:1.4
--- src/external/bsd/atf/dist/atf-c/dynstr.c:1.3 Tue Dec 22 13:36:56 2009
+++ src/external/bsd/atf/dist/atf-c/dynstr.c Fri Jun 4 08:32:14 2010
@@ -1,7 +1,7 @@
/*
* Automated Testing Framework (atf)
*
- * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
+ * Copyright (c) 2008, 2009, 2010 The NetBSD Foundation, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -29,6 +29,7 @@
#include <errno.h>
#include <stdarg.h>
+#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -121,22 +122,17 @@
{
atf_error_t err;
- atf_object_init(&ad->m_object);
-
ad->m_data = (char *)malloc(sizeof(char));
if (ad->m_data == NULL) {
err = atf_no_memory_error();
- goto err_object;
+ goto out;
}
ad->m_data[0] = '\0';
ad->m_datasize = 1;
ad->m_length = 0;
err = atf_no_error();
- goto out;
-err_object:
- atf_object_fini(&ad->m_object);
out:
return err;
}
@@ -146,8 +142,6 @@
{
atf_error_t err;
- atf_object_init(&ad->m_object);
-
ad->m_datasize = strlen(fmt) + 1;
ad->m_length = 0;
@@ -159,7 +153,7 @@
ad->m_data = (char *)malloc(ad->m_datasize);
if (ad->m_data == NULL) {
err = atf_no_memory_error();
- goto err_object;
+ goto out;
}
va_copy(ap2, ap);
@@ -168,7 +162,7 @@
if (ret < 0) {
free(ad->m_data);
err = atf_libc_error(errno, "Cannot format string");
- goto err_object;
+ goto out;
}
INV(ret >= 0);
@@ -180,10 +174,6 @@
} while (ad->m_length >= ad->m_datasize);
err = atf_no_error();
- goto out;
-
-err_object:
- atf_object_fini(&ad->m_object);
out:
POST(atf_is_error(err) || ad->m_data != NULL);
return err;
@@ -207,17 +197,15 @@
{
atf_error_t err;
- atf_object_init(&ad->m_object);
-
if (memlen >= SIZE_MAX - 1) {
err = atf_no_memory_error();
- goto err_object;
+ goto out;
}
ad->m_data = (char *)malloc(memlen + 1);
if (ad->m_data == NULL) {
err = atf_no_memory_error();
- goto err_object;
+ goto out;
}
ad->m_datasize = memlen + 1;
@@ -226,10 +214,7 @@
ad->m_length = strlen(ad->m_data);
INV(ad->m_length <= memlen);
err = atf_no_error();
- goto out;
-err_object:
- atf_object_fini(&ad->m_object);
out:
return err;
}
@@ -239,28 +224,23 @@
{
atf_error_t err;
- atf_object_init(&ad->m_object);
-
if (len == SIZE_MAX) {
err = atf_no_memory_error();
- goto err_object;
+ goto out;
}
ad->m_datasize = (len + 1) * sizeof(char);
ad->m_data = (char *)malloc(ad->m_datasize);
if (ad->m_data == NULL) {
err = atf_no_memory_error();
- goto err_object;
+ goto out;
}
memset(ad->m_data, ch, len);
ad->m_data[len] = '\0';
ad->m_length = len;
err = atf_no_error();
- goto out;
-err_object:
- atf_object_fini(&ad->m_object);
out:
return err;
}
@@ -283,8 +263,6 @@
{
atf_error_t err;
- atf_object_copy(&dest->m_object, &src->m_object);
-
dest->m_data = (char *)malloc(src->m_datasize);
if (dest->m_data == NULL)
err = atf_no_memory_error();
@@ -303,15 +281,11 @@
{
INV(ad->m_data != NULL);
free(ad->m_data);
-
- atf_object_fini(&ad->m_object);
}
char *
atf_dynstr_fini_disown(atf_dynstr_t *ad)
{
- atf_object_fini(&ad->m_object);
-
INV(ad->m_data != NULL);
return ad->m_data;
}
Index: src/external/bsd/atf/dist/atf-c/fs.c
diff -u src/external/bsd/atf/dist/atf-c/fs.c:1.3 src/external/bsd/atf/dist/atf-c/fs.c:1.4
--- src/external/bsd/atf/dist/atf-c/fs.c:1.3 Tue Dec 22 13:36:56 2009
+++ src/external/bsd/atf/dist/atf-c/fs.c Fri Jun 4 08:32:14 2010
@@ -1,7 +1,7 @@
/*
* Automated Testing Framework (atf)
*
- * Copyright (c) 2007, 2008, 2009 The NetBSD Foundation, Inc.
+ * Copyright (c) 2007, 2008, 2009, 2010 The NetBSD Foundation, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -67,6 +67,7 @@
static atf_error_t normalize(atf_dynstr_t *, char *);
static atf_error_t normalize_ap(atf_dynstr_t *, const char *, va_list);
static void replace_contents(atf_fs_path_t *, const char *);
+static atf_error_t set_immutable(const char *, bool, bool *);
static const char *stat_type_to_string(const int);
/* ---------------------------------------------------------------------
@@ -231,8 +232,13 @@
atf_error_t err;
struct dirent *de;
- if (erase && !(atf_fs_stat_get_mode(st) & S_IWUSR)) {
- if (chmod(pstr, atf_fs_stat_get_mode(st) | S_IWUSR) == -1) {
+ if (erase && ((atf_fs_stat_get_mode(st) & S_IRWXU) != S_IRWXU)) {
+ bool unused_done;
+ err = set_immutable(pstr, false, &unused_done);
+ if (atf_is_error(err))
+ goto out;
+
+ if (chmod(pstr, atf_fs_stat_get_mode(st) | S_IRWXU) == -1) {
err = atf_libc_error(errno, "Cannot grant write permissions "
"to %s", pstr);
goto out;
@@ -465,6 +471,76 @@
}
static
+atf_error_t
+set_immutable(const char *filename, bool value, bool *done)
+{
+ atf_error_t err;
+
+#if HAVE_CHFLAGS
+ struct stat sb;
+
+ if (lstat(filename, &sb) == -1) {
+ err = atf_libc_error(errno, "lstat(%s) failed", filename);
+ goto out;
+ }
+
+ unsigned long new_flags = sb.st_flags;
+ if (value)
+ new_flags |= UF_IMMUTABLE;
+ else
+ new_flags &= ~UF_IMMUTABLE;
+
+ if (chflags(filename, new_flags) == -1) {
+ err = atf_libc_error(errno, "chflags(%s) failed", filename);
+ goto out;
+ }
+
+ err = atf_no_error();
+ *done = true;
+
+out:
+#elif HAVE_CHATTR
+ if (atf_user_is_root()) {
+ /* TODO: This should use ioctl(2) instead of chattr(1), but it looks
+ * like that the API to set the immutable value is file-system specific.
+ * Investigate this later. */
+ atf_fs_path_t prog;
+
+ err = atf_fs_path_init_fmt(&prog, CHATTR);
+ if (!atf_is_error(err)) {
+ atf_process_status_t status;
+ const char *argv[4] = { "chattr", value ? "+i" : "-i", filename,
+ NULL };
+
+ err = atf_process_exec_array(&status, &prog, argv, NULL, NULL);
+ if (!atf_is_error(err)) {
+ if (!atf_process_status_exited(&status) ||
+ atf_process_status_exitstatus(&status) != EXIT_SUCCESS) {
+ /* XXX: This is the wrong error type. */
+ err = atf_libc_error(EINVAL, "Failed to exec chattr");
+ }
+
+ atf_process_status_fini(&status);
+ }
+
+ atf_fs_path_fini(&prog);
+ }
+ *done = true;
+ } else {
+ /* Linux doesn't allow to set the immutability bit by non-root; just
+ * report it as an unsupported case. */
+ err = atf_no_error();
+ *done = false;
+ }
+#else
+ err = atf_no_error();
+ *done = false;
+#endif
+
+ return err;
+}
+
+static
const char *
stat_type_to_string(const int type)
{
@@ -508,8 +584,6 @@
atf_error_t err;
va_list ap2;
- atf_object_init(&p->m_object);
-
va_copy(ap2, ap);
err = normalize_ap(&p->m_data, fmt, ap2);
va_end(ap2);
@@ -533,8 +607,6 @@
atf_error_t
atf_fs_path_copy(atf_fs_path_t *dest, const atf_fs_path_t *src)
{
- atf_object_copy(&dest->m_object, &src->m_object);
-
return atf_dynstr_copy(&dest->m_data, &src->m_data);
}
@@ -542,8 +614,6 @@
atf_fs_path_fini(atf_fs_path_t *p)
{
atf_dynstr_fini(&p->m_data);
-
- atf_object_fini(&p->m_object);
}
/*
@@ -560,10 +630,8 @@
err = atf_fs_path_init_fmt(bp, ".");
else if (endpos == 0)
err = atf_fs_path_init_fmt(bp, "/");
- else {
- atf_object_init(&bp->m_object);
+ else
err = atf_dynstr_init_substr(&bp->m_data, &p->m_data, 0, endpos);
- }
#if defined(HAVE_CONST_DIRNAME)
INV(atf_equal_dynstr_cstring(&bp->m_data,
@@ -736,17 +804,12 @@
}
}
- if (!atf_is_error(err))
- atf_object_init(&st->m_object);
-
return err;
}
void
atf_fs_stat_copy(atf_fs_stat_t *dest, const atf_fs_stat_t *src)
{
- atf_object_copy(&dest->m_object, &src->m_object);
-
dest->m_type = src->m_type;
dest->m_sb = src->m_sb;
}
@@ -754,7 +817,6 @@
void
atf_fs_stat_fini(atf_fs_stat_t *st)
{
- atf_object_fini(&st->m_object);
}
/*
@@ -1057,6 +1119,12 @@
}
atf_error_t
+atf_fs_set_immutable(const atf_fs_path_t *p, bool value, bool *done)
+{
+ return set_immutable(atf_fs_path_cstring(p), value, done);
+}
+
+atf_error_t
atf_fs_unlink(const atf_fs_path_t *p)
{
atf_error_t err;
Index: src/external/bsd/atf/dist/atf-c/tc.c
diff -u src/external/bsd/atf/dist/atf-c/tc.c:1.4 src/external/bsd/atf/dist/atf-c/tc.c:1.5
--- src/external/bsd/atf/dist/atf-c/tc.c:1.4 Sat May 8 08:11:04 2010
+++ src/external/bsd/atf/dist/atf-c/tc.c Fri Jun 4 08:32:14 2010
@@ -82,8 +82,6 @@
{
atf_error_t err;
- atf_object_init(&tc->m_object);
-
tc->m_ident = ident;
tc->m_head = head;
tc->m_body = body;
@@ -92,14 +90,15 @@
err = atf_map_init(&tc->m_vars);
if (atf_is_error(err))
- goto err_object;
+ goto err;
err = atf_tc_set_md_var(tc, "ident", ident);
if (atf_is_error(err))
goto err_map;
/* XXX Should the head be able to return error codes? */
- tc->m_head(tc);
+ if (tc->m_head != NULL)
+ tc->m_head(tc);
if (strcmp(atf_tc_get_md_var(tc, "ident"), ident) != 0)
atf_tc_fail("Test case head modified the read-only 'ident' "
@@ -110,9 +109,7 @@
err_map:
atf_map_fini(&tc->m_vars);
-err_object:
- atf_object_fini(&tc->m_object);
-
+err:
return err;
}
@@ -128,8 +125,6 @@
atf_tc_fini(atf_tc_t *tc)
{
atf_map_fini(&tc->m_vars);
-
- atf_object_fini(&tc->m_object);
}
/*
@@ -251,8 +246,6 @@
atf_error_t
atf_tc_run(const atf_tc_t *tc, const atf_fs_path_t *resfile)
{
- atf_reset_exit_checks(); /* XXX */
-
current_tc = tc;
current_resfile = resfile;
current_tc_fail_count = 0;
@@ -457,8 +450,6 @@
{
va_list ap;
- atf_reset_exit_checks();
-
va_start(ap, fmt);
fail_internal(file, line, "Requirement failed", "", fmt, ap,
tc_fail, atf_tc_fail);
Index: src/external/bsd/atf/dist/atf-version/atf-version.cpp
diff -u src/external/bsd/atf/dist/atf-version/atf-version.cpp:1.2 src/external/bsd/atf/dist/atf-version/atf-version.cpp:1.3
--- src/external/bsd/atf/dist/atf-version/atf-version.cpp:1.2 Fri May 14 15:30:39 2010
+++ src/external/bsd/atf/dist/atf-version/atf-version.cpp Fri Jun 4 08:32:14 2010
@@ -30,7 +30,6 @@
#if defined(HAVE_CONFIG_H)
#include "bconfig.h"
#endif
-#include "revision.h"
#include <cstdlib>
#include <iostream>
@@ -38,6 +37,8 @@
#include "atf-c++/application.hpp"
#include "atf-c++/ui.hpp"
+#include "revision.h"
+
class atf_version : public atf::application::app {
static const char* m_description;