[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Incorrect assumption of vsnprintf() behavior in RPM 4.0.4
- From: Albert Chin <rpm-list thewrittenword com>
- To: rpm-list redhat com
- Subject: Incorrect assumption of vsnprintf() behavior in RPM 4.0.4
- Date: Sun, 20 Apr 2003 13:48:21 -0500
RPM 4.0.4 incorrectly assumes C99 vsnprintf() behavior. This breaks
RPM on IRIX 6.5, Solaris 2.5.1, and Tru64 UNIX. The patch below fixes
this. This patch uses the trio *snprintf() replacement functions from:
http://ctrio.sourceforge.net
and assumes the trio source files are in rpmio/ (not included in this
patch).
The AC_FUNC_VSNPRINTF_C99 macro was stolen from glib 2.2.1.
Without this patch, -q --scripts is essentially broken on the above
platforms.
--
albert chin (china@thewrittenword.com)
-- snip snip
--- /dev/null 2003-04-20 08:45:35.000000000 -0500
+++ acinclude.m4 2003-04-20 08:14:45.964148000 -0500
@@ -0,0 +1,45 @@
+dnl @synopsis AC_FUNC_VSNPRINTF_C99
+dnl
+dnl Check whether there is a vsnprintf() function with C99 semantics installed.
+dnl
+AC_DEFUN([AC_FUNC_VSNPRINTF_C99],
+[AC_CACHE_CHECK(for C99 vsnprintf,
+ ac_cv_func_vsnprintf_c99,
+[AC_TRY_RUN(
+[#include <stdio.h>
+#include <stdarg.h>
+
+int
+doit(char * s, ...)
+{
+ char buffer[32];
+ va_list args;
+ int r;
+
+ va_start(args, s);
+ r = vsnprintf(buffer, 5, s, args);
+ va_end(args);
+
+ if (r != 7)
+ exit(1);
+
+ exit(0);
+
+ return (0);
+}
+
+int
+main(void)
+{
+ doit("1234567");
+ exit(1);
+}], ac_cv_func_vsnprintf_c99=yes, ac_cv_func_vsnprintf_c99=no, ac_cv_func_vsnprintf_c99=no)])
+dnl Note that the default is to be pessimistic in the case of cross compilation.
+dnl If you know that the target has a C99 vsnprintf(), you can get around this
+dnl by setting ac_func_vsnprintf_c99 to yes, as described in the Autoconf manual.
+if test $ac_cv_func_vsnprintf_c99 = yes; then
+ AC_DEFINE(HAVE_C99_VSNPRINTF, 1,
+ [Define if you have a version of the vsnprintf function
+ with semantics as specified by the ISO C99 standard.])
+fi
+])# AC_FUNC_VSNPRINTF_C99
--- configure.in.orig 2002-05-12 14:24:56.000000000 -0500
+++ configure.in 2003-04-20 09:00:57.974078000 -0500
@@ -357,7 +357,14 @@
dnl Better not use fchmod at all.
AC_CHECK_FUNC(fchmod)
-AC_CHECK_FUNCS(vsnprintf snprintf)
+AC_CHECK_FUNCS(vsnprintf)
+AC_FUNC_VSNPRINTF_C99
+if test "x$ac_cv_func_vsnprintf_c99" = "xno"; then
+ # for trio
+ AC_SEARCH_LIBS(pow, m)
+fi
+
+AM_CONDITIONAL(WITH_TRIO_SOURCES, test "x$ac_cv_func_vsnprintf_c99" = "xno")
dnl Temporary hack for MiNT. Some functions (writev, snprintf) are
dnl not in the libc but in libport (for political reasons). This check
--- rpmio/Makefile.am.orig 2002-05-12 14:33:54.000000000 -0500
+++ rpmio/Makefile.am 2003-04-20 09:01:49.399228000 -0500
@@ -26,8 +26,14 @@
BEECRYPTLOBJS = $(shell cat $(top_builddir)/beecrypt/listobjs)
lib_LTLIBRARIES = librpmio.la
+if WITH_TRIO_SOURCES
+librpmio_la_SOURCES = digest.c macro.c rpmio.c rpmlog.c rpmmalloc.c \
+ rpmpgp.c rpmrpc.c strcasecmp.c stubs.c url.c ugid.c \
+ trio.c trionan.c triostr.c
+else
librpmio_la_SOURCES = digest.c macro.c rpmio.c rpmlog.c rpmmalloc.c \
rpmpgp.c rpmrpc.c strcasecmp.c stubs.c url.c ugid.c
+endif
librpmio_la_LDFLAGS = -release @VERSION@
librpmio_la_LIBADD = $(BEECRYPTLOBJS)
librpmio_la_DEPENDENCIES = .created
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
[]