#9386: sage-native-execute leaves traces of sage
-------------------------------------+-------------------------------------
       Reporter:  nbruin             |        Owner:  tbd
           Type:  defect             |       Status:  needs_review
       Priority:  major              |    Milestone:  sage-6.4
      Component:  packages:          |   Resolution:
  standard                           |    Merged in:
       Keywords:                     |    Reviewers:
        Authors:  Thierry Monteil    |  Work issues:
Report Upstream:  N/A                |       Commit:
         Branch:                     |  920c897ec3c439d772f7dfef1a420fb9aec0baea
  u/tmonteil/sage_native_execute_leaves_traces_of_sage|     Stopgaps:
   Dependencies:                     |
-------------------------------------+-------------------------------------

Comment (by nbruin):

 Replying to [comment:9 tmonteil]:
 > Instead of storing the whole environment on a central place, i was
 thinking of having a modified `export` function that applies to all Sage,
 that stores the previous value if it is not already stored (with a special
 flag to remember that the variable did no exist, which seems slightly
 different than being the empty string)

 The restoring bit could be easy:
  - scan the entire environment for variable names of the form
 `SAGE_OLD_<name>`. For each of those:
  - If the value of `SAGE_OLD_<name>` is of the form `+<value>` then set
 `<name>=<value>`
  - If the value is empty, unset `<name>`
  - If value is non-empty but does not start with +: error.
 That's a simple loop you can execute in `sage-native-execute`.

 The difficult part is ensuring all exports adhere to the standard imposed
 here. You could make a bash function that does this, but not all
 environment setting needs to happen by bash, and we might not have easy
 control over all environment setting instructions (chances are we do for
 all variables that matter, though. If we adjust sage-env, we're probably
 already good). An obvious advantage is that any non-cooperating
 environment clobbering will simply not be restored, which is not
 necessarily an error condition.

 > it remains a local operation that passes the required info along
 subprocesses, so it is probably easier to maintain. Then, it suffices to
 copy-or-unset those values when `sage-native-execute` is called. I don't
 know which is best.

 Agreed. Storing an environment in a temporary variable somewhere sounds
 awkward.

--
Ticket URL: <http://trac.sagemath.org/ticket/9386#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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.

Reply via email to