Bug 2508 - Attributes are not correctly read with RawTextConfig
Attributes are not correctly read with RawTextConfig
Status: RESOLVED DUPLICATE of bug 2507
Product: ns-3
Classification: Unclassified
Component: config-store
ns-3-dev
All All
: P5 minor
Assigned To: ns-bugs
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2016-09-21 17:35 EDT by Tommaso Pecorella
Modified: 2016-09-21 17:48 EDT (History)
1 user (show)

See Also:


Attachments
test case (1.09 KB, text/x-csrc)
2016-09-21 17:35 EDT, Tommaso Pecorella
Details
input for the test case (102 bytes, text/plain)
2016-09-21 17:36 EDT, Tommaso Pecorella
Details
patch (446 bytes, patch)
2016-09-21 17:36 EDT, Tommaso Pecorella
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tommaso Pecorella 2016-09-21 17:35:27 EDT
Robert Schmidt reported the problem here:
https://groups.google.com/forum/#!topic/ns-3-users/zMEMJ7vPORY

The bug is evident: if you use ConfigureDefaults before ConfigureAttributes the first will read the whole file, leaving the stream with the eof bit set.
Since seekg(0) doesn't clear the eof bit (in c++99, in c++11 it does), the file is not rewinded and the attributes are not read.

Solution: clear the eof bit.

Credits to Robert Schmidt for finding this and providing a solution.
Comment 1 Tommaso Pecorella 2016-09-21 17:35:50 EDT
Created attachment 2590 [details]
test case
Comment 2 Tommaso Pecorella 2016-09-21 17:36:09 EDT
Created attachment 2591 [details]
input for the test case
Comment 3 Tommaso Pecorella 2016-09-21 17:36:34 EDT
Created attachment 2592 [details]
patch
Comment 4 Tommaso Pecorella 2016-09-21 17:48:18 EDT

*** This bug has been marked as a duplicate of bug 2507 ***