Bugzilla – Bug 2507
ConfigStore RawTextConfigLoad doesn't reset stream error state
Last modified: 2016-09-27 19:54:48 EDT
From Robert Schmidt via the users' list: Hi all, I have problems using the ConfigStore. I guess it is a bug, but maybe I am using it wrong. I am on ns3-dev. The problem occurs when trying to configure my model via ConfigStore::ConfigureAttributes () after having called ConfigStore::ConfigureDefaults () as explained here [1]. I attached a sample script that illustrates this, config-test.cc (it is based on first.cc from the tutorial, I did not manage to produce an easier one). When running the script without setting any parameters, the server pings three times back (enable the UdpEchoServerApplication logging component). Now, via a config in raw mode I set the StartTime of the UdpEchoClient to two seconds. I'd expect that the server starts to respond from 2s onwards. This is not the case. By setting the RawTextConfig logging component one can see that upon calling RawTextConfigLoad::Attributes (), nothing happens. Indeed the reset of the file error flags is not called like in RawTextConfigLoad::Default (). By adding m_is->clear (); to the begging of RawTextConfigLoad::Attributes () it parses the file correctly and the UdpEchoClient behaves correctly. Is this a real bug or am I missing something? I attached a patch adding this one line. Robert [1] https://www.nsnam.org/wiki/HOWTO_use_the_ConfigStore
Created attachment 2586 [details] Proposed patch
Created attachment 2587 [details] test program
Created attachment 2588 [details] input file for test program
Created attachment 2589 [details] Revised test program Revised test program to simplify invocation: - set ConfigStore defaults - turn on logging for UdpEchoServerApplication ./waf --run config-test
*** Bug 2508 has been marked as a duplicate of this bug. ***
(In reply to Tommaso Pecorella from comment #5) > *** Bug 2508 has been marked as a duplicate of this bug. *** In my opinion this could be safely pushed. I'd also say to indicate Robert Schmidt <rschmi@gmx.net> as the patch author.
Wrt > Since seekg(0) doesn't clear the eof bit (in c++99, in c++11 it does) Since we have --std=c++11 I'm puzzled why this cropped up at all?
Well, according to http://www.cplusplus.com/reference/istream/istream/seekg/ it should. Perhaps some compilers aren't yet very pedantic about these small details. (In reply to Peter Barnes from comment #7) > Wrt > > > Since seekg(0) doesn't clear the eof bit (in c++99, in c++11 it does) > > Since we have --std=c++11 I'm puzzled why this cropped up at all?
Pushed in 12337 e37de7f82ed2