>Description:
ft_dump failed to link on Tru64 UNIX V4.0F with gcc 3.1:

/bin/ksh ../libtool --mode=link gcc  -O3 -DDBUG_OFF   -mieee 
-DUNDEF_HAVE_GETHOSTBYNAME_R   -o ft_dump  ft_dump.o libmyisam.a ../mysys/libmysys.a 
../dbug/libdbug.a ../strings/libmystrings.a -lm  -lpthread 
gcc -O3 -DDBUG_OFF -mieee -DUNDEF_HAVE_GETHOSTBYNAME_R -o ft_dump ft_dump.o  
libmyisam.a ../mysys/libmysys.a ../dbug/libdbug.a ../strings/libmystrings.a -lm 
-lpthread
snprintf
collect2: ld returned 1 exit status
make[2]: *** [ft_dump] Error 1

Obviously, snprintf is undefined (true, since the system libc lacks that function).
        
>How-To-Repeat:
Configure and build mysql 4.0.14 as described in Environment below.
        
>Fix:
myisam/ft_dump.c used snprintf unconditionally, whitout regarding HAVE_SNPRINTF.
There are two other places where the test was broken: they used HAVE_SNPRINTF_
(which doesn't exist anywhere) instead of HAVE_SNPRINTF.

The following patch fixes all three errors and allows the mysql build to
complete successfully.

===================================================================
RCS file: libmysqld/RCS/field.cc,v
retrieving revision 1.1
diff -up -r1.1 libmysqld/field.cc
--- libmysqld/field.cc  2003/07/18 14:57:47     1.1
+++ libmysqld/field.cc  2003/08/07 23:27:22
@@ -742,7 +742,7 @@ void Field_decimal::store(double nr)
   char buff[320];
 
   fyllchar = zerofill ? (char) '0' : (char) ' ';
-#ifdef HAVE_SNPRINTF_
+#ifdef HAVE_SNPRINTF
   buff[sizeof(buff)-1]=0;                      // Safety
   snprintf(buff,sizeof(buff)-1, "%.*f",(int) dec,nr);
 #else
===================================================================
RCS file: myisam/RCS/ft_dump.c,v
retrieving revision 1.1
diff -up -r1.1 myisam/ft_dump.c
--- myisam/ft_dump.c    2003/07/18 14:57:46     1.1
+++ myisam/ft_dump.c    2003/08/07 23:30:43
@@ -130,7 +130,12 @@ int main(int argc,char *argv[])
 #error
 #endif
 
-      snprintf(buf,MAX_LEN,"%.*s",(int) keylen,info->lastkey+1);
+#ifdef HAVE_SNPRINTF
+  buf[sizeof(buf)-1]=0;                        // Safety
+  snprintf(buf,MAX_LEN,"%.*s",(int) keylen,info->lastkey+1);
+#else
+  sprintf(buf,"%.*s",(int) keylen,info->lastkey+1);
+#endif
       casedn_str(buf);
       total++;
       lengths[keylen]++;
===================================================================
RCS file: sql/RCS/field.cc,v
retrieving revision 1.1
diff -up -r1.1 sql/field.cc
--- sql/field.cc        2003/07/18 14:57:47     1.1
+++ sql/field.cc        2003/08/07 23:25:53
@@ -742,7 +742,7 @@ void Field_decimal::store(double nr)
   char buff[320];
 
   fyllchar = zerofill ? (char) '0' : (char) ' ';
-#ifdef HAVE_SNPRINTF_
+#ifdef HAVE_SNPRINTF
   buff[sizeof(buff)-1]=0;                      // Safety
   snprintf(buff,sizeof(buff)-1, "%.*f",(int) dec,nr);
 #else
        

>Submitter-Id:  net
>Originator:    
>Organization:
  -----------------------------------------------------------------------------
  Rainer Orth, Faculty of Technology, Bielefeld University
>
>MySQL support: none
>Synopsis:      Several unconditional uses of snprintf cause link failure on Tru64 
>UNIX V4.0F
>Severity:      serious
>Priority:      medium
>Category:      mysql
>Class:         sw-bug
>Release:       mysql-4.0.14 (Source distribution)
>C compiler:    gcc (GCC) 3.1
>C++ compiler:  g++ (GCC) 3.1
>Environment:
        
System: OSF1 metropolitan V4.0 1229 alpha
Machine: alpha
Some paths:  /vol/perl-5.8/bin/perl /vol/gnu/bin/make /vol/gnu/bin/gcc /usr/bin/cc
GCC: Reading specs from /vol/gnu/lib/gcc-lib/alpha-dec-osf4.0f/3.1/specs
Configured with: /vol/gnu/src/gcc/gcc-3.1-branch-dist/configure --prefix=/vol/gnu 
--with-local-prefix=/vol/gnu --disable-nls alpha-dec-osf4.0f
Thread model: single
gcc version 3.1
Compilation info: CC='gcc'  CFLAGS=''  CXX='g++'  CXXFLAGS=''  LDFLAGS=''  ASFLAGS=''
LIBC: 
lrwxr-xr-x   1 root     system         17 Dec 15  1999 /lib/libc.a -> ../ccs/lib/libc.a
lrwxr-xr-x   1 root     system         17 Dec 15  1999 /usr/lib/libc.a -> 
../ccs/lib/libc.a
Configure command: ./configure '--prefix=/vol/mysql-4.0' 
'--infodir=/vol/mysql-4.0/share/info' '--libexecdir=/vol/mysql-4.0/lib' 
'--with-berkeley-db' '--without-bench' '--build' 'alpha-dec-osf4.0f' 
'build_alias=alpha-dec-osf4.0f'

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to