Opened 16 years ago

Closed 16 years ago

Last modified 16 years ago

#774 closed Bugs (Duplicate)

regex_replace is not thread safe when format = $N

Reported by: r_emek Owned by: John Maddock
Milestone: Component: regex
Version: None Severity:
Keywords: Cc:

Description

When used in a multi-threaded environment,
regex_replace produces wrong results when the 'fmt'
parameter is $<digit> (i.e., $1, $2, etc.). 

If, for example, the correct results of the replacement
operation is 1234, and fmt is '$0', we'll eventually
get one of the following: 
 - 12340
 - $0

(The last digit of the erroneous result is usually the
digit number from the format). 

I'm attaching a sample program that demonstrates the
problem. 

We've seen this problem on Linux (RedHat 9, gcc version
3.2.2 20030222) and on several other platforms. 

Change History (2)

comment:1 by John Maddock, 16 years ago

Status: assignedclosed
Logged In: YES 
user_id=14804

This is a duplicate of
https://sourceforge.net/tracker/?func=detail&atid=107586&aid=1530683&group_id=7586.
 See regex-thread.diff for the fix.

John Maddock.

comment:2 by r_emek, 16 years ago

Logged In: YES 
user_id=1581119

Thanks a lot. 
Note: See TracTickets for help on using tickets.