List:Commits« Previous MessageNext Message »
From:holyfoot Date:March 18 2006 2:56pm
Subject:bk commit into 5.1 tree (holyfoot:1.2183) BUG#18115
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of hf. When hf 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.2183 06/03/18 17:56:24 holyfoot@deer.(none) +6 -0
  bug #18115 (mysql_upgrade missing in Windows binary)

  client/mysql_upgrade.c
    1.1 06/03/18 17:54:41 holyfoot@stripped +208 -0

  client/mysql_upgrade.c
    1.0 06/03/18 17:54:41 holyfoot@stripped +0 -0
    BitKeeper file /home/hf/work/mysql-5.1.upgrd/client/mysql_upgrade.c

  VC++Files/client/mysql_upgrade_ia64.dsp
    1.1 06/03/18 17:54:40 holyfoot@stripped +77 -0

  VC++Files/client/mysql_upgrade.dsp
    1.1 06/03/18 17:54:40 holyfoot@stripped +71 -0

  client/Makefile.am
    1.66 06/03/18 17:54:40 holyfoot@stripped +5 -2
    mysql_upgrade programm added

  VC++Files/mysql_ia64.dsw
    1.6 06/03/18 17:54:40 holyfoot@stripped +20 -0
    mysql_upgrade project added

  VC++Files/mysql.dsw
    1.28 06/03/18 17:54:40 holyfoot@stripped +25 -0
    mysql_upgrade project added

  VC++Files/client/mysql_upgrade_ia64.dsp
    1.0 06/03/18 17:54:40 holyfoot@stripped +0 -0
    BitKeeper file /home/hf/work/mysql-5.1.upgrd/VC++Files/client/mysql_upgrade_ia64.dsp

  VC++Files/client/mysql_upgrade.dsp
    1.0 06/03/18 17:54:40 holyfoot@stripped +0 -0
    BitKeeper file /home/hf/work/mysql-5.1.upgrd/VC++Files/client/mysql_upgrade.dsp

# 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:	holyfoot
# Host:	deer.(none)
# Root:	/home/hf/work/mysql-5.1.upgrd

--- 1.65/client/Makefile.am	Fri Mar  3 12:57:36 2006
+++ 1.66/client/Makefile.am	Sat Mar 18 17:54:40 2006
@@ -39,7 +39,7 @@
 bin_PROGRAMS =			mysql mysqladmin mysqlcheck mysqlshow \
 				mysqldump mysqlimport mysqltest mysqlbinlog \
 				mysqltestmanagerc mysqltestmanager-pwgen \
-				mysqlslap
+				mysqlslap mysql_upgrade
 noinst_HEADERS =		sql_string.h completion_hash.h my_readline.h \
 				client_priv.h
 mysql_SOURCES =			mysql.cc readline.cc sql_string.cc completion_hash.cc
@@ -72,11 +72,14 @@
 mysqldump_SOURCES=		mysqldump.c my_user.c $(yassl_dummy_link_fix)
 mysqlimport_SOURCES=		mysqlimport.c \
 				$(yassl_dummy_link_fix)
+mysql_upgrade_SOURCES=          mysql_upgrade.c $(yassl_dummy_link_fix)
 sql_src=log_event.h mysql_priv.h log_event.cc my_decimal.h my_decimal.cc
 strings_src=decimal.c
 
 # Fix for mit-threads
-DEFS =			-DUNDEF_THREADS_HACK
+DEFS =			-DUNDEF_THREADS_HACK \
+			-DDEFAULT_MYSQL_HOME="\"$(prefix)\"" \
+			-DDATADIR="\"$(localstatedir)\"" 
 
 link_sources:
 	for f in $(sql_src) ; do \

--- 1.5/VC++Files/mysql_ia64.dsw	Fri Jul 22 00:47:39 2005
+++ 1.6/VC++Files/mysql_ia64.dsw	Sat Mar 18 17:54:40 2006
@@ -436,6 +436,24 @@
 
 ###############################################################################
 
