2020-08-11 12:38 CEST

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0002640Spring engineGeneralpublic2011-09-09 15:46
Reporterabma 
Assigned Tohoijui 
PrioritynormalSeveritycrashReproducibilityalways
StatusresolvedResolutionfixed 
Product Version 
Target VersionFixed in Version83.0 
Summary0002640: (master) crash when HOME isn't set
Descriptionenv -i ~/local/spring/master/bin/spring

terminate called after throwing an instance of 'std::logic_error'
  what(): basic_string::_S_construct null not valid
Error: Aborted (SIGABRT) in spring 0.82+.4.0 (Debug)
Error: Stacktrace:
Error: <0> /lib/x86_64-linux-gnu/libc.so.6(+0x33d80) [0x7f0a02c85d80]
Error: <1> /lib/x86_64-linux-gnu/libc.so.6(gsignal+0x35) [0x7f0a02c85d05]
Error: <2> /lib/x86_64-linux-gnu/libc.so.6(abort+0x186) [0x7f0a02c89ab6]
Error: <3> /usr/lib/x86_64-linux-gnu/libstdc++.so.6(_ZN9__gnu_cxx27__verbose_terminate_handlerEv+0x11d) [0x7f0a0353cb9d]
Error: <4> /usr/lib/x86_64-linux-gnu/libstdc++.so.6(+0xb9d46) [0x7f0a0353ad46]
Error: <5> /usr/lib/x86_64-linux-gnu/libstdc++.so.6(+0xb9d73) [0x7f0a0353ad73]
Error: <6> /usr/lib/x86_64-linux-gnu/libstdc++.so.6(+0xb9e6e) [0x7f0a0353ae6e]
Error: <7> /usr/lib/x86_64-linux-gnu/libstdc++.so.6(_ZSt19__throw_logic_errorPKc+0x57) [0x7f0a034e7217]
Error: <8> /usr/include/c++/4.6/bits/basic_string.tcc:138
Error: <9> /usr/lib/x86_64-linux-gnu/libstdc++.so.6(_ZNSsC2EPKcRKSaIcE+0x43) [0x7f0a03525973]
spring: /home/abma/dev/spring/master/rts/System/LogOutput.cpp:117: const string& CLogOutput::GetFilePath() const: Assertion `initialized' failed.
Abgebrochen
Additional Informationthis is why the buildbot currently does print such strange error messages on the validation tests
TagsNo tags attached.
Checked infolog.txt for Errors
Attached Files

-Relationships
+Relationships

-Notes

~0007330

hoijui (reporter)

Last edited: 2011-09-06 13:13

in rts/System/Config/ConfigLocater.cpp we have:

  37 #ifndef _WIN32
  38 const string base = ".springrc";
  39 const string home = getenv("HOME");
  40
  41 const string defCfg = home + "/" + base;

By browsing the web, i found out that the HOME env var is usually only set for real persons user accounts.
I assume this is run by a special buildbot user, that does not have HOME set (can be "simulated" with "unset -v HOME").

This problem is handled by this stackoverflow question, and the accepted answer plus the comment to it seem like exactly what we need.
http://stackoverflow.com/questions/2910377/get-home-directory-in-linux-c

my suggestion:
use HOME if it is set, otherwise use:
   struct passwd* pw = getpwuid(getuid());
   const char* homedir = pw->pw_dir;
and optionally set the HOME variable to that value, so we can use it in other places in the engine, should need arise.

edit: doing it

~0007350

hoijui (reporter)

resolved in:
https://github.com/spring/spring/commit/dfb23b301899579bf96cb6afaa640366da0f846b
+Notes

-Issue History
Date Modified Username Field Change
2011-09-05 22:48 abma New Issue
2011-09-05 22:51 abma Summary (master) crash with custom path on startup => (master) crash when HOME isn't set
2011-09-05 22:51 abma Description Updated
2011-09-05 22:55 abma Additional Information Updated
2011-09-06 12:59 hoijui Note Added: 0007330
2011-09-06 13:13 hoijui Note Edited: 0007330
2011-09-06 13:14 hoijui Status new => assigned
2011-09-06 13:14 hoijui Assigned To => hoijui
2011-09-09 15:46 hoijui Note Added: 0007350
2011-09-09 15:46 hoijui Status assigned => resolved
2011-09-09 15:46 hoijui Fixed in Version => 0.83.0
2011-09-09 15:46 hoijui Resolution open => fixed
+Issue History