diff --git a/Makefile.am b/Makefile.am
index e69b336a2c09f4ec282dc007c10967e2a3ccee1c..56aec377afb8c5a85e4ddea9533de44215c8de05 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -24,15 +24,15 @@ EXTRA_DIST =		INSTALL-SOURCE README \
 SUBDIRS =		. include @docs_dirs@ @readline_dir@ \
 			@thread_dirs@ pstack @sql_client_dirs@ \
 			@sql_server_dirs@ scripts man tests \
-			BUILD netware os2 @libmysqld_dirs@ \
-			@bench_dirs@ support-files @fs_dirs@ @tools_dirs@ \
-			@platform_dir@
+			BUILD @netware_dir@ os2 @libmysqld_dirs@ \
+			@bench_dirs@ support-files @fs_dirs@ @tools_dirs@
+			
 
 # Relink after clean
 linked_sources = linked_client_sources linked_server_sources \
 		 linked_libmysql_sources linked_libmysql_r_sources \
 		 linked_libmysqld_sources  linked_libmysqldex_sources \
-		 linked_include_sources
+		 linked_include_sources @linked_netware_sources@
 
 CLEANFILES = $(linked_sources)
 
@@ -63,6 +63,10 @@ linked_libmysqldex_sources:
 	cd libmysqld/examples; $(MAKE) link_sources
 	echo timestamp > linked_libmysqldex_sources
 
+linked_netware_sources:
+	cd @netware_dir@; $(MAKE) link_sources
+	echo timestamp > linked_netware_sources
+
 #avoid recursive make calls in sql directory
 linked_server_sources:
 	cd sql; rm -f mini_client_errors.c;@LN_CP_F@ ../libmysql/errmsg.c mini_client_errors.c
@@ -73,7 +77,7 @@ init-db:		all
 	$(top_builddir)/scripts/mysql_install_db
 
 bin-dist:		all
-	$(top_builddir)/scripts/make_binary_distribution
+	$(top_builddir)/scripts/make_binary_distribution @MAKE_BINARY_DISTRIBUTION_OPTIONS@
 
 tags:
 	support-files/build-tags
@@ -83,3 +87,4 @@ tags:
 
 test:
 	cd mysql-test ; ./mysql-test-run
+
diff --git a/client/mysql.cc b/client/mysql.cc
index 5f84261bd825f0651019d9210bde4c025f189963..da52fb54e7daefe3947bbcdb151e1372509fb270 100644
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -1702,6 +1702,9 @@ print_table_data_xml(MYSQL_RES *result)
 {
   MYSQL_ROW   cur;
   MYSQL_FIELD *fields;
+#ifdef __NETWARE__
+  uint		lines= 0;
+#endif
 
   mysql_field_seek(result,0);
 
diff --git a/configure.in b/configure.in
index d4f749d5de79cb81897e6b5bb82d99c8395a99b3..093abc7e983c9c90857c6da6b90ef65598af1357 100644
--- a/configure.in
+++ b/configure.in
@@ -38,10 +38,10 @@ rm -f $AVAILABLE_LANGUAGES_ERRORS_RULES
 for i in $AVAILABLE_LANGUAGES
 do
   AVAILABLE_LANGUAGES_ERRORS="$AVAILABLE_LANGUAGES_ERRORS $i/errmsg.sys"
-  case $SYSTEM_TYPE in
-    *netware* | *modesto*)
+  case $host_os in
+    netware* | modesto*)
       echo "$i/errmsg.sys: $i/errmsg.txt
-	\$(top_builddir)/extra/comp_err.cyg \$^ $i/errmsg.sys" \
+	\$(top_builddir)/extra/comp_err.linux \$^ $i/errmsg.sys" \
       >> $AVAILABLE_LANGUAGES_ERRORS_RULES
       ;;
     *)
@@ -1067,7 +1067,10 @@ dnl Is this the right match for DEC OSF on alpha?
   *netware*)
     # No need for curses library so set it to null
     with_named_curses=""
-    PLATFORM_NETWARE=yes
+
+    # No thread library - in LibC
+    with_named_thread=""
+    
     #
     # Edit Makefile.in files.
     #
@@ -1089,36 +1092,36 @@ dnl Is this the right match for DEC OSF on alpha?
       fi
       case $file in
         sql/Makefile.in)
-          # Use gen_lex_hash.cyg instead of gen_lex_hash
+          # Use gen_lex_hash.linux instead of gen_lex_hash
           # Add library dependencies to mysqld_DEPENDENCIES
           lib_DEPENDENCIES="\$(bdb_libs_with_path) \$(innodb_libs) \$(pstack_libs) \$(innodb_system_libs) \$(openssl_libs)"
           cat > $filesed << EOF
 s,\(^.*\$(MAKE) gen_lex_hash\),#\1,
-s,\(\./gen_lex_hash\),\1.cyg,
+s,\(\./gen_lex_hash\),\1.linux,
 s%\(mysqld_DEPENDENCIES = \) %\1$lib_DEPENDENCIES %
 EOF
           ;;
         sql/share/Makefile.in)
           cat > $filesed << EOF
-s,\(extra/comp_err\),\1.cyg,
+s,\(extra/comp_err\),\1.linux,
 EOF
           ;;
         libmysql/Makefile.in)
           cat > $filesed << EOF
-s,\(\./conf_to_src\)\( \$(top_srcdir)\),\1.cyg\2,
-s,\(: conf_to_src\),\1.cyg,
+s,\(\./conf_to_src\)\( \$(top_srcdir)\),\1.linux\2,
+s,\(: conf_to_src\),\1.linux,
 EOF
           ;;
         libmysql_r/Makefile.in)
           cat > $filesed << EOF
-s,\(\./conf_to_src\)\( \$(top_srcdir)\),\1.cyg\2,
-s,\(: conf_to_src\),\1.cyg,
+s,\(\./conf_to_src\)\( \$(top_srcdir)\),\1.linux\2,
+s,\(: conf_to_src\),\1.linux,
 EOF
           ;;
         strings/Makefile.in)
           cat > $filesed << EOF
-s,\(\./conf_to_src\)\( \$(top_srcdir)\),\1.cyg\2,
-s,\(: conf_to_src\),\1.cyg,
+s,\(\./conf_to_src\)\( \$(top_srcdir)\),\1.linux\2,
+s,\(: conf_to_src\),\1.linux,
 EOF
           ;;
         client/Makefile.in)
@@ -1167,7 +1170,6 @@ EOF
     ;;
 esac
 
-AM_CONDITIONAL(PLATFORM_NETWARE, test "$PLATFORM_NETWARE" = "yes")
 
 #---START: Used in for client configure
 # Check if we threads are in libc or if we should use
@@ -2195,13 +2197,6 @@ AC_ARG_WITH(extra-charsets,
   [extra_charsets="$withval"],
   [extra_charsets="none"])
 
-AC_ARG_WITH(platform-dir,
-    [  --with-platform-dir=DIR
-                          Add specified directory to list of SUBDIRS to build.],
-    [ with_platform_dir=$withval ],
-    [ with_platform_dir=no ]
-    )
-
 AC_MSG_CHECKING("character sets")
 
 if test "$extra_charsets" = none; then
@@ -2440,12 +2435,15 @@ AC_SUBST(CLIENT_LIBS)
 AC_SUBST(sql_client_dirs)
 AC_SUBST(linked_client_targets)
 
-platform_dir=
-if test "$with_platform_dir" != "no"
-then
-  platform_dir="$with_platform_dir"
+# If configuring for NetWare, set up to link sources from and build the netware directory
+netware_dir=
+linked_netware_sources=
+if expr "$SYSTEM_TYPE" : ".*netware.*" > /dev/null; then
+  netware_dir="netware"
+  linked_netware_sources="linked_netware_sources"
 fi
-AC_SUBST(platform_dir)
+AC_SUBST(netware_dir)
+AC_SUBST(linked_netware_sources)
 
 if test "$with_server" = "yes" -o "$THREAD_SAFE_CLIENT" != "no"
 then
