#10822: sage -sh doesn't set the path right if default shell is zsh on OSX
-----------------------+----------------------------------------------------
Reporter: jason | Owner:
Type: defect | Status: needs_review
Priority: major | Milestone:
Component: scripts | Keywords:
Work_issues: | Upstream: N/A
Reviewer: | Author: John Palmieri
Merged: | Dependencies: #11866, #11790
-----------------------+----------------------------------------------------
Comment(by ppurka):
What does the -d option do for zsh? I can't find anything
[http://zsh.sourceforge.net/Doc/Release/Options.html#Single-Letter-Options
at the manual] which suggests that that option is available.
Secondly, I believe one of the reasons for creating a new .zshrc is to
avoid sourcing user settings (as I read it in sage-sage). In this case,
one should invoke zsh as {{{zsh -o noglobalrcs}}} see
[http://zsh.sourceforge.net/Doc/Release/Files.html#Files Files].
A cleaner way to implement the ZDOTDIR would be to then '''remove'''
/tmp/.zshrc if it is present and echo a newer one. In fact, one could even
use the RPROMPT of zsh to get a cleaner prompt. It is less annoying that a
massive prompt that is obtained otherwise. :)
Here's a diff of what changes I did to sage-sage.
{{{
#!diff
# HG changeset patch
# User P Purkayastha <[email protected]>
# Date 1317310855 -28800
# Node ID 469d05f30083d92990be2a0af692062d9b51c7be
# Parent f8f1496d316ce8556a8d7350de61e0f755c23681
[mq]: trac_10822_fix_zsh_shell.patch
diff --git a/sage-sage b/sage-sage
--- a/sage-sage
+++ b/sage-sage
@@ -497,7 +497,23 @@
SHELL_OPTS=" -f"
;;
zsh)
- SHELL_OPTS=" -f -d"
+ FILE="/tmp/.zshrc"
+ if [ -e "$FILE" ]; then
+ if ! rm -f "$FILE"; then
+ echo "No permission to delete and create new file
$FILE"
+ exit 1
+ fi
+ fi
+ cat > "$FILE" << EOF
+PATH="$SAGE_ROOT:$SAGE_LOCAL/bin:$PATH"
+export PATH
+PS1="%m:%~ %n$ "
+export PS1
+RPROMPT=" #SAGE_ROOT=${SAGE_ROOT} (sage subshell)"
+export RPROMPT
+EOF
+ export ZDOTDIR="/tmp"
+ SHELL_OPTS="-o noglobalrcs"
;;
*)
echo >&2 "Unknown shell: $SHELL!"
}}}
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/10822#comment:17>
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.