Bug 1204

Summary: Can't Parse Time +100000000.0ns
Product: ns-3 Reporter: Nicola Baldo <nicola>
Component: coreAssignee: Mitch Watrous <watrous>
Status: RESOLVED FIXED    
Severity: normal CC: mathieu.lacage, ns-bugs
Priority: P5    
Version: ns-3-dev   
Hardware: All   
OS: All   
Attachments: program that allows to reproduce the bug

Description Nicola Baldo 2011-06-30 10:43:54 UTC
It's an error which happens when using the config store, but I guess it might be due to the parsing of time values which belongs to core.

The bug is reproduced running the attached program twice, as follows:

nicola@pcnbaldo:~/locale/ns-3-dev$ ./waf --command-template="%s --ns3::ConfigStore::Filename=values.xml --ns3::ConfigStore::Mode=Save --ns3::ConfigStore::FileFormat=Xml" --run scratch/config-store-default-bug
[snip]      
[file is saved and program exits ok]

nicola@pcnbaldo:~/locale/ns-3-dev$ ./waf --command-template="%s --ns3::ConfigStore::Filename=values.xml --ns3::ConfigStore::Mode=Load --ns3::ConfigStore::FileFormat=Xml" --run scratch/config-store-default-bug
[snip]      
aborted. msg="Can't Parse Time +100000000.0ns", file=../src/core/model/time.cc, line=74
Command ['/home/nicola/locale/ns-3-dev/build/debug/scratch/config-store-default-bug', '--ns3::ConfigStore::Filename=values.xml', '--ns3::ConfigStore::Mode=Load', '--ns3::ConfigStore::FileFormat=Xml'] terminated with signal SIGSEGV. Run it under a debugger to get more information (./waf --run <program> --command-template="gdb --args %s <args>").


Note that by removing all Time values from values.xml then the ConfigStore can successfully load it.
Comment 1 Nicola Baldo 2011-06-30 10:44:33 UTC
Created attachment 1179 [details]
program that allows to reproduce the bug
Comment 2 Mathieu Lacage 2011-07-06 19:23:55 UTC
(In reply to comment #1)
> Created attachment 1179 [details]
> program that allows to reproduce the bug

did not try to run it. looked at the code. probably because Time::Time searches the unit identifier by searching the string from the start until it finds a non-numeric character. 

Should be fixable either by expanding the set of characters you are looking for (i.e., add '.' and '+') or by searching on the first non-letter from the end.

I know you are busy but maybe you could cook a patch and add a test to time-test- suite.cc ? (it would be nice to test negative times too).
Comment 3 Tom Henderson 2011-10-15 11:58:38 UTC
*** Bug 1279 has been marked as a duplicate of this bug. ***
Comment 4 Mitch Watrous 2011-11-11 17:42:07 UTC
Bug closed.

Changeset:  91a0ff9ee4eb