Bug 2508

Summary: Attributes are not correctly read with RawTextConfig
Product: ns-3 Reporter: Tommaso Pecorella <tommaso.pecorella>
Component: config-storeAssignee: ns-bugs <ns-bugs>
Status: RESOLVED DUPLICATE    
Severity: minor CC: pdbarnes
Priority: P5    
Version: ns-3-dev   
Hardware: All   
OS: All   
See Also: https://www.nsnam.org/bugzilla/show_bug.cgi?id=2507
Attachments: test case
input for the test case
patch

Description Tommaso Pecorella 2016-09-21 17:35:27 UTC
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 UTC
Created attachment 2590 [details]
test case
Comment 2 Tommaso Pecorella 2016-09-21 17:36:09 UTC
Created attachment 2591 [details]
input for the test case
Comment 3 Tommaso Pecorella 2016-09-21 17:36:34 UTC
Created attachment 2592 [details]
patch
Comment 4 Tommaso Pecorella 2016-09-21 17:48:18 UTC

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