SBCL fails to startup from non-existing working directory

Bug #338924 reported by Leslie P. Polzer
4
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://www.sbcl.org/>.

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.

Tags: cwd ldb
Gábor Melis (melisgl)
Changed in sbcl:
status: New → Confirmed
Gábor Melis (melisgl)
Changed in sbcl:
importance: Undecided → Low
Revision history for this message
Roman Marynchak (roman-marynchak) wrote :

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):

------------------------------------
os-cold-init-or-reinit
posix-getcwd/
posix-getcwd
simple-perror
------------------------------------

Regards,
Roman

Revision history for this message
Stas Boukarev (stassats) wrote :

Fixed in b7e68df14bbdcee894af620e4168328797be94b9

Changed in sbcl:
status: Confirmed → Fix Committed
Stas Boukarev (stassats)
Changed in sbcl:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.