@@ -2612,6 +2610,17 @@ AC_SUBST(GXX)
 #Remove TOOLS_LIBS, because this is included in LIBRARIES
 #AC_SUBST(TOOLS_LIBS)
 
+# Set configuration options for make_binary_distribution
+case $SYSTEM_TYPE in
+  *netware*)
+    MAKE_BINARY_DISTRIBUTION_OPTIONS=--no-strip
+    ;;
+  *)
+    MAKE_BINARY_DISTRIBUTION_OPTIONS=
+    ;;
+esac
+AC_SUBST(MAKE_BINARY_DISTRIBUTION_OPTIONS)
+
 # Output results
 AC_OUTPUT(Makefile extra/Makefile mysys/Makefile isam/Makefile dnl
  strings/Makefile regex/Makefile heap/Makefile dnl
diff --git a/extra/mysql_waitpid.c b/extra/mysql_waitpid.c
index 007db959111a9bd29cd141eb8e0ffd95302ca411..bff1752ec21553002cdaac14b4aaeb18339153b7 100644
--- a/extra/mysql_waitpid.c
+++ b/extra/mysql_waitpid.c
@@ -16,6 +16,8 @@
 
 /* Wait until a program dies */
 
+#ifndef __NETWARE__
+
 #include <my_global.h>
 #include <m_string.h>
 #include <my_getopt.h>
@@ -101,3 +103,15 @@ void usage(void)
   my_print_help(my_long_options);
   exit(-1);
 }
+
+#else
+
+#include <stdio.h>
+
+main()
+{
+	fprintf(stderr,"This tool has not been ported to NetWare\n");
+	return 0;
+}
+
+#endif /* __NETWARE__ */
diff --git a/include/my_pthread.h b/include/my_pthread.h
index bea6b8bef5a4d0cd2d182f4aca85b9abe6baa6b0..574198a0645c66b57096dc3de941c3bbd7f68dca 100644
--- a/include/my_pthread.h
+++ b/include/my_pthread.h
@@ -430,7 +430,7 @@ struct tm *localtime_r(const time_t *clock, struct tm *res);
 #define pthread_kill(A,B) pthread_dummy(0)
 #undef	pthread_detach_this_thread
 #define pthread_detach_this_thread() { pthread_t tmp=pthread_self() ; pthread_detach(&tmp); }
-#else /* HAVE_PTHREAD_ATTR_CREATE && !HAVE_SIGWAIT */
+#elif !defined(__NETWARE__) /* HAVE_PTHREAD_ATTR_CREATE && !HAVE_SIGWAIT */
 #define HAVE_PTHREAD_KILL
 #endif
 
diff --git a/include/mysql.h b/include/mysql.h
index 486caa5baa5c0cc6a7b922ad51c1335926d90768..fb650343399b482b39729174157a41116c1ac7a4 100644
--- a/include/mysql.h
+++ b/include/mysql.h
@@ -422,7 +422,7 @@ int		STDCALL mysql_drop_db(MYSQL *mysql, const char *DB);
 int simple_command(MYSQL *mysql,enum enum_server_command command,
 		   const char *arg, unsigned long length, my_bool skipp_check);
 unsigned long net_safe_read(MYSQL* mysql);
-void STDCALL mysql_once_init(void);
+void mysql_once_init(void);
 
 #ifdef __NETWARE__
 #pragma pack(pop)		/* restore alignment */
diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c
index 10cfb5ec88c9e5e2c1553edf1c4ce83b69558b09..04d2d9d12e40489dda941001172e4f1567c91d11 100644
--- a/libmysql/libmysql.c
+++ b/libmysql/libmysql.c
@@ -536,7 +536,8 @@ char* getlogin(void);
 /* default to "root" on NetWare */
 static void read_user_name(char *name)
 {
-  (void)strmake(name,"root", USERNAME_LENGTH);
+  char *str=getenv("USER");
+  strmake(name, str ? str : "UNKNOWN_USER", USERNAME_LENGTH);
 }
 
 #elif !defined(MSDOS) && ! defined(VMS) && !defined(__WIN__) && !defined(OS2)
@@ -1427,7 +1428,7 @@ mysql_init(MYSQL *mysql)
     outside program.
 */
 
