SBCL fails to startup from non-existing working directory
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
SBCL |
Fix Released
|
Low
|
Unassigned |
Bug Description
[sky@wintermute ~/tmp]% mkdir foo
[sky@wintermute ~/tmp]% cd foo
[sky@wintermute ~/tmp/foo]% rmdir ~/tmp/foo
[sky@wintermute ~/tmp/foo]% sbcl
This is SBCL 1.0.24, an implementation of ANSI Common Lisp.
More information about SBCL is available at <http://
SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses. See the CREDITS and COPYING files in the
distribution for more information.
internal error #26
SC: 14, Offset: 2 $1= 0x090a0847: other pointer
fatal error encountered in SBCL pid 9144(tid 3084954368):
internal error too early in init, can't recover
Welcome to LDB, a low-level debugger for the Lisp runtime environment.
ldb>
I suppose this hasn't been fixed in later versions either.
Let me know if you need more info.
Changed in sbcl: | |
status: | New → Confirmed |
Changed in sbcl: | |
importance: | Undecided → Low |
Changed in sbcl: | |
status: | Fix Committed → Fix Released |
The bug cause is in the /src/code/unix.lisp file, where the function posix-getcwd is defined. It uses alien C function getcwd, which fails to get the working directory in our case, setting errno to ENOENT (corresponds to "No such file or directory"). This behavior is not SBCL-specific, I have seen the similar issue with other programs.
As a solution I suggest searching for some other place to be our working directory after the getcwd gives up inside posix-getcwd. We may use getenv("HOME") alien C call after that to make the user's home directory to be our working directory. I am not sure whether it is logically correct or not, maybe there is a better solution, so I will not create a patch right now. In any case, we know the issue cause and place now, so the desired fix implementation will be pretty straightforward. The backtrace info shows the next code flow (fragment):
------- ------- ------- ------- ------- - init-or- reinit ------- ------- ------- ------- -
os-cold-
posix-getcwd/
posix-getcwd
simple-perror
-------
Regards,
Roman