Index: /CMT/HEAD/ChangeLog
===================================================================
--- /CMT/HEAD/ChangeLog	(revision 143)
+++ /CMT/HEAD/ChangeLog	(revision 144)
@@ -1,2 +1,38 @@
+2006-02-07  Christian Arnault  <arnault@lal.in2p3.fr> 295
+
+	* mgr/requirements: Protect cmtpath_patterns with strategies
+	use $(CMTCONFIG) instead of $(tag) in cmtpath_patterns
+
+	* source/cmt_parser.cxx (configure_cmt_path): Suppress warnings for bad paths at this stage
+	(do_check_configuration): Add set_standard_macros for do_check_configuration
+
+	* source/cmt_commands.cxx (do_check): Activate warnings for check configuration and for setup 
+
+	* source/cmt_symbol.cxx (filter_path_value): Don't kill path item when they don't exist.
+	(action): Reset all_sets_done at each symbol definition.
+	(all_set): Protect against internal recursivity
+	(all_print): Print path settings here.
+	(check_all_paths): Add a new function to check all paths.
+	(SetBuilder::build): suppress detetion of overridings from here (move to SymbolValueList::show)
+	(PathBuilder::build): suppress detetion of overridings from here (move to SymbolValueList::show)
+	(MacroBuilder::build): suppress detetion of overridings from here (move to SymbolValueList::show)
+	(ActionBuilder::build): suppress detetion of overridings from here (move to SymbolValueList::show)
+	(SymbolValueList::show): Keep reset to null actions
+	Print overridings
+
+	* source/cmt_system.cxx: Add include cmt_map.h for putenv management
+	(class CMTPathManager): Suppress generation of an error when the CMTPATH item does not exist 
+
+2006-02-06  Christian Arnault  <arnault@lal.in2p3.fr> 294
+
+	* source/cmt_cvs.cxx (class CvsImplementation): Uses the new CmtSystem::putenv API
+
+	* source/cmt_symbol.cxx (all_set): Uses the new CmtSystem::putenv API to fix setup problems 
+
+	* source/cmt_system.h (class CmtSystem): Modifying the API of the internal putenv function 
+
+	* source/cmt_system.cxx (putenv): Replacing the old putenv implementation with a new one using a static map
+	of all used environment variables so as to ensure a stable string
+
 2006-01-31    <arnault@lal.in2p3.fr> 293
 
Index: /CMT/HEAD/mgr/cmt_dependencies.make
===================================================================
--- /CMT/HEAD/mgr/cmt_dependencies.make	(revision 143)
+++ /CMT/HEAD/mgr/cmt_dependencies.make	(revision 144)
@@ -10,5 +10,5 @@
 cmt_script_cxx_dependencies =  ../source/cmt_script.cxx   ../source/cmt_std.h   ../source/cmt_string.h   ../source/cmt_vector.h   ../source/cmt_regexp.h   ../source/cmt_system.h   ../source/cmt.h   ../source/cmt_parser.h   ../source/cmt_script.h   ../source/cmt_map.h   ../source/cmt_include.h   ../source/cmt_pattern.h   ../source/cmt_scope_section.h   ../source/cmt_use.h 
 cmt_string_cxx_dependencies =  ../source/cmt_string.cxx   ../source/cmt_std.h   ../source/cmt_string.h 
-cmt_system_cxx_dependencies =  ../source/cmt_system.cxx   ../source/cmt_std.h   ../source/cmt_string.h   ../source/cmt_vector.h   ../source/cmt_regexp.h   ../source/cmt_system.h   ../source/cmt_error.h 
+cmt_system_cxx_dependencies =  ../source/cmt_system.cxx   ../source/cmt_std.h   ../source/cmt_string.h   ../source/cmt_vector.h   ../source/cmt_regexp.h   ../source/cmt_system.h   ../source/cmt_error.h   ../source/cmt_map.h 
 cmt_tag_cxx_dependencies =  ../source/cmt_tag.cxx   ../source/cmt_std.h   ../source/cmt_string.h   ../source/cmt_vector.h   ../source/cmt_regexp.h   ../source/cmt_system.h   ../source/cmt.h   ../source/cmt_parser.h   ../source/cmt_map.h   ../source/cmt_include.h   ../source/cmt_script.h   ../source/cmt_pattern.h   ../source/cmt_scope_section.h   ../source/cmt_use.h   ../source/cmt_tag.h   ../source/cmt_branch.h   ../source/cmt_fragment.h   ../source/cmt_group.h   ../source/cmt_constituent.h   ../source/cmt_language.h   ../source/cmt_symbol.h   ../source/cmt_awk.h   ../source/cmt_project.h   ../source/cmt_cmtpath_pattern.h   ../source/cmt_database.h   ../source/cmt_log.h 
 cmt_use_cxx_dependencies =  ../source/cmt_use.cxx   ../source/cmt_std.h   ../source/cmt_string.h   ../source/cmt_vector.h   ../source/cmt_map.h   ../source/cmt_regexp.h   ../source/cmt_system.h   ../source/cmt.h   ../source/cmt_parser.h   ../source/cmt_include.h   ../source/cmt_script.h   ../source/cmt_pattern.h   ../source/cmt_scope_section.h   ../source/cmt_use.h   ../source/cmt_tag.h   ../source/cmt_symbol.h   ../source/cmt_error.h   ../source/cmt_branch.h   ../source/cmt_fragment.h   ../source/cmt_group.h   ../source/cmt_constituent.h   ../source/cmt_language.h   ../source/cmt_awk.h   ../source/cmt_project.h   ../source/cmt_cmtpath_pattern.h   ../source/cmt_database.h   ../source/cmt_syntax.h 
Index: /CMT/HEAD/mgr/requirements
===================================================================
--- /CMT/HEAD/mgr/requirements	(revision 143)
+++ /CMT/HEAD/mgr/requirements	(revision 144)
@@ -656,10 +656,12 @@
 
 cmtpath_pattern \
-  macro cmt_installarea_paths "$(cmt_installarea_prefix)/$(tag)/bin" ; \
-  macro_append cmt_installarea_paths " $(cmt_installarea_prefix)/$(tag)/lib" ; \
-  macro_append cmt_installarea_paths " $(cmt_installarea_prefix)/share/lib" ; \
-  macro_append cmt_installarea_paths " $(cmt_installarea_prefix)/share/bin" ; \
-  macro_prepend use_linkopts   " $(cmt_installarea_linkopts) " ; \
-  macro_append shlibbuilder    " $(cmt_installarea_linkopts) "
+  macro cmt_installarea_paths "$(cmt_installarea_prefix)/$(CMTCONFIG)/bin"
+
+cmtpath_pattern \
+  macro_append cmt_installarea_paths "" <project>_with_installarea " $(<project>_installarea_prefix)/$(CMTCONFIG)/lib" ; \
+  macro_append cmt_installarea_paths "" <project>_with_installarea " $(<project>_installarea_prefix)/share/lib" ; \
+  macro_append cmt_installarea_paths "" <project>_with_installarea " $(<project>_installarea_prefix)/share/bin" ; \
+  macro_prepend use_linkopts         "" <project>_with_installarea " $(<project>_installarea_linkopts) " ; \
+  macro_append shlibbuilder          "" <project>_with_installarea " $(<project>_installarea_linkopts) "
 
 macro CMT_PATH_remove_regexp "/[^/]*/" WIN32 "\\[^\\]*\\"
@@ -675,19 +677,20 @@
   path_remove_regexp CLASSPATH "" <project>_with_installarea "$(<project>_installarea_prefix_remove)$(CMT_PATH_remove_share_regexp)bin$"
 
+
 cmtpath_pattern \
   path_prepend PATH "" \
-               <project>_with_installarea&WIN32 "<path>/$(<project>_installarea_prefix)/${tag}/bin" \
-               <project>_with_installarea&Unix "<path>/$(<project>_installarea_prefix)/${tag}/bin" ; \
+               <project>_with_installarea&WIN32 "<path>/$(<project>_installarea_prefix)/${CMTCONFIG}/bin" \
+               <project>_with_installarea&Unix "<path>/$(<project>_installarea_prefix)/${CMTCONFIG}/bin" ; \
   path_prepend PATH "" \
-               <project>_with_installarea&WIN32 "<path>/$(<project>_installarea_prefix)/${tag}/lib" \
-               <project>_with_installarea&CYGWIN "<path>/$(<project>_installarea_prefix)/${tag}/lib" ; \
+               <project>_with_installarea&WIN32 "<path>/$(<project>_installarea_prefix)/${CMTCONFIG}/lib" \
+               <project>_with_installarea&CYGWIN "<path>/$(<project>_installarea_prefix)/${CMTCONFIG}/lib" ; \
   path_prepend LD_LIBRARY_PATH "" \
-               <project>_with_installarea&Unix "<path>/$(<project>_installarea_prefix)/${tag}/lib" ; \
+               <project>_with_installarea&Unix "<path>/$(<project>_installarea_prefix)/${CMTCONFIG}/lib" ; \
   path_prepend CLASSPATH "" <project>_with_installarea "<path>/$(<project>_installarea_prefix)/share/lib" ; \
   path_prepend CLASSPATH "" <project>_with_installarea "<path>/$(<project>_installarea_prefix)/share/bin" ; \
   macro_prepend cmt_installarea_linkopts "" \
                 <project>_without_installarea "" \
-                <project>_with_installarea&Unix " -L<path>/$(<project>_installarea_prefix)/$(tag)/lib " \
-                <project>_with_installarea&WIN32 " /LIBPATH:<path>\$(<project>_installarea_prefix)\$(tag)\lib "
+                <project>_with_installarea&Unix " -L<path>/$(<project>_installarea_prefix)/$(CMTCONFIG)/lib " \
+                <project>_with_installarea&WIN32 " /LIBPATH:<path>\$(<project>_installarea_prefix)\$(CMTCONFIG)\lib "
 
 set NEWCMTCONFIG "${cmt_hardware}-${cmt_system_version}-${cmt_compiler_version}"
Index: /CMT/HEAD/source/cmt_commands.cxx
===================================================================
--- /CMT/HEAD/source/cmt_commands.cxx	(revision 143)
+++ /CMT/HEAD/source/cmt_commands.cxx	(revision 144)
@@ -689,4 +689,5 @@
 	{
 	  cmt.m_action = action_check_configuration;
+	  cmt.m_warnings = true;
 	}
       else if (arg == "files")
@@ -1108,4 +1109,5 @@
 {
   cmt.m_action = action_setup;
+  cmt.m_warnings = true;
 }
 
Index: /CMT/HEAD/source/cmt_cvs.cxx
===================================================================
--- /CMT/HEAD/source/cmt_cvs.cxx	(revision 143)
+++ /CMT/HEAD/source/cmt_cvs.cxx	(revision 144)
@@ -1018,14 +1018,13 @@
     static cmt_string CMTPATH;
 
-    cmt_string cmtpath = CmtSystem::getenv ("CMTPATH");
+    cmt_string cmtpath = Symbol::get_env_value ("CMTPATH");
 
     if (cmtpath.find (dir) == cmt_string::npos)
       {
-	CMTPATH = "CMTPATH=";
-	CMTPATH += dir;
+	CMTPATH = dir;
 	CMTPATH += ":";
 	CMTPATH += cmtpath;
-	
-	CmtSystem::putenv (CMTPATH);
+
+	CmtSystem::putenv ("CMTPATH", CMTPATH);
       }
 
Index: /CMT/HEAD/source/cmt_parser.cxx
===================================================================
--- /CMT/HEAD/source/cmt_parser.cxx	(revision 143)
+++ /CMT/HEAD/source/cmt_parser.cxx	(revision 144)
@@ -565,40 +565,10 @@
   cmt_string s;
 
-  /*
-  Symbol* symbol = Symbol::find ("CMTPATH");
-  if (symbol != 0)
-    {
-      bool show_set_hidden = false;
-
-      if (Me.m_action == action_show_set)
-        {
-          show_set_hidden = true;
-          Me.m_action = action_none;
-        }
-
-      s = symbol->build_macro_value ();
-      Symbol::expand (s);
-
-      if (show_set_hidden)
-        {
-          show_set_hidden = false;
-          Me.m_action = action_show_set;
-        }
-    }
-  else
-    {
-      s = CmtSystem::getenv ("CMTPATH");
-    }
-  */
-
   s = Symbol::get_env_value ("CMTPATH");
 
   {
     bool q = Me.m_quiet;
-    bool w = Me.m_warnings;
     Me.m_quiet = true;  
-    Me.m_warnings = true;  
     Symbol::filter_path_value ("CMTPATH", s);
-    Me.m_warnings = w;  
     Me.m_quiet = q;
   }
@@ -1962,4 +1932,6 @@
   Tag* tag;
 
+  set_standard_macros ();
+
   static CmtSystem::cmt_string_vector tags;
 
@@ -1979,4 +1951,6 @@
     }
 
+  Symbol::check_all_paths ();
+
   env = CmtSystem::getenv ("CMTSITE");
   if (env == "") 
@@ -1995,4 +1969,5 @@
       cerr << "#CMT> The CMTSITE value " << env << " is not used in any tag expression. Please check spelling" << endl;
     }
+
 }
 
@@ -4012,14 +3987,4 @@
 	      IProjectFactory& factory = ProjectFactory::instance ();
 	      factory.create_project ("", pwd, "CurrentProject", 0);
-
-	      /*
-	      cmt_string temp = "path_prepend CMTPATH \"";
-	      temp += pwd;
-	      temp += "\"";
-	      
-              Use& use = Use::current();
-
-	      SyntaxParser::parse_requirements_line (temp, &use);
-	      */
 
 	      break;
@@ -5191,6 +5156,11 @@
     case action_unlock :
       // case action_version :
-      reach_current_package ();
-      use_user_context_requirements ();
+      {
+	bool w = Me.m_warnings;
+	Me.m_warnings = false;
+	reach_current_package ();
+	use_user_context_requirements ();
+	Me.m_warnings = w;
+      }
       break;
     default:
@@ -7536,5 +7506,5 @@
 
   Me.m_recursive = true;
-  Me.m_debug = false;
+  //Me.m_debug = false;
   use = Use::add (Me.m_default_path, "CMT", Me.m_cmt_version, "", "", 0);
   Me.m_recursive = recursive_copy;
Index: /CMT/HEAD/source/cmt_symbol.cxx
===================================================================
--- /CMT/HEAD/source/cmt_symbol.cxx	(revision 143)
+++ /CMT/HEAD/source/cmt_symbol.cxx	(revision 144)
@@ -876,8 +876,6 @@
 	  if (Cmt::get_warnings ())
 	    {
-	      cerr << "#CMT> Warning: Wrong " << name << " item " << t << endl;
+	      cout << "#CMT> Warning: Wrong path item " << t << " in " << name << endl;
 	    }
-	    
-	  t = "";
 	}
     }
@@ -975,4 +973,6 @@
       const cmt_string& default_value = words[2];
 
+      Cmt::reset_all_sets_done ();
+
       if (Cmt::get_debug ())
 	{
@@ -1301,11 +1301,17 @@
   //cerr << "all_set" << endl;
 
+  static bool running = false;
+
+
   if (Cmt::get_debug ())
     {
-      cout << "Symbol::all_set> done" << Cmt::get_all_sets_done () << endl;
+      cout << "\nSymbol::all_set> done=" << running << endl;
     }
 
   if (Cmt::get_all_sets_done ()) return;
 
+  if (running) return;
+
+  running = true;
   Cmt::set_all_sets_done ();
 
@@ -1313,13 +1319,9 @@
   Use::UsePtrVector& Uses = Use::get_ordered_uses ();
 
-  static CmtSystem::cmt_string_vector envs;
-
-  envs.clear ();
-
   int number;
 
   if (Symbols.size () == 0) 
     {
-        //running = false;
+      running = false;
       return;
     }
@@ -1336,9 +1338,7 @@
       if (value != "")
 	{
-	  cmt_string& temp = envs.add ();
-
-	  temp = symbol.name;
-	  temp += '=';
-	  temp += value;
+	  Symbol::expand (value);
+
+	  CmtSystem::putenv (symbol.name, value);
 	}
     }