-void STDCALL mysql_once_init(void)
+void mysql_once_init(void)
 {
   if (!mysql_client_init)
   {
diff --git a/libmysqld/libmysqld.c b/libmysqld/libmysqld.c
index 3f7c666cd30b7d44e9c6db4d03bf8c58e1032e26..3fba238a8bf449f09855aac70b2b338cd97a69bc 100644
--- a/libmysqld/libmysqld.c
+++ b/libmysqld/libmysqld.c
@@ -62,7 +62,7 @@ my_string	mysql_unix_port=0;
 #define closesocket(A) close(A)
 #endif
 
-void STDCALL mysql_once_init(void);
+static void mysql_once_init(void);
 static MYSQL_DATA *read_rows (MYSQL *mysql,MYSQL_FIELD *fields,
 			      uint field_count);
 static int read_one_row(MYSQL *mysql,uint fields,MYSQL_ROW row,
diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh
index 3e498703ada9cf9f543eabfe0573a59125ab87d6..b05779e8af2e0f9560e4b97cba436ce5ffe5d9c9 100644
--- a/mysql-test/mysql-test-run.sh
+++ b/mysql-test/mysql-test-run.sh
@@ -331,6 +331,7 @@ while test $# -gt 0; do
       EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --skip-safemalloc"
       SLEEP_TIME_AFTER_RESTART=10
       SLEEP_TIME_FOR_DELETE=120
+      USE_RUNNING_SERVER=""
       ;;
     --valgrind-options=*)
       TMP=`$ECHO "$1" | $SED -e "s;--valgrind-options=;;"`
diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result
index 828bd2bab83cbe4cd08eef0e8ac813a34c603847..2a6eaaf0bfc3c4fefdb7aaf93f770e7dee439ea1 100644
--- a/mysql-test/r/innodb.result
+++ b/mysql-test/r/innodb.result
@@ -1058,3 +1058,13 @@ create table t2 (b varchar(10) not null unique) type=innodb;
 select t1.a from t1,t2 where t1.a=t2.b;
 a
 drop table t1,t2;
+CREATE TABLE t1 (id INT NOT NULL, PRIMARY KEY (id)) TYPE=INNODB;
+CREATE TABLE t2 (id INT PRIMARY KEY, t1_id INT, INDEX par_ind (t1_id), FOREIGN KEY (t1_id) REFERENCES t1(id)  ON DELETE CASCADE ) TYPE=INNODB;
+insert into t1 set id=1;
+insert into t2 set id=1, t1_id=1;
+delete t1,t2 from t1,t2 where t1.id=t2.t1_id;
+select * from t1;
+id
+select * from t2;
+id	t1_id
+drop table t1,t2;
diff --git a/mysql-test/r/rpl000001.result b/mysql-test/r/rpl000001.result
index 2dc21e86152c7e6732e5c5d87cc7f06ac949a904..2d277571296f593513df9a94ca68a8ec38f74afc 100644
--- a/mysql-test/r/rpl000001.result
+++ b/mysql-test/r/rpl000001.result
@@ -8,7 +8,7 @@ drop table if exists t1,t2,t3;
 create table t1 (word char(20) not null);
 load data infile '../../std_data/words.dat' into table t1;
 load data local infile 'MYSQL_TEST_DIR/std_data/words.dat' into table t1;
-select * from t1;
+select * from t1 limit 10;
 word
 Aarhus
 Aaron
@@ -20,16 +20,6 @@ abandoned
 abandoning
 abandonment
 abandons
-Aarhus
-Aaron
-Ababa
-aback
-abaft
-abandon
-abandoned
-abandoning
-abandonment
-abandons
 slave stop;
 set password for root@"localhost" = password('foo');
 slave start;
@@ -42,7 +32,7 @@ n
 2
 select sum(length(word)) from t1;
 sum(length(word))
-141
+1021
 drop table t1,t3;
 reset master;
 slave stop;
diff --git a/mysql-test/r/rpl000004.result b/mysql-test/r/rpl000004.result
index 82b208d0b58aae862150f31cc63298f23247e40c..3142adc50d668c4cb60c00895b0615008b932a20 100644
--- a/mysql-test/r/rpl000004.result
+++ b/mysql-test/r/rpl000004.result
@@ -23,7 +23,7 @@ Table	Op	Msg_type	Msg_text
 test.t1	check	status	OK
 select count(*) from t2;
 count(*)
-10
+70
 select count(*) from t3;
 count(*)
 0
diff --git a/mysql-test/r/rpl_log.result b/mysql-test/r/rpl_log.result
index 835b5d6629a298896e6b11c09cb4219609c4d403..5415a153a981796016f88ef123d9fdff109349be 100644
--- a/mysql-test/r/rpl_log.result
+++ b/mysql-test/r/rpl_log.result
@@ -22,9 +22,9 @@ master-bin.001	172	Intvar	1	172	INSERT_ID=1
 master-bin.001	200	Query	1	200	use test; insert into t1 values (NULL)
 master-bin.001	263	Query	1	263	use test; drop table t1
 master-bin.001	311	Query	1	311	use test; create table t1 (word char(20) not null)
-master-bin.001	386	Create_file	1	386	db=test;table=t1;file_id=1;block_len=81
-master-bin.001	556	Exec_load	1	556	;file_id=1
-master-bin.001	579	Query	1	579	use test; drop table t1
+master-bin.001	386	Create_file	1	386	db=test;table=t1;file_id=1;block_len=581
+master-bin.001	1056	Exec_load	1	1056	;file_id=1
+master-bin.001	1079	Query	1	1079	use test; drop table t1
 show binlog events from 79 limit 1;
 Log_name	Pos	Event_type	Server_id	Orig_log_pos	Info
 master-bin.001	79	Query	1	79	use test; create table t1(n int not null auto_increment primary key)
@@ -50,10 +50,10 @@ master-bin.001	172	Intvar	1	172	INSERT_ID=1
 master-bin.001	200	Query	1	200	use test; insert into t1 values (NULL)
 master-bin.001	263	Query	1	263	use test; drop table t1
 master-bin.001	311	Query	1	311	use test; create table t1 (word char(20) not null)
-master-bin.001	386	Create_file	1	386	db=test;table=t1;file_id=1;block_len=81
-master-bin.001	556	Exec_load	1	556	;file_id=1
-master-bin.001	579	Query	1	579	use test; drop table t1
-master-bin.001	627	Rotate	1	627	master-bin.002;pos=4
+master-bin.001	386	Create_file	1	386	db=test;table=t1;file_id=1;block_len=581
+master-bin.001	1056	Exec_load	1	1056	;file_id=1
+master-bin.001	1079	Query	1	1079	use test; drop table t1
+master-bin.001	1127	Rotate	1	1127	master-bin.002;pos=4
 show binlog events in 'master-bin.002';
 Log_name	Pos	Event_type	Server_id	Orig_log_pos	Info
 master-bin.002	4	Query	1	4	use test; create table t1 (n int)
@@ -76,10 +76,10 @@ slave-bin.001	172	Intvar	1	172	INSERT_ID=1
 slave-bin.001	200	Query	1	200	use test; insert into t1 values (NULL)
 slave-bin.001	263	Query	1	263	use test; drop table t1
 slave-bin.001	311	Query	1	311	use test; create table t1 (word char(20) not null)
-slave-bin.001	386	Create_file	1	386	db=test;table=t1;file_id=1;block_len=81
-slave-bin.001	565	Exec_load	1	556	;file_id=1
-slave-bin.001	588	Query	1	579	use test; drop table t1
-slave-bin.001	636	Rotate	2	636	slave-bin.002;pos=4
+slave-bin.001	386	Create_file	1	386	db=test;table=t1;file_id=1;block_len=581
+slave-bin.001	1065	Exec_load	1	1056	;file_id=1
+slave-bin.001	1088	Query	1	1079	use test; drop table t1
+slave-bin.001	1136	Rotate	2	1136	slave-bin.002;pos=4
 show binlog events in 'slave-bin.002' from 4;
 Log_name	Pos	Event_type	Server_id	Orig_log_pos	Info
 slave-bin.002	4	Query	1	4	use test; create table t1 (n int)
@@ -87,6 +87,6 @@ slave-bin.002	62	Query	1	62	use test; insert into t1 values (1)
 slave-bin.002	122	Query	1	122	use test; drop table t1
 show slave status;
 Master_Host	Master_User	Master_Port	Connect_retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_do_db	Replicate_ignore_db	Last_errno	Last_error	Skip_counter	Exec_master_log_pos	Relay_log_space
-127.0.0.1	root	MASTER_PORT	1	master-bin.002	170	slave-relay-bin.002	957	master-bin.002	Yes	Yes			0		0	170	961
+127.0.0.1	root	MASTER_PORT	1	master-bin.002	170	slave-relay-bin.002	1457	master-bin.002	Yes	Yes			0		0	170	1461
 show binlog events in 'slave-bin.005' from 4;
 Error when executing command SHOW BINLOG EVENTS: Could not find target log
diff --git a/mysql-test/r/type_blob.result b/mysql-test/r/type_blob.result
index 2047eed622776c3d1c2a6ed08d0425d264ac3e78..ab4723457d199b24f16136b29492eac6c645615e 100644
--- a/mysql-test/r/type_blob.result
+++ b/mysql-test/r/type_blob.result
@@ -448,3 +448,10 @@ select foobar, boggle from t1 where foobar = 'fish' and boggle = 10;
 foobar	boggle
 fish	10
 drop table t1;
+create table t1 (id integer auto_increment unique,imagem LONGBLOB not null);
+insert into t1 (id) values (1);
+update t1 set imagem=load_file('../../std_data/words.dat') where id=1;
+select if(imagem is null, "ERROR", "OK"),length(imagem) from t1 where id = 1;
+if(imagem is null, "ERROR", "OK")	length(imagem)
+OK	581
+drop table t1;
diff --git a/mysql-test/std_data/words.dat b/mysql-test/std_data/words.dat
index c2d1cb70cbff18f8576712f2f1cfd9a84d9147ac..1b28624e35465b59ee630ceeb637b1d11ca5083b 100644
--- a/mysql-test/std_data/words.dat
+++ b/mysql-test/std_data/words.dat
@@ -8,3 +8,63 @@ abandoned
 abandoning
 abandonment
 abandons
+Aarhus
+Aaron
+Ababa
+aback
+abaft
+abandon
+abandoned
+abandoning
+abandonment
+abandons
+abase
+abased
+abasement
+abasements
+abases
+abash
+abashed
+abashes
+abashing
+abasing
+abate
+abated
+abatement
+abatements
+abater
+abates
+abating
+Abba
+abbe
+abbey
+abbeys
+abbot
+abbots
+Abbott
+abbreviate
+abbreviated
+abbreviates
+abbreviating
+abbreviation
+abbreviations
+Abby
+abdomen
+abdomens
+abdominal
+abduct
+abducted
+abduction
+abductions
+abductor
+abductors
+abducts
+Abe
+abed
+Abel
+Abelian
+Abelson
+Aberdeen
+Abernathy
+aberrant
+aberration
diff --git a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test
index 250b68a38459dcc311a9ea7dcd75fd4a67626bfd..8b75d0675660a7e5adf613e2d38a0deeaa6e6958 100644
--- a/mysql-test/t/innodb.test
+++ b/mysql-test/t/innodb.test
@@ -696,3 +696,16 @@ create table t1 (a varchar(10) not null) type=myisam;
 create table t2 (b varchar(10) not null unique) type=innodb;
 select t1.a from t1,t2 where t1.a=t2.b;
 drop table t1,t2;
+
+#
+# Test of multi-table-delete with foreign key constraints
+#
+
+CREATE TABLE t1 (id INT NOT NULL, PRIMARY KEY (id)) TYPE=INNODB;
+CREATE TABLE t2 (id INT PRIMARY KEY, t1_id INT, INDEX par_ind (t1_id), FOREIGN KEY (t1_id) REFERENCES t1(id)  ON DELETE CASCADE ) TYPE=INNODB;
+insert into t1 set id=1;
+insert into t2 set id=1, t1_id=1;
+delete t1,t2 from t1,t2 where t1.id=t2.t1_id;
+select * from t1;
+select * from t2;
+drop table t1,t2;
diff --git a/mysql-test/t/rpl000001.test b/mysql-test/t/rpl000001.test
index 0f195c65fb08de5c081e029590cfa3446845d609..4ffd7d1d78e6a9e7eae703aef329e3456cd63b31 100644
--- a/mysql-test/t/rpl000001.test
+++ b/mysql-test/t/rpl000001.test
@@ -4,7 +4,7 @@ create table t1 (word char(20) not null);
 load data infile '../../std_data/words.dat' into table t1;
 --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
 eval load data local infile '$MYSQL_TEST_DIR/std_data/words.dat' into table t1;
-select * from t1;
+select * from t1 limit 10;
 
 #
 # Test slave with wrong password
diff --git a/mysql-test/t/type_blob.test b/mysql-test/t/type_blob.test
index 2b23617ec8b34588c713008c6d95959d4027ec0e..5bdaad7ffaccef53585569cb20eab2229d4c61fd 100644
--- a/mysql-test/t/type_blob.test
+++ b/mysql-test/t/type_blob.test
@@ -1,3 +1,7 @@
+# This test can't be run with running server (--extern) as this uses
+# load_file() on a file in the tree.
+#
+
 #
 # test of full join with blob
 #
@@ -249,3 +253,13 @@ insert into t1 values ('fish', 10),('bear', 20);
 select foobar, boggle from t1 where foobar = 'fish';
 select foobar, boggle from t1 where foobar = 'fish' and boggle = 10;
 drop table t1;
+
+#
+# Bug when blob is updated
+#
+
+create table t1 (id integer auto_increment unique,imagem LONGBLOB not null);
+insert into t1 (id) values (1);
+update t1 set imagem=load_file('../../std_data/words.dat') where id=1;
+select if(imagem is null, "ERROR", "OK"),length(imagem) from t1 where id = 1;
+drop table t1;
diff --git a/mysys/my_init.c b/mysys/my_init.c
index c6d590fc2aab675958090b199ba78c9db1572739..61d9f4a4b2b2b6defc3e32a4f286b60727da3720 100644
--- a/mysys/my_init.c
+++ b/mysys/my_init.c
@@ -350,7 +350,7 @@ static my_bool win32_init_tcp_ip()
 
 static void netware_init()
 {
-  char cwd[PATH_MAX], *name
+  char cwd[PATH_MAX], *name;
 
   /* init only if we are not a client library */
   if (my_progname)
diff --git a/mysys/my_netware.c b/mysys/my_netware.c
index 6c3242594dffb9dfe33a0471966cb816445140c6..e41dbd0a029455d49b6d861d9ab1a9832235bdb3 100644
--- a/mysys/my_netware.c
+++ b/mysys/my_netware.c
@@ -20,6 +20,7 @@
 
 #include <mysys_priv.h>
 #ifdef __NETWARE__
+  #include <string.h>
   #include <library.h>
 
 /*
@@ -61,8 +62,8 @@ long PMMeteredUsageRequest
  long *NLSMeterErrCode
 );
 
-ypedef long(*PMUR)(char*, long, char*, char, char*, long, long*, long*,
-		   long*);
+typedef long(*PMUR)(const char*, long, const char*, char,
+        const char*, long, long*, long*, long*);
 
 /* infoType */
 /* indicates that the info in the userInfo param is an NDS user */
diff --git a/netware/Makefile.am b/netware/Makefile.am
index bfa87f25770c6d313f6716e2230f708489f2cfde..5933340febb1dc0b62ef23894922f3079256a8a3 100644
--- a/netware/Makefile.am
+++ b/netware/Makefile.am
@@ -14,7 +14,6 @@
 #  along with this program; if not, write to the Free Software 
 #  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 
-if PLATFORM_NETWARE
 INCLUDES =			-I$(srcdir)/../include -I../include -I..
 bin_PROGRAMS =			mysqld_safe mysql_install_db mysql_test_run libmysql
 mysqld_safe_SOURCES=		mysqld_safe.c my_manage.c
@@ -22,7 +21,27 @@ mysql_install_db_SOURCES=	mysql_install_db.c my_manage.c
 mysql_test_run_SOURCES=		mysql_test_run.c my_manage.c
 libmysql_SOURCES=		libmysqlmain.c
 libmysql_LDADD =		../libmysql/.libs/libmysqlclient.a
-endif
+
+netware_build_files =           client/mysql.def client/mysqladmin.def \
+                                client/mysqlbinlog.def client/mysqlcheck.def \
+                                client/mysqldump.def client/mysqlimport.def \
+                                client/mysqlshow.def client/mysqltest.def \
+                                extra/mysql_install.def extra/my_print_defaults.def \
+                                extra/perror.def extra/replace.def \
+                                extra/resolveip.def isam/isamchk.def \
+                                isam/isamlog.def isam/pack_isam.def \
+                                libmysqld/libmysqld.def myisam/myisamchk.def \
+                                myisam/myisamlog.def myisam/myisampack.def \
+                                sql/mysqld.def sql/mysqld.xdc
+	
+link_sources:
+	set -x; \
+	for f in $(netware_build_files); do \
+	  rm -f $(srcdir)/../$$f; \
+	  org=`echo $$f | sed -e 's/.*\/\(.*\)/\1/g'`; \
+	  @LN_CP_F@ $(srcdir)/$$org $(srcdir)/../$$f; \
+	done;
+
 
 # Don't update the files from bitkeeper
 %::SCCS/s.%
diff --git a/netware/init_db.sql b/netware/init_db.sql
index 640fe3a4188a3d097cd25d98da37d23774c7236d..1e8354e13a199874162c9ce9660a44643e18a6d3 100644
--- a/netware/init_db.sql
+++ b/netware/init_db.sql
@@ -1,3 +1,6 @@
+CREATE DATABASE mysql;
+CREATE DATABASE test;
+
 USE mysql;
 
 CREATE TABLE db (Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Select_priv enum('N','Y') DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') DEFAULT 'N' NOT NULL, References_priv enum('N','Y') DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL, PRIMARY KEY Host (Host,Db,User), KEY User (User)) comment='Database privileges';
diff --git a/netware/isamchk.def b/netware/isamchk.def
index 4ac6c6781c77a4b89a9869c1ef101e3b71851d2d..a724340066ac0b2dcee37d2908fdba710ffe0934 100644
--- a/netware/isamchk.def
+++ b/netware/isamchk.def
@@ -2,7 +2,7 @@
 # ISAM Check
 #------------------------------------------------------------------------------
 MODULE	libc.nlm
-COPYRIGHT "(c) 2002 Novell, Inc. Portions (c) 2002 MySQL AB. All Rights Reserved."
+COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
 DESCRIPTION "MySQL ISAM Table Check Tool"
 VERSION 4, 0
 STACKSIZE 65536
diff --git a/netware/isamlog.def b/netware/isamlog.def
index e87dafc6cb5c780e6b530c14d2fd91e66c0d3670..3f74d17f2845f49a750dd633a6acdf0b1a3789b3 100644
--- a/netware/isamlog.def
+++ b/netware/isamlog.def
@@ -2,8 +2,8 @@
 # ISAM Log
 #------------------------------------------------------------------------------
 MODULE	libc.nlm
-COPYRIGHT "(c) 2002 Novell, Inc. Portions (c) 2002 MySQL AB. All Rights Reserved."
-DESCRIPTION "ISAM Log"
+COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
+DESCRIPTION "MySQL ISAM Table Log Tool"
 VERSION 4, 0
 DEBUG
 
diff --git a/netware/libmysql.def b/netware/libmysql.def
index f995eb8a496972eaaa3045c3ddc4d66c64e40cef..f2ab1f0f21ac1775cc49e3d2196876e9587cd571 100644
--- a/netware/libmysql.def
+++ b/netware/libmysql.def
@@ -3,7 +3,7 @@
 #------------------------------------------------------------------------------
 MODULE	libc.nlm
 EXPORT @libmysql.imp
-COPYRIGHT "(c) 2002 Novell, Inc. Portions (c) 2002 MySQL AB. All Rights Reserved."
+COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
 DESCRIPTION "MySQL Client Library"
 VERSION 4, 0
 AUTOUNLOAD
diff --git a/netware/my_print_defaults.def b/netware/my_print_defaults.def
index 384b705bead30943cd7da6de1f940b8ae6bf74c2..7f474c504699a6428a777121e645a9cadb61722e 100644
--- a/netware/my_print_defaults.def
+++ b/netware/my_print_defaults.def
@@ -2,7 +2,7 @@
 # My Print Defaults
 #------------------------------------------------------------------------------
 MODULE	libc.nlm
-COPYRIGHT "(c) 2002 Novell, Inc. Portions (c) 2002 MySQL AB. All Rights Reserved."
+COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
 DESCRIPTION "MySQL Print Defaults Tool"
 VERSION 4, 0
 #DEBUG
diff --git a/netware/myisamchk.def b/netware/myisamchk.def
index b9de47facc30e245736dbdd354a6baab78d35f3b..5a57866c1ee033a794f6c7294d03a4b556d49e0d 100644
--- a/netware/myisamchk.def
+++ b/netware/myisamchk.def
@@ -2,7 +2,7 @@
 # MyISAM Check
 #------------------------------------------------------------------------------
 MODULE	libc.nlm
-COPYRIGHT "(c) 2002 Novell, Inc. Portions (c) 2002 MySQL AB. All Rights Reserved."
+COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
 DESCRIPTION "MySQL MyISAM Table Check Tool"
 VERSION 4, 0
 STACKSIZE 65536
diff --git a/netware/myisamlog.def b/netware/myisamlog.def
index f2b42757b340680991ea0455ceffa50f7cb91540..c3bbee38d165d47058857185af94fc80fedf325b 100644
--- a/netware/myisamlog.def
+++ b/netware/myisamlog.def
@@ -2,7 +2,7 @@
 # MyISAM Log
 #------------------------------------------------------------------------------
 MODULE	libc.nlm
-COPYRIGHT "(c) 2002 Novell, Inc. Portions (c) 2002 MySQL AB. All Rights Reserved."
+COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
 DESCRIPTION "MySQL MyISAM Table Log Tool"
 VERSION 4, 0
 #DEBUG
diff --git a/netware/myisampack.def b/netware/myisampack.def
index ada7c869243302e74a1d4e4269838b3c428542b7..ae025e5f84d0e1cca92c7f6e3c07cf7df38a8687 100644
--- a/netware/myisampack.def
+++ b/netware/myisampack.def
@@ -2,7 +2,7 @@
 # MyISAM Pack
 #------------------------------------------------------------------------------
 MODULE	libc.nlm
-COPYRIGHT "(c) 2002 Novell, Inc. Portions (c) 2002 MySQL AB. All Rights Reserved."
+COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
 DESCRIPTION "MySQL MyISAM Table Pack Tool"
 VERSION 4, 0
 #DEBUG
diff --git a/netware/mysql.def b/netware/mysql.def
index 3947252a097d0d977c221657738142a209588d0b..a5e3ae21369f426900221a1a50f0f21cc2de7267 100644
--- a/netware/mysql.def
+++ b/netware/mysql.def
@@ -3,7 +3,7 @@
 #------------------------------------------------------------------------------
 MODULE	libc.nlm
 SCREENNAME "MySQL Monitor"
-COPYRIGHT "(c) 2002 Novell, Inc. Portions (c) 2002 MySQL AB. All Rights Reserved."
+COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
 DESCRIPTION "MySQL Monitor"
 VERSION 4, 0
 MULTIPLE
diff --git a/netware/mysql_install_db.c b/netware/mysql_install_db.c
index 96f416880b11efe14d762f31514358612bbcec16..128f07dc2bcff17aa306e8e8bf2cdcb140f5eeda 100644
--- a/netware/mysql_install_db.c
+++ b/netware/mysql_install_db.c
@@ -312,20 +312,6 @@ void create_paths()
   {
     mkdir(datadir, 0);
   }
-  
-  // mysql directory
-  snprintf(temp, PATH_MAX, "%s/mysql", datadir);
-  if (stat(temp, &info))
-  {
-    mkdir(temp, 0);
-  }
-
-  // test directory
-  snprintf(temp, PATH_MAX, "%s/test", datadir);
-  if (stat(temp, &info))
-  {
-    mkdir(temp, 0);
-  }
 }
 
 /******************************************************************************
diff --git a/netware/mysql_install_db.def b/netware/mysql_install_db.def
index 448e5a446351653cb8c2cb5de4b0ce95682aab53..c813e80d7681d8f519855c2afa207c528d7dcb40 100644
--- a/netware/mysql_install_db.def
+++ b/netware/mysql_install_db.def
@@ -3,7 +3,7 @@
 #------------------------------------------------------------------------------
 MODULE	libc.nlm
 SCREENNAME "MySQL Install"
-COPYRIGHT "(c) 2002 Novell, Inc. Portions (c) 2002 MySQL AB. All Rights Reserved."
+COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
 DESCRIPTION "MySQL Initial Database Installer"
 VERSION 4, 0
 #DEBUG
diff --git a/netware/mysql_test_run.def b/netware/mysql_test_run.def
index b30139e55263915835187ae988d073a0dc761cec..7cca2e1dea6c49d7ca1d5952f7b9ee473bb45804 100644
--- a/netware/mysql_test_run.def
+++ b/netware/mysql_test_run.def
@@ -4,7 +4,7 @@
 MODULE	libc.nlm
 STACKSIZE 65536
 SCREENNAME "MySQL Test Run"
-COPYRIGHT "(c) 2002 Novell, Inc. Portions (c) 2002 MySQL AB. All Rights Reserved."
+COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
 DESCRIPTION "MySQL Test Run"
 VERSION 4, 0
 #DEBUG
diff --git a/netware/mysqladmin.def b/netware/mysqladmin.def
index 750d2231888f41235d553f124fed34a7af915a10..02ea42a23435cd1f866ca29fdfe74325ab3e39e2 100644
--- a/netware/mysqladmin.def
+++ b/netware/mysqladmin.def
@@ -3,7 +3,7 @@
 #------------------------------------------------------------------------------
 MODULE	libc.nlm
 SCREENNAME "MySQL Admin"
-COPYRIGHT "(c) 2002 Novell, Inc. Portions (c) 2002 MySQL AB. All Rights Reserved."
+COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
 DESCRIPTION "MySQL Admin Tool"
 VERSION 4, 0
 #DEBUG
diff --git a/netware/mysqlbinlog.def b/netware/mysqlbinlog.def
index a5ed40bf7fc5bc1c7248997870b178885d78c0a5..b62ce4a578fc9475feb8c8f6bf94a74169f73399 100644
--- a/netware/mysqlbinlog.def
+++ b/netware/mysqlbinlog.def
@@ -2,7 +2,7 @@
 # MySQL Binary Log
 #------------------------------------------------------------------------------
 MODULE	libc.nlm
-COPYRIGHT "(c) 2002 Novell, Inc. Portions (c) 2002 MySQL AB. All Rights Reserved."
+COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
 DESCRIPTION "MySQL Binary Log Dump Tool"
 VERSION 4, 0
 #DEBUG
diff --git a/netware/mysqlcheck.def b/netware/mysqlcheck.def
index 98029cab416f409b8c8ade2fabe5f9fa859f2a95..ae554bc6a0602c5b2daed8f7e7930488b4086c9d 100644
--- a/netware/mysqlcheck.def
+++ b/netware/mysqlcheck.def
@@ -2,7 +2,7 @@
 # MySQL Client
 #------------------------------------------------------------------------------
 MODULE	libc.nlm
-COPYRIGHT "(c) 2002 Novell, Inc. Portions (c) 2002 MySQL AB. All Rights Reserved."
+COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
 DESCRIPTION "MySQL Check Tool"
 VERSION 4, 0
 #DEBUG
diff --git a/netware/mysqld_safe.c b/netware/mysqld_safe.c
index cf0d6989d8d8a4545ba0dc84916abc16c62677a2..59c40eb61e652619fa4b64e9d7a7af5d0543cd1f 100644
--- a/netware/mysqld_safe.c
+++ b/netware/mysqld_safe.c
@@ -190,7 +190,7 @@ void finish_defaults()
   if (!err_log[0]) snprintf(err_log, PATH_MAX, "%s/%s.err", datadir, hostname);
 
   // safe-log
-  if (!safe_log[0]) snprintf(safe_log, PATH_MAX, "%s/%s.log", datadir, hostname);
+  if (!safe_log[0]) snprintf(safe_log, PATH_MAX, "%s/%s.safe", datadir, hostname);
 
   // mysqld
   if (!mysqld[0]) snprintf(mysqld, PATH_MAX, "%s/bin/mysqld-max", basedir);
@@ -364,7 +364,7 @@ void get_options(int argc, char *argv[])
 
   // default file arguments
   init_args(al);
-  add_arg(al, "dummy");
+  add_arg(al, "ignore");
   read_defaults(al);
   parse_args(al->argc, al->argv);
   free_args(al);
diff --git a/netware/mysqldump.def b/netware/mysqldump.def
index 2de489762b28b0c4e64494fd38a4ca400fe1ae25..763097a338ce9a91513cf1d43b25f74b65d8c592 100644
--- a/netware/mysqldump.def
+++ b/netware/mysqldump.def
@@ -2,7 +2,7 @@
 # MySQL Admin
 #------------------------------------------------------------------------------
 MODULE	libc.nlm
-COPYRIGHT "(c) 2002 Novell, Inc. Portions (c) 2002 MySQL AB. All Rights Reserved."
+COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
 DESCRIPTION "MySQL Dump Tool"
 VERSION 4, 0
 #DEBUG
diff --git a/netware/mysqlimport.def b/netware/mysqlimport.def
index 35673c943912510ca28f9e9aa3dd1e426082ada4..990e704b73dc492073b739c1a538221b0fde4ae0 100644
--- a/netware/mysqlimport.def
+++ b/netware/mysqlimport.def
@@ -2,7 +2,7 @@
 # MySQL Client
 #------------------------------------------------------------------------------
 MODULE	libc.nlm
-COPYRIGHT "(c) 2002 Novell, Inc. Portions (c) 2002 MySQL AB. All Rights Reserved."
+COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
 DESCRIPTION "MySQL Import Tool"
 VERSION 4, 0
 #DEBUG
diff --git a/netware/mysqlshow.def b/netware/mysqlshow.def
index 2629ae3897496d9b6965bb2be365ce5cbbe9735a..2849def81098417ea3f08dc9e7cf1bfa3d10df5e 100644
--- a/netware/mysqlshow.def
+++ b/netware/mysqlshow.def
@@ -3,7 +3,7 @@
 #------------------------------------------------------------------------------
 MODULE	libc.nlm
 SCREENNAME "MySQL Show"
-COPYRIGHT "(c) 2002 Novell, Inc. Portions (c) 2002 MySQL AB. All Rights Reserved."
+COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
 DESCRIPTION "MySQL Show Tool"
 VERSION 4, 0
 #DEBUG
diff --git a/netware/mysqltest.def b/netware/mysqltest.def
index 3f6bc63124473130d5cb2fd52042fecc4a0fb94b..c4fadf141c6e448c0cb3bffd56d5908d52607f71 100644
--- a/netware/mysqltest.def
+++ b/netware/mysqltest.def
@@ -2,7 +2,7 @@
 # MySQL Admin
 #------------------------------------------------------------------------------
 MODULE	libc.nlm
-COPYRIGHT "(c) 2002 Novell, Inc. Portions (c) 2002 MySQL AB. All Rights Reserved."
+COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
 DESCRIPTION "MySQL Test Case Tool"
 VERSION 4, 0
 #DEBUG
diff --git a/netware/pack_isam.def b/netware/pack_isam.def
index f22eb13da3913384b703b0a0d07beeaad88bed20..0e077be6f009c4808496ebd9431fcd759794780f 100644
--- a/netware/pack_isam.def
+++ b/netware/pack_isam.def
@@ -2,8 +2,8 @@
 # Pack ISAM
 #------------------------------------------------------------------------------
 MODULE	libc.nlm
-COPYRIGHT "(c) 2002 Novell, Inc. Portions (c) 2002 MySQL AB. All Rights Reserved."
-DESCRIPTION "Pack ISAM"
+COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
+DESCRIPTION "MySQL ISAM Table Pack Tool"
 VERSION 4, 0
 DEBUG
 
diff --git a/netware/perror.def b/netware/perror.def
index 8c604b2b92bce9b6ad712909a6a09ff32a23ec90..08725a515efcba037e1672667165b005d6e3bb1f 100644
--- a/netware/perror.def
+++ b/netware/perror.def
@@ -2,7 +2,7 @@
 # PERROR
 #------------------------------------------------------------------------------
 MODULE	libc.nlm
-COPYRIGHT "(c) 2002 Novell, Inc. Portions (c) 2002 MySQL AB. All Rights Reserved."
+COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
 DESCRIPTION "MySQL Error Code Description Tool"
 VERSION 4, 0
 #DEBUG
diff --git a/netware/replace.def b/netware/replace.def
index 1e6955d3939a6830858cc69611b6101471e060c4..b639d40f58b1e2d1249b96133563f3fd948f4ced 100644
--- a/netware/replace.def
+++ b/netware/replace.def
@@ -2,7 +2,7 @@
 # Replace
 #------------------------------------------------------------------------------
 MODULE	libc.nlm
-COPYRIGHT "(c) 2002 Novell, Inc. Portions (c) 2002 MySQL AB. All Rights Reserved."
+COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
 DESCRIPTION "MySQL Text Replacement Tool"
 VERSION 4, 0
 #DEBUG
diff --git a/netware/resolveip.def b/netware/resolveip.def
index f09a5bb915bfd1d64f8120bf2f4cf747bff76f69..fc6ee0fa313e020aff4f308b6d8173b8b8cbee98 100644
--- a/netware/resolveip.def
+++ b/netware/resolveip.def
@@ -2,7 +2,7 @@
 # Resolve IP
 #------------------------------------------------------------------------------
 MODULE	libc.nlm
-COPYRIGHT "(c) 2002 Novell, Inc. Portions (c) 2002 MySQL AB. All Rights Reserved."
+COPYRIGHT "(c) 2003 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
 DESCRIPTION "MySQL IP/Hostname Resolve Tool"
 VERSION 4, 0
 #DEBUG
diff --git a/netware/test_db.sql b/netware/test_db.sql
index 453d81693ed26bb83f8081732dad25727d9477ab..d43b632289c5b02aac267a19b29d3cd047521998 100644
--- a/netware/test_db.sql
+++ b/netware/test_db.sql
@@ -1,3 +1,6 @@
+CREATE DATABASE mysql;
+CREATE DATABASE test;
+
 USE mysql;
 
 CREATE TABLE db (Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Select_priv enum('N','Y') DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') DEFAULT 'N' NOT NULL, References_priv enum('N','Y') DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL, PRIMARY KEY Host (Host,Db,User), KEY User (User)) comment='Database privileges';
diff --git a/scripts/make_binary_distribution.sh b/scripts/make_binary_distribution.sh
index 0773ccc679c37e0f03850db35bbba16d34c91422..1bdf5b86fdfe9ca5500ab0d1711ab3514dd0dd3c 100644
--- a/scripts/make_binary_distribution.sh
+++ b/scripts/make_binary_distribution.sh
@@ -10,6 +10,7 @@ version=@VERSION@
 export machine system version
 SOURCE=`pwd` 
 CP="cp -p"
+MV="mv"
 
 STRIP=1
 DEBUG=0
@@ -58,7 +59,7 @@ case $system in
     MYSQL_SHARE=$BASE/share
     EXTRA_BIN_FILES="netware/mysqld_safe.nlm netware/mysql_install_db.nlm \
       netware/init_db.sql netware/test_db.sql netware/mysql_explain_log.nlm \
-      netware/mysqlhotcopy.nlm netware/libmysql.nlm"
+      netware/mysqlhotcopy.nlm netware/libmysql.nlm netware/init_secure_db.sql"
     ;;
 esac
 
@@ -122,7 +123,7 @@ do
 done
 
 if [ $BASE_SYSTEM = "netware" ] ; then
-    $CP -r netware/scripts/* $BASE/scripts
+    $CP -r netware/*.pl $BASE/scripts
 fi
 
 for i in libmysql/.libs/libmysqlclient.a libmysql/.libs/libmysqlclient.so* libmysql/libmysqlclient.* libmysql_r/.libs/libmysqlclient_r.a libmysql_r/.libs/libmysqlclient_r.so* libmysql_r/libmysqlclient_r.* mysys/libmysys.a strings/libmystrings.a dbug/libdbug.a libmysqld/.libs/libmysqld.a libmysqld/.libs/libmysqld.so* libmysqld/libmysqld.a netware/libmysql.imp
@@ -148,12 +149,15 @@ if [ $BASE_SYSTEM != "netware" ] ; then
   rm -f $BASE/include/config-netware.h
 fi
 
-if [ -d tests ] ; then
-  $CP tests/*.res tests/*.tst tests/*.pl $BASE/tests
-fi
-if [ -d man ] ; then
-  $CP man/*.1 $BASE/man/man1
+if [ $BASE_SYSTEM != "netware" ] ; then
+  if [ -d tests ] ; then
+    $CP tests/*.res tests/*.tst tests/*.pl $BASE/tests
+  fi
+  if [ -d man ] ; then
+    $CP man/*.1 $BASE/man/man1
+  fi
 fi
+
 $CP support-files/* $BASE/support-files
 
 if [ $BASE_SYSTEM = "netware" ] ; then
diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h
index 5efda9ce88ccc5cd5c769fed091840703c5684e3..f7ade97940c7cf94dcc2129d18c62f67c2107264 100644
--- a/sql/item_cmpfunc.h
+++ b/sql/item_cmpfunc.h
@@ -475,8 +475,7 @@ class Item_func_isnull :public Item_bool_func
       if (!(used_tables_cache=args[0]->used_tables()))
       {
 	/* Remember if the value is always NULL or never NULL */
-	args[0]->val();
-	cached_value= args[0]->null_value ? (longlong) 1 : (longlong) 0;
+	cached_value= (longlong) args[0]->is_null();
       }
     }
   }
diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h
index d9a4302ce0cbab4a975635756837e6c7fc9f47a7..83b413591926b2ba9828bd4086824ddfbb4aae55 100644
--- a/sql/mysql_priv.h
+++ b/sql/mysql_priv.h
@@ -494,7 +494,7 @@ int mysqld_show(THD *thd, const char *wild, show_var_st *variables,
 /* sql_handler.cc */
 int mysql_ha_open(THD *thd, TABLE_LIST *tables);
 int mysql_ha_close(THD *thd, TABLE_LIST *tables, bool dont_send_ok=0);
-int mysql_ha_closeall(THD *thd, TABLE_LIST *tables, bool dont_send_ok=0);
+int mysql_ha_closeall(THD *thd, TABLE_LIST *tables);
 int mysql_ha_read(THD *, TABLE_LIST *,enum enum_ha_read_modes,char *,
                List<Item> *,enum ha_rkey_function,Item *,ha_rows,ha_rows);
 
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 98cb5159e934f964186b9c93bdfb6089b0ff1b55..324355e6f171d7cfc88caf0682eabedaeeaa9140 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -760,7 +760,7 @@ void kill_mysql(void)
 
 #if defined(OS2) || defined(__NETWARE__)
 extern "C" void kill_server(int sig_ptr)
-#define RETURN_FROM_KILL_SERVER DBUG_RETURN
+#define RETURN_FROM_KILL_SERVER DBUG_VOID_RETURN
 #elif !defined(__WIN__)
 static void *kill_server(void *sig_ptr)
 #define RETURN_FROM_KILL_SERVER DBUG_RETURN(0)
@@ -777,9 +777,6 @@ static void __cdecl kill_server(int sig_ptr)
     RETURN_FROM_KILL_SERVER;
   kill_in_progress=TRUE;
   abort_loop=1;					// This should be set
-#ifdef __NETWARE__
-  ActivateScreen(getscreenhandle());		// Show the screen going down
-#endif
   signal(sig,SIG_IGN);
   if (sig == MYSQL_KILL_SIGNAL || sig == 0)
     sql_print_error(ER(ER_NORMAL_SHUTDOWN),my_progname);
@@ -1392,7 +1389,6 @@ static void check_data_home(const char *path)
 // down server event callback
 void mysql_down_server_cb(void *, void *)
 {
-  setscreenmode(SCR_AUTOCLOSE_ON_EXIT);   // auto close the screen
   kill_server(0);
 }
 
@@ -1448,26 +1444,6 @@ static void start_signal_handler(void)
 
 static void check_data_home(const char *path)
 {
-  struct volume_info vol;
-  char buff[PATH_MAX], *pos;
-
-  bzero((char*) &vol, sizeof(vol));    // clear struct
-
-  // find volume name
-  if ((pos= strchr(path, ':')))
-  {
-    uint length= (uint) (pos-path);
-    strmake(buff, path, min(length, sizeof(buff)-1));
-  }
-  else
-    strmov(buff, "SYS");     // assume SYS volume
-
-  netware_vol_info_from_name(&vol, buff);    // retrieve information
-  if ((vol.flags & VOL_NSS_PRESENT) == 0)
-  {
-    sql_print_error("Error: %s is not on an NSS volume!", path);
-    unireg_abort(-1);
-  }
 }
 
 #elif defined(__EMX__)
@@ -2005,11 +1981,6 @@ int main(int argc, char **argv)
 
   start_time=time((time_t*) 0);
 
-#ifdef __NETWARE__
-  printf("MySQL Server %s, for %s (%s)\n", VERSION, SYSTEM_TYPE, MACHINE_TYPE);
-  fflush(stdout);
-#endif /* __NETWARE__ */
-
 #ifdef OS2
   {
     // fix timezone for daylight saving
@@ -2764,7 +2735,11 @@ inline void kill_broken_server()
       (!opt_disable_networking && ip_sock == INVALID_SOCKET))
   {
     select_thread_in_use = 0;
+#ifdef __NETWARE__
+    kill_server(MYSQL_KILL_SIGNAL); /* never returns */
+#else
     kill_server((void*)MYSQL_KILL_SIGNAL); /* never returns */
+#endif /* __NETWARE__ */
   }
 }
 #define MAYBE_BROKEN_SYSCALL kill_broken_server();
