I spent some hours last week (whilst in a cottage in wales), trying to track down the problem I have with Therion not liking my data any more. Here is what I discovered, which I hope will give you a clue, or suggest some more tests for me to do because I am out of ideas. In summary the problem exists in 0.2.19 and 0.3.1 so it's not a feature of the new version as I first thought. And as 0.2.19 _used_ to work then ewither it's a bug in underlying libraries or my data/environment has changed in some way. All the gdb testing has been done in 0.3.1. There are two bugs: 'invalid command context' on the first 'end*' command and a segfault if I use 'end centreline' instead of 'endcentreline'. I have found the function the segfault occurs in but no more. And the 'invalid command context' thing has been tracked down to the 'wrong' context value (NONE, SURVEY, SCRAP) being set when the endcommand happens, but I don't understand what this context is or enough about C++ to know how it might go wrong. The reading of the data seems to be OK so far as I can tell from using GDB. Here are my notes giving the details of what I did: debugging therion soundriver problem 2004.06.17 soundriver.th gives 'invalid command context' with v0.2.19 and 0.3.1 at first 'end' command (endmap, endcenterline). If I change endcenterline to 'end centerline' then I get a segfault instead. The top of the file looks like: encoding utf-8 # map elevator -title "Terikan River Cave: Elevator Entrance" # farside@river # farside2@river # endmap #connections # join farside@river farside2@river join farsidewest1@river farsidewest2@river join fsceil1@river:0 farsidewest3@river:7 centerline equate 17@evening 53@river equate 24@evening 1@river #*equate 4@river2 6@evening ; was it stn 6 cairn? closure suggests not equate 1@rifticious 2@evening equate 5@rifticious 12@evening equate 1@pooh 50@river equate 22@rifticious 1@rifticious2 equate 10@penthouse 27@river end centerline Backtracing with gdb produces: reading input -- soundriver.th open file -- soundriver.th Program received signal SIGSEGV, Segmentation fault. 0x0806fe92 in thsurvey::get_decdef (this=0x0) at thsurvey.h:239 239 bool get_decdef() { return this->decdef; } the backtrace looks like this: (gdb) bt #0 0x0806fe92 in thsurvey::get_decdef (this=0x0) at thsurvey.h:239 #1 0x0806f5a2 in thdata::set_survey_declination (this=0x819da20) at thdata.cxx:1996 #2 0x0806c605 in thdata::insert_data_leg (this=0x819da20, nargs=2, args=0x8195798) at thdata.cxx:1370 #3 0x080676d6 in thdata::set (this=0x819da20, cod={id = 0, nargs = 1}, args=0xbffffa60, argenc=6, indataline=1) at thdata.cxx:223 #4 0x08063c16 in thdatareader::read (this=0x818b420, ifname=0x8197b70 "soundriver.th", spath=0x819b6a0 "/home/wookey/.therion:/usr/share/therion:/usr/local/share/therion", dbptr=0x818b200) at thdatareader.cxx:119 #5 0x0810c1ef in main (argc=1, argv=0xbffffb34) at therion.cxx:254 (gdb) Now I changed the file to this: encoding utf-8 map elevator -title "Terikan River Cave: Elevator Entrance" farside@river farside2@river endmap #connections # join farside@river farside2@river join farsidewest1@river farsidewest2@river join fsceil1@river:0 farsidewest3@river:7 centerline equate 17@evening 53@river equate 24@evening 1@river #*equate 4@river2 6@evening ; was it stn 6 cairn? closure suggests not equate 1@rifticious 2@evening equate 5@rifticious 12@evening equate 1@pooh 50@river equate 22@rifticious 1@rifticious2 equate 10@penthouse 27@river endcenterline stepping through to find out why 'invalid command context occurs on 'endmap' we find that 'endmap' matches at thdatareader::read line 87 and then barf happens at line 91 dbptr->insert(objptr); because in thdatabase::insert, line 159 if ((optr->get_context() & this->ccontext) == 0) (gdb) print optr->get_context() $2 = 2 -i.e THCTX_SURVEY (gdb) print this->ccontext $3 = 1 i.e THCTX_NONE (gdb) print (optr->get_context() & this->ccontext) $4 = 0 so we get "invalid command context". I don't really understand what this context stuff is about but maybe this will be a clue. Wookey -- Aleph One Ltd, Bottisham, CAMBRIDGE, CB5 9BA, UK Tel +44 (0) 1223 811679 work: http://www.aleph1.co.uk/ play: http://www.chaos.org.uk/~wookey/
After reading your file several time, it seems to be very simple error. You are missing survey command in the beginning of your file :))) Change your file to following: encoding utf-8 survey soundriver [current file contents] endsurvey soundriver # if this command already does not exists at the end of your file I'm sending you your source files separately (they work on my computer). You can diff them and see, where is the difference.
soundriver.th gives 'invalid command context' with v0.2.19 and 0.3.1 at first 'end' command (endmap, endcenterline). If I change endcenterline to 'end centerline' then I get a segfault instead.
This is OK. Multiline command (like map or centerline) is inserted into database when endmap(endcenterline) is readed. Note, that you must type "endcenterline" not "end centerline". The segfault is real therion bug - I'll fix in the next version.
I don't really understand what this context stuff is about but maybe this will be a clue.
It's very simple - in fact all therion commands must be placed between survey - endsurvey commands (survey context). And all 2D commands (point, line, area) must be placed between scrap - endscrap commands (scrap context). I'll send you your data files (once you have sent them to us) that work correctly. You can diff with your files to see the difference. Thanks for your feedback, I hope it will work now (at least the files I will send you). Regards, S.
+++ Stacho Mudrak [04-06-22 10:12 +0200]:
After reading your file several time, it seems to be very simple error. You are missing survey command in the beginning of your file :))) Change your file to following:
encoding utf-8 survey soundriver
[current file contents]
OK, you're right. That line must have got deleted at some point. So, it was a silly error, but given that this has taken some 6 weeks to solve with some fairly computer-savvy users, it suggests that the error messages could be rather more helpful. If it had said: "'survey' command missing before 'map' command", or "data must be enclosed in 'survey' at line blah", then we might have worked it out a bit quicker than 'invalid command context' which didn't help either of us, and so we started suspecting something complicated and looking through hex-dumps of the file! (this wasn't helped by my mistaken belief that it worked OK with 0.2.19 - sorry about that - "bloody users!").
It's very simple - in fact all therion commands must be placed between survey - endsurvey commands (survey context). And all 2D commands (point, line, area) must be placed between scrap - endscrap commands (scrap context). I'll send you your data files (once you have sent them to us) that work correctly. You can diff with your files to see the difference.
OK - so it shouldn't be too hard to generate a much more user-helpful message when this doesn't happen.
Thanks for your feedback, I hope it will work now (at least the files I will send you).
Yep - I'm back in business. I'll upload therion 0.3.1 today and try and get some drawing done soon... Wookey -- Aleph One Ltd, Bottisham, CAMBRIDGE, CB5 9BA, UK Tel +44 (0) 1223 811679 work: http://www.aleph1.co.uk/ play: http://www.chaos.org.uk/~wookey/
So, it was a silly error, but given that this has taken some 6 weeks to solve with some fairly computer-savvy users, it suggests that the error messages could be rather more helpful.
In fact your original message with the bug report from May 25 contained the survey command :)) The message from June 20 didn't -- this explains why it took 6 weeks to discover it... M. --------------------- I get: "Invalid command context" at line 6 in this file: 1 encoding utf-8 2 survey soundriver 3 4 map elevator -title "Terikan: Elevator Entrance" 5 farside@river 6 farside2@river 7 endmap 8 ....<lots more data>.... ---------------------
+++ Martin Budaj [04-06-29 07:45 +0200]:
So, it was a silly error, but given that this has taken some 6 weeks to solve with some fairly computer-savvy users, it suggests that the error messages could be rather more helpful.
In fact your original message with the bug report from May 25 contained the survey command :)) The message from June 20 didn't -- this explains why it took 6 weeks to discover it...
Yes, - I have no explanation for how that happened. So far as I can see there was only ever one copy of this file. But yes, it did greatly confuse the issue. The 'line 6' error suggests that in fact the 'endmap' command was on line 6, so in fact line 2 must have been missing, but then where did I copy this version from to send to you? It's a mystery. Nevertheless - if the error had been 'missing survey command before 'map', then we would probably have got to the answer faster.
M.
--------------------- I get: "Invalid command context" at line 6 in this file:
1 encoding utf-8 2 survey soundriver 3 4 map elevator -title "Terikan: Elevator Entrance" 5 farside@river 6 farside2@river 7 endmap 8 ....<lots more data>.... ---------------------
Wookey -- Aleph One Ltd, Bottisham, CAMBRIDGE, CB5 9BA, UK Tel +44 (0) 1223 811679 work: http://www.aleph1.co.uk/ play: http://www.chaos.org.uk/~wookey/
participants (3)
-
Martin Budaj -
Stacho Mudrak -
Wookey