MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Marc Alff Date:January 26 2010 3:50am
Subject:bzr commit into mysql-5.5-next-mr branch (marc.alff:2974) Bug#50337
View as plain text  
#At file:///home/malff/BZR_TREE/mysql-next-mr-marc-50337/ based on revid:marc.alff@stripped

 2974 Marc Alff	2010-01-25
      Bug#50337 --defaults-file=~/something doesn't work anymore
      
      Before this fix, opening a configuration file located under "~" failed.
      To evaluate the "~" path, home_dir needs to be initialized.
      The 'home_dir' variable was initialized too late in my_init().
      
      This fix:
      - moved the home_dir initialization from my_init() to my_basic_init(),
        using getenv("HOME"))
      - moved the initialization of my_umask / my_umask_dir also to
        my_basic_init(), to have all the my_umask / my_umask_dir init code in the
        same place.
      
      The second part is not strictly required, but makes the code more
      maintainable.
      
      Tested the fix manually.
      
      No MTR tests added, because MTR should not access or modify the $HOME
      directory of the user running tests.

    modified:
      mysys/my_init.c
=== modified file 'mysys/my_init.c'
--- a/mysys/my_init.c	2010-01-07 05:42:07 +0000
+++ b/mysys/my_init.c	2010-01-26 03:50:31 +0000
@@ -74,6 +74,8 @@ static MYSQL_FILE instrumented_stdin;
 */
 my_bool my_basic_init(void)
 {
+  char * str;
+
   if (my_basic_init_done)
     return 0;
   my_basic_init_done= 1;
@@ -82,6 +84,19 @@ my_bool my_basic_init(void)
   my_umask= 0660;                       /* Default umask for new files */
   my_umask_dir= 0700;                   /* Default umask for new directories */
 
+#ifndef VMS
+  /* Default creation of new files */
+  if ((str= getenv("UMASK")) != 0)
+    my_umask= (int) (atoi_octal(str) | 0600);
+  /* Default creation of new dir's */
+  if ((str= getenv("UMASK_DIR")) != 0)
+    my_umask_dir= (int) (atoi_octal(str) | 0700);
+#endif
+
+  /* $HOME is needed early to parse configuration files located in ~/ */
+  if ((home_dir= getenv("HOME")) != 0)
+    home_dir= intern_filename(home_dir_buff, home_dir);
+
   init_glob_errs();
 
   instrumented_stdin.m_file= stdin;
@@ -124,7 +139,6 @@ my_bool my_basic_init(void)
 
 my_bool my_init(void)
 {
-  char * str;
   if (my_init_done)
     return 0;
   my_init_done= 1;
@@ -142,24 +156,11 @@ my_bool my_init(void)
   {
     DBUG_ENTER("my_init");
     DBUG_PROCESS((char*) (my_progname ? my_progname : "unknown"));
-    if (!home_dir)
-    {					/* Don't initialize twice */
-      my_win_init();
-      if ((home_dir=getenv("HOME")) != 0)
-	home_dir=intern_filename(home_dir_buff,home_dir);
-#ifndef VMS
-      /* Default creation of new files */
-      if ((str=getenv("UMASK")) != 0)
-	my_umask=(int) (atoi_octal(str) | 0600);
-	/* Default creation of new dir's */
-      if ((str=getenv("UMASK_DIR")) != 0)
-	my_umask_dir=(int) (atoi_octal(str) | 0700);
-#endif
+    my_win_init();
 #ifdef VMS
-      init_ctype();			/* Stupid linker don't link _ctype.c */
+    init_ctype();                       /* Stupid linker don't link _ctype.c */
 #endif
-      DBUG_PRINT("exit",("home: '%s'",home_dir));
-    }
+    DBUG_PRINT("exit", ("home: '%s'", home_dir));
 #ifdef __WIN__
     win32_init_tcp_ip();
 #endif


Attachment: [text/bzr-bundle] bzr/marc.alff@sun.com-20100126035031-d60t0r8v5npjk876.bundle
Thread
bzr commit into mysql-5.5-next-mr branch (marc.alff:2974) Bug#50337Marc Alff26 Jan
  • Re: bzr commit into mysql-5.5-next-mr branch (marc.alff:2974) Bug#50337Guilhem Bichot26 Jan