[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#115978: marked as done (stringstream adds extra characters at the end (forwarded from libstdc++2.10-dev))



Your message dated Sun, 23 Dec 2001 23:55:10 +0100
with message-id <15398.24782.865605.282986@gargle.gargle.HOWL>
and subject line fixed in libstdc++2.10-glibc2.2-2.95.4-0.011223
has caused the attached Bug report to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what I am
talking about this indicates a serious mail system misconfiguration
somewhere.  Please contact me immediately.)

Debian bug tracking system administrator
(administrator, Debian Bugs database)

--------------------------------------
Received: (at submit) by bugs.debian.org; 17 Oct 2001 15:06:39 +0000
>From jeh@profitlogic.com Wed Oct 17 10:06:39 2001
Return-path: <jeh@profitlogic.com>
Received: from (mail.grossprofit.com) [12.151.134.178] 
	by master.debian.org with esmtp (Exim 3.12 1 (Debian))
	id 15tsHG-0007bI-00; Wed, 17 Oct 2001 10:06:38 -0500
Received: from profitlogic.com (godel.grossprofit.com [10.0.2.69]) by mail.grossprofit.com with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2653.13)
	id 4G4NW428; Wed, 17 Oct 2001 11:06:08 -0400
Message-ID: <3BCD9E60.5060709@profitlogic.com>
Date: Wed, 17 Oct 2001 11:06:08 -0400
From: Justin Hahn <jeh@profitlogic.com>
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.5) Gecko/20011015
X-Accept-Language: en
MIME-Version: 1.0
To: submit@bugs.debian.org
Subject: stringstream adds extra characters at the end (forwarded from libstdc++2.10-dev)
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
Delivered-To: submit@bugs.debian.org

Package: libstdc++2.10-glibc2.2
Version: 2.95.4-0.011006
Severity: critical

One of my users reported the following as Bug #109073. Unfortunately, he 
reported it to libstdc++-dev, not realizing this is a code and not a 
header issue. This is most likely an upstream problem. It is also 
CRITICAL as it is preventing us from updating development systems (we're 
stuck at 2.95.4-010424). While the original report was against 
2.95.4-010810 we've been experiencing with this with every version newer 
than 2.95.4-010424.

The original message follows this line:
------------------------------------------------------------------------





When I upgraded from 2.95.4-0.010424, I found that code which used
stringstreams (or istringstreams or ostringstreams) broke.  In
particular, I find that extra characters are added to the end of the
stream which complicate reading and writing.  For example, I wrote the
following program:

------------------------------------------------------------------------
#include <sstream>
#include <iostream>

void
writer(int i)
{
    static stringstream sstr;

    // shove some stuff into the stringstream
    sstr << "This is a fubar test. " << i;
    sstr.unsetf(ios::skipws);   // keep spaces

    char c = 'Q'; // A throwaway that appears nowhere in the message
    while (sstr >> c)
    {
        // print out each character and its hex representation.  It
        // should stop printing out when the end of the string is
        // reached.
        cout << c << "[" << hex << static_cast<int>(c) << "] ";
        c = 'Q';
    }
    cout << "\n----------------" << endl ;

    // reset the stringstream after it has gone out of good state
    sstr.clear();
}

int 
main()
{
    for (int i = 0; i != 2; ++i)
    {
        writer(i);
    }
    
    return 0;
}
------------------------------------------------------------------------



which returns the following under 2.95.4-0.010810:

------------------------------------------------------------------------
T:54 h:68 i:69 s:73  :20 i:69 s:73  :20 a:61  :20 f:66 u:75 b:62 a:61 r:72  :20 t:74 e:65 s:73 t:74 .:2e  :20 0:30 :0 :0 :0 :0 :0 :0 :0 :0 
----------------
a:61  :20 f:66 u:75 b:62 a:61 r:72  :20 t:74 e:65 s:73 t:74 .:2e  :20 1:31 :0 :0 :0 :0 :0 :0 :0 :0 :0 :0 :0 :0 :0 :0 :0 :0 :0 
----------------
------------------------------------------------------------------------



while 2.95.4-0.010424 gives the correct (I think):

------------------------------------------------------------------------
T:54 h:68 i:69 s:73  :20 i:69 s:73  :20 a:61  :20 f:66 u:75 b:62 a:61 r:72  :20 t:74 e:65 s:73 t:74 .:2e  :20 0:30 
----------------
T:54 h:68 i:69 s:73  :20 i:69 s:73  :20 a:61  :20 f:66 u:75 b:62 a:61 r:72  :20 t:74 e:65 s:73 t:74 .:2e  :20 1:31 
----------------
------------------------------------------------------------------------



Note the trailing null characters in the 2.95.4-0.010810 version, and
notice also that the number of trailing nulls in the first half of the
output (8) exactly corresponds to the number of characters missing
from the string in the second half ("This is ").


Note that other tests we have done involving streaming in and out
numerical types have resulted in non-null characters being added at
the end.  It is not only nulls which can be added, although only nulls
seem to be added in this particular case.



I am submitting this to Debian rather than to gcc since it is not
obvious to me whether this is a problem with the packaging or the
source.  If the latter, would you please forward this report to the
gcc folks?

Thanks.

Dan Katz






---------------------------------------
Received: (at 109073-done) by bugs.debian.org; 23 Dec 2001 23:00:16 +0000
>From doko@cs.tu-berlin.de Sun Dec 23 17:00:16 2001
Return-path: <doko@cs.tu-berlin.de>
Received: from mail.cs.tu-berlin.de [130.149.17.13] (root)
	by master.debian.org with esmtp (Exim 3.12 1 (Debian))
	id 16IHbM-0003vx-00; Sun, 23 Dec 2001 17:00:16 -0600
Received: from bolero.cs.tu-berlin.de (doko@bolero.cs.tu-berlin.de [130.149.19.1])
	by mail.cs.tu-berlin.de (8.9.3/8.9.3) with ESMTP id XAA11309;
	Sun, 23 Dec 2001 23:55:11 +0100 (MET)
Received: (from doko@localhost)
	by bolero.cs.tu-berlin.de (8.10.2+Sun/8.9.3) id fBNMtBo28770;
	Sun, 23 Dec 2001 23:55:11 +0100 (MET)
From: Matthias Klose <doko@cs.tu-berlin.de>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Message-ID: <15398.24782.865605.282986@gargle.gargle.HOWL>
Date: Sun, 23 Dec 2001 23:55:10 +0100
To: 109073-done@bugs.debian.org, 115978-done@bugs.debian.org
Subject: fixed in libstdc++2.10-glibc2.2-2.95.4-0.011223
X-Mailer: VM 6.89 under 21.1 (patch 14) "Cuyahoga Valley" XEmacs Lucid
Delivered-To: 109073-done@bugs.debian.org

gcc-2.95 (2.95.4.ds7-0.011223) unstable; urgency=medium

  * Undo debian/patches/libstdc++-sstream.dpatch. Closes #109073, #115978.
    Reopens #92524, #100571. The patch breaks debian/bugs/bug-115978.cc.



Reply to: