From nobody@FreeBSD.org  Tue Apr  2 08:30:23 2013
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
	by hub.freebsd.org (Postfix) with ESMTP id 34E37D75
	for <freebsd-gnats-submit@FreeBSD.org>; Tue,  2 Apr 2013 08:30:23 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id 0D7C1F4B
	for <freebsd-gnats-submit@FreeBSD.org>; Tue,  2 Apr 2013 08:30:23 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.5/8.14.5) with ESMTP id r328UMdF028801
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 2 Apr 2013 08:30:22 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.5/8.14.5/Submit) id r328UMiV028800;
	Tue, 2 Apr 2013 08:30:22 GMT
	(envelope-from nobody)
Message-Id: <201304020830.r328UMiV028800@red.freebsd.org>
Date: Tue, 2 Apr 2013 08:30:22 GMT
From: "C. P. Ghost" <cpghost@cordula.ws>
To: freebsd-gnats-submit@FreeBSD.org
Subject: math/maxima fails to start with SBCL and quicklisp
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         177576
>Category:       ports
>Synopsis:       math/maxima fails to start with SBCL and quicklisp
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bf
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Apr 02 08:40:00 UTC 2013
>Closed-Date:    
>Last-Modified:  Mon May  6 16:00:00 UTC 2013
>Originator:     C. P. Ghost
>Release:        FreeBSD 9.1-STABLE
>Organization:
Cordula's Web
>Environment:
FreeBSD phenom.cordula.ws 9.1-STABLE FreeBSD 9.1-STABLE #0 r248955: Sun Mar 31 22:50:51 CEST 2013     root@phenom.cordula.ws:/usr/obj/usr/src/sys/GENERIC  amd64
>Description:
math/maxima fails to start with SBCL when quicklisp is installed and enabled.

Because the maxima port is usually compiled as root but runs as a regular user, when it invokes SBCL with quicklisp enabled, it tries to access non-existent /root/.cache/common-lisp directory instead of $HOME/.cache/common-lisp of the invoking user. This causes SBCL to go into debugger-mode.

>How-To-Repeat:
Just install quicklisp for SBCL, i.e. add this to your ~/.sbclrc via quicklisp's setup function:

;;; The following lines added by ql:add-to-init-file:
#-quicklisp
(let ((quicklisp-init (merge-pathnames "quicklisp/setup.lisp"
                                       (user-homedir-pathname))))
  (when (probe-file quicklisp-init)
    (load quicklisp-init)))

Then, make and install math/maxima port with SBCL as default lisp, and run as regular user.
>Fix:
As explained in the following bug report of a Linux distribution:
  https://bugs.archlinux.org/task/29882
we need to disable user-specific initializations, i.e. prevent ~/.sbclrc
from running when maxima is invoked.

To do this, apply the attached patch to the startup script.

Patch attached with submission follows:

--- src/maxima.in.orig	2012-12-04 06:54:50.000000000 +0100
+++ src/maxima.in	2013-04-02 10:08:59.000000000 +0200
@@ -196,7 +196,7 @@
   if [ -x "$MAXIMA_IMAGESDIR/binary-$MAXIMA_LISP/maxima" ]; then
     exec "$MAXIMA_IMAGESDIR/binary-$MAXIMA_LISP/maxima" --noinform $MAXIMA_LISP_OPTIONS --end-runtime-options --eval '(cl-user::run)' --end-toplevel-options "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
   else
-    exec "@SBCL_NAME@" --core "$maxima_image_base.core" --noinform $MAXIMA_LISP_OPTIONS --end-runtime-options --eval '(cl-user::run)' --end-toplevel-options "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
+    exec "@SBCL_NAME@" --core "$maxima_image_base.core" --noinform $MAXIMA_LISP_OPTIONS --end-runtime-options --no-userinit --eval '(cl-user::run)' --end-toplevel-options "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
   fi
 
 else


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports-bugs->bf 
Responsible-Changed-By: edwin 
Responsible-Changed-When: Tue Apr 2 08:40:08 UTC 2013 
Responsible-Changed-Why:  
Over to maintainer (via the GNATS Auto Assign Tool) 

http://www.freebsd.org/cgi/query-pr.cgi?pr=177576 

From: "b.f." <bf1783@googlemail.com>
To: bug-followup@freebsd.org, cpghost@cordula.ws
Cc:  
Subject: Re: ports/177576: math/maxima fails to start with SBCL and quicklisp
Date: Mon, 6 May 2013 15:58:52 +0000

 I am not able to reproduce your problem with sbcl 1.1.7 on 10-CURRENT
 amd64: for me, sbcl doesn't drop to debugger on startup with the given
 userinit  additions.  So it seems that there are some missing details
 in the description of the problem -- like why user-cache isn't being
 set properly.  In any event, I don't think that disabling all userinit
 files by default is the proper fix, as this would prevent appropriate
 use of such files.
 
 b.
>Unformatted:
