monotone-commits-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Monotone-commits-diffs] net.venge.monotone: 5e1057295bf12fa86849dc5aed4


From: code
Subject: [Monotone-commits-diffs] net.venge.monotone: 5e1057295bf12fa86849dc5aed4577e1788d367e
Date: Sat, 16 Mar 2013 10:58:31 +0100 (CET)

revision:            5e1057295bf12fa86849dc5aed4577e1788d367e
date:                2013-03-16T09:40:39
author:              address@hidden
branch:              net.venge.monotone
changelog:
explicit merge of '854a497f9efde46ff86f7343a769da6fb50d5385'
              and 'dfe4b51c8db852b7281a125aac6f3ddee34906f6'



manifest:
format_version "1"

new_manifest [7b2af3a1e5b46c3b57ce0cba2c6dceb81230a73a]

old_revision [854a497f9efde46ff86f7343a769da6fb50d5385]

add_dir "test/func/wanted_testresults"

add_file "test/func/wanted_testresults/__driver__.lua"
 content [670d2df947c1e878dc53530808a87b5a2647fe87]

patch "INSTALL_windows_native.txt"
 from [890ae02b8d52b803a093cfa38c267de4955f3943]
   to [83756282255c6dc573e2936fc65dff22c0836afd]

patch "NEWS"
 from [54723cd3a325f76fc39e733ff3ff4372860afb5c]
   to [777c52083e117f5e3010e0f95f3a6b199e2d39f4]

patch "doc/monotone.texi"
 from [430c4f42443f49cfea8ed42f7cf46a7973fb8997]
   to [08e1d3c65f796492d95f5d83efbf58861d5a8ce7]

patch "src/cmd_list.cc"
 from [2fd51c7a2d8edd949a7e262085988ad3124dc135]
   to [a0103f85cfb0c0e36fe33f3bad41e321cf1d5dcc]

patch "src/database.cc"
 from [87efeeff2d3263ba98af684a4022f1897434ed2d]
   to [39ab2644b936e09a536b99ebd28b93f6e0d7c162]

patch "src/key_store.cc"
 from [b7859345f7c665914d16357409bdff24a48b7996]
   to [1ca13b7ee527bc2872d9fc325cf5ef327ca053c2]

patch "src/netxx/serverbase.cxx"
 from [156f2090341d2a36bdb718e7c69df58f9251983e]
   to [efaec5b590ba58147d17d7d17adf9a41b9d305d2]

patch "src/ssh_agent.cc"
 from [4a0dcab873559e934e41c5f220b5434d35600d9b]
   to [6313ee3cdfca4112ba3957dc4a5f318472289dfa]

patch "src/std_hooks.lua"
 from [5b089162751bf675605aa10655c77dcd7af99b93]
   to [7e694c8f47f34cc2491f078ce6cd514fa349755b]

patch "src/unix/fs.cc"
 from [f51cae4dbc5589b0add4f7b9b649fde3c83d1220]
   to [686805003c24f02e8631c517399f29250b34fb65]

patch "test/extra/mail-notify/scripts/run-mail-notify"
 from [b90ab9abd71ff563f2492839cff878b947092bd6]
   to [4ac0215e561a21c86ce1e1743cf7598023107b1c]

patch "test/func/netsync_badhost_gives_nice_error/__driver__.lua"
 from [840813871ca60bde7d4c8829591932de494219f8]
   to [c6e63fc8f098d7f4aed860f8ff9614e2b347899f]

patch "test/func/netsync_hook_errcodes/__driver__.lua"
 from [ec71c8c29e3fa49ae6bb99053318c2cadf770aed]
   to [bb45536419fd9a4445f22e02140dbc88826a9c80]

old_revision [dfe4b51c8db852b7281a125aac6f3ddee34906f6]

patch "doc/monotone.texi"
 from [54602b03c6fbd96c3eacf8ec43e25202d4e12889]
   to [08e1d3c65f796492d95f5d83efbf58861d5a8ce7]