@@ -1360,18 +1360,20 @@
 	  if (use.get_strategy ("SetupConfig"))
 	    {
-	      cmt_string& temp = envs.add ();
+	      cmt_string temp;
 
 	      temp = use.prefix;
-	      temp += "CONFIG=";
-	      temp += cmtconfig;
+	      temp += "CONFIG";
+
+	      CmtSystem::putenv (temp, cmtconfig);
 	    }
 
 	  if (use.get_strategy ("SetupRoot"))
 	    {
-	      cmt_string& temp = envs.add ();
+	      cmt_string temp;
 
 	      temp = use.prefix;
-	      temp += "ROOT=";
-	      temp += use.get_full_path ();
+	      temp += "ROOT";
+
+	      CmtSystem::putenv (temp, use.get_full_path ());
 	    }
         }
@@ -1385,18 +1387,20 @@
 	if (use.get_strategy ("SetupConfig"))
 	  {
-	    cmt_string& temp = envs.add ();
-	    
+	    cmt_string temp;
+
 	    temp = use.prefix;
-	    temp += "CONFIG=";
-	    temp += cmtconfig;
+	    temp += "CONFIG";
+
+	    CmtSystem::putenv (temp, cmtconfig);
 	  }
 	
 	if (use.get_strategy ("SetupRoot"))
 	  {
-	    cmt_string& temp = envs.add ();
-	    
+	    cmt_string temp;
+
 	    temp = use.prefix;
-	    temp += "ROOT=";
-	    temp += use.get_full_path ();
+	    temp += "ROOT";
+
+	    CmtSystem::putenv (temp, use.get_full_path ());
 	  }
       }
@@ -1415,29 +1419,18 @@
 	  filter_path_value (symbol.name, value);
 
-	  cmt_string& temp = envs.add ();
-
-	  temp = symbol.name;
-	  temp += '=';
-	  temp += value;
+#ifdef WIN32
+	  value.replace_all ("/", "\\");
+#endif
+
+          if (Cmt::get_debug ())
+            {
+              cerr << "Symbol::all_set-2> " << symbol.name << " = " << value << endl;
+            }
+
+	  CmtSystem::putenv (symbol.name, value);
 	}
     }
 
-  for (number = 0; number < envs.size (); number++)
-    {
-      cmt_string& env = envs[number];
-      Symbol::expand (env);
-
-#ifdef WIN32
-      env.replace_all ("/", "\\");
-#endif
-
-      if (Cmt::get_debug ())
-        {
-          cout << "Symbol::all_set> " << env << endl;
-        }
-      CmtSystem::putenv (env);
-    }
-
-    //running = false;
+  running = false;
 }
 
@@ -1457,5 +1450,6 @@
       if ((symbol.type == SymbolSet) ||
           (symbol.type == SymbolAlias) ||
-          (symbol.type == SymbolSetupScript))
+          (symbol.type == SymbolSetupScript) ||
+          (symbol.type == SymbolPath))
         {
           if (symbol.print (mode))
@@ -1473,4 +1467,14 @@
         }
     }
