Opened 8 years ago

Closed 7 years ago

#10286 closed Bugs (obsolete)

Fail regex matching when dynamic linking boost_regex on FreeBSD 8 (9).

Reported by: Pavel Karelin <hkarel@…> Owned by: John Maddock
Milestone: To Be Determined Component: regex
Version: Boost 1.55.0 Severity: Problem
Keywords: Cc:

Description

Simple example:

#include <boost/regex.hpp>
#include <string>

main(int, char *[])
{
std::string filter_rules = "cause  16";
std::string::const_iterator start = filter_rules.begin();
std::string::const_iterator end = filter_rules.end();
std::string rule_pattern = "([a-z_]+).*";
boost::regex rule_re(rule_pattern, boost::regex::extended);
boost::smatch what;
regex_search(filter_rules, what, rule_re);

std::string call_param = what[1];
std::string rule_operator = what[2];
std::string value = what[3];
printf("\n0: %s", call_param.c_str());
printf("\n1: %s", rule_operator.c_str());
printf("\n2: %s\n", value.c_str());
}

Static linking:
g++ test.cpp -o test -I/opt/boost/1.55.0/include /opt/boost/1.55.0/lib/libboost_regex.a

Results:
0: cause /* It's correct */
1:
2:

Dynamic linking:
g++ test.cpp -o test -I/opt/boost/1.55.0/include -L/opt/boost/1.55.0/lib -lboost_regex -Wl,-rpath,/opt/boost/1.55.0/lib

Results:
0: /* FAIL! */
1:
2:

It is manifested on FreeBSD 8 (9), architecture amd64.

Boost was builds with next parameters:
./bootstrap.sh \
--without-icu \
--without-libraries=coroutine,graph,graph_parallel,locale,log,math,mpi,random,test,wave \
--with-python=${py_dir}/bin/python

./b2 --disable-icu

Change History (2)

comment:1 by John Maddock, 8 years ago

I'm afraid I don't have FreeBSD to test on. However, I note all the regression tests are passing for FreeBSD here: http://www.boost.org/development/tests/develop/developer/regex.html

My guess is that you have multiple Boost.Regex so's on your system and it's picking the wrong one at run time?

comment:2 by John Maddock, 7 years ago

Resolution: obsolete
Status: newclosed
Note: See TracTickets for help on using tickets.