Opened 11 years ago

Closed 11 years ago

#4512 closed defect (fixed)

[with patch, positive review] sage path-related troubles

Reported by: craigcitro Owned by: craigcitro
Priority: blocker Milestone: sage-3.2
Component: build Keywords:
Cc: Merged in:
Authors: Reviewers:
Report Upstream: Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description

Unfortunately, it seems that sage -sh doesn't ask the shell to avoid processing the .profile or equivalent. In particular, it can lead to things like this:

[craigcitro@sharma ~/new-three-two]  $ ./sage -version
Sage Version 3.2.rc0, Release Date: 2008-11-10
[craigcitro@sharma ~/new-three-two]  $ ./sage -sh

Starting subshell with Sage environment variables set.
Be sure to exit when you are done and do not do anything
with other copies of Sage!

[craigcitro@sharma ~/new-three-two]  $ sage -version
SAGE Version 3.1.4, Release Date: 2008-10-16
[craigcitro@sharma ~/new-three-two]  $ which sage
/usr/local/bin/sage

This comes from the fact that I manually prepend certain things to my path in my .bashrc. Sadly, this leads to several small, subtle issues. I've attached a patch which turns several calls to sage into $SAGE_ROOT/sage.

However, something more serious is needed. I think that the right approach is to start the new shell without processing any login files, so that we know our path is correct. The patch does that.

I'm listing this as a blocker, because it causes such subtle errors, and because a fix is attached.

Attachments (2)

trac-4512.patch (3.3 KB) - added by craigcitro 11 years ago.
trac-4512-pt2.patch (2.2 KB) - added by craigcitro 11 years ago.

Download all attachments as: .zip

Change History (8)

Changed 11 years ago by craigcitro

comment:1 Changed 11 years ago by craigcitro

  • Status changed from new to assigned

This patch is for the sage-scripts repository, of course.

comment:2 Changed 11 years ago by mhansen

Could we at least have a PS1 that includes the current directory? I always hated it when I was on a machine where "sage -sh" didn't use my existing PS1.

comment:3 Changed 11 years ago by craigcitro

Yeah, that would be very reasonable.

Actually, we could go one further: have a specific place in ~/.sage/ where one can put .profile files and whatnot, with big warnings about paths. The point is really just that we don't want to grab the system-wide ones ...

comment:4 Changed 11 years ago by mabshoff

Craig,

I am not so sure this is a blocker, i.e. just because your .profile is misconfigured doesn't mean that as a consequence somebody else's config will not be broken by fixing it for you. I am inclined to merge this patch, but I need to think about it.

Cheers,

Michael

Changed 11 years ago by craigcitro

comment:5 Changed 11 years ago by mabshoff

  • Summary changed from [with patch, needs review] sage path-related troubles to [with patch, positive review] sage path-related troubles

trac-4512-pt2.patch addresses all my concerns even though it could be cleaner, i.e. via some special parameter. Craig will do so in a followup ticket, so positive review.

Cheers,

Michael

comment:6 Changed 11 years ago by mabshoff

  • Resolution set to fixed
  • Status changed from assigned to closed

Merged both patch in Sage 3.2.rc1

Note: See TracTickets for help on using tickets.