Dwarf Fortress Bug Tracker - Dwarf Fortress
View Issue Details
0009757Dwarf FortressTechnical -- Generalpublic2016-05-15 13:412018-05-08 08:32
seudopar 
lethosor 
lowtrivialalways
confirmedopen 
x86_64Linux4.5.4
0.43.02 
 
0009757: dwarffortress binary seems to always exit with a non-zero exit code
When ever I run the dwarffortress binary, I have noticed that it always seems to exit with what is conventionally considered an error status code of 1, although no error appears to be occurring.
> dwarffortress
<exit the game>
> echo $?
0.44.10, binary patch
Issue History
2016-05-15 13:41seudoparNew Issue
2016-05-17 17:03lethosorNote Added: 0035211
2016-05-17 17:03lethosorAssigned To => lethosor
2016-05-17 17:03lethosorStatusnew => needs feedback
2016-05-18 17:44seudoparNote Added: 0035231
2016-05-18 17:44seudoparStatusneeds feedback => assigned
2016-05-18 18:03seudoparNote Edited: 0035231bug_revision_view_page.php?bugnote_id=0035231#r14205
2016-05-18 18:06seudoparIssue Monitored: seudopar
2018-05-08 08:25lethosorStatusassigned => needs feedback
2018-05-08 08:28lethosorNote Added: 0038299
2018-05-08 08:28lethosorSummarydwarffortress binary seems to always exit with an error status code of 1. => dwarffortress binary seems to always exit with a non-zero exit code
2018-05-08 08:28lethosorStatusneeds feedback => confirmed
2018-05-08 08:29lethosorTag Attached: 0.44.10
2018-05-08 08:32lethosorNote Added: 0038300
2018-05-08 08:32lethosorTag Attached: binary patch

Notes
(0035211)
lethosor   
2016-05-17 17:03   
What is the "dwarffortress" script? If it's not "df" or a renamed copy of the "df" script (or a link to the libs/Dwarf_Fortress executable), it's not something Toady works with.
(0035231)
seudopar   
2016-05-18 17:44   
(edited on: 2016-05-18 18:03)
Oh sorry. That appears to be a bash script that the maintainer of the package in Arch Linux wrapped it in.

The same behavior occurs when the actual binary (libs/Dwarf_Fortress) is called.

(0038299)
lethosor   
2018-05-08 08:28   
Interestingly enough, running DF 0.44.10 on OS X with
DYLD_LIBRARY_PATH=./libs DYLD_FRAMEWORK_PATH=./libs ./dwarfort.exe ; echo $?

gives an exit code of 32
(0038300)
lethosor   
2018-05-08 08:32   
I think I found the issue, too:
https://github.com/svenstaro/dwarf_fortress_unfuck/blob/d6a4ee67e7b41bec1caa87548640643db35a6080/g_src/enabler.cpp#L543-L593 [^]
https://github.com/svenstaro/dwarf_fortress_unfuck/blob/d6a4ee67e7b41bec1caa87548640643db35a6080/g_src/enabler.cpp#L796-L804 [^]

main() returns the result of enabler.loop(), which is supposed to return an int but never actually does. There are a couple easy ways to fix this.