+}
+
+//-------------------------------------------------------------
+void Symbol::check_all_paths ()
+{
+  static SymbolVector& Symbols = symbols ();
+
+  int number;
+
+  if (Symbols.size () == 0) return;
 
   for (number = 0; number < Symbol::symbol_number (); number++)
@@ -1478,17 +1482,12 @@
       Symbol& symbol = Symbol::symbol (number);
 
-      if ((symbol.type != SymbolPath)) continue;
-
-      if (symbol.print (mode))
-        {
-          if (mode == Bat)
-            {
-              cout << endl;
-            }
-          else
-            {
-              //cout << "; ";
-              cout << endl;
-            }
+      if (symbol.type == SymbolPath)
+        {
+	  cmt_string temp;
+
+	  temp = symbol.build_macro_value ();
+	  expand (temp);
+
+	  Symbol::filter_path_value (symbol.name, temp);
         }
     }
@@ -1940,5 +1939,4 @@
 
   bool first_definition = true;
-  bool defined = false;
 
   for (int i = 0; i < symbol.value_lists.size (); i++)
@@ -1984,29 +1982,4 @@
               {
                 temp = CmtSystem::getenv (symbol.name);
-              }
-
-            if (!defined)
-              {
-                defined = true;
-              }
-            else
-              {
-                if ((!Cmt::get_quiet ()) &&
-                    ((action == action_show_macro) ||
-		     (action == action_show_set) ||
-		     (action == action_show_action) ||
-		     (action == action_show_macros) ||
-		     (action == action_show_sets) ||
-		     (action == action_show_actions)))
-                  {
-                    cerr << "#CMT> Warning: Symbol " << symbol.name << " overridden";
-
-                    if (value_list.use != 0)
-                      {
-                        cerr << " in package " << value_list.use->get_package_name ();
-                      }
-
-                    cerr << endl;
-                  }
               }
 
@@ -2146,5 +2119,4 @@
 
   bool first_definition = true;
-  bool defined = false;
 
   for (int i = 0; i < symbol.value_lists.size (); i++)
@@ -2182,29 +2154,4 @@
                 resolve_value (new_value, symbol.name, temp);
                 temp = new_value;
-
-                if (!defined)
-                  {
-                    defined = true;
-                  }
-                else
-                  {
-		    if ((!Cmt::get_quiet ()) &&
-			((action == action_show_macro) ||
-			 (action == action_show_set) ||
-			 (action == action_show_action) ||
-			 (action == action_show_macros) ||
-			 (action == action_show_sets) ||
-			 (action == action_show_actions)))
-                      {
-                        cerr << "#CMT> Warning: Symbol " << symbol.name << " overridden";
-                        
-                        if (value_list.use != 0)
-                          {
-                            cerr << " in package " << value_list.use->get_package_name ();
-                          }
-                        
-                        cerr << endl;
-                      }
-                  }
               }
 
@@ -2495,5 +2442,4 @@
 
   bool first_definition = true;
-  bool defined = false;
 
   for (i = 0; i < symbol.value_lists.size (); i++)
@@ -2557,31 +2503,4 @@
         {
           temp = value.text;
-
-          if (!defined)
-            {
-              defined = true;
-            }
-          else
-            {
-	      /*
-	      if ((!Cmt::get_quiet ()) &&
-		  ((action == action_show_macro) ||
-		   (action == action_show_set) ||
-		   (action == action_show_action) ||
-		   (action == action_show_macros) ||
-		   (action == action_show_sets) ||
-		   (action == action_show_actions)))
-                {
-                  cerr << "#CMT> Warning: Symbol " << symbol.name << " overridden";
-                  
-                  if (value_list.use != 0)
-                    {
-                      cerr << " in package " << value_list.use->get_package_name ();
-                    }
-
-                  cerr << endl;
-                }
-	      */
-            }
         }
     }
@@ -2739,5 +2658,4 @@
 
   bool first_definition = true;
-  bool defined = false;
 
   temp = "";
@@ -2771,29 +2689,4 @@
         {
           temp = value.text;
-
-          if (!defined)
-            {
-              defined = true;
-            }
-          else
-            {
-	      if ((!Cmt::get_quiet ()) &&
-		  ((action == action_show_macro) ||
-		   (action == action_show_set) ||
-		   (action == action_show_action) ||
-		   (action == action_show_macros) ||
-		   (action == action_show_sets) ||
-		   (action == action_show_actions)))
-                {
-                  cerr << "#CMT> Warning: Symbol " << symbol.name << " overridden";
-                  
-                  if (value_list.use != 0)
-                    {
-                      cerr << " in package " << value_list.use->get_package_name ();
-                    }
-
-                  cerr << endl;
-                }
-            }
         }
     }
@@ -2892,5 +2785,28 @@
   ActionType action = Cmt::get_action ();
 
-  if (value.text == "") return;
+  switch (command_type)
+    {
+      //case CommandSet :
+      case CommandSetAppend :
+      case CommandSetPrepend :
+      case CommandSetRemove :
+      case CommandSetRemoveRegexp :
+	//case CommandAlias :
+	//case CommandPath :
+      case CommandPathAppend :
+      case CommandPathPrepend :
+      case CommandPathRemove :
+      case CommandPathRemoveRegexp :
+      case CommandMacroPrepend :
+	//case CommandMacro :
+      case CommandMacroAppend :
+      case CommandMacroRemove :
+      case CommandMacroRemoveRegexp :
+      case CommandMacroRemoveAll :
+      case CommandMacroRemoveAllRegexp :
+	//case CommandAction :
+	if (value.text == "") return;
+        break;
+    }
 
   if (discarded) discarded_text = " (discarded by override)";
