diff options
author | barner <barner@FreeBSD.org> | 2006-08-02 03:25:17 +0800 |
---|---|---|
committer | barner <barner@FreeBSD.org> | 2006-08-02 03:25:17 +0800 |
commit | 279a83c68e5270a92d243ed1792da4399ba2faac (patch) | |
tree | c825089a44c92fd6084dade1d584b132fbfa52ea /devel | |
parent | 320b971b94f436803da3f54e381327e0209e4054 (diff) | |
download | freebsd-ports-gnome-279a83c68e5270a92d243ed1792da4399ba2faac.tar.gz freebsd-ports-gnome-279a83c68e5270a92d243ed1792da4399ba2faac.tar.zst freebsd-ports-gnome-279a83c68e5270a92d243ed1792da4399ba2faac.zip |
- Fix const-correctness bug in Boost.Regex-1.33.x
that strikes only in multithreaded programs on Unix platforms, if:
* Multiple threads construct regexes concurrently, or
* Multiple threads perform search and replace operations concurrently.
- Bump PORTREVISION (threads are enabled in the port's default configuration)
Submitted by: John Maddock <john@johnmaddock.co.uk> via boost-announce
Found by: Aleksey Sanin
See also: http://lists.boost.org/boost-announce/2006/08/0097.php
Diffstat (limited to 'devel')
-rw-r--r-- | devel/boost/Makefile | 2 | ||||
-rw-r--r-- | devel/boost/files/patch-boost_regex_pending_object_cache.hpp | 49 | ||||
-rw-r--r-- | devel/boost/files/patch-boost_regex_v4_cpp_regex_traits.hpp | 74 | ||||
-rw-r--r-- | devel/boost/files/patch-boost_regex_v4_w32_regex_traits.hpp | 38 |
4 files changed, 162 insertions, 1 deletions
diff --git a/devel/boost/Makefile b/devel/boost/Makefile index f5a3466576de..67c0e520f33e 100644 --- a/devel/boost/Makefile +++ b/devel/boost/Makefile @@ -7,7 +7,7 @@ PORTNAME= boost PORTVERSION= 1.33.1 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= devel MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:S/$/:boost_site,spirit_site/} MASTER_SITE_SUBDIR=boost/:boost_site diff --git a/devel/boost/files/patch-boost_regex_pending_object_cache.hpp b/devel/boost/files/patch-boost_regex_pending_object_cache.hpp new file mode 100644 index 000000000000..64ed6b11e4e4 --- /dev/null +++ b/devel/boost/files/patch-boost_regex_pending_object_cache.hpp @@ -0,0 +1,49 @@ +--- boost/regex/pending/object_cache.hpp.orig Mon Jun 20 13:48:37 2005 ++++ boost/regex/pending/object_cache.hpp Tue Aug 1 20:58:55 2006 +@@ -35,16 +35,16 @@ + class object_cache + { + public: +- typedef std::pair< ::boost::shared_ptr<Object>, Key const*> value_type; ++ typedef std::pair< ::boost::shared_ptr<Object const>, Key const*> value_type; + typedef std::list<value_type> list_type; + typedef typename list_type::iterator list_iterator; + typedef std::map<Key, list_iterator> map_type; + typedef typename map_type::iterator map_iterator; + typedef typename list_type::size_type size_type; +- static boost::shared_ptr<Object> get(const Key& k, size_type max_cache_size); ++ static boost::shared_ptr<Object const> get(const Key& k, size_type max_cache_size); + + private: +- static boost::shared_ptr<Object> do_get(const Key& k, size_type max_cache_size); ++ static boost::shared_ptr<Object const> do_get(const Key& k, size_type max_cache_size); + + struct data + { +@@ -58,7 +58,7 @@ + }; + + template <class Key, class Object> +-boost::shared_ptr<Object> object_cache<Key, Object>::get(const Key& k, size_type max_cache_size) ++boost::shared_ptr<Object const> object_cache<Key, Object>::get(const Key& k, size_type max_cache_size) + { + #ifdef BOOST_HAS_THREADS + static boost::static_mutex mut = BOOST_STATIC_MUTEX_INIT; +@@ -80,7 +80,7 @@ + } + + template <class Key, class Object> +-boost::shared_ptr<Object> object_cache<Key, Object>::do_get(const Key& k, size_type max_cache_size) ++boost::shared_ptr<Object const> object_cache<Key, Object>::do_get(const Key& k, size_type max_cache_size) + { + typedef typename object_cache<Key, Object>::data object_data; + typedef typename list_type::size_type list_size_type; +@@ -115,7 +115,7 @@ + // if we get here then the item is not in the cache, + // so create it: + // +- boost::shared_ptr<Object> result(new Object(k)); ++ boost::shared_ptr<Object const> result(new Object(k)); + // + // Add it to the list, and index it: + // diff --git a/devel/boost/files/patch-boost_regex_v4_cpp_regex_traits.hpp b/devel/boost/files/patch-boost_regex_v4_cpp_regex_traits.hpp new file mode 100644 index 000000000000..8cefa347d795 --- /dev/null +++ b/devel/boost/files/patch-boost_regex_v4_cpp_regex_traits.hpp @@ -0,0 +1,74 @@ +--- boost/regex/v4/cpp_regex_traits.hpp.orig Wed Sep 14 14:20:41 2005 ++++ boost/regex/v4/cpp_regex_traits.hpp Tue Aug 1 20:58:55 2006 +@@ -407,12 +407,12 @@ + typedef charT char_type; + //cpp_regex_traits_implementation(); + cpp_regex_traits_implementation(const std::locale& l) +- : cpp_regex_traits_char_layer<charT>(l), m_is(&m_sbuf) ++ : cpp_regex_traits_char_layer<charT>(l) + { + init(); + } + cpp_regex_traits_implementation(const cpp_regex_traits_base<charT>& l) +- : cpp_regex_traits_char_layer<charT>(l), m_is(&m_sbuf) ++ : cpp_regex_traits_char_layer<charT>(l) + { + init(); + } +@@ -439,8 +439,6 @@ + string_type lookup_collatename(const charT* p1, const charT* p2) const; + string_type transform_primary(const charT* p1, const charT* p2) const; + string_type transform(const charT* p1, const charT* p2) const; +- re_detail::parser_buf<charT> m_sbuf; // buffer for parsing numbers. +- std::basic_istream<charT> m_is; // stream for parsing numbers. + private: + std::map<int, std::string> m_error_strings; // error messages indexed by numberic ID + std::map<string_type, char_class_type> m_custom_class_names; // character class names +@@ -816,7 +814,7 @@ + + + template <class charT> +-inline boost::shared_ptr<cpp_regex_traits_implementation<charT> > create_cpp_regex_traits(const std::locale& l BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(charT)) ++inline boost::shared_ptr<const cpp_regex_traits_implementation<charT> > create_cpp_regex_traits(const std::locale& l BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(charT)) + { + cpp_regex_traits_base<charT> key(l); + return ::boost::object_cache<cpp_regex_traits_base<charT>, cpp_regex_traits_implementation<charT> >::get(key, 5); +@@ -954,7 +952,7 @@ + static std::string get_catalog_name(); + + private: +- boost::shared_ptr<re_detail::cpp_regex_traits_implementation<charT> > m_pimpl; ++ boost::shared_ptr<const re_detail::cpp_regex_traits_implementation<charT> > m_pimpl; + // + // catalog name handler: + // +@@ -969,17 +967,21 @@ + template <class charT> + int cpp_regex_traits<charT>::toi(const charT*& first, const charT* last, int radix)const + { ++ re_detail::parser_buf<charT> sbuf; // buffer for parsing numbers. ++ std::basic_istream<charT> is(&sbuf); // stream for parsing numbers. ++ + // we do NOT want to parse any thousands separators inside the stream: +- last = std::find(first, last, BOOST_USE_FACET(std::numpunct<charT>, m_pimpl->m_is.getloc()).thousands_sep()); +- m_pimpl->m_sbuf.pubsetbuf(const_cast<charT*>(static_cast<const charT*>(first)), static_cast<std::streamsize>(last-first)); +- m_pimpl->m_is.clear(); +- if(std::abs(radix) == 16) m_pimpl->m_is >> std::hex; +- else if(std::abs(radix) == 8) m_pimpl->m_is >> std::oct; +- else m_pimpl->m_is >> std::dec; ++ last = std::find(first, last, BOOST_USE_FACET(std::numpunct<charT>, is.getloc()).thousands_sep()); ++ ++ sbuf.pubsetbuf(const_cast<charT*>(static_cast<const charT*>(first)), static_cast<std::streamsize>(last-first)); ++ is.clear(); ++ if(std::abs(radix) == 16) is >> std::hex; ++ else if(std::abs(radix) == 8) is >> std::oct; ++ else is >> std::dec; + int val; +- if(m_pimpl->m_is >> val) ++ if(is >> val) + { +- first = first + ((last - first) - m_pimpl->m_sbuf.in_avail()); ++ first = first + ((last - first) - sbuf.in_avail()); + return val; + } + else diff --git a/devel/boost/files/patch-boost_regex_v4_w32_regex_traits.hpp b/devel/boost/files/patch-boost_regex_v4_w32_regex_traits.hpp new file mode 100644 index 000000000000..08784222db50 --- /dev/null +++ b/devel/boost/files/patch-boost_regex_v4_w32_regex_traits.hpp @@ -0,0 +1,38 @@ +--- boost/regex/v4/w32_regex_traits.hpp.orig Tue Jul 12 11:49:11 2005 ++++ boost/regex/v4/w32_regex_traits.hpp Tue Aug 1 20:58:55 2006 +@@ -166,7 +166,7 @@ + { + return ::boost::re_detail::w32_tolower(c, this->m_locale); + } +- bool isctype(boost::uint32_t mask, charT c) ++ bool isctype(boost::uint32_t mask, charT c)const + { + return ::boost::re_detail::w32_is(this->m_locale, mask, c); + } +@@ -263,7 +263,7 @@ + { + return m_lower_map[static_cast<unsigned char>(c)]; + } +- bool isctype(boost::uint32_t mask, char c) ++ bool isctype(boost::uint32_t mask, char c)const + { + return m_type_map[static_cast<unsigned char>(c)] & mask; + } +@@ -539,7 +539,7 @@ + + + template <class charT> +-boost::shared_ptr<w32_regex_traits_implementation<charT> > create_w32_regex_traits(::boost::re_detail::lcid_type l BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(charT)) ++boost::shared_ptr<const w32_regex_traits_implementation<charT> > create_w32_regex_traits(::boost::re_detail::lcid_type l BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(charT)) + { + // TODO: create a cache for previously constructed objects. + return boost::object_cache< ::boost::re_detail::lcid_type, w32_regex_traits_implementation<charT> >::get(l, 5); +@@ -653,7 +653,7 @@ + static std::string get_catalog_name(); + + private: +- boost::shared_ptr<re_detail::w32_regex_traits_implementation<charT> > m_pimpl; ++ boost::shared_ptr<const re_detail::w32_regex_traits_implementation<charT> > m_pimpl; + // + // catalog name handler: + // |