[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
setting user environment variables
From: |
Rik |
Subject: |
setting user environment variables |
Date: |
Mon, 16 Mar 2015 19:13:51 -0700 |
3/16/15
All,
A little code review help is in order. Normally I wouldn't touch a user's
environment, but since we've moved to a dispatch program that forks to a
child I don't think this is so critical anymore as we are only affecting
the child which vanishes at exit anyways.
The issue is that the locale of the user is entering into Octave and
causing problems. Matlab, and Octave followed, unilaterally sets the
LC_NUMERIC and LC_TIME variables to the 'C' locale. This used to work, but
apparently it no longer does as there are now reports on savannah of
segfaults when these are not overriden (http://savannah.gnu.org/bugs/?44469).
The proposed patch, which was tested and works, is below. Any objections?
* octave.cc (octave_initialize_interpreter): Use octave_env::putenv to set
LC_NUMERIC and LC_TIME variables to 'C' as Matlab does.
diff -r fc6c87e254bf -r bd06a3c3ef9d libinterp/octave.cc
--- a/libinterp/octave.cc Sun Mar 15 17:03:16 2015 +0000
+++ b/libinterp/octave.cc Mon Mar 16 11:51:35 2015 -0700
@@ -727,6 +727,8 @@ octave_initialize_interpreter (int argc,
// Matlab uses "C" locale for LC_NUMERIC class regardless of local setting
setlocale (LC_NUMERIC, "C");
setlocale (LC_TIME, "C");
+ octave_env::putenv ("LC_NUMERIC", "C");
+ octave_env::putenv ("LC_TIME", "C");
Cheers,
Rik
- setting user environment variables,
Rik <=