#978 empty locale environment variables => error at launch

closed
nobody
Lisp Core (471)
5
2006-09-24
2006-09-04
Anonymous
No

I couldn't run maxima on amd64 gentoo linux system,
error is below. I'm ready to provide as much info as
you need to fix this problem.

Error:
>$ maxima
Maxima encountered a Lisp error:

Error in SETQ [or a callee]: 0 and 2 are illegal as
:START and :END
for the sequence "".

Automatically continuing.
To reenable the Lisp debugger set *debugger-hook* to nil.
Error in SUBSEQ [or a callee]: The tag
RETURN-FROM-DEBUGGER is undefined.

Fast links are on: do (use-fast-links nil) for debugging
Broken at CONDITIONS::CLCS-UNIVERSAL-ERROR-HANDLER.
1 (Abort) Return to debug level 1.
2 Return to top level.
dbl:MAXIMA>>>:bt

#0 CLCS-UNIVERSAL-ERROR-HANDLER
{error-name=:error,correctable=nil,function-name=setq,continue-format-string=(""...}
[ihs=14]
#1 SUBSEQ {loc0="",loc1=0,loc2=2,loc3=nil} [ihs=13]
#2 Computing args for STRING-DOWNCASE {} [ihs=12]
#3 SET-LOCALE {} [ihs=7]
#4 RUN {} [ihs=4]
NIL
dbl:MAXIMA>>>

Discussion

  • Robert Dodier

    Robert Dodier - 2006-09-08

    Logged In: YES
    user_id=501686

    (0) PLEASE SIGN IN to make bug reports or at least leave
    your email address so that we can contact you. Thank you &
    sorry for shouting.

    (1) Ports other than SBCL, CMUCL, GCL, and Clisp on Linux,
    and GCL on Windows, are not maintained by the Maxima
    development team. We don't have the people or the hardware
    to maintain other ports. Problems in other ports have to be
    reported to the maintainer for that port. I don't know who
    that is in the case of the AMD64/Gentoo port.

    (2) That said, we can glean a bit from the error message.
    The error originates from SET-LOCALE in src/init-cl.lisp.
    There is a test for LOCALE equal to NIL but otherwise LOCALE
    is assumed to be a nonempty string. LOCALE is a string
    returned from MAXIMA-GETENV. In the case of GCL (which
    appears to be the Lisp implementation -- could be mistaken
    about that), MAXIMA-GETENV punts to SI::GETENV. So a
    question for the original poster -- what does GCL (on your
    system) return for, say, (SI::GETENV "FOOBAR") (or some
    other unset environment variable) ? Does it return "" or NIL ?

    If SI::GETENV returns "", then changing ((null locale) ...)
    in SET-LOCALE (in src/init-cl.lisp) to ((or (null locale)
    (equal locale "")) ...) should fix this problem. You'll have
    to recompile in order for the change to take effect. Let us
    know how it turns out. Hope this helps. Robert Dodier

     
  • Ruslan U. Zakirov

    Logged In: YES
    user_id=1594760

    0. Done.
    1. It's gcl on linux. Now, I'm installing clisp to check.
    2.
    cubic@cubic-pc ~ $ gcl
    GCL (GNU Common Lisp) 2.6.7 ANSI Sep 3 2006 20:46:57
    Source License: LGPL(gcl,gmp), GPL(unexec,bfd)
    Binary License: GPL due to GPL'ed components: (READLINE BFD
    UNEXEC)
    Modifications of this banner must retain notice of a
    compatible license
    Dedicated to the memory of W. Schelter
    >(SI::GETENV "SVKMERGE")
    "KDiff3"

    >(SI::GETENV "FOOBAR")
    NIL

    So it returns NIL and problem is in other place.

    Thanks for your answer.

     
  • Ruslan U. Zakirov

    Logged In: YES
    user_id=1594760

    have tried with `clisp`. No luck.

    cubic@cubic-pc ~ $ maxima -v -l 'clisp'
    + '[' clisp = clisp ']'
    + '[' true = true ']'
    + exec /usr/lib64/maxima/5.9.3/binary-clisp/lisp.run -q -M
    /usr/lib64/maxima/5.9.3/binary-clisp/maxima.mem '' -- -v -l
    clisp '' '' '' '' '' ''
    Maxima encountered a Lisp error:

    AREF: index 0 for "" is out of range

    Automatically continuing.
    To reenable the Lisp debugger set *debugger-hook* to nil.

    *** - THROW: there is no CATCHer for tag RETURN-FROM-DEBUGGER
    Break 1 [1]> :bt
    <1> #<SYSTEM-FUNCTION EXT:SHOW-STACK> 3
    <2> #<COMPILED-FUNCTION SYSTEM::PRINT-BACKTRACE>
    <3> #<COMPILED-FUNCTION SYSTEM::DEBUG-BACKTRACE>
    <4> #<SYSTEM-FUNCTION SYSTEM::READ-EVAL-PRINT> 2
    <5> #<COMPILED-FUNCTION SYSTEM::BREAK-LOOP-2-2>
    <6> #<SYSTEM-FUNCTION SYSTEM::SAME-ENV-AS> 2
    <7> #<COMPILED-FUNCTION SYSTEM::BREAK-LOOP-2>
    <8> #<SYSTEM-FUNCTION SYSTEM::DRIVER>
    <9> #<COMPILED-FUNCTION SYSTEM::BREAK-LOOP>
    <10> #<SYSTEM-FUNCTION INVOKE-DEBUGGER> 1
    <11> #<COMPILED-FUNCTION MAXIMA-LISP-DEBUGGER>
    <12> #<SYSTEM-FUNCTION INVOKE-DEBUGGER> 1
    <13> #<SYSTEM-FUNCTION AREF>
    <14> #<SYSTEM-FUNCTION SUBSEQ>
    EVAL frame for form (STRING-DOWNCASE (SUBSEQ LOCALE 0 2))
    <15> #<SPECIAL-OPERATOR SETQ>
    EVAL frame for form (SETQ LANGUAGE (STRING-DOWNCASE (SUBSEQ
    LOCALE 0 2)))
    <16> #<SPECIAL-OPERATOR COND>
    EVAL frame for form
    (COND ((NULL LOCALE) (SETQ *MAXIMA-LANG-SUBDIR* NIL))
    ((ZL-MEMBER LOCALE '("C" "POSIX" "c" "posix")) (SETQ
    *MAXIMA-LANG-SUBDIR* NIL))
    (T (WHEN (EQL (POSITION #\. LOCALE) 5) (SETQ CODESET
    (STRING-DOWNCASE (SUBSEQ LOCALE 6))))
    (WHEN (EQL (POSITION #\_ LOCALE) 2) (SETQ TERRITORY
    (STRING-DOWNCASE (SUBSEQ LOCALE 3 5))))
    (SETQ LANGUAGE (STRING-DOWNCASE (SUBSEQ LOCALE 0 2)))
    (COND ((EQUAL LANGUAGE "en") (SETQ *MAXIMA-LANG-SUBDIR* NIL))
    ((ZL-MEMBER LANGUAGE '("es" "pt"))
    (IF (ZL-MEMBER CODESET '("utf-8" "utf8")) (SETQ
    *MAXIMA-LANG-SUBDIR* (CONCATENATE 'STRING LANGUAGE ".utf8"))
    (SETQ *MAXIMA-LANG-SUBDIR* LANGUAGE)))
    (T (SETQ *MAXIMA-LANG-SUBDIR* NIL)))
    (COND ((EQUAL LANGUAGE "es") (SETQ CL-INFO::*INDEX-NAME*
    (FORMAT NIL "~andice" (CODE-CHAR 205))))
    ((EQUAL LANGUAGE "pt") (SETQ CL-INFO::*INDEX-NAME*
    (FORMAT NIL "~andice" (CODE-CHAR 205)))))
    (COND
    ((ZL-MEMBER LANGUAGE '("es" "pt")) (SETQ
    CL-INFO::*EXTRA-CHARS* (FORMAT NIL "~a-~a" (CODE-CHAR 192)
    (CODE-CHAR 255)))))))
    <17> #<SPECIAL-OPERATOR UNLESS>
    EVAL frame for form
    (UNLESS (SETQ *MAXIMA-LANG-SUBDIR* (MAXIMA-GETENV
    "MAXIMA_LANG_SUBDIR"))
    (SETQ LOCALE (OR (MAXIMA-GETENV "LC_ALL") (MAXIMA-GETENV
    "LC_MESSAGES") (MAXIMA-GETENV "LANG")))
    (COND ((NULL LOCALE) (SETQ *MAXIMA-LANG-SUBDIR* NIL))
    ((ZL-MEMBER LOCALE '("C" "POSIX" "c" "posix")) (SETQ
    *MAXIMA-LANG-SUBDIR* NIL))
    (T (WHEN (EQL (POSITION #\. LOCALE) 5) (SETQ CODESET
    (STRING-DOWNCASE (SUBSEQ LOCALE 6))))
    (WHEN (EQL (POSITION #\_ LOCALE) 2) (SETQ TERRITORY
    (STRING-DOWNCASE (SUBSEQ LOCALE 3 5))))
    (SETQ LANGUAGE (STRING-DOWNCASE (SUBSEQ LOCALE 0 2)))
    (COND ((EQUAL LANGUAGE "en") (SETQ *MAXIMA-LANG-SUBDIR* NIL))
    ((ZL-MEMBER LANGUAGE '("es" "pt"))
    (IF (ZL-MEMBER CODESET '("utf-8" "utf8")) (SETQ
    *MAXIMA-LANG-SUBDIR* (CONCATENATE 'STRING LANGUAGE ".utf8"))
    (SETQ *MAXIMA-LANG-SUBDIR* LANGUAGE)))
    (T (SETQ *MAXIMA-LANG-SUBDIR* NIL)))
    (COND ((EQUAL LANGUAGE "es") (SETQ CL-INFO::*INDEX-NAME*
    (FORMAT NIL "~andice" (CODE-CHAR 205))))
    ((EQUAL LANGUAGE "pt") (SETQ CL-INFO::*INDEX-NAME*
    (FORMAT NIL "~andice" (CODE-CHAR 205)))))
    (COND
    ((ZL-MEMBER LANGUAGE '("es" "pt"))
    (SETQ CL-INFO::*EXTRA-CHARS* (FORMAT NIL "~a-~a"
    (CODE-CHAR 192) (CODE-CHAR 255))))))))
    <18> #<SPECIAL-OPERATOR LET>
    EVAL frame for form
    (LET (LOCALE LANGUAGE TERRITORY CODESET) (SETQ
    CL-INFO::*INDEX-NAME* "index")
    (UNLESS (SETQ *MAXIMA-LANG-SUBDIR* (MAXIMA-GETENV
    "MAXIMA_LANG_SUBDIR"))
    (SETQ LOCALE (OR (MAXIMA-GETENV "LC_ALL") (MAXIMA-GETENV
    "LC_MESSAGES") (MAXIMA-GETENV "LANG")))
    (COND ((NULL LOCALE) (SETQ *MAXIMA-LANG-SUBDIR* NIL))
    ((ZL-MEMBER LOCALE '("C" "POSIX" "c" "posix")) (SETQ
    *MAXIMA-LANG-SUBDIR* NIL))
    (T (WHEN (EQL (POSITION #\. LOCALE) 5) (SETQ CODESET
    (STRING-DOWNCASE (SUBSEQ LOCALE 6))))
    (WHEN (EQL (POSITION #\_ LOCALE) 2) (SETQ TERRITORY
    (STRING-DOWNCASE (SUBSEQ LOCALE 3 5))))
    (SETQ LANGUAGE (STRING-DOWNCASE (SUBSEQ LOCALE 0 2)))
    (COND ((EQUAL LANGUAGE "en") (SETQ *MAXIMA-LANG-SUBDIR*
    NIL))
    ((ZL-MEMBER LANGUAGE '("es" "pt"))
    (IF (ZL-MEMBER CODESET '("utf-8" "utf8")) (SETQ
    *MAXIMA-LANG-SUBDIR* (CONCATENATE 'STRING LANGUAGE ".utf8"))
    (SETQ *MAXIMA-LANG-SUBDIR* LANGUAGE)))
    (T (SETQ *MAXIMA-LANG-SUBDIR* NIL)))
    (COND ((EQUAL LANGUAGE "es") (SETQ CL-INFO::*INDEX-NAME*
    (FORMAT NIL "~andice" (CODE-CHAR 205))))
    ((EQUAL LANGUAGE "pt") (SETQ CL-INFO::*INDEX-NAME*
    (FORMAT NIL "~andice" (CODE-CHAR 205)))))
    (COND
    ((ZL-MEMBER LANGUAGE '("es" "pt"))
    (SETQ CL-INFO::*EXTRA-CHARS* (FORMAT NIL "~a-~a"
    (CODE-CHAR 192) (CODE-CHAR 255))))))))
    (SETQ CL-INFO::*LANG-SUBDIR* *MAXIMA-LANG-SUBDIR*))
    APPLY frame for call (SET-LOCALE)
    <19>
    #<FUNCTION SET-LOCALE NIL (DECLARE (SYSTEM::IN-DEFUN
    SET-LOCALE))
    (BLOCK SET-LOCALE
    (LET (LOCALE LANGUAGE TERRITORY CODESET) (SETQ
    CL-INFO::*INDEX-NAME* "index")
    (UNLESS (SETQ *MAXIMA-LANG-SUBDIR* (MAXIMA-GETENV
    "MAXIMA_LANG_SUBDIR"))
    (SETQ LOCALE (OR (MAXIMA-GETENV "LC_ALL")
    (MAXIMA-GETENV "LC_MESSAGES") (MAXIMA-GETENV "LANG")))
    (COND ((NULL LOCALE) (SETQ *MAXIMA-LANG-SUBDIR* NIL))
    ((ZL-MEMBER LOCALE '("C" "POSIX" "c" "posix")) (SETQ
    *MAXIMA-LANG-SUBDIR* NIL))
    (T (WHEN (EQL (POSITION #\. LOCALE) 5) (SETQ CODESET
    (STRING-DOWNCASE (SUBSEQ LOCALE 6))))
    (WHEN (EQL (POSITION #\_ LOCALE) 2) (SETQ TERRITORY
    (STRING-DOWNCASE (SUBSEQ LOCALE 3 5))))
    (SETQ LANGUAGE (STRING-DOWNCASE (SUBSEQ LOCALE 0 2)))
    (COND ((EQUAL LANGUAGE "en") (SETQ
    *MAXIMA-LANG-SUBDIR* NIL))
    ((ZL-MEMBER LANGUAGE '("es" "pt"))
    (IF (ZL-MEMBER CODESET '("utf-8" "utf8")) (SETQ
    *MAXIMA-LANG-SUBDIR* (CONCATENATE 'STRING LANGUAGE ".utf8"))
    (SETQ *MAXIMA-LANG-SUBDIR* LANGUAGE)))
    (T (SETQ *MAXIMA-LANG-SUBDIR* NIL)))
    (COND ((EQUAL LANGUAGE "es") (SETQ
    CL-INFO::*INDEX-NAME* (FORMAT NIL "~andice" (CODE-CHAR 205))))
    ((EQUAL LANGUAGE "pt") (SETQ CL-INFO::*INDEX-NAME*
    (FORMAT NIL "~andice" (CODE-CHAR 205)))))
    (COND
    ((ZL-MEMBER LANGUAGE '("es" "pt"))
    (SETQ CL-INFO::*EXTRA-CHARS* (FORMAT NIL "~a-~a"
    (CODE-CHAR 192) (CODE-CHAR 255))))))))
    (SETQ CL-INFO::*LANG-SUBDIR* *MAXIMA-LANG-SUBDIR*)))> 0
    EVAL frame for form (SET-LOCALE)
    <20> #<SPECIAL-OPERATOR CATCH>
    EVAL frame for form
    (CATCH 'TO-LISP (SET-PATHNAMES) (SET-LOCALE)
    (LET* NIL (MULTIPLE-VALUE-SETQ (INPUT-STREAM BATCH-FLAG)
    (PROCESS-MAXIMA-ARGS INPUT-STREAM BATCH-FLAG))
    (VALUES INPUT-STREAM BATCH-FLAG))
    (TAGBODY #:G19698
    (BLOCK #:G19699
    (CATCH '#:G19700
    (LET
    ((SYSTEM::*ACTIVE-RESTARTS*
    (CONS
    (LOAD-TIME-VALUE
    (SYSTEM::MAKE-RESTART :NAME 'MACSYMA-QUIT
    :INVOKE-TAG '#:G19700 :REPORT
    #'(LAMBDA (STREAM) (FORMAT STREAM "Maxima
    top-level"))))
    SYSTEM::*ACTIVE-RESTARTS*)))
    (RETURN-FROM #:G19699 (MACSYMA-TOP-LEVEL INPUT-STREAM
    BATCH-FLAG))))
    (VALUES NIL T))
    (GO #:G19698)))
    <21> #<SPECIAL-OPERATOR LET>
    EVAL frame for form
    (LET ((INPUT-STREAM *STANDARD-INPUT*) (BATCH-FLAG NIL))
    (CATCH 'TO-LISP (SET-PATHNAMES) (SET-LOCALE)
    (LET* NIL (MULTIPLE-VALUE-SETQ (INPUT-STREAM BATCH-FLAG)
    (PROCESS-MAXIMA-ARGS INPUT-STREAM BATCH-FLAG))
    (VALUES INPUT-STREAM BATCH-FLAG))
    (TAGBODY #:G19698
    (BLOCK #:G19699
    (CATCH '#:G19700
    (LET
    ((SYSTEM::*ACTIVE-RESTARTS*
    (CONS
    (LOAD-TIME-VALUE
    (SYSTEM::MAKE-RESTART :NAME 'MACSYMA-QUIT
    :INVOKE-TAG '#:G19700 :REPORT
    #'(LAMBDA (STREAM) (FORMAT STREAM "Maxima
    top-level"))))
    SYSTEM::*ACTIVE-RESTARTS*)))
    (RETURN-FROM #:G19699 (MACSYMA-TOP-LEVEL INPUT-STREAM
    BATCH-FLAG))))
    (VALUES NIL T))
    (GO #:G19698))))
    <22> #<SPECIAL-OPERATOR PROGN>
    EVAL frame for form
    (PROGN (EVAL-WHEN (:COMPILE-TOPLEVEL LOAD EVAL) (SETQ
    *PACKAGE* (SYSTEM::%FIND-PACKAGE "MAXIMA"))) (SETQ
    *LOAD-VERBOSE* NIL)
    (SETQ *DEBUGGER-HOOK* #'MAXIMA-LISP-DEBUGGER)
    (LET ((INPUT-STREAM *STANDARD-INPUT*) (BATCH-FLAG NIL))
    (CATCH 'TO-LISP (SET-PATHNAMES) (SET-LOCALE)
    (LET* NIL (MULTIPLE-VALUE-SETQ (INPUT-STREAM BATCH-FLAG)
    (PROCESS-MAXIMA-ARGS INPUT-STREAM BATCH-FLAG))
    (VALUES INPUT-STREAM BATCH-FLAG))
    (TAGBODY #:G19698
    (BLOCK #:G19699
    (CATCH '#:G19700
    (LET
    ((SYSTEM::*ACTIVE-RESTARTS*
    (CONS
    (LOAD-TIME-VALUE
    (SYSTEM::MAKE-RESTART :NAME 'MACSYMA-QUIT
    :INVOKE-TAG '#:G19700 :REPORT
    #'(LAMBDA (STREAM) (FORMAT STREAM "Maxima
    top-level"))))
    SYSTEM::*ACTIVE-RESTARTS*)))
    (RETURN-FROM #:G19699 (MACSYMA-TOP-LEVEL INPUT-STREAM
    BATCH-FLAG))))
    (VALUES NIL T))
    (GO #:G19698)))))
    APPLY frame for call (RUN)
    Printed 22 frames
    Break 1 [1]>

     
  • Robert Dodier

    Robert Dodier - 2006-09-10

    Logged In: YES
    user_id=501686

    Ruz, thanks for the additional information. It still looks
    like somehow "" is returned from SI::GETENV (to judge by the
    error message from AREF). Can you try to change

    ((null locale) ...)

    in SET-LOCALE (in src/init-cl.lisp) to

    ((or (null locale) (equal locale "")) ...)

    Let me know how it turns out.

    You will need to rebuild Maxima in order for this change to
    take effect, I believe. (For many changes, all you need to
    do is load("my_new_file.lisp"); within Maxima. But we can't
    get that far.)

     
  • Ruslan U. Zakirov

    Logged In: YES
    user_id=1594760

    Ok, I'm compiling changed version.

    I think you're very close, but as I can see problem happens
    a little bit earlier in:
    (setq locale (or (maxima-getenv "LC_ALL")
    (maxima-getenv "LC_MESSAGES")
    (maxima-getenv "LANG")))
    ...
    And here is my environment:
    ~ # env | grep 'LC_ALL\|LANG'
    LC_ALL=
    LANG=ru_RU.UTF-8

    As you can see LC_ALL is set to empty string and as I
    understand 'or' returns first defined(not NIL in lisp).
    Is it correct?

     
  • Ruslan U. Zakirov

    Logged In: YES
    user_id=1594760

    Ok, patched version works fine, but as I've described before
    it's a sort of workaround.

     
  • Robert Dodier

    Robert Dodier - 2006-09-11

    Logged In: YES
    user_id=501686

    Glad to hear the patch works. I agree it's a workaround. By
    the way, although someone is working on a Russian
    translation of the reference manual, it is not ready yet, so
    I don't think LANG=ru_RU.UTF-8 will have any effect.
    Eventually it will.

    Here is a modified SETQ to replace (SETQ LOCALE ...) in
    SET-LOCALE in src/init-cl.lisp. Please try this and let me
    know if it works.

    (setq locale
    (or
    (let ((x (maxima-getenv "LC_ALL"))) (if (and x
    (not (equal x ""))) x))
    (let ((x (maxima-getenv "LC_MESSAGES"))) (if
    (and x (not (equal x ""))) x))
    (let ((x (maxima-getenv "LANG"))) (if (and x
    (not (equal x ""))) x))))

     
  • Robert Dodier

    Robert Dodier - 2006-09-24

    Logged In: YES
    user_id=501686

    Following stuff committed as r1.74 src/init-cl.lisp. Intent
    is to treat "", e.g. from something like
    export LC_MESSAGES=
    the same as NIL.

    Closing this report as fixed. Ruz, thanks for reporting the
    problem.

    --- src/init-cl.lisp 9 Sep 2006 05:05:48 -0000 1.73
    +++ src/init-cl.lisp 23 Sep 2006 23:02:02 -0000
    @@ -214,9 +214,11 @@
    (let (locale language territory codeset)
    (setq cl-info::*index-name* "index")
    (unless (setq *maxima-lang-subdir* (maxima-getenv
    "MAXIMA_LANG_SUBDIR"))
    - (setq locale (or (maxima-getenv "LC_ALL")
    - (maxima-getenv "LC_MESSAGES")
    - (maxima-getenv "LANG")))
    + (setq locale
    + (or
    + (let ((x (maxima-getenv "LC_ALL"))) (if (and
    x (not (equal x ""))) x))
    + (let ((x (maxima-getenv "LC_MESSAGES"))) (if
    (and x (not (equal x ""))) x))
    + (let ((x (maxima-getenv "LANG"))) (if (and x
    (not (equal x ""))) x))))
    (cond
    ((or (null locale) (equal locale ""))
    (setq *maxima-lang-subdir* nil))

     
  • Robert Dodier

    Robert Dodier - 2006-09-24
    • status: open --> closed
    • summary: Maxima encountered a Lisp error on start --> empty locale environment variables => error at launch
     

Log in to post a comment.