#4029: [with patch; needs work] sage-env kills the shell when called from 
"wrong"
directory
--------------------------+-------------------------------------------------
 Reporter:  dphilp        |       Owner:  mabshoff       
     Type:  defect        |      Status:  new            
 Priority:  minor         |   Milestone:  sage-4.1.2     
Component:  distribution  |    Keywords:  sage-env source
 Reviewer:                |      Author:  Mike Hansen    
   Merged:                |  
--------------------------+-------------------------------------------------

Comment(by was):

 Reopened because wjp pointed out a serious issue -- the rest of the script
 gets executed.

 Some irc discussion about this:
 {{{
 williamstein: Regarding sage-env, I redid a patch of yours at #4029.
 [06:15am] williamstein:
 Wow, what does "$(exit 1)" mean?
 [06:15am] williamstein:
 ah, you give a reference.
 [06:16am] williamstein:
 I still don't understand it.
 [06:18am] williamstein:
 Mike could you change the patch itself to include a comment about what
 $(exit 1) means?  Or maybe just a link to that page in
 [06:18am] williamstein:
 a
 [06:18am] williamstein:
 comment?
 [06:18am] williamstein:
 Because googling for "$(exit 1)" would be tricky.
 [06:18am] williamstein:
 $(exit 1)
 [06:18am] williamstein:
 actually, it is easy to google for.
 [06:18am] williamstein:
 No, it isn't.
 [06:20am] williamstein:
 well if it works, it works, I guess.
 [06:21am] mhansen:
 Yeah, I don't quite understand it myself.
 [06:22am] williamstein:
 Well, it works perfecty.
 [06:22am] williamstein:
 so positive review.
 [06:23am] williamstein:
 And the current behavior in Sage (without the patch) is indeed
 "disconcerting".
 [06:24am] mhansen:
 I'm surprised that one page was the only page that I could find something
 about it.
 [06:24am] williamstein:
 Indeed.
 [06:25am] williamstein:
 It's hard to google though.
 [06:27am] wjp:
 isn't this trick only for passing a return status? I don't think it
 actually stops the script that's being sourced, right?
 [06:28am] williamstein:
 I don't know.  But if you try it, for some reason it works.
 [06:28am] wjp:
 hm, strange. Did you also test the remainder of sage-env doesn't get
 executed?
 [06:28am] williamstein:
 wjp -- you seam like the type to pull open the bash source code, read it,
 and completely understand what $(exit 1) does :-)
 [06:29am] wjp:
 I thought $(...) was the same as `...`
 [06:29am] wjp:
 (yes, I am kind of that type :-) )
 [06:29am] williamstein:
 crap, in fact, the remainder does get executed.
 [06:30am] williamstein:
 hey mhansen -- what did my original patch do?
 [06:30am] williamstein:
 since I think you deleted it.
 [06:30am] mhansen:
 Ripped the bottom half of sage-env out and put it in a different file.
 [06:30am] mhansen:
 By bottom half, I meant the part below that line.
 [06:31am] williamstein:
 oh, now I remember doing that.
 [06:31am] williamstein:
 "When in doubt, refactor it out!"
 }}}

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/4029#comment:10>
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