bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

can't compile bash 4.1 under Solaris 8/9


From: Yann Rouillard
Subject: can't compile bash 4.1 under Solaris 8/9
Date: Wed, 06 Jan 2010 15:54:08 +0100
User-agent: Thunderbird 2.0.0.23 (X11/20090817)

Configuration Information [Automatically generated, do not change]:
Machine: sparc
OS: solaris2.8
Compiler: /opt/studio/SOS11/SUNWspro/bin/cc
Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='sparc' -DCONF_OSTYPE='solaris2.8' -DCONF_MACHTYPE='sparc-sun-solaris2.8' -DCONF_VENDOR='sun' -DLOCALEDIR='/opt/csw/share/locale' -DPACKAGE='bas h' -DSHELL -DHAVE_CONFIG_H -DSOLARIS -I. -I. -I./include -I./lib -I/opt/csw/include -xO3 -xarch=v8 -I/opt/csw/include uname output: SunOS build8s 5.8 Generic_Virtual sun4u sparc SUNW,SPARC-Enterprise-T5220
Machine Type: sparc-sun-solaris2.8

Bash Version: 4.1
Patch Level: 0
Release Status: release

Description:
bash 4.1 can't be compiled under Solaris 8 and Solaris 9, the compilation stops at a vsnprintf redefinition error. This happens because the vsnprintf native function is not detected as being standard compliant (it returns -1 in case of overflow) by the configure script, hence bash redefine the function at compile time.


Repeat-By:
Try to compile bash 4.1 under Solaris 8 or Solaris 9, you end up with the following error:

...
rm -f printf.o
./mkbuiltins -D . printf.def
/opt/studio/SOS11/SUNWspro/bin/cc -c -DHAVE_CONFIG_H -DSHELL -I. -I.. -I.. -I../include -I../lib -I. -DSOLARIS -I/opt/csw/include -xO3 -xarch=v8 -I/opt/csw/include printf.c || ( rm -f p rintf.c ; exit 1 )
"./printf.def", line 175: identifier redeclared: vsnprintf
current : function(pointer to char, unsigned int, pointer to const char, ...) returning int previous: function(pointer to char, unsigned int, pointer to const char, pointer to void) returning int : "/usr/include/stdio.h", line 227
cc: acomp failed for printf.c
gmake[3]: *** [printf.o] Error 1
...

Fix:
I fixed the problem by renaming the vsnprintf function to bash_vsnprintf to be able to use another vsnprintf function without name clash but I am not sure it's the proper solution.
I used the following patch:

diff --speed-large-files -Nur bash-4.1.orig/builtins/printf.def bash-4.1/builtins/printf.def
--- bash-4.1.orig/builtins/printf.def   2010-01-06 15:15:00.498275417 +0100
+++ bash-4.1/builtins/printf.def        2010-01-06 15:13:39.646642489 +0100
@@ -172,7 +172,9 @@
 #endif

 #if !HAVE_VSNPRINTF
-extern int vsnprintf __P((char *, size_t, const char *, ...)) __attribute__((__format__ (printf, 3, 4))); +extern int bash_vsnprintf __P((char *, size_t, const char *, ...)) __attribute__((__format__ (printf, 3, 4)));
+#else
+#  define bash_vsnprintf vsnprintf
 #endif

 static void printf_erange __P((char *));
@@ -885,7 +887,7 @@
   int blen;

   SH_VA_START (args, format);
-  blen = vsnprintf (vbuf + vblen, vbsize - vblen, format, args);
+  blen = bash_vsnprintf (vbuf + vblen, vbsize - vblen, format, args);
   va_end (args);

   nlen = vblen + blen + 1;
@@ -894,7 +896,7 @@
       vbsize = ((nlen + 63) >> 6) << 6;
       vbuf = (char *)xrealloc (vbuf, vbsize);
       SH_VA_START (args, format);
-      blen = vsnprintf (vbuf + vblen, vbsize - vblen, format, args);
+      blen = bash_vsnprintf (vbuf + vblen, vbsize - vblen, format, args);
       va_end (args);
     }

diff --speed-large-files -Nur bash-4.1.orig/lib/sh/snprintf.c bash-4.1/lib/sh/snprintf.c
--- bash-4.1.orig/lib/sh/snprintf.c     2010-01-06 15:14:47.740952207 +0100
+++ bash-4.1/lib/sh/snprintf.c  2010-01-06 15:14:25.727971179 +0100
@@ -1655,9 +1655,9 @@

 int
 #if defined (__STDC__)
-vsnprintf(char *string, size_t length, const char *format, va_list args)
+bash_vsnprintf(char *string, size_t length, const char *format, va_list args)
 #else
-vsnprintf(string, length, format, args)
+bash_vsnprintf(string, length, format, args)
      char *string;
      size_t length;
      const char *format;






reply via email to

[Prev in Thread] Current Thread [Next in Thread]