ports/114353: Fix to bug in devel/monotone with boost 1.34.0
Lapo Luchini
lapo at lapo.it
Fri Jul 6 14:20:08 UTC 2007
The following reply was made to PR ports/114353; it has been noted by GNATS.
From: Lapo Luchini <lapo at lapo.it>
To: bug-followup at FreeBSD.org, v.haisman at sh.cvut.cz
Cc:
Subject: Re: ports/114353: Fix to bug in devel/monotone with boost 1.34.0
Date: Fri, 06 Jul 2007 15:43:20 +0200
This is a multi-part message in MIME format.
--------------010307010903030607040508
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: 7bit
Yes, that's the patch (generated with something like this I guess: `mtn
diff -r 33bf29f0 -r 28c4c304 paths.cc`).
The attached file (same patch, but done by `make update-patches`) is to
be committed in /usr/ports/devel/monotone/files/ subdirectory.
--------------010307010903030607040508
Content-Type: text/plain;
name="patch-paths.cc"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="patch-paths.cc"
--- paths.cc.orig Mon May 7 16:13:44 2007
+++ paths.cc Fri Jul 6 15:27:55 2007
@@ -10,6 +10,7 @@
#include <string>
#include <sstream>
+#include <boost/version.hpp>
#include <boost/filesystem/operations.hpp>
#include <boost/filesystem/convenience.hpp>
@@ -249,6 +250,41 @@ internal_string_to_split_path(string con
I(fully_normalized_path_split(path, true, sp));
}
+// path::normalize() is deprecated in Boost 1.34, and also
+// doesn't remove leading or trailing dots any more.
+static fs::path
+normalize_path(fs::path const & in)
+{
+#if BOOST_VERSION < 103400
+ return in.normalize();
+#else
+ fs::path out;
+ vector<string> stack;
+ for (fs::path::iterator i = in.begin(); i != in.end(); ++i)
+ {
+ // remove . elements
+ if (*i == ".")
+ continue;
+ // remove foo/.. element pairs
+ if (*i == "..")
+ {
+ if (!stack.empty())
+ {
+ stack.pop_back();
+ continue;
+ }
+ }
+ stack.push_back(*i);
+ }
+ for (vector<string>::const_iterator i = stack.begin();
+ i != stack.end(); ++i)
+ {
+ out /= *i;
+ }
+ return out;
+#endif
+}
+
static void
normalize_external_path(string const & path, string & normalized)
{
@@ -272,7 +308,7 @@ normalize_external_path(string const & p
base = initial_rel_path.get();
// the fs::native is needed to get it to accept paths like ".foo".
relative = fs::path(path, fs::native);
- out = (base / relative).normalize();
+ out = normalize_path(base / relative);
}
catch (exception &)
{
@@ -539,9 +575,9 @@ static string
normalize_out_dots(string const & path)
{
#ifdef WIN32
- return fs::path(path, fs::native).normalize().string();
+ return normalize_path(fs::path(path, fs::native)).string();
#else
- return fs::path(path, fs::native).normalize().native_file_string();
+ return normalize_path(fs::path(path, fs::native)).native_file_string();
#endif
}
@@ -679,9 +715,17 @@ find_bookdir(fs::path const & root, fs::
}
// check for _MTN/. and _MTN/.. to see if mt dir is readable
- if (!fs::exists(check / ".") || !fs::exists(check / ".."))
+ try
+ {
+ if (!fs::exists(check / ".") || !fs::exists(check / ".."))
+ {
+ L(FL("problems with '%s' (missing '.' or '..')") % check.string());
+ return false;
+ }
+ }
+ catch(exception &)
{
- L(FL("problems with '%s' (missing '.' or '..')") % check.string());
+ L(FL("problems with '%s' (cannot check for '.' or '..')") % check.string());
return false;
}
return true;
--------------010307010903030607040508--
More information about the freebsd-ports-bugs
mailing list