Index: /CMT/HEAD/source/cmt_symbol.h
===================================================================
--- /CMT/HEAD/source/cmt_symbol.h	(revision 143)
+++ /CMT/HEAD/source/cmt_symbol.h	(revision 144)
@@ -89,4 +89,5 @@
   static void all_print (PrintMode mode);
   static void all_print_clean (PrintMode mode);
+  static void check_all_paths ();
 
   static int symbol_number ();
Index: /CMT/HEAD/source/cmt_system.cxx
===================================================================
--- /CMT/HEAD/source/cmt_system.cxx	(revision 143)
+++ /CMT/HEAD/source/cmt_system.cxx	(revision 144)
@@ -57,4 +57,5 @@
 #include "cmt_system.h"
 #include "cmt_error.h"
+#include "cmt_map.h"
 
 //--------------------------------------------------
@@ -94,8 +95,7 @@
 	{
 #ifdef USE_PWD
-	  new_dir = "PWD=";
-	  new_dir += dir;
+	  new_dir = dir;
 	  new_dir += file_separator ();
-	  putenv (new_dir);
+	  putenv ("PWD", new_dir);
 #endif
 
@@ -109,7 +109,5 @@
 	{
 #ifdef USE_PWD
-	  new_dir = "PWD=";
-	  new_dir += dir;
-	  putenv (new_dir);
+	  putenv ("PWD", dir);
 #endif
 
@@ -1222,11 +1220,39 @@
 }
 
-//----------------------------------------------------------
-bool CmtSystem::putenv (const cmt_string& name_value)
-{
-  int status = ::putenv ((char*) name_value.c_str ());
-
-  if (status == 0) return (true);
-  else return (false);
+/**
+   Implementation based on a local static map of used environment
+variables to ensure a stable character string. The OS requires
+that the character string sent via a putenv is kept untouched forever
+ */
+bool CmtSystem::putenv (const cmt_string& name, const cmt_string& value)
+{
+  static cmt_map <cmt_string, cmt_string> envs;
+
+  if (!envs.has (name))
+    {
+      cmt_string& v = *(new cmt_string);
+      v = name;
+      v += "=";
+      v += value;
+      envs.add (name, v);
+    }
+  else
+    {
+      cmt_string& v = *(envs.find (name));
+      v = name;
+      v += "=";
+      v += value;
+    }
+
+  {
+    const cmt_string& v = *envs.find (name);
+    //cerr << "#CmtSystem::putenv> name=" << name << " &v=" << &v << endl;
+
+    int status = ::putenv ((char*) v.c_str ());
+
+    if (status == 0) return (true);
+    else return (false);
+  }
+
 }
 
@@ -1296,15 +1322,8 @@
       }
     
-    cerr << "adding npath=[" << npath << "]" << endl;
+    //cerr << "adding npath=[" << npath << "]" << endl;
     
     if (npath != "")
       {
-	if (!CmtSystem::test_directory (npath))
-	  {
-	    cerr << "#CMT> Warning: path " << npath << " doesn't exist" << endl;
-	    CmtError::set (CmtError::path_not_found, npath);
-	    return;
-	  }
-
 	cmt_string project_name;
 
Index: /CMT/HEAD/source/cmt_system.h
===================================================================
--- /CMT/HEAD/source/cmt_system.h	(revision 143)
+++ /CMT/HEAD/source/cmt_system.h	(revision 144)
@@ -110,5 +110,5 @@
   static bool testenv (const cmt_string& name);
   static cmt_string getenv (const cmt_string& name);
-  static bool putenv (const cmt_string& name_value);
+  static bool putenv (const cmt_string& name, const cmt_string& value);
   static void get_cmt_paths (IProjectFactory& factory,
                              const cmt_string& init_text,