============================================================
--- INSTALL_windows_native.txt	890ae02b8d52b803a093cfa38c267de4955f3943
+++ INSTALL_windows_native.txt	83756282255c6dc573e2936fc65dff22c0836afd
@@ -38,8 +38,11 @@
                         | _not_ the "windows binary installer"
 sqlite3       | 3.7.11  | http://www.sqlite.org/download.html
                         | -> sqlite-autoconf-3071100.tar.gz
+libiconv      | 1.14    | ftp://ftp.gnu.org/gnu/libiconv/
+                        | -> libiconv-1.14.tar.gz
 libidn        | 1.24    | ftp://ftp.gnu.org/gnu/libidn/
                         | -> libidn-1.24.tar.gz
+http://ftp.gnu.org/pub/gnu/libiconv/
 Depends.exe   |         | http://www.dependencywalker.com/ ; also comes with Visual Studio
 
 In general, there are two versions of most tools on the
@@ -143,14 +146,22 @@
    $ ./configure --prefix=/mingw
    $ make install
 
-08. libidn
+08. libiconv
+
    $ cd /usr/src
+   $ tar -zxf ../libiconv-1.14.tar.gz
+   $ cd libiconv-1.14
+   $ ./configure --prefix=/mingw
+   $ make install
+
+09. libidn
+   $ cd /usr/src
    $ tar -zxf ../libidn-1.24.tar.gz
    $ cd libidn-1.24
    $ ./configure --prefix=/mingw
    $ make install
 
-09. Depends.exe
+10. Depends.exe
    If you have Visual Studio installed, you should be able to skip this.
    If you don't, then download the appropriate depends*.zip and
    unpack it someplace in your %PATH% (for example, C:\MinGW\bin\).
@@ -158,14 +169,14 @@
    If you just want to build monotone for your own use, you can skip this and
    just ignore that test failing.
 
-10. build monotone
+11. build monotone
    You can skip the CXXFLAGS and LDFLAGS if you really want to, but if you do that
    then libgcc_s and libstdc++-6 will be linked dynamically and the resulting
    monotone binary will take several extra seconds to start.
    $ cd /c/.../monotone
    $ autoreconf -i # not needed if you use the distributed tarball
-   $ export CXXFLAGS="-static-libgcc -static-libstdc++ -g -O2 -Wall"
-   $ export LDFLAGS="-static-libgcc -static-libstdc++"
+   $ export CXXFLAGS="-static-libgcc -static-libstdc++ -I/mingw/include -g -O2 -Wall"
+   $ export LDFLAGS="-static-libgcc -static-libstdc++ -L/mingw/lib"
    $ export botan_CFLAGS="-I/mingw/include/botan-1.10"
    $ export botan_LIBS="-lbotan-1.10"
    $ ./configure
============================================================
--- NEWS	54723cd3a325f76fc39e733ff3ff4372860afb5c
+++ NEWS	777c52083e117f5e3010e0f95f3a6b199e2d39f4
@@ -4,6 +4,9 @@ XXX XXX XX XX:XX:XX UTC 201X
 
         Changes
 
+        - '_MTN/wanted-testresults' must now have 1 hex-encoded
+          signing key hash in lowercase per line.
+
         New features
 
         - 'automate atttributes' now also works without a workspace
============================================================
--- doc/monotone.texi	430c4f42443f49cfea8ed42f7cf46a7973fb8997
+++ doc/monotone.texi	08e1d3c65f796492d95f5d83efbf58861d5a8ce7
@@ -11976,7 +11976,9 @@ @subsection Netsync Permission Hooks
 
 
 If a client connects anonymously, this hook will be called with a
address@hidden of @code{nil}.
address@hidden of @code{nil}. An empty string value must be used
+in @file{read-permissions} to represent clients connecting anonymously. e.g.
address@hidden ""}.
 
 @address@hidden get_netsync_write_permitted (@var{key_identity})
 
@@ -12234,18 +12236,20 @@ @subsection Trust Evaluation Hooks
 This hook is used by the update algorithm to determine whether a
 change in test results between update source and update target is
 acceptable. The hook is called with two tables, each of which maps a
