#10822: sage -sh doesn't set the path right if default shell is zsh on OSX
-----------------------+----------------------------------------------------
   Reporter:  jason    |       Owner:     
       Type:  defect   |      Status:  new
   Priority:  major    |   Milestone:     
  Component:  scripts  |    Keywords:     
     Author:           |    Upstream:  N/A
   Reviewer:           |      Merged:     
Work_issues:           |  
-----------------------+----------------------------------------------------

Comment(by jhpalmieri):

 I have one idea how to fix this, but it doesn't seem ideal: first, change
 the SHELL_OPTS for zsh to " -d".  Then create a .zshrc file, say in
 SAGE_ROOT/local/bin, containing
 {{{
 export PATH=$SAGE_ROOT:$SAGE_LOCAL/bin:$PATH
 }}}
 and then tell zsh to read this file when starting up.  The following patch
 to sage-sage does it, and also fixes the prompt:
 {{{
 #!diff
 diff -r e7a865848991 sage-sage
 --- a/sage-sage
 +++ b/sage-sage
 @@ -478,16 +478,19 @@ if [ "$1" = '-sh'  -o "$1" = '--sh' ]; t
      echo
      # We must start a new shell with no .profile or .bashrc files
      # processed, so that we know our path is correct
 -    PS1="SAGE_ROOT=${SAGE_ROOT}\n(sage subshell) \h:\W \u\$ "
 -    export PS1
      case $SHELL_NAME in
          bash)
 +           PS1="SAGE_ROOT=${SAGE_ROOT}\n(sage subshell) \h:\W \u\$ "
 +           export PS1
              SHELL_OPTS=" --norc"
              ;;
          csh)
              SHELL_OPTS=" -f"
              ;;
          ksh)
 +           PS1="""SAGE_ROOT=${SAGE_ROOT}
 +(sage subshell) `hostname -s`:\${PWD##*/} $USER$ """
 +           export PS1
              SHELL_OPTS=" -p"
              ;;
          sh)
 @@ -497,7 +500,12 @@ if [ "$1" = '-sh'  -o "$1" = '--sh' ]; t
              SHELL_OPTS=" -f"
              ;;
          zsh)
 -            SHELL_OPTS=" -f -d"
 +           PS1="""SAGE_ROOT=${SAGE_ROOT}
 +(sage subshell) %m:%1~ %n$ """
 +           export PS1
 +           ZDOTDIR=${SAGE_ROOT}/local/bin/
 +           export ZDOTDIR
 +            SHELL_OPTS=" -d"
              ;;
          *)
              echo >&2 "Unknown shell: $SHELL!"
 }}}
 I think that setting the prompt for csh and tcsh might require a similar
 trick, since their prompt doesn't seem to be governed by an environment
 variable the same way.

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/10822#comment:11>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to