[Therion] recovering lost data after buggy undo behavior in xtherion

Jonny Prouty jonathanprouty at gmail.com
Tue Aug 19 04:50:39 CEST 2025


Hello all,

I am writing this list hoping to avoid redoing many hours worth of
drafting. To be brief, xtherion has overwritten the th2 file I wasa
editing. Yes, I should have done a git commit or done some other backup
after that amount of work, too late now. I have seen this behavior before
but it hasn't bitten me this badly until now.

In this case, I deleted several objects (in this case rock-border lines)
and then thought better of it and hit ctrl-z several times to undo the
delete. At some point I received the following error message:

can't read "xth(me,imgs,,XVIimg)": no such element in array
can't read "xth(me,imgs,,XVIimg)": no such element in array
    while executing
"if {$xth(me,imgs,$imgx,XVIimg)} continue"
    (procedure "xth_me_write_file" line 24)
    invoked from within
"xth_me_write_file $fname"
    (procedure "xth_me_save_file" line 42)
    invoked from within
"xth_me_save_file 1"
    invoked from within
".xth.tb.savasb invoke"
    ("uplevel" body line 1)
    invoked from within
"uplevel #0 [list $w invoke]"
    (procedure "tk::ButtonUp" line 22)
    invoked from within
"tk::ButtonUp .xth.tb.savasb"
    (command bound to event)

This may be associated with me having just added an additional sketch as a
background image and dragged it into position, but I don't know if that is
associated or purely circumstantial. Regardless, I am now unable to save
the file, or use the 'save as' functionality. I receive the same error when
I attempt to do that. When I examine the contents of the th2 file via the
command line, it is empty, and indeed the file now has a size of 0 bytes.

However, in xtherion I can still click on objects and view their
attributes, and I can drag the map around and xtherion successully redraws
items in the current view. Clearly, xtherion still has some representation
of the file.

I dumped the memory of the process into a file and then extracted the
strings from it:
gcore -o /tmp/therion_dump 83677
strings /tmp/therion_dump.83677 > /tmp/therion_memory.txt

The data is definitely in there, I can grep for specific text that I know
is in the th2 file, but it is pretty jumbled up. Reconstructing the th2
file from the coredump is probably viable, but I don't know that it would
be any easier than simply redrafting the survey.

Does anyone know of a relatively straightforward way to recover data from
xtherion after a soft crash? I'd absolutely love to not have to redraft all
of this passage. I will be leaving xtherion open for the time being in hope
a solution exists.

As an aside, when I examined the files that are currently being accessed by
the xtherion process, the th2 file is listed multiple times under different
file descriptors. That seems odd to me.

lsof -p 83677 | grep th2

COMMAND    PID    USER   FD   TYPE             DEVICE SIZE/OFF     NODE NAME
xtherion 83677 jprouty    6w   REG               0,49        0 13011147
/home/jprouty/data/caving/survey/redacted_cave/survey/20250816/F_plan.th2
xtherion 83677 jprouty    7w   REG               0,49        0 13037825
/home/jprouty/data/caving/survey/redacted_cave/survey/20250816/F_plan_2.th2
xtherion 83677 jprouty    8w   REG               0,49        0 13011147
/home/jprouty/data/caving/survey/redacted_cave/survey/20250816/F_plan.th2
xtherion 83677 jprouty    9w   REG               0,49        0 13011147
/home/jprouty/data/caving/survey/redacted_cave/survey/20250816/F_plan.th2
xtherion 83677 jprouty   10w   REG               0,49        0 13011147
/home/jprouty/data/caving/survey/redacted_cave/survey/20250816/F_plan.th2
xtherion 83677 jprouty   11w   REG               0,49        0 13011147
/home/jprouty/data/caving/survey/redacted_cave/survey/20250816/F_plan.th2
xtherion 83677 jprouty   12w   REG               0,49        0 13037825
/home/jprouty/data/caving/survey/redacted_cave/survey/20250816/F_plan_2.th2
xtherion 83677 jprouty   13w   REG               0,49        0 13037825
/home/jprouty/data/caving/survey/redacted_cave/survey/20250816/F_plan_2.th2
xtherion 83677 jprouty   14w   REG               0,49        0 13037825
/home/jprouty/data/caving/survey/redacted_cave/survey/20250816/F_plan_2.th2

Thanks very much in advance for any and all help! I really appreciate it.

Jonny
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.speleo.sk/pipermail/therion/attachments/20250818/1068fc2c/attachment.htm>


More information about the Therion mailing list