From MAILER-DAEMON Thu Apr 01 15:33:56 2004
Received: from list by monty-python.gnu.org with archive (Exim 4.30)
	id 1B98su-00056w-6C
	for mharc-bug-commoncpp@gnu.org; Thu, 01 Apr 2004 15:33:56 -0500
Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30)
	id 1B98sq-00052n-Aw
	for bug-commoncpp@gnu.org; Thu, 01 Apr 2004 15:33:52 -0500
Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30)
	id 1B98sC-0004ZJ-6z
	for bug-commoncpp@gnu.org; Thu, 01 Apr 2004 15:33:43 -0500
Received: from [216.68.248.32] (helo=Milcor21.milacron.com)
	by monty-python.gnu.org with esmtp (Exim 4.30) id 1B98rM-00041g-7W
	for bug-commoncpp@gnu.org; Thu, 01 Apr 2004 15:32:20 -0500
Received: from dmeusmail.dmeus.milacron.com ([143.62.132.57]) by
	Milcor21.milacron.com with Microsoft SMTPSVC(5.0.2195.6713); 
	Thu, 1 Apr 2004 15:32:18 -0500
Received: by dmeusmail.dmeus.milacron.com with Internet Mail Service
	(5.5.2657.72) id <HXYA793Z>; Thu, 1 Apr 2004 15:32:15 -0500
Message-ID: <EF398F42BE1BDF479B1E481F6E0053F201C97D94@dmeusmail.dmeus.milacron.com>
From: erik_ohrnberger@dme.net
To: bug-commoncpp@gnu.org
Date: Thu, 1 Apr 2004 15:32:14 -0500 
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2657.72)
Content-Type: text/plain;
	charset="iso-8859-1"
X-OriginalArrivalTime: 01 Apr 2004 20:32:18.0502 (UTC)
	FILETIME=[6D514E60:01C41828]
Subject: persistence exceptions
X-BeenThere: bug-commoncpp@gnu.org
X-Mailman-Version: 2.1.4
Precedence: list
List-Id: Bug reports for Common C++ <bug-commoncpp.gnu.org>
List-Unsubscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=unsubscribe>
List-Archive: <http://mail.gnu.org/pipermail/bug-commoncpp>
List-Post: <mailto:bug-commoncpp@gnu.org>
List-Help: <mailto:bug-commoncpp-request@gnu.org?subject=help>
List-Subscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=subscribe>
X-List-Received-Date: Thu, 01 Apr 2004 20:33:54 -0000


Looking though the code in the engine.cpp source module, I've found in a
number of places where assert is used.  

I was just wondering if those places should really have Engine::Exception
being thrown?

What way, a client program could catch those errors and display something
nice to the user and explain what when wrong.

Cheers,
	Erik.



From MAILER-DAEMON Thu Apr 01 15:51:29 2004
Received: from list by monty-python.gnu.org with archive (Exim 4.30)
	id 1B9992-0001qZ-Ew
	for mharc-bug-commoncpp@gnu.org; Thu, 01 Apr 2004 15:50:36 -0500
Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30)
	id 1B9986-0000vP-DU
	for bug-commoncpp@gnu.org; Thu, 01 Apr 2004 15:49:38 -0500
Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30)
	id 1B991L-0003O0-Ro
	for bug-commoncpp@gnu.org; Thu, 01 Apr 2004 15:43:12 -0500
Received: from [216.68.248.32] (helo=Milcor21.milacron.com)
	by monty-python.gnu.org with esmtp (Exim 4.30) id 1B991G-0003ER-4x
	for bug-commoncpp@gnu.org; Thu, 01 Apr 2004 15:42:34 -0500
Received: from dmeusmail.dmeus.milacron.com ([143.62.132.57]) by
	Milcor21.milacron.com with Microsoft SMTPSVC(5.0.2195.6713); 
	Thu, 1 Apr 2004 15:42:25 -0500
Received: by dmeusmail.dmeus.milacron.com with Internet Mail Service
	(5.5.2657.72) id <HXYA7939>; Thu, 1 Apr 2004 15:42:23 -0500
Message-ID: <EF398F42BE1BDF479B1E481F6E0053F201C97D95@dmeusmail.dmeus.milacron.com>
From: erik_ohrnberger@dme.net
To: bug-commoncpp@gnu.org
Date: Thu, 1 Apr 2004 15:42:23 -0500 
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2657.72)
Content-Type: text/plain;
	charset="iso-8859-1"
X-OriginalArrivalTime: 01 Apr 2004 20:42:27.0975 (UTC)
	FILETIME=[D8978170:01C41829]
Subject: RE: persistence exceptions
X-BeenThere: bug-commoncpp@gnu.org
X-Mailman-Version: 2.1.4
Precedence: list
List-Id: Bug reports for Common C++ <bug-commoncpp.gnu.org>
List-Unsubscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=unsubscribe>
List-Archive: <http://mail.gnu.org/pipermail/bug-commoncpp>
List-Post: <mailto:bug-commoncpp@gnu.org>
List-Help: <mailto:bug-commoncpp-request@gnu.org?subject=help>
List-Subscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=subscribe>
X-List-Received-Date: Thu, 01 Apr 2004 20:50:25 -0000


... And also:

* shouldn't Engine::readObject also THROW( Engine::Exception)?

* shouldn't lower level IO exceptions be caught and re-thrown as
Engine::Exceptions?



> -----Original Message-----
> From: Ohrnberger, Erik 
> Sent: Thursday, April 01, 2004 3:32 PM
> To: bug-commoncpp@gnu.org
> Subject: persistence exceptions
> 
> 
> 
> Looking though the code in the engine.cpp source module, I've 
> found in a number of places where assert is used.  
> 
> I was just wondering if those places should really have 
> Engine::Exception being thrown?
> 
> What way, a client program could catch those errors and 
> display something nice to the user and explain what when wrong.
> 
> Cheers,
> 	Erik.
> 



From MAILER-DAEMON Thu Apr 01 21:16:48 2004
Received: from list by monty-python.gnu.org with archive (Exim 4.30)
	id 1B9EEh-0001Xy-FF
	for mharc-bug-commoncpp@gnu.org; Thu, 01 Apr 2004 21:16:47 -0500
Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30)
	id 1B9Dkv-0000y7-NA
	for bug-commoncpp@gnu.org; Thu, 01 Apr 2004 20:46:01 -0500
Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30)
	id 1B9DkP-0000uD-CE
	for bug-commoncpp@gnu.org; Thu, 01 Apr 2004 20:46:00 -0500
Received: from [61.152.127.104] (helo=mailsh.codexchina.com)
	by monty-python.gnu.org with esmtp (Exim 4.30) id 1B9DkO-0000ru-9K
	for bug-commoncpp@gnu.org; Thu, 01 Apr 2004 20:45:28 -0500
Received: from CodexBench ([192.168.88.254]) by mailsh.codexchina.com with
	Microsoft SMTPSVC(5.0.2195.6713); Fri, 2 Apr 2004 09:45:36 +0800
Message-ID: <001e01c41854$32112380$2e1210ac@codexchina.com>
From: "Ben.Chen" <Ben.Chen@codexchina.com>
To: <bug-commoncpp@gnu.org>
Date: Fri, 2 Apr 2004 09:45:36 +0800
Organization: Codex
MIME-Version: 1.0
Content-Type: multipart/alternative;
	boundary="----=_NextPart_000_001B_01C41897.402AEDA0"
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
X-OriginalArrivalTime: 02 Apr 2004 01:45:36.0984 (UTC)
	FILETIME=[32160580:01C41854]
X-Mailman-Approved-At: Thu, 01 Apr 2004 21:16:46 -0500
Subject: Thread::join can not exit
X-BeenThere: bug-commoncpp@gnu.org
X-Mailman-Version: 2.1.4
Precedence: list
Reply-To: "Ben.Chen" <Ben.Chen@codexchina.com>
List-Id: Bug reports for Common C++ <bug-commoncpp.gnu.org>
List-Unsubscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=unsubscribe>
List-Archive: <http://mail.gnu.org/pipermail/bug-commoncpp>
List-Post: <mailto:bug-commoncpp@gnu.org>
List-Help: <mailto:bug-commoncpp-request@gnu.org?subject=help>
List-Subscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=subscribe>
X-List-Received-Date: Fri, 02 Apr 2004 01:46:02 -0000

This is a multi-part message in MIME format.

------=_NextPart_000_001B_01C41897.402AEDA0
Content-Type: text/plain;
	charset="gb2312"
Content-Transfer-Encoding: base64

DQpIaSwgDQoNCk15IGVudmlyb25tZW50IGlzIGcrKyAzLjIuMiAyMDAzMDIyMiBvbiBSZWRoYXQg
OS4wLiBDb21tb25DcHAyIDEuMS4wLg0KSSBkZXZpcmVkIGEgY2xhc3MgZnJvbSBUQ1BTZXNzaW9u
IGFuZCBydW4gaXQsIHRoZW4gSSBmb3VuZCBUaHJlYWQ6OmpvaW4gY2FuIG5vdCBleGl0Lg0KDQpj
bGFzcyB0ZXN0VENQU2Vzc2lvbiA6IHB1YmxpYyBUQ1BTZXNzaW9uDQp7DQpwdWJsaWM6DQogICAg
dGVzdFRDUFNlc3Npb24oLi4uKQ0KICAgIDoNCiAgICAgICAgVENQU2Vzc2lvbiguLi4pDQogICAg
ew0KDQogICAgfQ0KcHJvdGVjdGVkOg0KICAgIHZpcnR1YWwgdm9pZCBydW4oKQ0KICAgIHsNCiAg
ICAgICAgLi4uDQogICAgfQ0KfTsNCg0KaW50IG1haW4oKQ0Kew0KICAgIHRlc3RUQ1BTZXNzaW9u
KiBwID0gbmV3IHRlc3RUQ1BTZXNzaW9uKC4uLik7DQogICAgcC0+ZGV0YWNoKCk7DQogICAgcC0+
VGhyZWFkOjpqb2luKCk7DQoNCiAgICByZXR1cm4gMDsNCn0NCg0KDQoNCg0KSSBjaGVja2VkIHRo
ZSBzb3VyY2UgY29kZSwgaW4gVGhyZWFkOjpjbG9zZSgpLCANCg0KLi4uDQogICAgLy8gZmluYWwg
Y2FuIGNhbGwgZGVzdHJ1Y3RvciAodGhhdCBjYWxsIFRlcm1pbmF0ZSkNCiAgICBmaW5hbCgpOw0K
DQogICAgLy8gdGVzdCBpZiB0aGlzIGNsYXNzIGlzIHNlbGYtZXhpdGluZyB0aHJlYWQNCiNpZmRl
ZiBXSU4zMg0KICAgIGlmIChfc2VsZi5nZXRLZXkoKSA9PSB0aGlzKQ0KI2Vsc2UNCiAgICBpZiAo
VGhyZWFkSW1wbDo6X3NlbGYuZ2V0S2V5KCkgPT0gdGhpcykNCiNlbmRpZg0KICAgIHsNCiAgICAg
ICAgaWYocHJpdikNCiAgICAgICAgICAgIHByaXYtPl90aWQgPSAwOw0KICAgICAgICBqb2luU2Vt
LnBvc3QoKTsNCiAgICB9DQouLi4NCg0KDQoNCklmICJkZWxldGUgdGhpcyIgaW4gZmluYWwgZnVu
Y3Rpb24sIFRocmVhZEltcGw6Ol9zZWxmLmdldEtleSgpIHdpbGwgbm90IHJldHVybiB0aGUga2V5
IG9mIHJ1bm5pbmcgdGhyZWFkIGJ1dCB0aGUga2V5IG9mIG1haW4gdGhyZWFkLCBzbyB0aGUgcmVz
dWx0IG9mIGNvbXBhcmUgZXhwcmVzc2lvbiBpcyBmYWxzZSwgdGhlIHNlbWFwaG9yZSBpcyBzdGls
bCBkb3duLCBhbmQgaGVuY2UgdGhlIGpvaW4gZnVuY3Rpb24gY2FuIG5vdCBleGl0LiANCg0KSSBj
aGFuZ2VkIHRoZSBjb2RlIHRvOg0KDQouLi4NCiNpZmRlZiBXSU4zMg0KICAgIHZvaWQqIGtleSA9
IF9zZWxmLmdldEtleSgpOw0KI2Vsc2UNCiAgICB2b2lkKiBrZXkgPSBUaHJlYWRJbXBsOjpfc2Vs
Zi5nZXRLZXkoKTsNCiNlbmRpZg0KDQogICAgLy8gZmluYWwgY2FuIGNhbGwgZGVzdHJ1Y3RvciAo
dGhhdCBjYWxsIFRlcm1pbmF0ZSkNCiAgICBmaW5hbCgpOw0KDQogICAgLy8gdGVzdCBpZiB0aGlz
IGNsYXNzIGlzIHNlbGYtZXhpdGluZyB0aHJlYWQNCiAgICBpZiAoIGtleSA9PSB0aGlzICkNCiAg
ICB7DQogICAgICAgIGlmKHByaXYpDQogICAgICAgICAgICBwcml2LT5fdGlkID0gMDsNCiAgICAg
ICAgam9pblNlbS5wb3N0KCk7DQogICAgfQ0KLi4uDQoNCkl0IHdvcmtzIHdlbGwuDQoNCkJ1dCBJ
IGRvbid0IGtub3cgd2hldGhlciBJIGRvIGl0IGNvcnJlY3RseS4gTG9va2luZyBmb3J3YXJkIHRv
IHlvdXIgZmVlZGJhY2suIFRoYW5rcyENCg0KLS0NCkJlc3QgcmVnYXJkcw0KDQpCZW4gQ2hlbg0K
T3V0c291cmNpbmcNClNoYW5naGFpIENvZGV4LCBJbmMuDQpUZWw6IDg2LTIxLTUxMzE0MTA2KjEw
NjcNCmVtYWlsOiBiZW4uY2hlbkBjb2RleGNoaW5hLmNvbQ0KDQog

------=_NextPart_000_001B_01C41897.402AEDA0
Content-Type: text/html;
	charset="gb2312"
Content-Transfer-Encoding: base64

PCFET0NUWVBFIEhUTUwgUFVCTElDICItLy9XM0MvL0RURCBIVE1MIDQuMCBUcmFuc2l0aW9uYWwv
L0VOIj4NCjxIVE1MPjxIRUFEPg0KPE1FVEEgaHR0cC1lcXVpdj1Db250ZW50LVR5cGUgY29udGVu
dD0idGV4dC9odG1sOyBjaGFyc2V0PWdiMjMxMiI+DQo8TUVUQSBjb250ZW50PSJNU0hUTUwgNi4w
MC4yODAwLjEyNzYiIG5hbWU9R0VORVJBVE9SPg0KPFNUWUxFPjwvU1RZTEU+DQo8L0hFQUQ+DQo8
Qk9EWSBiZ0NvbG9yPSNmZmZmZmY+DQo8RElWPiZuYnNwOzwvRElWPg0KPERJVj5IaSwgPC9ESVY+
DQo8RElWPiZuYnNwOzwvRElWPg0KPERJVj5NeSZuYnNwO2Vudmlyb25tZW50IGlzJm5ic3A7Zysr
IDMuMi4yIDIwMDMwMjIyIG9uIFJlZGhhdCA5LjAuIENvbW1vbkNwcDIgDQoxLjEuMC48L0RJVj4N
CjxESVY+SSBkZXZpcmVkIGEgY2xhc3MgZnJvbSBUQ1BTZXNzaW9uIGFuZCBydW4gaXQsJm5ic3A7
dGhlbiBJIGZvdW5kIA0KVGhyZWFkOjpqb2luIGNhbiBub3QgZXhpdC48L0RJVj4NCjxESVY+Jm5i
c3A7PC9ESVY+DQo8RElWPmNsYXNzIHRlc3RUQ1BTZXNzaW9uIDogcHVibGljIFRDUFNlc3Npb248
L0RJVj4NCjxESVY+ezwvRElWPg0KPERJVj5wdWJsaWM6PC9ESVY+DQo8RElWPiZuYnNwOyZuYnNw
OyZuYnNwOyB0ZXN0VENQU2Vzc2lvbiguLi4pPC9ESVY+DQo8RElWPiZuYnNwOyZuYnNwOyZuYnNw
OyA6PC9ESVY+DQo8RElWPiZuYnNwOyZuYnNwOyZuYnNwOyAmbmJzcDsmbmJzcDsmbmJzcDsgVENQ
U2Vzc2lvbiguLi4pPC9ESVY+DQo8RElWPiZuYnNwOyZuYnNwOyZuYnNwOyB7PC9ESVY+DQo8RElW
PiZuYnNwOzwvRElWPg0KPERJVj4mbmJzcDsmbmJzcDsmbmJzcDsgfTwvRElWPg0KPERJVj5wcm90
ZWN0ZWQ6PC9ESVY+DQo8RElWPiZuYnNwOyZuYnNwOyZuYnNwOyB2aXJ0dWFsIHZvaWQgcnVuKCk8
L0RJVj4NCjxESVY+Jm5ic3A7Jm5ic3A7Jm5ic3A7IHs8L0RJVj4NCjxESVY+Jm5ic3A7Jm5ic3A7
Jm5ic3A7ICZuYnNwOyZuYnNwOyZuYnNwOyAuLi48L0RJVj4NCjxESVY+Jm5ic3A7Jm5ic3A7Jm5i
c3A7IH08L0RJVj4NCjxESVY+fTs8L0RJVj4NCjxESVY+Jm5ic3A7PC9ESVY+DQo8RElWPmludCBt
YWluKCk8L0RJVj4NCjxESVY+ezwvRElWPg0KPERJVj4mbmJzcDsmbmJzcDsmbmJzcDsgdGVzdFRD
UFNlc3Npb24qIHAgPSBuZXcgdGVzdFRDUFNlc3Npb24oLi4uKTs8L0RJVj4NCjxESVY+Jm5ic3A7
Jm5ic3A7Jm5ic3A7IHAtJmd0O2RldGFjaCgpOzwvRElWPg0KPERJVj4mbmJzcDsmbmJzcDsmbmJz
cDsgcC0mZ3Q7VGhyZWFkOjpqb2luKCk7PC9ESVY+DQo8RElWPiZuYnNwOzwvRElWPg0KPERJVj4m
bmJzcDsmbmJzcDsmbmJzcDsgcmV0dXJuIDA7PC9ESVY+DQo8RElWPn08L0RJVj4NCjxESVY+Jm5i
c3A7PC9ESVY+DQo8RElWPiZuYnNwOzwvRElWPg0KPERJVj4mbmJzcDs8L0RJVj4NCjxESVY+Jm5i
c3A7PC9ESVY+DQo8RElWPkkgY2hlY2tlZCB0aGUgc291cmNlIGNvZGUsIGluIFRocmVhZDo6Y2xv
c2UoKSwgPC9ESVY+DQo8RElWPiZuYnNwOzwvRElWPg0KPERJVj4uLi48L0RJVj4NCjxESVY+Jm5i
c3A7Jm5ic3A7Jm5ic3A7IC8vIGZpbmFsIGNhbiBjYWxsIGRlc3RydWN0b3IgKHRoYXQgY2FsbCAN
ClRlcm1pbmF0ZSk8QlI+Jm5ic3A7Jm5ic3A7Jm5ic3A7IGZpbmFsKCk7PC9ESVY+DQo8RElWPiZu
YnNwOzwvRElWPg0KPERJVj4mbmJzcDsmbmJzcDsmbmJzcDsgLy8gdGVzdCBpZiB0aGlzIGNsYXNz
IGlzIHNlbGYtZXhpdGluZyB0aHJlYWQ8QlI+PEZPTlQgDQpjb2xvcj0jMDAwMGZmPiNpZmRlZiBX
SU4zMjxCUj4mbmJzcDsmbmJzcDsmbmJzcDsgaWYgKF9zZWxmLmdldEtleSgpID09IA0KdGhpcyk8
QlI+I2Vsc2U8QlI+Jm5ic3A7Jm5ic3A7Jm5ic3A7IGlmIChUaHJlYWRJbXBsOjpfc2VsZi5nZXRL
ZXkoKSA9PSANCnRoaXMpPEJSPiNlbmRpZjxCUj48L0ZPTlQ+Jm5ic3A7Jm5ic3A7Jm5ic3A7IHs8
L0RJVj4NCjxESVY+Jm5ic3A7Jm5ic3A7Jm5ic3A7ICZuYnNwOyZuYnNwOyZuYnNwOyBpZihwcml2
KTxCUj4mbmJzcDsmbmJzcDsmbmJzcDsgDQombmJzcDsmbmJzcDsmbmJzcDsgJm5ic3A7Jm5ic3A7
Jm5ic3A7IHByaXYtJmd0O190aWQgPSANCjA7PEJSPiZuYnNwOyZuYnNwOyZuYnNwOyZuYnNwOyZu
YnNwOyZuYnNwOyZuYnNwOyZuYnNwO2pvaW5TZW0ucG9zdCgpOzxCUj4mbmJzcDsmbmJzcDsmbmJz
cDsgDQp9PC9ESVY+DQo8RElWPi4uLjwvRElWPg0KPERJVj4mbmJzcDs8L0RJVj4NCjxESVY+Jm5i
c3A7PC9ESVY+DQo8RElWPiZuYnNwOzwvRElWPg0KPERJVj5JZiAiZGVsZXRlIHRoaXMiIGluIGZp
bmFsIGZ1bmN0aW9uLCA8Rk9OVCBjb2xvcj0jMDAwMGZmPjxGT05UIA0KY29sb3I9IzAwMDAwMD5U
aHJlYWRJbXBsOjpfc2VsZi5nZXRLZXkoKTwvRk9OVD4gPC9GT05UPjxGT05UIGNvbG9yPSMwMDAw
MDA+d2lsbCANCm5vdCByZXR1cm4gdGhlIGtleSBvZiBydW5uaW5nIHRocmVhZCBidXQgdGhlIGtl
eSBvZiBtYWluIHRocmVhZCwmbmJzcDtzbyB0aGUgDQpyZXN1bHQgb2YgY29tcGFyZSBleHByZXNz
aW9uIGlzIGZhbHNlLCZuYnNwO3RoZSBzZW1hcGhvcmUgaXMgc3RpbGwgZG93biwgYW5kIA0KaGVu
Y2UgdGhlIGpvaW4gZnVuY3Rpb24gY2FuIG5vdCBleGl0LiA8L0ZPTlQ+PC9ESVY+DQo8RElWPiZu
YnNwOzwvRElWPg0KPERJVj5JIGNoYW5nZWQgdGhlIGNvZGUgdG86PC9ESVY+DQo8RElWPiZuYnNw
OzwvRElWPg0KPERJVj4uLi48L0RJVj4NCjxESVY+PEZPTlQgY29sb3I9IzAwMDBmZj4jaWZkZWYg
V0lOMzI8QlI+Jm5ic3A7Jm5ic3A7Jm5ic3A7IHZvaWQqIGtleSA9IA0KX3NlbGYuZ2V0S2V5KCk7
PEJSPiNlbHNlPEJSPiZuYnNwOyZuYnNwOyZuYnNwOyB2b2lkKiBrZXkgDQo9Jm5ic3A7VGhyZWFk
SW1wbDo6X3NlbGYuZ2V0S2V5KCk7PEJSPiNlbmRpZjwvRk9OVD48L0RJVj4NCjxESVY+PEZPTlQg
Y29sb3I9IzAwMDBmZj48L0ZPTlQ+Jm5ic3A7PC9ESVY+DQo8RElWPg0KPERJVj4mbmJzcDsmbmJz
cDsmbmJzcDsgLy8gZmluYWwgY2FuIGNhbGwgZGVzdHJ1Y3RvciAodGhhdCBjYWxsIA0KVGVybWlu
YXRlKTxCUj4mbmJzcDsmbmJzcDsmbmJzcDsgZmluYWwoKTs8L0RJVj4NCjxESVY+Jm5ic3A7PC9E
SVY+DQo8RElWPiZuYnNwOyZuYnNwOyZuYnNwOyAvLyB0ZXN0IGlmIHRoaXMgY2xhc3MgaXMgc2Vs
Zi1leGl0aW5nIHRocmVhZDxCUj48Rk9OVCANCmNvbG9yPSMwMDAwZmY+Jm5ic3A7Jm5ic3A7Jm5i
c3A7IGlmICgga2V5ID09IHRoaXMgKTwvRk9OVD48QlI+Jm5ic3A7Jm5ic3A7Jm5ic3A7IA0KezxC
Uj4mbmJzcDsmbmJzcDsmbmJzcDsgJm5ic3A7Jm5ic3A7Jm5ic3A7IA0KaWYocHJpdik8QlI+Jm5i
c3A7Jm5ic3A7Jm5ic3A7Jm5ic3A7Jm5ic3A7Jm5ic3A7Jm5ic3A7Jm5ic3A7Jm5ic3A7Jm5ic3A7
Jm5ic3A7IA0KcHJpdi0mZ3Q7X3RpZCA9IDA7PC9ESVY+DQo8RElWPiZuYnNwOyZuYnNwOyZuYnNw
OyAmbmJzcDsmbmJzcDsmbmJzcDsgam9pblNlbS5wb3N0KCk7PEJSPiZuYnNwOyZuYnNwOyZuYnNw
OyANCn08L0RJVj48L0RJVj4NCjxESVY+Li4uPC9ESVY+DQo8RElWPiZuYnNwOzwvRElWPg0KPERJ
Vj5JdCB3b3JrcyB3ZWxsLjwvRElWPg0KPERJVj4mbmJzcDs8L0RJVj4NCjxESVY+QnV0IEkgZG9u
J3Qga25vdyB3aGV0aGVyIEkgZG8gaXQgY29ycmVjdGx5LiBMb29raW5nIGZvcndhcmQgdG8geW91
ciANCmZlZWRiYWNrLiBUaGFua3MhPC9ESVY+DQo8RElWPiZuYnNwOzwvRElWPg0KPERJVj4tLTxC
Uj5CZXN0IHJlZ2FyZHM8L0RJVj4NCjxESVY+Jm5ic3A7PC9ESVY+DQo8RElWPkJlbiBDaGVuPEJS
Pk91dHNvdXJjaW5nPEJSPlNoYW5naGFpIENvZGV4LCBJbmMuPEJSPlRlbDogDQo4Ni0yMS01MTMx
NDEwNioxMDY3PEJSPmVtYWlsOiA8QSANCmhyZWY9Im1haWx0bzpiZW4uY2hlbkBjb2RleGNoaW5h
LmNvbSI+YmVuLmNoZW5AY29kZXhjaGluYS5jb208L0E+PC9ESVY+DQo8RElWPjxCUj4mbmJzcDs8
L0RJVj48L0JPRFk+PC9IVE1MPg0K

------=_NextPart_000_001B_01C41897.402AEDA0--




From MAILER-DAEMON Fri Apr 02 03:48:43 2004
Received: from list by monty-python.gnu.org with archive (Exim 4.30)
	id 1B9KLy-0001nq-2r
	for mharc-bug-commoncpp@gnu.org; Fri, 02 Apr 2004 03:48:42 -0500
Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30)
	id 1B9KLq-0001jI-Ep
	for bug-commoncpp@gnu.org; Fri, 02 Apr 2004 03:48:34 -0500
Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30)
	id 1B9KLF-0001Vs-1W
	for bug-commoncpp@gnu.org; Fri, 02 Apr 2004 03:48:28 -0500
Received: from [216.218.222.122] (helo=mail.ostel.com)
	by monty-python.gnu.org with esmtp (Exim 4.30) id 1B9K75-00088W-Bk
	for bug-commoncpp@gnu.org; Fri, 02 Apr 2004 03:33:19 -0500
Received: by mail.ostel.com (Postfix, from userid 1005)
	id 4AA332F286D; Fri,  2 Apr 2004 00:36:17 -0800 (PST)
Received: from 192.168.1.102 (pool-138-89-45-226.mad.east.verizon.net
	[138.89.45.226]) by mail.ostel.com (Postfix) with ESMTP
	id 2D9962F2867; Fri,  2 Apr 2004 00:36:13 -0800 (PST)
From: David Sugar <dyfet@ostel.com>
To: "Ben.Chen" <Ben.Chen@codexchina.com>, <bug-commoncpp@gnu.org>
Date: Thu, 1 Apr 2004 15:35:43 -0500
User-Agent: KMail/1.5.3
References: <001e01c41854$32112380$2e1210ac@codexchina.com>
In-Reply-To: <001e01c41854$32112380$2e1210ac@codexchina.com>
MIME-Version: 1.0
Content-Type: text/plain;
  charset="gb2312"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Message-Id: <200404011535.43566.dyfet@ostel.com>
Cc: 
Subject: Re: Thread::join can not exit
X-BeenThere: bug-commoncpp@gnu.org
X-Mailman-Version: 2.1.4
Precedence: list
List-Id: Bug reports for Common C++ <bug-commoncpp.gnu.org>
List-Unsubscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=unsubscribe>
List-Archive: <http://mail.gnu.org/pipermail/bug-commoncpp>
List-Post: <mailto:bug-commoncpp@gnu.org>
List-Help: <mailto:bug-commoncpp-request@gnu.org?subject=help>
List-Subscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=subscribe>
X-List-Received-Date: Fri, 02 Apr 2004 08:48:37 -0000

I believe this was resolved a different way in 1.1.1/1.1.2.  Basically if you 
create a "detached" threat (using detach rather than start), it would 
automatically self delete as it exits, and without the need to use a "delete 
this" in final. 

On Thursday 01 April 2004 08:45 pm, Ben.Chen wrote:
> Hi,
>
> My environment is g++ 3.2.2 20030222 on Redhat 9.0. CommonCpp2 1.1.0.
> I devired a class from TCPSession and run it, then I found Thread::join can
> not exit.
>
> class testTCPSession : public TCPSession
> {
> public:
>     testTCPSession(...)
>
>         TCPSession(...)
>     {
>
>     }
> protected:
>     virtual void run()
>     {
>         ...
>     }
> };
>
> int main()
> {
>     testTCPSession* p = new testTCPSession(...);
>     p->detach();
>     p->Thread::join();
>
>     return 0;
> }
>
>
>
>
> I checked the source code, in Thread::close(),
>
> ...
>     // final can call destructor (that call Terminate)
>     final();
>
>     // test if this class is self-exiting thread
> #ifdef WIN32
>     if (_self.getKey() == this)
> #else
>     if (ThreadImpl::_self.getKey() == this)
> #endif
>     {
>         if(priv)
>             priv->_tid = 0;
>         joinSem.post();
>     }
> ...
>
>
>
> If "delete this" in final function, ThreadImpl::_self.getKey() will not
> return the key of running thread but the key of main thread, so the result
> of compare expression is false, the semaphore is still down, and hence the
> join function can not exit.
>
> I changed the code to:
>
> ...
> #ifdef WIN32
>     void* key = _self.getKey();
> #else
>     void* key = ThreadImpl::_self.getKey();
> #endif
>
>     // final can call destructor (that call Terminate)
>     final();
>
>     // test if this class is self-exiting thread
>     if ( key == this )
>     {
>         if(priv)
>             priv->_tid = 0;
>         joinSem.post();
>     }
> ...
>
> It works well.
>
> But I don't know whether I do it correctly. Looking forward to your
> feedback. Thanks!
>
> --
> Best regards
>
> Ben Chen
> Outsourcing
> Shanghai Codex, Inc.
> Tel: 86-21-51314106*1067
> email: ben.chen@codexchina.com




From MAILER-DAEMON Fri Apr 02 18:10:04 2004
Received: from list by monty-python.gnu.org with archive (Exim 4.30)
	id 1B9XnX-00049z-Ny
	for mharc-bug-commoncpp@gnu.org; Fri, 02 Apr 2004 18:10:03 -0500
Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30)
	id 1B9XnU-00048H-MF
	for bug-commoncpp@gnu.org; Fri, 02 Apr 2004 18:10:00 -0500
Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30)
	id 1B9Xmq-0003rT-TY
	for bug-commoncpp@gnu.org; Fri, 02 Apr 2004 18:09:52 -0500
Received: from [66.185.86.72] (helo=fep02-mail.bloor.is.net.cable.rogers.com)
	by monty-python.gnu.org with esmtp (Exim 4.30) id 1B9Xmq-0003qk-Ch
	for bug-commoncpp@gnu.org; Fri, 02 Apr 2004 18:09:20 -0500
Received: from chatgris.no-ip.com ([24.112.132.225])
	by fep02-mail.bloor.is.net.cable.rogers.com
	(InterMail vM.5.01.05.12 201-253-122-126-112-20020820) with ESMTP id
	<20040402230806.FTGZ39251.fep02-mail.bloor.is.net.cable.rogers.com@chatgris.no-ip.com>
	for <bug-commoncpp@gnu.org>; Fri, 2 Apr 2004 18:08:06 -0500
From: Joshua Moore-Oliva <josh@chatgris.com>
To: bug-commoncpp@gnu.org
Date: Fri, 2 Apr 2004 18:07:37 -0500
User-Agent: KMail/1.6.1
MIME-Version: 1.0
Content-Disposition: inline
Content-Type: text/plain;
  charset="us-ascii"
Content-Transfer-Encoding: 7bit
Message-Id: <200404021807.37103.josh@chatgris.com>
X-Authentication-Info: Submitted using SMTP AUTH PLAIN at
	fep02-mail.bloor.is.net.cable.rogers.com from [24.112.132.225]
	using ID <janetteoliva@rogers.com> at Fri,
	2 Apr 2004 18:08:06 -0500
Subject: Memory leaks in common cpp.
X-BeenThere: bug-commoncpp@gnu.org
X-Mailman-Version: 2.1.4
Precedence: list
List-Id: Bug reports for Common C++ <bug-commoncpp.gnu.org>
List-Unsubscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=unsubscribe>
List-Archive: <http://mail.gnu.org/pipermail/bug-commoncpp>
List-Post: <mailto:bug-commoncpp@gnu.org>
List-Help: <mailto:bug-commoncpp-request@gnu.org?subject=help>
List-Subscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=subscribe>
X-List-Received-Date: Fri, 02 Apr 2004 23:10:02 -0000

I am not sure if I need to call a function at the end of my program ala apr style (apr_terminate()) or if this is a memory leak in gnu common c++ but there
are two memory leaks when I just link a program to gnucpp...

I would really like to get rid of these..

Thanks, Joshua Moore-Oliva

200 bytes in 1 blocks are definitely lost in loss record 1 of 3
==7196==    at 0x402E2D63: (within /usr/lib/valgrind/libpthread.so)
==7196==    by 0x402E4B21: (within /usr/lib/valgrind/libpthread.so)
==7196==    by 0x402E4C4A: __pthread_key_create (in /usr/lib/valgrind/libpthread.so)
==7196==    by 0x40261186: ost::ThreadKey::ThreadKey(void (*)(void*)) (in /usr/lib/libccgnu2-1.0.so.0.0.11)
==7196==    by 0x4025F77C: (within /usr/lib/libccgnu2-1.0.so.0.0.11)
==7196==    by 0x4025F87A: (within /usr/lib/libccgnu2-1.0.so.0.0.11)
==7196==    by 0x40276FC4: (within /usr/lib/libccgnu2-1.0.so.0.0.11)
==7196==    by 0x4025C2F0: (within /usr/lib/libccgnu2-1.0.so.0.0.11)
==7196==    by 0x4000B78D: (within /lib/ld-2.3.2.so)
==7196==    by 0x4000B879: _dl_init (in /lib/ld-2.3.2.so)
==7196==    by 0x40000A24: (within /lib/ld-2.3.2.so)
==7196==
==7196==
==7196== 212 bytes in 1 blocks are still reachable in loss record 2 of 3
==7196==    at 0x4002ADFE: operator new(unsigned) (in /usr/lib/valgrind/vgskin_memcheck.so)
==7196==    by 0x4025DDB5: ost::Thread::Thread(bool) (in /usr/lib/libccgnu2-1.0.so.0.0.11)
==7196==    by 0x4025F7B4: (within /usr/lib/libccgnu2-1.0.so.0.0.11)
==7196==    by 0x4025F87A: (within /usr/lib/libccgnu2-1.0.so.0.0.11)
==7196==    by 0x40276FC4: (within /usr/lib/libccgnu2-1.0.so.0.0.11)
==7196==    by 0x4025C2F0: (within /usr/lib/libccgnu2-1.0.so.0.0.11)
==7196==    by 0x4000B78D: (within /lib/ld-2.3.2.so)
==7196==    by 0x4000B879: _dl_init (in /lib/ld-2.3.2.so)
==7196==    by 0x40000A24: (within /lib/ld-2.3.2.so)



From MAILER-DAEMON Sat Apr 03 06:28:29 2004
Received: from list by monty-python.gnu.org with archive (Exim 4.30)
	id 1B9jK7-0007H3-Ew
	for mharc-bug-commoncpp@gnu.org; Sat, 03 Apr 2004 06:28:27 -0500
Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30)
	id 1B9jJx-00074F-7m
	for bug-commoncpp@gnu.org; Sat, 03 Apr 2004 06:28:17 -0500
Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30)
	id 1B9jJC-0006H7-Sl
	for bug-commoncpp@gnu.org; Sat, 03 Apr 2004 06:28:03 -0500
Received: from [216.218.222.122] (helo=mail.ostel.com)
	by monty-python.gnu.org with esmtp (Exim 4.30) id 1B9jJB-0006ED-N0
	for bug-commoncpp@gnu.org; Sat, 03 Apr 2004 06:27:29 -0500
Received: by mail.ostel.com (Postfix, from userid 1005)
	id DAF162F2867; Sat,  3 Apr 2004 03:30:35 -0800 (PST)
Received: from 192.168.1.102 (pool-138-89-45-226.mad.east.verizon.net
	[138.89.45.226]) by mail.ostel.com (Postfix) with ESMTP
	id 9ECCF2F286D; Sat,  3 Apr 2004 03:30:31 -0800 (PST)
From: David Sugar <dyfet@ostel.com>
To: Joshua Moore-Oliva <josh@chatgris.com>, bug-commoncpp@gnu.org
Date: Fri, 2 Apr 2004 18:29:55 -0500
User-Agent: KMail/1.5.3
References: <200404021807.37103.josh@chatgris.com>
In-Reply-To: <200404021807.37103.josh@chatgris.com>
MIME-Version: 1.0
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Message-Id: <200404021829.55432.dyfet@ostel.com>
Cc: 
Subject: Re: Memory leaks in common cpp.
X-BeenThere: bug-commoncpp@gnu.org
X-Mailman-Version: 2.1.4
Precedence: list
List-Id: Bug reports for Common C++ <bug-commoncpp.gnu.org>
List-Unsubscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=unsubscribe>
List-Archive: <http://mail.gnu.org/pipermail/bug-commoncpp>
List-Post: <mailto:bug-commoncpp@gnu.org>
List-Help: <mailto:bug-commoncpp-request@gnu.org?subject=help>
List-Subscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sat, 03 Apr 2004 11:28:22 -0000

This looks like a 1.0.11 release.  Does this still happen in 1.1.2?  I know of 
several memory leaks that were found and fixed in 1.1.0 and 1.1.1.

On Friday 02 April 2004 06:07 pm, Joshua Moore-Oliva wrote:
> I am not sure if I need to call a function at the end of my program ala apr
> style (apr_terminate()) or if this is a memory leak in gnu common c++ but
> there are two memory leaks when I just link a program to gnucpp...
>
> I would really like to get rid of these..
>
> Thanks, Joshua Moore-Oliva
>
> 200 bytes in 1 blocks are definitely lost in loss record 1 of 3
> ==7196==    at 0x402E2D63: (within /usr/lib/valgrind/libpthread.so)
> ==7196==    by 0x402E4B21: (within /usr/lib/valgrind/libpthread.so)
> ==7196==    by 0x402E4C4A: __pthread_key_create (in
> /usr/lib/valgrind/libpthread.so) ==7196==    by 0x40261186:
> ost::ThreadKey::ThreadKey(void (*)(void*)) (in
> /usr/lib/libccgnu2-1.0.so.0.0.11) ==7196==    by 0x4025F77C: (within
> /usr/lib/libccgnu2-1.0.so.0.0.11) ==7196==    by 0x4025F87A: (within
> /usr/lib/libccgnu2-1.0.so.0.0.11) ==7196==    by 0x40276FC4: (within
> /usr/lib/libccgnu2-1.0.so.0.0.11) ==7196==    by 0x4025C2F0: (within
> /usr/lib/libccgnu2-1.0.so.0.0.11) ==7196==    by 0x4000B78D: (within
> /lib/ld-2.3.2.so)
> ==7196==    by 0x4000B879: _dl_init (in /lib/ld-2.3.2.so)
> ==7196==    by 0x40000A24: (within /lib/ld-2.3.2.so)
> ==7196==
> ==7196==
> ==7196== 212 bytes in 1 blocks are still reachable in loss record 2 of 3
> ==7196==    at 0x4002ADFE: operator new(unsigned) (in
> /usr/lib/valgrind/vgskin_memcheck.so) ==7196==    by 0x4025DDB5:
> ost::Thread::Thread(bool) (in /usr/lib/libccgnu2-1.0.so.0.0.11) ==7196==   
> by 0x4025F7B4: (within /usr/lib/libccgnu2-1.0.so.0.0.11) ==7196==    by
> 0x4025F87A: (within /usr/lib/libccgnu2-1.0.so.0.0.11) ==7196==    by
> 0x40276FC4: (within /usr/lib/libccgnu2-1.0.so.0.0.11) ==7196==    by
> 0x4025C2F0: (within /usr/lib/libccgnu2-1.0.so.0.0.11) ==7196==    by
> 0x4000B78D: (within /lib/ld-2.3.2.so)
> ==7196==    by 0x4000B879: _dl_init (in /lib/ld-2.3.2.so)
> ==7196==    by 0x40000A24: (within /lib/ld-2.3.2.so)
>
>
> _______________________________________________
> Bug-commoncpp mailing list
> Bug-commoncpp@gnu.org
> http://mail.gnu.org/mailman/listinfo/bug-commoncpp




From MAILER-DAEMON Mon Apr 05 12:16:25 2004
Received: from list by monty-python.gnu.org with archive (Exim 4.30)
	id 1BAWlt-0000iq-PQ
	for mharc-bug-commoncpp@gnu.org; Mon, 05 Apr 2004 12:16:25 -0400
Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30)
	id 1BAWlq-0000hB-Hl
	for bug-commoncpp@gnu.org; Mon, 05 Apr 2004 12:16:22 -0400
Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30)
	id 1BAWlH-0000Ub-1V
	for bug-commoncpp@gnu.org; Mon, 05 Apr 2004 12:16:19 -0400
Received: from [216.68.248.32] (helo=Milcor21.milacron.com)
	by monty-python.gnu.org with esmtp (Exim 4.30) id 1BAWlG-0000Tr-He
	for bug-commoncpp@gnu.org; Mon, 05 Apr 2004 12:15:46 -0400
Received: from dmeusmail.dmeus.milacron.com ([143.62.132.57]) by
	Milcor21.milacron.com with Microsoft SMTPSVC(5.0.2195.6713); 
	Mon, 5 Apr 2004 12:15:44 -0400
Received: by dmeusmail.dmeus.milacron.com with Internet Mail Service
	(5.5.2657.72) id <2GMSQ7JK>; Mon, 5 Apr 2004 12:15:44 -0400
Message-ID: <EF398F42BE1BDF479B1E481F6E0053F201C97DA4@dmeusmail.dmeus.milacron.com>
From: erik_ohrnberger@dme.net
To: bug-commoncpp@gnu.org
Date: Mon, 5 Apr 2004 12:15:36 -0400 
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2657.72)
Content-Type: text/plain;
	charset="iso-8859-1"
X-OriginalArrivalTime: 05 Apr 2004 16:15:44.0818 (UTC)
	FILETIME=[3F9E8920:01C41B29]
Subject: ost::String class release 1.1.1
X-BeenThere: bug-commoncpp@gnu.org
X-Mailman-Version: 2.1.4
Precedence: list
List-Id: Bug reports for Common C++ <bug-commoncpp.gnu.org>
List-Unsubscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=unsubscribe>
List-Archive: <http://mail.gnu.org/pipermail/bug-commoncpp>
List-Post: <mailto:bug-commoncpp@gnu.org>
List-Help: <mailto:bug-commoncpp-request@gnu.org?subject=help>
List-Subscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 05 Apr 2004 16:16:24 -0000

Everyone,
	I'm noticing instances of seg faults in the ost::String::getSpace()
method, where the *text variable is assigned what appears to be random
garbage, and is yet used as a pointer into some data structure.

	Has anyone else experienced a similar failure?

	Is there a patch to the ost::String class that needs to be applied?

	Thanks,
		Erik.



From MAILER-DAEMON Mon Apr 05 13:49:35 2004
Received: from list by monty-python.gnu.org with archive (Exim 4.30)
	id 1BAYE3-0004y1-FF
	for mharc-bug-commoncpp@gnu.org; Mon, 05 Apr 2004 13:49:35 -0400
Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30)
	id 1BAYDz-0004w2-Ux
	for bug-commoncpp@gnu.org; Mon, 05 Apr 2004 13:49:31 -0400
Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30)
	id 1BAYDS-0004mM-Rb
	for bug-commoncpp@gnu.org; Mon, 05 Apr 2004 13:49:29 -0400
Received: from [216.68.248.32] (helo=Milcor21.milacron.com)
	by monty-python.gnu.org with esmtp (Exim 4.30) id 1BAYCf-0004gE-Aa
	for bug-commoncpp@gnu.org; Mon, 05 Apr 2004 13:48:09 -0400
Received: from dmeusmail.dmeus.milacron.com ([143.62.132.57]) by
	Milcor21.milacron.com with Microsoft SMTPSVC(5.0.2195.6713); 
	Mon, 5 Apr 2004 13:48:08 -0400
Received: by dmeusmail.dmeus.milacron.com with Internet Mail Service
	(5.5.2657.72) id <2GMSQ7L0>; Mon, 5 Apr 2004 13:48:07 -0400
Message-ID: <EF398F42BE1BDF479B1E481F6E0053F201C97DA9@dmeusmail.dmeus.milacron.com>
From: erik_ohrnberger@dme.net
To: bug-commoncpp@gnu.org
Date: Mon, 5 Apr 2004 13:48:04 -0400 
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2657.72)
Content-Type: text/plain;
	charset="iso-8859-1"
X-OriginalArrivalTime: 05 Apr 2004 17:48:08.0504 (UTC)
	FILETIME=[27E9E380:01C41B36]
Subject: RE: ost::String class release 1.1.1
X-BeenThere: bug-commoncpp@gnu.org
X-Mailman-Version: 2.1.4
Precedence: list
List-Id: Bug reports for Common C++ <bug-commoncpp.gnu.org>
List-Unsubscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=unsubscribe>
List-Archive: <http://mail.gnu.org/pipermail/bug-commoncpp>
List-Post: <mailto:bug-commoncpp@gnu.org>
List-Help: <mailto:bug-commoncpp-request@gnu.org?subject=help>
List-Subscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 05 Apr 2004 17:49:33 -0000

David,
 635 char *String::getSpace(unsigned size)
 636 {
 637     unsigned        slot;
 638     char*           text = NULL;
 639     char**          next;
 640 
 641     if(size > slotlimit)
 642         return new char[size];
 643 
 644     slot = size / slotsize;
 645     mutex.enterMutex();
 646     if(!pager)
 647     {
 648         pager = new MemPager(pagesize);
 649         idx = (char **)pager->alloc(sizeof(char *) * slots);
 650         memset(idx, 0, sizeof(char *) * slots);
 651     }
 652     text = idx[slot];
 653     if(text)
 654     {
 655         next = (char **)text;
 656         idx[slot] = *next;
 657     }
 658     else
 659         text = (char *)pager->alloc(++slot * slotsize);
 660     mutex.leaveMutex();
 661     return text;
 662 }

Right on line 656.  
slot = 1
text = 0x32353964 <Address 0x32353964 out of bounds>
size = 1076041732

I think that size must be way off (duh).  OK, so where'd that come from?

 407 void String::copy(const String &original)
 408 {
 409     char *ptr;
 410     content = original.content;
 411 
 412     if(!isBig())
 413         return;
 414 
 415     if(getLength() < minsize)
 416     {
 417         content.ministring.length = getLength();
 418         memcpy(content.ministring.text, getText(), getLength() + 1);
 419         content.ministring.big = false;
 420         return;
 421     }
 422 
 423     ptr = getText();
 424     content.bigstring.size = setSize(content.bigstring.length + 1);
 425     content.bigstring.text = getSpace(getSize());
 426     memcpy(content.bigstring.text, ptr, getLength() + 1);
 427 }

at line 425
getLength() = 8
ptr is pointing to a valid string of text.
content.bigstring.size = 32

Hmm.  Hope that this helps, I'm afraid that I've not studied this String
class sufficiently to diagnose this at the moment.  Perhaps you'l ahve some
insights?

	Thanks,
		Erik.

> -----Original Message-----
> From: David Sugar [mailto:dyfet@ostel.com]
> Sent: Monday, April 05, 2004 1:27 AM
> To: Ohrnberger, Erik; bug-commoncpp@gnu.org
> Subject: Re: ost::String class release 1.1.1
> 
> 
> Hmm...
> 
> text is either assigned from a slot list (linked list) or 
> from mempager 
> alloc'd memory.  If the linked list is messed up, that is one 
> possibility.  
> However, the other option is if the string is too large, a 
> simple new is 
> used, and text is never modified.  Text is not initialized 
> because it does 
> not need a value until it needs to be assigned from the list or from 
> mempager.  Hence, it would help to know more about where 
> precisely this 
> segfault occurs.  One thing you can do is initially set text 
> to NULL at the 
> start of getSpace, as that would make it easier to determine 
> what the real 
> state of text is at the time it happens; whether its before 
> or after it has 
> been assigned by something.
> 
> On Monday 05 April 2004 12:15 pm, erik_ohrnberger@dme.net wrote:
> > Everyone,
> > 	I'm noticing instances of seg faults in the 
> ost::String::getSpace()
> > method, where the *text variable is assigned what appears 
> to be random
> > garbage, and is yet used as a pointer into some data structure.
> >
> > 	Has anyone else experienced a similar failure?
> >
> > 	Is there a patch to the ost::String class that needs to 
> be applied?
> >
> > 	Thanks,
> > 		Erik.
> >
> >
> > _______________________________________________
> > Bug-commoncpp mailing list
> > Bug-commoncpp@gnu.org
> > http://mail.gnu.org/mailman/listinfo/bug-commoncpp
> 
> 



From MAILER-DAEMON Mon Apr 05 13:57:26 2004
Received: from list by monty-python.gnu.org with archive (Exim 4.30)
	id 1BAYLe-0007mi-04
	for mharc-bug-commoncpp@gnu.org; Mon, 05 Apr 2004 13:57:26 -0400
Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30)
	id 1BAYLa-0007kg-PN
	for bug-commoncpp@gnu.org; Mon, 05 Apr 2004 13:57:22 -0400
Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30)
	id 1BAYL3-0007W0-8T
	for bug-commoncpp@gnu.org; Mon, 05 Apr 2004 13:57:20 -0400
Received: from [199.232.41.8] (helo=mx20.gnu.org)
	by monty-python.gnu.org with esmtp (TLSv1:DES-CBC3-SHA:168)
	(Exim 4.30) id 1BAYJC-0006ol-CH
	for bug-commoncpp@gnu.org; Mon, 05 Apr 2004 13:54:54 -0400
Received: from [216.218.222.122] (helo=mail.ostel.com)
	by mx20.gnu.org with esmtp (Exim 4.30) id 1BAXpU-0001xR-GK
	for bug-commoncpp@gnu.org; Mon, 05 Apr 2004 13:24:12 -0400
Received: by mail.ostel.com (Postfix, from userid 1005)
	id 9D27F2F2883; Mon,  5 Apr 2004 10:24:15 -0700 (PDT)
Received: from 192.168.1.102 (pool-138-89-45-226.mad.east.verizon.net
	[138.89.45.226]) by mail.ostel.com (Postfix) with ESMTP
	id E13782F2867; Mon,  5 Apr 2004 10:24:08 -0700 (PDT)
From: David Sugar <dyfet@ostel.com>
To: erik_ohrnberger@dme.net, bug-commoncpp@gnu.org
Date: Mon, 5 Apr 2004 01:26:33 -0400
User-Agent: KMail/1.5.3
References: <EF398F42BE1BDF479B1E481F6E0053F201C97DA4@dmeusmail.dmeus.milacron.com>
In-Reply-To: <EF398F42BE1BDF479B1E481F6E0053F201C97DA4@dmeusmail.dmeus.milacron.com>
MIME-Version: 1.0
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Message-Id: <200404050126.33762.dyfet@ostel.com>
Cc: 
Subject: Re: ost::String class release 1.1.1
X-BeenThere: bug-commoncpp@gnu.org
X-Mailman-Version: 2.1.4
Precedence: list
List-Id: Bug reports for Common C++ <bug-commoncpp.gnu.org>
List-Unsubscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=unsubscribe>
List-Archive: <http://mail.gnu.org/pipermail/bug-commoncpp>
List-Post: <mailto:bug-commoncpp@gnu.org>
List-Help: <mailto:bug-commoncpp-request@gnu.org?subject=help>
List-Subscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 05 Apr 2004 17:57:24 -0000

Hmm...

text is either assigned from a slot list (linked list) or from mempager 
alloc'd memory.  If the linked list is messed up, that is one possibility.  
However, the other option is if the string is too large, a simple new is 
used, and text is never modified.  Text is not initialized because it does 
not need a value until it needs to be assigned from the list or from 
mempager.  Hence, it would help to know more about where precisely this 
segfault occurs.  One thing you can do is initially set text to NULL at the 
start of getSpace, as that would make it easier to determine what the real 
state of text is at the time it happens; whether its before or after it has 
been assigned by something.

On Monday 05 April 2004 12:15 pm, erik_ohrnberger@dme.net wrote:
> Everyone,
> 	I'm noticing instances of seg faults in the ost::String::getSpace()
> method, where the *text variable is assigned what appears to be random
> garbage, and is yet used as a pointer into some data structure.
>
> 	Has anyone else experienced a similar failure?
>
> 	Is there a patch to the ost::String class that needs to be applied?
>
> 	Thanks,
> 		Erik.
>
>
> _______________________________________________
> Bug-commoncpp mailing list
> Bug-commoncpp@gnu.org
> http://mail.gnu.org/mailman/listinfo/bug-commoncpp




From MAILER-DAEMON Mon Apr 05 14:08:59 2004
Received: from list by monty-python.gnu.org with archive (Exim 4.30)
	id 1BAYVl-0006gg-Te
	for mharc-bug-commoncpp@gnu.org; Mon, 05 Apr 2004 14:07:53 -0400
Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30)
	id 1BAYVF-00065J-SJ
	for bug-commoncpp@gnu.org; Mon, 05 Apr 2004 14:07:22 -0400
Received: from [216.218.222.122] (helo=mail.ostel.com)
	by monty-python.gnu.org with esmtp (Exim 4.30) id 1BAYUx-0005hW-47
	for bug-commoncpp@gnu.org; Mon, 05 Apr 2004 14:07:03 -0400
Received: by mail.ostel.com (Postfix, from userid 1005)
	id 60FE42F2883; Mon,  5 Apr 2004 11:07:14 -0700 (PDT)
Received: from 192.168.1.102 (pool-138-89-45-226.mad.east.verizon.net
	[138.89.45.226]) by mail.ostel.com (Postfix) with ESMTP
	id 7E6B62F2867; Mon,  5 Apr 2004 11:07:12 -0700 (PDT)
From: David Sugar <dyfet@ostel.com>
To: erik_ohrnberger@dme.net, bug-commoncpp@gnu.org
Date: Mon, 5 Apr 2004 02:09:37 -0400
User-Agent: KMail/1.5.3
References: <EF398F42BE1BDF479B1E481F6E0053F201C97DA9@dmeusmail.dmeus.milacron.com>
In-Reply-To: <EF398F42BE1BDF479B1E481F6E0053F201C97DA9@dmeusmail.dmeus.milacron.com>
MIME-Version: 1.0
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Message-Id: <200404050209.37264.dyfet@ostel.com>
Cc: 
Subject: Re: ost::String class release 1.1.1
X-BeenThere: bug-commoncpp@gnu.org
X-Mailman-Version: 2.1.4
Precedence: list
List-Id: Bug reports for Common C++ <bug-commoncpp.gnu.org>
List-Unsubscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=unsubscribe>
List-Archive: <http://mail.gnu.org/pipermail/bug-commoncpp>
List-Post: <mailto:bug-commoncpp@gnu.org>
List-Help: <mailto:bug-commoncpp-request@gnu.org?subject=help>
List-Subscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 05 Apr 2004 18:07:49 -0000

The idx[slot] list is a link list sorted by size.  The place to start is first 
to confirm if the slot[idx] is being correctly initialized to NULL, and, in 
the separate place where strings are being deleted, if they are being added 
to the linked list correctly.  This may also be an alignment issue, depending 
on the architecture.  What cpu architecture is this being built on?

On Monday 05 April 2004 01:48 pm, erik_ohrnberger@dme.net wrote:
> David,
>  635 char *String::getSpace(unsigned size)
>  636 {
>  637     unsigned        slot;
>  638     char*           text = NULL;
>  639     char**          next;
>  640
>  641     if(size > slotlimit)
>  642         return new char[size];
>  643
>  644     slot = size / slotsize;
>  645     mutex.enterMutex();
>  646     if(!pager)
>  647     {
>  648         pager = new MemPager(pagesize);
>  649         idx = (char **)pager->alloc(sizeof(char *) * slots);
>  650         memset(idx, 0, sizeof(char *) * slots);
>  651     }
>  652     text = idx[slot];
>  653     if(text)
>  654     {
>  655         next = (char **)text;
>  656         idx[slot] = *next;
>  657     }
>  658     else
>  659         text = (char *)pager->alloc(++slot * slotsize);
>  660     mutex.leaveMutex();
>  661     return text;
>  662 }
>
> Right on line 656.
> slot = 1
> text = 0x32353964 <Address 0x32353964 out of bounds>
> size = 1076041732
>
> I think that size must be way off (duh).  OK, so where'd that come from?
>
>  407 void String::copy(const String &original)
>  408 {
>  409     char *ptr;
>  410     content = original.content;
>  411
>  412     if(!isBig())
>  413         return;
>  414
>  415     if(getLength() < minsize)
>  416     {
>  417         content.ministring.length = getLength();
>  418         memcpy(content.ministring.text, getText(), getLength() + 1);
>  419         content.ministring.big = false;
>  420         return;
>  421     }
>  422
>  423     ptr = getText();
>  424     content.bigstring.size = setSize(content.bigstring.length + 1);
>  425     content.bigstring.text = getSpace(getSize());
>  426     memcpy(content.bigstring.text, ptr, getLength() + 1);
>  427 }
>
> at line 425
> getLength() = 8
> ptr is pointing to a valid string of text.
> content.bigstring.size = 32
>
> Hmm.  Hope that this helps, I'm afraid that I've not studied this String
> class sufficiently to diagnose this at the moment.  Perhaps you'l ahve some
> insights?
>
> 	Thanks,
> 		Erik.
>
> > -----Original Message-----
> > From: David Sugar [mailto:dyfet@ostel.com]
> > Sent: Monday, April 05, 2004 1:27 AM
> > To: Ohrnberger, Erik; bug-commoncpp@gnu.org
> > Subject: Re: ost::String class release 1.1.1
> >
> >
> > Hmm...
> >
> > text is either assigned from a slot list (linked list) or
> > from mempager
> > alloc'd memory.  If the linked list is messed up, that is one
> > possibility.
> > However, the other option is if the string is too large, a
> > simple new is
> > used, and text is never modified.  Text is not initialized
> > because it does
> > not need a value until it needs to be assigned from the list or from
> > mempager.  Hence, it would help to know more about where
> > precisely this
> > segfault occurs.  One thing you can do is initially set text
> > to NULL at the
> > start of getSpace, as that would make it easier to determine
> > what the real
> > state of text is at the time it happens; whether its before
> > or after it has
> > been assigned by something.
> >
> > On Monday 05 April 2004 12:15 pm, erik_ohrnberger@dme.net wrote:
> > > Everyone,
> > > 	I'm noticing instances of seg faults in the
> >
> > ost::String::getSpace()
> >
> > > method, where the *text variable is assigned what appears
> >
> > to be random
> >
> > > garbage, and is yet used as a pointer into some data structure.
> > >
> > > 	Has anyone else experienced a similar failure?
> > >
> > > 	Is there a patch to the ost::String class that needs to
> >
> > be applied?
> >
> > > 	Thanks,
> > > 		Erik.
> > >
> > >
> > > _______________________________________________
> > > Bug-commoncpp mailing list
> > > Bug-commoncpp@gnu.org
> > > http://mail.gnu.org/mailman/listinfo/bug-commoncpp
>
> _______________________________________________
> Bug-commoncpp mailing list
> Bug-commoncpp@gnu.org
> http://mail.gnu.org/mailman/listinfo/bug-commoncpp




From MAILER-DAEMON Mon Apr 05 14:14:06 2004
Received: from list by monty-python.gnu.org with archive (Exim 4.30)
	id 1BAYbl-0001fM-Oi
	for mharc-bug-commoncpp@gnu.org; Mon, 05 Apr 2004 14:14:05 -0400
Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30)
	id 1BAYaf-0001Bl-V7
	for bug-commoncpp@gnu.org; Mon, 05 Apr 2004 14:12:57 -0400
Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30)
	id 1BAYZm-0000nF-3g
	for bug-commoncpp@gnu.org; Mon, 05 Apr 2004 14:12:33 -0400
Received: from [216.68.248.32] (helo=Milcor21.milacron.com)
	by monty-python.gnu.org with esmtp (Exim 4.30) id 1BAYZl-0000ml-Hj
	for bug-commoncpp@gnu.org; Mon, 05 Apr 2004 14:12:01 -0400
Received: from dmeusmail.dmeus.milacron.com ([143.62.132.57]) by
	Milcor21.milacron.com with Microsoft SMTPSVC(5.0.2195.6713); 
	Mon, 5 Apr 2004 14:12:00 -0400
Received: by dmeusmail.dmeus.milacron.com with Internet Mail Service
	(5.5.2657.72) id <2GMSQ7MR>; Mon, 5 Apr 2004 14:12:00 -0400
Message-ID: <EF398F42BE1BDF479B1E481F6E0053F201C97DAA@dmeusmail.dmeus.milacron.com>
From: erik_ohrnberger@dme.net
To: bug-commoncpp@gnu.org
Date: Mon, 5 Apr 2004 14:11:54 -0400 
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2657.72)
Content-Type: text/plain;
	charset="iso-8859-1"
X-OriginalArrivalTime: 05 Apr 2004 18:12:00.0795 (UTC)
	FILETIME=[7DA026B0:01C41B39]
Subject: RE: ost::String class release 1.1.1
X-BeenThere: bug-commoncpp@gnu.org
X-Mailman-Version: 2.1.4
Precedence: list
List-Id: Bug reports for Common C++ <bug-commoncpp.gnu.org>
List-Unsubscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=unsubscribe>
List-Archive: <http://mail.gnu.org/pipermail/bug-commoncpp>
List-Post: <mailto:bug-commoncpp@gnu.org>
List-Help: <mailto:bug-commoncpp-request@gnu.org?subject=help>
List-Subscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 05 Apr 2004 18:14:03 -0000

i686 AMD Athlon(tm) Processor AuthenticAMD GNU/Linux

> -----Original Message-----
> From: David Sugar [mailto:dyfet@ostel.com]
> Sent: Monday, April 05, 2004 2:10 AM
> To: Ohrnberger, Erik; bug-commoncpp@gnu.org
> Subject: Re: ost::String class release 1.1.1
> 
> 
> The idx[slot] list is a link list sorted by size.  The place 
> to start is first 
> to confirm if the slot[idx] is being correctly initialized to 
> NULL, and, in 
> the separate place where strings are being deleted, if they 
> are being added 
> to the linked list correctly.  This may also be an alignment 
> issue, depending 
> on the architecture.  What cpu architecture is this being built on?
> 
> On Monday 05 April 2004 01:48 pm, erik_ohrnberger@dme.net wrote:
> > David,
> >  635 char *String::getSpace(unsigned size)
> >  636 {
> >  637     unsigned        slot;
> >  638     char*           text = NULL;
> >  639     char**          next;
> >  640
> >  641     if(size > slotlimit)
> >  642         return new char[size];
> >  643
> >  644     slot = size / slotsize;
> >  645     mutex.enterMutex();
> >  646     if(!pager)
> >  647     {
> >  648         pager = new MemPager(pagesize);
> >  649         idx = (char **)pager->alloc(sizeof(char *) * slots);
> >  650         memset(idx, 0, sizeof(char *) * slots);
> >  651     }
> >  652     text = idx[slot];
> >  653     if(text)
> >  654     {
> >  655         next = (char **)text;
> >  656         idx[slot] = *next;
> >  657     }
> >  658     else
> >  659         text = (char *)pager->alloc(++slot * slotsize);
> >  660     mutex.leaveMutex();
> >  661     return text;
> >  662 }
> >
> > Right on line 656.
> > slot = 1
> > text = 0x32353964 <Address 0x32353964 out of bounds>
> > size = 1076041732
> >
> > I think that size must be way off (duh).  OK, so where'd 
> that come from?
> >
> >  407 void String::copy(const String &original)
> >  408 {
> >  409     char *ptr;
> >  410     content = original.content;
> >  411
> >  412     if(!isBig())
> >  413         return;
> >  414
> >  415     if(getLength() < minsize)
> >  416     {
> >  417         content.ministring.length = getLength();
> >  418         memcpy(content.ministring.text, getText(), 
> getLength() + 1);
> >  419         content.ministring.big = false;
> >  420         return;
> >  421     }
> >  422
> >  423     ptr = getText();
> >  424     content.bigstring.size = 
> setSize(content.bigstring.length + 1);
> >  425     content.bigstring.text = getSpace(getSize());
> >  426     memcpy(content.bigstring.text, ptr, getLength() + 1);
> >  427 }
> >
> > at line 425
> > getLength() = 8
> > ptr is pointing to a valid string of text.
> > content.bigstring.size = 32
> >
> > Hmm.  Hope that this helps, I'm afraid that I've not 
> studied this String
> > class sufficiently to diagnose this at the moment.  Perhaps 
> you'l ahve some
> > insights?
> >
> > 	Thanks,
> > 		Erik.
> >
> > > -----Original Message-----
> > > From: David Sugar [mailto:dyfet@ostel.com]
> > > Sent: Monday, April 05, 2004 1:27 AM
> > > To: Ohrnberger, Erik; bug-commoncpp@gnu.org
> > > Subject: Re: ost::String class release 1.1.1
> > >
> > >
> > > Hmm...
> > >
> > > text is either assigned from a slot list (linked list) or
> > > from mempager
> > > alloc'd memory.  If the linked list is messed up, that is one
> > > possibility.
> > > However, the other option is if the string is too large, a
> > > simple new is
> > > used, and text is never modified.  Text is not initialized
> > > because it does
> > > not need a value until it needs to be assigned from the 
> list or from
> > > mempager.  Hence, it would help to know more about where
> > > precisely this
> > > segfault occurs.  One thing you can do is initially set text
> > > to NULL at the
> > > start of getSpace, as that would make it easier to determine
> > > what the real
> > > state of text is at the time it happens; whether its before
> > > or after it has
> > > been assigned by something.
> > >
> > > On Monday 05 April 2004 12:15 pm, erik_ohrnberger@dme.net wrote:
> > > > Everyone,
> > > > 	I'm noticing instances of seg faults in the
> > >
> > > ost::String::getSpace()
> > >
> > > > method, where the *text variable is assigned what appears
> > >
> > > to be random
> > >
> > > > garbage, and is yet used as a pointer into some data structure.
> > > >
> > > > 	Has anyone else experienced a similar failure?
> > > >
> > > > 	Is there a patch to the ost::String class that needs to
> > >
> > > be applied?
> > >
> > > > 	Thanks,
> > > > 		Erik.
> > > >
> > > >
> > > > _______________________________________________
> > > > Bug-commoncpp mailing list
> > > > Bug-commoncpp@gnu.org
> > > > http://mail.gnu.org/mailman/listinfo/bug-commoncpp
> >
> > _______________________________________________
> > Bug-commoncpp mailing list
> > Bug-commoncpp@gnu.org
> > http://mail.gnu.org/mailman/listinfo/bug-commoncpp
> 
> 



From MAILER-DAEMON Mon Apr 05 14:57:05 2004
Received: from list by monty-python.gnu.org with archive (Exim 4.30)
	id 1BAZHM-00037y-QL
	for mharc-bug-commoncpp@gnu.org; Mon, 05 Apr 2004 14:57:04 -0400
Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30)
	id 1BAZHJ-00036H-FN
	for bug-commoncpp@gnu.org; Mon, 05 Apr 2004 14:57:01 -0400
Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30)
	id 1BAZE0-0002FO-CQ
	for bug-commoncpp@gnu.org; Mon, 05 Apr 2004 14:54:07 -0400
Received: from [216.218.222.122] (helo=mail.ostel.com)
	by monty-python.gnu.org with esmtp (Exim 4.30) id 1BAZD1-00027l-T0
	for bug-commoncpp@gnu.org; Mon, 05 Apr 2004 14:52:36 -0400
Received: by mail.ostel.com (Postfix, from userid 1005)
	id 5D7AB2F2883; Mon,  5 Apr 2004 11:52:47 -0700 (PDT)
Received: from 192.168.1.102 (pool-138-89-45-226.mad.east.verizon.net
	[138.89.45.226]) by mail.ostel.com (Postfix) with ESMTP
	id 5B4BE2F2867; Mon,  5 Apr 2004 11:52:40 -0700 (PDT)
From: David Sugar <dyfet@ostel.com>
To: erik_ohrnberger@dme.net, bug-commoncpp@gnu.org
Date: Mon, 5 Apr 2004 02:55:04 -0400
User-Agent: KMail/1.5.3
References: <EF398F42BE1BDF479B1E481F6E0053F201C97DAA@dmeusmail.dmeus.milacron.com>
In-Reply-To: <EF398F42BE1BDF479B1E481F6E0053F201C97DAA@dmeusmail.dmeus.milacron.com>
MIME-Version: 1.0
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Message-Id: <200404050255.04929.dyfet@ostel.com>
Cc: 
Subject: Re: ost::String class release 1.1.1
X-BeenThere: bug-commoncpp@gnu.org
X-Mailman-Version: 2.1.4
Precedence: list
List-Id: Bug reports for Common C++ <bug-commoncpp.gnu.org>
List-Unsubscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=unsubscribe>
List-Archive: <http://mail.gnu.org/pipermail/bug-commoncpp>
List-Post: <mailto:bug-commoncpp@gnu.org>
List-Help: <mailto:bug-commoncpp-request@gnu.org?subject=help>
List-Subscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 05 Apr 2004 18:57:02 -0000

Do you have a sample/test case application that you can get to reliably 
segfault?

David

On Monday 05 April 2004 02:11 pm, erik_ohrnberger@dme.net wrote:
> i686 AMD Athlon(tm) Processor AuthenticAMD GNU/Linux
>
> > -----Original Message-----
> > From: David Sugar [mailto:dyfet@ostel.com]
> > Sent: Monday, April 05, 2004 2:10 AM
> > To: Ohrnberger, Erik; bug-commoncpp@gnu.org
> > Subject: Re: ost::String class release 1.1.1
> >
> >
> > The idx[slot] list is a link list sorted by size.  The place
> > to start is first
> > to confirm if the slot[idx] is being correctly initialized to
> > NULL, and, in
> > the separate place where strings are being deleted, if they
> > are being added
> > to the linked list correctly.  This may also be an alignment
> > issue, depending
> > on the architecture.  What cpu architecture is this being built on?
> >
> > On Monday 05 April 2004 01:48 pm, erik_ohrnberger@dme.net wrote:
> > > David,
> > >  635 char *String::getSpace(unsigned size)
> > >  636 {
> > >  637     unsigned        slot;
> > >  638     char*           text = NULL;
> > >  639     char**          next;
> > >  640
> > >  641     if(size > slotlimit)
> > >  642         return new char[size];
> > >  643
> > >  644     slot = size / slotsize;
> > >  645     mutex.enterMutex();
> > >  646     if(!pager)
> > >  647     {
> > >  648         pager = new MemPager(pagesize);
> > >  649         idx = (char **)pager->alloc(sizeof(char *) * slots);
> > >  650         memset(idx, 0, sizeof(char *) * slots);
> > >  651     }
> > >  652     text = idx[slot];
> > >  653     if(text)
> > >  654     {
> > >  655         next = (char **)text;
> > >  656         idx[slot] = *next;
> > >  657     }
> > >  658     else
> > >  659         text = (char *)pager->alloc(++slot * slotsize);
> > >  660     mutex.leaveMutex();
> > >  661     return text;
> > >  662 }
> > >
> > > Right on line 656.
> > > slot = 1
> > > text = 0x32353964 <Address 0x32353964 out of bounds>
> > > size = 1076041732
> > >
> > > I think that size must be way off (duh).  OK, so where'd
> >
> > that come from?
> >
> > >  407 void String::copy(const String &original)
> > >  408 {
> > >  409     char *ptr;
> > >  410     content = original.content;
> > >  411
> > >  412     if(!isBig())
> > >  413         return;
> > >  414
> > >  415     if(getLength() < minsize)
> > >  416     {
> > >  417         content.ministring.length = getLength();
> > >  418         memcpy(content.ministring.text, getText(),
> >
> > getLength() + 1);
> >
> > >  419         content.ministring.big = false;
> > >  420         return;
> > >  421     }
> > >  422
> > >  423     ptr = getText();
> > >  424     content.bigstring.size =
> >
> > setSize(content.bigstring.length + 1);
> >
> > >  425     content.bigstring.text = getSpace(getSize());
> > >  426     memcpy(content.bigstring.text, ptr, getLength() + 1);
> > >  427 }
> > >
> > > at line 425
> > > getLength() = 8
> > > ptr is pointing to a valid string of text.
> > > content.bigstring.size = 32
> > >
> > > Hmm.  Hope that this helps, I'm afraid that I've not
> >
> > studied this String
> >
> > > class sufficiently to diagnose this at the moment.  Perhaps
> >
> > you'l ahve some
> >
> > > insights?
> > >
> > > 	Thanks,
> > > 		Erik.
> > >
> > > > -----Original Message-----
> > > > From: David Sugar [mailto:dyfet@ostel.com]
> > > > Sent: Monday, April 05, 2004 1:27 AM
> > > > To: Ohrnberger, Erik; bug-commoncpp@gnu.org
> > > > Subject: Re: ost::String class release 1.1.1
> > > >
> > > >
> > > > Hmm...
> > > >
> > > > text is either assigned from a slot list (linked list) or
> > > > from mempager
> > > > alloc'd memory.  If the linked list is messed up, that is one
> > > > possibility.
> > > > However, the other option is if the string is too large, a
> > > > simple new is
> > > > used, and text is never modified.  Text is not initialized
> > > > because it does
> > > > not need a value until it needs to be assigned from the
> >
> > list or from
> >
> > > > mempager.  Hence, it would help to know more about where
> > > > precisely this
> > > > segfault occurs.  One thing you can do is initially set text
> > > > to NULL at the
> > > > start of getSpace, as that would make it easier to determine
> > > > what the real
> > > > state of text is at the time it happens; whether its before
> > > > or after it has
> > > > been assigned by something.
> > > >
> > > > On Monday 05 April 2004 12:15 pm, erik_ohrnberger@dme.net wrote:
> > > > > Everyone,
> > > > > 	I'm noticing instances of seg faults in the
> > > >
> > > > ost::String::getSpace()
> > > >
> > > > > method, where the *text variable is assigned what appears
> > > >
> > > > to be random
> > > >
> > > > > garbage, and is yet used as a pointer into some data structure.
> > > > >
> > > > > 	Has anyone else experienced a similar failure?
> > > > >
> > > > > 	Is there a patch to the ost::String class that needs to
> > > >
> > > > be applied?
> > > >
> > > > > 	Thanks,
> > > > > 		Erik.
> > > > >
> > > > >
> > > > > _______________________________________________
> > > > > Bug-commoncpp mailing list
> > > > > Bug-commoncpp@gnu.org
> > > > > http://mail.gnu.org/mailman/listinfo/bug-commoncpp
> > >
> > > _______________________________________________
> > > Bug-commoncpp mailing list
> > > Bug-commoncpp@gnu.org
> > > http://mail.gnu.org/mailman/listinfo/bug-commoncpp
>
> _______________________________________________
> Bug-commoncpp mailing list
> Bug-commoncpp@gnu.org
> http://mail.gnu.org/mailman/listinfo/bug-commoncpp




From MAILER-DAEMON Tue Apr 06 07:03:10 2004
Received: from list by monty-python.gnu.org with archive (Exim 4.30)
	id 1BAoMH-0002ng-Na
	for mharc-bug-commoncpp@gnu.org; Tue, 06 Apr 2004 07:03:09 -0400
Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30)
	id 1BAoLf-0002cL-30
	for bug-commoncpp@gnu.org; Tue, 06 Apr 2004 07:02:31 -0400
Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30)
	id 1BAoF0-0000gs-1i
	for bug-commoncpp@gnu.org; Tue, 06 Apr 2004 06:56:09 -0400
Received: from [193.137.203.229] (helo=smtp2.dei.uc.pt)
	by monty-python.gnu.org with esmtp (Exim 4.30) id 1BAoDS-0000JR-HU
	for bug-commoncpp@gnu.org; Tue, 06 Apr 2004 06:54:02 -0400
Received: from student.dei.uc.pt (student.dei.uc.pt [10.1.0.1])
	by smtp2.dei.uc.pt (8.11.7/8.11.7) with ESMTP id i36B3pK30741
	for <bug-commoncpp@gnu.org>; Tue, 6 Apr 2004 12:03:51 +0100
Received: from punkass.com (abra.dei.uc.pt [10.3.0.21])
	by student.dei.uc.pt (8.12.8/8.12.8) with ESMTP id i36ArZsR020164
	for <bug-commoncpp@gnu.org>; Tue, 6 Apr 2004 11:53:35 +0100
Message-ID: <4073DE38.9020705@punkass.com>
Date: Wed, 07 Apr 2004 11:55:52 +0100
From: Jose Pedro Tavares <zarroba@punkass.com>
User-Agent: Mozilla Thunderbird 0.5 (X11/20040208)
X-Accept-Language: en-us, en
MIME-Version: 1.0
To: bug-commoncpp@gnu.org
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
X-UC-DEI-MailScanner-Information: Please contact helpdesk@dei.uc.pt for more
	information
X-UC-DEI-MailScanner: Found to be clean
Content-Transfer-Encoding: quoted-printable
X-MIME-Autoconverted: from 8bit to quoted-printable by smtp2.dei.uc.pt id
	i36B3pK30741
Subject: Error including date types in 1.1.0
X-BeenThere: bug-commoncpp@gnu.org
X-Mailman-Version: 2.1.4
Precedence: list
List-Id: Bug reports for Common C++ <bug-commoncpp.gnu.org>
List-Unsubscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=unsubscribe>
List-Archive: <http://mail.gnu.org/pipermail/bug-commoncpp>
List-Post: <mailto:bug-commoncpp@gnu.org>
List-Help: <mailto:bug-commoncpp-request@gnu.org?subject=help>
List-Subscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 06 Apr 2004 11:03:06 -0000

I'm using cc++ 1.1.0 and it was all going allright until I tried to use=20
Date types (Date, Datetime and Time). I've used Threads, Strings,=20
Sockets and everything was good. I think it is a linking problem since=20
it finds <cc++/numbers.h> or a compatibility problem with STLport, the=20
error is:

/usr/include/stlport/stl/_ios_base.h:198: undefined reference to=20
`ost::Datetime::Datetime[in-charge]()'

I use the following compiler flags:
-lstlport_gcc -lccgnu2
Is libccext needed for this? When I add -lccext2 to the compiler flags=20
the following error appears:
-lstlport_gcc -lccext2 -lccgnu2 -o bin/sim_test
/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.3/../../../libccext2.so:=20
undefined reference to `deflate'
/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.3/../../../libccext2.so:=20
undefined reference to `xmlCreatePushParserCtxt'
/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.3/../../../libccext2.so:=20
undefined reference to `inflate'
/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.3/../../../libccext2.so:=20
undefined reference to `xmlParseChunk'
/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.3/../../../libccext2.so:=20
undefined reference to `inflateInit_'
/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.3/../../../libccext2.so:=20
undefined reference to `deflateInit_'
/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.3/../../../libccext2.so:=20
undefined reference to `xmlFreeParserCtxt'
/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.3/../../../libccext2.so:=20
undefined reference to `inflateEnd'
/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.3/../../../libccext2.so:=20
undefined reference to `deflateEnd'
collect2: ld returned 1 exit status

TIA
Z=E9 Pedro

PS: Sorry for my bad english...



From MAILER-DAEMON Tue Apr 06 09:18:05 2004
Received: from list by monty-python.gnu.org with archive (Exim 4.30)
	id 1BAqMz-0003gQ-R4
	for mharc-bug-commoncpp@gnu.org; Tue, 06 Apr 2004 09:12:01 -0400
Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30)
	id 1BAqMq-0003dZ-Gn
	for bug-commoncpp@gnu.org; Tue, 06 Apr 2004 09:11:52 -0400
Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30)
	id 1BAqCI-0001eF-VH
	for bug-commoncpp@gnu.org; Tue, 06 Apr 2004 09:01:30 -0400
Received: from [216.218.222.122] (helo=mail.ostel.com)
	by monty-python.gnu.org with esmtp (Exim 4.30) id 1BAq3M-0000LO-LN
	for bug-commoncpp@gnu.org; Tue, 06 Apr 2004 08:51:44 -0400
Received: by mail.ostel.com (Postfix, from userid 1005)
	id 8BCC52F2883; Tue,  6 Apr 2004 05:51:59 -0700 (PDT)
Received: from 192.168.1.102 (pool-138-89-45-226.mad.east.verizon.net
	[138.89.45.226]) by mail.ostel.com (Postfix) with ESMTP
	id C85792F2867; Tue,  6 Apr 2004 05:51:57 -0700 (PDT)
From: David Sugar <dyfet@ostel.com>
To: Jose Pedro Tavares <zarroba@punkass.com>, bug-commoncpp@gnu.org
Date: Mon, 5 Apr 2004 20:54:18 -0400
User-Agent: KMail/1.5.3
References: <4073DE38.9020705@punkass.com>
In-Reply-To: <4073DE38.9020705@punkass.com>
MIME-Version: 1.0
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
Message-Id: <200404052054.18087.dyfet@ostel.com>
Cc: 
Subject: Re: Error including date types in 1.1.0
X-BeenThere: bug-commoncpp@gnu.org
X-Mailman-Version: 2.1.4
Precedence: list
List-Id: Bug reports for Common C++ <bug-commoncpp.gnu.org>
List-Unsubscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=unsubscribe>
List-Archive: <http://mail.gnu.org/pipermail/bug-commoncpp>
List-Post: <mailto:bug-commoncpp@gnu.org>
List-Help: <mailto:bug-commoncpp-request@gnu.org?subject=help>
List-Subscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 06 Apr 2004 13:11:59 -0000

I have not tested STLPort in a long time...

It is very useful having a single reference stl implimentation that you can=
=20
take to different platforms, as so many of the past ones had been broken.

I see they changed the compile and link rules a bit...

On Wednesday 07 April 2004 06:55 am, Jose Pedro Tavares wrote:
> I'm using cc++ 1.1.0 and it was all going allright until I tried to use
> Date types (Date, Datetime and Time). I've used Threads, Strings,
> Sockets and everything was good. I think it is a linking problem since
> it finds <cc++/numbers.h> or a compatibility problem with STLport, the
> error is:
>
> /usr/include/stlport/stl/_ios_base.h:198: undefined reference to
> `ost::Datetime::Datetime[in-charge]()'
>
> I use the following compiler flags:
> -lstlport_gcc -lccgnu2
> Is libccext needed for this? When I add -lccext2 to the compiler flags
> the following error appears:
> -lstlport_gcc -lccext2 -lccgnu2 -o bin/sim_test
> /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.3/../../../libccext2.so:
> undefined reference to `deflate'
> /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.3/../../../libccext2.so:
> undefined reference to `xmlCreatePushParserCtxt'
> /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.3/../../../libccext2.so:
> undefined reference to `inflate'
> /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.3/../../../libccext2.so:
> undefined reference to `xmlParseChunk'
> /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.3/../../../libccext2.so:
> undefined reference to `inflateInit_'
> /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.3/../../../libccext2.so:
> undefined reference to `deflateInit_'
> /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.3/../../../libccext2.so:
> undefined reference to `xmlFreeParserCtxt'
> /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.3/../../../libccext2.so:
> undefined reference to `inflateEnd'
> /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.3/../../../libccext2.so:
> undefined reference to `deflateEnd'
> collect2: ld returned 1 exit status
>
> TIA
> Z=E9 Pedro
>
> PS: Sorry for my bad english...
>
>
> _______________________________________________
> Bug-commoncpp mailing list
> Bug-commoncpp@gnu.org
> http://mail.gnu.org/mailman/listinfo/bug-commoncpp




From MAILER-DAEMON Tue Apr 06 19:17:11 2004
Received: from list by monty-python.gnu.org with archive (Exim 4.30)
	id 1BAzoc-0003tc-Pt
	for mharc-bug-commoncpp@gnu.org; Tue, 06 Apr 2004 19:17:10 -0400
Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30)
	id 1BAzoZ-0003st-JG
	for bug-commoncpp@gnu.org; Tue, 06 Apr 2004 19:17:07 -0400
Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30)
	id 1BAzns-0003no-50
	for bug-commoncpp@gnu.org; Tue, 06 Apr 2004 19:16:55 -0400
Received: from [66.185.86.76] (helo=web02-imail.rogers.com)
	by monty-python.gnu.org with esmtp (Exim 4.30) id 1BAzlU-0002rI-57
	for bug-commoncpp@gnu.org; Tue, 06 Apr 2004 19:13:56 -0400
Received: from chatgris.no-ip.com ([24.112.132.225]) by web02-imail.rogers.com
	(InterMail vM.5.01.05.12 201-253-122-126-112-20020820) with ESMTP
	id <20040406231329.SVNV40503.web02-imail.rogers.com@chatgris.no-ip.com>;
	Tue, 6 Apr 2004 19:13:29 -0400
From: Joshua Moore-Oliva <josh@chatgris.com>
To: David Sugar <dyfet@ostel.com>
Date: Tue, 6 Apr 2004 19:23:43 -0400
User-Agent: KMail/1.6.1
References: <200404021807.37103.josh@chatgris.com>
	<200404021829.55432.dyfet@ostel.com>
In-Reply-To: <200404021829.55432.dyfet@ostel.com>
MIME-Version: 1.0
Content-Disposition: inline
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Message-Id: <200404061923.43076.josh@chatgris.com>
X-Authentication-Info: Submitted using SMTP AUTH PLAIN at
	web02-imail.rogers.com from [24.112.132.225] using ID
	<janetteoliva@rogers.com> at Tue, 6 Apr 2004 19:13:29 -0400
Cc: bug-commoncpp@gnu.org
Subject: Re: Memory leaks in common cpp.
X-BeenThere: bug-commoncpp@gnu.org
X-Mailman-Version: 2.1.4
Precedence: list
List-Id: Bug reports for Common C++ <bug-commoncpp.gnu.org>
List-Unsubscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=unsubscribe>
List-Archive: <http://mail.gnu.org/pipermail/bug-commoncpp>
List-Post: <mailto:bug-commoncpp@gnu.org>
List-Help: <mailto:bug-commoncpp-request@gnu.org?subject=help>
List-Subscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 06 Apr 2004 23:17:08 -0000

I have the exact same problems in 1.1.2.

=46rom the looks of it it seems that pthread_key_delete is not being called=
 at the end?

Errors from 1.1.2 pasted below.

=3D=3D7272=3D=3D 200 bytes in 1 blocks are definitely lost in loss record 1=
 of 3
=3D=3D7272=3D=3D    at 0x402E9D63: (within /usr/lib/valgrind/libpthread.so)
=3D=3D7272=3D=3D    by 0x402EBB21: (within /usr/lib/valgrind/libpthread.so)
=3D=3D7272=3D=3D    by 0x402EBC4A: __pthread_key_create (in /usr/lib/valgri=
nd/libpthread.so)
=3D=3D7272=3D=3D    by 0x402628EE: ost::ThreadKey::ThreadKey(void (*)(void*=
)) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
=3D=3D7272=3D=3D    by 0x40260BB3: (within /usr/lib/libccgnu2-1.1.so.0.0.2)
=3D=3D7272=3D=3D    by 0x40260CFB: (within /usr/lib/libccgnu2-1.1.so.0.0.2)
=3D=3D7272=3D=3D    by 0x40279A34: (within /usr/lib/libccgnu2-1.1.so.0.0.2)
=3D=3D7272=3D=3D    by 0x4025CB30: (within /usr/lib/libccgnu2-1.1.so.0.0.2)
=3D=3D7272=3D=3D    by 0x4000B78D: (within /lib/ld-2.3.2.so)
=3D=3D7272=3D=3D    by 0x4000B879: _dl_init (in /lib/ld-2.3.2.so)
=3D=3D7272=3D=3D    by 0x40000A24: (within /lib/ld-2.3.2.so)
=3D=3D7272=3D=3D
=3D=3D7272=3D=3D
=3D=3D7272=3D=3D 220 bytes in 1 blocks are still reachable in loss record 2=
 of 3
=3D=3D7272=3D=3D    at 0x4002ADFE: operator new(unsigned) (in /usr/lib/valg=
rind/vgskin_memcheck.so)
=3D=3D7272=3D=3D    by 0x4025EBDA: ost::Thread::Thread(bool) (in /usr/lib/l=
ibccgnu2-1.1.so.0.0.2)
=3D=3D7272=3D=3D    by 0x40260F56: ost::MainThread::MainThread() (in /usr/l=
ib/libccgnu2-1.1.so.0.0.2)
=3D=3D7272=3D=3D    by 0x40260BF0: (within /usr/lib/libccgnu2-1.1.so.0.0.2)
=3D=3D7272=3D=3D    by 0x40260CFB: (within /usr/lib/libccgnu2-1.1.so.0.0.2)
=3D=3D7272=3D=3D    by 0x40279A34: (within /usr/lib/libccgnu2-1.1.so.0.0.2)
=3D=3D7272=3D=3D    by 0x4025CB30: (within /usr/lib/libccgnu2-1.1.so.0.0.2)
=3D=3D7272=3D=3D    by 0x4000B78D: (within /lib/ld-2.3.2.so)
=3D=3D7272=3D=3D    by 0x4000B879: _dl_init (in /lib/ld-2.3.2.so)
=3D=3D7272=3D=3D    by 0x40000A24: (within /lib/ld-2.3.2.so)

On April 2, 2004 6:29 pm, David Sugar wrote:
> This looks like a 1.0.11 release.  Does this still happen in 1.1.2?  I kn=
ow of=20
> several memory leaks that were found and fixed in 1.1.0 and 1.1.1.
>=20
> On Friday 02 April 2004 06:07 pm, Joshua Moore-Oliva wrote:
> > I am not sure if I need to call a function at the end of my program ala=
 apr
> > style (apr_terminate()) or if this is a memory leak in gnu common c++ b=
ut
> > there are two memory leaks when I just link a program to gnucpp...
> >
> > I would really like to get rid of these..
> >
> > Thanks, Joshua Moore-Oliva
> >
> > 200 bytes in 1 blocks are definitely lost in loss record 1 of 3
> > =3D=3D7196=3D=3D    at 0x402E2D63: (within /usr/lib/valgrind/libpthread=
=2Eso)
> > =3D=3D7196=3D=3D    by 0x402E4B21: (within /usr/lib/valgrind/libpthread=
=2Eso)
> > =3D=3D7196=3D=3D    by 0x402E4C4A: __pthread_key_create (in
> > /usr/lib/valgrind/libpthread.so) =3D=3D7196=3D=3D    by 0x40261186:
> > ost::ThreadKey::ThreadKey(void (*)(void*)) (in
> > /usr/lib/libccgnu2-1.0.so.0.0.11) =3D=3D7196=3D=3D    by 0x4025F77C: (w=
ithin
> > /usr/lib/libccgnu2-1.0.so.0.0.11) =3D=3D7196=3D=3D    by 0x4025F87A: (w=
ithin
> > /usr/lib/libccgnu2-1.0.so.0.0.11) =3D=3D7196=3D=3D    by 0x40276FC4: (w=
ithin
> > /usr/lib/libccgnu2-1.0.so.0.0.11) =3D=3D7196=3D=3D    by 0x4025C2F0: (w=
ithin
> > /usr/lib/libccgnu2-1.0.so.0.0.11) =3D=3D7196=3D=3D    by 0x4000B78D: (w=
ithin
> > /lib/ld-2.3.2.so)
> > =3D=3D7196=3D=3D    by 0x4000B879: _dl_init (in /lib/ld-2.3.2.so)
> > =3D=3D7196=3D=3D    by 0x40000A24: (within /lib/ld-2.3.2.so)
> > =3D=3D7196=3D=3D
> > =3D=3D7196=3D=3D
> > =3D=3D7196=3D=3D 212 bytes in 1 blocks are still reachable in loss reco=
rd 2 of 3
> > =3D=3D7196=3D=3D    at 0x4002ADFE: operator new(unsigned) (in
> > /usr/lib/valgrind/vgskin_memcheck.so) =3D=3D7196=3D=3D    by 0x4025DDB5:
> > ost::Thread::Thread(bool) (in /usr/lib/libccgnu2-1.0.so.0.0.11) =3D=3D7=
196=3D=3D  =20
> > by 0x4025F7B4: (within /usr/lib/libccgnu2-1.0.so.0.0.11) =3D=3D7196=3D=
=3D    by
> > 0x4025F87A: (within /usr/lib/libccgnu2-1.0.so.0.0.11) =3D=3D7196=3D=3D =
   by
> > 0x40276FC4: (within /usr/lib/libccgnu2-1.0.so.0.0.11) =3D=3D7196=3D=3D =
   by
> > 0x4025C2F0: (within /usr/lib/libccgnu2-1.0.so.0.0.11) =3D=3D7196=3D=3D =
   by
> > 0x4000B78D: (within /lib/ld-2.3.2.so)
> > =3D=3D7196=3D=3D    by 0x4000B879: _dl_init (in /lib/ld-2.3.2.so)
> > =3D=3D7196=3D=3D    by 0x40000A24: (within /lib/ld-2.3.2.so)
> >
> >
> > _______________________________________________
> > Bug-commoncpp mailing list
> > Bug-commoncpp@gnu.org
> > http://mail.gnu.org/mailman/listinfo/bug-commoncpp
>=20



From MAILER-DAEMON Wed Apr 07 16:38:19 2004
Received: from list by monty-python.gnu.org with archive (Exim 4.30)
	id 1BBJoR-0000Lo-IR
	for mharc-bug-commoncpp@gnu.org; Wed, 07 Apr 2004 16:38:19 -0400
Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30)
	id 1BB0fr-0007vE-Eb
	for bug-commoncpp@gnu.org; Tue, 06 Apr 2004 20:12:11 -0400
Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30)
	id 1BB0fH-0007oA-UF
	for bug-commoncpp@gnu.org; Tue, 06 Apr 2004 20:12:07 -0400
Received: from [199.232.41.8] (helo=mx20.gnu.org)
	by monty-python.gnu.org with esmtp (TLSv1:DES-CBC3-SHA:168)
	(Exim 4.30) id 1BB0fH-0007iu-BK
	for bug-commoncpp@gnu.org; Tue, 06 Apr 2004 20:11:35 -0400
Received: from [65.32.5.135] (helo=ms-smtp-05.tampabay.rr.com)
	by mx20.gnu.org with esmtp (Exim 4.30) id 1BB0SW-0000he-4N
	for bug-commoncpp@gnu.org; Tue, 06 Apr 2004 19:58:24 -0400
Received: from ms-mss-03 (ms-mss-03-smtp-bk [10.10.4.19])
	by ms-smtp-05.tampabay.rr.com (8.12.10/8.12.7) with ESMTP id
	i36NwJ4F024595
	for <bug-commoncpp@gnu.org>; Tue, 6 Apr 2004 19:58:19 -0400 (EDT)
Received: from tampabay.rr.com (localhost [127.0.0.1])
	by ms-mss-03.tampabay.rr.com
	(iPlanet Messaging Server 5.2 HotFix 1.21 (built Sep  8 2003))
	with ESMTP id <0HVR00EA3X972H@ms-mss-03.tampabay.rr.com> for
	bug-commoncpp@gnu.org; Tue, 06 Apr 2004 19:58:19 -0400 (EDT)
Received: from [10.10.6.26] (Forwarded-For: [207.30.9.99])
	by ms-mss-03.tampabay.rr.com (mshttpd); Tue, 06 Apr 2004 19:58:19 -0400
Date: Tue, 06 Apr 2004 19:58:19 -0400
From: zemiandeng@cfl.rr.com
To: bug-commoncpp@gnu.org
Message-id: <5d4ce95d1023.5d10235d4ce9@tampabay.rr.com>
MIME-version: 1.0
X-Mailer: iPlanet Messenger Express 5.2 HotFix 1.21 (built Sep  8 2003)
Content-type: multipart/mixed; boundary="Boundary_(ID_JZEwvCICfM00NL7KFvsD2w)"
Content-language: en
X-Accept-Language: en
Priority: normal
X-Virus-Scanned: Symantec AntiVirus Scan Engine
X-Mailman-Approved-At: Wed, 07 Apr 2004 16:38:15 -0400
Subject: compiling source with Visual Studio .net (VC7)
X-BeenThere: bug-commoncpp@gnu.org
X-Mailman-Version: 2.1.4
Precedence: list
Reply-To: zemiandeng@cfl.rr.com
List-Id: Bug reports for Common C++ <bug-commoncpp.gnu.org>
List-Unsubscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=unsubscribe>
List-Archive: <http://mail.gnu.org/pipermail/bug-commoncpp>
List-Post: <mailto:bug-commoncpp@gnu.org>
List-Help: <mailto:bug-commoncpp-request@gnu.org?subject=help>
List-Subscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 07 Apr 2004 00:12:14 -0000

This is a multi-part message in MIME format.

--Boundary_(ID_JZEwvCICfM00NL7KFvsD2w)
Content-type: text/plain; charset=us-ascii
Content-transfer-encoding: 7BIT
Content-disposition: inline

Hi, 

I can't compile the ccext2 project under vc7. Can you help?
The buildlog is attached.



Thanks.

-zdeng

--Boundary_(ID_JZEwvCICfM00NL7KFvsD2w)
Content-type: text/html; NAME=BuildLog.htm
Content-transfer-encoding: 7BIT
Content-disposition: attachment; filename=BuildLog.htm

<html>
<head>
<META HTTP-EQUIV="Content-Type" content="text/html; charset=Windows-1252">
</head>
<body>
<pre>
<table width=100% bgcolor=#CFCFE5><tr> <td> <font face=arial size=+3>
Build Log
</font></table><table width=* cellspacing=0 cellpadding=0><tr><td width=0 bgcolor=#EDEDF5>&nbsp;</td><td width=0 bgcolor=#FFFFFF>&nbsp;</td><td width=*><pre>
<h3>------- Build started: Project: ccext2, Configuration: Debug|Win32 -------
</h3>
</pre></table><table width=100% bgcolor=#DFDFE5><tr><td><font face=arial size=+2>
Environment Space
</font></table><table width=* cellspacing=0 cellpadding=0><tr><td width=0 bgcolor=#EDEDF5>&nbsp;</td><td width=0 bgcolor=#FFFFFF>&nbsp;</td><td width=*><pre>    ALLUSERSPROFILE=C:\Documents and Settings\All Users
    APPDATA=C:\Documents and Settings\zemian.deng\Application Data
    CI_HOLOS_CLI=C:\Program Files\Seagate Software\Open Olap\
    CommonProgramFiles=C:\Program Files\Common Files
    COMPUTERNAME=KMD-ZEMIAND
    ComSpec=C:\WINDOWS\system32\cmd.exe
    EDITOR=vi
    HOME=C:/data/zdeng
    HOMEDRIVE=C:
    HOMEPATH=\Documents and Settings\zemian.deng
    INCLUDE=C:\Program Files\Microsoft Visual Studio .NET\Vc7\include;C:\Program Files\Microsoft Visual Studio .NET\Vc7\atlmfc\include;C:\Program Files\Microsoft Visual Studio .NET\Vc7\PlatformSDK\include\prerelease;C:\Program Files\Microsoft Visual Studio .NET\Vc7\PlatformSDK\include;C:\Program Files\Microsoft Visual Studio .NET\FrameworkSDK\include
    INTERIX_ROOT=/dev/fs/C/SFU/
    INTERIX_ROOT_WIN=C:\SFU\
    JAVA_HOME=C:\apps\j2sdk1.4.2_04
    LD_LIBRARY_PATH=/usr/lib:/usr/X11R5/lib
    LIB=C:\Program Files\Microsoft Visual Studio .NET\Vc7\lib;C:\Program Files\Microsoft Visual Studio .NET\Vc7\atlmfc\lib;C:\Program Files\Microsoft Visual Studio .NET\Vc7\PlatformSDK\lib\prerelease;C:\Program Files\Microsoft Visual Studio .NET\Vc7\PlatformSDK\lib;C:\Program Files\Microsoft Visual Studio .NET\FrameworkSDK\lib
    LIBPATH=
    LOGONSERVER=\\KP-MAILSTORE01
    NUMBER_OF_PROCESSORS=1
    OPENNT_ROOT=/dev/fs/C/SFU/
    OS=Windows_NT
    Path=C:\Program Files\Microsoft Visual Studio .NET\Vc7\bin;C:\Program Files\Microsoft Visual Studio .NET\Common7\Tools\bin\prerelease;C:\Program Files\Microsoft Visual Studio .NET\Common7\Tools\bin;C:\Program Files\Microsoft Visual Studio .NET\Common7\tools;C:\Program Files\Microsoft Visual Studio .NET\Common7\ide;C:\Program Files\HTML Help Workshop\;C:\Program Files\Microsoft Visual Studio .NET\FrameworkSDK\bin;C:\WINDOWS\Microsoft.NET\Framework\v1.0.3705;C:\Program Files\eDrawings2003\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32\WBEM;C:\Program Files\Seagate Software\NOTES\;C:\Program Files\Seagate Software\NOTES\DATA\;C:\Program Files\Common Files\Compuware\NMShared;C:\Program Files\Compuware\DevPartner Studio\Analysis;C:\Program Files\Compuware\DevPartner Studio\Distributed Analyzer;C:\SFU\common\;C:\Projects\Delta\SAPI\Common Files\system;C:\MSSQL7\BINN
    PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH
    PROCESSOR_ARCHITECTURE=x86
    PROCESSOR_IDENTIFIER=x86 Family 15 Model 2 Stepping 9, GenuineIntel
    PROCESSOR_LEVEL=15
    PROCESSOR_REVISION=0209
    ProgramFiles=C:\Program Files
    SESSIONNAME=Console
    SFUDIR=C:\SFU\
    SFUDIR_INTERIX=/dev/fs/C/SFU/
    SystemDrive=C:
    SystemRoot=C:\WINDOWS
    TEMP=C:\DOCUME~1\ZEMIAN~1.DEN\LOCALS~1\Temp
    TMP=C:\DOCUME~1\ZEMIAN~1.DEN\LOCALS~1\Temp
    USERDNSDOMAIN=KINETICSUSA.COM
    USERDOMAIN=KINETICS2
    USERNAME=zemian.deng
    USERPROFILE=C:\Documents and Settings\zemian.deng
    VSCOMNTOOLS="C:\Program Files\Microsoft Visual Studio .NET\Common7\Tools\"
    windir=C:\WINDOWS
    XAPPLRESDIR=/usr/X11R5/lib/X11/app-defaults
    XCMSDB=/usr/X11R5/lib/X11/Xcms.txt
    XKEYSYMDB=/usr/X11R5/lib/X11/XKeysymDB
    XNLSPATH=/usr/X11R5/lib/X11/nls
    _ACP_ATLPROV=C:\Program Files\Microsoft Visual Studio .NET\Vc7\bin\ATLPROV.DLL
    _ACP_INCLUDE=..\w32;..\include;C:\Program Files\Microsoft Visual Studio .NET\Vc7\include;C:\Program Files\Microsoft Visual Studio .NET\Vc7\atlmfc\include;C:\Program Files\Microsoft Visual Studio .NET\Vc7\PlatformSDK\include\prerelease;C:\Program Files\Microsoft Visual Studio .NET\Vc7\PlatformSDK\include;C:\Program Files\Microsoft Visual Studio .NET\FrameworkSDK\include
    _ACP_LIB=C:\Program Files\Microsoft Visual Studio .NET\Vc7\lib;C:\Program Files\Microsoft Visual Studio .NET\Vc7\atlmfc\lib;C:\Program Files\Microsoft Visual Studio .NET\Vc7\PlatformSDK\lib\prerelease;C:\Program Files\Microsoft Visual Studio .NET\Vc7\PlatformSDK\lib;C:\Program Files\Microsoft Visual Studio .NET\FrameworkSDK\lib;..\w32;..\include;C:\Program Files\Microsoft Visual Studio .NET\Vc7\include;C:\Program Files\Microsoft Visual Studio .NET\Vc7\atlmfc\include;C:\Program Files\Microsoft Visual Studio .NET\Vc7\PlatformSDK\include\prerelease;C:\Program Files\Microsoft Visual Studio .NET\Vc7\PlatformSDK\include;C:\Program Files\Microsoft Visual Studio .NET\FrameworkSDK\include
    _ACP_PATH=C:\Program Files\Microsoft Visual Studio .NET\Vc7\bin;C:\Program Files\Microsoft Visual Studio .NET\Common7\Tools\bin\prerelease;C:\Program Files\Microsoft Visual Studio .NET\Common7\Tools\bin;C:\Program Files\Microsoft Visual Studio .NET\Common7\tools;C:\Program Files\Microsoft Visual Studio .NET\Common7\ide;C:\Program Files\HTML Help Workshop\;C:\Program Files\Microsoft Visual Studio .NET\FrameworkSDK\bin;C:\WINDOWS\Microsoft.NET\Framework\v1.0.3705;C:\Program Files\eDrawings2003\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32\WBEM;C:\Program Files\Seagate Software\NOTES\;C:\Program Files\Seagate Software\NOTES\DATA\;C:\Program Files\Common Files\Compuware\NMShared;C:\Program Files\Compuware\DevPartner Studio\Analysis;C:\Program Files\Compuware\DevPartner Studio\Distributed Analyzer;C:\SFU\common\;C:\Projects\Delta\SAPI\Common Files\system;C:\MSSQL7\BINN
</pre></table><table width=100% bgcolor=#DFDFE5><tr><td><font face=arial size=+2>
Command Lines
</font></table><table width=* cellspacing=0 cellpadding=0><tr><td width=0 bgcolor=#EDEDF5>&nbsp;</td><td width=0 bgcolor=#FFFFFF>&nbsp;</td><td width=*><pre>Creating temporary file "C:\DOCUME~1\ZEMIAN~1.DEN\LOCALS~1\Temp\RSP00000F.rsp" with contents
[
/Od /I "..\w32" /I "..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_USRDLL" /D "CCEXT2_EXPORTS" /D "_MBCS" /D "_WINDLL" /FD /EHsc /RTC1 /MDd /YX"stdafx.h" /Fp".\Debug/ccext2.pch" /Fo".\Debug/" /Fd".\Debug/" /W3 /c /ZI  /out:"debug/ccext2d.dll" 
"\data\src\c++\commoncpp2-1.1.0\src\xml.cpp"
"\data\src\c++\commoncpp2-1.1.0\src\urlstring.cpp"
"\data\src\c++\commoncpp2-1.1.0\src\url.cpp"
"\data\src\c++\commoncpp2-1.1.0\src\unix.cpp"
"\data\src\c++\commoncpp2-1.1.0\src\serial.cpp"
"\data\src\c++\commoncpp2-1.1.0\src\persist.cpp"
"\data\src\c++\commoncpp2-1.1.0\src\numbers.cpp"
"\data\src\c++\commoncpp2-1.1.0\src\network.cpp"
"\data\src\c++\commoncpp2-1.1.0\src\md5.cpp"
"\data\src\c++\commoncpp2-1.1.0\src\getopt1.c"
"\data\src\c++\commoncpp2-1.1.0\src\getopt.c"
"\data\src\c++\commoncpp2-1.1.0\src\fifo.cpp"
"\data\src\c++\commoncpp2-1.1.0\src\engine.cpp"
"\data\src\c++\commoncpp2-1.1.0\src\digest.cpp"
"\data\src\c++\commoncpp2-1.1.0\src\date.cpp"
"\data\src\c++\commoncpp2-1.1.0\src\cmdoptns.cpp"
"\data\src\c++\commoncpp2-1.1.0\src\buffer.cpp"
]
Creating command line "cl.exe @C:\DOCUME~1\ZEMIAN~1.DEN\LOCALS~1\Temp\RSP00000F.rsp /nologo"
</pre></table><table width=100% bgcolor=#DFDFE5><tr><td><font face=arial size=+2>
Output Window
</font></table><table width=* cellspacing=0 cellpadding=0><tr><td width=0 bgcolor=#EDEDF5>&nbsp;</td><td width=0 bgcolor=#FFFFFF>&nbsp;</td><td width=*><pre>Compiling...
xml.cpp
urlstring.cpp
url.cpp
unix.cpp
serial.cpp
c:\data\src\c++\commoncpp2-1.1.0\src\serial.cpp(968) : warning C4355: 'this' : used in base member initializer list
c:\data\src\c++\commoncpp2-1.1.0\src\serial.cpp(987) : warning C4355: 'this' : used in base member initializer list
persist.cpp
c:\Program Files\Microsoft Visual Studio .NET\Vc7\include\functional(139) : error C2678: binary '<' : no operator found which takes a left-hand operand of type 'const ost::String' (or there is no acceptable conversion)
        c:\Program Files\Microsoft Visual Studio .NET\Vc7\include\functional(138) : while compiling class-template member function 'bool std::less<_Ty>::operator ()(const _Ty &,const ost::String &) const'
        with
        [
            _Ty=ost::String
        ]
        c:\Program Files\Microsoft Visual Studio .NET\Vc7\include\map(36) : see reference to class template instantiation 'std::less<_Ty>' being compiled
        with
        [
            _Ty=ost::String
        ]
        c:\Program Files\Microsoft Visual Studio .NET\Vc7\include\xtree(19) : see reference to class template instantiation 'std::_Tmap_traits<_Kty,_Ty,_Pr,_Alloc,_Mfl>' being compiled
        with
        [
            _Kty=ost::String,
            _Ty=int32,
            _Pr=std::less<ost::String>,
            _Alloc=std::allocator<std::pair<const ost::String,int32>>,
            _Mfl=false
        ]
        c:\Program Files\Microsoft Visual Studio .NET\Vc7\include\xtree(61) : see reference to class template instantiation 'std::_Tree_nod<_Traits>' being compiled
        with
        [
            _Traits=std::_Tmap_traits<ost::String,int32,std::less<ost::String>,std::allocator<std::pair<const ost::String,int32>>,false>
        ]
        c:\Program Files\Microsoft Visual Studio .NET\Vc7\include\xtree(83) : see reference to class template instantiation 'std::_Tree_ptr<_Traits>' being compiled
        with
        [
            _Traits=std::_Tmap_traits<ost::String,int32,std::less<ost::String>,std::allocator<std::pair<const ost::String,int32>>,false>
        ]
        c:\Program Files\Microsoft Visual Studio .NET\Vc7\include\xtree(101) : see reference to class template instantiation 'std::_Tree_val<_Traits>' being compiled
        with
        [
            _Traits=std::_Tmap_traits<ost::String,int32,std::less<ost::String>,std::allocator<std::pair<const ost::String,int32>>,false>
        ]
        c:\Program Files\Microsoft Visual Studio .NET\Vc7\include\map(77) : see reference to class template instantiation 'std::_Tree<_Traits>' being compiled
        with
        [
            _Traits=std::_Tmap_traits<ost::String,int32,std::less<ost::String>,std::allocator<std::pair<const ost::String,int32>>,false>
        ]
        c:\data\src\c++\commoncpp2-1.1.0\include\cc++\persist.h(383) : see reference to class template instantiation 'std::map<_Kty,_Ty,_Pr,_Alloc>' being compiled
        with
        [
            _Kty=ost::String,
            _Ty=int32,
            _Pr=std::less<ost::String>,
            _Alloc=std::allocator<std::pair<const ost::String,int32>>
        ]
numbers.cpp
c:\data\src\c++\commoncpp2-1.1.0\src\numbers.cpp(116) : warning C4244: '=' : conversion from 'long' to 'char', possible loss of data
c:\data\src\c++\commoncpp2-1.1.0\src\numbers.cpp(218) : warning C4244: '=' : conversion from 'long' to 'char', possible loss of data
network.cpp
md5.cpp
getopt1.c
getopt.c
fifo.cpp
engine.cpp
c:\Program Files\Microsoft Visual Studio .NET\Vc7\include\functional(139) : error C2678: binary '<' : no operator found which takes a left-hand operand of type 'const ost::String' (or there is no acceptable conversion)
        c:\Program Files\Microsoft Visual Studio .NET\Vc7\include\functional(138) : while compiling class-template member function 'bool std::less<_Ty>::operator ()(const _Ty &,const ost::String &) const'
        with
        [
            _Ty=ost::String
        ]
        c:\Program Files\Microsoft Visual Studio .NET\Vc7\include\map(36) : see reference to class template instantiation 'std::less<_Ty>' being compiled
        with
        [
            _Ty=ost::String
        ]
        c:\Program Files\Microsoft Visual Studio .NET\Vc7\include\xtree(19) : see reference to class template instantiation 'std::_Tmap_traits<_Kty,_Ty,_Pr,_Alloc,_Mfl>' being compiled
        with
        [
            _Kty=ost::String,
            _Ty=int32,
            _Pr=std::less<ost::String>,
            _Alloc=std::allocator<std::pair<const ost::String,int32>>,
            _Mfl=false
        ]
        c:\Program Files\Microsoft Visual Studio .NET\Vc7\include\xtree(61) : see reference to class template instantiation 'std::_Tree_nod<_Traits>' being compiled
        with
        [
            _Traits=std::_Tmap_traits<ost::String,int32,std::less<ost::String>,std::allocator<std::pair<const ost::String,int32>>,false>
        ]
        c:\Program Files\Microsoft Visual Studio .NET\Vc7\include\xtree(83) : see reference to class template instantiation 'std::_Tree_ptr<_Traits>' being compiled
        with
        [
            _Traits=std::_Tmap_traits<ost::String,int32,std::less<ost::String>,std::allocator<std::pair<const ost::String,int32>>,false>
        ]
        c:\Program Files\Microsoft Visual Studio .NET\Vc7\include\xtree(101) : see reference to class template instantiation 'std::_Tree_val<_Traits>' being compiled
        with
        [
            _Traits=std::_Tmap_traits<ost::String,int32,std::less<ost::String>,std::allocator<std::pair<const ost::String,int32>>,false>
        ]
        c:\Program Files\Microsoft Visual Studio .NET\Vc7\include\map(77) : see reference to class template instantiation 'std::_Tree<_Traits>' being compiled
        with
        [
            _Traits=std::_Tmap_traits<ost::String,int32,std::less<ost::String>,std::allocator<std::pair<const ost::String,int32>>,false>
        ]
        c:\data\src\c++\commoncpp2-1.1.0\include\cc++\persist.h(383) : see reference to class template instantiation 'std::map<_Kty,_Ty,_Pr,_Alloc>' being compiled
        with
        [
            _Kty=ost::String,
            _Ty=int32,
            _Pr=std::less<ost::String>,
            _Alloc=std::allocator<std::pair<const ost::String,int32>>
        ]
digest.cpp
c:\data\src\c++\commoncpp2-1.1.0\src\digest.cpp(64) : warning C4355: 'this' : used in base member initializer list
date.cpp
cmdoptns.cpp
buffer.cpp
</pre></table><table width=100% bgcolor=#DFDFE5><tr><td><font face=arial size=+2>
Results
</font></table><table width=* cellspacing=0 cellpadding=0><tr><td width=0 bgcolor=#EDEDF5>&nbsp;</td><td width=0 bgcolor=#FFFFFF>&nbsp;</td><td width=*><pre>
Build log was saved at "file://c:\data\src\c++\commoncpp2-1.1.0\w32\Debug\BuildLog.htm"
ccext2 - 2 error(s), 5 warning(s)</pre></table><table   width=100% height=20 bgcolor=#CFCFE5><tr><td><font face=arial size=+2>
</font></table></body></html>

--Boundary_(ID_JZEwvCICfM00NL7KFvsD2w)--



From MAILER-DAEMON Wed Apr 07 16:38:23 2004
Received: from list by monty-python.gnu.org with archive (Exim 4.30)
	id 1BBJoS-0000M4-1o
	for mharc-bug-commoncpp@gnu.org; Wed, 07 Apr 2004 16:38:20 -0400
Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30)
	id 1BBGEq-000668-VB
	for bug-commoncpp@gnu.org; Wed, 07 Apr 2004 12:49:20 -0400
Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30)
	id 1BBGED-0005gY-RE
	for bug-commoncpp@gnu.org; Wed, 07 Apr 2004 12:49:12 -0400
Received: from [199.232.41.8] (helo=mx20.gnu.org)
	by monty-python.gnu.org with esmtp (TLSv1:DES-CBC3-SHA:168)
	(Exim 4.30) id 1BBGED-0005g6-DV
	for bug-commoncpp@gnu.org; Wed, 07 Apr 2004 12:48:41 -0400
Received: from [152.66.102.122] (helo=bell.phy.bme.hu)
	by mx20.gnu.org with esmtp (Exim 4.30) id 1BBEpK-0003lo-KW
	for bug-commoncpp@gnu.org; Wed, 07 Apr 2004 11:18:54 -0400
Received: from localhost ([127.0.0.1] helo=123mail.org)
	by bell.phy.bme.hu with esmtp (Exim 3.35 #1 (Debian))
	id 1BBEp5-0000hB-00
	for <bug-commoncpp@gnu.org>; Wed, 07 Apr 2004 17:18:39 +0200
Message-ID: <40741BCF.3030206@123mail.org>
Date: Wed, 07 Apr 2004 17:18:39 +0200
From: Gabor Szabo <gabor_szabo@123mail.org>
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040113
X-Accept-Language: en-us, en
MIME-Version: 1.0
To: bug-commoncpp@gnu.org
Content-Type: multipart/mixed; boundary="------------000900040307020109050004"
X-Mailman-Approved-At: Wed, 07 Apr 2004 16:38:15 -0400
Subject: Threads leak?
X-BeenThere: bug-commoncpp@gnu.org
X-Mailman-Version: 2.1.4
Precedence: list
List-Id: Bug reports for Common C++ <bug-commoncpp.gnu.org>
List-Unsubscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=unsubscribe>
List-Archive: <http://mail.gnu.org/pipermail/bug-commoncpp>
List-Post: <mailto:bug-commoncpp@gnu.org>
List-Help: <mailto:bug-commoncpp-request@gnu.org?subject=help>
List-Subscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 07 Apr 2004 16:49:22 -0000

This is a multi-part message in MIME format.
--------------000900040307020109050004
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit



Hi there,


In my program I had to repetitively create, run and destroy 
threads with the Thread class, and noticed that the memory 
footprint of the process just keeps growing (as shown by top). I 
have attached two pieces of code, one with the Thread class, and 
one using pthreads, both performing the same operations from this 
point of view. While the memory usage of the pthreads one does 
not increase, this is not true for the CC++ example. I am using 
Common C++ 1.1.0.

I have looked at the source code of Threads, but did not see any 
indication of why this is happening.


Gabor Szabo


--------------000900040307020109050004
Content-Type: application/x-tar;
 name="thtest.tar.gz"
Content-Transfer-Encoding: base64
Content-Disposition: inline;
 filename="thtest.tar.gz"

H4sIAE0NdEAAA+1VS2/TQBDONfsrhtJWdvOynUelJCAQCC4BDsAJEHU3TrLgrC3vuqqo8t+Z
Wdt5tKLtgQQO+0nJzk5mdmYf35d34c9oJuKotkd4vucNer2a53lBP+jS6Pv9AY0G3X635tPg
ef3zAP1+4HvdGnj7bKpCrnSYAdTUr/AyuSdO6XwaSX2Ilg4J9urN5OXbj/AMWh88uOjkKuvE
CQ/jDk+Wy0TyRqNzKWSH87nMgxZP5EzModWaxeFcXTA2eV3lPz43FpcKh+hak4WLhHE8rHMO
qWaMczLbnLP6vNGAY6do0EWrrIXmGFoJHL9gLNXDeqrbjwr+10f9X8Ic9Z5rPMT/80Fvzf/+
Of7u+91e3/L/EGDsqZA8xr3BWCRKZ1G4fL7l40RivUD3tL14zhjLlZBzkOEyUmnII1B6Orrj
xIVGGCukBo7S4NGEx6FS8GmhI6VhCGl+GQuOc1qa3bBiPmQAV4mYQpZLx8XJDX4AsImRMYrw
4VDFUZQ6fZe8K7aqii1DIR0ywmzOm8AXeLVnaF99+eYyWqosrxeUSIFZRJ1ihSTXMB7DET0H
/VUeUcAsycAsJ8wmcBgDPlSyGg3XNFT0B7QOxuhF2+Q77qj0ixk49NsTXMBl9RtW39Si086y
JKMAlxyRnMYjVl+VubjajwQ3VC622m0zScsu1z48Mzgii5spaIH3UQZhiTyTdBOrHSEk8dz3
G3uA/37QDSr+B4OBT/wPgsDy/xDYonq6ofnGifQWyW1Xhmzf9eVSYOSdVPx/L1RjRwkMwc+0
oaJTTai0mBYsLemelyzHN2IoUDb4PboW2nn/eTJx6TVvmA/3Ur/KJvaTUSmAaEKGCbqJfAx1
rowcpLhFPXPWauBu5OBhKaCNVtU4fuvIOS2mTaC2sZjZezHblQpeiUTVwQkxuLmlFdzFDAww
p9Dy3S3B2KlspKMqWx7zmXtabPKvFV3tHJbRpOKuSh9p0sl0LUV4MX+8ykqkHM+9rVIWFhYW
FhYWFhYWFhYWFhYWFhYWFhYWFhYWFhaPwW9ZU96dACgAAA==
--------------000900040307020109050004--



From MAILER-DAEMON Thu Apr 08 18:22:16 2004
Received: from list by monty-python.gnu.org with archive (Exim 4.30)
	id 1BBhua-0006d2-Cb
	for mharc-bug-commoncpp@gnu.org; Thu, 08 Apr 2004 18:22:16 -0400
Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30)
	id 1BBh9u-0001KJ-Vb
	for bug-commoncpp@gnu.org; Thu, 08 Apr 2004 17:34:02 -0400
Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30)
	id 1BBh9L-000170-SS
	for bug-commoncpp@gnu.org; Thu, 08 Apr 2004 17:33:59 -0400
Received: from [62.28.6.10] (helo=vmail.vterm.com)
	by monty-python.gnu.org with esmtp (Exim 4.30) id 1BBh9J-00013r-7f
	for bug-commoncpp@gnu.org; Thu, 08 Apr 2004 17:33:26 -0400
Received: from tboon [209.50.223.48] by vmail.vterm.com with ESMTP
	(SMTPD32-8.05) id A4541070144; Thu, 08 Apr 2004 17:29:56 -0400
From: "Taylor Boon" <tboon@biopay.com>
To: <bug-commoncpp@gnu.org>
Date: Thu, 8 Apr 2004 17:32:39 -0400
MIME-Version: 1.0
Content-Type: multipart/alternative;
	boundary="----=_NextPart_000_0033_01C41D8F.7D278F90"
X-Mailer: Microsoft Office Outlook, Build 11.0.5510
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
Thread-Index: AcQdsQP7rLl6hZcFR1Og0TutvMVQKQ==
Message-Id: <200404081729500.SM01144@tboon>
X-Declude-Sender: tboon@biopay.com [209.50.223.48]
X-Note: This E-mail was scanned by Declude JunkMail (www.declude.com) for spam.
X-Mailman-Approved-At: Thu, 08 Apr 2004 18:22:14 -0400
Subject: Bug in InetAddress::setIPAddress
X-BeenThere: bug-commoncpp@gnu.org
X-Mailman-Version: 2.1.4
Precedence: list
List-Id: Bug reports for Common C++ <bug-commoncpp.gnu.org>
List-Unsubscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=unsubscribe>
List-Archive: <http://mail.gnu.org/pipermail/bug-commoncpp>
List-Post: <mailto:bug-commoncpp@gnu.org>
List-Help: <mailto:bug-commoncpp-request@gnu.org?subject=help>
List-Subscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=subscribe>
X-List-Received-Date: Thu, 08 Apr 2004 21:34:04 -0000

This is a multi-part message in MIME format.

------=_NextPart_000_0033_01C41D8F.7D278F90
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: 7bit

There seems to be a bug in InetAddress::setIPAddress. If the call to
inet_addr fails and returns INADDR_NONE, the address in the addr.sin_addr
will be set to 255.255.255.255. What should happen is that this is caught
and setIPAddress return false such that setAddress will call gethostbyname.


------=_NextPart_000_0033_01C41D8F.7D278F90
Content-Type: text/html;
	charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<html xmlns:o=3D"urn:schemas-microsoft-com:office:office" =
xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns=3D"http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=3DContent-Type content=3D"text/html; =
charset=3Dus-ascii">
<meta name=3DGenerator content=3D"Microsoft Word 11 (filtered medium)">
<style>
<!--
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0in;
	margin-bottom:.0001pt;
	font-size:12.0pt;
	font-family:"Times New Roman";}
a:link, span.MsoHyperlink
	{color:blue;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{color:purple;
	text-decoration:underline;}
span.EmailStyle17
	{mso-style-type:personal-compose;
	font-family:Arial;
	color:windowtext;}
@page Section1
	{size:8.5in 11.0in;
	margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
	{page:Section1;}
-->
</style>

</head>

<body lang=3DEN-US link=3Dblue vlink=3Dpurple>

<div class=3DSection1>

<p class=3DMsoNormal><font size=3D3 face=3D"Times New Roman"><span =
style=3D'font-size:
12.0pt'>There seems to be a bug in InetAddress::setIPAddress. If the =
call to
inet_addr fails and returns INADDR_NONE, the address in the =
addr.sin_addr will
be set to 255.255.255.255. What should happen is that this is caught and
setIPAddress return false such that setAddress will call =
gethostbyname.<o:p></o:p></span></font></p>

</div>

</body>

</html>

------=_NextPart_000_0033_01C41D8F.7D278F90--




From MAILER-DAEMON Fri Apr 09 04:11:07 2004
Received: from list by monty-python.gnu.org with archive (Exim 4.30)
	id 1BBr6R-0001oG-8R
	for mharc-bug-commoncpp@gnu.org; Fri, 09 Apr 2004 04:11:07 -0400
Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30)
	id 1BBr6F-0001eG-Ol
	for bug-commoncpp@gnu.org; Fri, 09 Apr 2004 04:10:55 -0400
Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30)
	id 1BBr5j-00019G-53
	for bug-commoncpp@gnu.org; Fri, 09 Apr 2004 04:10:54 -0400
Received: from [199.232.41.8] (helo=mx20.gnu.org)
	by monty-python.gnu.org with esmtp (TLSv1:DES-CBC3-SHA:168)
	(Exim 4.30) id 1BBr5g-00017j-8d
	for bug-commoncpp@gnu.org; Fri, 09 Apr 2004 04:10:20 -0400
Received: from [66.185.86.76] (helo=web02-imail.rogers.com)
	by mx20.gnu.org with esmtp (Exim 4.30) id 1BBqz5-0002KY-SF
	for bug-commoncpp@gnu.org; Fri, 09 Apr 2004 04:03:31 -0400
Received: from chatgris.no-ip.com ([24.112.132.225]) by web02-imail.rogers.com
	(InterMail vM.5.01.05.12 201-253-122-126-112-20020820) with ESMTP
	id <20040409080305.OTQD40503.web02-imail.rogers.com@chatgris.no-ip.com>
	for <bug-commoncpp@gnu.org>; Fri, 9 Apr 2004 04:03:05 -0400
From: Joshua Moore-Oliva <josh@chatgris.com>
To: <bug-commoncpp@gnu.org>
Date: Fri, 9 Apr 2004 04:02:34 -0400
User-Agent: KMail/1.6.1
MIME-Version: 1.0
Content-Disposition: inline
Content-Type: text/plain;
  charset="us-ascii"
Content-Transfer-Encoding: 7bit
Message-Id: <200404090402.34896.josh@chatgris.com>
X-Authentication-Info: Submitted using SMTP AUTH PLAIN at
	web02-imail.rogers.com from [24.112.132.225] using ID
	<janetteoliva@rogers.com> at Fri, 9 Apr 2004 04:03:05 -0400
Subject: Segmentation fault//memcpy misuse with command options (partial fix
	patch included)
X-BeenThere: bug-commoncpp@gnu.org
X-Mailman-Version: 2.1.4
Precedence: list
List-Id: Bug reports for Common C++ <bug-commoncpp.gnu.org>
List-Unsubscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=unsubscribe>
List-Archive: <http://mail.gnu.org/pipermail/bug-commoncpp>
List-Post: <mailto:bug-commoncpp@gnu.org>
List-Help: <mailto:bug-commoncpp-request@gnu.org?subject=help>
List-Subscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=subscribe>
X-List-Received-Date: Fri, 09 Apr 2004 08:11:05 -0000

I created a program with quite a few options, and I got a segmentation fault that appears to be a mis-use of memcpy.

Included is a test program to reproduce the problem and some debugging output.

I was able to remove the problems with memcpy with the changes in the included patch, however I am not familiar enough with the code to
determine why the getSpace function in the String library is going out of bounds...  

debugging output before patch

==17692== Source and destination overlap in memcpy(0x41E1A83C, 0x41E1A87C, 86)
==17692==    at 0x40022224: memcpy (in /usr/lib/valgrind/vgskin_memcheck.so)
==17692==    by 0x40277A94: ost::String::set(char const*, unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
==17692==    by 0x40277B07: ost::String::set(ost::String const&) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
==17692==    by 0x402B16C1: ost::String::operator=(ost::String const&) (in /usr/lib/libccext2-1.1.so.0.0.2)
==17692==    by 0x402B7B10: ost::CommandOptionParse_impl::makePrintErrors() (in /usr/lib/libccext2-1.1.so.0.0.2)
==17692==    by 0x402B6CAC: ost::CommandOptionParse_impl::printErrors() (in /usr/lib/libccext2-1.1.so.0.0.2)
==17692==    by 0x8048BD8: main (in /home/chatgris/a.out)
==17692==
==17692== Source and destination overlap in memcpy(0x41E1A87C, 0x41E1A83C, 87)
==17692==    at 0x40022224: memcpy (in /usr/lib/valgrind/vgskin_memcheck.so)
==17692==    by 0x40277C75: ost::String::copy(ost::String const&) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
==17692==    by 0x4027647B: ost::String::String(ost::String const&) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
==17692==    by 0x4027887C: ost::operator+(ost::String const&, char const*) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
==17692==    by 0x402B7B83: ost::CommandOptionParse_impl::makePrintErrors() (in /usr/lib/libccext2-1.1.so.0.0.2)
==17692==    by 0x402B6CAC: ost::CommandOptionParse_impl::printErrors() (in /usr/lib/libccext2-1.1.so.0.0.2)
==17692==    by 0x8048BD8: main (in /home/chatgris/a.out)
==17692==
==17692== Source and destination overlap in memcpy(0x41E1AC68, 0x41E1ABA8, 215)
==17692==    at 0x40022224: memcpy (in /usr/lib/valgrind/vgskin_memcheck.so)
==17692==    by 0x40278310: ost::String::resize(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
==17692==    by 0x40277A71: ost::String::set(char const*, unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
==17692==    by 0x40277B07: ost::String::set(ost::String const&) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
==17692==    by 0x402B16C1: ost::String::operator=(ost::String const&) (in /usr/lib/libccext2-1.1.so.0.0.2)
==17692==    by 0x402B7DD5: ost::CommandOptionParse_impl::makePrintErrors() (in /usr/lib/libccext2-1.1.so.0.0.2)
==17692==    by 0x402B6CAC: ost::CommandOptionParse_impl::printErrors() (in /usr/lib/libccext2-1.1.so.0.0.2)
==17692==    by 0x8048BD8: main (in /home/chatgris/a.out)
Value required for option '--connection_string' is missing
Value==17692==
==17692== Source and destination overlap in memcpy(0x41E1A7BC, 0x41E1A7DC, 41)
==17692==    at 0x40022224: memcpy (in /usr/lib/valgrind/vgskin_memcheck.so)
==17692==    by 0x40277C75: ost::String::copy(ost::String const&) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
==17692==    by 0x4027647B: ost::String::String(ost::String const&) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
==17692==    by 0x402787B2: ost::operator+(ost::String const&, char) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
==17692==    by 0x402B8015: ost::CommandOptionParse_impl::makePrintUsage() (in /usr/lib/libccext2-1.1.so.0.0.2)
==17692==    by 0x402B6C7A: ost::CommandOptionParse_impl::printUsage() (in /usr/lib/libccext2-1.1.so.0.0.2)
==17692==    by 0x8048BFA: main (in /home/chatgris/a.out)
==17692==
==17692== Invalid read of size 4
==17692==    at 0x40278576: ost::String::getSpace(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
==17692==    by 0x402781F6: ost::String::resize(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
==17692==    by 0x40277A71: ost::String::set(char const*, unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
==17692==    by 0x40277B07: ost::String::set(ost::String const&) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
==17692==    by 0x402B16C1: oValue==26722== Invalid read of size 4
==26722==    at 0x40278576: ost::String::getSpace(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
==26722==    by 0x402781F6: ost::String::resize(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
==26722==    by 0x40277A71: ost::String::set(char const*, unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
==26722==    by 0x40277B07: ost::String::set(ost::String const&) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
==26722==    by 0x402B16C1: ost::String::operator=(ost::String const&) (in /usr/lib/libccext2-1.1.so.0.0.2)
==26722==    by 0x402B802A: ost::CommandOptionParse_impl::makePrintUsage() (in /usr/lib/libccext2-1.1.so.0.0.2)
==26722==    by 0x402B6C7A: ost::CommandOptionParse_impl::printUsage() (in /usr/lib/libccext2-1.1.so.0.0.2)
==26722==    by 0x8048BFA: main (main.cpp:69)
==26722==  Address 0x20202020 is not stack'd, malloc'd or free'd
==26722==
==26722== Process terminating with default action of signal 11 (SIGSEGV): dumping core
==26722==  Address not mapped to object at address 0x20202020
==26722==    at 0x40278576: ost::String::getSpace(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
==26722==    by 0x402781F6: ost::String::resize(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
==26722==    by 0x40277A71: ost::String::set(char const*, unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
==26722==    by 0x40277B07: ost::String::set(ost::String const&) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
==26722==    by 0x402B16C1: ost::String::operator=(ost::String const&) (in /usr/lib/libccext2-1.1.so.0.0.2)
==26722==    by 0x402B802A: ost::CommandOptionParse_impl::makePrintUsage() (in /usr/lib/libccext2-1.1.so.0.0.2)
==26722==    by 0x402B6C7A: ost::CommandOptionParse_impl::printUsage() (in /usr/lib/libccext2-1.1.so.0.0.2)
==26722==    by 0x8048BFA: main (main.cpp:69)st::String::operator=(ost::String const&) (in /usr/lib/libccext2-1.1.so.0.0.2)
==17692==    by 0x402B802A: ost::CommandOptionParse_impl::makePrintUsage() (in /usr/lib/libccext2-1.1.so.0.0.2)
==17692==    by 0x402B6C7A: ost::CommandOptionParse_impl::printUsage() (in /usr/lib/libccext2-1.1.so.0.0.2)
==17692==    by 0x8048BFA: main (in /home/chatgris/a.out)
==17692==  Address 0x20202020 is not stack'd, malloc'd or free'd
==17692==
==17692== Process terminating with default action of signal 11 (SIGSEGV): dumping core
==17692==  Address not mapped to object at address 0x20202020
==17692==    at 0x40278576: ost::String::getSpace(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
==17692==    by 0x402781F6: ost::String::resize(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
==17692==    by 0x40277A71: ost::String::set(char const*, unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
==17692==    by 0x40277B07: ost::String::set(ost::String const&) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
==17692==    by 0x402B16C1: ost::String::operator=(ost::String const&) (in /usr/lib/libccext2-1.1.so.0.0.2)
==17692==    by 0x402B802A: ost::CommandOptionParse_impl::makePrintUsage() (in /usr/lib/libccext2-1.1.so.0.0.2)
==17692==    by 0x402B6C7A: ost::CommandOptionParse_impl::printUsage() (in /usr/lib/libccext2-1.1.so.0.0.2)
==17692==    by 0x8048BFA: main (in /home/chatgris/a.out)


test case

#include <iostream>
#include <cc++/common.h>

ost::CommandOptionArg optConnInfo (
  "connection_string", "c", "Connection String.", true
);

ost::CommandOptionArg optMergeDelimiterField (
  "field_delimiter", "f", "Field delimiter for merge information", true
);

ost::CommandOptionArg optMergeDelimiterRecord (
  "record_delimiter", "r", "Record delimiter for merge information", true
);

ost::CommandOptionArg optMergeNames (
  "merge_names", "n", "Merge Field Names (tab delimited)", true
);

ost::CommandOptionArg optMessageSource (
  "message_source", "s", "Message Source", true
);

ost::CommandOptionArg optQuery (
  "query", "q", "Query to retrieve send data", true
);

ost::CommandOptionArg optSortDir (
  "sort_dir", "sd", "Directory where the sort binary resides", true
);

ost::CommandOptionArg optSortName (
  "sort_name", "sn", "Name of the sort binary", true
);

ost::CommandOptionArg optSortTmpDir (
  "sort_tmp_dir", "st", "Temp dir for sort to use", true
);

ost::CommandOptionArg optMaxBatchSize (
  "max_batch_size", "b", "Maximum Batch Size", true
);

ost::CommandOptionArg optPriority (
  "priority", "p", "Priority for mailing", true
);

ost::CommandOptionNoArg optHelpArg (
  "help", "?", "Print help usage"
);

int main ( int argc, char ** argv ) {
  ost::CommandOptionParse * optArgs =
    ost::makeCommandOptionParse ( argc
                                , argv
                                , "Configurable Procmail receiver.\n"
  );

  // If the user requested help then suppress all the usage error
  // messages.
  if ( optHelpArg.numSet ) {
    std::cerr << optArgs->printUsage();
    return 0;
  }

  // Print usage your way.
  if ( optArgs->argsHaveError() ) {
    std::cerr << optArgs->printErrors();
    std::cerr << optArgs->printUsage();
    return 1;
  }

  std::cout << "Success" << std::endl;

  delete optArgs;
  
  return 0;
}

Patch to get rid of memcpy

170c170
<               memmove(ptr + start, str, count);
---
>               memcpy(ptr + start, str, count);
218c218
<       memmove(ptr + start, ptr + start + count, len - start - count);
---
>       memcpy(ptr + start, ptr + start + count, len - start - count);
253c253
<       memmove(getText() + getLength(), str, len);
---
>       memcpy(getText() + getLength(), str, len);
391c391
<       memmove(getText(), str, Value==26722== Invalid read of size 4
==26722==    at 0x40278576: ost::String::getSpace(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
==26722==    by 0x402781F6: ost::String::resize(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
==26722==    by 0x40277A71: ost::String::set(char const*, unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
==26722==    by 0x40277B07: ost::String::set(ost::String const&) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
==26722==    by 0x402B16C1: ost::String::operator=(ost::String const&) (in /usr/lib/libccext2-1.1.so.0.0.2)
==26722==    by 0x402B802A: ost::CommandOptionParse_impl::makePrintUsage() (in /usr/lib/libccext2-1.1.so.0.0.2)
==26722==    by 0x402B6C7A: ost::CommandOptionParse_impl::printUsage() (in /usr/lib/libccext2-1.1.so.0.0.2)
==26722==    by 0x8048BFA: main (main.cpp:69)
==26722==  Address 0x20202020 is not stack'd, malloc'd or free'd
==26722==
==26722== Process terminating with default action of signal 11 (SIGSEGV): dumping core
==26722==  Address not mapped to object at address 0x20202020
==26722==    at 0x40278576: ost::String::getSpace(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
==26722==    by 0x402781F6: ost::String::resize(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
==26722==    by 0x40277A71: ost::String::set(char const*, unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
==26722==    by 0x40277B07: ost::String::set(ost::String const&) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
==26722==    by 0x402B16C1: ost::String::operator=(ost::String const&) (in /usr/lib/libccext2-1.1.so.0.0.2)
==26722==    by 0x402B802A: ost::CommandOptionParse_impl::makePrintUsage() (in /usr/lib/libccext2-1.1.so.0.0.2)
==26722==    by 0x402B6C7A: ost::CommandOptionParse_impl::printUsage() (in /usr/lib/libccext2-1.1.so.0.0.2)
==26722==    by 0x8048BFA: main (main.cpp:69)len);
---
>       memcpy(getText(), str, len);
418c418
<               memmove(content.ministring.text, getText(), getLength() + 1);
---
>               memcpy(content.ministring.text, getText(), getLength() + 1);
426c426
<       memmove(content.bigstring.text, ptr, getLength() + 1);
---
>       memcpy(content.bigstring.text, ptr, getLength() + 1);
576c576
<               memmove(ptr, content.ministring.text, length);
---
>               memcpy(ptr, content.ministring.text, length);
588c588
<               memmove(content.ministring.text, ptr, length);
---
>               memcpy(content.ministring.text, ptr, length);
597c597
<       memmove(ptr, getText(), length);
---
>       memcpy(ptr, getText(), length);

Debugging results of above program after patch applied

Value==26722== Invalid read of size 4
==26722==    at 0x40278576: ost::String::getSpace(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
==26722==    by 0x402781F6: ost::String::resize(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
==26722==    by 0x40277A71: ost::String::set(char const*, unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
==26722==    by 0x40277B07: ost::String::set(ost::String const&) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
==26722==    by 0x402B16C1: ost::String::operator=(ost::String const&) (in /usr/lib/libccext2-1.1.so.0.0.2)
==26722==    by 0x402B802A: ost::CommandOptionParse_impl::makePrintUsage() (in /usr/lib/libccext2-1.1.so.0.0.2)
==26722==    by 0x402B6C7A: ost::CommandOptionParse_impl::printUsage() (in /usr/lib/libccext2-1.1.so.0.0.2)
==26722==    by 0x8048BFA: main (main.cpp:69)
==26722==  Address 0x20202020 is not stack'd, malloc'd or free'd
==26722==
==26722== Process terminating with default action of signal 11 (SIGSEGV): dumping core
==26722==  Address not mapped to object at address 0x20202020
==26722==    at 0x40278576: ost::String::getSpace(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
==26722==    by 0x402781F6: ost::String::resize(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
==26722==    by 0x40277A71: ost::String::set(char const*, unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
==26722==    by 0x40277B07: ost::String::set(ost::String const&) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
==26722==    by 0x402B16C1: ost::String::operator=(ost::String const&) (in /usr/lib/libccext2-1.1.so.0.0.2)
==26722==    by 0x402B802A: ost::CommandOptionParse_impl::makePrintUsage() (in /usr/lib/libccext2-1.1.so.0.0.2)
==26722==    by 0x402B6C7A: ost::CommandOptionParse_impl::printUsage() (in /usr/lib/libccext2-1.1.so.0.0.2)
==26722==    by 0x8048BFA: main (main.cpp:69)



From MAILER-DAEMON Fri Apr 09 09:17:24 2004
Received: from list by monty-python.gnu.org with archive (Exim 4.30)
	id 1BBvsp-0007ur-FR
	for mharc-bug-commoncpp@gnu.org; Fri, 09 Apr 2004 09:17:23 -0400
Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30)
	id 1BBvsh-0007oh-A6
	for bug-commoncpp@gnu.org; Fri, 09 Apr 2004 09:17:15 -0400
Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30)
	id 1BBvs5-0007Wu-4A
	for bug-commoncpp@gnu.org; Fri, 09 Apr 2004 09:17:08 -0400
Received: from [216.218.222.122] (helo=mail.ostel.com)
	by monty-python.gnu.org with esmtp (Exim 4.30) id 1BBvs3-0007WG-Tk
	for bug-commoncpp@gnu.org; Fri, 09 Apr 2004 09:16:36 -0400
Received: by mail.ostel.com (Postfix, from userid 1005)
	id C8AF22F2867; Fri,  9 Apr 2004 06:17:16 -0700 (PDT)
Received: from [192.168.1.102] (pool-141-153-170-194.mad.east.verizon.net
	[141.153.170.194]) by mail.ostel.com (Postfix) with ESMTP
	id 5E38B2F2883; Fri,  9 Apr 2004 06:17:14 -0700 (PDT)
From: David Sugar <dyfet@ostel.com>
To: bug-commoncpp@gnu.org
Date: Thu, 8 Apr 2004 21:19:21 -0400
User-Agent: KMail/1.6.2
References: <200404090402.34896.josh@chatgris.com>
In-Reply-To: <200404090402.34896.josh@chatgris.com>
MIME-Version: 1.0
Content-Disposition: inline
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Message-Id: <200404082119.21103.dyfet@ostel.com>
Cc: 
Subject: Re: Segmentation fault//memcpy misuse with command options (partial
	fix patch included)
X-BeenThere: bug-commoncpp@gnu.org
X-Mailman-Version: 2.1.4
Precedence: list
List-Id: Bug reports for Common C++ <bug-commoncpp.gnu.org>
List-Unsubscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=unsubscribe>
List-Archive: <http://mail.gnu.org/pipermail/bug-commoncpp>
List-Post: <mailto:bug-commoncpp@gnu.org>
List-Help: <mailto:bug-commoncpp-request@gnu.org?subject=help>
List-Subscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=subscribe>
X-List-Received-Date: Fri, 09 Apr 2004 13:17:18 -0000

So what you did is basically replace every memcpy with a memmove?  Hmm...in at 
least some cases, memcpy may be inline'd with assembler code.  Perhaps there 
is something odd in the inline code substitution?  Also, your patch got a 
little chopped up in the debugging text...

David

On Friday 09 April 2004 04:02 am, Joshua Moore-Oliva wrote:
> I created a program with quite a few options, and I got a segmentation
> fault that appears to be a mis-use of memcpy.
>
> Included is a test program to reproduce the problem and some debugging
> output.
>
> I was able to remove the problems with memcpy with the changes in the
> included patch, however I am not familiar enough with the code to determine
> why the getSpace function in the String library is going out of bounds...
>
> debugging output before patch
>
> ==17692== Source and destination overlap in memcpy(0x41E1A83C, 0x41E1A87C,
> 86) ==17692==    at 0x40022224: memcpy (in
> /usr/lib/valgrind/vgskin_memcheck.so) ==17692==    by 0x40277A94:
> ost::String::set(char const*, unsigned) (in
> /usr/lib/libccgnu2-1.1.so.0.0.2) ==17692==    by 0x40277B07:
> ost::String::set(ost::String const&) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> ==17692==    by 0x402B16C1: ost::String::operator=(ost::String const&) (in
> /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x402B7B10:
> ost::CommandOptionParse_impl::makePrintErrors() (in
> /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x402B6CAC:
> ost::CommandOptionParse_impl::printErrors() (in
> /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x8048BD8: main (in
> /home/chatgris/a.out)
> ==17692==
> ==17692== Source and destination overlap in memcpy(0x41E1A87C, 0x41E1A83C,
> 87) ==17692==    at 0x40022224: memcpy (in
> /usr/lib/valgrind/vgskin_memcheck.so) ==17692==    by 0x40277C75:
> ost::String::copy(ost::String const&) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> ==17692==    by 0x4027647B: ost::String::String(ost::String const&) (in
> /usr/lib/libccgnu2-1.1.so.0.0.2) ==17692==    by 0x4027887C:
> ost::operator+(ost::String const&, char const*) (in
> /usr/lib/libccgnu2-1.1.so.0.0.2) ==17692==    by 0x402B7B83:
> ost::CommandOptionParse_impl::makePrintErrors() (in
> /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x402B6CAC:
> ost::CommandOptionParse_impl::printErrors() (in
> /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x8048BD8: main (in
> /home/chatgris/a.out)
> ==17692==
> ==17692== Source and destination overlap in memcpy(0x41E1AC68, 0x41E1ABA8,
> 215) ==17692==    at 0x40022224: memcpy (in
> /usr/lib/valgrind/vgskin_memcheck.so) ==17692==    by 0x40278310:
> ost::String::resize(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> ==17692==    by 0x40277A71: ost::String::set(char const*, unsigned) (in
> /usr/lib/libccgnu2-1.1.so.0.0.2) ==17692==    by 0x40277B07:
> ost::String::set(ost::String const&) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> ==17692==    by 0x402B16C1: ost::String::operator=(ost::String const&) (in
> /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x402B7DD5:
> ost::CommandOptionParse_impl::makePrintErrors() (in
> /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x402B6CAC:
> ost::CommandOptionParse_impl::printErrors() (in
> /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x8048BD8: main (in
> /home/chatgris/a.out)
> Value required for option '--connection_string' is missing
> Value==17692==
> ==17692== Source and destination overlap in memcpy(0x41E1A7BC, 0x41E1A7DC,
> 41) ==17692==    at 0x40022224: memcpy (in
> /usr/lib/valgrind/vgskin_memcheck.so) ==17692==    by 0x40277C75:
> ost::String::copy(ost::String const&) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> ==17692==    by 0x4027647B: ost::String::String(ost::String const&) (in
> /usr/lib/libccgnu2-1.1.so.0.0.2) ==17692==    by 0x402787B2:
> ost::operator+(ost::String const&, char) (in
> /usr/lib/libccgnu2-1.1.so.0.0.2) ==17692==    by 0x402B8015:
> ost::CommandOptionParse_impl::makePrintUsage() (in
> /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x402B6C7A:
> ost::CommandOptionParse_impl::printUsage() (in
> /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x8048BFA: main (in
> /home/chatgris/a.out)
> ==17692==
> ==17692== Invalid read of size 4
> ==17692==    at 0x40278576: ost::String::getSpace(unsigned) (in
> /usr/lib/libccgnu2-1.1.so.0.0.2) ==17692==    by 0x402781F6:
> ost::String::resize(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> ==17692==    by 0x40277A71: ost::String::set(char const*, unsigned) (in
> /usr/lib/libccgnu2-1.1.so.0.0.2) ==17692==    by 0x40277B07:
> ost::String::set(ost::String const&) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> ==17692==    by 0x402B16C1: oValue==26722== Invalid read of size 4
> ==26722==    at 0x40278576: ost::String::getSpace(unsigned) (in
> /usr/lib/libccgnu2-1.1.so.0.0.2) ==26722==    by 0x402781F6:
> ost::String::resize(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> ==26722==    by 0x40277A71: ost::String::set(char const*, unsigned) (in
> /usr/lib/libccgnu2-1.1.so.0.0.2) ==26722==    by 0x40277B07:
> ost::String::set(ost::String const&) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> ==26722==    by 0x402B16C1: ost::String::operator=(ost::String const&) (in
> /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x402B802A:
> ost::CommandOptionParse_impl::makePrintUsage() (in
> /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x402B6C7A:
> ost::CommandOptionParse_impl::printUsage() (in
> /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x8048BFA: main
> (main.cpp:69)
> ==26722==  Address 0x20202020 is not stack'd, malloc'd or free'd
> ==26722==
> ==26722== Process terminating with default action of signal 11 (SIGSEGV):
> dumping core ==26722==  Address not mapped to object at address 0x20202020
> ==26722==    at 0x40278576: ost::String::getSpace(unsigned) (in
> /usr/lib/libccgnu2-1.1.so.0.0.2) ==26722==    by 0x402781F6:
> ost::String::resize(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> ==26722==    by 0x40277A71: ost::String::set(char const*, unsigned) (in
> /usr/lib/libccgnu2-1.1.so.0.0.2) ==26722==    by 0x40277B07:
> ost::String::set(ost::String const&) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> ==26722==    by 0x402B16C1: ost::String::operator=(ost::String const&) (in
> /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x402B802A:
> ost::CommandOptionParse_impl::makePrintUsage() (in
> /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x402B6C7A:
> ost::CommandOptionParse_impl::printUsage() (in
> /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x8048BFA: main
> (main.cpp:69)st::String::operator=(ost::String const&) (in
> /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x402B802A:
> ost::CommandOptionParse_impl::makePrintUsage() (in
> /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x402B6C7A:
> ost::CommandOptionParse_impl::printUsage() (in
> /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x8048BFA: main (in
> /home/chatgris/a.out)
> ==17692==  Address 0x20202020 is not stack'd, malloc'd or free'd
> ==17692==
> ==17692== Process terminating with default action of signal 11 (SIGSEGV):
> dumping core ==17692==  Address not mapped to object at address 0x20202020
> ==17692==    at 0x40278576: ost::String::getSpace(unsigned) (in
> /usr/lib/libccgnu2-1.1.so.0.0.2) ==17692==    by 0x402781F6:
> ost::String::resize(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> ==17692==    by 0x40277A71: ost::String::set(char const*, unsigned) (in
> /usr/lib/libccgnu2-1.1.so.0.0.2) ==17692==    by 0x40277B07:
> ost::String::set(ost::String const&) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> ==17692==    by 0x402B16C1: ost::String::operator=(ost::String const&) (in
> /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x402B802A:
> ost::CommandOptionParse_impl::makePrintUsage() (in
> /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x402B6C7A:
> ost::CommandOptionParse_impl::printUsage() (in
> /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x8048BFA: main (in
> /home/chatgris/a.out)
>
>
> test case
>
> #include <iostream>
> #include <cc++/common.h>
>
> ost::CommandOptionArg optConnInfo (
>   "connection_string", "c", "Connection String.", true
> );
>
> ost::CommandOptionArg optMergeDelimiterField (
>   "field_delimiter", "f", "Field delimiter for merge information", true
> );
>
> ost::CommandOptionArg optMergeDelimiterRecord (
>   "record_delimiter", "r", "Record delimiter for merge information", true
> );
>
> ost::CommandOptionArg optMergeNames (
>   "merge_names", "n", "Merge Field Names (tab delimited)", true
> );
>
> ost::CommandOptionArg optMessageSource (
>   "message_source", "s", "Message Source", true
> );
>
> ost::CommandOptionArg optQuery (
>   "query", "q", "Query to retrieve send data", true
> );
>
> ost::CommandOptionArg optSortDir (
>   "sort_dir", "sd", "Directory where the sort binary resides", true
> );
>
> ost::CommandOptionArg optSortName (
>   "sort_name", "sn", "Name of the sort binary", true
> );
>
> ost::CommandOptionArg optSortTmpDir (
>   "sort_tmp_dir", "st", "Temp dir for sort to use", true
> );
>
> ost::CommandOptionArg optMaxBatchSize (
>   "max_batch_size", "b", "Maximum Batch Size", true
> );
>
> ost::CommandOptionArg optPriority (
>   "priority", "p", "Priority for mailing", true
> );
>
> ost::CommandOptionNoArg optHelpArg (
>   "help", "?", "Print help usage"
> );
>
> int main ( int argc, char ** argv ) {
>   ost::CommandOptionParse * optArgs =
>     ost::makeCommandOptionParse ( argc
>                                 , argv
>                                 , "Configurable Procmail receiver.\n"
>   );
>
>   // If the user requested help then suppress all the usage error
>   // messages.
>   if ( optHelpArg.numSet ) {
>     std::cerr << optArgs->printUsage();
>     return 0;
>   }
>
>   // Print usage your way.
>   if ( optArgs->argsHaveError() ) {
>     std::cerr << optArgs->printErrors();
>     std::cerr << optArgs->printUsage();
>     return 1;
>   }
>
>   std::cout << "Success" << std::endl;
>
>   delete optArgs;
>
>   return 0;
> }
>
> Patch to get rid of memcpy
>
> 170c170
> <               memmove(ptr + start, str, count);
> ---
>
> >               memcpy(ptr + start, str, count);
>
> 218c218
> <       memmove(ptr + start, ptr + start + count, len - start - count);
> ---
>
> >       memcpy(ptr + start, ptr + start + count, len - start - count);
>
> 253c253
> <       memmove(getText() + getLength(), str, len);
> ---
>
> >       memcpy(getText() + getLength(), str, len);
>
> 391c391
> <       memmove(getText(), str, Value==26722== Invalid read of size 4
> ==26722==    at 0x40278576: ost::String::getSpace(unsigned) (in
> /usr/lib/libccgnu2-1.1.so.0.0.2) ==26722==    by 0x402781F6:
> ost::String::resize(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> ==26722==    by 0x40277A71: ost::String::set(char const*, unsigned) (in
> /usr/lib/libccgnu2-1.1.so.0.0.2) ==26722==    by 0x40277B07:
> ost::String::set(ost::String const&) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> ==26722==    by 0x402B16C1: ost::String::operator=(ost::String const&) (in
> /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x402B802A:
> ost::CommandOptionParse_impl::makePrintUsage() (in
> /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x402B6C7A:
> ost::CommandOptionParse_impl::printUsage() (in
> /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x8048BFA: main
> (main.cpp:69)
> ==26722==  Address 0x20202020 is not stack'd, malloc'd or free'd
> ==26722==
> ==26722== Process terminating with default action of signal 11 (SIGSEGV):
> dumping core ==26722==  Address not mapped to object at address 0x20202020
> ==26722==    at 0x40278576: ost::String::getSpace(unsigned) (in
> /usr/lib/libccgnu2-1.1.so.0.0.2) ==26722==    by 0x402781F6:
> ost::String::resize(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> ==26722==    by 0x40277A71: ost::String::set(char const*, unsigned) (in
> /usr/lib/libccgnu2-1.1.so.0.0.2) ==26722==    by 0x40277B07:
> ost::String::set(ost::String const&) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> ==26722==    by 0x402B16C1: ost::String::operator=(ost::String const&) (in
> /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x402B802A:
> ost::CommandOptionParse_impl::makePrintUsage() (in
> /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x402B6C7A:
> ost::CommandOptionParse_impl::printUsage() (in
> /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x8048BFA: main
> (main.cpp:69)len);
> ---
>
> >       memcpy(getText(), str, len);
>
> 418c418
> <               memmove(content.ministring.text, getText(), getLength() +
> 1); ---
>
> >               memcpy(content.ministring.text, getText(), getLength() +
> > 1);
>
> 426c426
> <       memmove(content.bigstring.text, ptr, getLength() + 1);
> ---
>
> >       memcpy(content.bigstring.text, ptr, getLength() + 1);
>
> 576c576
> <               memmove(ptr, content.ministring.text, length);
> ---
>
> >               memcpy(ptr, content.ministring.text, length);
>
> 588c588
> <               memmove(content.ministring.text, ptr, length);
> ---
>
> >               memcpy(content.ministring.text, ptr, length);
>
> 597c597
> <       memmove(ptr, getText(), length);
> ---
>
> >       memcpy(ptr, getText(), length);
>
> Debugging results of above program after patch applied
>
> Value==26722== Invalid read of size 4
> ==26722==    at 0x40278576: ost::String::getSpace(unsigned) (in
> /usr/lib/libccgnu2-1.1.so.0.0.2) ==26722==    by 0x402781F6:
> ost::String::resize(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> ==26722==    by 0x40277A71: ost::String::set(char const*, unsigned) (in
> /usr/lib/libccgnu2-1.1.so.0.0.2) ==26722==    by 0x40277B07:
> ost::String::set(ost::String const&) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> ==26722==    by 0x402B16C1: ost::String::operator=(ost::String const&) (in
> /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x402B802A:
> ost::CommandOptionParse_impl::makePrintUsage() (in
> /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x402B6C7A:
> ost::CommandOptionParse_impl::printUsage() (in
> /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x8048BFA: main
> (main.cpp:69)
> ==26722==  Address 0x20202020 is not stack'd, malloc'd or free'd
> ==26722==
> ==26722== Process terminating with default action of signal 11 (SIGSEGV):
> dumping core ==26722==  Address not mapped to object at address 0x20202020
> ==26722==    at 0x40278576: ost::String::getSpace(unsigned) (in
> /usr/lib/libccgnu2-1.1.so.0.0.2) ==26722==    by 0x402781F6:
> ost::String::resize(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> ==26722==    by 0x40277A71: ost::String::set(char const*, unsigned) (in
> /usr/lib/libccgnu2-1.1.so.0.0.2) ==26722==    by 0x40277B07:
> ost::String::set(ost::String const&) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> ==26722==    by 0x402B16C1: ost::String::operator=(ost::String const&) (in
> /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x402B802A:
> ost::CommandOptionParse_impl::makePrintUsage() (in
> /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x402B6C7A:
> ost::CommandOptionParse_impl::printUsage() (in
> /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x8048BFA: main
> (main.cpp:69)
>
>
> _______________________________________________
> Bug-commoncpp mailing list
> Bug-commoncpp@gnu.org
> http://mail.gnu.org/mailman/listinfo/bug-commoncpp



From MAILER-DAEMON Fri Apr 09 16:51:23 2004
Received: from list by monty-python.gnu.org with archive (Exim 4.30)
	id 1BC2yB-0002vw-KE
	for mharc-bug-commoncpp@gnu.org; Fri, 09 Apr 2004 16:51:23 -0400
Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30)
	id 1BC2y9-0002vS-7a
	for bug-commoncpp@gnu.org; Fri, 09 Apr 2004 16:51:21 -0400
Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30)
	id 1BC2wo-0002eL-SX
	for bug-commoncpp@gnu.org; Fri, 09 Apr 2004 16:50:30 -0400
Received: from [199.232.41.8] (helo=mx20.gnu.org)
	by monty-python.gnu.org with esmtp (TLSv1:DES-CBC3-SHA:168)
	(Exim 4.30) id 1BC2wo-0002VJ-73
	for bug-commoncpp@gnu.org; Fri, 09 Apr 2004 16:49:58 -0400
Received: from [66.185.86.74] (helo=fep04-mail.bloor.is.net.cable.rogers.com)
	by mx20.gnu.org with esmtp (Exim 4.30) id 1BC2tO-00067Z-P4
	for bug-commoncpp@gnu.org; Fri, 09 Apr 2004 16:46:26 -0400
Received: from chatgris.no-ip.com ([24.112.132.225])
	by fep04-mail.bloor.is.net.cable.rogers.com
	(InterMail vM.5.01.05.12 201-253-122-126-112-20020820) with ESMTP id
	<20040409204521.UUGM167788.fep04-mail.bloor.is.net.cable.rogers.com@chatgris.no-ip.com>;
	Fri, 9 Apr 2004 16:45:21 -0400
From: Joshua Moore-Oliva <josh@chatgris.com>
To: David Sugar <dyfet@ostel.com>
Date: Fri, 9 Apr 2004 16:56:06 -0400
User-Agent: KMail/1.6.1
References: <200404090402.34896.josh@chatgris.com>
	<200404082119.21103.dyfet@ostel.com>
In-Reply-To: <200404082119.21103.dyfet@ostel.com>
MIME-Version: 1.0
Content-Disposition: inline
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Message-Id: <200404091656.06652.josh@chatgris.com>
X-Authentication-Info: Submitted using SMTP AUTH PLAIN at
	fep04-mail.bloor.is.net.cable.rogers.com from [24.112.132.225]
	using ID <janetteoliva@rogers.com> at Fri,
	9 Apr 2004 16:45:21 -0400
Cc: bug-commoncpp@gnu.org
Subject: Re: Segmentation fault//memcpy misuse with command options (partial
	fix patch included)
X-BeenThere: bug-commoncpp@gnu.org
X-Mailman-Version: 2.1.4
Precedence: list
List-Id: Bug reports for Common C++ <bug-commoncpp.gnu.org>
List-Unsubscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=unsubscribe>
List-Archive: <http://mail.gnu.org/pipermail/bug-commoncpp>
List-Post: <mailto:bug-commoncpp@gnu.org>
List-Help: <mailto:bug-commoncpp-request@gnu.org?subject=help>
List-Subscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=subscribe>
X-List-Received-Date: Fri, 09 Apr 2004 20:51:21 -0000

Yea that's all I did, because memcpy has undefined results when moving memory where the memory areas overlap...

(which is what was happenning )

However, there is still a segfault in the getSpace function of the String class..  is this is pretty much a showstopper bug because I cannot start my program at all
due to it.

Joshua Moore-Oliva.

On April 8, 2004 9:19 pm, David Sugar wrote:
> So what you did is basically replace every memcpy with a memmove?  Hmm...in at 
> least some cases, memcpy may be inline'd with assembler code.  Perhaps there 
> is something odd in the inline code substitution?  Also, your patch got a 
> little chopped up in the debugging text...
> 
> David
> 
> On Friday 09 April 2004 04:02 am, Joshua Moore-Oliva wrote:
> > I created a program with quite a few options, and I got a segmentation
> > fault that appears to be a mis-use of memcpy.
> >
> > Included is a test program to reproduce the problem and some debugging
> > output.
> >
> > I was able to remove the problems with memcpy with the changes in the
> > included patch, however I am not familiar enough with the code to determine
> > why the getSpace function in the String library is going out of bounds...
> >
> > debugging output before patch
> >
> > ==17692== Source and destination overlap in memcpy(0x41E1A83C, 0x41E1A87C,
> > 86) ==17692==    at 0x40022224: memcpy (in
> > /usr/lib/valgrind/vgskin_memcheck.so) ==17692==    by 0x40277A94:
> > ost::String::set(char const*, unsigned) (in
> > /usr/lib/libccgnu2-1.1.so.0.0.2) ==17692==    by 0x40277B07:
> > ost::String::set(ost::String const&) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > ==17692==    by 0x402B16C1: ost::String::operator=(ost::String const&) (in
> > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x402B7B10:
> > ost::CommandOptionParse_impl::makePrintErrors() (in
> > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x402B6CAC:
> > ost::CommandOptionParse_impl::printErrors() (in
> > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x8048BD8: main (in
> > /home/chatgris/a.out)
> > ==17692==
> > ==17692== Source and destination overlap in memcpy(0x41E1A87C, 0x41E1A83C,
> > 87) ==17692==    at 0x40022224: memcpy (in
> > /usr/lib/valgrind/vgskin_memcheck.so) ==17692==    by 0x40277C75:
> > ost::String::copy(ost::String const&) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > ==17692==    by 0x4027647B: ost::String::String(ost::String const&) (in
> > /usr/lib/libccgnu2-1.1.so.0.0.2) ==17692==    by 0x4027887C:
> > ost::operator+(ost::String const&, char const*) (in
> > /usr/lib/libccgnu2-1.1.so.0.0.2) ==17692==    by 0x402B7B83:
> > ost::CommandOptionParse_impl::makePrintErrors() (in
> > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x402B6CAC:
> > ost::CommandOptionParse_impl::printErrors() (in
> > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x8048BD8: main (in
> > /home/chatgris/a.out)
> > ==17692==
> > ==17692== Source and destination overlap in memcpy(0x41E1AC68, 0x41E1ABA8,
> > 215) ==17692==    at 0x40022224: memcpy (in
> > /usr/lib/valgrind/vgskin_memcheck.so) ==17692==    by 0x40278310:
> > ost::String::resize(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > ==17692==    by 0x40277A71: ost::String::set(char const*, unsigned) (in
> > /usr/lib/libccgnu2-1.1.so.0.0.2) ==17692==    by 0x40277B07:
> > ost::String::set(ost::String const&) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > ==17692==    by 0x402B16C1: ost::String::operator=(ost::String const&) (in
> > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x402B7DD5:
> > ost::CommandOptionParse_impl::makePrintErrors() (in
> > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x402B6CAC:
> > ost::CommandOptionParse_impl::printErrors() (in
> > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x8048BD8: main (in
> > /home/chatgris/a.out)
> > Value required for option '--connection_string' is missing
> > Value==17692==
> > ==17692== Source and destination overlap in memcpy(0x41E1A7BC, 0x41E1A7DC,
> > 41) ==17692==    at 0x40022224: memcpy (in
> > /usr/lib/valgrind/vgskin_memcheck.so) ==17692==    by 0x40277C75:
> > ost::String::copy(ost::String const&) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > ==17692==    by 0x4027647B: ost::String::String(ost::String const&) (in
> > /usr/lib/libccgnu2-1.1.so.0.0.2) ==17692==    by 0x402787B2:
> > ost::operator+(ost::String const&, char) (in
> > /usr/lib/libccgnu2-1.1.so.0.0.2) ==17692==    by 0x402B8015:
> > ost::CommandOptionParse_impl::makePrintUsage() (in
> > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x402B6C7A:
> > ost::CommandOptionParse_impl::printUsage() (in
> > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x8048BFA: main (in
> > /home/chatgris/a.out)
> > ==17692==
> > ==17692== Invalid read of size 4
> > ==17692==    at 0x40278576: ost::String::getSpace(unsigned) (in
> > /usr/lib/libccgnu2-1.1.so.0.0.2) ==17692==    by 0x402781F6:
> > ost::String::resize(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > ==17692==    by 0x40277A71: ost::String::set(char const*, unsigned) (in
> > /usr/lib/libccgnu2-1.1.so.0.0.2) ==17692==    by 0x40277B07:
> > ost::String::set(ost::String const&) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > ==17692==    by 0x402B16C1: oValue==26722== Invalid read of size 4
> > ==26722==    at 0x40278576: ost::String::getSpace(unsigned) (in
> > /usr/lib/libccgnu2-1.1.so.0.0.2) ==26722==    by 0x402781F6:
> > ost::String::resize(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > ==26722==    by 0x40277A71: ost::String::set(char const*, unsigned) (in
> > /usr/lib/libccgnu2-1.1.so.0.0.2) ==26722==    by 0x40277B07:
> > ost::String::set(ost::String const&) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > ==26722==    by 0x402B16C1: ost::String::operator=(ost::String const&) (in
> > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x402B802A:
> > ost::CommandOptionParse_impl::makePrintUsage() (in
> > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x402B6C7A:
> > ost::CommandOptionParse_impl::printUsage() (in
> > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x8048BFA: main
> > (main.cpp:69)
> > ==26722==  Address 0x20202020 is not stack'd, malloc'd or free'd
> > ==26722==
> > ==26722== Process terminating with default action of signal 11 (SIGSEGV):
> > dumping core ==26722==  Address not mapped to object at address 0x20202020
> > ==26722==    at 0x40278576: ost::String::getSpace(unsigned) (in
> > /usr/lib/libccgnu2-1.1.so.0.0.2) ==26722==    by 0x402781F6:
> > ost::String::resize(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > ==26722==    by 0x40277A71: ost::String::set(char const*, unsigned) (in
> > /usr/lib/libccgnu2-1.1.so.0.0.2) ==26722==    by 0x40277B07:
> > ost::String::set(ost::String const&) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > ==26722==    by 0x402B16C1: ost::String::operator=(ost::String const&) (in
> > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x402B802A:
> > ost::CommandOptionParse_impl::makePrintUsage() (in
> > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x402B6C7A:
> > ost::CommandOptionParse_impl::printUsage() (in
> > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x8048BFA: main
> > (main.cpp:69)st::String::operator=(ost::String const&) (in
> > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x402B802A:
> > ost::CommandOptionParse_impl::makePrintUsage() (in
> > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x402B6C7A:
> > ost::CommandOptionParse_impl::printUsage() (in
> > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x8048BFA: main (in
> > /home/chatgris/a.out)
> > ==17692==  Address 0x20202020 is not stack'd, malloc'd or free'd
> > ==17692==
> > ==17692== Process terminating with default action of signal 11 (SIGSEGV):
> > dumping core ==17692==  Address not mapped to object at address 0x20202020
> > ==17692==    at 0x40278576: ost::String::getSpace(unsigned) (in
> > /usr/lib/libccgnu2-1.1.so.0.0.2) ==17692==    by 0x402781F6:
> > ost::String::resize(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > ==17692==    by 0x40277A71: ost::String::set(char const*, unsigned) (in
> > /usr/lib/libccgnu2-1.1.so.0.0.2) ==17692==    by 0x40277B07:
> > ost::String::set(ost::String const&) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > ==17692==    by 0x402B16C1: ost::String::operator=(ost::String const&) (in
> > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x402B802A:
> > ost::CommandOptionParse_impl::makePrintUsage() (in
> > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x402B6C7A:
> > ost::CommandOptionParse_impl::printUsage() (in
> > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x8048BFA: main (in
> > /home/chatgris/a.out)
> >
> >
> > test case
> >
> > #include <iostream>
> > #include <cc++/common.h>
> >
> > ost::CommandOptionArg optConnInfo (
> >   "connection_string", "c", "Connection String.", true
> > );
> >
> > ost::CommandOptionArg optMergeDelimiterField (
> >   "field_delimiter", "f", "Field delimiter for merge information", true
> > );
> >
> > ost::CommandOptionArg optMergeDelimiterRecord (
> >   "record_delimiter", "r", "Record delimiter for merge information", true
> > );
> >
> > ost::CommandOptionArg optMergeNames (
> >   "merge_names", "n", "Merge Field Names (tab delimited)", true
> > );
> >
> > ost::CommandOptionArg optMessageSource (
> >   "message_source", "s", "Message Source", true
> > );
> >
> > ost::CommandOptionArg optQuery (
> >   "query", "q", "Query to retrieve send data", true
> > );
> >
> > ost::CommandOptionArg optSortDir (
> >   "sort_dir", "sd", "Directory where the sort binary resides", true
> > );
> >
> > ost::CommandOptionArg optSortName (
> >   "sort_name", "sn", "Name of the sort binary", true
> > );
> >
> > ost::CommandOptionArg optSortTmpDir (
> >   "sort_tmp_dir", "st", "Temp dir for sort to use", true
> > );
> >
> > ost::CommandOptionArg optMaxBatchSize (
> >   "max_batch_size", "b", "Maximum Batch Size", true
> > );
> >
> > ost::CommandOptionArg optPriority (
> >   "priority", "p", "Priority for mailing", true
> > );
> >
> > ost::CommandOptionNoArg optHelpArg (
> >   "help", "?", "Print help usage"
> > );
> >
> > int main ( int argc, char ** argv ) {
> >   ost::CommandOptionParse * optArgs =
> >     ost::makeCommandOptionParse ( argc
> >                                 , argv
> >                                 , "Configurable Procmail receiver.\n"
> >   );
> >
> >   // If the user requested help then suppress all the usage error
> >   // messages.
> >   if ( optHelpArg.numSet ) {
> >     std::cerr << optArgs->printUsage();
> >     return 0;
> >   }
> >
> >   // Print usage your way.
> >   if ( optArgs->argsHaveError() ) {
> >     std::cerr << optArgs->printErrors();
> >     std::cerr << optArgs->printUsage();
> >     return 1;
> >   }
> >
> >   std::cout << "Success" << std::endl;
> >
> >   delete optArgs;
> >
> >   return 0;
> > }
> >
> > Patch to get rid of memcpy
> >
> > 170c170
> > <               memmove(ptr + start, str, count);
> > ---
> >
> > >               memcpy(ptr + start, str, count);
> >
> > 218c218
> > <       memmove(ptr + start, ptr + start + count, len - start - count);
> > ---
> >
> > >       memcpy(ptr + start, ptr + start + count, len - start - count);
> >
> > 253c253
> > <       memmove(getText() + getLength(), str, len);
> > ---
> >
> > >       memcpy(getText() + getLength(), str, len);
> >
> > 391c391
> > <       memmove(getText(), str, Value==26722== Invalid read of size 4
> > ==26722==    at 0x40278576: ost::String::getSpace(unsigned) (in
> > /usr/lib/libccgnu2-1.1.so.0.0.2) ==26722==    by 0x402781F6:
> > ost::String::resize(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > ==26722==    by 0x40277A71: ost::String::set(char const*, unsigned) (in
> > /usr/lib/libccgnu2-1.1.so.0.0.2) ==26722==    by 0x40277B07:
> > ost::String::set(ost::String const&) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > ==26722==    by 0x402B16C1: ost::String::operator=(ost::String const&) (in
> > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x402B802A:
> > ost::CommandOptionParse_impl::makePrintUsage() (in
> > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x402B6C7A:
> > ost::CommandOptionParse_impl::printUsage() (in
> > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x8048BFA: main
> > (main.cpp:69)
> > ==26722==  Address 0x20202020 is not stack'd, malloc'd or free'd
> > ==26722==
> > ==26722== Process terminating with default action of signal 11 (SIGSEGV):
> > dumping core ==26722==  Address not mapped to object at address 0x20202020
> > ==26722==    at 0x40278576: ost::String::getSpace(unsigned) (in
> > /usr/lib/libccgnu2-1.1.so.0.0.2) ==26722==    by 0x402781F6:
> > ost::String::resize(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > ==26722==    by 0x40277A71: ost::String::set(char const*, unsigned) (in
> > /usr/lib/libccgnu2-1.1.so.0.0.2) ==26722==    by 0x40277B07:
> > ost::String::set(ost::String const&) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > ==26722==    by 0x402B16C1: ost::String::operator=(ost::String const&) (in
> > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x402B802A:
> > ost::CommandOptionParse_impl::makePrintUsage() (in
> > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x402B6C7A:
> > ost::CommandOptionParse_impl::printUsage() (in
> > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x8048BFA: main
> > (main.cpp:69)len);
> > ---
> >
> > >       memcpy(getText(), str, len);
> >
> > 418c418
> > <               memmove(content.ministring.text, getText(), getLength() +
> > 1); ---
> >
> > >               memcpy(content.ministring.text, getText(), getLength() +
> > > 1);
> >
> > 426c426
> > <       memmove(content.bigstring.text, ptr, getLength() + 1);
> > ---
> >
> > >       memcpy(content.bigstring.text, ptr, getLength() + 1);
> >
> > 576c576
> > <               memmove(ptr, content.ministring.text, length);
> > ---
> >
> > >               memcpy(ptr, content.ministring.text, length);
> >
> > 588c588
> > <               memmove(content.ministring.text, ptr, length);
> > ---
> >
> > >               memcpy(content.ministring.text, ptr, length);
> >
> > 597c597
> > <       memmove(ptr, getText(), length);
> > ---
> >
> > >       memcpy(ptr, getText(), length);
> >
> > Debugging results of above program after patch applied
> >
> > Value==26722== Invalid read of size 4
> > ==26722==    at 0x40278576: ost::String::getSpace(unsigned) (in
> > /usr/lib/libccgnu2-1.1.so.0.0.2) ==26722==    by 0x402781F6:
> > ost::String::resize(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > ==26722==    by 0x40277A71: ost::String::set(char const*, unsigned) (in
> > /usr/lib/libccgnu2-1.1.so.0.0.2) ==26722==    by 0x40277B07:
> > ost::String::set(ost::String const&) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > ==26722==    by 0x402B16C1: ost::String::operator=(ost::String const&) (in
> > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x402B802A:
> > ost::CommandOptionParse_impl::makePrintUsage() (in
> > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x402B6C7A:
> > ost::CommandOptionParse_impl::printUsage() (in
> > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x8048BFA: main
> > (main.cpp:69)
> > ==26722==  Address 0x20202020 is not stack'd, malloc'd or free'd
> > ==26722==
> > ==26722== Process terminating with default action of signal 11 (SIGSEGV):
> > dumping core ==26722==  Address not mapped to object at address 0x20202020
> > ==26722==    at 0x40278576: ost::String::getSpace(unsigned) (in
> > /usr/lib/libccgnu2-1.1.so.0.0.2) ==26722==    by 0x402781F6:
> > ost::String::resize(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > ==26722==    by 0x40277A71: ost::String::set(char const*, unsigned) (in
> > /usr/lib/libccgnu2-1.1.so.0.0.2) ==26722==    by 0x40277B07:
> > ost::String::set(ost::String const&) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > ==26722==    by 0x402B16C1: ost::String::operator=(ost::String const&) (in
> > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x402B802A:
> > ost::CommandOptionParse_impl::makePrintUsage() (in
> > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x402B6C7A:
> > ost::CommandOptionParse_impl::printUsage() (in
> > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x8048BFA: main
> > (main.cpp:69)
> >
> >
> > _______________________________________________
> > Bug-commoncpp mailing list
> > Bug-commoncpp@gnu.org
> > http://mail.gnu.org/mailman/listinfo/bug-commoncpp
> 



From MAILER-DAEMON Fri Apr 09 16:55:27 2004
Received: from list by monty-python.gnu.org with archive (Exim 4.30)
	id 1BC327-000474-9c
	for mharc-bug-commoncpp@gnu.org; Fri, 09 Apr 2004 16:55:27 -0400
Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30)
	id 1BC322-00045v-Bd
	for bug-commoncpp@gnu.org; Fri, 09 Apr 2004 16:55:22 -0400
Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30)
	id 1BC31S-0003yS-Mb
	for bug-commoncpp@gnu.org; Fri, 09 Apr 2004 16:55:17 -0400
Received: from [199.232.41.8] (helo=mx20.gnu.org)
	by monty-python.gnu.org with esmtp (TLSv1:DES-CBC3-SHA:168)
	(Exim 4.30) id 1BC31S-0003yK-8z
	for bug-commoncpp@gnu.org; Fri, 09 Apr 2004 16:54:46 -0400
Received: from [66.185.86.74] (helo=fep04-mail.bloor.is.net.cable.rogers.com)
	by mx20.gnu.org with esmtp (Exim 4.30) id 1BC2xP-0006Zp-9G
	for bug-commoncpp@gnu.org; Fri, 09 Apr 2004 16:50:35 -0400
Received: from chatgris.no-ip.com ([24.112.132.225])
	by fep04-mail.bloor.is.net.cable.rogers.com
	(InterMail vM.5.01.05.12 201-253-122-126-112-20020820) with ESMTP id
	<20040409204932.UVPP167788.fep04-mail.bloor.is.net.cable.rogers.com@chatgris.no-ip.com>;
	Fri, 9 Apr 2004 16:49:32 -0400
From: Joshua Moore-Oliva <josh@chatgris.com>
To: David Sugar <dyfet@ostel.com>
Date: Fri, 9 Apr 2004 17:00:17 -0400
User-Agent: KMail/1.6.1
References: <200404090402.34896.josh@chatgris.com>
	<200404082119.21103.dyfet@ostel.com>
In-Reply-To: <200404082119.21103.dyfet@ostel.com>
MIME-Version: 1.0
Content-Disposition: inline
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Message-Id: <200404091700.17737.josh@chatgris.com>
X-Authentication-Info: Submitted using SMTP AUTH PLAIN at
	fep04-mail.bloor.is.net.cable.rogers.com from [24.112.132.225]
	using ID <janetteoliva@rogers.com> at Fri,
	9 Apr 2004 16:49:32 -0400
Cc: bug-commoncpp@gnu.org
Subject: Re: Segmentation fault//memcpy misuse with command options (partial
	fix patch included)
X-BeenThere: bug-commoncpp@gnu.org
X-Mailman-Version: 2.1.4
Precedence: list
List-Id: Bug reports for Common C++ <bug-commoncpp.gnu.org>
List-Unsubscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=unsubscribe>
List-Archive: <http://mail.gnu.org/pipermail/bug-commoncpp>
List-Post: <mailto:bug-commoncpp@gnu.org>
List-Help: <mailto:bug-commoncpp-request@gnu.org?subject=help>
List-Subscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=subscribe>
X-List-Received-Date: Fri, 09 Apr 2004 20:55:24 -0000

In addition, none of these problems occur with commoncpp2 1.0.13 only in 1.1.2.

Joshua Moore-Oliva.

On April 8, 2004 9:19 pm, David Sugar wrote:
> So what you did is basically replace every memcpy with a memmove?  Hmm...in at 
> least some cases, memcpy may be inline'd with assembler code.  Perhaps there 
> is something odd in the inline code substitution?  Also, your patch got a 
> little chopped up in the debugging text...
> 
> David
> 
> On Friday 09 April 2004 04:02 am, Joshua Moore-Oliva wrote:
> > I created a program with quite a few options, and I got a segmentation
> > fault that appears to be a mis-use of memcpy.
> >
> > Included is a test program to reproduce the problem and some debugging
> > output.
> >
> > I was able to remove the problems with memcpy with the changes in the
> > included patch, however I am not familiar enough with the code to determine
> > why the getSpace function in the String library is going out of bounds...
> >
> > debugging output before patch
> >
> > ==17692== Source and destination overlap in memcpy(0x41E1A83C, 0x41E1A87C,
> > 86) ==17692==    at 0x40022224: memcpy (in
> > /usr/lib/valgrind/vgskin_memcheck.so) ==17692==    by 0x40277A94:
> > ost::String::set(char const*, unsigned) (in
> > /usr/lib/libccgnu2-1.1.so.0.0.2) ==17692==    by 0x40277B07:
> > ost::String::set(ost::String const&) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > ==17692==    by 0x402B16C1: ost::String::operator=(ost::String const&) (in
> > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x402B7B10:
> > ost::CommandOptionParse_impl::makePrintErrors() (in
> > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x402B6CAC:
> > ost::CommandOptionParse_impl::printErrors() (in
> > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x8048BD8: main (in
> > /home/chatgris/a.out)
> > ==17692==
> > ==17692== Source and destination overlap in memcpy(0x41E1A87C, 0x41E1A83C,
> > 87) ==17692==    at 0x40022224: memcpy (in
> > /usr/lib/valgrind/vgskin_memcheck.so) ==17692==    by 0x40277C75:
> > ost::String::copy(ost::String const&) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > ==17692==    by 0x4027647B: ost::String::String(ost::String const&) (in
> > /usr/lib/libccgnu2-1.1.so.0.0.2) ==17692==    by 0x4027887C:
> > ost::operator+(ost::String const&, char const*) (in
> > /usr/lib/libccgnu2-1.1.so.0.0.2) ==17692==    by 0x402B7B83:
> > ost::CommandOptionParse_impl::makePrintErrors() (in
> > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x402B6CAC:
> > ost::CommandOptionParse_impl::printErrors() (in
> > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x8048BD8: main (in
> > /home/chatgris/a.out)
> > ==17692==
> > ==17692== Source and destination overlap in memcpy(0x41E1AC68, 0x41E1ABA8,
> > 215) ==17692==    at 0x40022224: memcpy (in
> > /usr/lib/valgrind/vgskin_memcheck.so) ==17692==    by 0x40278310:
> > ost::String::resize(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > ==17692==    by 0x40277A71: ost::String::set(char const*, unsigned) (in
> > /usr/lib/libccgnu2-1.1.so.0.0.2) ==17692==    by 0x40277B07:
> > ost::String::set(ost::String const&) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > ==17692==    by 0x402B16C1: ost::String::operator=(ost::String const&) (in
> > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x402B7DD5:
> > ost::CommandOptionParse_impl::makePrintErrors() (in
> > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x402B6CAC:
> > ost::CommandOptionParse_impl::printErrors() (in
> > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x8048BD8: main (in
> > /home/chatgris/a.out)
> > Value required for option '--connection_string' is missing
> > Value==17692==
> > ==17692== Source and destination overlap in memcpy(0x41E1A7BC, 0x41E1A7DC,
> > 41) ==17692==    at 0x40022224: memcpy (in
> > /usr/lib/valgrind/vgskin_memcheck.so) ==17692==    by 0x40277C75:
> > ost::String::copy(ost::String const&) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > ==17692==    by 0x4027647B: ost::String::String(ost::String const&) (in
> > /usr/lib/libccgnu2-1.1.so.0.0.2) ==17692==    by 0x402787B2:
> > ost::operator+(ost::String const&, char) (in
> > /usr/lib/libccgnu2-1.1.so.0.0.2) ==17692==    by 0x402B8015:
> > ost::CommandOptionParse_impl::makePrintUsage() (in
> > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x402B6C7A:
> > ost::CommandOptionParse_impl::printUsage() (in
> > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x8048BFA: main (in
> > /home/chatgris/a.out)
> > ==17692==
> > ==17692== Invalid read of size 4
> > ==17692==    at 0x40278576: ost::String::getSpace(unsigned) (in
> > /usr/lib/libccgnu2-1.1.so.0.0.2) ==17692==    by 0x402781F6:
> > ost::String::resize(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > ==17692==    by 0x40277A71: ost::String::set(char const*, unsigned) (in
> > /usr/lib/libccgnu2-1.1.so.0.0.2) ==17692==    by 0x40277B07:
> > ost::String::set(ost::String const&) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > ==17692==    by 0x402B16C1: oValue==26722== Invalid read of size 4
> > ==26722==    at 0x40278576: ost::String::getSpace(unsigned) (in
> > /usr/lib/libccgnu2-1.1.so.0.0.2) ==26722==    by 0x402781F6:
> > ost::String::resize(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > ==26722==    by 0x40277A71: ost::String::set(char const*, unsigned) (in
> > /usr/lib/libccgnu2-1.1.so.0.0.2) ==26722==    by 0x40277B07:
> > ost::String::set(ost::String const&) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > ==26722==    by 0x402B16C1: ost::String::operator=(ost::String const&) (in
> > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x402B802A:
> > ost::CommandOptionParse_impl::makePrintUsage() (in
> > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x402B6C7A:
> > ost::CommandOptionParse_impl::printUsage() (in
> > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x8048BFA: main
> > (main.cpp:69)
> > ==26722==  Address 0x20202020 is not stack'd, malloc'd or free'd
> > ==26722==
> > ==26722== Process terminating with default action of signal 11 (SIGSEGV):
> > dumping core ==26722==  Address not mapped to object at address 0x20202020
> > ==26722==    at 0x40278576: ost::String::getSpace(unsigned) (in
> > /usr/lib/libccgnu2-1.1.so.0.0.2) ==26722==    by 0x402781F6:
> > ost::String::resize(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > ==26722==    by 0x40277A71: ost::String::set(char const*, unsigned) (in
> > /usr/lib/libccgnu2-1.1.so.0.0.2) ==26722==    by 0x40277B07:
> > ost::String::set(ost::String const&) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > ==26722==    by 0x402B16C1: ost::String::operator=(ost::String const&) (in
> > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x402B802A:
> > ost::CommandOptionParse_impl::makePrintUsage() (in
> > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x402B6C7A:
> > ost::CommandOptionParse_impl::printUsage() (in
> > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x8048BFA: main
> > (main.cpp:69)st::String::operator=(ost::String const&) (in
> > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x402B802A:
> > ost::CommandOptionParse_impl::makePrintUsage() (in
> > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x402B6C7A:
> > ost::CommandOptionParse_impl::printUsage() (in
> > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x8048BFA: main (in
> > /home/chatgris/a.out)
> > ==17692==  Address 0x20202020 is not stack'd, malloc'd or free'd
> > ==17692==
> > ==17692== Process terminating with default action of signal 11 (SIGSEGV):
> > dumping core ==17692==  Address not mapped to object at address 0x20202020
> > ==17692==    at 0x40278576: ost::String::getSpace(unsigned) (in
> > /usr/lib/libccgnu2-1.1.so.0.0.2) ==17692==    by 0x402781F6:
> > ost::String::resize(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > ==17692==    by 0x40277A71: ost::String::set(char const*, unsigned) (in
> > /usr/lib/libccgnu2-1.1.so.0.0.2) ==17692==    by 0x40277B07:
> > ost::String::set(ost::String const&) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > ==17692==    by 0x402B16C1: ost::String::operator=(ost::String const&) (in
> > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x402B802A:
> > ost::CommandOptionParse_impl::makePrintUsage() (in
> > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x402B6C7A:
> > ost::CommandOptionParse_impl::printUsage() (in
> > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x8048BFA: main (in
> > /home/chatgris/a.out)
> >
> >
> > test case
> >
> > #include <iostream>
> > #include <cc++/common.h>
> >
> > ost::CommandOptionArg optConnInfo (
> >   "connection_string", "c", "Connection String.", true
> > );
> >
> > ost::CommandOptionArg optMergeDelimiterField (
> >   "field_delimiter", "f", "Field delimiter for merge information", true
> > );
> >
> > ost::CommandOptionArg optMergeDelimiterRecord (
> >   "record_delimiter", "r", "Record delimiter for merge information", true
> > );
> >
> > ost::CommandOptionArg optMergeNames (
> >   "merge_names", "n", "Merge Field Names (tab delimited)", true
> > );
> >
> > ost::CommandOptionArg optMessageSource (
> >   "message_source", "s", "Message Source", true
> > );
> >
> > ost::CommandOptionArg optQuery (
> >   "query", "q", "Query to retrieve send data", true
> > );
> >
> > ost::CommandOptionArg optSortDir (
> >   "sort_dir", "sd", "Directory where the sort binary resides", true
> > );
> >
> > ost::CommandOptionArg optSortName (
> >   "sort_name", "sn", "Name of the sort binary", true
> > );
> >
> > ost::CommandOptionArg optSortTmpDir (
> >   "sort_tmp_dir", "st", "Temp dir for sort to use", true
> > );
> >
> > ost::CommandOptionArg optMaxBatchSize (
> >   "max_batch_size", "b", "Maximum Batch Size", true
> > );
> >
> > ost::CommandOptionArg optPriority (
> >   "priority", "p", "Priority for mailing", true
> > );
> >
> > ost::CommandOptionNoArg optHelpArg (
> >   "help", "?", "Print help usage"
> > );
> >
> > int main ( int argc, char ** argv ) {
> >   ost::CommandOptionParse * optArgs =
> >     ost::makeCommandOptionParse ( argc
> >                                 , argv
> >                                 , "Configurable Procmail receiver.\n"
> >   );
> >
> >   // If the user requested help then suppress all the usage error
> >   // messages.
> >   if ( optHelpArg.numSet ) {
> >     std::cerr << optArgs->printUsage();
> >     return 0;
> >   }
> >
> >   // Print usage your way.
> >   if ( optArgs->argsHaveError() ) {
> >     std::cerr << optArgs->printErrors();
> >     std::cerr << optArgs->printUsage();
> >     return 1;
> >   }
> >
> >   std::cout << "Success" << std::endl;
> >
> >   delete optArgs;
> >
> >   return 0;
> > }
> >
> > Patch to get rid of memcpy
> >
> > 170c170
> > <               memmove(ptr + start, str, count);
> > ---
> >
> > >               memcpy(ptr + start, str, count);
> >
> > 218c218
> > <       memmove(ptr + start, ptr + start + count, len - start - count);
> > ---
> >
> > >       memcpy(ptr + start, ptr + start + count, len - start - count);
> >
> > 253c253
> > <       memmove(getText() + getLength(), str, len);
> > ---
> >
> > >       memcpy(getText() + getLength(), str, len);
> >
> > 391c391
> > <       memmove(getText(), str, Value==26722== Invalid read of size 4
> > ==26722==    at 0x40278576: ost::String::getSpace(unsigned) (in
> > /usr/lib/libccgnu2-1.1.so.0.0.2) ==26722==    by 0x402781F6:
> > ost::String::resize(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > ==26722==    by 0x40277A71: ost::String::set(char const*, unsigned) (in
> > /usr/lib/libccgnu2-1.1.so.0.0.2) ==26722==    by 0x40277B07:
> > ost::String::set(ost::String const&) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > ==26722==    by 0x402B16C1: ost::String::operator=(ost::String const&) (in
> > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x402B802A:
> > ost::CommandOptionParse_impl::makePrintUsage() (in
> > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x402B6C7A:
> > ost::CommandOptionParse_impl::printUsage() (in
> > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x8048BFA: main
> > (main.cpp:69)
> > ==26722==  Address 0x20202020 is not stack'd, malloc'd or free'd
> > ==26722==
> > ==26722== Process terminating with default action of signal 11 (SIGSEGV):
> > dumping core ==26722==  Address not mapped to object at address 0x20202020
> > ==26722==    at 0x40278576: ost::String::getSpace(unsigned) (in
> > /usr/lib/libccgnu2-1.1.so.0.0.2) ==26722==    by 0x402781F6:
> > ost::String::resize(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > ==26722==    by 0x40277A71: ost::String::set(char const*, unsigned) (in
> > /usr/lib/libccgnu2-1.1.so.0.0.2) ==26722==    by 0x40277B07:
> > ost::String::set(ost::String const&) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > ==26722==    by 0x402B16C1: ost::String::operator=(ost::String const&) (in
> > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x402B802A:
> > ost::CommandOptionParse_impl::makePrintUsage() (in
> > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x402B6C7A:
> > ost::CommandOptionParse_impl::printUsage() (in
> > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x8048BFA: main
> > (main.cpp:69)len);
> > ---
> >
> > >       memcpy(getText(), str, len);
> >
> > 418c418
> > <               memmove(content.ministring.text, getText(), getLength() +
> > 1); ---
> >
> > >               memcpy(content.ministring.text, getText(), getLength() +
> > > 1);
> >
> > 426c426
> > <       memmove(content.bigstring.text, ptr, getLength() + 1);
> > ---
> >
> > >       memcpy(content.bigstring.text, ptr, getLength() + 1);
> >
> > 576c576
> > <               memmove(ptr, content.ministring.text, length);
> > ---
> >
> > >               memcpy(ptr, content.ministring.text, length);
> >
> > 588c588
> > <               memmove(content.ministring.text, ptr, length);
> > ---
> >
> > >               memcpy(content.ministring.text, ptr, length);
> >
> > 597c597
> > <       memmove(ptr, getText(), length);
> > ---
> >
> > >       memcpy(ptr, getText(), length);
> >
> > Debugging results of above program after patch applied
> >
> > Value==26722== Invalid read of size 4
> > ==26722==    at 0x40278576: ost::String::getSpace(unsigned) (in
> > /usr/lib/libccgnu2-1.1.so.0.0.2) ==26722==    by 0x402781F6:
> > ost::String::resize(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > ==26722==    by 0x40277A71: ost::String::set(char const*, unsigned) (in
> > /usr/lib/libccgnu2-1.1.so.0.0.2) ==26722==    by 0x40277B07:
> > ost::String::set(ost::String const&) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > ==26722==    by 0x402B16C1: ost::String::operator=(ost::String const&) (in
> > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x402B802A:
> > ost::CommandOptionParse_impl::makePrintUsage() (in
> > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x402B6C7A:
> > ost::CommandOptionParse_impl::printUsage() (in
> > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x8048BFA: main
> > (main.cpp:69)
> > ==26722==  Address 0x20202020 is not stack'd, malloc'd or free'd
> > ==26722==
> > ==26722== Process terminating with default action of signal 11 (SIGSEGV):
> > dumping core ==26722==  Address not mapped to object at address 0x20202020
> > ==26722==    at 0x40278576: ost::String::getSpace(unsigned) (in
> > /usr/lib/libccgnu2-1.1.so.0.0.2) ==26722==    by 0x402781F6:
> > ost::String::resize(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > ==26722==    by 0x40277A71: ost::String::set(char const*, unsigned) (in
> > /usr/lib/libccgnu2-1.1.so.0.0.2) ==26722==    by 0x40277B07:
> > ost::String::set(ost::String const&) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > ==26722==    by 0x402B16C1: ost::String::operator=(ost::String const&) (in
> > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x402B802A:
> > ost::CommandOptionParse_impl::makePrintUsage() (in
> > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x402B6C7A:
> > ost::CommandOptionParse_impl::printUsage() (in
> > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x8048BFA: main
> > (main.cpp:69)
> >
> >
> > _______________________________________________
> > Bug-commoncpp mailing list
> > Bug-commoncpp@gnu.org
> > http://mail.gnu.org/mailman/listinfo/bug-commoncpp
> 



From MAILER-DAEMON Sat Apr 10 17:56:50 2004
Received: from list by monty-python.gnu.org with archive (Exim 4.30)
	id 1BCQT4-0003oG-77
	for mharc-bug-commoncpp@gnu.org; Sat, 10 Apr 2004 17:56:50 -0400
Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30)
	id 1BCQT1-0003nM-89
	for bug-commoncpp@gnu.org; Sat, 10 Apr 2004 17:56:47 -0400
Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30)
	id 1BCQST-0003aW-U4
	for bug-commoncpp@gnu.org; Sat, 10 Apr 2004 17:56:46 -0400
Received: from [199.232.41.8] (helo=mx20.gnu.org)
	by monty-python.gnu.org with esmtp (TLSv1:DES-CBC3-SHA:168)
	(Exim 4.30) id 1BCQST-0003aE-El
	for bug-commoncpp@gnu.org; Sat, 10 Apr 2004 17:56:13 -0400
Received: from [216.218.222.122] (helo=mail.ostel.com)
	by mx20.gnu.org with esmtp (Exim 4.30) id 1BCQS4-00009M-RT
	for bug-commoncpp@gnu.org; Sat, 10 Apr 2004 17:55:48 -0400
Received: by mail.ostel.com (Postfix, from userid 1005)
	id 395B52F2867; Sat, 10 Apr 2004 14:56:39 -0700 (PDT)
Received: from [192.168.1.102] (pool-141-153-175-218.mad.east.verizon.net
	[141.153.175.218]) by mail.ostel.com (Postfix) with ESMTP
	id 7F86B2F2883; Sat, 10 Apr 2004 14:56:31 -0700 (PDT)
From: David Sugar <dyfet@ostel.com>
To: Joshua Moore-Oliva <josh@chatgris.com>
Date: Sat, 10 Apr 2004 05:58:32 -0400
User-Agent: KMail/1.6.2
References: <200404090402.34896.josh@chatgris.com>
	<200404082119.21103.dyfet@ostel.com>
	<200404091700.17737.josh@chatgris.com>
In-Reply-To: <200404091700.17737.josh@chatgris.com>
MIME-Version: 1.0
Content-Disposition: inline
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Message-Id: <200404100558.32236.dyfet@ostel.com>
Cc: bug-commoncpp@gnu.org
Subject: Re: Segmentation fault//memcpy misuse with command options (partial
	fix patch included)
X-BeenThere: bug-commoncpp@gnu.org
X-Mailman-Version: 2.1.4
Precedence: list
List-Id: Bug reports for Common C++ <bug-commoncpp.gnu.org>
List-Unsubscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=unsubscribe>
List-Archive: <http://mail.gnu.org/pipermail/bug-commoncpp>
List-Post: <mailto:bug-commoncpp@gnu.org>
List-Help: <mailto:bug-commoncpp-request@gnu.org?subject=help>
List-Subscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sat, 10 Apr 2004 21:56:48 -0000

My first thought is that most of these operations depend on getLength 
returning the correct string length (in effect strlen() + 1 null byte).  
However, the String class actually stores a length field, which is what 
getLength() actually returns, and maybe that length field is not being kept 
in sync with the actual string length in some circumstances!  It would be 
interesting to compare the length returned by getLength with the length 
returned by strlen() in front of each of these memmove's...

On Friday 09 April 2004 05:00 pm, you wrote:
> In addition, none of these problems occur with commoncpp2 1.0.13 only in
> 1.1.2.
>
> Joshua Moore-Oliva.
>
> On April 8, 2004 9:19 pm, David Sugar wrote:
> > So what you did is basically replace every memcpy with a memmove? 
> > Hmm...in at least some cases, memcpy may be inline'd with assembler code.
> >  Perhaps there is something odd in the inline code substitution?  Also,
> > your patch got a little chopped up in the debugging text...
> >
> > David
> >
> > On Friday 09 April 2004 04:02 am, Joshua Moore-Oliva wrote:
> > > I created a program with quite a few options, and I got a segmentation
> > > fault that appears to be a mis-use of memcpy.
> > >
> > > Included is a test program to reproduce the problem and some debugging
> > > output.
> > >
> > > I was able to remove the problems with memcpy with the changes in the
> > > included patch, however I am not familiar enough with the code to
> > > determine why the getSpace function in the String library is going out
> > > of bounds...
> > >
> > > debugging output before patch
> > >
> > > ==17692== Source and destination overlap in memcpy(0x41E1A83C,
> > > 0x41E1A87C, 86) ==17692==    at 0x40022224: memcpy (in
> > > /usr/lib/valgrind/vgskin_memcheck.so) ==17692==    by 0x40277A94:
> > > ost::String::set(char const*, unsigned) (in
> > > /usr/lib/libccgnu2-1.1.so.0.0.2) ==17692==    by 0x40277B07:
> > > ost::String::set(ost::String const&) (in
> > > /usr/lib/libccgnu2-1.1.so.0.0.2) ==17692==    by 0x402B16C1:
> > > ost::String::operator=(ost::String const&) (in
> > > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x402B7B10:
> > > ost::CommandOptionParse_impl::makePrintErrors() (in
> > > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x402B6CAC:
> > > ost::CommandOptionParse_impl::printErrors() (in
> > > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x8048BD8: main (in
> > > /home/chatgris/a.out)
> > > ==17692==
> > > ==17692== Source and destination overlap in memcpy(0x41E1A87C,
> > > 0x41E1A83C, 87) ==17692==    at 0x40022224: memcpy (in
> > > /usr/lib/valgrind/vgskin_memcheck.so) ==17692==    by 0x40277C75:
> > > ost::String::copy(ost::String const&) (in
> > > /usr/lib/libccgnu2-1.1.so.0.0.2) ==17692==    by 0x4027647B:
> > > ost::String::String(ost::String const&) (in
> > > /usr/lib/libccgnu2-1.1.so.0.0.2) ==17692==    by 0x4027887C:
> > > ost::operator+(ost::String const&, char const*) (in
> > > /usr/lib/libccgnu2-1.1.so.0.0.2) ==17692==    by 0x402B7B83:
> > > ost::CommandOptionParse_impl::makePrintErrors() (in
> > > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x402B6CAC:
> > > ost::CommandOptionParse_impl::printErrors() (in
> > > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x8048BD8: main (in
> > > /home/chatgris/a.out)
> > > ==17692==
> > > ==17692== Source and destination overlap in memcpy(0x41E1AC68,
> > > 0x41E1ABA8, 215) ==17692==    at 0x40022224: memcpy (in
> > > /usr/lib/valgrind/vgskin_memcheck.so) ==17692==    by 0x40278310:
> > > ost::String::resize(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > > ==17692==    by 0x40277A71: ost::String::set(char const*, unsigned) (in
> > > /usr/lib/libccgnu2-1.1.so.0.0.2) ==17692==    by 0x40277B07:
> > > ost::String::set(ost::String const&) (in
> > > /usr/lib/libccgnu2-1.1.so.0.0.2) ==17692==    by 0x402B16C1:
> > > ost::String::operator=(ost::String const&) (in
> > > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x402B7DD5:
> > > ost::CommandOptionParse_impl::makePrintErrors() (in
> > > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x402B6CAC:
> > > ost::CommandOptionParse_impl::printErrors() (in
> > > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x8048BD8: main (in
> > > /home/chatgris/a.out)
> > > Value required for option '--connection_string' is missing
> > > Value==17692==
> > > ==17692== Source and destination overlap in memcpy(0x41E1A7BC,
> > > 0x41E1A7DC, 41) ==17692==    at 0x40022224: memcpy (in
> > > /usr/lib/valgrind/vgskin_memcheck.so) ==17692==    by 0x40277C75:
> > > ost::String::copy(ost::String const&) (in
> > > /usr/lib/libccgnu2-1.1.so.0.0.2) ==17692==    by 0x4027647B:
> > > ost::String::String(ost::String const&) (in
> > > /usr/lib/libccgnu2-1.1.so.0.0.2) ==17692==    by 0x402787B2:
> > > ost::operator+(ost::String const&, char) (in
> > > /usr/lib/libccgnu2-1.1.so.0.0.2) ==17692==    by 0x402B8015:
> > > ost::CommandOptionParse_impl::makePrintUsage() (in
> > > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x402B6C7A:
> > > ost::CommandOptionParse_impl::printUsage() (in
> > > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x8048BFA: main (in
> > > /home/chatgris/a.out)
> > > ==17692==
> > > ==17692== Invalid read of size 4
> > > ==17692==    at 0x40278576: ost::String::getSpace(unsigned) (in
> > > /usr/lib/libccgnu2-1.1.so.0.0.2) ==17692==    by 0x402781F6:
> > > ost::String::resize(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > > ==17692==    by 0x40277A71: ost::String::set(char const*, unsigned) (in
> > > /usr/lib/libccgnu2-1.1.so.0.0.2) ==17692==    by 0x40277B07:
> > > ost::String::set(ost::String const&) (in
> > > /usr/lib/libccgnu2-1.1.so.0.0.2) ==17692==    by 0x402B16C1:
> > > oValue==26722== Invalid read of size 4 ==26722==    at 0x40278576:
> > > ost::String::getSpace(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > > ==26722==    by 0x402781F6:
> > > ost::String::resize(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > > ==26722==    by 0x40277A71: ost::String::set(char const*, unsigned) (in
> > > /usr/lib/libccgnu2-1.1.so.0.0.2) ==26722==    by 0x40277B07:
> > > ost::String::set(ost::String const&) (in
> > > /usr/lib/libccgnu2-1.1.so.0.0.2) ==26722==    by 0x402B16C1:
> > > ost::String::operator=(ost::String const&) (in
> > > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x402B802A:
> > > ost::CommandOptionParse_impl::makePrintUsage() (in
> > > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x402B6C7A:
> > > ost::CommandOptionParse_impl::printUsage() (in
> > > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x8048BFA: main
> > > (main.cpp:69)
> > > ==26722==  Address 0x20202020 is not stack'd, malloc'd or free'd
> > > ==26722==
> > > ==26722== Process terminating with default action of signal 11
> > > (SIGSEGV): dumping core ==26722==  Address not mapped to object at
> > > address 0x20202020 ==26722==    at 0x40278576:
> > > ost::String::getSpace(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > > ==26722==    by 0x402781F6:
> > > ost::String::resize(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > > ==26722==    by 0x40277A71: ost::String::set(char const*, unsigned) (in
> > > /usr/lib/libccgnu2-1.1.so.0.0.2) ==26722==    by 0x40277B07:
> > > ost::String::set(ost::String const&) (in
> > > /usr/lib/libccgnu2-1.1.so.0.0.2) ==26722==    by 0x402B16C1:
> > > ost::String::operator=(ost::String const&) (in
> > > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x402B802A:
> > > ost::CommandOptionParse_impl::makePrintUsage() (in
> > > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x402B6C7A:
> > > ost::CommandOptionParse_impl::printUsage() (in
> > > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x8048BFA: main
> > > (main.cpp:69)st::String::operator=(ost::String const&) (in
> > > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x402B802A:
> > > ost::CommandOptionParse_impl::makePrintUsage() (in
> > > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x402B6C7A:
> > > ost::CommandOptionParse_impl::printUsage() (in
> > > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x8048BFA: main (in
> > > /home/chatgris/a.out)
> > > ==17692==  Address 0x20202020 is not stack'd, malloc'd or free'd
> > > ==17692==
> > > ==17692== Process terminating with default action of signal 11
> > > (SIGSEGV): dumping core ==17692==  Address not mapped to object at
> > > address 0x20202020 ==17692==    at 0x40278576:
> > > ost::String::getSpace(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > > ==17692==    by 0x402781F6:
> > > ost::String::resize(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > > ==17692==    by 0x40277A71: ost::String::set(char const*, unsigned) (in
> > > /usr/lib/libccgnu2-1.1.so.0.0.2) ==17692==    by 0x40277B07:
> > > ost::String::set(ost::String const&) (in
> > > /usr/lib/libccgnu2-1.1.so.0.0.2) ==17692==    by 0x402B16C1:
> > > ost::String::operator=(ost::String const&) (in
> > > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x402B802A:
> > > ost::CommandOptionParse_impl::makePrintUsage() (in
> > > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x402B6C7A:
> > > ost::CommandOptionParse_impl::printUsage() (in
> > > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x8048BFA: main (in
> > > /home/chatgris/a.out)
> > >
> > >
> > > test case
> > >
> > > #include <iostream>
> > > #include <cc++/common.h>
> > >
> > > ost::CommandOptionArg optConnInfo (
> > >   "connection_string", "c", "Connection String.", true
> > > );
> > >
> > > ost::CommandOptionArg optMergeDelimiterField (
> > >   "field_delimiter", "f", "Field delimiter for merge information", true
> > > );
> > >
> > > ost::CommandOptionArg optMergeDelimiterRecord (
> > >   "record_delimiter", "r", "Record delimiter for merge information",
> > > true );
> > >
> > > ost::CommandOptionArg optMergeNames (
> > >   "merge_names", "n", "Merge Field Names (tab delimited)", true
> > > );
> > >
> > > ost::CommandOptionArg optMessageSource (
> > >   "message_source", "s", "Message Source", true
> > > );
> > >
> > > ost::CommandOptionArg optQuery (
> > >   "query", "q", "Query to retrieve send data", true
> > > );
> > >
> > > ost::CommandOptionArg optSortDir (
> > >   "sort_dir", "sd", "Directory where the sort binary resides", true
> > > );
> > >
> > > ost::CommandOptionArg optSortName (
> > >   "sort_name", "sn", "Name of the sort binary", true
> > > );
> > >
> > > ost::CommandOptionArg optSortTmpDir (
> > >   "sort_tmp_dir", "st", "Temp dir for sort to use", true
> > > );
> > >
> > > ost::CommandOptionArg optMaxBatchSize (
> > >   "max_batch_size", "b", "Maximum Batch Size", true
> > > );
> > >
> > > ost::CommandOptionArg optPriority (
> > >   "priority", "p", "Priority for mailing", true
> > > );
> > >
> > > ost::CommandOptionNoArg optHelpArg (
> > >   "help", "?", "Print help usage"
> > > );
> > >
> > > int main ( int argc, char ** argv ) {
> > >   ost::CommandOptionParse * optArgs =
> > >     ost::makeCommandOptionParse ( argc
> > >                                 , argv
> > >                                 , "Configurable Procmail receiver.\n"
> > >   );
> > >
> > >   // If the user requested help then suppress all the usage error
> > >   // messages.
> > >   if ( optHelpArg.numSet ) {
> > >     std::cerr << optArgs->printUsage();
> > >     return 0;
> > >   }
> > >
> > >   // Print usage your way.
> > >   if ( optArgs->argsHaveError() ) {
> > >     std::cerr << optArgs->printErrors();
> > >     std::cerr << optArgs->printUsage();
> > >     return 1;
> > >   }
> > >
> > >   std::cout << "Success" << std::endl;
> > >
> > >   delete optArgs;
> > >
> > >   return 0;
> > > }
> > >
> > > Patch to get rid of memcpy
> > >
> > > 170c170
> > > <               memmove(ptr + start, str, count);
> > > ---
> > >
> > > >               memcpy(ptr + start, str, count);
> > >
> > > 218c218
> > > <       memmove(ptr + start, ptr + start + count, len - start - count);
> > > ---
> > >
> > > >       memcpy(ptr + start, ptr + start + count, len - start - count);
> > >
> > > 253c253
> > > <       memmove(getText() + getLength(), str, len);
> > > ---
> > >
> > > >       memcpy(getText() + getLength(), str, len);
> > >
> > > 391c391
> > > <       memmove(getText(), str, Value==26722== Invalid read of size 4
> > > ==26722==    at 0x40278576: ost::String::getSpace(unsigned) (in
> > > /usr/lib/libccgnu2-1.1.so.0.0.2) ==26722==    by 0x402781F6:
> > > ost::String::resize(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > > ==26722==    by 0x40277A71: ost::String::set(char const*, unsigned) (in
> > > /usr/lib/libccgnu2-1.1.so.0.0.2) ==26722==    by 0x40277B07:
> > > ost::String::set(ost::String const&) (in
> > > /usr/lib/libccgnu2-1.1.so.0.0.2) ==26722==    by 0x402B16C1:
> > > ost::String::operator=(ost::String const&) (in
> > > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x402B802A:
> > > ost::CommandOptionParse_impl::makePrintUsage() (in
> > > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x402B6C7A:
> > > ost::CommandOptionParse_impl::printUsage() (in
> > > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x8048BFA: main
> > > (main.cpp:69)
> > > ==26722==  Address 0x20202020 is not stack'd, malloc'd or free'd
> > > ==26722==
> > > ==26722== Process terminating with default action of signal 11
> > > (SIGSEGV): dumping core ==26722==  Address not mapped to object at
> > > address 0x20202020 ==26722==    at 0x40278576:
> > > ost::String::getSpace(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > > ==26722==    by 0x402781F6:
> > > ost::String::resize(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > > ==26722==    by 0x40277A71: ost::String::set(char const*, unsigned) (in
> > > /usr/lib/libccgnu2-1.1.so.0.0.2) ==26722==    by 0x40277B07:
> > > ost::String::set(ost::String const&) (in
> > > /usr/lib/libccgnu2-1.1.so.0.0.2) ==26722==    by 0x402B16C1:
> > > ost::String::operator=(ost::String const&) (in
> > > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x402B802A:
> > > ost::CommandOptionParse_impl::makePrintUsage() (in
> > > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x402B6C7A:
> > > ost::CommandOptionParse_impl::printUsage() (in
> > > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x8048BFA: main
> > > (main.cpp:69)len);
> > > ---
> > >
> > > >       memcpy(getText(), str, len);
> > >
> > > 418c418
> > > <               memmove(content.ministring.text, getText(), getLength()
> > > + 1); ---
> > >
> > > >               memcpy(content.ministring.text, getText(), getLength()
> > > > + 1);
> > >
> > > 426c426
> > > <       memmove(content.bigstring.text, ptr, getLength() + 1);
> > > ---
> > >
> > > >       memcpy(content.bigstring.text, ptr, getLength() + 1);
> > >
> > > 576c576
> > > <               memmove(ptr, content.ministring.text, length);
> > > ---
> > >
> > > >               memcpy(ptr, content.ministring.text, length);
> > >
> > > 588c588
> > > <               memmove(content.ministring.text, ptr, length);
> > > ---
> > >
> > > >               memcpy(content.ministring.text, ptr, length);
> > >
> > > 597c597
> > > <       memmove(ptr, getText(), length);
> > > ---
> > >
> > > >       memcpy(ptr, getText(), length);
> > >
> > > Debugging results of above program after patch applied
> > >
> > > Value==26722== Invalid read of size 4
> > > ==26722==    at 0x40278576: ost::String::getSpace(unsigned) (in
> > > /usr/lib/libccgnu2-1.1.so.0.0.2) ==26722==    by 0x402781F6:
> > > ost::String::resize(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > > ==26722==    by 0x40277A71: ost::String::set(char const*, unsigned) (in
> > > /usr/lib/libccgnu2-1.1.so.0.0.2) ==26722==    by 0x40277B07:
> > > ost::String::set(ost::String const&) (in
> > > /usr/lib/libccgnu2-1.1.so.0.0.2) ==26722==    by 0x402B16C1:
> > > ost::String::operator=(ost::String const&) (in
> > > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x402B802A:
> > > ost::CommandOptionParse_impl::makePrintUsage() (in
> > > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x402B6C7A:
> > > ost::CommandOptionParse_impl::printUsage() (in
> > > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x8048BFA: main
> > > (main.cpp:69)
> > > ==26722==  Address 0x20202020 is not stack'd, malloc'd or free'd
> > > ==26722==
> > > ==26722== Process terminating with default action of signal 11
> > > (SIGSEGV): dumping core ==26722==  Address not mapped to object at
> > > address 0x20202020 ==26722==    at 0x40278576:
> > > ost::String::getSpace(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > > ==26722==    by 0x402781F6:
> > > ost::String::resize(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > > ==26722==    by 0x40277A71: ost::String::set(char const*, unsigned) (in
> > > /usr/lib/libccgnu2-1.1.so.0.0.2) ==26722==    by 0x40277B07:
> > > ost::String::set(ost::String const&) (in
> > > /usr/lib/libccgnu2-1.1.so.0.0.2) ==26722==    by 0x402B16C1:
> > > ost::String::operator=(ost::String const&) (in
> > > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x402B802A:
> > > ost::CommandOptionParse_impl::makePrintUsage() (in
> > > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x402B6C7A:
> > > ost::CommandOptionParse_impl::printUsage() (in
> > > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x8048BFA: main
> > > (main.cpp:69)
> > >
> > >
> > > _______________________________________________
> > > Bug-commoncpp mailing list
> > > Bug-commoncpp@gnu.org
> > > http://mail.gnu.org/mailman/listinfo/bug-commoncpp



From MAILER-DAEMON Sat Apr 10 18:10:27 2004
Received: from list by monty-python.gnu.org with archive (Exim 4.30)
	id 1BCQgF-0000Tm-BA
	for mharc-bug-commoncpp@gnu.org; Sat, 10 Apr 2004 18:10:27 -0400
Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30)
	id 1BCQg5-0000M4-K0
	for bug-commoncpp@gnu.org; Sat, 10 Apr 2004 18:10:17 -0400
Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30)
	id 1BCQfX-000859-Ny
	for bug-commoncpp@gnu.org; Sat, 10 Apr 2004 18:10:16 -0400
Received: from [216.218.222.122] (helo=mail.ostel.com)
	by monty-python.gnu.org with esmtp (Exim 4.30) id 1BCQfW-00084k-Sc
	for bug-commoncpp@gnu.org; Sat, 10 Apr 2004 18:09:43 -0400
Received: by mail.ostel.com (Postfix, from userid 1005)
	id 143222F2883; Sat, 10 Apr 2004 15:10:35 -0700 (PDT)
Received: from [192.168.1.102] (pool-141-153-175-218.mad.east.verizon.net
	[141.153.175.218]) by mail.ostel.com (Postfix) with ESMTP
	id BC4272F2867; Sat, 10 Apr 2004 15:10:31 -0700 (PDT)
From: David Sugar <dyfet@ostel.com>
To: bug-commoncpp@gnu.org
Date: Sat, 10 Apr 2004 06:12:32 -0400
User-Agent: KMail/1.6.2
References: <40741BCF.3030206@123mail.org>
In-Reply-To: <40741BCF.3030206@123mail.org>
MIME-Version: 1.0
Content-Disposition: inline
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Message-Id: <200404100612.32542.dyfet@ostel.com>
Cc: Gabor Szabo <gabor_szabo@123mail.org>
Subject: Re: Threads leak?
X-BeenThere: bug-commoncpp@gnu.org
X-Mailman-Version: 2.1.4
Precedence: list
List-Id: Bug reports for Common C++ <bug-commoncpp.gnu.org>
List-Unsubscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=unsubscribe>
List-Archive: <http://mail.gnu.org/pipermail/bug-commoncpp>
List-Post: <mailto:bug-commoncpp@gnu.org>
List-Help: <mailto:bug-commoncpp-request@gnu.org?subject=help>
List-Subscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sat, 10 Apr 2004 22:10:18 -0000

I did read this somewhere:

"...pthread_setspecific may be called from a thread-specific data destructor 
function, however this may result in lost storage or infinite loops...."

If a thread is deleted it may invoke terminate from it's own destructor, in 
certain appropriate cases, and in the posix implementation, this currently 
sets:  

        if(getThread() == this)
                _self.setKey(DUMMY_INVALID_THREAD);

Actually, I think this should happen if getThread() != this or maybe could be 
left out entirely, as _self.setKey() does invoke pthread_setspecific, and may 
well do so from a destructor.  If you remove that from thread.cpp, do you 
still see a memory leak in your code?

On Wednesday 07 April 2004 11:18 am, Gabor Szabo wrote:
> Hi there,
>
>
> In my program I had to repetitively create, run and destroy
> threads with the Thread class, and noticed that the memory
> footprint of the process just keeps growing (as shown by top). I
> have attached two pieces of code, one with the Thread class, and
> one using pthreads, both performing the same operations from this
> point of view. While the memory usage of the pthreads one does
> not increase, this is not true for the CC++ example. I am using
> Common C++ 1.1.0.
>
> I have looked at the source code of Threads, but did not see any
> indication of why this is happening.
>
>
> Gabor Szabo



From MAILER-DAEMON Sun Apr 11 18:20:45 2004
Received: from list by monty-python.gnu.org with archive (Exim 4.30)
	id 1BCnJl-0005Wl-DS
	for mharc-bug-commoncpp@gnu.org; Sun, 11 Apr 2004 18:20:45 -0400
Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30)
	id 1BCnJh-0005Vr-RG
	for bug-commoncpp@gnu.org; Sun, 11 Apr 2004 18:20:41 -0400
Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30)
	id 1BCnJ8-0005Ok-RK
	for bug-commoncpp@gnu.org; Sun, 11 Apr 2004 18:20:37 -0400
Received: from [66.185.86.71] (helo=fep01-mail.bloor.is.net.cable.rogers.com)
	by monty-python.gnu.org with esmtp (Exim 4.30) id 1BCnJ8-0005Oc-FO
	for bug-commoncpp@gnu.org; Sun, 11 Apr 2004 18:20:06 -0400
Received: from chatgris.no-ip.com ([24.112.132.225])
	by fep01-mail.bloor.is.net.cable.rogers.com
	(InterMail vM.5.01.05.12 201-253-122-126-112-20020820) with ESMTP id
	<20040411221856.XEDM166482.fep01-mail.bloor.is.net.cable.rogers.com@chatgris.no-ip.com>;
	Sun, 11 Apr 2004 18:18:56 -0400
From: Joshua Moore-Oliva <josh@chatgris.com>
To: David Sugar <dyfet@ostel.com>
Date: Sun, 11 Apr 2004 18:29:51 -0400
User-Agent: KMail/1.6.1
References: <200404090402.34896.josh@chatgris.com>
	<200404091700.17737.josh@chatgris.com>
	<200404100558.32236.dyfet@ostel.com>
In-Reply-To: <200404100558.32236.dyfet@ostel.com>
MIME-Version: 1.0
Content-Disposition: inline
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Message-Id: <200404111829.51113.josh@chatgris.com>
X-Authentication-Info: Submitted using SMTP AUTH PLAIN at
	fep01-mail.bloor.is.net.cable.rogers.com from [24.112.132.225]
	using ID <janetteoliva@rogers.com> at Sun,
	11 Apr 2004 18:18:56 -0400
Cc: bug-commoncpp@gnu.org
Subject: Re: Segmentation fault//memcpy misuse with command options (partial
	fix patch included)
X-BeenThere: bug-commoncpp@gnu.org
X-Mailman-Version: 2.1.4
Precedence: list
List-Id: Bug reports for Common C++ <bug-commoncpp.gnu.org>
List-Unsubscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=unsubscribe>
List-Archive: <http://mail.gnu.org/pipermail/bug-commoncpp>
List-Post: <mailto:bug-commoncpp@gnu.org>
List-Help: <mailto:bug-commoncpp-request@gnu.org?subject=help>
List-Subscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sun, 11 Apr 2004 22:20:43 -0000

Well..  I don't want to sound haughty but I have no idea how this library works...  I just ran into this problem and submitted a bug report.

I don't know enough about the lib to fix it...  

Joshua Moore-Oliva

On April 10, 2004 5:58 am, you wrote:
> My first thought is that most of these operations depend on getLength 
> returning the correct string length (in effect strlen() + 1 null byte).  
> However, the String class actually stores a length field, which is what 
> getLength() actually returns, and maybe that length field is not being kept 
> in sync with the actual string length in some circumstances!  It would be 
> interesting to compare the length returned by getLength with the length 
> returned by strlen() in front of each of these memmove's...
> 



From MAILER-DAEMON Tue Apr 13 14:55:36 2004
Received: from list by monty-python.gnu.org with archive (Exim 4.30)
	id 1BDT4J-0001fi-Ho
	for mharc-bug-commoncpp@gnu.org; Tue, 13 Apr 2004 14:55:35 -0400
Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30)
	id 1BDT4G-0001eS-AM
	for bug-commoncpp@gnu.org; Tue, 13 Apr 2004 14:55:32 -0400
Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30)
	id 1BDT1f-0008Uo-IA
	for bug-commoncpp@gnu.org; Tue, 13 Apr 2004 14:53:26 -0400
Received: from [216.218.222.122] (helo=mail.ostel.com)
	by monty-python.gnu.org with esmtp (Exim 4.30) id 1BDT1D-0007og-Bs
	for bug-commoncpp@gnu.org; Tue, 13 Apr 2004 14:52:23 -0400
Received: by mail.ostel.com (Postfix, from userid 1005)
	id 661F62F2883; Tue, 13 Apr 2004 11:53:36 -0700 (PDT)
Received: from [192.168.1.102] (pool-141-153-203-248.mad.east.verizon.net
	[141.153.203.248]) by mail.ostel.com (Postfix) with ESMTP
	id 9652A2F2867; Tue, 13 Apr 2004 11:53:28 -0700 (PDT)
From: David Sugar <dyfet@ostel.com>
To: bug-commoncpp@gnu.org
Date: Tue, 13 Apr 2004 14:55:15 -0400
User-Agent: KMail/1.6.2
References: <200404090402.34896.josh@chatgris.com>
	<200404091700.17737.josh@chatgris.com>
	<200404100558.32236.dyfet@ostel.com>
In-Reply-To: <200404100558.32236.dyfet@ostel.com>
MIME-Version: 1.0
Content-Disposition: inline
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Message-Id: <200404131455.15148.dyfet@ostel.com>
Cc: 
Subject: Re: Segmentation fault//memcpy misuse with command options (partial
	fix patch included)
X-BeenThere: bug-commoncpp@gnu.org
X-Mailman-Version: 2.1.4
Precedence: list
List-Id: Bug reports for Common C++ <bug-commoncpp.gnu.org>
List-Unsubscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=unsubscribe>
List-Archive: <http://mail.gnu.org/pipermail/bug-commoncpp>
List-Post: <mailto:bug-commoncpp@gnu.org>
List-Help: <mailto:bug-commoncpp-request@gnu.org?subject=help>
List-Subscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 13 Apr 2004 18:55:33 -0000

I have been able to duplicate this problem here, using a different example, 
and I know what is happening.  When the slot list of linked deleted 
(reusable) buffers is formed, each buffer has to be unique.  I believe 
somewhere we are permitting other strings to hold a duplicate copy of the 
String internals and buffer pointers, and hence the string buffer in the 
linked list is being overwritten by another string object that also has it's 
buffer.  Since the linked list is formed by making the buffer content into 
link pointers, these links are getting overriden by the other string object 
that still has a pointer to the same piece of memory that is thought to be 
free, and hence starts containing pointers that are not links but rather 
composed of character data.

I believe the likely culpret is ::copy(), which allows "content" structure to 
= the content of the original string unmodified when !isBig(), and here is 
where we may copy the alias to the same memory pointer, but I need to do some 
further testing to see if it is indeed there or in another one of the 
operations...

On Saturday 10 April 2004 05:58 am, David Sugar wrote:
> My first thought is that most of these operations depend on getLength
> returning the correct string length (in effect strlen() + 1 null byte).
> However, the String class actually stores a length field, which is what
> getLength() actually returns, and maybe that length field is not being kept
> in sync with the actual string length in some circumstances!  It would be
> interesting to compare the length returned by getLength with the length
> returned by strlen() in front of each of these memmove's...
>
> On Friday 09 April 2004 05:00 pm, you wrote:
> > In addition, none of these problems occur with commoncpp2 1.0.13 only in
> > 1.1.2.
> >
> > Joshua Moore-Oliva.
> >
> > On April 8, 2004 9:19 pm, David Sugar wrote:
> > > So what you did is basically replace every memcpy with a memmove?
> > > Hmm...in at least some cases, memcpy may be inline'd with assembler
> > > code. Perhaps there is something odd in the inline code substitution? 
> > > Also, your patch got a little chopped up in the debugging text...
> > >
> > > David
> > >
> > > On Friday 09 April 2004 04:02 am, Joshua Moore-Oliva wrote:
> > > > I created a program with quite a few options, and I got a
> > > > segmentation fault that appears to be a mis-use of memcpy.
> > > >
> > > > Included is a test program to reproduce the problem and some
> > > > debugging output.
> > > >
> > > > I was able to remove the problems with memcpy with the changes in the
> > > > included patch, however I am not familiar enough with the code to
> > > > determine why the getSpace function in the String library is going
> > > > out of bounds...
> > > >
> > > > debugging output before patch
> > > >
> > > > ==17692== Source and destination overlap in memcpy(0x41E1A83C,
> > > > 0x41E1A87C, 86) ==17692==    at 0x40022224: memcpy (in
> > > > /usr/lib/valgrind/vgskin_memcheck.so) ==17692==    by 0x40277A94:
> > > > ost::String::set(char const*, unsigned) (in
> > > > /usr/lib/libccgnu2-1.1.so.0.0.2) ==17692==    by 0x40277B07:
> > > > ost::String::set(ost::String const&) (in
> > > > /usr/lib/libccgnu2-1.1.so.0.0.2) ==17692==    by 0x402B16C1:
> > > > ost::String::operator=(ost::String const&) (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x402B7B10:
> > > > ost::CommandOptionParse_impl::makePrintErrors() (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x402B6CAC:
> > > > ost::CommandOptionParse_impl::printErrors() (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x8048BD8: main (in
> > > > /home/chatgris/a.out)
> > > > ==17692==
> > > > ==17692== Source and destination overlap in memcpy(0x41E1A87C,
> > > > 0x41E1A83C, 87) ==17692==    at 0x40022224: memcpy (in
> > > > /usr/lib/valgrind/vgskin_memcheck.so) ==17692==    by 0x40277C75:
> > > > ost::String::copy(ost::String const&) (in
> > > > /usr/lib/libccgnu2-1.1.so.0.0.2) ==17692==    by 0x4027647B:
> > > > ost::String::String(ost::String const&) (in
> > > > /usr/lib/libccgnu2-1.1.so.0.0.2) ==17692==    by 0x4027887C:
> > > > ost::operator+(ost::String const&, char const*) (in
> > > > /usr/lib/libccgnu2-1.1.so.0.0.2) ==17692==    by 0x402B7B83:
> > > > ost::CommandOptionParse_impl::makePrintErrors() (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x402B6CAC:
> > > > ost::CommandOptionParse_impl::printErrors() (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x8048BD8: main (in
> > > > /home/chatgris/a.out)
> > > > ==17692==
> > > > ==17692== Source and destination overlap in memcpy(0x41E1AC68,
> > > > 0x41E1ABA8, 215) ==17692==    at 0x40022224: memcpy (in
> > > > /usr/lib/valgrind/vgskin_memcheck.so) ==17692==    by 0x40278310:
> > > > ost::String::resize(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > > > ==17692==    by 0x40277A71: ost::String::set(char const*, unsigned)
> > > > (in /usr/lib/libccgnu2-1.1.so.0.0.2) ==17692==    by 0x40277B07:
> > > > ost::String::set(ost::String const&) (in
> > > > /usr/lib/libccgnu2-1.1.so.0.0.2) ==17692==    by 0x402B16C1:
> > > > ost::String::operator=(ost::String const&) (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x402B7DD5:
> > > > ost::CommandOptionParse_impl::makePrintErrors() (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x402B6CAC:
> > > > ost::CommandOptionParse_impl::printErrors() (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x8048BD8: main (in
> > > > /home/chatgris/a.out)
> > > > Value required for option '--connection_string' is missing
> > > > Value==17692==
> > > > ==17692== Source and destination overlap in memcpy(0x41E1A7BC,
> > > > 0x41E1A7DC, 41) ==17692==    at 0x40022224: memcpy (in
> > > > /usr/lib/valgrind/vgskin_memcheck.so) ==17692==    by 0x40277C75:
> > > > ost::String::copy(ost::String const&) (in
> > > > /usr/lib/libccgnu2-1.1.so.0.0.2) ==17692==    by 0x4027647B:
> > > > ost::String::String(ost::String const&) (in
> > > > /usr/lib/libccgnu2-1.1.so.0.0.2) ==17692==    by 0x402787B2:
> > > > ost::operator+(ost::String const&, char) (in
> > > > /usr/lib/libccgnu2-1.1.so.0.0.2) ==17692==    by 0x402B8015:
> > > > ost::CommandOptionParse_impl::makePrintUsage() (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x402B6C7A:
> > > > ost::CommandOptionParse_impl::printUsage() (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x8048BFA: main (in
> > > > /home/chatgris/a.out)
> > > > ==17692==
> > > > ==17692== Invalid read of size 4
> > > > ==17692==    at 0x40278576: ost::String::getSpace(unsigned) (in
> > > > /usr/lib/libccgnu2-1.1.so.0.0.2) ==17692==    by 0x402781F6:
> > > > ost::String::resize(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > > > ==17692==    by 0x40277A71: ost::String::set(char const*, unsigned)
> > > > (in /usr/lib/libccgnu2-1.1.so.0.0.2) ==17692==    by 0x40277B07:
> > > > ost::String::set(ost::String const&) (in
> > > > /usr/lib/libccgnu2-1.1.so.0.0.2) ==17692==    by 0x402B16C1:
> > > > oValue==26722== Invalid read of size 4 ==26722==    at 0x40278576:
> > > > ost::String::getSpace(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > > > ==26722==    by 0x402781F6:
> > > > ost::String::resize(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > > > ==26722==    by 0x40277A71: ost::String::set(char const*, unsigned)
> > > > (in /usr/lib/libccgnu2-1.1.so.0.0.2) ==26722==    by 0x40277B07:
> > > > ost::String::set(ost::String const&) (in
> > > > /usr/lib/libccgnu2-1.1.so.0.0.2) ==26722==    by 0x402B16C1:
> > > > ost::String::operator=(ost::String const&) (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x402B802A:
> > > > ost::CommandOptionParse_impl::makePrintUsage() (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x402B6C7A:
> > > > ost::CommandOptionParse_impl::printUsage() (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x8048BFA: main
> > > > (main.cpp:69)
> > > > ==26722==  Address 0x20202020 is not stack'd, malloc'd or free'd
> > > > ==26722==
> > > > ==26722== Process terminating with default action of signal 11
> > > > (SIGSEGV): dumping core ==26722==  Address not mapped to object at
> > > > address 0x20202020 ==26722==    at 0x40278576:
> > > > ost::String::getSpace(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > > > ==26722==    by 0x402781F6:
> > > > ost::String::resize(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > > > ==26722==    by 0x40277A71: ost::String::set(char const*, unsigned)
> > > > (in /usr/lib/libccgnu2-1.1.so.0.0.2) ==26722==    by 0x40277B07:
> > > > ost::String::set(ost::String const&) (in
> > > > /usr/lib/libccgnu2-1.1.so.0.0.2) ==26722==    by 0x402B16C1:
> > > > ost::String::operator=(ost::String const&) (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x402B802A:
> > > > ost::CommandOptionParse_impl::makePrintUsage() (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x402B6C7A:
> > > > ost::CommandOptionParse_impl::printUsage() (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x8048BFA: main
> > > > (main.cpp:69)st::String::operator=(ost::String const&) (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x402B802A:
> > > > ost::CommandOptionParse_impl::makePrintUsage() (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x402B6C7A:
> > > > ost::CommandOptionParse_impl::printUsage() (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x8048BFA: main (in
> > > > /home/chatgris/a.out)
> > > > ==17692==  Address 0x20202020 is not stack'd, malloc'd or free'd
> > > > ==17692==
> > > > ==17692== Process terminating with default action of signal 11
> > > > (SIGSEGV): dumping core ==17692==  Address not mapped to object at
> > > > address 0x20202020 ==17692==    at 0x40278576:
> > > > ost::String::getSpace(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > > > ==17692==    by 0x402781F6:
> > > > ost::String::resize(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > > > ==17692==    by 0x40277A71: ost::String::set(char const*, unsigned)
> > > > (in /usr/lib/libccgnu2-1.1.so.0.0.2) ==17692==    by 0x40277B07:
> > > > ost::String::set(ost::String const&) (in
> > > > /usr/lib/libccgnu2-1.1.so.0.0.2) ==17692==    by 0x402B16C1:
> > > > ost::String::operator=(ost::String const&) (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x402B802A:
> > > > ost::CommandOptionParse_impl::makePrintUsage() (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x402B6C7A:
> > > > ost::CommandOptionParse_impl::printUsage() (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x8048BFA: main (in
> > > > /home/chatgris/a.out)
> > > >
> > > >
> > > > test case
> > > >
> > > > #include <iostream>
> > > > #include <cc++/common.h>
> > > >
> > > > ost::CommandOptionArg optConnInfo (
> > > >   "connection_string", "c", "Connection String.", true
> > > > );
> > > >
> > > > ost::CommandOptionArg optMergeDelimiterField (
> > > >   "field_delimiter", "f", "Field delimiter for merge information",
> > > > true );
> > > >
> > > > ost::CommandOptionArg optMergeDelimiterRecord (
> > > >   "record_delimiter", "r", "Record delimiter for merge information",
> > > > true );
> > > >
> > > > ost::CommandOptionArg optMergeNames (
> > > >   "merge_names", "n", "Merge Field Names (tab delimited)", true
> > > > );
> > > >
> > > > ost::CommandOptionArg optMessageSource (
> > > >   "message_source", "s", "Message Source", true
> > > > );
> > > >
> > > > ost::CommandOptionArg optQuery (
> > > >   "query", "q", "Query to retrieve send data", true
> > > > );
> > > >
> > > > ost::CommandOptionArg optSortDir (
> > > >   "sort_dir", "sd", "Directory where the sort binary resides", true
> > > > );
> > > >
> > > > ost::CommandOptionArg optSortName (
> > > >   "sort_name", "sn", "Name of the sort binary", true
> > > > );
> > > >
> > > > ost::CommandOptionArg optSortTmpDir (
> > > >   "sort_tmp_dir", "st", "Temp dir for sort to use", true
> > > > );
> > > >
> > > > ost::CommandOptionArg optMaxBatchSize (
> > > >   "max_batch_size", "b", "Maximum Batch Size", true
> > > > );
> > > >
> > > > ost::CommandOptionArg optPriority (
> > > >   "priority", "p", "Priority for mailing", true
> > > > );
> > > >
> > > > ost::CommandOptionNoArg optHelpArg (
> > > >   "help", "?", "Print help usage"
> > > > );
> > > >
> > > > int main ( int argc, char ** argv ) {
> > > >   ost::CommandOptionParse * optArgs =
> > > >     ost::makeCommandOptionParse ( argc
> > > >                                 , argv
> > > >                                 , "Configurable Procmail receiver.\n"
> > > >   );
> > > >
> > > >   // If the user requested help then suppress all the usage error
> > > >   // messages.
> > > >   if ( optHelpArg.numSet ) {
> > > >     std::cerr << optArgs->printUsage();
> > > >     return 0;
> > > >   }
> > > >
> > > >   // Print usage your way.
> > > >   if ( optArgs->argsHaveError() ) {
> > > >     std::cerr << optArgs->printErrors();
> > > >     std::cerr << optArgs->printUsage();
> > > >     return 1;
> > > >   }
> > > >
> > > >   std::cout << "Success" << std::endl;
> > > >
> > > >   delete optArgs;
> > > >
> > > >   return 0;
> > > > }
> > > >
> > > > Patch to get rid of memcpy
> > > >
> > > > 170c170
> > > > <               memmove(ptr + start, str, count);
> > > > ---
> > > >
> > > > >               memcpy(ptr + start, str, count);
> > > >
> > > > 218c218
> > > > <       memmove(ptr + start, ptr + start + count, len - start -
> > > > count); ---
> > > >
> > > > >       memcpy(ptr + start, ptr + start + count, len - start -
> > > > > count);
> > > >
> > > > 253c253
> > > > <       memmove(getText() + getLength(), str, len);
> > > > ---
> > > >
> > > > >       memcpy(getText() + getLength(), str, len);
> > > >
> > > > 391c391
> > > > <       memmove(getText(), str, Value==26722== Invalid read of size 4
> > > > ==26722==    at 0x40278576: ost::String::getSpace(unsigned) (in
> > > > /usr/lib/libccgnu2-1.1.so.0.0.2) ==26722==    by 0x402781F6:
> > > > ost::String::resize(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > > > ==26722==    by 0x40277A71: ost::String::set(char const*, unsigned)
> > > > (in /usr/lib/libccgnu2-1.1.so.0.0.2) ==26722==    by 0x40277B07:
> > > > ost::String::set(ost::String const&) (in
> > > > /usr/lib/libccgnu2-1.1.so.0.0.2) ==26722==    by 0x402B16C1:
> > > > ost::String::operator=(ost::String const&) (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x402B802A:
> > > > ost::CommandOptionParse_impl::makePrintUsage() (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x402B6C7A:
> > > > ost::CommandOptionParse_impl::printUsage() (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x8048BFA: main
> > > > (main.cpp:69)
> > > > ==26722==  Address 0x20202020 is not stack'd, malloc'd or free'd
> > > > ==26722==
> > > > ==26722== Process terminating with default action of signal 11
> > > > (SIGSEGV): dumping core ==26722==  Address not mapped to object at
> > > > address 0x20202020 ==26722==    at 0x40278576:
> > > > ost::String::getSpace(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > > > ==26722==    by 0x402781F6:
> > > > ost::String::resize(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > > > ==26722==    by 0x40277A71: ost::String::set(char const*, unsigned)
> > > > (in /usr/lib/libccgnu2-1.1.so.0.0.2) ==26722==    by 0x40277B07:
> > > > ost::String::set(ost::String const&) (in
> > > > /usr/lib/libccgnu2-1.1.so.0.0.2) ==26722==    by 0x402B16C1:
> > > > ost::String::operator=(ost::String const&) (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x402B802A:
> > > > ost::CommandOptionParse_impl::makePrintUsage() (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x402B6C7A:
> > > > ost::CommandOptionParse_impl::printUsage() (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x8048BFA: main
> > > > (main.cpp:69)len);
> > > > ---
> > > >
> > > > >       memcpy(getText(), str, len);
> > > >
> > > > 418c418
> > > > <               memmove(content.ministring.text, getText(),
> > > > getLength() + 1); ---
> > > >
> > > > >               memcpy(content.ministring.text, getText(),
> > > > > getLength() + 1);
> > > >
> > > > 426c426
> > > > <       memmove(content.bigstring.text, ptr, getLength() + 1);
> > > > ---
> > > >
> > > > >       memcpy(content.bigstring.text, ptr, getLength() + 1);
> > > >
> > > > 576c576
> > > > <               memmove(ptr, content.ministring.text, length);
> > > > ---
> > > >
> > > > >               memcpy(ptr, content.ministring.text, length);
> > > >
> > > > 588c588
> > > > <               memmove(content.ministring.text, ptr, length);
> > > > ---
> > > >
> > > > >               memcpy(content.ministring.text, ptr, length);
> > > >
> > > > 597c597
> > > > <       memmove(ptr, getText(), length);
> > > > ---
> > > >
> > > > >       memcpy(ptr, getText(), length);
> > > >
> > > > Debugging results of above program after patch applied
> > > >
> > > > Value==26722== Invalid read of size 4
> > > > ==26722==    at 0x40278576: ost::String::getSpace(unsigned) (in
> > > > /usr/lib/libccgnu2-1.1.so.0.0.2) ==26722==    by 0x402781F6:
> > > > ost::String::resize(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > > > ==26722==    by 0x40277A71: ost::String::set(char const*, unsigned)
> > > > (in /usr/lib/libccgnu2-1.1.so.0.0.2) ==26722==    by 0x40277B07:
> > > > ost::String::set(ost::String const&) (in
> > > > /usr/lib/libccgnu2-1.1.so.0.0.2) ==26722==    by 0x402B16C1:
> > > > ost::String::operator=(ost::String const&) (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x402B802A:
> > > > ost::CommandOptionParse_impl::makePrintUsage() (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x402B6C7A:
> > > > ost::CommandOptionParse_impl::printUsage() (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x8048BFA: main
> > > > (main.cpp:69)
> > > > ==26722==  Address 0x20202020 is not stack'd, malloc'd or free'd
> > > > ==26722==
> > > > ==26722== Process terminating with default action of signal 11
> > > > (SIGSEGV): dumping core ==26722==  Address not mapped to object at
> > > > address 0x20202020 ==26722==    at 0x40278576:
> > > > ost::String::getSpace(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > > > ==26722==    by 0x402781F6:
> > > > ost::String::resize(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > > > ==26722==    by 0x40277A71: ost::String::set(char const*, unsigned)
> > > > (in /usr/lib/libccgnu2-1.1.so.0.0.2) ==26722==    by 0x40277B07:
> > > > ost::String::set(ost::String const&) (in
> > > > /usr/lib/libccgnu2-1.1.so.0.0.2) ==26722==    by 0x402B16C1:
> > > > ost::String::operator=(ost::String const&) (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x402B802A:
> > > > ost::CommandOptionParse_impl::makePrintUsage() (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x402B6C7A:
> > > > ost::CommandOptionParse_impl::printUsage() (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x8048BFA: main
> > > > (main.cpp:69)
> > > >
> > > >
> > > > _______________________________________________
> > > > Bug-commoncpp mailing list
> > > > Bug-commoncpp@gnu.org
> > > > http://mail.gnu.org/mailman/listinfo/bug-commoncpp
>
> _______________________________________________
> Bug-commoncpp mailing list
> Bug-commoncpp@gnu.org
> http://mail.gnu.org/mailman/listinfo/bug-commoncpp



From MAILER-DAEMON Tue Apr 13 15:27:26 2004
Received: from list by monty-python.gnu.org with archive (Exim 4.30)
	id 1BDTZ8-0000Mb-AL
	for mharc-bug-commoncpp@gnu.org; Tue, 13 Apr 2004 15:27:26 -0400
Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30)
	id 1BDTZ3-0000JL-Qf
	for bug-commoncpp@gnu.org; Tue, 13 Apr 2004 15:27:21 -0400
Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30)
	id 1BDTYX-00006P-3f
	for bug-commoncpp@gnu.org; Tue, 13 Apr 2004 15:27:20 -0400
Received: from [216.218.222.122] (helo=mail.ostel.com)
	by monty-python.gnu.org with esmtp (Exim 4.30) id 1BDTYW-00006D-DF
	for bug-commoncpp@gnu.org; Tue, 13 Apr 2004 15:26:48 -0400
Received: by mail.ostel.com (Postfix, from userid 1005)
	id DB0242F2884; Tue, 13 Apr 2004 12:28:03 -0700 (PDT)
Received: from [192.168.1.102] (pool-141-153-164-212.mad.east.verizon.net
	[141.153.164.212]) by mail.ostel.com (Postfix) with ESMTP
	id 82D9F2F2867; Tue, 13 Apr 2004 12:27:55 -0700 (PDT)
From: David Sugar <dyfet@ostel.com>
To: bug-commoncpp@gnu.org
Date: Tue, 13 Apr 2004 15:29:41 -0400
User-Agent: KMail/1.6.2
References: <200404090402.34896.josh@chatgris.com>
	<200404091700.17737.josh@chatgris.com>
	<200404100558.32236.dyfet@ostel.com>
In-Reply-To: <200404100558.32236.dyfet@ostel.com>
MIME-Version: 1.0
Content-Disposition: inline
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Message-Id: <200404131529.41979.dyfet@ostel.com>
Cc: 
Subject: Operator=(const String &c)
X-BeenThere: bug-commoncpp@gnu.org
X-Mailman-Version: 2.1.4
Precedence: list
List-Id: Bug reports for Common C++ <bug-commoncpp.gnu.org>
List-Unsubscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=unsubscribe>
List-Archive: <http://mail.gnu.org/pipermail/bug-commoncpp>
List-Post: <mailto:bug-commoncpp@gnu.org>
List-Help: <mailto:bug-commoncpp-request@gnu.org?subject=help>
List-Subscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 13 Apr 2004 19:27:23 -0000

I found there is no = operator defined for String to String, and the default 
operator I verified does copy the String content data structure literally, 
since after an equal, both strings have pointers to the same memory buffer.  
In addition to defining that operator, I also rewrote the copy constructor a 
bit in general.  This removed one error, but there is still at least one more 
case where the values of content seem duplicatable between String objects, 
which I am still tracking down.

On Saturday 10 April 2004 05:58 am, David Sugar wrote:
> My first thought is that most of these operations depend on getLength
> returning the correct string length (in effect strlen() + 1 null byte).
> However, the String class actually stores a length field, which is what
> getLength() actually returns, and maybe that length field is not being kept
> in sync with the actual string length in some circumstances!  It would be
> interesting to compare the length returned by getLength with the length
> returned by strlen() in front of each of these memmove's...
>
> On Friday 09 April 2004 05:00 pm, you wrote:
> > In addition, none of these problems occur with commoncpp2 1.0.13 only in
> > 1.1.2.
> >
> > Joshua Moore-Oliva.
> >
> > On April 8, 2004 9:19 pm, David Sugar wrote:
> > > So what you did is basically replace every memcpy with a memmove?
> > > Hmm...in at least some cases, memcpy may be inline'd with assembler
> > > code. Perhaps there is something odd in the inline code substitution? 
> > > Also, your patch got a little chopped up in the debugging text...
> > >
> > > David
> > >
> > > On Friday 09 April 2004 04:02 am, Joshua Moore-Oliva wrote:
> > > > I created a program with quite a few options, and I got a
> > > > segmentation fault that appears to be a mis-use of memcpy.
> > > >
> > > > Included is a test program to reproduce the problem and some
> > > > debugging output.
> > > >
> > > > I was able to remove the problems with memcpy with the changes in the
> > > > included patch, however I am not familiar enough with the code to
> > > > determine why the getSpace function in the String library is going
> > > > out of bounds...
> > > >
> > > > debugging output before patch
> > > >
> > > > ==17692== Source and destination overlap in memcpy(0x41E1A83C,
> > > > 0x41E1A87C, 86) ==17692==    at 0x40022224: memcpy (in
> > > > /usr/lib/valgrind/vgskin_memcheck.so) ==17692==    by 0x40277A94:
> > > > ost::String::set(char const*, unsigned) (in
> > > > /usr/lib/libccgnu2-1.1.so.0.0.2) ==17692==    by 0x40277B07:
> > > > ost::String::set(ost::String const&) (in
> > > > /usr/lib/libccgnu2-1.1.so.0.0.2) ==17692==    by 0x402B16C1:
> > > > ost::String::operator=(ost::String const&) (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x402B7B10:
> > > > ost::CommandOptionParse_impl::makePrintErrors() (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x402B6CAC:
> > > > ost::CommandOptionParse_impl::printErrors() (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x8048BD8: main (in
> > > > /home/chatgris/a.out)
> > > > ==17692==
> > > > ==17692== Source and destination overlap in memcpy(0x41E1A87C,
> > > > 0x41E1A83C, 87) ==17692==    at 0x40022224: memcpy (in
> > > > /usr/lib/valgrind/vgskin_memcheck.so) ==17692==    by 0x40277C75:
> > > > ost::String::copy(ost::String const&) (in
> > > > /usr/lib/libccgnu2-1.1.so.0.0.2) ==17692==    by 0x4027647B:
> > > > ost::String::String(ost::String const&) (in
> > > > /usr/lib/libccgnu2-1.1.so.0.0.2) ==17692==    by 0x4027887C:
> > > > ost::operator+(ost::String const&, char const*) (in
> > > > /usr/lib/libccgnu2-1.1.so.0.0.2) ==17692==    by 0x402B7B83:
> > > > ost::CommandOptionParse_impl::makePrintErrors() (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x402B6CAC:
> > > > ost::CommandOptionParse_impl::printErrors() (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x8048BD8: main (in
> > > > /home/chatgris/a.out)
> > > > ==17692==
> > > > ==17692== Source and destination overlap in memcpy(0x41E1AC68,
> > > > 0x41E1ABA8, 215) ==17692==    at 0x40022224: memcpy (in
> > > > /usr/lib/valgrind/vgskin_memcheck.so) ==17692==    by 0x40278310:
> > > > ost::String::resize(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > > > ==17692==    by 0x40277A71: ost::String::set(char const*, unsigned)
> > > > (in /usr/lib/libccgnu2-1.1.so.0.0.2) ==17692==    by 0x40277B07:
> > > > ost::String::set(ost::String const&) (in
> > > > /usr/lib/libccgnu2-1.1.so.0.0.2) ==17692==    by 0x402B16C1:
> > > > ost::String::operator=(ost::String const&) (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x402B7DD5:
> > > > ost::CommandOptionParse_impl::makePrintErrors() (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x402B6CAC:
> > > > ost::CommandOptionParse_impl::printErrors() (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x8048BD8: main (in
> > > > /home/chatgris/a.out)
> > > > Value required for option '--connection_string' is missing
> > > > Value==17692==
> > > > ==17692== Source and destination overlap in memcpy(0x41E1A7BC,
> > > > 0x41E1A7DC, 41) ==17692==    at 0x40022224: memcpy (in
> > > > /usr/lib/valgrind/vgskin_memcheck.so) ==17692==    by 0x40277C75:
> > > > ost::String::copy(ost::String const&) (in
> > > > /usr/lib/libccgnu2-1.1.so.0.0.2) ==17692==    by 0x4027647B:
> > > > ost::String::String(ost::String const&) (in
> > > > /usr/lib/libccgnu2-1.1.so.0.0.2) ==17692==    by 0x402787B2:
> > > > ost::operator+(ost::String const&, char) (in
> > > > /usr/lib/libccgnu2-1.1.so.0.0.2) ==17692==    by 0x402B8015:
> > > > ost::CommandOptionParse_impl::makePrintUsage() (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x402B6C7A:
> > > > ost::CommandOptionParse_impl::printUsage() (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x8048BFA: main (in
> > > > /home/chatgris/a.out)
> > > > ==17692==
> > > > ==17692== Invalid read of size 4
> > > > ==17692==    at 0x40278576: ost::String::getSpace(unsigned) (in
> > > > /usr/lib/libccgnu2-1.1.so.0.0.2) ==17692==    by 0x402781F6:
> > > > ost::String::resize(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > > > ==17692==    by 0x40277A71: ost::String::set(char const*, unsigned)
> > > > (in /usr/lib/libccgnu2-1.1.so.0.0.2) ==17692==    by 0x40277B07:
> > > > ost::String::set(ost::String const&) (in
> > > > /usr/lib/libccgnu2-1.1.so.0.0.2) ==17692==    by 0x402B16C1:
> > > > oValue==26722== Invalid read of size 4 ==26722==    at 0x40278576:
> > > > ost::String::getSpace(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > > > ==26722==    by 0x402781F6:
> > > > ost::String::resize(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > > > ==26722==    by 0x40277A71: ost::String::set(char const*, unsigned)
> > > > (in /usr/lib/libccgnu2-1.1.so.0.0.2) ==26722==    by 0x40277B07:
> > > > ost::String::set(ost::String const&) (in
> > > > /usr/lib/libccgnu2-1.1.so.0.0.2) ==26722==    by 0x402B16C1:
> > > > ost::String::operator=(ost::String const&) (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x402B802A:
> > > > ost::CommandOptionParse_impl::makePrintUsage() (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x402B6C7A:
> > > > ost::CommandOptionParse_impl::printUsage() (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x8048BFA: main
> > > > (main.cpp:69)
> > > > ==26722==  Address 0x20202020 is not stack'd, malloc'd or free'd
> > > > ==26722==
> > > > ==26722== Process terminating with default action of signal 11
> > > > (SIGSEGV): dumping core ==26722==  Address not mapped to object at
> > > > address 0x20202020 ==26722==    at 0x40278576:
> > > > ost::String::getSpace(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > > > ==26722==    by 0x402781F6:
> > > > ost::String::resize(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > > > ==26722==    by 0x40277A71: ost::String::set(char const*, unsigned)
> > > > (in /usr/lib/libccgnu2-1.1.so.0.0.2) ==26722==    by 0x40277B07:
> > > > ost::String::set(ost::String const&) (in
> > > > /usr/lib/libccgnu2-1.1.so.0.0.2) ==26722==    by 0x402B16C1:
> > > > ost::String::operator=(ost::String const&) (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x402B802A:
> > > > ost::CommandOptionParse_impl::makePrintUsage() (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x402B6C7A:
> > > > ost::CommandOptionParse_impl::printUsage() (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x8048BFA: main
> > > > (main.cpp:69)st::String::operator=(ost::String const&) (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x402B802A:
> > > > ost::CommandOptionParse_impl::makePrintUsage() (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x402B6C7A:
> > > > ost::CommandOptionParse_impl::printUsage() (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x8048BFA: main (in
> > > > /home/chatgris/a.out)
> > > > ==17692==  Address 0x20202020 is not stack'd, malloc'd or free'd
> > > > ==17692==
> > > > ==17692== Process terminating with default action of signal 11
> > > > (SIGSEGV): dumping core ==17692==  Address not mapped to object at
> > > > address 0x20202020 ==17692==    at 0x40278576:
> > > > ost::String::getSpace(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > > > ==17692==    by 0x402781F6:
> > > > ost::String::resize(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > > > ==17692==    by 0x40277A71: ost::String::set(char const*, unsigned)
> > > > (in /usr/lib/libccgnu2-1.1.so.0.0.2) ==17692==    by 0x40277B07:
> > > > ost::String::set(ost::String const&) (in
> > > > /usr/lib/libccgnu2-1.1.so.0.0.2) ==17692==    by 0x402B16C1:
> > > > ost::String::operator=(ost::String const&) (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x402B802A:
> > > > ost::CommandOptionParse_impl::makePrintUsage() (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x402B6C7A:
> > > > ost::CommandOptionParse_impl::printUsage() (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x8048BFA: main (in
> > > > /home/chatgris/a.out)
> > > >
> > > >
> > > > test case
> > > >
> > > > #include <iostream>
> > > > #include <cc++/common.h>
> > > >
> > > > ost::CommandOptionArg optConnInfo (
> > > >   "connection_string", "c", "Connection String.", true
> > > > );
> > > >
> > > > ost::CommandOptionArg optMergeDelimiterField (
> > > >   "field_delimiter", "f", "Field delimiter for merge information",
> > > > true );
> > > >
> > > > ost::CommandOptionArg optMergeDelimiterRecord (
> > > >   "record_delimiter", "r", "Record delimiter for merge information",
> > > > true );
> > > >
> > > > ost::CommandOptionArg optMergeNames (
> > > >   "merge_names", "n", "Merge Field Names (tab delimited)", true
> > > > );
> > > >
> > > > ost::CommandOptionArg optMessageSource (
> > > >   "message_source", "s", "Message Source", true
> > > > );
> > > >
> > > > ost::CommandOptionArg optQuery (
> > > >   "query", "q", "Query to retrieve send data", true
> > > > );
> > > >
> > > > ost::CommandOptionArg optSortDir (
> > > >   "sort_dir", "sd", "Directory where the sort binary resides", true
> > > > );
> > > >
> > > > ost::CommandOptionArg optSortName (
> > > >   "sort_name", "sn", "Name of the sort binary", true
> > > > );
> > > >
> > > > ost::CommandOptionArg optSortTmpDir (
> > > >   "sort_tmp_dir", "st", "Temp dir for sort to use", true
> > > > );
> > > >
> > > > ost::CommandOptionArg optMaxBatchSize (
> > > >   "max_batch_size", "b", "Maximum Batch Size", true
> > > > );
> > > >
> > > > ost::CommandOptionArg optPriority (
> > > >   "priority", "p", "Priority for mailing", true
> > > > );
> > > >
> > > > ost::CommandOptionNoArg optHelpArg (
> > > >   "help", "?", "Print help usage"
> > > > );
> > > >
> > > > int main ( int argc, char ** argv ) {
> > > >   ost::CommandOptionParse * optArgs =
> > > >     ost::makeCommandOptionParse ( argc
> > > >                                 , argv
> > > >                                 , "Configurable Procmail receiver.\n"
> > > >   );
> > > >
> > > >   // If the user requested help then suppress all the usage error
> > > >   // messages.
> > > >   if ( optHelpArg.numSet ) {
> > > >     std::cerr << optArgs->printUsage();
> > > >     return 0;
> > > >   }
> > > >
> > > >   // Print usage your way.
> > > >   if ( optArgs->argsHaveError() ) {
> > > >     std::cerr << optArgs->printErrors();
> > > >     std::cerr << optArgs->printUsage();
> > > >     return 1;
> > > >   }
> > > >
> > > >   std::cout << "Success" << std::endl;
> > > >
> > > >   delete optArgs;
> > > >
> > > >   return 0;
> > > > }
> > > >
> > > > Patch to get rid of memcpy
> > > >
> > > > 170c170
> > > > <               memmove(ptr + start, str, count);
> > > > ---
> > > >
> > > > >               memcpy(ptr + start, str, count);
> > > >
> > > > 218c218
> > > > <       memmove(ptr + start, ptr + start + count, len - start -
> > > > count); ---
> > > >
> > > > >       memcpy(ptr + start, ptr + start + count, len - start -
> > > > > count);
> > > >
> > > > 253c253
> > > > <       memmove(getText() + getLength(), str, len);
> > > > ---
> > > >
> > > > >       memcpy(getText() + getLength(), str, len);
> > > >
> > > > 391c391
> > > > <       memmove(getText(), str, Value==26722== Invalid read of size 4
> > > > ==26722==    at 0x40278576: ost::String::getSpace(unsigned) (in
> > > > /usr/lib/libccgnu2-1.1.so.0.0.2) ==26722==    by 0x402781F6:
> > > > ost::String::resize(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > > > ==26722==    by 0x40277A71: ost::String::set(char const*, unsigned)
> > > > (in /usr/lib/libccgnu2-1.1.so.0.0.2) ==26722==    by 0x40277B07:
> > > > ost::String::set(ost::String const&) (in
> > > > /usr/lib/libccgnu2-1.1.so.0.0.2) ==26722==    by 0x402B16C1:
> > > > ost::String::operator=(ost::String const&) (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x402B802A:
> > > > ost::CommandOptionParse_impl::makePrintUsage() (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x402B6C7A:
> > > > ost::CommandOptionParse_impl::printUsage() (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x8048BFA: main
> > > > (main.cpp:69)
> > > > ==26722==  Address 0x20202020 is not stack'd, malloc'd or free'd
> > > > ==26722==
> > > > ==26722== Process terminating with default action of signal 11
> > > > (SIGSEGV): dumping core ==26722==  Address not mapped to object at
> > > > address 0x20202020 ==26722==    at 0x40278576:
> > > > ost::String::getSpace(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > > > ==26722==    by 0x402781F6:
> > > > ost::String::resize(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > > > ==26722==    by 0x40277A71: ost::String::set(char const*, unsigned)
> > > > (in /usr/lib/libccgnu2-1.1.so.0.0.2) ==26722==    by 0x40277B07:
> > > > ost::String::set(ost::String const&) (in
> > > > /usr/lib/libccgnu2-1.1.so.0.0.2) ==26722==    by 0x402B16C1:
> > > > ost::String::operator=(ost::String const&) (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x402B802A:
> > > > ost::CommandOptionParse_impl::makePrintUsage() (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x402B6C7A:
> > > > ost::CommandOptionParse_impl::printUsage() (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x8048BFA: main
> > > > (main.cpp:69)len);
> > > > ---
> > > >
> > > > >       memcpy(getText(), str, len);
> > > >
> > > > 418c418
> > > > <               memmove(content.ministring.text, getText(),
> > > > getLength() + 1); ---
> > > >
> > > > >               memcpy(content.ministring.text, getText(),
> > > > > getLength() + 1);
> > > >
> > > > 426c426
> > > > <       memmove(content.bigstring.text, ptr, getLength() + 1);
> > > > ---
> > > >
> > > > >       memcpy(content.bigstring.text, ptr, getLength() + 1);
> > > >
> > > > 576c576
> > > > <               memmove(ptr, content.ministring.text, length);
> > > > ---
> > > >
> > > > >               memcpy(ptr, content.ministring.text, length);
> > > >
> > > > 588c588
> > > > <               memmove(content.ministring.text, ptr, length);
> > > > ---
> > > >
> > > > >               memcpy(content.ministring.text, ptr, length);
> > > >
> > > > 597c597
> > > > <       memmove(ptr, getText(), length);
> > > > ---
> > > >
> > > > >       memcpy(ptr, getText(), length);
> > > >
> > > > Debugging results of above program after patch applied
> > > >
> > > > Value==26722== Invalid read of size 4
> > > > ==26722==    at 0x40278576: ost::String::getSpace(unsigned) (in
> > > > /usr/lib/libccgnu2-1.1.so.0.0.2) ==26722==    by 0x402781F6:
> > > > ost::String::resize(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > > > ==26722==    by 0x40277A71: ost::String::set(char const*, unsigned)
> > > > (in /usr/lib/libccgnu2-1.1.so.0.0.2) ==26722==    by 0x40277B07:
> > > > ost::String::set(ost::String const&) (in
> > > > /usr/lib/libccgnu2-1.1.so.0.0.2) ==26722==    by 0x402B16C1:
> > > > ost::String::operator=(ost::String const&) (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x402B802A:
> > > > ost::CommandOptionParse_impl::makePrintUsage() (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x402B6C7A:
> > > > ost::CommandOptionParse_impl::printUsage() (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x8048BFA: main
> > > > (main.cpp:69)
> > > > ==26722==  Address 0x20202020 is not stack'd, malloc'd or free'd
> > > > ==26722==
> > > > ==26722== Process terminating with default action of signal 11
> > > > (SIGSEGV): dumping core ==26722==  Address not mapped to object at
> > > > address 0x20202020 ==26722==    at 0x40278576:
> > > > ost::String::getSpace(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > > > ==26722==    by 0x402781F6:
> > > > ost::String::resize(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > > > ==26722==    by 0x40277A71: ost::String::set(char const*, unsigned)
> > > > (in /usr/lib/libccgnu2-1.1.so.0.0.2) ==26722==    by 0x40277B07:
> > > > ost::String::set(ost::String const&) (in
> > > > /usr/lib/libccgnu2-1.1.so.0.0.2) ==26722==    by 0x402B16C1:
> > > > ost::String::operator=(ost::String const&) (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x402B802A:
> > > > ost::CommandOptionParse_impl::makePrintUsage() (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x402B6C7A:
> > > > ost::CommandOptionParse_impl::printUsage() (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x8048BFA: main
> > > > (main.cpp:69)
> > > >
> > > >
> > > > _______________________________________________
> > > > Bug-commoncpp mailing list
> > > > Bug-commoncpp@gnu.org
> > > > http://mail.gnu.org/mailman/listinfo/bug-commoncpp
>
> _______________________________________________
> Bug-commoncpp mailing list
> Bug-commoncpp@gnu.org
> http://mail.gnu.org/mailman/listinfo/bug-commoncpp



From MAILER-DAEMON Tue Apr 13 16:56:01 2004
Received: from list by monty-python.gnu.org with archive (Exim 4.30)
	id 1BDUwl-0005eW-Nz
	for mharc-bug-commoncpp@gnu.org; Tue, 13 Apr 2004 16:55:55 -0400
Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30)
	id 1BDUwi-0005dY-CL
	for bug-commoncpp@gnu.org; Tue, 13 Apr 2004 16:55:52 -0400
Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30)
	id 1BDUwB-0005NU-Hh
	for bug-commoncpp@gnu.org; Tue, 13 Apr 2004 16:55:51 -0400
Received: from [216.218.222.122] (helo=mail.ostel.com)
	by monty-python.gnu.org with esmtp (Exim 4.30) id 1BDUsf-0003ZW-8q
	for bug-commoncpp@gnu.org; Tue, 13 Apr 2004 16:51:41 -0400
Received: by mail.ostel.com (Postfix, from userid 1005)
	id 33A872F2883; Tue, 13 Apr 2004 13:52:37 -0700 (PDT)
Received: from [192.168.1.102] (pool-138-89-66-19.mad.east.verizon.net
	[138.89.66.19]) by mail.ostel.com (Postfix) with ESMTP
	id 1E3082F2891; Tue, 13 Apr 2004 13:52:03 -0700 (PDT)
From: David Sugar <dyfet@ostel.com>
To: bug-commoncpp@gnu.org
Date: Tue, 13 Apr 2004 16:53:37 -0400
User-Agent: KMail/1.6.2
References: <200404090402.34896.josh@chatgris.com>
	<200404100558.32236.dyfet@ostel.com>
	<200404131455.15148.dyfet@ostel.com>
In-Reply-To: <200404131455.15148.dyfet@ostel.com>
MIME-Version: 1.0
Content-Disposition: inline
Content-Type: Multipart/Mixed;
  boundary="Boundary-00=_RNFfACZyUmFCTyu"
Message-Id: <200404131653.37664.dyfet@ostel.com>
Cc: 
Subject: Changed string.cpp and string.h for testing
X-BeenThere: bug-commoncpp@gnu.org
X-Mailman-Version: 2.1.4
Precedence: list
List-Id: Bug reports for Common C++ <bug-commoncpp.gnu.org>
List-Unsubscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=unsubscribe>
List-Archive: <http://mail.gnu.org/pipermail/bug-commoncpp>
List-Post: <mailto:bug-commoncpp@gnu.org>
List-Help: <mailto:bug-commoncpp-request@gnu.org?subject=help>
List-Subscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 13 Apr 2004 20:55:53 -0000


--Boundary-00=_RNFfACZyUmFCTyu
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

They are attached...

--Boundary-00=_RNFfACZyUmFCTyu
Content-Type: text/x-c++src;
  charset="iso-8859-1";
  name="string.cpp"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="string.cpp"

// Copyright (C) 1999-2002 Open Source Telecom Corporation.
//  
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
// 
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software 
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// 
// As a special exception to the GNU General Public License, permission is 
// granted for additional uses of the text contained in its release 
// of Common C++.
// 
// The exception is that, if you link the Common C++ library with other files
// to produce an executable, this does not by itself cause the
// resulting executable to be covered by the GNU General Public License.
// Your use of that executable is in no way restricted on account of
// linking the Common C++ library code into it.
// 
// This exception does not however invalidate any other reasons why
// the executable file might be covered by the GNU General Public License.
// 
// This exception applies only to the code released under the 
// name Common C++.  If you copy code from other releases into a copy of
// Common C++, as the General Public License permits, the exception does
// not apply to the code that you add in this way.  To avoid misleading
// anyone as to the status of such modified files, you must delete
// this exception notice from them.
// 
// If you write modifications of your own for Common C++, it is your choice
// whether to permit this exception to apply to your modifications.
// If you do not wish that, delete this exception notice.


#include <cc++/config.h>
#include <cc++/export.h>
#include <cc++/thread.h>
#include <cc++/misc.h>
#include <cc++/strchar.h>
#include <cc++/string.h>
#include "private.h"

#include <cstdarg>
#include <cstdio>

#ifdef	CCXX_NAMESPACES
namespace ost {
using std::streambuf;
using std::ofstream;
using std::ostream;
using std::endl;
using std::ios;
#endif

static Mutex mutex;
MemPager *String::pager = NULL;
char **String::idx = NULL;

const unsigned String::minsize = ((sizeof(char *) + (sizeof(unsigned) * 2) + 1));
const unsigned String::slotsize = 32;
const unsigned String::pagesize = 1024;
const unsigned String::slotlimit = 512;
const unsigned String::slots = ((slotlimit / slotsize) + 1);
const unsigned String::npos = (unsigned)(-1);

String::String()
{
	init();
}

String::String(const String &original)
{
	init();
	copy(original);
}

String::String(unsigned count, const char chr)
{
	init();
	resize(count + 1);
	memset(getText(), chr, count);
	setLength(count);
}

#ifdef	HAVE_SNPRINTF
String::String(unsigned count, const char *format, ...)
{
        va_list args;
        va_start(args, format);

	init();
	resize(count);

        char *ptr = getText();
	vsnprintf(ptr, count, format, args);
        setLength(strlen(ptr));
	va_end(args);
}
#else
String::String(unsigned count, const char *str)
{
        init();
        resize(count);

        if(!str || !*str)
                return;

        set(str);
}
#endif

String::String(const char *str)
{
	init();
	set(str);
}

String::String(const String &str, unsigned start, unsigned count)
{
	init();
	char *ptr = str.getText();
	unsigned len = str.getLength();

	if(start >= len)
		return;

	ptr += start;
	len -= start;
	
	if(count >= len)
		count = len;

	set(ptr, count);
}

char String::at(int index) const
{
	if(index < 0)
		index = getLength() - index + 1;
	if(index > getLength() || index < 0)
		return 0;

	return (getText())[index];
}

void String::insert(unsigned start, const char *str, unsigned count)
{
	char *ptr = getText();
	unsigned len = getLength();
	unsigned size = getSize();

	if(!str)
		str = "";

	if(!count)
		count = strlen(str);

	if(!count || start > len)
		return;

	if(len + count >= size)
	{
		resize(len + count + 1);
		ptr = getText();
	}

	if(start == len)
	{
		memmove(ptr + start, str, count);
		len += count;
		setLength(len);
		ptr[len] = 0;
		return;
	}

	memmove(ptr + start + count, ptr + start, len - start);
	memmove(ptr + start, str, count);
	len += count;
	setLength(len);
	ptr[len] = 0;
	return;
}	


void String::insert(unsigned start, const String &s)
{
	insert(start, s.getText(), s.getLength());
}

void String::replace(unsigned start, unsigned len, const char *text, unsigned count)
{
	erase(start, len);
	insert(start, text, count);
}

void String::replace(unsigned start, unsigned len, const String &s)
{
	erase(start, len);
	insert(start, s);
}

void String::erase(unsigned start, unsigned count)
{
	unsigned len = getLength();
	char *ptr = getText();
		
	if(start >= len)
		return;

	if(start + count >= len || count == npos || !count)
	{
		setLength(start);
		ptr[start] = 0;
		return;
	}		

	memmove(ptr + start, ptr + start + count, len - start - count);
	len -= count;
	setLength(len);
	ptr[len] = 0;
}

void String::append(const char *str, unsigned offset, unsigned len)
{
	unsigned slen = getLength();
	char *ptr = getText();

	if(slen < offset)
	{
		append(str, len);
		return;
	}

	setLength(offset);
	ptr[offset] = 0;
	append(str, len);
}

void String::append(const char *str, unsigned len)
{
	if(!str)
		return;

	if(!len)
		len = strlen(str);

	if(!len)
		return;

	if(getLength() + len >= getSize())
		resize(getLength() + len + 1);
	memmove(getText() + getLength(), str, len);
	len += getLength();
	setLength(len);
	getText()[len] = 0;
	return;
}

void String::add(char c)
{
	unsigned len = getLength();
	char *ptr;

	if(len + 1 >= getSize())
		resize(len + 2);
	
	ptr = getText();
	ptr[len++] = c;
	setLength(len);
	ptr[len] = 0;
}

void String::trim(unsigned count)
{
	unsigned len = getLength();
	char *ptr = getText();

	if(count >= len)
		count = len;

	len -= count;
	ptr[len] = 0;
	setLength(len);
}

String String::token(const char *delim, unsigned offset)
{
        char *ptr = getText();
        unsigned len = getLength();
        unsigned count = 0;
        String result;
	bool found = false;

	if(offset >= len)
		return result;

	len -= offset;
	ptr += offset;
                                                                        
        while(count < len)
        {
                if(strchr(delim, ptr[count]))
		{
			found = true;
                        break;
		}
                ++count;
        }

	if(!count && found)
		erase(offset, 1);
                                                                        
        if(!count)
		return result;

        result.set(ptr, count);                                                                        
	if(found)
		++count;
        erase(offset, count);
	return result;
}

void String::strip(const char *chars)
{
	unsigned len = strtrim(chars, getText(), getLength());
	if(!len)
	{
		setLength(len);
		return;
	}
	setLength(strchop(chars, getText(), len));
}

#ifdef	HAVE_SNPRINTF
const char *String::set(unsigned size, const char *format, ...)
{
        va_list args;
        va_start(args, format);

	if(size <= minsize)
		clear();

	if(size > getSize())
		resize(size);

        char *ptr = getText();
	vsnprintf(ptr, size, format, args);
        setLength(strlen(ptr));
	va_end(args);
	return ptr;
}

void String::append(unsigned size, const char *format, ...)
{
        va_list args;
        va_start(args, format);
	unsigned len = getLength();

	if(len + size <= minsize)
		clear();

	if(len + size > getSize())
		resize(size + size);

        char *ptr = getText() + len;
	vsnprintf(ptr, size, format, args);
        setLength(strlen(getText()));
	va_end(args);
}

#endif
const char *String::set(const char *str, unsigned len)
{
	if(!str)
	{
		clear();
		return str;
	}

	if(!len)
		len = strlen(str);

	// if we are making a short string, lets clear prior alloc

	if(len < minsize)
		clear();

	if(len >= getSize())
		resize(len + 1);
	memmove(getText(), str, len);
	getText()[len] = 0;
	setLength(len);
	return str;
}

void String::set(const String &str)
{
	set(str.getText(), str.getLength());
}

void String::append(const String &str)
{
	append(str.getText(), str.getLength());
}


void String::copy(const String &original)
{
	clear();

	if(original.getLength() < minsize)
	{
		content.ministring.length = original.getLength();
		memmove(content.ministring.text, original.getText(), original.getLength() + 1);
		content.ministring.big = false;
		return;
	}

//	ptr = original.getText();
	content.bigstring.length = original.getLength();
	content.bigstring.size = setSize(original.getLength() + 1);
	content.bigstring.text = getSpace(content.bigstring.size);
	content.ministring.big = true;
	memmove(content.bigstring.text, original.getText(), original.getLength() + 1);
}

String::~String()
{
	clear();
}

void String::init(void)
{
	content.ministring.big = false;
	content.ministring.length = 0;
	content.ministring.text[0] = 0;
}

unsigned String::search(const char *text, unsigned clen, unsigned index) const
{
	unsigned len = getLength();
	 
	if(!text)
		text = "";

	if(!clen)
		clen = strlen(text);

	while(clen + index <= len)
	{
		if(compare(text, clen, index) == 0)
			return index;
		++index;
	}
	return npos;
}

unsigned String::find(const char *text, unsigned index, unsigned len, unsigned count) const
{
	unsigned pos;

	if(!text)
		text = "";

	if(!len)
		len = strlen(text);

	while(count--)
	{
		pos = search(text, len, index);
		if(pos == npos)
			break;
		index = pos + 1;
	}
	return pos;
}

unsigned String::rfind(const char *text, unsigned index, unsigned len) const
{
	unsigned result = npos;

        if(!text)
                text = "";

        if(!len)
                len = strlen(text);

	for(;;)
	{
		index = search(text, len, index);
		if(index == npos)
			break;
		result = index++;
	}
	return result;
}

unsigned String::count(const char *text, unsigned index, unsigned len) const
{
	unsigned count = 0;
	if(!text)
		text = "";

	if(!len)
		len = strlen(text);

	for(;;)
	{
		index = search(text, len, index);
		if(index == npos)
			break;
		++count;
		++index;
	}
	return count;
}

unsigned String::count(const String &str, unsigned index) const
{
	return count(str.getText(), index, str.getLength());
}

unsigned String::find(const String &str, unsigned index, unsigned count) const
{
	return find(str.getText(), index, str.getLength(), count);
}

unsigned String::rfind(const String &str, unsigned index) const
{
	return rfind(str.getText(), index, str.getLength());
}

int String::compare(const char *text, unsigned len, unsigned index) const
{
	if(!text)
		text = "";

	if(index > getLength())
		return -1;

	if(!len)
		return strcmp(getText() + index, text);

	return strncmp(getText() + index, text, len);
}

bool String::isEmpty(void) const
{
	char *ptr = getText();

	if(!ptr || !*ptr)
		return true;

	return false;
}

void String::resize(unsigned size)
{
	unsigned length = getLength();
	char *ptr;

	if(length >= size)
		length = size - 1;

	++length;

	if(!isBig() && size <= minsize)
		return;

	if(!isBig())
	{
		ptr = getSpace(size);
		memmove(ptr, content.ministring.text, length); 
		ptr[--length] = 0;
		content.ministring.big = true;
		content.bigstring.text = ptr;
		content.bigstring.length = length;
		setSize(size);
		return;
	}
	
	if(size <= minsize && getSize() > slotlimit)
	{
		ptr = getText();
		memmove(content.ministring.text, ptr, length);
		content.ministring.text[--length] = 0;
		content.ministring.big = false;
		content.ministring.length = length;
		delete[] ptr;
		return;
	}

	ptr = getSpace(size);
	memmove(ptr, getText(), length);
	ptr[--length] = 0;
	clear();
	setSize(size);
	content.bigstring.length = length;
	content.bigstring.text = ptr;
	content.ministring.big = true;
}

void String::clear(void)
{
	char **next;
	unsigned slot;

	if(!isBig())
		goto end;

	if(!content.bigstring.text)
		goto end; 

	if(getSize() > slotlimit)
	{
		delete[] content.bigstring.text;
		goto end;
	}

	slot = (getSize() - 1) / slotsize;
	next = (char **)content.bigstring.text;
	mutex.enterMutex();
	*next = idx[slot];
	idx[slot] = content.bigstring.text;
	setLength(0);
	content.bigstring.text = NULL;
	mutex.leaveMutex();	
	
end:
	init();
	return;
}	

char *String::getSpace(unsigned size)
{
	unsigned slot;
	char *text, **next;

	if(size > slotlimit)
		return new char[size];

	slot = size / slotsize;
	mutex.enterMutex();
	if(!pager)
	{
		pager = new MemPager(pagesize);
		idx = (char **)pager->alloc(sizeof(char *) * slots);
		memset(idx, 0, sizeof(char *) * slots);
	}
	text = idx[slot];
	if(text)
	{
		next = (char **)text;
		idx[slot] = *next;
	}
	else
		text = (char *)pager->alloc(++slot * slotsize);
	mutex.leaveMutex();
	return text;
}

const char *String::getIndex(unsigned index) const
{
	const char *dp = getText();

	if(index > getLength())
		return NULL;

	return (const char *)dp + index;
}
		
char *String::getText(void) const
{
	if(isBig())
		return (char *)content.bigstring.text;

	return (char *)content.ministring.text;
}

const unsigned String::getSize(void) const
{
	if(isBig())
		return content.bigstring.size;

	return minsize;
}

void String::setLength(unsigned len)
{
	if(isBig())
		content.bigstring.length = len;
	else
		content.ministring.length = len;
}

unsigned String::setSize(unsigned size)
{
	if(size <= minsize && !isBig())
		return minsize;

	if(size <= slotlimit)
	{
		size = size / slotsize;
		++size *= slotsize;
	}
	content.bigstring.size = size;
	return size;
}

const unsigned String::getLength(void) const
{
	if(isBig())
		return content.bigstring.length;

	return content.ministring.length;
}

String operator+(const String &s1, char c2)
{
	String result(s1);
	result.add(c2);
	return result;
}

String operator+(const String &s1, const String &s2)
{
	String result(s1);
	result.append(s2);
	return result;
}

String operator+(const String &s1, const char *s2)
{
	String result(s1);
	result += s2;
	return result;
}

String operator+(const char *s1, const String &s2)
{
	String result(s1);
	result += s2;
	return result;
}

String operator+(char c1, const String &s2)
{
	String result(1, c1);
	result += s2;
	return result;
}

bool String::operator<(const String &s1) const
{
        if(compare(s1.getText()) < 0)
                return true;

        return false;
}

bool String::operator<(const char *s1) const
{
        if(compare(s1) < 0)
                return true;

        return false;
}

bool String::operator>(const String &s1) const
{
        if(compare(s1.getText()) > 0)
                return true;

        return false;
}

bool String::operator>(const char *s1) const
{
        if(compare(s1) > 0)
                return true;

        return false;
}

bool String::operator<=(const String &s1) const
{
	if(compare(s1.getText()) <= 0)
		return true;

	return false;
}

bool String::operator<=(const char *s1) const
{
        if(compare(s1) <= 0)
                return true;

        return false;
}

bool String::operator>=(const String &s1) const
{
        if(compare(s1.getText()) >= 0)
                return true;

        return false;
}

bool String::operator>=(const char *s1) const
{
        if(compare(s1) >= 0)
                return true;

        return false;
}

bool String::operator==(const String &s1) const
{
        if(compare(s1.getText()) == 0)
                return true;

        return false;
}

bool String::operator==(const char *s1) const
{
        if(compare(s1) == 0)
                return true;

        return false;
}

bool String::operator!=(const String &s1) const
{
        if(compare(s1.getText()) != 0)
                return true;

        return false;
}

bool String::operator!=(const char *s1) const
{
        if(compare(s1) != 0)
                return true;

        return false;
}

bool String::operator*=(const String &s1) const
{
	return search(s1.getText(), s1.getLength()) != npos;
}

bool String::operator*=(const char *s) const
{
	return search(s) != npos;
}

std::ostream &operator<<(std::ostream &os, const String &str)
{
	os << str.getText();
	return os;
}

std::istream &getline(std::istream &is, String &str, char delim, unsigned len)
{
	if(!len)
		len = str.getSize() - 1;

	if(len >= str.getSize())
		str.resize(len + 1);

	char *ptr = str.getText();
	is.getline(ptr, len, delim);
	str.setLength(strlen(ptr));
	return is;
}

SString::SString() :
String(), streambuf()
#ifdef  HAVE_OLD_IOSTREAM
,ostream()
#else
,ostream((streambuf *)this)
#endif
{
#ifdef  HAVE_OLD_IOSTREAM
        ostream::init((streambuf *)this);
#endif
}

SString::SString(const SString &from) :
String(from), streambuf()
#ifdef  HAVE_OLD_IOSTREAM
,ostream()
#else
,ostream((streambuf *)this)
#endif
{
#ifdef  HAVE_OLD_IOSTREAM
        ostream::init((streambuf *)this);
#endif
}

SString::~SString()
{
	if(isBig())
		String::clear();
}

int SString::overflow(int c)
{
	String::add((char)(c));
	return c;
}

#ifdef	HAVE_SNPRINTF
int strprintf(String &str, unsigned size, const char *format, ...)
{
	va_list args;
	va_start(args, format);
	int rtn;

	if(!size)
		size = str.getSize();

	if(size > str.getSize())
		str.resize(size);

	char *ptr = str.getText();
	str.setLength(0);
	ptr[0] = 0;
	rtn = vsnprintf(ptr, size, format, args);
	str.setLength(strlen(ptr));
	va_end(args);
	return rtn;
}
#endif

#ifdef	CCXX_NAMESPACES
};	
#endif

/** EMACS **
 * Local variables:
 * mode: c++
 * c-basic-offset: 8
 * End:
 */

--Boundary-00=_RNFfACZyUmFCTyu
Content-Type: text/x-chdr;
  charset="iso-8859-1";
  name="string.h"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="string.h"

// Copyright (C) 1999-2001 Open Source Telecom Corporation.
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
// 
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
// 
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// 
// As a special exception to the GNU General Public License, permission is 
// granted for additional uses of the text contained in its release 
// of Common C++.
// 
// The exception is that, if you link the Common C++ library with other
// files to produce an executable, this does not by itself cause the
// resulting executable to be covered by the GNU General Public License.
// Your use of that executable is in no way restricted on account of
// linking the Common C++ library code into it.
//
// This exception does not however invalidate any other reasons why
// the executable file might be covered by the GNU General Public License.
// 
// This exception applies only to the code released under the 
// name Common C++.  If you copy code from other releases into a copy of
// Common C++, as the General Public License permits, the exception does
// not apply to the code that you add in this way.  To avoid misleading
// anyone as to the status of such modified files, you must delete
// this exception notice from them.
// 
// If you write modifications of your own for Common C++, it is your choice
// whether to permit this exception to apply to your modifications.
// If you do not wish that, delete this exception notice.

/**
 * @file string.h
 * @short Common C++ generic string class
 **/

#ifndef	CCXX_STRING_H_
#define	CCXX_STRING_H_

#ifndef	CCXX_MISSING_H_
#include <cc++/missing.h>
#endif

#ifndef CCXX_STRCHAR_H_
#include <cc++/strchar.h>
#endif

#ifdef	CCXX_NAMESPACES
namespace ost {
#endif

/**
 * This is a generic and portable string class.  It uses optimized
 * memory allocation strategies to efficiently handle smaller string
 * content by grouping strings into 32 byte aligned slots that can
 * be re-allocated from a free list directly.
 *
 * While meant to cover the basic functionality of the ANSI C++
 * string class in form and function, this class offers some important
 * enhancements, including the ability to derive class type specific
 * versions of itself.  The latter might be used to derive a unicode
 * string, a string for data and time data types, or to add case
 * insensitive comparisons, for example.
 *
 * @author David Sugar <dyfet@ostel.com>
 * @short Generic string class.
 */
class __EXPORT String
{
protected:
	static const unsigned minsize;
	static const unsigned slotsize;
	static const unsigned pagesize;
	static const unsigned slotlimit;
	static const unsigned slots;

private:
	friend class MemPager;

	static MemPager *pager;
	static char **idx;

#pragma	pack(1)
	union
	{
		struct
		{
			char *text;
			unsigned size;
			unsigned length;
		}	bigstring;
		struct
		{
			char text[(sizeof(char *) + (sizeof(unsigned) * 2) + 1)];
			char length : 6;
			bool big : 1;
		}	ministring;
	}	content;
#pragma	pack()

protected:
	/**
	 * Determine if string is allocated in local variable or an
	 * external reference.
	 *
	 * @return true if external heap is used.
	 */
	inline bool isBig(void) const
		{return content.ministring.big;};

	/**
	 * Set the content of the string variable to the specified
	 * string value, and use smart re-allocation strategies if
	 * appropriate to shrink the size of the variable.	
	 *
	 * @param string to set.
	 * @param length of string if passed.
	 */
	const char *set(const char *str, unsigned len = 0);

	/**
	 * Set the content of the string variable to that of another
	 * variable.  Uses the string set method.
	 *
	 * @param string to copy from.
	 */
	void set(const String &str);

#ifdef	HAVE_SNPRINTF
	/**
	 * Set the content of the string variable to that of a
	 * formatted printf style string.
	 *
	 * @param string to copy from.
	 */
	const char *set(unsigned size, const char *format, ...);
#endif

	/**
	 * Impliment the copy constructor, used internally.  Will always
	 * create a minimum sized string allocation.
	 *
	 * @param string to copy from.
	 */
	void copy(const String &str);

	/**
	 * Used to initialize a string object.
	 */
	void init(void);

	/**
	 * Used to fetch memory, if needed, based on the size, from the
	 * pager, or the system heap.
	 *
	 * @return string pointer to space.
	 * @param size of space needed.
	 */
	char *getSpace(unsigned size);

	/**
	 * Set the size of allocated space in the string variable
	 * (capacity) to a known value.  The value is recomputed and
	 * adjusted based on allocation method.
	 *
	 * @param size in bytes.
	 */
	unsigned setSize(unsigned size);

	/**
	 * Set the length value of the string content.
	 *
	 * @param size in bytes.
	 */
	void setLength(unsigned len);

	/**
	 * A derivable low level comparison operator.  This can be used
	 * to create custom comparison data types in derived string
	 * classes.
	 *
	 * @return 0 if match, or value for ordering.
	 * @param text to compare.
	 * @param length of text to compare.
	 * @param offset from start of string, used in searchs.
	 */
	virtual int compare(const char *text, unsigned len = 0, unsigned index = 0) const;

	/**
	 * An internal method used to search for a substring starting at 
	 * a known offset.  Used by find and count methods.
	 *
	 * @return npos if fails, or offset to text found.
	 * @param text to search for.
	 * @param length of search text.
	 * @param offset to start from.
	 */
	unsigned search(const char *text, unsigned clen = 0, unsigned offset = 0) const;

public:
	static const unsigned npos;

	typedef unsigned size_type;

	/**
	 * Construct an empty string.
	 */
	String();

	/**
	 * Copy constructor.
	 *
	 * @param string to copy from.
	 */
	String(const String &original);

	/**
	 * Create a string from a cstring.
	 *
	 * @param text to set with.
	 */
	String(const char *str);

	/**
	 * Create a new string from a subset of another string.	
	 *
	 * @param prior string.	
	 * @param offset to start of data in prior string.
	 * @param length of our substring.
	 */
	String(const String &str, unsigned offset, unsigned len = npos);

#ifdef	HAVE_SNPRINTF
	/**
	 * Create a string from formatted text input.
	 *
	 * @param size to allocate for our new string.
	 * @param snprintf format.
	 * @param data to input.
	 */
	String(unsigned count, const char *fmt, ...);
#else
        /**
         * Create a string of a known size, and optionally fill with
         * content.
         *
         * @param size to allocate for our new string.
         * @param content to put into it.
         */
        String(unsigned count, const char *str);
#endif

	/**
	 * Fill a new string with character data.
	 *
	 * @param size of new string.
	 * @param char to fill string with.
	 */
	String(unsigned count, char fill = ' ');

	/**
	 * Destroy the string...
	 */
	virtual ~String();

	/**
	 * Get a string pointer to string content based on an indexed
	 * offset.  A NULL is returned if the index is outsize of range.
	 *
	 * @return string content or NULL if invalid index.
	 * @param index
	 */
	const char *getIndex(unsigned index) const;

	/**
	 * Get the text of a string.
	 *
	 * @return string content.
	 */
	char *getText(void) const;

	/**
	 * Get the assigned length of string.
	 *
	 * @return string length.
	 */
	const unsigned getLength(void) const;

	/**
	 * Get the allocation size of the string variable.
	 *
	 * @return allocation size.
	 */
	const unsigned getSize(void) const;

	/**
	 * Return true if string is empty.
	 *
	 * @return true if string is empty string.
	 */
	bool isEmpty(void) const;

	/**
	 * Re-allocate buffer space for string.
	 *
	 * @param new size to use.
	 */
	void resize(unsigned size);

	/**
	 * Clear the contents of the entire string.
	 */
	void clear(void);

	/**
	 * Return a character at a known offset.
	 *
	 * @return character at offset.
	 */
	char at(int offset) const;

	/**
	 * Count the number of occurences of a specific string within
	 * our string.
	 *
	 * @return count of instances.
	 * @param string to test.
	 * @param offset to start from.
	 */
	unsigned count(const String &s, unsigned offset = 0) const;

	/**
	 * Count the number of occurrences of a specific text pattern
	 * within our string.
	 *
	 * @return count of instances.
	 * @param offset to start from.	
 	 * @param length of text pattern if specified.
	 */
	unsigned count(const char *s, unsigned offset = 0, unsigned len = 0) const;

	/**
	 * Extract a new string as a token from the current string.
	 *
	 * @return string containing token.
	 * @param offset to start from.
	 * @param deliminator characters.
	 */
	String token(const char *delim = " \t\n\r", unsigned offset = 0);

	/**
	 * Find the index to the nth instance of a substring in our string.
	 *
	 * @return index of found substring.
	 * @param string to search for.
	 * @param offset to start at.
	 * @param instance to look for.
	 */
	unsigned find(const String &s, unsigned offset = 0, unsigned instance = 1) const;

	/**
	 * Find last occurence of a substring in our string.
	 *
	 * @return index of last instance found,
	 * @param string to search for.
	 * @param offset to start from.
	 */
	unsigned rfind(const String &s, unsigned offset = 0) const;

        /**
         * Find the index to the nth instance of text in our string.
         *
         * @return index of found substring.
         * @param string to search for.
         * @param offset to start at.
	 * @param size of string text.
         * @param instance to look for.
         */
	unsigned find(const char *s, unsigned offset = 0, unsigned len = 0, unsigned count = 1) const;

       /**
         * Find last occurence of a text in our string.
         *
         * @return index of last instance found,
         * @param string to search for.
         * @param offset to start from.
	 * @param size of string to look for.
	 */
	unsigned rfind(const char *s, unsigned offset = 0, unsigned len = 0) const;

	/**
	 * Trim trailing characters from a string.
	 *
	 * @param list of chars to trim.
	 */
	inline void trim(const char *cs)
		{setLength(strtrim(cs, getText(), getLength()));};

        /**
         * Chop leading characters from a string.
         *
         * @param list of chars to chop.
         */
        inline void chop(const char *cs)
                {setLength(strchop(cs, getText(), getLength()));};

	/**
	 * Strip lead and trailing characters from a string.
	 *
	 * @param list of chars to strip.
	 */
	void strip(const char *cs);

	/**
	 * Chop n leading characters from a string.
	 *
	 * @param count to chop.
	 */
	inline void chop(unsigned count)
		{erase(0, count);};

	/**
	 * Trim n trailing characters from a string.
	 *
	 * @param count to trim.
	 */
	void trim(unsigned count);

	/**
	 * Erase a portion of string.
	 *
	 * @param starting index to erase from.
	 * @param number of characters to erase.
	 */
	void erase(unsigned start, unsigned len = npos);

	/**
	 * Insert text into a string.
	 *
	 * @param starting offset to insert at.
	 * @param text to insert.
	 * @param size of text to insert.
	 */
	void insert(unsigned start, const char *text, unsigned len = 0);

	/**
	 * Insert other string into our string.
	 *
	 * @param string offset to insert at.
	 * @param string to insert.
	 */
	void insert(unsigned start, const String &str);

	/**
	 * Replace text at a specific position in the string with new
	 * text.
	 *
	 * @param starting offset to replace at.
	 * @param length of text to remove.
	 * @param text to replace with.
	 * @param size of replacement text.
	 */
	void replace(unsigned start, unsigned len, const char *text, unsigned count = 0);

        /**
         * Replace text at a specific position in the string with new
         * string,
         *
         * @param starting offset to replace at.
         * @param length of text to remove.
         * @param string to replace with.
         */
	void replace(unsigned start, unsigned len, const String &s);

	/**
	 * A more convenient version of find for nth occurences, by
	 * putting the instance first.
	 *
	 * @param nth instance to look for.
	 * @param text to look for.
	 * @param offset to start at.
	 * @param length of text.
	 */
	inline unsigned find(unsigned instance, const char *text, unsigned offset = 0, unsigned len = 0) const
		{return find(text, offset, len, instance);};

        /**
         * A more convenient version of find for nth occurences, by
         * putting the instance first.
         *
         * @param nth instance to look for.
         * @param string to look for.
         * @param offset to start at.
         */
	inline unsigned find(unsigned instance, const String &s, unsigned offset = 0) const
		{return find(s, offset, instance);};

	/**
	 * Return a new string that contains a specific substring of the
	 * current string.
	 *
	 * @return new string.
	 * @param starting offset for extracted substring.	
	 * @param length of substring.
	 */
	inline String substr(unsigned start, unsigned len) const
		{return String(*this, start, len);};

	/**
	 * Return an indexed string based on the index, such as from a
	 * find.  If out of range, a NULL string is returned.
	 *
	 * @return pointer to string data from our string,
	 * @param index or offset to use.
	 */
	inline const char *(index)(unsigned idx) const
		{return getIndex(idx);};

	/**
	 * Reduce the size of the string allocation to the minimum
	 * needed based on the current effective length.
	 */
	inline void compact(void)
		{resize(getLength() + 1);};

	/**
	 * Old ANSI C++ compatible string pointer extraction.
	 *
	 * @return string data.
	 */
	inline char *c_str(void) const
		{return getText();};

	/**
	 * Get our string data through dereference operator.
	 *
	 * @return string data.
	 */
	inline operator char *() const
		{return getText();};

	/**
	 * Logical test for string empty.
	 *
	 * @return true if is empty.
	 */
	inline bool operator!(void) const
		{return isEmpty();};

	/**
	 * Alternate get text method.
	 *
	 * @return string data.
	 */
	inline char *text(void) const
		{return getText();};

	/**
	 * Alternate get text method.
	 *
	 * @return string data.
	 */
	inline char *data(void) const
		{return getText();};

	/**
	 * Get length as if null terminated string.
	 *
	 * @return cstring length.
	 */
	inline unsigned length(void) const
		{return strlen(getText());};

	/**
	 * Get actual length of string data.
	 *
	 * @return actual size of string.
	 */
	inline unsigned size(void) const
		{return getLength();};

	/**
	 * Get space allocated to hold current string.
	 *
	 * @return space of memory buffer from heap or local.
	 */
	inline unsigned capacity(void) const
		{return getSize();};

	/**
	 * Return true if string is empty.
	 */
	bool empty(void) const
		{return isEmpty();};

	/**
	 * Append text to the end of the current string.
	 *
	 * @param text to append.
	 * @param size of text to append.
	 */
	void append(const char *str, unsigned count = 0);

#ifdef	HAVE_SNPRINTF
	/**
	 * Append formatted text to the end of the current string.
	 *
	 * @param text to append.
	 * @param size of text to append.
	 */
	void append(unsigned size, const char *format, ...);
#endif

        /**
         * Append text into the current string.
         *
         * @param text to append.
	 * @param offset to overlay.
         * @param size of text to append.
         */
        void append(const char *str, unsigned offset, unsigned count);

	/**
	 * Add a character to the end of a string.
	 *
	 * @param char to add.
	 */
	void add(char c);

	/**
	 * Append string to the end of the current string.
	 *
	 * @param string to append.
	 */
	void append(const String &str);

	/**
	 * Extract a character by array indexing.
	 *
	 * @return character code.
	 */
	inline const char operator[](unsigned index) const
		{return at(index);};

	/**
	 * Assign our string from another string.
	 */
	inline void operator =(const String& str)
		{set(str);};

	/**
	 * Assign our string for c string.
	 */
	inline const char *operator =(const char *str)
		{return set(str);};

	/**
	 * Add two strings and return a temporary object.
	 */
	friend __EXPORT String operator+(const String &s1, const String &s2);

	friend __EXPORT String operator+(const String &s1, const char *s2);

	friend __EXPORT String operator+(const char *s1, const String &s2);

	friend __EXPORT String operator+(const String &s1, const char c2);
	
	friend __EXPORT String operator+(const char c1, const String &s2);

	/**
	 * Append operator.
	 */
	inline String &operator+=(const String &str)
		{append(str); return *this;};

	/**
	 * Append operator.
	 */
	inline String &operator+=(char c)
		{add(c); return *this;};

	/**
	 * Append operator.
	 */
	inline String &operator+=(const char *str)
		{append(str); return *this;};

	/**
	 * Fetch input from a std::istream into the current string 
	 * variable until either the string variable is filled (based on
	 * current length) or the deliminator is read.
	 *
	 * @param stream to read.
	 * @param string to save into.
	 * @param deliminator to use.
	 * @param optional size limitor.
	 */
	friend __EXPORT std::istream &getline(std::istream &is, String &str, char delim = '\n', unsigned size = 0);

	/**
	 * Stream the content of our string variable directly to a C++
	 * streaming source.
	 */
	friend __EXPORT std::ostream &operator<<(std::ostream &os, const String &str);

	/**
	 * Stream input into our variable.
	 */
	inline friend std::istream &operator>>(std::istream &is, String &str)
		{return getline(is, str);};

#ifdef	HAVE_SNPRINTF
	/**
	 * Print values directly into a string variable.
	 *
	 * @return character count.
	 * @param string to use.
	 * @param size of string required.
	 * @param format of data
	 */
	friend __EXPORT int strprintf(String &str, unsigned size, const char *fmt, ...);
#endif

        bool operator<(const String &str) const;
        bool operator<(const char *str) const;
	bool operator>(const String &str) const;
	bool operator>(const char *str) const;
        bool operator<=(const String &str) const;
        bool operator<=(const char *str) const;
        bool operator>=(const String &str) const;
        bool operator>=(const char *str) const;
        bool operator==(const String &str) const;
        bool operator==(const char *str) const;
        bool operator!=(const String &str) const;
        bool operator!=(const char *str) const;

#ifdef	HAVE_SNPRINTF

        /**
         * Append operator
         */
        inline String &operator+=(int i)
                {append(16, "%d", i); return *this;};

        inline String &operator+=(unsigned int i)
                {append(16, "%u", i); return *this;};

        inline String &operator+=(long l)
                {append(16, "%l", l); return *this;};

        inline String &operator+=(unsigned long l)
                {append(16, "%ul", l); return *this;};

        inline String &operator+=(float f)
                {append(32, "%f", f); return *this;};

        inline String &operator+=(double d)
                {append(32, "%f", d); return *this;};

        inline String &operator+=(short s)
                {append(8, "%hd", s); return *this;};

        inline String &operator+=(unsigned short s)
                {append(8, "%hu", s); return *this;};


        /**
         * Assignment operator.
         */
        inline String &operator=(int i)
                {set(16, "%d", i); return *this;};

        inline String &operator=(unsigned int i)
                {set(16, "%u", i); return *this;};

        inline String &operator=(long l)
                {set(16, "%l", l); return *this;};

        inline String &operator=(unsigned long l)
                {set(16, "%ul", l); return *this;};

        inline String &operator=(float f)
                {set(32, "%f", f); return *this;};

        inline String &operator=(double d)
                {set(32, "%f", d); return *this;};

        inline String &operator=(short s)
                {set(8, "%hd", s); return *this;};

        inline String &operator=(unsigned short s)
                {set(8, "%hu", s); return *this;};

	inline String &operator=(String &original)
		{copy(original); return *this;};

#endif

	/**
	 * Test if string is contained in our string.
	 */
	bool operator*=(const String &str) const;

	/**
	 * Test if text is contained in our string.
	 */
	bool operator*=(const char *str) const;
};

class __EXPORT SString : public String, protected std::streambuf, public std::ostream
{
protected:
        /**
         * This is the streambuf function that actually outputs the data
         * to the string.  Since all output should be done with the standard
         * ostream operators, this function should never be called directly.
         */
	int overflow(int c);

public:
	/**
	 * Create an empty streamable string ready for input.
	 */
	SString();

	/**
	 * Copy constructor
	 */
	SString(const SString &from);

	/**
	 * Cancel out the object.
	 */
	~SString();
};

#ifdef	CCXX_NAMESPACES
};
#endif

#endif

--Boundary-00=_RNFfACZyUmFCTyu--



From MAILER-DAEMON Tue Apr 13 16:57:40 2004
Received: from list by monty-python.gnu.org with archive (Exim 4.30)
	id 1BDUyR-0006Hy-Ni
	for mharc-bug-commoncpp@gnu.org; Tue, 13 Apr 2004 16:57:39 -0400
Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30)
	id 1BDUyO-0006Go-Vz
	for bug-commoncpp@gnu.org; Tue, 13 Apr 2004 16:57:36 -0400
Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30)
	id 1BDUt5-00042T-U3
	for bug-commoncpp@gnu.org; Tue, 13 Apr 2004 16:52:40 -0400
Received: from [216.218.222.122] (helo=mail.ostel.com)
	by monty-python.gnu.org with esmtp (Exim 4.30) id 1BDUsc-0003VJ-Gb
	for bug-commoncpp@gnu.org; Tue, 13 Apr 2004 16:51:38 -0400
Received: by mail.ostel.com (Postfix, from userid 1005)
	id D03732F2867; Tue, 13 Apr 2004 13:52:33 -0700 (PDT)
Received: from [192.168.1.102] (pool-138-89-66-19.mad.east.verizon.net
	[138.89.66.19]) by mail.ostel.com (Postfix) with ESMTP
	id 9B90D2F2883; Tue, 13 Apr 2004 13:52:01 -0700 (PDT)
From: David Sugar <dyfet@ostel.com>
To: bug-commoncpp@gnu.org
Date: Tue, 13 Apr 2004 16:47:42 -0400
User-Agent: KMail/1.6.2
References: <200404090402.34896.josh@chatgris.com>
	<200404091700.17737.josh@chatgris.com>
	<200404100558.32236.dyfet@ostel.com>
In-Reply-To: <200404100558.32236.dyfet@ostel.com>
MIME-Version: 1.0
Content-Disposition: inline
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Message-Id: <200404131647.42086.dyfet@ostel.com>
Cc: 
Subject: Re: Segmentation fault//memcpy fixed
X-BeenThere: bug-commoncpp@gnu.org
X-Mailman-Version: 2.1.4
Precedence: list
List-Id: Bug reports for Common C++ <bug-commoncpp.gnu.org>
List-Unsubscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=unsubscribe>
List-Archive: <http://mail.gnu.org/pipermail/bug-commoncpp>
List-Post: <mailto:bug-commoncpp@gnu.org>
List-Help: <mailto:bug-commoncpp-request@gnu.org?subject=help>
List-Subscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 13 Apr 2004 20:57:37 -0000

The last problem I found was that in "clear", when computing the slot (list 
number) to assign a newly freed buffer, it was computing slotsize in the 
object, which was aligned to the slot size, by the size of a slot, which 
always offset the item into the wrong list.  Hence, in clear:

	slot = getSize() / slotsize;

must become:

	slot = (getSize() - 1) / slotsize;

On Saturday 10 April 2004 05:58 am, David Sugar wrote:
> My first thought is that most of these operations depend on getLength
> returning the correct string length (in effect strlen() + 1 null byte).
> However, the String class actually stores a length field, which is what
> getLength() actually returns, and maybe that length field is not being kept
> in sync with the actual string length in some circumstances!  It would be
> interesting to compare the length returned by getLength with the length
> returned by strlen() in front of each of these memmove's...
>
> On Friday 09 April 2004 05:00 pm, you wrote:
> > In addition, none of these problems occur with commoncpp2 1.0.13 only in
> > 1.1.2.
> >
> > Joshua Moore-Oliva.
> >
> > On April 8, 2004 9:19 pm, David Sugar wrote:
> > > So what you did is basically replace every memcpy with a memmove?
> > > Hmm...in at least some cases, memcpy may be inline'd with assembler
> > > code. Perhaps there is something odd in the inline code substitution? 
> > > Also, your patch got a little chopped up in the debugging text...
> > >
> > > David
> > >
> > > On Friday 09 April 2004 04:02 am, Joshua Moore-Oliva wrote:
> > > > I created a program with quite a few options, and I got a
> > > > segmentation fault that appears to be a mis-use of memcpy.
> > > >
> > > > Included is a test program to reproduce the problem and some
> > > > debugging output.
> > > >
> > > > I was able to remove the problems with memcpy with the changes in the
> > > > included patch, however I am not familiar enough with the code to
> > > > determine why the getSpace function in the String library is going
> > > > out of bounds...
> > > >
> > > > debugging output before patch
> > > >
> > > > ==17692== Source and destination overlap in memcpy(0x41E1A83C,
> > > > 0x41E1A87C, 86) ==17692==    at 0x40022224: memcpy (in
> > > > /usr/lib/valgrind/vgskin_memcheck.so) ==17692==    by 0x40277A94:
> > > > ost::String::set(char const*, unsigned) (in
> > > > /usr/lib/libccgnu2-1.1.so.0.0.2) ==17692==    by 0x40277B07:
> > > > ost::String::set(ost::String const&) (in
> > > > /usr/lib/libccgnu2-1.1.so.0.0.2) ==17692==    by 0x402B16C1:
> > > > ost::String::operator=(ost::String const&) (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x402B7B10:
> > > > ost::CommandOptionParse_impl::makePrintErrors() (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x402B6CAC:
> > > > ost::CommandOptionParse_impl::printErrors() (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x8048BD8: main (in
> > > > /home/chatgris/a.out)
> > > > ==17692==
> > > > ==17692== Source and destination overlap in memcpy(0x41E1A87C,
> > > > 0x41E1A83C, 87) ==17692==    at 0x40022224: memcpy (in
> > > > /usr/lib/valgrind/vgskin_memcheck.so) ==17692==    by 0x40277C75:
> > > > ost::String::copy(ost::String const&) (in
> > > > /usr/lib/libccgnu2-1.1.so.0.0.2) ==17692==    by 0x4027647B:
> > > > ost::String::String(ost::String const&) (in
> > > > /usr/lib/libccgnu2-1.1.so.0.0.2) ==17692==    by 0x4027887C:
> > > > ost::operator+(ost::String const&, char const*) (in
> > > > /usr/lib/libccgnu2-1.1.so.0.0.2) ==17692==    by 0x402B7B83:
> > > > ost::CommandOptionParse_impl::makePrintErrors() (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x402B6CAC:
> > > > ost::CommandOptionParse_impl::printErrors() (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x8048BD8: main (in
> > > > /home/chatgris/a.out)
> > > > ==17692==
> > > > ==17692== Source and destination overlap in memcpy(0x41E1AC68,
> > > > 0x41E1ABA8, 215) ==17692==    at 0x40022224: memcpy (in
> > > > /usr/lib/valgrind/vgskin_memcheck.so) ==17692==    by 0x40278310:
> > > > ost::String::resize(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > > > ==17692==    by 0x40277A71: ost::String::set(char const*, unsigned)
> > > > (in /usr/lib/libccgnu2-1.1.so.0.0.2) ==17692==    by 0x40277B07:
> > > > ost::String::set(ost::String const&) (in
> > > > /usr/lib/libccgnu2-1.1.so.0.0.2) ==17692==    by 0x402B16C1:
> > > > ost::String::operator=(ost::String const&) (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x402B7DD5:
> > > > ost::CommandOptionParse_impl::makePrintErrors() (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x402B6CAC:
> > > > ost::CommandOptionParse_impl::printErrors() (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x8048BD8: main (in
> > > > /home/chatgris/a.out)
> > > > Value required for option '--connection_string' is missing
> > > > Value==17692==
> > > > ==17692== Source and destination overlap in memcpy(0x41E1A7BC,
> > > > 0x41E1A7DC, 41) ==17692==    at 0x40022224: memcpy (in
> > > > /usr/lib/valgrind/vgskin_memcheck.so) ==17692==    by 0x40277C75:
> > > > ost::String::copy(ost::String const&) (in
> > > > /usr/lib/libccgnu2-1.1.so.0.0.2) ==17692==    by 0x4027647B:
> > > > ost::String::String(ost::String const&) (in
> > > > /usr/lib/libccgnu2-1.1.so.0.0.2) ==17692==    by 0x402787B2:
> > > > ost::operator+(ost::String const&, char) (in
> > > > /usr/lib/libccgnu2-1.1.so.0.0.2) ==17692==    by 0x402B8015:
> > > > ost::CommandOptionParse_impl::makePrintUsage() (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x402B6C7A:
> > > > ost::CommandOptionParse_impl::printUsage() (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x8048BFA: main (in
> > > > /home/chatgris/a.out)
> > > > ==17692==
> > > > ==17692== Invalid read of size 4
> > > > ==17692==    at 0x40278576: ost::String::getSpace(unsigned) (in
> > > > /usr/lib/libccgnu2-1.1.so.0.0.2) ==17692==    by 0x402781F6:
> > > > ost::String::resize(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > > > ==17692==    by 0x40277A71: ost::String::set(char const*, unsigned)
> > > > (in /usr/lib/libccgnu2-1.1.so.0.0.2) ==17692==    by 0x40277B07:
> > > > ost::String::set(ost::String const&) (in
> > > > /usr/lib/libccgnu2-1.1.so.0.0.2) ==17692==    by 0x402B16C1:
> > > > oValue==26722== Invalid read of size 4 ==26722==    at 0x40278576:
> > > > ost::String::getSpace(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > > > ==26722==    by 0x402781F6:
> > > > ost::String::resize(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > > > ==26722==    by 0x40277A71: ost::String::set(char const*, unsigned)
> > > > (in /usr/lib/libccgnu2-1.1.so.0.0.2) ==26722==    by 0x40277B07:
> > > > ost::String::set(ost::String const&) (in
> > > > /usr/lib/libccgnu2-1.1.so.0.0.2) ==26722==    by 0x402B16C1:
> > > > ost::String::operator=(ost::String const&) (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x402B802A:
> > > > ost::CommandOptionParse_impl::makePrintUsage() (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x402B6C7A:
> > > > ost::CommandOptionParse_impl::printUsage() (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x8048BFA: main
> > > > (main.cpp:69)
> > > > ==26722==  Address 0x20202020 is not stack'd, malloc'd or free'd
> > > > ==26722==
> > > > ==26722== Process terminating with default action of signal 11
> > > > (SIGSEGV): dumping core ==26722==  Address not mapped to object at
> > > > address 0x20202020 ==26722==    at 0x40278576:
> > > > ost::String::getSpace(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > > > ==26722==    by 0x402781F6:
> > > > ost::String::resize(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > > > ==26722==    by 0x40277A71: ost::String::set(char const*, unsigned)
> > > > (in /usr/lib/libccgnu2-1.1.so.0.0.2) ==26722==    by 0x40277B07:
> > > > ost::String::set(ost::String const&) (in
> > > > /usr/lib/libccgnu2-1.1.so.0.0.2) ==26722==    by 0x402B16C1:
> > > > ost::String::operator=(ost::String const&) (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x402B802A:
> > > > ost::CommandOptionParse_impl::makePrintUsage() (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x402B6C7A:
> > > > ost::CommandOptionParse_impl::printUsage() (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x8048BFA: main
> > > > (main.cpp:69)st::String::operator=(ost::String const&) (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x402B802A:
> > > > ost::CommandOptionParse_impl::makePrintUsage() (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x402B6C7A:
> > > > ost::CommandOptionParse_impl::printUsage() (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x8048BFA: main (in
> > > > /home/chatgris/a.out)
> > > > ==17692==  Address 0x20202020 is not stack'd, malloc'd or free'd
> > > > ==17692==
> > > > ==17692== Process terminating with default action of signal 11
> > > > (SIGSEGV): dumping core ==17692==  Address not mapped to object at
> > > > address 0x20202020 ==17692==    at 0x40278576:
> > > > ost::String::getSpace(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > > > ==17692==    by 0x402781F6:
> > > > ost::String::resize(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > > > ==17692==    by 0x40277A71: ost::String::set(char const*, unsigned)
> > > > (in /usr/lib/libccgnu2-1.1.so.0.0.2) ==17692==    by 0x40277B07:
> > > > ost::String::set(ost::String const&) (in
> > > > /usr/lib/libccgnu2-1.1.so.0.0.2) ==17692==    by 0x402B16C1:
> > > > ost::String::operator=(ost::String const&) (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x402B802A:
> > > > ost::CommandOptionParse_impl::makePrintUsage() (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x402B6C7A:
> > > > ost::CommandOptionParse_impl::printUsage() (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==17692==    by 0x8048BFA: main (in
> > > > /home/chatgris/a.out)
> > > >
> > > >
> > > > test case
> > > >
> > > > #include <iostream>
> > > > #include <cc++/common.h>
> > > >
> > > > ost::CommandOptionArg optConnInfo (
> > > >   "connection_string", "c", "Connection String.", true
> > > > );
> > > >
> > > > ost::CommandOptionArg optMergeDelimiterField (
> > > >   "field_delimiter", "f", "Field delimiter for merge information",
> > > > true );
> > > >
> > > > ost::CommandOptionArg optMergeDelimiterRecord (
> > > >   "record_delimiter", "r", "Record delimiter for merge information",
> > > > true );
> > > >
> > > > ost::CommandOptionArg optMergeNames (
> > > >   "merge_names", "n", "Merge Field Names (tab delimited)", true
> > > > );
> > > >
> > > > ost::CommandOptionArg optMessageSource (
> > > >   "message_source", "s", "Message Source", true
> > > > );
> > > >
> > > > ost::CommandOptionArg optQuery (
> > > >   "query", "q", "Query to retrieve send data", true
> > > > );
> > > >
> > > > ost::CommandOptionArg optSortDir (
> > > >   "sort_dir", "sd", "Directory where the sort binary resides", true
> > > > );
> > > >
> > > > ost::CommandOptionArg optSortName (
> > > >   "sort_name", "sn", "Name of the sort binary", true
> > > > );
> > > >
> > > > ost::CommandOptionArg optSortTmpDir (
> > > >   "sort_tmp_dir", "st", "Temp dir for sort to use", true
> > > > );
> > > >
> > > > ost::CommandOptionArg optMaxBatchSize (
> > > >   "max_batch_size", "b", "Maximum Batch Size", true
> > > > );
> > > >
> > > > ost::CommandOptionArg optPriority (
> > > >   "priority", "p", "Priority for mailing", true
> > > > );
> > > >
> > > > ost::CommandOptionNoArg optHelpArg (
> > > >   "help", "?", "Print help usage"
> > > > );
> > > >
> > > > int main ( int argc, char ** argv ) {
> > > >   ost::CommandOptionParse * optArgs =
> > > >     ost::makeCommandOptionParse ( argc
> > > >                                 , argv
> > > >                                 , "Configurable Procmail receiver.\n"
> > > >   );
> > > >
> > > >   // If the user requested help then suppress all the usage error
> > > >   // messages.
> > > >   if ( optHelpArg.numSet ) {
> > > >     std::cerr << optArgs->printUsage();
> > > >     return 0;
> > > >   }
> > > >
> > > >   // Print usage your way.
> > > >   if ( optArgs->argsHaveError() ) {
> > > >     std::cerr << optArgs->printErrors();
> > > >     std::cerr << optArgs->printUsage();
> > > >     return 1;
> > > >   }
> > > >
> > > >   std::cout << "Success" << std::endl;
> > > >
> > > >   delete optArgs;
> > > >
> > > >   return 0;
> > > > }
> > > >
> > > > Patch to get rid of memcpy
> > > >
> > > > 170c170
> > > > <               memmove(ptr + start, str, count);
> > > > ---
> > > >
> > > > >               memcpy(ptr + start, str, count);
> > > >
> > > > 218c218
> > > > <       memmove(ptr + start, ptr + start + count, len - start -
> > > > count); ---
> > > >
> > > > >       memcpy(ptr + start, ptr + start + count, len - start -
> > > > > count);
> > > >
> > > > 253c253
> > > > <       memmove(getText() + getLength(), str, len);
> > > > ---
> > > >
> > > > >       memcpy(getText() + getLength(), str, len);
> > > >
> > > > 391c391
> > > > <       memmove(getText(), str, Value==26722== Invalid read of size 4
> > > > ==26722==    at 0x40278576: ost::String::getSpace(unsigned) (in
> > > > /usr/lib/libccgnu2-1.1.so.0.0.2) ==26722==    by 0x402781F6:
> > > > ost::String::resize(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > > > ==26722==    by 0x40277A71: ost::String::set(char const*, unsigned)
> > > > (in /usr/lib/libccgnu2-1.1.so.0.0.2) ==26722==    by 0x40277B07:
> > > > ost::String::set(ost::String const&) (in
> > > > /usr/lib/libccgnu2-1.1.so.0.0.2) ==26722==    by 0x402B16C1:
> > > > ost::String::operator=(ost::String const&) (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x402B802A:
> > > > ost::CommandOptionParse_impl::makePrintUsage() (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x402B6C7A:
> > > > ost::CommandOptionParse_impl::printUsage() (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x8048BFA: main
> > > > (main.cpp:69)
> > > > ==26722==  Address 0x20202020 is not stack'd, malloc'd or free'd
> > > > ==26722==
> > > > ==26722== Process terminating with default action of signal 11
> > > > (SIGSEGV): dumping core ==26722==  Address not mapped to object at
> > > > address 0x20202020 ==26722==    at 0x40278576:
> > > > ost::String::getSpace(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > > > ==26722==    by 0x402781F6:
> > > > ost::String::resize(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > > > ==26722==    by 0x40277A71: ost::String::set(char const*, unsigned)
> > > > (in /usr/lib/libccgnu2-1.1.so.0.0.2) ==26722==    by 0x40277B07:
> > > > ost::String::set(ost::String const&) (in
> > > > /usr/lib/libccgnu2-1.1.so.0.0.2) ==26722==    by 0x402B16C1:
> > > > ost::String::operator=(ost::String const&) (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x402B802A:
> > > > ost::CommandOptionParse_impl::makePrintUsage() (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x402B6C7A:
> > > > ost::CommandOptionParse_impl::printUsage() (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x8048BFA: main
> > > > (main.cpp:69)len);
> > > > ---
> > > >
> > > > >       memcpy(getText(), str, len);
> > > >
> > > > 418c418
> > > > <               memmove(content.ministring.text, getText(),
> > > > getLength() + 1); ---
> > > >
> > > > >               memcpy(content.ministring.text, getText(),
> > > > > getLength() + 1);
> > > >
> > > > 426c426
> > > > <       memmove(content.bigstring.text, ptr, getLength() + 1);
> > > > ---
> > > >
> > > > >       memcpy(content.bigstring.text, ptr, getLength() + 1);
> > > >
> > > > 576c576
> > > > <               memmove(ptr, content.ministring.text, length);
> > > > ---
> > > >
> > > > >               memcpy(ptr, content.ministring.text, length);
> > > >
> > > > 588c588
> > > > <               memmove(content.ministring.text, ptr, length);
> > > > ---
> > > >
> > > > >               memcpy(content.ministring.text, ptr, length);
> > > >
> > > > 597c597
> > > > <       memmove(ptr, getText(), length);
> > > > ---
> > > >
> > > > >       memcpy(ptr, getText(), length);
> > > >
> > > > Debugging results of above program after patch applied
> > > >
> > > > Value==26722== Invalid read of size 4
> > > > ==26722==    at 0x40278576: ost::String::getSpace(unsigned) (in
> > > > /usr/lib/libccgnu2-1.1.so.0.0.2) ==26722==    by 0x402781F6:
> > > > ost::String::resize(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > > > ==26722==    by 0x40277A71: ost::String::set(char const*, unsigned)
> > > > (in /usr/lib/libccgnu2-1.1.so.0.0.2) ==26722==    by 0x40277B07:
> > > > ost::String::set(ost::String const&) (in
> > > > /usr/lib/libccgnu2-1.1.so.0.0.2) ==26722==    by 0x402B16C1:
> > > > ost::String::operator=(ost::String const&) (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x402B802A:
> > > > ost::CommandOptionParse_impl::makePrintUsage() (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x402B6C7A:
> > > > ost::CommandOptionParse_impl::printUsage() (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x8048BFA: main
> > > > (main.cpp:69)
> > > > ==26722==  Address 0x20202020 is not stack'd, malloc'd or free'd
> > > > ==26722==
> > > > ==26722== Process terminating with default action of signal 11
> > > > (SIGSEGV): dumping core ==26722==  Address not mapped to object at
> > > > address 0x20202020 ==26722==    at 0x40278576:
> > > > ost::String::getSpace(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > > > ==26722==    by 0x402781F6:
> > > > ost::String::resize(unsigned) (in /usr/lib/libccgnu2-1.1.so.0.0.2)
> > > > ==26722==    by 0x40277A71: ost::String::set(char const*, unsigned)
> > > > (in /usr/lib/libccgnu2-1.1.so.0.0.2) ==26722==    by 0x40277B07:
> > > > ost::String::set(ost::String const&) (in
> > > > /usr/lib/libccgnu2-1.1.so.0.0.2) ==26722==    by 0x402B16C1:
> > > > ost::String::operator=(ost::String const&) (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x402B802A:
> > > > ost::CommandOptionParse_impl::makePrintUsage() (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x402B6C7A:
> > > > ost::CommandOptionParse_impl::printUsage() (in
> > > > /usr/lib/libccext2-1.1.so.0.0.2) ==26722==    by 0x8048BFA: main
> > > > (main.cpp:69)
> > > >
> > > >
> > > > _______________________________________________
> > > > Bug-commoncpp mailing list
> > > > Bug-commoncpp@gnu.org
> > > > http://mail.gnu.org/mailman/listinfo/bug-commoncpp
>
> _______________________________________________
> Bug-commoncpp mailing list
> Bug-commoncpp@gnu.org
> http://mail.gnu.org/mailman/listinfo/bug-commoncpp



From MAILER-DAEMON Thu Apr 15 09:40:13 2004
Received: from list by monty-python.gnu.org with archive (Exim 4.30)
	id 1BE6uV-00047N-0Q
	for mharc-bug-commoncpp@gnu.org; Thu, 15 Apr 2004 09:28:07 -0400
Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30)
	id 1BE6uF-00045m-RC
	for bug-commoncpp@gnu.org; Thu, 15 Apr 2004 09:27:51 -0400
Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30)
	id 1BE6th-0003xd-Ju
	for bug-commoncpp@gnu.org; Thu, 15 Apr 2004 09:27:48 -0400
Received: from [66.185.86.72] (helo=fep02-mail.bloor.is.net.cable.rogers.com)
	by monty-python.gnu.org with esmtp (Exim 4.30) id 1BE6th-0003xI-2T
	for bug-commoncpp@gnu.org; Thu, 15 Apr 2004 09:27:17 -0400
Received: from chatgris.no-ip.com ([24.112.132.225])
	by fep02-mail.bloor.is.net.cable.rogers.com
	(InterMail vM.5.01.05.12 201-253-122-126-112-20020820) with ESMTP id
	<20040415132649.HBJY30980.fep02-mail.bloor.is.net.cable.rogers.com@chatgris.no-ip.com>;
	Thu, 15 Apr 2004 09:26:49 -0400
From: Joshua Moore-Oliva <josh@chatgris.com>
To: David Sugar <dyfet@ostel.com>
Date: Thu, 15 Apr 2004 09:33:55 -0400
User-Agent: KMail/1.6.1
References: <200404090402.34896.josh@chatgris.com>
	<200404131455.15148.dyfet@ostel.com>
	<200404131653.37664.dyfet@ostel.com>
In-Reply-To: <200404131653.37664.dyfet@ostel.com>
MIME-Version: 1.0
Content-Disposition: inline
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Message-Id: <200404150933.55355.josh@chatgris.com>
X-Authentication-Info: Submitted using SMTP AUTH PLAIN at
	fep02-mail.bloor.is.net.cable.rogers.com from [24.112.132.225]
	using ID <janetteoliva@rogers.com> at Thu,
	15 Apr 2004 09:26:49 -0400
Cc: bug-commoncpp@gnu.org
Subject: Re: Changed string.cpp and string.h for testing
X-BeenThere: bug-commoncpp@gnu.org
X-Mailman-Version: 2.1.4
Precedence: list
List-Id: Bug reports for Common C++ <bug-commoncpp.gnu.org>
List-Unsubscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=unsubscribe>
List-Archive: <http://mail.gnu.org/pipermail/bug-commoncpp>
List-Post: <mailto:bug-commoncpp@gnu.org>
List-Help: <mailto:bug-commoncpp-request@gnu.org?subject=help>
List-Subscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=subscribe>
X-List-Received-Date: Thu, 15 Apr 2004 13:28:02 -0000

Fixes the problem

On April 13, 2004 4:53 pm, David Sugar wrote:
> They are attached...
> 



From MAILER-DAEMON Sat Apr 17 12:05:23 2004
Received: from list by monty-python.gnu.org with archive (Exim 4.30)
	id 1BEsJm-0005b6-Hi
	for mharc-bug-commoncpp@gnu.org; Sat, 17 Apr 2004 12:05:22 -0400
Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30)
	id 1BEsJi-0005X9-NS
	for bug-commoncpp@gnu.org; Sat, 17 Apr 2004 12:05:18 -0400
Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30)
	id 1BEsJ5-0005DU-WA
	for bug-commoncpp@gnu.org; Sat, 17 Apr 2004 12:05:11 -0400
Received: from [213.179.251.246] (helo=jdevelop.priv)
	by monty-python.gnu.org with smtp (Exim 4.30) id 1BEsGA-0002yF-10
	for bug-commoncpp@gnu.org; Sat, 17 Apr 2004 12:01:38 -0400
Received: (qmail 748 invoked from network); 17 Apr 2004 16:00:59 -0000
Received: from localhost (HELO jdevelop.priv) (127.0.0.1)
	by localhost with SMTP; 17 Apr 2004 16:00:59 -0000
Date: Sat, 17 Apr 2004 19:00:59 +0300
From: Eugeny N Dzhurinsky <eugenydzh@jdevelop.com>
To: bug-commoncpp@gnu.org
Message-Id: <20040417190059.213403a7@jdevelop.priv>
Organization: JDevelop software
X-Mailer: Sylpheed version 0.9.10claws (GTK+ 1.2.10; i386-portbld-freebsd4.9)
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Subject: Licensing
X-BeenThere: bug-commoncpp@gnu.org
X-Mailman-Version: 2.1.4
Precedence: list
List-Id: Bug reports for Common C++ <bug-commoncpp.gnu.org>
List-Unsubscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=unsubscribe>
List-Archive: <http://mail.gnu.org/pipermail/bug-commoncpp>
List-Post: <mailto:bug-commoncpp@gnu.org>
List-Help: <mailto:bug-commoncpp-request@gnu.org?subject=help>
List-Subscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sat, 17 Apr 2004 16:05:20 -0000

Am I cllowed to use the CommonCPP in my proprietary commertial software?
Is it distributed with LGPL?



From MAILER-DAEMON Mon Apr 19 05:33:12 2004
Received: from list by monty-python.gnu.org with archive (Exim 4.30)
	id 1BFV8O-0003Kx-Q8
	for mharc-bug-commoncpp@gnu.org; Mon, 19 Apr 2004 05:32:12 -0400
Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30)
	id 1BFBTq-0000Jv-6y
	for bug-commoncpp@gnu.org; Sun, 18 Apr 2004 08:33:02 -0400
Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30)
	id 1BFBTJ-0000F5-6J
	for bug-commoncpp@gnu.org; Sun, 18 Apr 2004 08:33:00 -0400
Received: from [216.171.238.83] (helo=smtp.linuxfromscratch.org)
	by monty-python.gnu.org with esmtp (Exim 4.30) id 1BFBTI-0000Er-J9
	for bug-commoncpp@gnu.org; Sun, 18 Apr 2004 08:32:28 -0400
Received: by smtp.linuxfromscratch.org (Postfix, from userid 108)
	id B83BA131C; Sun, 18 Apr 2004 06:32:25 -0600 (MDT)
Received: from lfs5.example.org (i-195-137-83-37.freedom2surf.net
	[195.137.83.37])
	by smtp.linuxfromscratch.org (Postfix) with SMTP id 923EB1261
	for <bug-commoncpp@gnu.org>; Sun, 18 Apr 2004 06:32:23 -0600 (MDT)
Date: Sun, 18 Apr 2004 13:34:05 +0100
From: Matthew Burgess <matthew@linuxfromscratch.org>
To: bug-commoncpp@gnu.org
Message-Id: <20040418133405.23d9fa8e.matthew@linuxfromscratch.org>
Organization: LFS
X-Mailer: Sylpheed version 0.9.8a (GTK+ 1.2.10; i686-pc-linux-gnu)
Mime-Version: 1.0
Content-Type: multipart/mixed;
	boundary="Multipart=_Sun__18_Apr_2004_13_34_05_+0100_KoRJqj1K/ZTtOuVd"
X-Mailman-Approved-At: Mon, 19 Apr 2004 05:32:10 -0400
Subject: commoncpp-1.1.4 doesn't compile with --with-linuxthreads
X-BeenThere: bug-commoncpp@gnu.org
X-Mailman-Version: 2.1.4
Precedence: list
List-Id: Bug reports for Common C++ <bug-commoncpp.gnu.org>
List-Unsubscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=unsubscribe>
List-Archive: <http://mail.gnu.org/pipermail/bug-commoncpp>
List-Post: <mailto:bug-commoncpp@gnu.org>
List-Help: <mailto:bug-commoncpp-request@gnu.org?subject=help>
List-Subscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sun, 18 Apr 2004 12:33:03 -0000

This is a multi-part message in MIME format.

--Multipart=_Sun__18_Apr_2004_13_34_05_+0100_KoRJqj1K/ZTtOuVd
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit

Hi,

Trying to compile commoncpp-1.1.4 on a Linux box when specifying
--with-linuxthreads results in the following output from `make`:

---
 g++ -DHAVE_CONFIG_H -I. -I. -I../include -I../src -DCCXX_EXPORT_LIBRARY
-I/usr/include/libxml2 -I../include -O2 -mcpu=pentium3 -march=pentium3
-D_GNU_SOURCE -MT thread.lo -MD -MP -MF .deps/thread.Tpo -c thread.cpp 
-fPIC -DPIC -o .libs/thread.o
thread.cpp:98: multiple storage classes in declaration of `sigcancel'
thread.cpp:998: `thread_cancel_t' was not declared in this scope
thread.cpp:998: syntax error before `)' token
thread.cpp:999: prototype for `void ost::Thread::setCancel(...)' does
not match
   any in class `ost::Thread'
../include/cc++/thread.h:1046: candidate is: void
   ost::Thread::setCancel(ost::Thread::Cancel)
thread.cpp: In member function `void ost::Thread::setCancel(...)':
thread.cpp:1005: `mode' undeclared (first use this function)
thread.cpp:1005: (Each undeclared identifier is reported only once for
each   function it appears in.)
---

I've attached a patch which resolves these issues, and a further problem
that is seen once these two issues are fixed (linuxthreads appears to be
wanting to be linked via -lpthread, not -llthread, and it's FAQ supports
this).

Hope this is of some use,

Matt.

--Multipart=_Sun__18_Apr_2004_13_34_05_+0100_KoRJqj1K/ZTtOuVd
Content-Type: application/octet-stream;
	name="commoncpp-1.1.4-linuxthreads-1.patch"
Content-Disposition: attachment;
	filename="commoncpp-1.1.4-linuxthreads-1.patch"
Content-Transfer-Encoding: base64

U3VibWl0dGVkIEJ5OiAgICAgICAgICAgIE1hdHRoZXcgQnVyZ2VzcyA8bWF0dGhld0BsaW51eGZy
b21zY3JhdGNoLm9yZz4KRGF0ZTogICAgICAgICAgICAgICAgICAgIDIwMDQtMDQtMTgKSW5pdGlh
bCBQYWNrYWdlIFZlcnNpb246IDEuMS40ClVwc3RyZWFtIFN0YXR1czogICAgICAgICBTdWJtaXR0
ZWQKT3JpZ2luOiAgICAgICAgICAgICAgICAgIFNlZSBodHRwOi8vbGludXhmcm9tc2NyYXRjaC5v
cmcvcGlwZXJtYWlsL2JsZnMtc3VwcG9ydC8KICAgICAgICAgICAgICAgICAgICAgICAgIDIwMDQt
QXByaWwvMDQ5Mzk1Lmh0bWwKRGVzY3JpcHRpb246ICAgICAgICAgICAgIFdoZW4gdXNpbmcgdGhl
IC0td2l0aC1saW51eHRocmVhZHMgLi9jb25maWd1cmUgb3B0aW9uCiAgICAgICAgICAgICAgICAg
ICAgICAgICB0aGUgY29tcGlsZSBmYWlscy4KICAgICAgICAgICAgICAgICAgICAgICAgIEh1bmsj
MSBsaW5rcyB0byB0aGUgbGludXh0aHJlYWRzIGxpYnJhcnkgdXNpbmcKICAgICAgICAgICAgICAg
ICAgICAgICAgIC1scHRocmVhZCB3aGljaCBpcyBjb3JyZWN0IGFjY29yZGluZyB0byB0aGUKICAg
ICAgICAgICAgICAgICAgICAgICAgIExpbnV4VGhyZWFkcyBsaWJyYXJ5LgogICAgICAgICAgICAg
ICAgICAgICAgICAgSHVuayMyIGlzIG5lZWRlZCB0byBzdG9wIGdjYyBmcm9tIGNvbXBsYWluaW5n
IG9mCiAgICAgICAgICAgICAgICAgICAgICAgICAibXVsdGlwbGUgc3RvcmFnZSBjbGFzc2VzIGlu
IGRlY2xhcmF0aW9uIG9mCiAgICAgICAgICAgICAgICAgICAgICAgICBgc2lnY2FuY2VsJyIKICAg
ICAgICAgICAgICAgICAgICAgICAgIEh1bmsjMyBpcyBuZWVkZWQgYXMgaXQgbG9va3MgYXMgdGhv
dWdoIHRoZSBlbnVtCiAgICAgICAgICAgICAgICAgICAgICAgICB0aHJlYWRfY2FuY2VsX3Qgd2Fz
IHJlbmFtZWQgdG8gQ2FuY2VsIGluIHRocmVhZC5oCgpkaWZmIC1OYXVyIGNvbW1vbmNwcDItMS4x
LjQub3JpZy9jb25maWd1cmUgY29tbW9uY3BwMi0xLjEuNC9jb25maWd1cmUKLS0tIGNvbW1vbmNw
cDItMS4xLjQub3JpZy9jb25maWd1cmUJMjAwNC0wNC0xNyAxMzo1MjozNS4wMDAwMDAwMDAgKzAx
MDAKKysrIGNvbW1vbmNwcDItMS4xLjQvY29uZmlndXJlCTIwMDQtMDQtMTggMTI6MzU6NTIuMDAw
MDAwMDAwICswMTAwCkBAIC0yMjg5Miw3ICsyMjg5Miw3IEBACiAjIENoZWNrIHdoZXRoZXIgLS13
aXRoLWxpbnV4dGhyZWFkcyBvciAtLXdpdGhvdXQtbGludXh0aHJlYWRzIHdhcyBnaXZlbi4KIGlm
IHRlc3QgIiR7d2l0aF9saW51eHRocmVhZHMrc2V0fSIgPSBzZXQ7IHRoZW4KICAgd2l0aHZhbD0i
JHdpdGhfbGludXh0aHJlYWRzIgotICBvc3RfY3ZfdGhyZWFkX2xpYnJhcnk9bHRocmVhZAorICBv
c3RfY3ZfdGhyZWFkX2xpYnJhcnk9cHRocmVhZAogCiBjYXQgPj5jb25mZGVmcy5oIDw8XF9BQ0VP
RgogI2RlZmluZSBXSVRIX0xJTlVYVEhSRUFEUyAxCmRpZmYgLU5hdXIgY29tbW9uY3BwMi0xLjEu
NC5vcmlnL3NyYy90aHJlYWQuY3BwIGNvbW1vbmNwcDItMS4xLjQvc3JjL3RocmVhZC5jcHAKLS0t
IGNvbW1vbmNwcDItMS4xLjQub3JpZy9zcmMvdGhyZWFkLmNwcAkyMDA0LTA0LTE3IDEzOjUwOjQ1
LjAwMDAwMDAwMCArMDEwMAorKysgY29tbW9uY3BwMi0xLjEuNC9zcmMvdGhyZWFkLmNwcAkyMDA0
LTA0LTE4IDEyOjQxOjEzLjAwMDAwMDAwMCArMDEwMApAQCAtOTQsNyArOTQsNyBAQAogCiAjaWZk
ZWYJQ0NYWF9TSUdfVEhSRUFEX0NBTkNFTAogCi1leHRlcm4gIkMiIHN0YXRpYyBSRVRTSUdUWVBF
IHNpZ2NhbmNlbChpbnQpCitzdGF0aWMgUkVUU0lHVFlQRSBzaWdjYW5jZWwoaW50KQogewogCXB0
aHJlYWRfZXhpdChOVUxMKTsKIH0KQEAgLTEwNDAsNyArMTA0MCw3IEBACiAKICNpZmRlZglDQ1hY
X1NJR19USFJFQURfQ0FOQ0VMCiAKLXZvaWQJVGhyZWFkOjpzZXRDYW5jZWwodGhyZWFkX2NhbmNl
bF90IG1vZGUpCit2b2lkCVRocmVhZDo6c2V0Q2FuY2VsKENhbmNlbCBtb2RlKQogewogCXNpZ3Nl
dF90CW1hc2s7CiAK

--Multipart=_Sun__18_Apr_2004_13_34_05_+0100_KoRJqj1K/ZTtOuVd--



From MAILER-DAEMON Mon Apr 19 06:28:24 2004
Received: from list by monty-python.gnu.org with archive (Exim 4.30)
	id 1BFVzQ-0004Bi-Bm
	for mharc-bug-commoncpp@gnu.org; Mon, 19 Apr 2004 06:27:00 -0400
Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30)
	id 1BFVz9-00041a-GQ
	for bug-commoncpp@gnu.org; Mon, 19 Apr 2004 06:26:43 -0400
Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30)
	id 1BFVya-0003mH-C0
	for bug-commoncpp@gnu.org; Mon, 19 Apr 2004 06:26:39 -0400
Received: from [193.137.203.229] (helo=smtp2.dei.uc.pt)
	by monty-python.gnu.org with esmtp (Exim 4.30) id 1BFVvm-0002xy-Py
	for bug-commoncpp@gnu.org; Mon, 19 Apr 2004 06:23:14 -0400
Received: from student.dei.uc.pt (student.dei.uc.pt [10.1.0.1])
	by smtp2.dei.uc.pt (8.11.7/8.11.7) with ESMTP id i3JAZaK05096
	for <bug-commoncpp@gnu.org>; Mon, 19 Apr 2004 11:35:36 +0100
Received: from punkass.com (abra.dei.uc.pt [10.3.0.21])
	by student.dei.uc.pt (8.12.8/8.12.8) with ESMTP id i3JAN0sR025330
	for <bug-commoncpp@gnu.org>; Mon, 19 Apr 2004 11:23:00 +0100
Message-ID: <4085089F.3090904@punkass.com>
Date: Tue, 20 Apr 2004 12:25:19 +0100
From: Jose Pedro Tavares <zarroba@punkass.com>
User-Agent: Mozilla Thunderbird 0.5 (X11/20040208)
X-Accept-Language: en-us, en
MIME-Version: 1.0
To: bug-commoncpp@gnu.org
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
X-UC-DEI-MailScanner-Information: Please contact helpdesk@dei.uc.pt for more
	information
X-UC-DEI-MailScanner: Found to be clean
X-UC-DEI-MailScanner-SpamCheck: spam, SpamAssassin (score=2.9, required 2,
	DATE_IN_FUTURE_24_48 2.90)
X-UC-DEI-MailScanner-SpamScore: ss
Subject: {Spam?} Object serialization of  in 1.1.0
X-BeenThere: bug-commoncpp@gnu.org
X-Mailman-Version: 2.1.4
Precedence: list
List-Id: Bug reports for Common C++ <bug-commoncpp.gnu.org>
List-Unsubscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=unsubscribe>
List-Archive: <http://mail.gnu.org/pipermail/bug-commoncpp>
List-Post: <mailto:bug-commoncpp@gnu.org>
List-Help: <mailto:bug-commoncpp-request@gnu.org?subject=help>
List-Subscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 19 Apr 2004 10:26:46 -0000

I want to serialize objects to send them throw the network and I know 
that commoncpp doesn't permite to do so, but I wonder if any of you is 
doing it. I've passed an object to a char* throw 
reinterpret_cast<char*>(&object) but how do I do the opposite? Is this 
the best way of doing it?

TIA,
Jose Pedro Tavares



From MAILER-DAEMON Mon Apr 19 15:14:40 2004
Received: from list by monty-python.gnu.org with archive (Exim 4.30)
	id 1BFdUg-00041i-KS
	for mharc-bug-commoncpp@gnu.org; Mon, 19 Apr 2004 14:27:46 -0400
Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30)
	id 1BFdLQ-0001yi-6N
	for bug-commoncpp@gnu.org; Mon, 19 Apr 2004 14:18:12 -0400
Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30)
	id 1BFXfb-0002kM-Bz
	for bug-commoncpp@gnu.org; Mon, 19 Apr 2004 08:15:11 -0400
Received: from [216.218.222.122] (helo=mail.ostel.com)
	by monty-python.gnu.org with esmtp (Exim 4.30) id 1BFXCj-0007bR-OV
	for bug-commoncpp@gnu.org; Mon, 19 Apr 2004 07:44:49 -0400
Received: by mail.ostel.com (Postfix, from userid 1005)
	id 1F6252F286D; Mon, 19 Apr 2004 04:46:49 -0700 (PDT)
Received: from [192.168.1.102] (pool-138-89-40-158.mad.east.verizon.net
	[138.89.40.158]) by mail.ostel.com (Postfix) with ESMTP
	id BFBBF2F2867; Mon, 19 Apr 2004 04:46:47 -0700 (PDT)
From: David Sugar <dyfet@ostel.com>
To: bug-commoncpp@gnu.org
Date: Mon, 19 Apr 2004 07:48:09 -0400
User-Agent: KMail/1.6.2
References: <20040418133405.23d9fa8e.matthew@linuxfromscratch.org>
In-Reply-To: <20040418133405.23d9fa8e.matthew@linuxfromscratch.org>
MIME-Version: 1.0
Content-Disposition: inline
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Message-Id: <200404190748.09375.dyfet@ostel.com>
Cc: Matthew Burgess <matthew@linuxfromscratch.org>
Subject: Re: commoncpp-1.1.4 doesn't compile with --with-linuxthreads
X-BeenThere: bug-commoncpp@gnu.org
X-Mailman-Version: 2.1.4
Precedence: list
List-Id: Bug reports for Common C++ <bug-commoncpp.gnu.org>
List-Unsubscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=unsubscribe>
List-Archive: <http://mail.gnu.org/pipermail/bug-commoncpp>
List-Post: <mailto:bug-commoncpp@gnu.org>
List-Help: <mailto:bug-commoncpp-request@gnu.org?subject=help>
List-Subscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 19 Apr 2004 18:27:40 -0000

The --with-linuxthreads option is meant for FreeBSD systems that optionally 
had a port of the Linux threading system called "linuxthreads", available as 
a separate and optional link threading library, in addition to the default 
FreeBSD threading support.  That option was NEVER meant to be used on a 
GNU/Linux system, and Common C++ automatically detects  and configures for 
glibc pthread support without any special options.

On Sunday 18 April 2004 08:34 am, Matthew Burgess wrote:
> Hi,
>
> Trying to compile commoncpp-1.1.4 on a Linux box when specifying
> --with-linuxthreads results in the following output from `make`:
>
> ---
>  g++ -DHAVE_CONFIG_H -I. -I. -I../include -I../src -DCCXX_EXPORT_LIBRARY
> -I/usr/include/libxml2 -I../include -O2 -mcpu=pentium3 -march=pentium3
> -D_GNU_SOURCE -MT thread.lo -MD -MP -MF .deps/thread.Tpo -c thread.cpp
> -fPIC -DPIC -o .libs/thread.o
> thread.cpp:98: multiple storage classes in declaration of `sigcancel'
> thread.cpp:998: `thread_cancel_t' was not declared in this scope
> thread.cpp:998: syntax error before `)' token
> thread.cpp:999: prototype for `void ost::Thread::setCancel(...)' does
> not match
>    any in class `ost::Thread'
> ../include/cc++/thread.h:1046: candidate is: void
>    ost::Thread::setCancel(ost::Thread::Cancel)
> thread.cpp: In member function `void ost::Thread::setCancel(...)':
> thread.cpp:1005: `mode' undeclared (first use this function)
> thread.cpp:1005: (Each undeclared identifier is reported only once for
> each   function it appears in.)
> ---
>
> I've attached a patch which resolves these issues, and a further problem
> that is seen once these two issues are fixed (linuxthreads appears to be
> wanting to be linked via -lpthread, not -llthread, and it's FAQ supports
> this).
>
> Hope this is of some use,
>
> Matt.



From MAILER-DAEMON Wed Apr 21 10:36:25 2004
Received: from list by monty-python.gnu.org with archive (Exim 4.30)
	id 1BGIps-0007Kh-IL
	for mharc-bug-commoncpp@gnu.org; Wed, 21 Apr 2004 10:36:24 -0400
Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30)
	id 1BGIpp-0007JV-6Z
	for bug-commoncpp@gnu.org; Wed, 21 Apr 2004 10:36:21 -0400
Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30)
	id 1BGIpH-0007Fk-KD
	for bug-commoncpp@gnu.org; Wed, 21 Apr 2004 10:36:18 -0400
Received: from [195.41.178.3] (helo=proinfo.dk)
	by monty-python.gnu.org with esmtp (Exim 4.30) id 1BGIND-0001Jb-M7
	for bug-commoncpp@gnu.org; Wed, 21 Apr 2004 10:06:47 -0400
Received: from mars.prointra.dk ([148.170.19.5]) by gate1.proinfo.dk with
	ESMTP id <334265>; Wed, 21 Apr 2004 16:05:23 +0200
Received: by mars.prointra.dk with Internet Mail Service (5.5.2650.21)
	id <JH5GRKQD>; Wed, 21 Apr 2004 16:02:52 +0200
Message-ID: <CC2F8BD52F20D41184D40040C77A41A101DFFA07@mars.prointra.dk>
From: Byrial Jensen <bje@prosafe.as>
To: "'bug-commoncpp@gnu.org'" <bug-commoncpp@gnu.org>
Date: Wed, 21 Apr 2004 16:02:45 +0200
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2650.21)
Content-Type: text/plain; charset="iso-8859-1"
Subject: Cannot compile with GCC 3.4.0
X-BeenThere: bug-commoncpp@gnu.org
X-Mailman-Version: 2.1.4
Precedence: list
List-Id: Bug reports for Common C++ <bug-commoncpp.gnu.org>
List-Unsubscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=unsubscribe>
List-Archive: <http://mail.gnu.org/pipermail/bug-commoncpp>
List-Post: <mailto:bug-commoncpp@gnu.org>
List-Help: <mailto:bug-commoncpp-request@gnu.org?subject=help>
List-Subscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 21 Apr 2004 14:36:22 -0000

GCC 3.4.0 has just been released, and it cannot compile CommonC++2 1.1.4
(or any other version) due to stricter conformance to the ISO/ANSI C++
standard
than previous versions of GCC.

Is somebody working on making CommonC++ able to compile with GCC 3.4.0?

Kind regards
Byrial Jensen



From MAILER-DAEMON Wed Apr 21 12:10:52 2004
Received: from list by monty-python.gnu.org with archive (Exim 4.30)
	id 1BGKJH-0006Qw-JH
	for mharc-bug-commoncpp@gnu.org; Wed, 21 Apr 2004 12:10:51 -0400
Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30)
	id 1BGKJD-0006OZ-Av
	for bug-commoncpp@gnu.org; Wed, 21 Apr 2004 12:10:47 -0400
Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30)
	id 1BGKIg-0006AA-Oa
	for bug-commoncpp@gnu.org; Wed, 21 Apr 2004 12:10:46 -0400
Received: from [216.218.222.122] (helo=mail.ostel.com)
	by monty-python.gnu.org with esmtp (Exim 4.30) id 1BGKIg-00069m-1Z
	for bug-commoncpp@gnu.org; Wed, 21 Apr 2004 12:10:14 -0400
Received: by mail.ostel.com (Postfix, from userid 1005)
	id 1B6662F2867; Wed, 21 Apr 2004 09:12:32 -0700 (PDT)
Received: from [192.168.1.102] (pool-138-89-39-159.mad.east.verizon.net
	[138.89.39.159]) by mail.ostel.com (Postfix) with ESMTP
	id C22792F286D; Wed, 21 Apr 2004 09:12:25 -0700 (PDT)
From: David Sugar <dyfet@ostel.com>
To: bug-commoncpp@gnu.org
Date: Wed, 21 Apr 2004 12:13:37 -0400
User-Agent: KMail/1.6.2
References: <CC2F8BD52F20D41184D40040C77A41A101DFFA07@mars.prointra.dk>
In-Reply-To: <CC2F8BD52F20D41184D40040C77A41A101DFFA07@mars.prointra.dk>
MIME-Version: 1.0
Content-Disposition: inline
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Message-Id: <200404211213.37716.dyfet@ostel.com>
Cc: Byrial Jensen <bje@prosafe.as>,
	"'bug-commoncpp@gnu.org'" <bug-commoncpp@gnu.org>,
	Federico Montesino Pouzols <fedemp@altern.org>
Subject: Re: Cannot compile with GCC 3.4.0
X-BeenThere: bug-commoncpp@gnu.org
X-Mailman-Version: 2.1.4
Precedence: list
List-Id: Bug reports for Common C++ <bug-commoncpp.gnu.org>
List-Unsubscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=unsubscribe>
List-Archive: <http://mail.gnu.org/pipermail/bug-commoncpp>
List-Post: <mailto:bug-commoncpp@gnu.org>
List-Help: <mailto:bug-commoncpp-request@gnu.org?subject=help>
List-Subscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 21 Apr 2004 16:10:49 -0000

I guess that would be me.  I just tried gcc-3.4.0, and in fact, I only found 
one broken construct, an "enum Cancel _cancel", which it rejected, in 
"cc++/thread.h".  Changing that to "Cancel _cancel" (using the existing 
typedef instead) was the only change I needed to to make to get the whole of 
Common C++ to compile on gcc-3.4.0 here.

I will need to check other Common C++ based libraries and code later, but I am 
hopeful the changes there are as minimal...

On Wednesday 21 April 2004 10:02 am, Byrial Jensen wrote:
> GCC 3.4.0 has just been released, and it cannot compile CommonC++2 1.1.4
> (or any other version) due to stricter conformance to the ISO/ANSI C++
> standard
> than previous versions of GCC.
>
> Is somebody working on making CommonC++ able to compile with GCC 3.4.0?
>
> Kind regards
> Byrial Jensen
>
>
> _______________________________________________
> Bug-commoncpp mailing list
> Bug-commoncpp@gnu.org
> http://mail.gnu.org/mailman/listinfo/bug-commoncpp



From MAILER-DAEMON Wed Apr 21 13:03:36 2004
Received: from list by monty-python.gnu.org with archive (Exim 4.30)
	id 1BGL8K-0005S0-8g
	for mharc-bug-commoncpp@gnu.org; Wed, 21 Apr 2004 13:03:36 -0400
Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30)
	id 1BGL8H-0005QK-4y
	for bug-commoncpp@gnu.org; Wed, 21 Apr 2004 13:03:33 -0400
Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30)
	id 1BGL7g-0005FZ-B5
	for bug-commoncpp@gnu.org; Wed, 21 Apr 2004 13:03:27 -0400
Received: from [199.232.41.8] (helo=mx20.gnu.org)
	by monty-python.gnu.org with esmtp (TLSv1:DES-CBC3-SHA:168)
	(Exim 4.30) id 1BGKug-0002Sd-Vx
	for bug-commoncpp@gnu.org; Wed, 21 Apr 2004 12:49:31 -0400
Received: from [216.218.222.122] (helo=mail.ostel.com)
	by mx20.gnu.org with esmtp (Exim 4.30) id 1BGKuK-0008Kc-KD
	for bug-commoncpp@gnu.org; Wed, 21 Apr 2004 12:49:08 -0400
Received: by mail.ostel.com (Postfix, from userid 1005)
	id 75B7A2F286D; Wed, 21 Apr 2004 09:51:07 -0700 (PDT)
Received: from [192.168.1.102] (pool-138-89-69-195.mad.east.verizon.net
	[138.89.69.195]) by mail.ostel.com (Postfix) with ESMTP
	id 19B552F2867; Wed, 21 Apr 2004 09:51:01 -0700 (PDT)
From: David Sugar <dyfet@ostel.com>
To: bug-commoncpp@gnu.org
Date: Wed, 21 Apr 2004 12:52:12 -0400
User-Agent: KMail/1.6.2
References: <CC2F8BD52F20D41184D40040C77A41A101DFFA07@mars.prointra.dk>
	<200404211213.37716.dyfet@ostel.com>
In-Reply-To: <200404211213.37716.dyfet@ostel.com>
MIME-Version: 1.0
Content-Disposition: inline
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Message-Id: <200404211252.12570.dyfet@ostel.com>
Cc: Byrial Jensen <bje@prosafe.as>,
	"'bug-commoncpp@gnu.org'" <bug-commoncpp@gnu.org>,
	Federico Montesino Pouzols <fedemp@altern.org>
Subject: Re: Cannot compile with GCC 3.4.0
X-BeenThere: bug-commoncpp@gnu.org
X-Mailman-Version: 2.1.4
Precedence: list
List-Id: Bug reports for Common C++ <bug-commoncpp.gnu.org>
List-Unsubscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=unsubscribe>
List-Archive: <http://mail.gnu.org/pipermail/bug-commoncpp>
List-Post: <mailto:bug-commoncpp@gnu.org>
List-Help: <mailto:bug-commoncpp-request@gnu.org?subject=help>
List-Subscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 21 Apr 2004 17:03:34 -0000

Well, I did find additional changes nessisary, particularly in headers, once I 
enabled all warnings and errors, but the changes were still not all that 
large...right now I am looking at ccrtp and gcc-3.4.

On Wednesday 21 April 2004 12:13 pm, David Sugar wrote:
> I guess that would be me.  I just tried gcc-3.4.0, and in fact, I only
> found one broken construct, an "enum Cancel _cancel", which it rejected, in
> "cc++/thread.h".  Changing that to "Cancel _cancel" (using the existing
> typedef instead) was the only change I needed to to make to get the whole
> of Common C++ to compile on gcc-3.4.0 here.
>
> I will need to check other Common C++ based libraries and code later, but I
> am hopeful the changes there are as minimal...
>
> On Wednesday 21 April 2004 10:02 am, Byrial Jensen wrote:
> > GCC 3.4.0 has just been released, and it cannot compile CommonC++2 1.1.4
> > (or any other version) due to stricter conformance to the ISO/ANSI C++
> > standard
> > than previous versions of GCC.
> >
> > Is somebody working on making CommonC++ able to compile with GCC 3.4.0?
> >
> > Kind regards
> > Byrial Jensen
> >
> >
> > _______________________________________________
> > Bug-commoncpp mailing list
> > Bug-commoncpp@gnu.org
> > http://mail.gnu.org/mailman/listinfo/bug-commoncpp
>
> _______________________________________________
> Bug-commoncpp mailing list
> Bug-commoncpp@gnu.org
> http://mail.gnu.org/mailman/listinfo/bug-commoncpp



From MAILER-DAEMON Thu Apr 22 07:45:40 2004
Received: from list by monty-python.gnu.org with archive (Exim 4.30)
	id 1BGcbq-0001RE-L7
	for mharc-bug-commoncpp@gnu.org; Thu, 22 Apr 2004 07:43:14 -0400
Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30)
	id 1BGcbE-0001D1-6l
	for bug-commoncpp@gnu.org; Thu, 22 Apr 2004 07:42:36 -0400
Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30)
	id 1BGcZp-0000jA-CD
	for bug-commoncpp@gnu.org; Thu, 22 Apr 2004 07:41:41 -0400
Received: from [62.92.39.162] (helo=cognita.no)
	by monty-python.gnu.org with esmtp (Exim 4.30) id 1BGcCo-0006CE-JP
	for bug-commoncpp@gnu.org; Thu, 22 Apr 2004 07:17:22 -0400
Received: from cognita.no (gatekeeper.cognita.no [62.92.39.171])
	by cognita.no (8.12.8/8.12.8) with ESMTP id i3MBMAd6026050
	for <bug-commoncpp@gnu.org>; Thu, 22 Apr 2004 13:22:10 +0200
Message-ID: <4087A9BB.3060206@cognita.no>
Date: Thu, 22 Apr 2004 13:17:15 +0200
From: Idar Tollefsen <idar@cognita.no>
Organization: Cognita AS
User-Agent: Mozilla Thunderbird 0.5 (Macintosh/20040208)
X-Accept-Language: en-us, en
MIME-Version: 1.0
To: bug-commoncpp@gnu.org
Content-Type: multipart/mixed; boundary="------------000109000807000808010908"
Subject: time_t Time::getTime() doesn't work
X-BeenThere: bug-commoncpp@gnu.org
X-Mailman-Version: 2.1.4
Precedence: list
List-Id: Bug reports for Common C++ <bug-commoncpp.gnu.org>
List-Unsubscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=unsubscribe>
List-Archive: <http://mail.gnu.org/pipermail/bug-commoncpp>
List-Post: <mailto:bug-commoncpp@gnu.org>
List-Help: <mailto:bug-commoncpp-request@gnu.org?subject=help>
List-Subscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=subscribe>
X-List-Received-Date: Thu, 22 Apr 2004 11:43:01 -0000

This is a multi-part message in MIME format.
--------------000109000807000808010908
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

Hello,

The function mentioned in the subject doesn't work. It uses mktime() to 
construct a time_t, but the struct tm it sends in has it's year set to 0, which 
would generate a time_t value greater than what time_t can hold, and mktime() 
returns -1 to indicate failure.

This function can never have worked, or it was implemented and tested on some 
platform where time_t was defined to something larger than I've seen on any 
platform I've tested it on. On the platforms I use, OS X and FreeBSD (4.9 on 
Alpha, 5.2 on i686), mktime() with a year value in the tm struct of less than 2 
will fail.

I also fail to see why it's desirable to use mktime() at all since the Time 
class already stores it value as seconds. Conversely, I have attached a patch 
that fixes the problem by simply converting the internally stored seconds to time_t.


Sincerely,
Idar Tollefsen


--------------000109000807000808010908
Content-Type: text/plain; x-mac-type="0"; x-mac-creator="0";
	name="patch-commoncpp2:src:date.cpp"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="patch-commoncpp2:src:date.cpp"

--- src/date.cpp.orig	Sun Mar 28 23:09:14 2004
+++ src/date.cpp	Thu Apr 15 10:49:06 2004
@@ -474,18 +474,7 @@
 
 time_t Time::getTime(void) const
 {
-	char buf[7];
-	struct tm dt;
-	memset(&dt, 0, sizeof(dt));
-	fromSeconds(buf);
-	ZNumber nhour(buf, 2);
-	ZNumber nminute(buf + 2, 2);
-	ZNumber nsecond(buf + 4, 2);
-	
-	dt.tm_hour = nhour();
-	dt.tm_min = nminute();
-	dt.tm_sec = nsecond();
-	return mktime(&dt);
+    return static_cast<time_t>(seconds);
 }
 
 int Time::getHour(void) const

--------------000109000807000808010908--



From MAILER-DAEMON Thu Apr 22 12:05:56 2004
Received: from list by monty-python.gnu.org with archive (Exim 4.30)
	id 1BGgi3-0003tP-Ur
	for mharc-bug-commoncpp@gnu.org; Thu, 22 Apr 2004 12:05:55 -0400
Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30)
	id 1BGgYt-0001lD-FU
	for bug-commoncpp@gnu.org; Thu, 22 Apr 2004 11:56:27 -0400
Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30)
	id 1BGgGx-0006ea-55
	for bug-commoncpp@gnu.org; Thu, 22 Apr 2004 11:38:27 -0400
Received: from [66.235.192.199] (helo=host134.ipowerweb.com)
	by monty-python.gnu.org with smtp (Exim 4.30) id 1BGfTO-0003SI-CO
	for bug-commoncpp@gnu.org; Thu, 22 Apr 2004 10:46:42 -0400
Received: (qmail 65241 invoked from network); 22 Apr 2004 14:48:21 -0000
Received: from unknown (HELO ralphlaptop.ralphdellamorte.com) (64.74.50.140)
	by host134.ipowerweb.com with SMTP; 22 Apr 2004 14:48:21 -0000
Message-Id: <5.1.0.14.0.20040422104445.00baeb20@mail.ralphdellamorte.com>
X-Sender: ralph@ralphdellamorte.com@mail.ralphdellamorte.com
X-Mailer: QUALCOMM Windows Eudora Version 5.1
Date: Thu, 22 Apr 2004 10:46:36 -0400
To: bug-commoncpp@gnu.org
From: Ralph Dellamorte <ralph@ralphdellamorte.com>
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"; format=flowed
Subject: simple socket client
X-BeenThere: bug-commoncpp@gnu.org
X-Mailman-Version: 2.1.4
Precedence: list
List-Id: Bug reports for Common C++ <bug-commoncpp.gnu.org>
List-Unsubscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=unsubscribe>
List-Archive: <http://mail.gnu.org/pipermail/bug-commoncpp>
List-Post: <mailto:bug-commoncpp@gnu.org>
List-Help: <mailto:bug-commoncpp-request@gnu.org?subject=help>
List-Subscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=subscribe>
X-List-Received-Date: Thu, 22 Apr 2004 16:05:53 -0000

I need to connect to an ip/port, and read data. There are no examples to do 
this other then being a server and doing a bind. Is there a simple example 
anywhere? I cant use the commoncpp TCPSocket, etc because they bind to the 
address. Please help, thanks!





From MAILER-DAEMON Mon Apr 26 15:24:17 2004
Received: from list by monty-python.gnu.org with archive (Exim 4.30)
	id 1BIBiC-0004rs-JQ
	for mharc-bug-commoncpp@gnu.org; Mon, 26 Apr 2004 15:24:16 -0400
Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30)
	id 1BIAiD-0003Ua-Kh
	for bug-commoncpp@gnu.org; Mon, 26 Apr 2004 14:20:13 -0400
Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30)
	id 1BIAg6-0002VP-SU
	for bug-commoncpp@gnu.org; Mon, 26 Apr 2004 14:18:35 -0400
Received: from [64.241.199.88] (helo=smtp-out.signia-idt.net)
	by monty-python.gnu.org with esmtp (Exim 4.30) id 1BIAfm-0002HZ-2D
	for bug-commoncpp@gnu.org; Mon, 26 Apr 2004 14:17:42 -0400
Received: from aego_exch2.signia-idt.net (aego_exch2.signia-idt.net
	[172.22.132.103])
	by smtp-out.signia-idt.net (8.12.11/8.12.10) with ESMTP id
	i3QIHWCI019013
	for <bug-commoncpp@gnu.org>; Mon, 26 Apr 2004 14:17:32 -0400 (EDT)
Received: by aego_exch2.signia-idt.net with Internet Mail Service (5.5.2657.72)
	id <284R6CZV>; Mon, 26 Apr 2004 14:18:55 -0400
Message-ID: <2C52593826C4D611A69F00508B60303F023C1BA6@aego_exch1.signia-idt.net>
From: "Surratt, Jason" <Jason.Surratt@drs-ss.com>
To: "'bug-commoncpp@gnu.org'" <bug-commoncpp@gnu.org>
Date: Mon, 26 Apr 2004 14:11:04 -0400
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2657.72)
Content-Type: multipart/alternative;
	boundary="----_=_NextPart_001_01C42BB9.D679B0E0"
X-Mailman-Approved-At: Mon, 26 Apr 2004 15:24:12 -0400
Subject: Problem when flow control is turned off in Windows
X-BeenThere: bug-commoncpp@gnu.org
X-Mailman-Version: 2.1.4
Precedence: list
List-Id: Bug reports for Common C++ <bug-commoncpp.gnu.org>
List-Unsubscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=unsubscribe>
List-Archive: <http://mail.gnu.org/pipermail/bug-commoncpp>
List-Post: <mailto:bug-commoncpp@gnu.org>
List-Help: <mailto:bug-commoncpp-request@gnu.org?subject=help>
List-Subscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 26 Apr 2004 18:43:51 -0000

This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_001_01C42BB9.D679B0E0
Content-Type: text/plain;
	charset="iso-8859-1"

 
This may be by design, but I thought I would point it out anyways.
 
I am trying to communicate with a device over the serial port with no
hardware flow control (setFlowControl(Serial::flowNone)). However, when I
use this command my serial port acts just as though hardware flow control is
enabled.
 
When poking around in the commoncpp2 source I noticed in the following
methods that the fOutxCtsFlow attribute was originally set to 1. This is
defined by Microsft as:
 
fOutxCtsFlow 
Specifies whether the CTS (clear-to-send) signal is monitored for output
flow control. If this member is TRUE and CTS is turned off, output is
suspended until CTS is sent again.
 
Since I want no flow control, I tried disabling the attribute (set to 0) and
it appears to have fixed my problem. I've included the modifications that I
made in serial.cpp at the bottom of the email.
 
Thanks for a great library and please let me know if I misunderstand the
intended use.
 
-jason
 
FYI I'm using Windows XP, MSVC 6 sp5 and commoncpp2-1.0.13 (although the
relevant source appears to be identical in v1.1.5).
 
...
void Serial::initConfig(void)
{
#ifdef WIN32
 
#define ASCII_XON       0x11
#define ASCII_XOFF      0x13
 
       DCB * attr = (DCB *)current;
       DCB * orig = (DCB *)original;
 
    attr->DCBlength = sizeof(DCB);
    orig->DCBlength = sizeof(DCB);
 
    GetCommState(dev, orig);
    GetCommState(dev, attr);
 
    attr->XonChar = ASCII_XON;
    attr->XoffChar = ASCII_XOFF;
    attr->XonLim = 100;
    attr->XoffLim = 100;
    attr->fOutxDsrFlow = 0;
    attr->fDtrControl = DTR_CONTROL_ENABLE;
    attr->fOutxCtsFlow = 0; // Changed from 1 to 0
    attr->fRtsControl = RTS_CONTROL_ENABLE;
    attr->fInX = attr->fOutX = 0;
 
    attr->fBinary = true;
    attr->fParity = true;
 
...
Serial::Error Serial::setFlowControl(Flow flow)
{
#ifdef WIN32
 
       DCB * attr = (DCB *)current;
    attr->XonChar = ASCII_XON;
    attr->XoffChar = ASCII_XOFF;
    attr->XonLim = 100;
    attr->XoffLim = 100;
 
       switch(flow)
       {
       case flowSoft:
              attr->fInX = attr->fOutX = 1;
              attr->fOutxCtsFlow = 0; // Added
              attr->fRtsControl = RTS_CONTROL_ENABLE; // Added
              break;
       case flowBoth:
              attr->fInX = attr->fOutX = 1;
       case flowHard:
              attr->fOutxCtsFlow = 1;
              attr->fRtsControl = RTS_CONTROL_HANDSHAKE;
              break;
       case flowNone:
              attr->fInX = attr->fOutX = 0;
attr->fOutxCtsFlow = 0; // Added 
              attr->fRtsControl = RTS_CONTROL_ENABLE; // Added
              break;
       default:
              return error(errFlowInvalid);
       }
 
       SetCommState(dev, attr);

------_=_NextPart_001_01C42BB9.D679B0E0
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<html xmlns:v=3D"urn:schemas-microsoft-com:vml" =
xmlns:o=3D"urn:schemas-microsoft-com:office:office" =
xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns=3D"http://www.w3.org/TR/REC-html40">

<head>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Diso-8859-1">


<meta name=3DProgId content=3DWord.Document>
<meta name=3DGenerator content=3D"Microsoft Word 9">
<meta name=3DOriginator content=3D"Microsoft Word 9">
<link rel=3DFile-List href=3D"cid:filelist.xml@01C42B99.384B0DD0">
<!--[if gte mso 9]><xml>
 <o:OfficeDocumentSettings>
  <o:DoNotRelyOnCSS/>
 </o:OfficeDocumentSettings>
</xml><![endif]--><!--[if gte mso 9]><xml>
 <w:WordDocument>
  <w:View>Normal</w:View>
  <w:Zoom>0</w:Zoom>
  <w:DocumentKind>DocumentEmail</w:DocumentKind>
  <w:EnvelopeVis/>
 </w:WordDocument>
</xml><![endif]-->
<style>
<!--
 /* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
	{mso-style-parent:"";
	margin:0in;
	margin-bottom:.0001pt;
	mso-pagination:widow-orphan;
	font-size:12.0pt;
	font-family:"Times New Roman";
	mso-fareast-font-family:"Times New Roman";}
p.MsoAutoSig, li.MsoAutoSig, div.MsoAutoSig
	{margin:0in;
	margin-bottom:.0001pt;
	mso-pagination:widow-orphan;
	font-size:12.0pt;
	font-family:"Times New Roman";
	mso-fareast-font-family:"Times New Roman";}
span.EmailStyle15
	{mso-style-type:personal-compose;
	mso-ansi-font-size:10.0pt;
	mso-ascii-font-family:Arial;
	mso-hansi-font-family:Arial;
	mso-bidi-font-family:Arial;
	color:black;}
@page Section1
	{size:8.5in 11.0in;
	margin:1.0in 1.25in 1.0in 1.25in;
	mso-header-margin:.5in;
	mso-footer-margin:.5in;
	mso-paper-source:0;}
div.Section1
	{page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext=3D"edit" spidmax=3D"1026"/>
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext=3D"edit">
  <o:idmap v:ext=3D"edit" data=3D"1"/>
 </o:shapelayout></xml><![endif]-->
</head>

<body lang=3DEN-US style=3D'tab-interval:.5in'>

<div class=3DSection1>

<p class=3DMsoNormal><span class=3DEmailStyle15><font size=3D1 =
color=3Dblack
face=3D"Courier New"><span =
style=3D'font-size:8.0pt;mso-bidi-font-size:12.0pt;
font-family:"Courier New"'><![if =
!supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></font></span></p>=


<p class=3DMsoNormal><span class=3DEmailStyle15><font size=3D1 =
color=3Dblack
face=3D"Courier New"><span =
style=3D'font-size:8.0pt;mso-bidi-font-size:12.0pt;
font-family:"Courier New"'>This may be by design, but I thought I would =
point
it out anyways.<o:p></o:p></span></font></span></p>

<p class=3DMsoNormal><span class=3DEmailStyle15><font size=3D1 =
color=3Dblack
face=3D"Courier New"><span =
style=3D'font-size:8.0pt;mso-bidi-font-size:12.0pt;
font-family:"Courier New"'><![if =
!supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></font></span></p>=


<p class=3DMsoNormal><span class=3DEmailStyle15><font size=3D1 =
color=3Dblack
face=3D"Courier New"><span =
style=3D'font-size:8.0pt;mso-bidi-font-size:12.0pt;
font-family:"Courier New"'>I am trying to communicate with a device =
over the
serial port with no hardware flow control =
(setFlowControl(Serial::flowNone)). However,
when I use this command my serial port acts just as though hardware =
flow
control is enabled.<o:p></o:p></span></font></span></p>

<p class=3DMsoNormal><span class=3DEmailStyle15><font size=3D1 =
color=3Dblack
face=3D"Courier New"><span =
style=3D'font-size:8.0pt;mso-bidi-font-size:12.0pt;
font-family:"Courier New"'><![if =
!supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></font></span></p>=


<p class=3DMsoNormal><span class=3DEmailStyle15><font size=3D1 =
color=3Dblack
face=3D"Courier New"><span =
style=3D'font-size:8.0pt;mso-bidi-font-size:12.0pt;
font-family:"Courier New"'>When poking around in the commoncpp2 source =
I
noticed in the following methods that the fOutxCtsFlow attribute was =
originally
set to 1. This is defined by Microsft as:<o:p></o:p></span></font></span=
></p>

<p class=3DMsoNormal><span class=3DEmailStyle15><font size=3D1 =
color=3Dblack
face=3D"Courier New"><span =
style=3D'font-size:8.0pt;mso-bidi-font-size:12.0pt;
font-family:"Courier New"'><![if =
!supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></font></span></p>=


<p class=3DMsoNormal><span class=3DEmailStyle15><font size=3D1 =
color=3Dblack
face=3D"Courier New"><span =
style=3D'font-size:8.0pt;mso-bidi-font-size:12.0pt;
font-family:"Courier New"'>fOutxCtsFlow =
<o:p></o:p></span></font></span></p>

<p class=3DMsoNormal><span class=3DEmailStyle15><font size=3D1 =
color=3Dblack
face=3D"Courier New"><span =
style=3D'font-size:8.0pt;mso-bidi-font-size:12.0pt;
font-family:"Courier New"'>Specifies whether the CTS (clear-to-send) =
signal is
monitored for output flow control. If this member is TRUE and CTS is =
turned
off, output is suspended until CTS is sent =
again.<o:p></o:p></span></font></span></p>

<p class=3DMsoNormal><span class=3DEmailStyle15><font size=3D1 =
color=3Dblack
face=3D"Courier New"><span =
style=3D'font-size:8.0pt;mso-bidi-font-size:12.0pt;
font-family:"Courier New"'><![if =
!supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></font></span></p>=


<p class=3DMsoNormal><span class=3DEmailStyle15><font size=3D1 =
color=3Dblack
face=3D"Courier New"><span =
style=3D'font-size:8.0pt;mso-bidi-font-size:12.0pt;
font-family:"Courier New"'>Since I want no flow control, I tried =
disabling the
attribute (set to 0) and it appears to have fixed my problem. =
I&#8217;ve included the
modifications that I made in serial.cpp at the bottom of the =
email.<o:p></o:p></span></font></span></p>

<p class=3DMsoNormal><span class=3DEmailStyle15><font size=3D1 =
color=3Dblack
face=3D"Courier New"><span =
style=3D'font-size:8.0pt;mso-bidi-font-size:12.0pt;
font-family:"Courier New"'><![if =
!supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></font></span></p>=


<p class=3DMsoNormal><span class=3DEmailStyle15><font size=3D1 =
color=3Dblack
face=3D"Courier New"><span =
style=3D'font-size:8.0pt;mso-bidi-font-size:12.0pt;
font-family:"Courier New"'>Thanks for a great library and please let me =
know if
I misunderstand the intended use.<o:p></o:p></span></font></span></p>

<p class=3DMsoNormal><span class=3DEmailStyle15><font size=3D1 =
color=3Dblack
face=3D"Courier New"><span =
style=3D'font-size:8.0pt;mso-bidi-font-size:12.0pt;
font-family:"Courier New"'><![if =
!supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></font></span></p>=


<p class=3DMsoNormal><span class=3DEmailStyle15><font size=3D1 =
color=3Dblack
face=3D"Courier New"><span =
style=3D'font-size:8.0pt;mso-bidi-font-size:12.0pt;
font-family:"Courier New"'>-jason<o:p></o:p></span></font></span></p>

<p class=3DMsoNormal><span class=3DEmailStyle15><font size=3D1 =
color=3Dblack
face=3D"Courier New"><span =
style=3D'font-size:8.0pt;mso-bidi-font-size:12.0pt;
font-family:"Courier New"'><![if =
!supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></font></span></p>=


<p class=3DMsoNormal><span class=3DEmailStyle15><font size=3D1 =
color=3Dblack
face=3D"Courier New"><span =
style=3D'font-size:8.0pt;mso-bidi-font-size:12.0pt;
font-family:"Courier New"'>FYI I&#8217;m using Windows XP, MSVC 6 sp5 =
and commoncpp2-1.0.13
(although the relevant source appears to be identical in =
v1.1.5).<o:p></o:p></span></font></span></p>

<p class=3DMsoNormal><span class=3DEmailStyle15><font size=3D1 =
color=3Dblack
face=3D"Courier New"><span =
style=3D'font-size:8.0pt;mso-bidi-font-size:12.0pt;
font-family:"Courier New"'><![if =
!supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></font></span></p>=


<p class=3DMsoNormal><span class=3DEmailStyle15><font size=3D1 =
color=3Dblack
face=3D"Courier New"><span =
style=3D'font-size:8.0pt;mso-bidi-font-size:12.0pt;
font-family:"Courier New"'>&#8230;<o:p></o:p></span></font></span></p>

<p class=3DMsoNormal><span class=3DEmailStyle15><font size=3D1 =
color=3Dblack
face=3D"Courier New"><span =
style=3D'font-size:8.0pt;mso-bidi-font-size:12.0pt;
font-family:"Courier New"'>void =
Serial::initConfig(void)<o:p></o:p></span></font></span></p>

<p class=3DMsoNormal><span class=3DEmailStyle15><font size=3D1 =
color=3Dblack
face=3D"Courier New"><span style=3D'font-size:8.0pt;mso-bidi-font-size:1=
2.0pt;
font-family:"Courier New"'>{<o:p></o:p></span></font></span></p>

<p class=3DMsoNormal><span class=3DEmailStyle15><font size=3D1 =
color=3Dblack
face=3D"Courier New"><span =
style=3D'font-size:8.0pt;mso-bidi-font-size:12.0pt;
font-family:"Courier New"'>#ifdef<span style=3D'mso-tab-count:1'> =
</span>WIN32<o:p></o:p></span></font></span></p>

<p class=3DMsoNormal><span class=3DEmailStyle15><font size=3D1 =
color=3Dblack
face=3D"Courier New"><span =
style=3D'font-size:8.0pt;mso-bidi-font-size:12.0pt;
font-family:"Courier New"'><![if =
!supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></font></span></p>=


<p class=3DMsoNormal><span class=3DEmailStyle15><font size=3D1 =
color=3Dblack
face=3D"Courier New"><span =
style=3D'font-size:8.0pt;mso-bidi-font-size:12.0pt;
font-family:"Courier New"'>#define ASCII_XON<span =
style=3D"mso-spacerun:
yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
</span>0x11<o:p></o:p></span></font></span></p>

<p class=3DMsoNormal><span class=3DEmailStyle15><font size=3D1 =
color=3Dblack
face=3D"Courier New"><span =
style=3D'font-size:8.0pt;mso-bidi-font-size:12.0pt;
font-family:"Courier New"'>#define ASCII_XOFF<span =
style=3D"mso-spacerun:
yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
</span>0x13<o:p></o:p></span></font></span></p>

<p class=3DMsoNormal><span class=3DEmailStyle15><font size=3D1 =
color=3Dblack
face=3D"Courier New"><span =
style=3D'font-size:8.0pt;mso-bidi-font-size:12.0pt;
font-family:"Courier New"'><![if =
!supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></font></span></p>=


<p class=3DMsoNormal><span class=3DEmailStyle15><font size=3D1 =
color=3Dblack
face=3D"Courier New"><span =
style=3D'font-size:8.0pt;mso-bidi-font-size:12.0pt;
font-family:"Courier New"'><span =
style=3D'mso-tab-count:1'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
</span>DCB
* attr =3D (DCB *)current;<o:p></o:p></span></font></span></p>

<p class=3DMsoNormal><span class=3DEmailStyle15><font size=3D1 =
color=3Dblack
face=3D"Courier New"><span =
style=3D'font-size:8.0pt;mso-bidi-font-size:12.0pt;
font-family:"Courier New"'><span =
style=3D'mso-tab-count:1'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
</span>DCB
* orig =3D (DCB *)original;<o:p></o:p></span></font></span></p>

<p class=3DMsoNormal><span class=3DEmailStyle15><font size=3D1 =
color=3Dblack
face=3D"Courier New"><span =
style=3D'font-size:8.0pt;mso-bidi-font-size:12.0pt;
font-family:"Courier New"'><![if =
!supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></font></span></p>=


<p class=3DMsoNormal><span class=3DEmailStyle15><font size=3D1 =
color=3Dblack
face=3D"Courier New"><span =
style=3D'font-size:8.0pt;mso-bidi-font-size:12.0pt;
font-family:"Courier New"'><span style=3D"mso-spacerun: =
yes">&nbsp;&nbsp;&nbsp;
</span>attr-&gt;DCBlength =3D =
sizeof(DCB);<o:p></o:p></span></font></span></p>

<p class=3DMsoNormal><span class=3DEmailStyle15><font size=3D1 =
color=3Dblack
face=3D"Courier New"><span =
style=3D'font-size:8.0pt;mso-bidi-font-size:12.0pt;
font-family:"Courier New"'><span style=3D"mso-spacerun: =
yes">&nbsp;&nbsp;&nbsp;
</span>orig-&gt;DCBlength =3D =
sizeof(DCB);<o:p></o:p></span></font></span></p>

<p class=3DMsoNormal><span class=3DEmailStyle15><font size=3D1 =
color=3Dblack
face=3D"Courier New"><span =
style=3D'font-size:8.0pt;mso-bidi-font-size:12.0pt;
font-family:"Courier New"'><![if =
!supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></font></span></p>=


<p class=3DMsoNormal><span class=3DEmailStyle15><font size=3D1 =
color=3Dblack
face=3D"Courier New"><span =
style=3D'font-size:8.0pt;mso-bidi-font-size:12.0pt;
font-family:"Courier New"'><span style=3D"mso-spacerun: =
yes">&nbsp;&nbsp;&nbsp;
</span>GetCommState(dev, orig);<o:p></o:p></span></font></span></p>

<p class=3DMsoNormal><span class=3DEmailStyle15><font size=3D1 =
color=3Dblack
face=3D"Courier New"><span =
style=3D'font-size:8.0pt;mso-bidi-font-size:12.0pt;
font-family:"Courier New"'><span style=3D"mso-spacerun: =
yes">&nbsp;&nbsp;&nbsp;
</span>GetCommState(dev, attr);<o:p></o:p></span></font></span></p>

<p class=3DMsoNormal><span class=3DEmailStyle15><font size=3D1 =
color=3Dblack
face=3D"Courier New"><span =
style=3D'font-size:8.0pt;mso-bidi-font-size:12.0pt;
font-family:"Courier New"'><![if =
!supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></font></span></p>=


<p class=3DMsoNormal><span class=3DEmailStyle15><font size=3D1 =
color=3Dblack
face=3D"Courier New"><span =
style=3D'font-size:8.0pt;mso-bidi-font-size:12.0pt;
font-family:"Courier New"'><span style=3D"mso-spacerun: =
yes">&nbsp;&nbsp;&nbsp;
</span>attr-&gt;XonChar =3D =
ASCII_XON;<o:p></o:p></span></font></span></p>

<p class=3DMsoNormal><span class=3DEmailStyle15><font size=3D1 =
color=3Dblack
face=3D"Courier New"><span =
style=3D'font-size:8.0pt;mso-bidi-font-size:12.0pt;
font-family:"Courier New"'><span style=3D"mso-spacerun: =
yes">&nbsp;&nbsp;&nbsp;
</span>attr-&gt;XoffChar =3D =
ASCII_XOFF;<o:p></o:p></span></font></span></p>

<p class=3DMsoNormal><span class=3DEmailStyle15><font size=3D1 =
color=3Dblack
face=3D"Courier New"><span =
style=3D'font-size:8.0pt;mso-bidi-font-size:12.0pt;
font-family:"Courier New"'><span style=3D"mso-spacerun: =
yes">&nbsp;&nbsp;&nbsp;
</span>attr-&gt;XonLim =3D 100;<o:p></o:p></span></font></span></p>

<p class=3DMsoNormal><span class=3DEmailStyle15><font size=3D1 =
color=3Dblack
face=3D"Courier New"><span =
style=3D'font-size:8.0pt;mso-bidi-font-size:12.0pt;
font-family:"Courier New"'><span style=3D"mso-spacerun: =
yes">&nbsp;&nbsp;&nbsp;
</span>attr-&gt;XoffLim =3D 100;<o:p></o:p></span></font></span></p>

<p class=3DMsoNormal><span class=3DEmailStyle15><font size=3D1 =
color=3Dblack
face=3D"Courier New"><span =
style=3D'font-size:8.0pt;mso-bidi-font-size:12.0pt;
font-family:"Courier New"'><span style=3D"mso-spacerun: =
yes">&nbsp;&nbsp;&nbsp;
</span>attr-&gt;fOutxDsrFlow =3D 0;<o:p></o:p></span></font></span></p>

<p class=3DMsoNormal><span class=3DEmailStyle15><font size=3D1 =
color=3Dblack
face=3D"Courier New"><span =
style=3D'font-size:8.0pt;mso-bidi-font-size:12.0pt;
font-family:"Courier New"'><span style=3D"mso-spacerun: =
yes">&nbsp;&nbsp;&nbsp;
</span>attr-&gt;fDtrControl =3D =
DTR_CONTROL_ENABLE;<o:p></o:p></span></font></span></p>

<p class=3DMsoNormal><span class=3DEmailStyle15><font size=3D1 =
color=3Dblack
face=3D"Courier New"><span =
style=3D'font-size:8.0pt;mso-bidi-font-size:12.0pt;
font-family:"Courier New"'><span style=3D"mso-spacerun: =
yes">&nbsp;&nbsp;&nbsp;
</span>attr-&gt;fOutxCtsFlow =3D 0; // Changed from 1 to =
0<o:p></o:p></span></font></span></p>

<p class=3DMsoNormal><span class=3DEmailStyle15><font size=3D1 =
color=3Dblack
face=3D"Courier New"><span =
style=3D'font-size:8.0pt;mso-bidi-font-size:12.0pt;
font-family:"Courier New"'><span style=3D"mso-spacerun: =
yes">&nbsp;&nbsp;&nbsp;
</span>attr-&gt;fRtsControl =3D =
RTS_CONTROL_ENABLE;<o:p></o:p></span></font></span></p>

<p class=3DMsoNormal><span class=3DEmailStyle15><font size=3D1 =
color=3Dblack
face=3D"Courier New"><span =
style=3D'font-size:8.0pt;mso-bidi-font-size:12.0pt;
font-family:"Courier New"'><span style=3D"mso-spacerun: =
yes">&nbsp;&nbsp;&nbsp;
</span>attr-&gt;fInX =3D attr-&gt;fOutX =3D =
0;<o:p></o:p></span></font></span></p>

<p class=3DMsoNormal><span class=3DEmailStyle15><font size=3D1 =
color=3Dblack
face=3D"Courier New"><span =
style=3D'font-size:8.0pt;mso-bidi-font-size:12.0pt;
font-family:"Courier New"'><![if =
!supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></font></span></p>=


<p class=3DMsoNormal><span class=3DEmailStyle15><font size=3D1 =
color=3Dblack
face=3D"Courier New"><span =
style=3D'font-size:8.0pt;mso-bidi-font-size:12.0pt;
font-family:"Courier New"'><span style=3D"mso-spacerun: =
yes">&nbsp;&nbsp;&nbsp;
</span>attr-&gt;fBinary =3D true;<o:p></o:p></span></font></span></p>

<p class=3DMsoNormal><span class=3DEmailStyle15><font size=3D1 =
color=3Dblack
face=3D"Courier New"><span =
style=3D'font-size:8.0pt;mso-bidi-font-size:12.0pt;
font-family:"Courier New"'><span style=3D"mso-spacerun: =
yes">&nbsp;&nbsp;&nbsp;
</span>attr-&gt;fParity =3D true;<o:p></o:p></span></font></span></p>

<p class=3DMsoNormal><span class=3DEmailStyle15><font size=3D1 =
color=3Dblack
face=3D"Courier New"><span =
style=3D'font-size:8.0pt;mso-bidi-font-size:12.0pt;
font-family:"Courier New"'><![if =
!supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></font></span></p>=


<p class=3DMsoNormal><span class=3DEmailStyle15><font size=3D1 =
color=3Dblack
face=3D"Courier New"><span =
style=3D'font-size:8.0pt;mso-bidi-font-size:12.0pt;
font-family:"Courier New"'>&#8230;<o:p></o:p></span></font></span></p>

<p class=3DMsoNormal><span class=3DEmailStyle15><font size=3D1 =
color=3Dblack
face=3D"Courier New"><span =
style=3D'font-size:8.0pt;mso-bidi-font-size:12.0pt;
font-family:"Courier New"'>Serial::Error Serial::setFlowControl(Flow =
flow)<o:p></o:p></span></font></span></p>

<p class=3DMsoNormal><span class=3DEmailStyle15><font size=3D1 =
color=3Dblack
face=3D"Courier New"><span =
style=3D'font-size:8.0pt;mso-bidi-font-size:12.0pt;
font-family:"Courier New"'>{<o:p></o:p></span></font></span></p>

<p class=3DMsoNormal><span class=3DEmailStyle15><font size=3D1 =
color=3Dblack
face=3D"Courier New"><span =
style=3D'font-size:8.0pt;mso-bidi-font-size:12.0pt;
font-family:"Courier New"'>#ifdef<span style=3D'mso-tab-count:1'> =
</span>WIN32<o:p></o:p></span></font></span></p>

<p class=3DMsoNormal><span class=3DEmailStyle15><font size=3D1 =
color=3Dblack
face=3D"Courier New"><span =
style=3D'font-size:8.0pt;mso-bidi-font-size:12.0pt;
font-family:"Courier New"'><![if =
!supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></font></span></p>=


<p class=3DMsoNormal><span class=3DEmailStyle15><font size=3D1 =
color=3Dblack
face=3D"Courier New"><span =
style=3D'font-size:8.0pt;mso-bidi-font-size:12.0pt;
font-family:"Courier New"'><span =
style=3D'mso-tab-count:1'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
</span>DCB
* attr =3D (DCB *)current;<o:p></o:p></span></font></span></p>

<p class=3DMsoNormal><span class=3DEmailStyle15><font size=3D1 =
color=3Dblack
face=3D"Courier New"><span =
style=3D'font-size:8.0pt;mso-bidi-font-size:12.0pt;
font-family:"Courier New"'><span style=3D"mso-spacerun: =
yes">&nbsp;&nbsp;&nbsp;
</span>attr-&gt;XonChar =3D =
ASCII_XON;<o:p></o:p></span></font></span></p>

<p class=3DMsoNormal><span class=3DEmailStyle15><font size=3D1 =
color=3Dblack
face=3D"Courier New"><span =
style=3D'font-size:8.0pt;mso-bidi-font-size:12.0pt;
font-family:"Courier New"'><span style=3D"mso-spacerun: =
yes">&nbsp;&nbsp;&nbsp;
</span>attr-&gt;XoffChar =3D =
ASCII_XOFF;<o:p></o:p></span></font></span></p>

<p class=3DMsoNormal><span class=3DEmailStyle15><font size=3D1 =
color=3Dblack
face=3D"Courier New"><span =
style=3D'font-size:8.0pt;mso-bidi-font-size:12.0pt;
font-family:"Courier New"'><span style=3D"mso-spacerun: =
yes">&nbsp;&nbsp;&nbsp;
</span>attr-&gt;XonLim =3D 100;<o:p></o:p></span></font></span></p>

<p class=3DMsoNormal><span class=3DEmailStyle15><font size=3D1 =
color=3Dblack
face=3D"Courier New"><span =
style=3D'font-size:8.0pt;mso-bidi-font-size:12.0pt;
font-family:"Courier New"'><span style=3D"mso-spacerun: =
yes">&nbsp;&nbsp;&nbsp;
</span>attr-&gt;XoffLim =3D 100;<o:p></o:p></span></font></span></p>

<p class=3DMsoNormal><span class=3DEmailStyle15><font size=3D1 =
color=3Dblack
face=3D"Courier New"><span =
style=3D'font-size:8.0pt;mso-bidi-font-size:12.0pt;
font-family:"Courier New"'><![if =
!supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></font></span></p>=


<p class=3DMsoNormal><span class=3DEmailStyle15><font size=3D1 =
color=3Dblack
face=3D"Courier New"><span =
style=3D'font-size:8.0pt;mso-bidi-font-size:12.0pt;
font-family:"Courier New"'><span =
style=3D'mso-tab-count:1'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
</span>switch(flow)<o:p></o:p></span></font></span></p>

<p class=3DMsoNormal><span class=3DEmailStyle15><font size=3D1 =
color=3Dblack
face=3D"Courier New"><span =
style=3D'font-size:8.0pt;mso-bidi-font-size:12.0pt;
font-family:"Courier New"'><span =
style=3D'mso-tab-count:1'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
</span>{<o:p></o:p></span></font></span></p>

<p class=3DMsoNormal><span class=3DEmailStyle15><font size=3D1 =
color=3Dblack
face=3D"Courier New"><span =
style=3D'font-size:8.0pt;mso-bidi-font-size:12.0pt;
font-family:"Courier New"'><span =
style=3D'mso-tab-count:1'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
</span>case
flowSoft:<o:p></o:p></span></font></span></p>

<p class=3DMsoNormal><span class=3DEmailStyle15><font size=3D1 =
color=3Dblack
face=3D"Courier New"><span =
style=3D'font-size:8.0pt;mso-bidi-font-size:12.0pt;
font-family:"Courier New"'><span =
style=3D'mso-tab-count:2'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>attr-&gt;fInX
=3D attr-&gt;fOutX =3D 1;<o:p></o:p></span></font></span></p>

<p class=3DMsoNormal><span class=3DEmailStyle15><font size=3D1 =
color=3Dblack
face=3D"Courier New"><span =
style=3D'font-size:8.0pt;mso-bidi-font-size:12.0pt;
font-family:"Courier New"'><span =
style=3D'mso-tab-count:2'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>attr-&gt;fOutxCtsFlow
=3D 0; // Added<o:p></o:p></span></font></span></p>

<p class=3DMsoNormal><span class=3DEmailStyle15><font size=3D1 =
color=3Dblack
face=3D"Courier New"><span =
style=3D'font-size:8.0pt;mso-bidi-font-size:12.0pt;
font-family:"Courier New"'><span =
style=3D'mso-tab-count:2'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>attr-&gt;fRtsControl
=3D RTS_CONTROL_ENABLE; // Added<o:p></o:p></span></font></span></p>

<p class=3DMsoNormal><span class=3DEmailStyle15><font size=3D1 =
color=3Dblack
face=3D"Courier New"><span =
style=3D'font-size:8.0pt;mso-bidi-font-size:12.0pt;
font-family:"Courier New"'><span =
style=3D'mso-tab-count:2'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
</span>break;<o:p></o:p></span></font></span></p>

<p class=3DMsoNormal><span class=3DEmailStyle15><font size=3D1 =
color=3Dblack
face=3D"Courier New"><span =
style=3D'font-size:8.0pt;mso-bidi-font-size:12.0pt;
font-family:"Courier New"'><span =
style=3D'mso-tab-count:1'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
</span>case
flowBoth:<o:p></o:p></span></font></span></p>

<p class=3DMsoNormal><span class=3DEmailStyle15><font size=3D1 =
color=3Dblack
face=3D"Courier New"><span =
style=3D'font-size:8.0pt;mso-bidi-font-size:12.0pt;
font-family:"Courier New"'><span =
style=3D'mso-tab-count:2'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>attr-&gt;fInX
=3D attr-&gt;fOutX =3D 1;<o:p></o:p></span></font></span></p>

<p class=3DMsoNormal><span class=3DEmailStyle15><font size=3D1 =
color=3Dblack
face=3D"Courier New"><span =
style=3D'font-size:8.0pt;mso-bidi-font-size:12.0pt;
font-family:"Courier New"'><span =
style=3D'mso-tab-count:1'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
</span>case
flowHard:<o:p></o:p></span></font></span></p>

<p class=3DMsoNormal><span class=3DEmailStyle15><font size=3D1 =
color=3Dblack
face=3D"Courier New"><span =
style=3D'font-size:8.0pt;mso-bidi-font-size:12.0pt;
font-family:"Courier New"'><span =
style=3D'mso-tab-count:2'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>attr-&gt;fOutxCtsFlow
=3D 1;<o:p></o:p></span></font></span></p>

<p class=3DMsoNormal><span class=3DEmailStyle15><font size=3D1 =
color=3Dblack
face=3D"Courier New"><span =
style=3D'font-size:8.0pt;mso-bidi-font-size:12.0pt;
font-family:"Courier New"'><span =
style=3D'mso-tab-count:2'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>attr-&gt;fRtsControl
=3D RTS_CONTROL_HANDSHAKE;<o:p></o:p></span></font></span></p>

<p class=3DMsoNormal><span class=3DEmailStyle15><font size=3D1 =
color=3Dblack
face=3D"Courier New"><span =
style=3D'font-size:8.0pt;mso-bidi-font-size:12.0pt;
font-family:"Courier New"'><span =
style=3D'mso-tab-count:2'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
</span>break;<o:p></o:p></span></font></span></p>

<p class=3DMsoNormal><span class=3DEmailStyle15><font size=3D1 =
color=3Dblack
face=3D"Courier New"><span =
style=3D'font-size:8.0pt;mso-bidi-font-size:12.0pt;
font-family:"Courier New"'><span =
style=3D'mso-tab-count:1'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
</span>case
flowNone:<o:p></o:p></span></font></span></p>

<p class=3DMsoNormal><span class=3DEmailStyle15><font size=3D1 =
color=3Dblack
face=3D"Courier New"><span =
style=3D'font-size:8.0pt;mso-bidi-font-size:12.0pt;
font-family:"Courier New"'><span =
style=3D'mso-tab-count:2'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>attr-&gt;fInX
=3D attr-&gt;fOutX =3D 0;<o:p></o:p></span></font></span></p>

<p class=3DMsoNormal style=3D'margin-left:.5in;text-indent:.5in'><span
class=3DEmailStyle15><font size=3D1 color=3Dblack face=3D"Courier =
New"><span
style=3D'font-size:8.0pt;mso-bidi-font-size:12.0pt;font-family:"Courier =
New"'>attr-&gt;fOutxCtsFlow
=3D 0; // Added <o:p></o:p></span></font></span></p>

<p class=3DMsoNormal><span class=3DEmailStyle15><font size=3D1 =
color=3Dblack
face=3D"Courier New"><span =
style=3D'font-size:8.0pt;mso-bidi-font-size:12.0pt;
font-family:"Courier New"'><span =
style=3D'mso-tab-count:2'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>attr-&gt;fRtsControl
=3D RTS_CONTROL_ENABLE; // Added<o:p></o:p></span></font></span></p>

<p class=3DMsoNormal><span class=3DEmailStyle15><font size=3D1 =
color=3Dblack
face=3D"Courier New"><span =
style=3D'font-size:8.0pt;mso-bidi-font-size:12.0pt;
font-family:"Courier New"'><span =
style=3D'mso-tab-count:2'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
</span>break;<o:p></o:p></span></font></span></p>

<p class=3DMsoNormal><span class=3DEmailStyle15><font size=3D1 =
color=3Dblack
face=3D"Courier New"><span =
style=3D'font-size:8.0pt;mso-bidi-font-size:12.0pt;
font-family:"Courier New"'><span =
style=3D'mso-tab-count:1'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
</span>default:<o:p></o:p></span></font></span></p>

<p class=3DMsoNormal><span class=3DEmailStyle15><font size=3D1 =
color=3Dblack
face=3D"Courier New"><span =
style=3D'font-size:8.0pt;mso-bidi-font-size:12.0pt;
font-family:"Courier New"'><span =
style=3D'mso-tab-count:2'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>return
error(errFlowInvalid);<o:p></o:p></span></font></span></p>

<p class=3DMsoNormal><span class=3DEmailStyle15><font size=3D1 =
color=3Dblack
face=3D"Courier New"><span =
style=3D'font-size:8.0pt;mso-bidi-font-size:12.0pt;
font-family:"Courier New"'><span =
style=3D'mso-tab-count:1'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
</span>}<o:p></o:p></span></font></span></p>

<p class=3DMsoNormal><span class=3DEmailStyle15><font size=3D1 =
color=3Dblack
face=3D"Courier New"><span =
style=3D'font-size:8.0pt;mso-bidi-font-size:12.0pt;
font-family:"Courier New"'><![if =
!supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></font></span></p>=


<p class=3DMsoNormal><span class=3DEmailStyle15><font size=3D1 =
color=3Dblack
face=3D"Courier New"><span =
style=3D'font-size:8.0pt;mso-bidi-font-size:12.0pt;
font-family:"Courier New"'><span =
style=3D'mso-tab-count:1'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
</span>SetCommState(dev,
attr);<o:p></o:p></span></font></span></p>

</div>

</body>

</html>

------_=_NextPart_001_01C42BB9.D679B0E0--



From MAILER-DAEMON Thu Apr 29 09:17:52 2004
Received: from list by monty-python.gnu.org with archive (Exim 4.30)
	id 1BJBQF-0004ds-B1
	for mharc-bug-commoncpp@gnu.org; Thu, 29 Apr 2004 09:17:51 -0400
Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30)
	id 1BJBQ8-0004av-Lx
	for bug-commoncpp@gnu.org; Thu, 29 Apr 2004 09:17:44 -0400
Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30)
	id 1BJBPW-0004Oc-ME
	for bug-commoncpp@gnu.org; Thu, 29 Apr 2004 09:17:37 -0400
Received: from [213.165.64.20] (helo=mail.gmx.net)
	by monty-python.gnu.org with smtp (Exim 4.30) id 1BJBPV-0004NR-Pd
	for bug-commoncpp@gnu.org; Thu, 29 Apr 2004 09:17:05 -0400
Received: (qmail 27970 invoked by uid 65534); 29 Apr 2004 13:17:03 -0000
Received: from pD95D37FE.dip.t-dialin.net (EHLO gate.home) (217.93.55.254)
	by mail.gmx.net (mp018) with SMTP; 29 Apr 2004 15:17:03 +0200
X-Authenticated: #482760
Received: from crunch2.home ([192.168.1.10])
	by gate.home with esmtp (Exim 3.35 #1 (Debian)) id 1BJBPT-0000Ck-00
	for <bug-commoncpp@gnu.org>; Thu, 29 Apr 2004 15:17:03 +0200
From: Onno Kortmann <onno@gmx.net>
To: bug-commoncpp@gnu.org
Date: Thu, 29 Apr 2004 15:17:02 +0200
User-Agent: KMail/1.5.4
MIME-Version: 1.0
Content-Type: Multipart/Mixed;
  boundary="Boundary-00=_OBQkAQbdFm9/FDR"
Message-Id: <200404291517.02646.onno@gmx.net>
Subject: Statically linked ELF, Process::detach() and serial port settings,
	statically initialized ttystream
X-BeenThere: bug-commoncpp@gnu.org
X-Mailman-Version: 2.1.4
Precedence: list
List-Id: Bug reports for Common C++ <bug-commoncpp.gnu.org>
List-Unsubscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=unsubscribe>
List-Archive: <http://mail.gnu.org/pipermail/bug-commoncpp>
List-Post: <mailto:bug-commoncpp@gnu.org>
List-Help: <mailto:bug-commoncpp-request@gnu.org?subject=help>
List-Subscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=subscribe>
X-List-Received-Date: Thu, 29 Apr 2004 13:17:47 -0000


--Boundary-00=_OBQkAQbdFm9/FDR
Content-Type: text/plain;
  charset="us-ascii"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Hi,

I wrote a small program that uses the serial port at 2400,8,n,1 to speak to a 
homebrewed microcontroller device and can/should be used as a daemon. Using 
the "ttystream" class with the extended initialization string (i.e. 
"/dev/ttyS2:2400,8,n,1") works without any problems, but only until I issue a 
Process::detach(). This seems to reset the port to 9600 baud or whatever it's 
initial setting was.

The bug depends on a statically initialized ttystream. Maybe I overlooked 
something, but I didn't found anything in the docs (neither "the c++ 
programming language" nor the common c++ docs) which states that statically 
initialized iostream objects are forbidden.

I run the program as root under linux-2.4.18. I'm linking statically with 
these compile commands (because development box != box in production use for 
this case):

g++ -g -Wall `ccgnu2-config --flags` -c baudtest.cc
g++ -static -o baudtest baudtest.o `ccgnu2-config --gnulibs --extlibs`

With this warning message (I ignored it because it seems to be really 
unrelated):
/usr/lib/libccgnu2.a(inaddr.o)(.text+0x105b): In function 
`ost::InetAddress::getHostname() const':
: warning: Using 'gethostbyaddr_r' in statically linked applications requires 
at runtime the shared libraries from the glibc version used for linking
/usr/lib/libccgnu2.a(inaddr.o)(.text+0xc30): In function 
`ost::InetAddress::setAddress(char const*)':
: warning: Using 'gethostbyname_r' in statically linked applications requires 
at runtime the shared libraries from the glibc version used for linking

My libcommonc++2 version is the newest from testing/unstable:
ii  libcommoncpp2- 1.0.13-3       Header files and static libraries for Common

Attached is a short test program that works as expected only non-daemon mode 
(no cmdline arguments given).

Admitted, the above is a somewhat weird configuration :) But a library should 
work as expected also under weird conditions - therefore I report this as a 
bug.

Best regards,

Onno

--Boundary-00=_OBQkAQbdFm9/FDR
Content-Type: text/x-c++src;
  charset="us-ascii";
  name="baudtest.cc"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="baudtest.cc"

#include <cc++/cmdoptns.h>
#include <cc++/process.h>
#include <cc++/slog.h>
#include <cc++/serial.h>

using namespace std;
using namespace ost;

static ttystream tty;

int main(int argc) {
	bool daemonize=argc>1;
	cout << "Running as daemon: " << daemonize << endl;
	tty.open("/dev/ttyS2:2400,8,n,1");
	if (daemonize) Process::detach();
	for (int n=0; n < 60; n++) {
		tty << "s0" << endl;
		sleep(1);
		tty << "s1" << endl;
	}
	return 0;
}

--Boundary-00=_OBQkAQbdFm9/FDR--




From MAILER-DAEMON Thu Apr 29 10:52:14 2004
Received: from list by monty-python.gnu.org with archive (Exim 4.30)
	id 1BJCQF-0000o9-FM
	for mharc-bug-commoncpp@gnu.org; Thu, 29 Apr 2004 10:21:55 -0400
Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30)
	id 1BJCQ7-0000n4-Ol
	for bug-commoncpp@gnu.org; Thu, 29 Apr 2004 10:21:47 -0400
Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30)
	id 1BJCPY-0000dw-5o
	for bug-commoncpp@gnu.org; Thu, 29 Apr 2004 10:21:44 -0400
Received: from [216.218.222.122] (helo=mail.ostel.com)
	by monty-python.gnu.org with esmtp (Exim 4.30) id 1BJCPX-0000d7-Hw
	for bug-commoncpp@gnu.org; Thu, 29 Apr 2004 10:21:11 -0400
Received: by mail.ostel.com (Postfix, from userid 1005)
	id 26EE32F2883; Thu, 29 Apr 2004 07:24:32 -0700 (PDT)
Received: from [192.168.1.102] (pool-68-239-129-223.nwrk.east.verizon.net
	[68.239.129.223]) by mail.ostel.com (Postfix) with ESMTP
	id ACE0E2F2867; Thu, 29 Apr 2004 07:24:24 -0700 (PDT)
From: David Sugar <dyfet@ostel.com>
To: bug-commoncpp@gnu.org
Date: Thu, 29 Apr 2004 10:21:01 -0400
User-Agent: KMail/1.6.2
References: <200404291517.02646.onno@gmx.net>
In-Reply-To: <200404291517.02646.onno@gmx.net>
MIME-Version: 1.0
Content-Disposition: inline
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Message-Id: <200404291021.01328.dyfet@ostel.com>
Cc: 
Subject: Re: Statically linked ELF,
	Process::detach() and serial port settings,
	statically initialized ttystream
X-BeenThere: bug-commoncpp@gnu.org
X-Mailman-Version: 2.1.4
Precedence: list
List-Id: Bug reports for Common C++ <bug-commoncpp.gnu.org>
List-Unsubscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=unsubscribe>
List-Archive: <http://mail.gnu.org/pipermail/bug-commoncpp>
List-Post: <mailto:bug-commoncpp@gnu.org>
List-Help: <mailto:bug-commoncpp-request@gnu.org?subject=help>
List-Subscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=subscribe>
X-List-Received-Date: Thu, 29 Apr 2004 14:21:48 -0000

Detach performs a "fork".  I recall there is a fcntl which controls "close on 
exec", but is there a reset behavior for "fork" of an open tty device or some 
odd controlling terminal behavior being invoked since the original 
controlling terminal was dismissed and this device is open and available to 
"become" a controlling terminal?  Perhaps we need to add a ioctl(dev, 
TIOCNOTTY, NULL) after the device is opened in ttystream to assure it cannot 
become a controlling terminal when the console is dropped in detach?

On Thursday 29 April 2004 09:17 am, Onno Kortmann wrote:
> Hi,
>
> I wrote a small program that uses the serial port at 2400,8,n,1 to speak to
> a homebrewed microcontroller device and can/should be used as a daemon.
> Using the "ttystream" class with the extended initialization string (i.e.
> "/dev/ttyS2:2400,8,n,1") works without any problems, but only until I issue
> a Process::detach(). This seems to reset the port to 9600 baud or whatever
> it's initial setting was.
>
> The bug depends on a statically initialized ttystream. Maybe I overlooked
> something, but I didn't found anything in the docs (neither "the c++
> programming language" nor the common c++ docs) which states that statically
> initialized iostream objects are forbidden.
>
> I run the program as root under linux-2.4.18. I'm linking statically with
> these compile commands (because development box != box in production use
> for this case):
>
> g++ -g -Wall `ccgnu2-config --flags` -c baudtest.cc
> g++ -static -o baudtest baudtest.o `ccgnu2-config --gnulibs --extlibs`
>
> With this warning message (I ignored it because it seems to be really
> unrelated):
> /usr/lib/libccgnu2.a(inaddr.o)(.text+0x105b): In function
>
> `ost::InetAddress::getHostname() const':
> : warning: Using 'gethostbyaddr_r' in statically linked applications
> : requires
>
> at runtime the shared libraries from the glibc version used for linking
> /usr/lib/libccgnu2.a(inaddr.o)(.text+0xc30): In function
>
> `ost::InetAddress::setAddress(char const*)':
> : warning: Using 'gethostbyname_r' in statically linked applications
> : requires
>
> at runtime the shared libraries from the glibc version used for linking
>
> My libcommonc++2 version is the newest from testing/unstable:
> ii  libcommoncpp2- 1.0.13-3       Header files and static libraries for
> Common
>
> Attached is a short test program that works as expected only non-daemon
> mode (no cmdline arguments given).
>
> Admitted, the above is a somewhat weird configuration :) But a library
> should work as expected also under weird conditions - therefore I report
> this as a bug.
>
> Best regards,
>
> Onno