-signing key -- representing a particular testsuite -- to a boolean
-value indicating whether or not the test run was successful. The
+signing key hash (as 20 raw bytes) -- representing a particular testsuite -- to a boolean
+value indicating whether or not the test run was successful (calculated
+from the @code{testresult} cert). The
 function should return @code{true} if you consider an update from the
 version carrying the @var{old_results} to the version carrying the
 @var{new_results} to be acceptable.
 
 The default definition of this hook returns @code{true} if
 @file{_MTN/wanted-testresults} does not exist. Otherwise, the file
-should contain a list of signing key ids. The hook returns @code{false}
-if a listed signing key id is present in both @var{old_results} and
address@hidden, and @var{old_results} is @code{true} but
address@hidden is @code{false}; otherwise it returns @code{true}.
+should contain a list of signing key hex-encoded hashes in lowercase (40 characters).
+The hook returns @code{false}
+if a listed signing key hash is present in both @var{old_results} and
address@hidden, with the value @code{true} in @var{old_results}
+and @code{false} in @var{new_results}; otherwise it returns @code{true}.
 
 @end ftable
 
============================================================
--- src/cmd_list.cc	2fd51c7a2d8edd949a7e262085988ad3124dc135
+++ src/cmd_list.cc	a0103f85cfb0c0e36fe33f3bad41e321cf1d5dcc
@@ -23,7 +23,6 @@
 #include "cmd.hh"
 #include "roster.hh"
 #include "database.hh"
-#include "date_format.hh"
 #include "globish.hh"
 #include "keys.hh"
 #include "key_store.hh"