+Project: "mysql_upgrade"=".\client\mysql_upgrade_ia64.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+    Begin Project Dependency
+    Project_Dep_Name mysqlclient
+    End Project Dependency
+    Begin Project Dependency
+    Project_Dep_Name zlib
+    End Project Dependency
+}}}
+
+###############################################################################
+
 Project: "mysqlbinlog"=".\mysqlbinlog\mysqlbinlog_ia64.dsp" - Package Owner=<4>
 
 Package=<5>
@@ -500,6 +518,8 @@
     End Project Dependency
     Begin Project Dependency
     Project_Dep_Name mysqladmin_ia64
+    Begin Project Dependency
+    Project_Dep_Name mysql_upgrade_ia64
     End Project Dependency
     Begin Project Dependency
     Project_Dep_Name mysqldump
--- New file ---
+++ VC++Files/client/mysql_upgrade.dsp	06/03/18 17:54:40
# Microsoft Developer Studio Project File - Name="mysql_upgrade" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **

# TARGTYPE "Win32 (x86) Console Application" 0x0103

CFG=mysql_upgrade - Win32 Release
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "mysql_upgrade.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "mysql_upgrade.mak" CFG="mysql_upgrade - Win32 Release"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "mysql_upgrade - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE

# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "mysql_upgrade___Win32_Release"
# PROP BASE Intermediate_Dir "mysql_upgrade___Win32_Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "mysql_upgrade___Win32_Release"
# PROP Intermediate_Dir "mysql_upgrade___Win32_Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD
/c
# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /D "NDEBUG" /D "DBUG_OFF" /D "_CONSOLE"
/D "_MBCS" /D "_WINDOWS" /Fp"Release/mysql_upgrade.pch" /YX /Fo"Release/" /Fd"Release/"
/FD /c
# ADD BASE RSC /l 0x416 /d "NDEBUG"
# ADD RSC /l 0x416 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib
shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib
user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib
oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 mysqlclient.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib
comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib
odbccp32.lib zlib.lib /nologo /subsystem:console /pdb:"release/mysql_upgrade.pdb"
/machine:I386 /out:"../client_release/mysql_upgrade.exe" /libpath:"..\lib_release\\"
# SUBTRACT LINK32 /pdb:none
# Begin Target

# Name "mysql_upgrade - Win32 Release"
# Begin Group "Source Files"

# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File

SOURCE=.\mysql_upgrade.c
# End Source File
# End Group
# Begin Group "Header Files"

# PROP Default_Filter "h;hpp;hxx;hm;inl"
# End Group
# Begin Group "Resource Files"

# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project

--- New file ---
+++ VC++Files/client/mysql_upgrade_ia64.dsp	06/03/18 17:54:40
# Microsoft Developer Studio Project File - Name="mysql_upgrade" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **

# TARGTYPE "Win32 (x86) Console Application" 0x0103

CFG=mysql_upgrade - Win32 Release
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "mysql_upgrade.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "mysql_upgrade.mak" CFG="mysql_upgrade - Win32 Release"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "mysql_upgrade - WinIA64 Release" (based on "Win32 (x86) Console Application")
!MESSAGE

# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe

!IF  "$(CFG)" == "mysql - WinIA64 Release"

# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "mysql_upgrade___WinIA64_Release"
# PROP BASE Intermediate_Dir "mysql_upgrade___WinIA64_Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "mysql_upgrade___WinIA64_Release"
# PROP Intermediate_Dir "mysql_upgrade___WinIA64_Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN64" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD
/c
# ADD CPP /nologo  /MT /W3  /I "../include" /D"NDEBUG" /D"DBUG_OFF" /D"_CONSOLE" /D"_MBCS"
/D"_WINDOWS" /Fp"Release/mysql_upgrade.pch" /YX /Fo"Release/" /Fd"Release/" /FD /c /O2 /G2
/EHsc /D"_IA64_" /Zi /D"WIN64" /D"WIN32" /D"_AFX_NO_DAO_SUPPORT" /Wp64 /Zm600
# ADD BASE RSC /l 0x416 /d "NDEBUG"
# ADD RSC /l 0x416 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib
shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib  kernel32.lib
user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib
oleaut32.lib uuid.lib odbc32.lib odbccp32.lib  /nologo /subsystem:console /machine:IA64
# ADD LINK32 mysqlclient.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib
comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib
odbccp32.lib zlib.lib /nologo /subsystem:console /pdb:"release/mysql_upgrade.pdb"
/machine:IA64 /out:"../client_release/mysql_upgrade.exe" /libpath:"..\lib_release\\"
/incremental:no
# SUBTRACT LINK32 

!ENDIF

# Begin Target

# Name "mysql_upgrade - WinIA64 Release"
# Begin Group "Source Files"

# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File

SOURCE=.\mysql_upgrade.c
# End Source File
# End Group
# Begin Group "Header Files"

# PROP Default_Filter "h;hpp;hxx;hm;inl"
# End Group
# Begin Group "Resource Files"

# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project

--- New file ---
+++ client/mysql_upgrade.c	06/03/18 17:54:41
/* Copyright (C) 2000 MySQL AB

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */

#include <stdlib.h>
#include "client_priv.h"
#include <my_dir.h>

static my_bool opt_force=0, opt_verbose=0;
static char *user= (char*)"root", *basedir=0, *datadir=0;

static struct my_option my_long_options[] =
{
  {"help", '?', "Display this help message and exit.", 0, 0, 0, GET_NO_ARG,
   NO_ARG, 0, 0, 0, 0, 0, 0},
  {"basedir", 'b', "Specifies the directory where MySQL is installed", (gptr*)
&basedir,
   (gptr*) &basedir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
  {"datadir", 'd', "Specifies the data directory", (gptr*) &datadir,
   (gptr*) &datadir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
  {"force", 'f', "Continue even if we get an sql-error.",
   (gptr*) &opt_force, (gptr*) &opt_force, 0, GET_BOOL, NO_ARG, 0, 0,
   0, 0, 0, 0},
  {"user", 'u', "User for login if not current user.", (gptr*) &user,
   (gptr*) &user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
  {"verbose", 'v', "Display more output about the process", 0, 0, 0, GET_NO_ARG,
   NO_ARG, 0, 0, 0, 0, 0, 0},
  {0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
static const char *load_default_groups[] = { "mysql_upgrade", "client", 0 };

#include <help_end.h>

static my_bool
get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
	       char *argument __attribute__((unused)))
{
  switch(optid) {
  case '?':
    puts("MySQL utility script to upgrade database to the current server version\n");
    puts("\n");
    my_print_help(my_long_options);
    exit(0);
  case 'f':
    opt_force= TRUE;
    break;
  case 'v':
    opt_verbose= TRUE;
    break;
  default:;
  };
  return 0;
}


static my_bool test_file_exists_res(const char *dir, const char *fname, char *buffer)
{
  MY_STAT stat_info;

  if (fname)
    sprintf(buffer, "%s/%s", dir, fname);
  else
    strcpy(buffer, dir);
  return my_stat(buffer, &stat_info, MYF(0)) != 0;
}


static my_bool test_file_exists(const char *dir, const char *fname)
{
  char path[1024];
  return test_file_exists_res(dir, fname, path);
}


int main(int argc, char **argv)
{
  char bindir[1024];
  char datadir_buf[1024];
  char mysqlcheck_line[1024];
  char check_file_name[1024];
  int check_file;
  char fix_priv_tables_cmd[1024];
  char script_line[1024];
  int error;
#ifdef __NETWARE__
  setscreenmode(SCR_AUTOCLOSE_ON_EXIT);
#endif

  load_defaults("my", load_default_groups, &argc, &argv);

  if ((error= handle_options(&argc, &argv, my_long_options, get_one_option)))
    exit(error);

  if (!basedir)
  {
    if (test_file_exists("./share/mysql/english", "errmsg.sys")
        && (test_file_exists("./bin", "mysqld") ||
            test_file_exists("./libexec", "mysqld")))
    {
      getcwd(bindir, sizeof(bindir));
    }
    else
    {
      strcpy(bindir, DEFAULT_MYSQL_HOME);
    }
  }
  else
  {
    strcpy(bindir, basedir);
  }

  if (!datadir)
  {
    datadir= datadir_buf;
    if (test_file_exists(bindir,"data/mysql"))
    {
      sprintf(datadir, "%s/data", bindir);
    }
    else if (test_file_exists(bindir, "var/mysql"))
    {
      sprintf(datadir, "%s/var", bindir);
    }
    else
      strcpy(datadir, DATADIR);
  }

  strcat(bindir, "/bin");

  if (!test_file_exists(bindir, "mysqlcheck"))
  {
    printf("Can't find program '%s/mysqlcheck'\n", bindir);
    puts("Please restart with --basedir=mysql-install-directory\n");
    exit(1);
  }

  if (!test_file_exists(datadir, "mysql/user.frm"))
  {
    puts("Can't find data directory. Please restart with --datadir=path-to-data-dir\n");
    exit(1);
  }

  if (test_file_exists_res(datadir, "mysql_upgrade_info", check_file_name) &&
!opt_force)
  {
    char chf_buffer[10];
    int b_read;
    check_file= open(check_file_name, O_RDONLY);
    b_read= read(check_file, chf_buffer, sizeof(chf_buffer));
    chf_buffer[b_read]= 0;
    if (strcmp(chf_buffer, VERSION))
    {
      if (opt_verbose)
        puts("mysql_upgrade already done for this version\n");
      goto fix_priv_tables;
    }
    close(check_file);
  }

  sprintf(mysqlcheck_line,
          "%s/mysqlcheck --check-upgrade --all-databases --auto-repair --user=%s",
          bindir, user);
  if (opt_verbose)
    printf("Running %s\n", mysqlcheck_line);
  system(mysqlcheck_line);

  check_file= open(check_file_name, O_CREAT | O_WRONLY);
  write(check_file, VERSION, strlen(VERSION));
  close(check_file);

fix_priv_tables:
  if (!test_file_exists(bindir, "mysql"))
  {
    puts("Could not find MySQL command-line client (mysql).\n");
    puts("Please use --basedir to specify the directory where MySQL is installed.\n");
    exit(1);
  }

  if (!test_file_exists_res(basedir,
        "support_files/mysql_fix_privilege_tables.sql", script_line) &&
      !test_file_exists_res(basedir,
        "share/mysql_fix_privileges_tables.sql", script_line) &&
      !test_file_exists_res(basedir,
        "share/mysql/mysql_fix_privilege_tables.sql", script_line) &&
      !test_file_exists_res(basedir,
        "scripts/mysql_fix_privilege_tables.sql", script_line) &&
      !test_file_exists_res("/usr/local/mysql/share/mysql",
        "mysql_fix_privilege_tables.sql", script_line))
  {
    puts("Could not find file mysql_fix_privilege_tables.sql\n");
    puts("Please use --basedir to specify the directory where MySQL is installed\n");
    exit(1);
  }
    
  sprintf(fix_priv_tables_cmd, "%s/mysql < %s", bindir, script_line);
  system(fix_priv_tables_cmd);

  return error;
} /* main */


--- 1.27/VC++Files/mysql.dsw	Fri Jul 22 00:47:39 2005
+++ 1.28/VC++Files/mysql.dsw	Sat Mar 18 17:54:40 2006
@@ -339,6 +339,27 @@
 
 ###############################################################################
 
+Project: "mysql_upgrade"=".\client\mysql_upgrade.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+    Begin Project Dependency
+    Project_Dep_Name mysqlclient
+    End Project Dependency
+    Begin Project Dependency
+    Project_Dep_Name zlib
+    End Project Dependency
+    Begin Project Dependency
+    Project_Dep_Name mysys
+    End Project Dependency
+}}}
+
+###############################################################################
+
 Project: "mysqlbinlog"=".\mysqlbinlog\mysqlbinlog.dsp" - Package Owner=<4>
 
 Package=<5>
@@ -415,6 +436,8 @@
     End Project Dependency
     Begin Project Dependency
     Project_Dep_Name mysqladmin
+    Begin Project Dependency
+    Project_Dep_Name myqsl_upgrade
     End Project Dependency
     Begin Project Dependency
     Project_Dep_Name mysqldump
@@ -802,6 +825,8 @@
     End Project Dependency
     Begin Project Dependency
     Project_Dep_Name mysqladmin
+    Begin Project Dependency
+    Project_Dep_Name mysql_upgrade
     End Project Dependency
     Begin Project Dependency
     Project_Dep_Name mysql_client_test
Thread
bk commit into 5.1 tree (holyfoot:1.2183) BUG#18115holyfoot18 Mar