@@ -3181,8 +3156,7 @@ enum options {
   OPT_BDB_CACHE_SIZE,
   OPT_BDB_LOG_BUFFER_SIZE,
   OPT_BDB_MAX_LOCK,
-  OPT_ERROR_LOG_FILE,
-  OPT_AUTOCLOSE
+  OPT_ERROR_LOG_FILE
 };
 
 
@@ -3192,9 +3166,6 @@ struct my_option my_long_options[] =
 {
   {"ansi", 'a', "Use ANSI SQL syntax instead of MySQL syntax", 0, 0, 0,
    GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
-#ifdef __NETWARE__
-  {"autoclose", OPT_AUTOCLOSE, "Auto close screen. (NetWare only)", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
-#endif /* __NETWARE__ */
   {"basedir", 'b',
    "Path to installation directory. All paths are usually resolved relative to this.",
    (gptr*) &mysql_home_ptr, (gptr*) &mysql_home_ptr, 0, GET_STR, REQUIRED_ARG,
@@ -4526,11 +4497,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
     if (opt_console)
       opt_error_log= 0;			// Force logs to stdout
     break;
-#ifdef __NETWARE__
-  case (int) OPT_AUTOCLOSE:
-    setscreenmode(SCR_AUTOCLOSE_ON_EXIT);
-    break;
-#endif
   case (int) OPT_FLUSH:
 #ifdef HAVE_ISAM
     nisam_flush=1;
diff --git a/sql/net_pkg.cc b/sql/net_pkg.cc
index 2ce811157af2836561ed7bcd1feeda6d1b5113b3..315cad5ca6d53b0affed2eb9abca15e7972fa41c 100644
--- a/sql/net_pkg.cc
+++ b/sql/net_pkg.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
+/* Copyright (C) 2000-2003 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
@@ -283,11 +283,6 @@ bool
 net_store_data(String *packet,const char *from,uint length)
 {
   ulong packet_length=packet->length();
-/* 
-   We have added net5store in net_store_length. 
-   Before that largest size was int3store.
-   Therefore +5 is changed to +9
-*/
   if (packet_length+9+length > packet->alloced_length() &&
       packet->realloc(packet_length+9+length))
     return 1;
@@ -305,8 +300,12 @@ net_store_data(String *packet,const char *from)
 {
   uint length=(uint) strlen(from);
   uint packet_length=packet->length();
-  if (packet_length+9+length > packet->alloced_length() &&
-      packet->realloc(packet_length+9+length))
+  /*
+    3 is the longest coding for storing a string with the used
+    net_store_length() function. We use 5 here 'just in case'
+  */
+  if (packet_length+5+length > packet->alloced_length() &&
+      packet->realloc(packet_length+5+length))
     return 1;
   char *to=(char*) net_store_length((char*) packet->ptr()+packet_length,
 				    length);
diff --git a/sql/records.cc b/sql/records.cc
index 7c3bd1110bbd82b2fb8e4a0630043a39ddb4ff14..22c4d54550ceef95e3c87b341d062eb0f0085d65 100644
--- a/sql/records.cc
+++ b/sql/records.cc
@@ -45,7 +45,8 @@ void init_read_record(READ_RECORD *info,THD *thd, TABLE *table,
   info->ref_length=table->file->ref_length;
   info->select=select;
   info->print_error=print_error;
-  table->status=0;			/* And it's allways found */
+  info->ignore_not_found_rows= 0;
+  table->status=0;			/* And it's always found */
 
   if (select && my_b_inited(&select->file))
     tempfile= &select->file;
@@ -184,7 +185,8 @@ static int rr_from_tempfile(READ_RECORD *info)
   {
     if (tmp == HA_ERR_END_OF_FILE)
       tmp= -1;
-    else if (tmp == HA_ERR_RECORD_DELETED)
+    else if (tmp == HA_ERR_RECORD_DELETED ||
+	     (tmp == HA_ERR_KEY_NOT_FOUND && info->ignore_not_found_rows))
       goto tryNext;
     else
     {
@@ -212,7 +214,8 @@ static int rr_from_pointers(READ_RECORD *info)
   {
     if (tmp == HA_ERR_END_OF_FILE)
       tmp= -1;
-    else if (tmp == HA_ERR_RECORD_DELETED)
+    else if (tmp == HA_ERR_RECORD_DELETED ||
+	     (tmp == HA_ERR_KEY_NOT_FOUND && info->ignore_not_found_rows))
       goto tryNext;
     else
     {
diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc
index 4997305de6b47feebef424df733e02c204613e83..1507d49ebd6b2311e03aaaba643cae133aa7db4e 100644
--- a/sql/sql_delete.cc
+++ b/sql/sql_delete.cc
@@ -393,6 +393,7 @@ void multi_delete::send_error(uint errcode,const char *err)
 int multi_delete::do_deletes(bool from_send_error)
 {
   int local_error= 0, counter= 0;
+  DBUG_ENTER("do_deletes");
 
   if (from_send_error)
   {
@@ -418,7 +419,12 @@ int multi_delete::do_deletes(bool from_send_error)
     }
 
     READ_RECORD	info;
-    init_read_record(&info,thd,table,NULL,0,0);
+    init_read_record(&info,thd,table,NULL,0,1);
+    /*
+      Ignore any rows not found in reference tables as they may already have
+      been deleted by foreign key handling
+    */
+    info.ignore_not_found_rows= 1;
     while (!(local_error=info.read_record(&info)) && !thd->killed)
     {
       if ((local_error=table->file->delete_row(table->record[0])))
@@ -432,7 +438,7 @@ int multi_delete::do_deletes(bool from_send_error)
     if (local_error == -1)				// End of file
       local_error = 0;
   }
-  return local_error;
+  DBUG_RETURN(local_error);
 }
 
 
diff --git a/sql/sql_handler.cc b/sql/sql_handler.cc
index eeaa574c69d7dd9c3f694f0ae58c166726d5c475..12e8c9e227a7fef30d1e1273ccce93c11fb6a9a1 100644
--- a/sql/sql_handler.cc
+++ b/sql/sql_handler.cc
@@ -87,18 +87,11 @@ int mysql_ha_close(THD *thd, TABLE_LIST *tables, bool dont_send_ok)
   return 0;
 }
 
-int mysql_ha_closeall(THD *thd, TABLE_LIST *tables, bool dont_send_ok)
+int mysql_ha_closeall(THD *thd, TABLE_LIST *tables)
 {
   TABLE **ptr=find_table_ptr_by_name(thd, tables->db, tables->real_name, 0);
-
-  DBUG_ASSERT(dont_send_ok);
   if (*ptr)
-  {
-//    if (!dont_send_ok) VOID(pthread_mutex_lock(&LOCK_open));
     close_thread_table(thd, ptr);
-//    if (!dont_send_ok) VOID(pthread_mutex_unlock(&LOCK_open));
-  }
-//  if (!dont_send_ok) send_ok(&thd->net);
   return 0;
 }
 
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index e8857a7faebd4657445477b775573b77e31359c7..31fcb0be8e38882b1ec5c8077a341251053dbab9 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -174,7 +174,7 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
   for (table=tables ; table ; table=table->next)
   {
     char *db=table->db ? table->db : thd->db;
-    mysql_ha_closeall(thd, table, 1);
+    mysql_ha_closeall(thd, table);
     if (!close_temporary_table(thd, db, table->real_name))
     {
       tmp_table_deleted=1;
diff --git a/sql/structs.h b/sql/structs.h
index be50c8fc24d7f761963e31db23e623fb7450afd1..77fed422d21727ec8232a32edef6935f4defe513 100644
--- a/sql/structs.h
+++ b/sql/structs.h
@@ -106,7 +106,7 @@ typedef struct st_read_record {			/* Parameter to read_record */
   byte *record;
   byte	*cache,*cache_pos,*cache_end,*read_positions;
   IO_CACHE *io_cache;
-  bool print_error;
+  bool print_error, ignore_not_found_rows;
 } READ_RECORD;
 
 enum timestamp_type { TIMESTAMP_NONE, TIMESTAMP_DATE, TIMESTAMP_FULL,