﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	resolution	keywords	cc	phab_field
2086	Path detection failing on BSDs	Anthony J. Bentley		"Calling pyrogenesis (instead of some path (be it relative or absolute) without being in the right dir) fails with the following error on ~~Linux and~~ BSD.
{{{
$ pyrogenesis
ERROR: Cannot find executable (expected at '/home/anthony/pyrogenesis')
Paths.cpp(176): Function call failed: return value was -110301 (No such file or directory)
Function call failed: return value was -110301 (No such file or directory)
Location: Paths.cpp:176 (Root)

Call stack:

(0x1b83f86ed5eb) 0x1b83f86ed5eb <_ZNSt12out_of_rangeD1Ev+342155> at pyrogenesis
(0x1b83f8690c11) 0x1b83f8690c11 <_ZStplIwSt11char_traitsIwESaIwEESbIT_T0_T1_ERKS6_S8_+285153> at pyrogenesis
(0x1b83f86916c2) 0x1b83f86916c2 <_ZStplIwSt11char_traitsIwESaIwEESbIT_T0_T1_ERKS6_S8_+287890> at pyrogenesis
(0x1b83f8691af2) 0x1b83f8691af2 <_ZStplIwSt11char_traitsIwESaIwEESbIT_T0_T1_ERKS6_S8_+288962> at pyrogenesis
(0x1b83f8424c7b) 0x1b83f8424c7b <_ZNSt6vectorImSaImEE14_M_fill_insertEN9__gnu_cxx17__normal_iteratorIPmS1_EEmRKm+240091> at pyrogenesis
(0x1b83f8427af4) 0x1b83f8427af4 <_ZNSt6vectorImSaImEE14_M_fill_insertEN9__gnu_cxx17__normal_iteratorIPmS1_EEmRKm+251988> at pyrogenesis
(0x1b83f840e668) 0x1b83f840e668 <_ZNSt6vectorImSaImEE14_M_fill_insertEN9__gnu_cxx17__normal_iteratorIPmS1_EEmRKm+148424> at pyrogenesis
(0x1b83f8410ce1) 0x1b83f8410ce1 <_ZNSt6vectorImSaImEE14_M_fill_insertEN9__gnu_cxx17__normal_iteratorIPmS1_EEmRKm+158273> at pyrogenesis
(0x1b83f824e8a2) 0x1b83f824e8a2 <__register_frame_info+9666> at pyrogenesis
(0x1b83f824f3b0) 0x1b83f824f3b0 <__register_frame_info+12496> at pyrogenesis
(0x1b83f824c261) 0x1b83f824c261 <+161> at pyrogenesis

errno = 0 (No such file or directory)
OS error = ?


(C)ontinue, (S)uppress, (B)reak, Launch (D)ebugger, or (E)xit?
}}}

However, if I'm in the same directory as the executable (e.g., with ""cd /usr/local/bin && pyrogenesis""), it works perfectly.

We should get the proper path of the executable if we are started like above (some ways on how to do that for ~~Linux and~~ some BSD variants [http://stackoverflow.com/questions/1023306/finding-current-executables-path-without-proc-self-exe/1024937#1024937 at stackoverflow])
    sys_ExecutablePathname() in [source:ps/trunk/source/lib/sysdep/os/ source/lib/sysdep/os/]{linux/linux.cpp,bsd/bsd.cpp}

BSDs might not have procfs available (reusing the code in linux.cpp (move it to unix_executable_path.cpp (see r15996)) might be possible if they do, but we should not rely on that) so using sysctl is the way to go."	defect	new	Nice to Have	Alpha 18	Core engine		simple	marcel.stieglitz@…	