@@ -114,8 +113,6 @@ CMD(certs, "certs", "", CMD_REF(list), "
 
   transaction_guard guard(db, false);
 
-  string date_fmt = get_date_format(app.opts, app.lua, date_time_long);
-
   revision_id ident;
   complete(app.opts, app.lua,  project, idx(args, 0)(), ident);
   vector<cert> ts;
@@ -187,11 +184,6 @@ CMD(certs, "certs", "", CMD_REF(list), "
       split_into_lines(washed, lines);
       std::string value_first_line = lines.empty() ? "" : idx(lines, 0);
 
-      if (idx(certs, i).name == date_cert_name)
-        {
-          value_first_line = date_t(value_first_line).as_formatted_localtime(date_fmt);
-        }
-
       key_identity_info identity;
       identity.id = idx(certs, i).key;
       project.complete_key_identity_from_id(keys, app.lua, identity);
@@ -1076,7 +1068,6 @@ CMD_AUTOMATE(certs, N_("REV"),
   sort(certs.begin(), certs.end());
 
   basic_io::printer pr;
-  string date_fmt = get_date_format(app.opts, app.lua, date_time_long);
 
   for (size_t i = 0; i < certs.size(); ++i)
     {
@@ -1114,14 +1105,8 @@ CMD_AUTOMATE(certs, N_("REV"),
         }
       st.push_str_pair(syms::signature, stat);
 
-      string value = tv();
-      if (name == date_cert_name)
-        {
-          value = date_t(tv()).as_formatted_localtime(date_fmt);
-        }
-      
       st.push_str_pair(syms::name, name());
-      st.push_str_pair(syms::value, value);
+      st.push_str_pair(syms::value, tv());
       st.push_str_pair(syms::trust, (trusted ? "trusted" : "untrusted"));
 
       pr.print_stanza(st);
============================================================
--- src/database.cc	87efeeff2d3263ba98af684a4022f1897434ed2d
+++ src/database.cc	39ab2644b936e09a536b99ebd28b93f6e0d7c162
@@ -92,7 +92,7 @@ using boost::shared_ptr;
 using std::accumulate;
 
 using boost::shared_ptr;
-using boost::shared_dynamic_cast;
+using boost::dynamic_pointer_cast;
 using boost::lexical_cast;
 using boost::get;
 using boost::tuple;
@@ -3430,7 +3430,7 @@ database::encrypt_rsa(key_id const & pub
 
   shared_ptr<X509_PublicKey> x509_key(Botan::X509::load_key(pub_block));
   shared_ptr<RSA_PublicKey> pub_key
-    = shared_dynamic_cast<RSA_PublicKey>(x509_key);
+    = dynamic_pointer_cast<RSA_PublicKey>(x509_key);
   if (!pub_key)
     throw recoverable_failure(origin::system,
                               "Failed to get RSA encrypting key");
@@ -3481,7 +3481,7 @@ database::check_signature(key_id const &
       L(FL("building verifier for %d-byte pub key") % pub_block.size());
       shared_ptr<X509_PublicKey> x509_key(Botan::X509::load_key(pub_block));
       shared_ptr<RSA_PublicKey> pub_key
-        = boost::shared_dynamic_cast<RSA_PublicKey>(x509_key);
+        = boost::dynamic_pointer_cast<RSA_PublicKey>(x509_key);
 
       E(pub_key, id.inner().made_from,
         F("failed to get RSA verifying key for %s") % id);
============================================================
--- src/key_store.cc	b7859345f7c665914d16357409bdff24a48b7996
+++ src/key_store.cc	1ca13b7ee527bc2872d9fc325cf5ef327ca053c2
@@ -43,7 +43,7 @@ using boost::shared_ptr;
 
 using boost::scoped_ptr;
 using boost::shared_ptr;
-using boost::shared_dynamic_cast;
+using boost::dynamic_pointer_cast;
 
 using Botan::RSA_PrivateKey;
 using Botan::RSA_PublicKey;
@@ -641,7 +641,7 @@ key_store_state::decrypt_private_key(key
   I(pkcs8_key);
 
   shared_ptr<RSA_PrivateKey> priv_key;
-  priv_key = shared_dynamic_cast<RSA_PrivateKey>(pkcs8_key);
+  priv_key = dynamic_pointer_cast<RSA_PrivateKey>(pkcs8_key);
   E(priv_key, origin::no_fault,
     F("failed to extract RSA private key from PKCS#8 keypair"));
 
@@ -879,7 +879,8 @@ key_store::make_signature(database & db,
         L(FL("make_signature: building %d-byte pub key") % pub_block.size());
         shared_ptr<X509_PublicKey> x509_key =
           shared_ptr<X509_PublicKey>(Botan::X509::load_key(pub_block));
-        shared_ptr<RSA_PublicKey> pub_key = shared_dynamic_cast<RSA_PublicKey>(x509_key);
+        shared_ptr<RSA_PublicKey> pub_key =
+          dynamic_pointer_cast<RSA_PublicKey>(x509_key);
 
         if (!pub_key)
           throw recoverable_failure(origin::system,
@@ -1092,7 +1093,7 @@ key_store_state::migrate_old_key_pair
         continue;
       }
 
-  priv_key = shared_dynamic_cast<RSA_PrivateKey>(pkcs8_key);
+  priv_key = dynamic_pointer_cast<RSA_PrivateKey>(pkcs8_key);
   I(priv_key);
 
   // now we can write out the new key
============================================================
--- src/netxx/serverbase.cxx	156f2090341d2a36bdb718e7c69df58f9251983e
+++ src/netxx/serverbase.cxx	efaec5b590ba58147d17d7d17adf9a41b9d305d2
@@ -46,6 +46,9 @@
 
 #include <cerrno>
 
+// Monotone specific, for get_current_working_dir()
+#include <src/platform.hh>
+
 // standard includes
 #include <map>
 #include <vector>
@@ -169,27 +172,16 @@ void Netxx::ServerBase::bind_to(const Ad
 		if (saun->sun_path[0] == '/') {
 		    files_.push_back(saun->sun_path);
 		} else {
-		    // BIG FAT WARNING: THIS CODE HAS NOT BEEN TESTED!
-		    // The original code is non-dynamic, depending on
-		    // the value of MAXPATHLEN.  Since that macro isn't
-		    // guaranteed to exist, a more dynamic use if getcwd()
-		    // was written.  However, since monotone doesn't use
-		    // AF_LOCAL sockets, this code will not be reached.
-		    int e = ERANGE;
-		    int n = 4096;
-
-		    while (e == ERANGE) {
-			char buffer[n];
-			e = 0;
-			n += 4096;
-
-			if (getcwd(buffer, n)) {
-			    std::string fullpath = buffer; fullpath += '/'; fullpath += saun->sun_path;
-			    files_.push_back(fullpath);
-			} else if ((e = errno) != ERANGE) {
-			    files_.push_back(saun->sun_path);
-			}
-		    }
+		    /*
+		     * the original (netxx) code here relied on MAXPATHLEN,
+		     * which isn't defined on hurd. As netxx seems to only
+		     * live on within monotone, we can as well make it
+		     * inter-dependent. And the unix/fs.cc variant certainly
+		     * gets more test mileage than anything special here.
+		     */
+		    std::string fullpath = get_current_working_dir();
+		    fullpath += '/'; fullpath += saun->sun_path;
+		    files_.push_back(fullpath);
 		}
 	    }
 #	endif
============================================================
--- src/ssh_agent.cc	4a0dcab873559e934e41c5f220b5434d35600d9b
+++ src/ssh_agent.cc	6313ee3cdfca4112ba3957dc4a5f318472289dfa
@@ -32,7 +32,7 @@ using boost::shared_ptr;
 using std::vector;
 
 using boost::shared_ptr;
-using boost::shared_dynamic_cast;
+using boost::dynamic_pointer_cast;
 
 using Botan::RSA_PublicKey;
 using Botan::RSA_PrivateKey;
@@ -391,7 +391,8 @@ ssh_agent::has_key(const keypair & key)
   L(FL("has_key: building %d-byte pub key") % pub_block.size());
   shared_ptr<X509_PublicKey> x509_key =
     shared_ptr<X509_PublicKey>(Botan::X509::load_key(pub_block));
-  shared_ptr<RSA_PublicKey> pub_key = shared_dynamic_cast<RSA_PublicKey>(x509_key);
+  shared_ptr<RSA_PublicKey> pub_key = 
+    dynamic_pointer_cast<RSA_PublicKey>(x509_key);
 
   if (!pub_key)
     throw recoverable_failure(origin::system,
============================================================
--- src/std_hooks.lua	5b089162751bf675605aa10655c77dcd7af99b93
+++ src/std_hooks.lua	7e694c8f47f34cc2491f078ce6cd514fa349755b
@@ -10,7 +10,7 @@
 -- this is the standard set of lua hooks for monotone;
 -- user-provided files can override it or add to it.
 
-function temp_file(namehint)
+function temp_file(namehint, filemodehint)
    local tdir
    tdir = os.getenv("TMPDIR")
    if tdir == nil then tdir = os.getenv("TMP") end
@@ -22,8 +22,14 @@ function temp_file(namehint)
    else
       filename = string.format("%s/mtn.%s.XXXXXX", tdir, namehint)
    end
+   local filemode
+   if filemodehint == nil then
+      filemode = "r+"
+   else
+      filemode = filemodehint
+   end
    local name = mkstemp(filename)
-   local file = io.open(name, "r+")
+   local file = io.open(name, filemode)
    return file, name
 end
 
@@ -413,7 +419,16 @@ end
    return true
 end
 
-function accept_testresult_change(old_results, new_results)
+-- http://snippets.luacode.org/?p=snippets/String_to_Hex_String_68
+function hex_dump(str,spacer)
+   return (string.gsub(str,"(.)",
+      function (c)
+         return string.format("%02x%s",string.byte(c), spacer or "")
+      end)
+   )
+end
+
+function accept_testresult_change_hex(old_results, new_results)
    local reqfile = io.open("_MTN/wanted-testresults", "r")
    if (reqfile == nil) then return true end
    local line = reqfile:read()
@@ -434,6 +449,21 @@ end
    return true
 end
 
+function accept_testresult_change(old_results, new_results)
+   -- Hex encode each of the key hashes to match those in 'wanted-testresults'
+   local old_results_hex = {}
+   for k, v in pairs(old_results) do
+	old_results_hex[hex_dump(k)] = v
+   end
+
+   local new_results_hex = {}
+   for k, v in pairs(new_results) do
+      new_results_hex[hex_dump(k)] = v
+   end
+
+   return accept_testresult_change_hex(old_results_hex, new_results_hex)
+end
+
 -- merger support
 
 -- Fields in the mergers structure:
@@ -823,8 +853,8 @@ mergers.opendiff = {
    wanted = function () return true end
 }
 
-function write_to_temporary_file(data, namehint)
-   tmp, filename = temp_file(namehint)
+function write_to_temporary_file(data, namehint, filemodehint)
+   tmp, filename = temp_file(namehint, filemodehint)
    if (tmp == nil) then
       return nil
    end;
@@ -911,10 +941,10 @@ function merge3 (anc_path, left_path, ri
    tbl.rfile = nil
    tbl.outfile = nil
    tbl.meld_exists = false
-   tbl.lfile = write_to_temporary_file (left, "left")
-   tbl.afile = write_to_temporary_file (ancestor, "ancestor")
-   tbl.rfile = write_to_temporary_file (right, "right")
-   tbl.outfile = write_to_temporary_file ("", "merged")
+   tbl.lfile = write_to_temporary_file (left, "left", "r+b")
+   tbl.afile = write_to_temporary_file (ancestor, "ancestor", "r+b")
+   tbl.rfile = write_to_temporary_file (right, "right", "r+b")
+   tbl.outfile = write_to_temporary_file ("", "merged", "r+b")
 
    if tbl.lfile ~= nil and tbl.rfile ~= nil and tbl.afile ~= nil and tbl.outfile ~= nil
    then
@@ -926,7 +956,7 @@ function merge3 (anc_path, left_path, ri
          if not ret then
             ret = nil
          else
-            ret = read_contents_of_file (ret, "r")
+            ret = read_contents_of_file (ret, "rb")
             if string.len (ret) == 0
             then
                ret = nil
@@ -1052,8 +1082,8 @@ function external_diff(file_path, data_o
 
 -- default external diff, works for gnu diff
 function external_diff(file_path, data_old, data_new, is_binary, diff_args, rev_old, rev_new)
-   local old_file = write_to_temporary_file(data_old);
-   local new_file = write_to_temporary_file(data_new);
+   local old_file = write_to_temporary_file(data_old, nil, "r+b");
+   local new_file = write_to_temporary_file(data_new, nil, "r+b");
 
    if diff_args == nil then diff_args = external_diff_default_args end
    execute("diff", diff_args, "--label", file_path .. "\told", old_file, "--label", file_path .. "\tnew", new_file);
============================================================
--- src/unix/fs.cc	f51cae4dbc5589b0add4f7b9b649fde3c83d1220
+++ src/unix/fs.cc	686805003c24f02e8631c517399f29250b34fb65
@@ -44,14 +44,26 @@ get_current_working_dir()
 string
 get_current_working_dir()
 {
-  char buffer[4096];
-  if (!getcwd(buffer, 4096))
+  std::vector<char> cwd_buf;
+  size_t cwd_sz = 4096;
+
+  // This funny loop prevents having to specify a MAXPATHLEN or similar, but
+  // uses a dynamic approach, repeatedly calling getcwd() until our buffer
+  // is big enough for the current path to fit. Think of it as a portable
+  // replacement for get_current_dir_name(), which is GNU-only.
+  do
     {
-      const int err = errno;
-      E(false, origin::system,
-        F("cannot get working directory: %s") % os_strerror(err));
+      cwd_buf.resize(cwd_sz);
+      if (getcwd(&cwd_buf[0], cwd_sz))
+        return string(&cwd_buf[0]);
+
+      cwd_sz += 4096;
     }
-  return string(buffer);
+  while (errno == ERANGE);
+
+  const int err = errno;
+  E(false, origin::system,
+    F("cannot get working directory: %s") % os_strerror(err));
 }
 
 void
============================================================
--- test/extra/mail-notify/scripts/run-mail-notify	b90ab9abd71ff563f2492839cff878b947092bd6
+++ test/extra/mail-notify/scripts/run-mail-notify	4ac0215e561a21c86ce1e1743cf7598023107b1c
@@ -3,7 +3,7 @@
 # Current work directory should be
 # {builddir}/test/work/extra/mail-notify
 
-_MIME_CONSTRUCT="`type -p mime-construct || which mime-construct`"
+_MIME_CONSTRUCT="`which mime-construct`"
 _MIME_CONSTRUCT_OUTPUT="`pwd`/mime-construct.out"
 _MIME_CONSTRUCT_ERROR="`pwd`/mime-construct.err"
 _HERE="`dirname ${0}`"
============================================================
--- test/func/netsync_badhost_gives_nice_error/__driver__.lua	840813871ca60bde7d4c8829591932de494219f8
+++ test/func/netsync_badhost_gives_nice_error/__driver__.lua	c6e63fc8f098d7f4aed860f8ff9614e2b347899f
@@ -1,4 +1,23 @@
+skip_if(not existsonpath("host"))
 
+-- We punt in case of misconfigured DNS servers that resolve inexistant
+-- domain names. (Don't even think about buying that domain name!)
+L("\nChecking DNS resolution for nosuchhost__blahblah__asdvasoih.com: ")
+local pid = spawn_redirected("", "host-lookup.out", "host-lookup.err",
+                             "host", "nosuchhost__blahblah__asdvasoih.com")
+local ec = wait(pid)
+
+if ec == 0 then
+  L("failed\n",
+    "\n",
+    "Your DNS resolver is trying to be helpful by resolving names that do\n",
+    "not exist. `host nosuchhost__blahblah__asdvasoih.com` returned:\n\n")
+  log_file_contents("host-lookup.out")
+  skip_if(true)
+else
+  L("good\n")
+end
+
 mtn_setup()
 
 check(mtn("pull", "nosuchhost__blahblah__asdvasoih.com", "some.pattern"), 1, false, true)
============================================================
--- test/func/netsync_hook_errcodes/__driver__.lua	ec71c8c29e3fa49ae6bb99053318c2cadf770aed
+++ test/func/netsync_hook_errcodes/__driver__.lua	bb45536419fd9a4445f22e02140dbc88826a9c80
@@ -12,9 +12,9 @@ function get_errcode(who)
 function get_errcode(who)
    canonicalize("testnotes-" .. who .. ".log")
    local dat = readfile("testnotes-" .. who .. ".log")
-   local _, _, errcode = string.find(dat, "\n%d+ end: status = (%d%d%d)\n")
+   local _, _, errcode = string.find(dat, "\n%d+ end: status = (%d+)\n")
+   if errcode == nil then errcode = "<missing>" end
    L("Error code for ", who, " is ", errcode)
-   if errcode == nil then errcode = "<missing>" end
    return errcode
 end
 
============================================================
--- /dev/null	
+++ test/func/wanted_testresults/__driver__.lua	670d2df947c1e878dc53530808a87b5a2647fe87
@@ -0,0 +1,79 @@
+-- Create some revisions then attach 'testresult' certs to them.
+-- `mtn update` must not update to a "fail" revision from a "pass"
+-- revision.
+
+-- This is handled by our default definition of 'accept_testresult_change'
+-- which reads '_MTN/wanted-testresults'.
+
+mtn_setup()
+
+addfile("numbers.txt", 1)
+commit()
+good_rev = base_revision()
+
+writefile("numbers.txt", 2)
+commit()
+bad_rev = base_revision()
+
+check(mtn("update", "-r", good_rev), 0, false, false)
+
+check(mtn("testresult", good_rev, "pass"), 0, false, false)
+check(mtn("testresult", bad_rev, "fail"), 0, false, false)
+
+-- Now write out our default 'accept_testresult_change' definition
+-- from 'std_hooks.lua'.
+writefile("_MTN/monotonerc", [[
+-- http://snippets.luacode.org/?p=snippets/String_to_Hex_String_68
+function hex_dump(str,spacer)
+   return (string.gsub(str,"(.)",
+      function (c)
+         return string.format("%02x%s",string.byte(c), spacer or "")
+      end)
+   )
+end
+
+function accept_testresult_change_hex(old_results, new_results)
+   local reqfile = io.open("_MTN/wanted-testresults", "r")
+   if (reqfile == nil) then return true end
+   local line = reqfile:read()
+   local required = {}
+   while (line ~= nil)
+   do
+      required[line] = true
+      line = reqfile:read()
+   end
+   io.close(reqfile)
+   for test, res in pairs(required)
+   do
+      if old_results[test] == true and new_results[test] ~= true
+      then
+         return false
+      end
+   end
+   return true
+end
+
+function accept_testresult_change(old_results, new_results)
+   -- Hex encode each of the key hashes to match those in 'wanted-testresults'
+   local old_results_hex = {}
+   for k, v in pairs(old_results) do
+	old_results_hex[hex_dump(k)] = v
+   end
+
+   local new_results_hex = {}
+   for k, v in pairs(new_results) do
+      new_results_hex[hex_dump(k)] = v
+   end
+
+   return accept_testresult_change_hex(old_results_hex, new_results_hex)
+end
+]])
+writefile("_MTN/wanted-testresults", "46ec58576f9e4f34a9eede521422aa5fd299dc50\n")
+
+check(mtn("update", "--rcfile", "_MTN/monotonerc"), 0, false, true)
+-- stderr now looks something like.
+-- mtn: updating along branch '$BRANCH'
+-- mtn: already up to date at $good_rev
+check(qgrep(good_rev, "stderr"))
+check(base_revision() == good_rev)
+
============================================================
--- doc/monotone.texi	54602b03c6fbd96c3eacf8ec43e25202d4e12889
+++ doc/monotone.texi	08e1d3c65f796492d95f5d83efbf58861d5a8ce7
@@ -5729,6 +5729,15 @@ @section Network
 Branches matching a pattern are excluded if the pattern is preceded by
 '-', included otherwise.
 
+The syntax for patterns is very simple.  @code{*} matches 0 or more
+arbitrary characters.  @code{?} matches exactly 1 arbitrary character
+(you need to escape that as @code{%3F} in a URI). @address@hidden,@}}
+matches alternatives; @address@hidden,bar,address@hidden matches ``foo'', or
+``bar'', or ``baz''.  These can be combined arbitrarily.  A backslash
+(@code{\}) escapes these special characters, to match exactly that
+character; this might be useful in case someone, for some odd
+reason, decides to put a ``*'' into their branch name.
+
 Valid examples of URIs monotone accepts are:
 
 @smallexample
@@ -5736,6 +5745,7 @@ @section Network
 mtn://my.server:4690?my.branch
 mtn://my.server/project?my.other.branch*;-my.other.branch.test
 mtn://my.server/project?one.branch;-one.branch.test;another.branch;-another.branch.test
+mtn://my.server/project?{one.branch,another.branch};-{one.branch.test,another.branch.test}
 file:///path/to/database.mtn?my.branch
 ssh://joe@@my.server/~/db.mtn?joes.branch
 @end group
@@ -5815,15 +5825,6 @@ @section Network
 file.  This file can then be read to identify specific monotone server
 processes.
 
-The syntax for patterns is very simple.  @code{*} matches 0 or more
-arbitrary characters.  @code{?} matches exactly 1 arbitrary character
-(you need to escape that with @code{%3F} in a URI). @address@hidden,@}}
-matches alternatives; @address@hidden,bar,address@hidden matches ``foo'', or
-``bar'', or ``baz''.  These can be combined arbitrarily.  A backslash
-(@code{\}) escapes these special characters, to match exactly that
-character; this might be useful in case someone, for some odd
-reason, decides to put a ``*'' into their branch name.
-
 @anchor{mtn address@hidden mtn clone @var{uri} address@hidden address@hidden address@hidden
 @itemx mtn clone @var{address}[:@var{port}] @var{branchname} address@hidden @strong{deprecated}
 @command{clone} is a helper command that performs the roles of a
@@ -12244,7 +12245,7 @@ @subsection Trust Evaluation Hooks
 
 The default definition of this hook returns @code{true} if
 @file{_MTN/wanted-testresults} does not exist. Otherwise, the file
-should contain a list of signing key hex-encoded hashes in lowercase (40 characters). 
+should contain a list of signing key hex-encoded hashes in lowercase (40 characters).
 The hook returns @code{false}
 if a listed signing key hash is present in both @var{old_results} and
 @var{new_results}, with the value @code{true} in @var{old_results}

reply via email to

[Prev in Thread] Current Thread [Next in Thread]