MySQL Lists are EOL. Please join:

List:Internals« Previous MessageNext Message »
From:Georg Richter Date:July 26 2005 5:41am
Subject:bk commit into 5.0 tree (georg:1.1890) BUG#5650
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of georg. When georg does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.1890 05/07/26 07:41:32 georg@stripped +1 -0
  fix for bug#5650 ('replace' does not follow symlinks)
  
  fix now checks if the original (from) file is a symlink and uses the
  link name. This prevents creation of a new file (and loss of symlink)
  when renaming the tempfile. 

  extra/replace.c
    1.20 05/07/26 07:41:27 georg@stripped +9 -3
    fix for bug#5650 ('replace' does not follow symlinks)
    
    fix now checks if the original (from) file is a symlink and uses the
    link name. This prevents creation of a new file (and loss of symlink)
    when renaming the tempfile. 

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	georg
# Host:	lmy002.wdf.sap.corp
# Root:	/home/georg/work/mysql/prod/mysql-5.0

--- 1.19/extra/replace.c	2005-07-18 14:31:58 +02:00
+++ 1.20/extra/replace.c	2005-07-26 07:41:27 +02:00
@@ -1053,12 +1053,18 @@
   int error;
   FILE *in,*out;
   char dir_buff[FN_REFLEN], tempname[FN_REFLEN];
+  char link_name[FN_REFLEN], *org_name = name;
   File temp_file;
   DBUG_ENTER("convert_file");
 
-  if (!(in=my_fopen(name,O_RDONLY,MYF(MY_WME))))
+  /* check if name is a symlink */
+#ifdef HAVE_READLINK  
+  org_name= (!my_disable_symlinks && 
+             !my_readlink(link_name, name, MYF(0))) ? link_name : name;
+#endif
+  if (!(in= my_fopen(org_name,O_RDONLY,MYF(MY_WME))))
     DBUG_RETURN(1);
-  dirname_part(dir_buff,name);
+  dirname_part(dir_buff,org_name);
   if ((temp_file= create_temp_file(tempname, dir_buff, "PR", O_WRONLY,
                                    MYF(MY_WME))) < 0)
   {
@@ -1075,7 +1081,7 @@
   my_fclose(in,MYF(0)); my_fclose(out,MYF(0));
 
   if (updated && ! error)
-    my_redel(name,tempname,MYF(MY_WME | MY_LINK_WARNING));
+    my_redel(org_name,tempname,MYF(MY_WME | MY_LINK_WARNING));
   else
     my_delete(tempname,MYF(MY_WME));
   if (!silent && ! error)
Thread
bk commit into 5.0 tree (georg:1.1890) BUG#5650Georg Richter26 Jul