# # # patch "ChangeLog" # from [73c944d692818567a5920ba6deec9a4ab18b8782] # to [f17e3a4cd4bfbcbb8a7e720e43446cb0449e81ca] # # patch "app_state.cc" # from [792e3fb96e0014818b035e55995291bfaf6c932e] # to [85d71171b53f38bca6f070200f2edaf7aaf99018] # # patch "contrib/usher.cc" # from [60b66c059446cc62d7b07a28791e1e609b5efd09] # to [fa9fa7456ac50359c2d1f50c1efef18668127178] # # patch "netxx/serverbase.cxx" # from [c08af53ff373665f71dcd30bba28f41354daf388] # to [9176551c9ec983187f6a52590d84131e125a37d5] # # patch "netxx/sockopt.cxx" # from [5f483a0e8bdf18d1c7ddb28e5f918921cc099286] # to [ab62347537609eed77b7c6f7a2b9806cc49be9ea] # # patch "netxx/sockopt.h" # from [4c1ce29a1741f50ee15f168779120f6465b25650] # to [1e9ed8908cf0297317f1415575ea28a22f887769] # # patch "ui.cc" # from [c51b1607975f692479563b70efd80c40731ea83a] # to [73b25bb821e7a820d70dfcb2991163070f2e4894] # ============================================================ --- ChangeLog 73c944d692818567a5920ba6deec9a4ab18b8782 +++ ChangeLog f17e3a4cd4bfbcbb8a7e720e43446cb0449e81ca @@ -1,3 +1,18 @@ +2005-12-06 Matthew Gregan + + * contrib/usher.cc (fork_server): Avoid getting stuck in an + infinte loop attempting to read() from a stream that has + reached EOF before we've read anything from it. This can occur if + the fork()+exec() of an usher managed monotone server fails. + * ui.cc (write_ticks): Don't call display_width() repeatedly for + the same string--get the result once and reuse it where necessary. + * netxx/sockopt.cxx, netxx/sockopt.h (set_ipv6_listen_for_v6_only): + New member function to set the IPV6_V6ONLY flag on a socket. + * netxx/serverbase.cxx (bind_to): Call set_ipv6_listen_for_v6_only + on IPv6 sockets. + * app_state.cc (allow_working_copy): Use keydir path from + MT/options if set. + 2005-12-05 Matthew Gregan * tests/t_database_sig_cleanup.at: Mark this as NOT_ON_WIN32; as ============================================================ --- app_state.cc 792e3fb96e0014818b035e55995291bfaf6c932e +++ app_state.cc 85d71171b53f38bca6f070200f2edaf7aaf99018 @@ -76,6 +76,12 @@ db.set_filename(dbname); } + if (!options[keydir_option]().empty()) + { + system_path keydir = system_path(options[keydir_option]); + set_key_dir(keydir); + } + if (branch_name().empty()) branch_name = options[branch_option]; L(F("branch name is '%s'\n") % branch_name()); ============================================================ --- contrib/usher.cc 60b66c059446cc62d7b07a28791e1e609b5efd09 +++ contrib/usher.cc fa9fa7456ac50359c2d1f50c1efef18668127178 @@ -526,7 +526,7 @@ // the first line output on the server's stderr will be either // "monotone: beginning service on : " or // "monotone: network error: bind(2) error: Address already in use" - while(r >= 0 && !line && got < 256) { + do { r = read(err[0], head + got, 256 - got); if (r) cerr<<"Read '"< 0 && !line && got < 256); head[got] = 0; if (string(head).find("beginning service") != string::npos) return pid; ============================================================ --- netxx/serverbase.cxx c08af53ff373665f71dcd30bba28f41354daf388 +++ netxx/serverbase.cxx 9176551c9ec983187f6a52590d84131e125a37d5 @@ -130,6 +130,11 @@ SockOpt socket_opt(socketfd); socket_opt.set_reuse_address(); +# ifndef NETXX_NO_INET6 + if (sa->sa_family == AF_INET6) + socket_opt.set_ipv6_listen_for_v6_only(); +# endif + if (bind(socketfd, sa, sa_size) != 0) { std::string error("bind(2) error: "); error += strerror(Netxx::get_last_error()); ============================================================ --- netxx/sockopt.cxx 5f483a0e8bdf18d1c7ddb28e5f918921cc099286 +++ netxx/sockopt.cxx ab62347537609eed77b7c6f7a2b9806cc49be9ea @@ -140,3 +140,20 @@ return true; } //#################################################################### +bool Netxx::SockOpt::set_ipv6_listen_for_v6_only (void) const +{ +# ifndef NETXX_NO_INET6 + +# ifndef IPV6_V6ONLY + return false; +# else + int on = 1; + char *val = reinterpret_cast(&on); + + if (setsockopt(socket_, IPPROTO_IPV6, IPV6_V6ONLY, val, sizeof(on)) != 0) + return false; +# endif +# endif + return true; +} +//#################################################################### ============================================================ --- netxx/sockopt.h 4c1ce29a1741f50ee15f168779120f6465b25650 +++ netxx/sockopt.h 1e9ed8908cf0297317f1415575ea28a22f887769 @@ -110,6 +110,17 @@ //#################################################################### bool check_for_error (std::string &message) const; + //#################################################################### + /** + * Set the socket option that does not allow IPv4 mapped addresses on + * a listening IPv6 socket. + * + * @return True if the socket was set to IPv6 only. + * @return False if the socket was not set to IPv6 only. + * @author Matthew Gregan + **/ + //#################################################################### + bool set_ipv6_listen_for_v6_only (void) const; private: socket_type socket_; bool revert_; ============================================================ --- ui.cc c51b1607975f692479563b70efd80c40731ea83a +++ ui.cc 73b25bb821e7a820d70dfcb2991163070f2e4894 @@ -93,17 +93,18 @@ for (map::const_iterator i = ui.tickers.begin(); i != ui.tickers.end(); ++i) { - width = 1 + display_width(utf8(i->second->name)); + size_t dwidth = display_width(utf8(i->second->name)); + width = 1 + dwidth; if (!first_tick) { tickline1 += " | "; tickline2 += " |"; } first_tick = false; - if (display_width(utf8(i->second->name)) < minwidth) + if (dwidth < minwidth) { - tickline1.append(minwidth - display_width(utf8(i->second->name)),' '); - width += minwidth - display_width(utf8(i->second->name)); + tickline1.append(minwidth - dwidth, ' '); + width += minwidth - dwidth; } tickline1 += i->second->name; @@ -133,16 +134,17 @@ count = (F("%d") % i->second->ticks).str(); } - if (display_width(utf8(count)) < width) + dwidth = display_width(utf8(count)); + if (dwidth < width) { - tickline2.append(width - display_width(utf8(count)),' '); + tickline2.append(width - dwidth, ' '); } - else if (display_width(utf8(count)) > width) + else if (dwidth > width) { // FIXME: not quite right, because substr acts on bytes rather than // characters; but there are always more bytes than characters, so // at worst this will just chop off a little too much. - count = count.substr(display_width(utf8(count)) - width); + count = count.substr(dwidth - width); } tickline2 += count; }