List:Commits« Previous MessageNext Message »
From:Chuck Bell Date:October 15 2009 3:43pm
Subject:bzr push into mysql-6.0-backup branch (charles.bell:2880 to 2881)
Bug#41843
View as plain text  
 2881 Chuck Bell	2009-10-15
      BUG#41843 : Can not do backup to a named pipe on windows
      
      The system currently interprets '\\.\pipe\namedpipe' as a fixed
      path translated to 'pipe\namedpipe' which is not a valid
      named pipe on windows. The path in question is a valid 
      representation of '\\localhost\pipe\namedpipe' and therefore
      should be preserved.
      
      This patch preserves the path notation.
     @ mysys/mf_pack.c
        Preserve the \\.\ sequence in the path.
     @ unittest/mysys/safe_cleanup_cat_path-t.c
        Added unit test cases for paths that form a named pipe including
        a test for the specific failure described in the bug report.

    modified:
      mysys/mf_pack.c
      unittest/mysys/safe_cleanup_cat_path-t.c
 2880 Oystein Grovlen	2009-10-09
      Bug#39105 Assertion in sql_class.cc when backing up invalid merge table
        (Updated to head of backup branch)
            
      Assertion no longer happens after new version of object service API
      was introduced, but error message could be improved so users are
      informed about what is actually wrong.  (That base tables are
      missing.)
            
      More information is made available by having the service interface
      copy its warnings to the THD error stack.  Main error message is still
      the same, but more information is now found on the error stack.
     @ mysql-test/suite/backup/r/backup_nodata_driver.result
        Updated result file
     @ mysql-test/suite/backup/r/backup_security.result
        Change gives one additional, and more informative error message
     @ mysql-test/suite/backup/t/backup_nodata_driver.test
        Add test case for Bug#39105
     @ mysql-test/suite/backup_engines/r/backup_interruption.result
        Updated result file to reflect changes to error reporting caused by this file.
     @ sql/si_objects.cc
        More information about errors are made available by having the service interface
        copy its warnings to the THD error stack.  Main error message is still the same, 
        but more information is now found on the error stack.

    modified:
      mysql-test/suite/backup/r/backup_nodata_driver.result
      mysql-test/suite/backup/r/backup_security.result
      mysql-test/suite/backup/t/backup_nodata_driver.test
      mysql-test/suite/backup_engines/r/backup_interruption.result
      sql/si_objects.cc
=== modified file 'mysys/mf_pack.c'
--- a/mysys/mf_pack.c	2009-08-30 18:08:25 +0000
+++ b/mysys/mf_pack.c	2009-10-15 15:42:39 +0000
@@ -250,6 +250,7 @@ size_t cleanup_dirname(register char *to
   "/.." at end removes previous path element, if it is a real directory.
   "~/" at path begin replaces ~ by home directory.
   "//" is replaced by "/", except on Win32 at begin.
+  "\\.\" is preserved for use on Windows for named pipes.
 
   If the cleanup process would end up with an empty path, "." is
   returned.
@@ -305,6 +306,7 @@ size_t safe_cleanup_cat_path(char *to, s
   char   *start;
   char   *pos;
   char   *end;
+  my_bool non_exist_found= FALSE;
   char   parent[5];     /* for "FN_PARENTDIR" */
   DBUG_ENTER("safe_cleanup_cat_path");
 
@@ -455,10 +457,22 @@ size_t safe_cleanup_cat_path(char *to, s
 #endif
           pos--;
       }
-      /* Skip /./ which could also be at path end. */
-      else if (((pos - start) > 1) &&
-               (pos[-1] == FN_CURLIB) &&
-               (pos[-2] == FN_LIBCHAR))
+      /*
+        Skip /./ which could also be at path end.
+        If no non existent path elemnt has been found yet,
+        skip ./ This can happen after a leading ../
+        In Windows case leave //./ in the path intact.
+      */
+      else if (((((pos - start) > 1) &&
+                 (pos[-1] == FN_CURLIB) &&
+                 (pos[-2] == FN_LIBCHAR)) ||
+                (!non_exist_found &&
+                 ((pos - start) > 0) &&
+                 (pos[-1] == FN_CURLIB)))
+#ifdef FN_NETWORK_DRIVES
+                && !(((pos - to) == 3) && (pos[-3] == FN_LIBCHAR))
+#endif
+               )
       {
         pos-= 2; /* purecov: tested */ /* unittest */
       }
@@ -482,6 +496,7 @@ size_t safe_cleanup_cat_path(char *to, s
           {
             /* Prevent backstep over non-real-directory. */
             start= pos + 1;
+            non_exist_found= TRUE;
           }
         }
 #endif

=== modified file 'unittest/mysys/safe_cleanup_cat_path-t.c'
--- a/unittest/mysys/safe_cleanup_cat_path-t.c	2009-05-19 09:48:45 +0000
+++ b/unittest/mysys/safe_cleanup_cat_path-t.c	2009-10-15 15:42:39 +0000
@@ -153,7 +153,7 @@ main(void)
 
   /* Use "file" for a non-existent file. */
 
-  plan(65);
+  plan(70);
 
   do_test("", "");
 
@@ -166,9 +166,16 @@ main(void)
   do_test("///", "/");
   do_test("/file", "/file");
 #ifdef FN_NETWORK_DRIVES
+  do_test("//node/pipe/file///", "//node/pipe/file");
+  do_test("//node/file///", "//node/file");
+  do_test("//./pipe/file", "//./pipe/file");
+  do_test("//./file///", "//./file");
   do_test("//file///", "//file");
   do_test("///file///", "//file");
 #else
+  do_test("//dir1/dir2/file///", "/dir1/dir2/file");
+  do_test("//dir/file///", "/dir/file");
+  do_test("//./file///", "/file");
   do_test("//file///", "/file");
   do_test("///file///", "/file");
 #endif
@@ -224,6 +231,9 @@ main(void)
   do_test("dir1/dir2/..", "dir1");
   do_test("dir1/..", ".");
 
+  do_test(".././file///", "../file");
+  do_test("..///./file///", "../file");
+
 #if defined(__WIN__)
   /* Windows does path cleanup differently. */
   do_test("file/../file", "file");


Attachment: [text/bzr-bundle] bzr/charles.bell@sun.com-20091015154239-zboe2on7hmx3wuwb.bundle
Thread
bzr push into mysql-6.0-backup branch (charles.bell:2880 to 2881)Bug#41843Chuck Bell15 Oct