Re: [PATCHES] [HACKERS] snprintf causes regression tests to fail

2005-02-28 Thread Bruce Momjian
Tom Lane wrote:
 [EMAIL PROTECTED] writes:
  Do we have any idea about what format string causes the regression failure?
 
 I'll bet the problem is that configure.in is doing things in the wrong
 order: it computes INT64_FORMAT against the system printf before
 deciding we should use our own printf.

Ah, the problem was introduced here:

revision 1.401
date: 2005/02/24 02:12:15;  author: tgl;  state: Exp;  lines: +13 -12
We aren't supposed to try to run test programs until after we've
verified that AC_TRY_RUN works.

The problem is that the PGAC_FUNC_PRINTF_ARG_CONTROL call was moved
below the printf 64-bit tests.  This commited patch moves
PGAC_FUNC_PRINTF_ARG_CONTROL which is after we know AC_TRY_RUN works and
just before printf 64-bit args are tested.

-- 
  Bruce Momjian|  http://candle.pha.pa.us
  pgman@candle.pha.pa.us   |  (610) 359-1001
  +  If your life is a hard drive, |  13 Roberts Road
  +  Christ can be your backup.|  Newtown Square, Pennsylvania 19073
Index: configure
===
RCS file: /cvsroot/pgsql/configure,v
retrieving revision 1.428
diff -c -c -r1.428 configure
*** configure   24 Feb 2005 02:12:14 -  1.428
--- configure   28 Feb 2005 20:33:41 -
***
*** 14809,14814 
--- 14809,14876 
  # snprintfs that use %lld, %qd, or %I64d as the format.  If none of these
  # work, fall back to our own snprintf emulation (which we know uses %lld).
  
+ # Also force use of our snprintf if system's doesn't do arg control
+ if test $pgac_need_repl_snprintf = no; then
+   echo $as_me:$LINENO: checking whether printf supports argument control 5
+ echo $ECHO_N checking whether printf supports argument control... $ECHO_C 
6
+ if test ${pgac_cv_printf_arg_control+set} = set; then
+   echo $ECHO_N (cached) $ECHO_C 6
+ else
+   if test $cross_compiling = yes; then
+   pgac_cv_printf_arg_control=cross
+ else
+   cat conftest.$ac_ext _ACEOF
+ #line $LINENO configure
+ #include confdefs.h
+ #include stdio.h
+ #include string.h
+ 
+ int main()
+ {
+   char buf[100];
+ 
+   /* can it swap arguments? */
+   snprintf(buf, 100, %2\$d %1\$d, 3, 4);
+   if (strcmp(buf, 4 3) != 0)
+ return 1;
+   return 0;
+ }
+ _ACEOF
+ rm -f conftest$ac_exeext
+ if { (eval echo $as_me:$LINENO: \$ac_link\) 5
+   (eval $ac_link) 25
+   ac_status=$?
+   echo $as_me:$LINENO: \$? = $ac_status 5
+   (exit $ac_status); }  { ac_try='./conftest$ac_exeext'
+   { (eval echo $as_me:$LINENO: \$ac_try\) 5
+   (eval $ac_try) 25
+   ac_status=$?
+   echo $as_me:$LINENO: \$? = $ac_status 5
+   (exit $ac_status); }; }; then
+   pgac_cv_printf_arg_control=yes
+ else
+   echo $as_me: program exited with status $ac_status 5
+ echo $as_me: failed program was: 5
+ cat conftest.$ac_ext 5
+ ( exit $ac_status )
+ pgac_cv_printf_arg_control=no
+ fi
+ rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext 
conftest.$ac_ext
+ fi
+ 
+ fi
+ echo $as_me:$LINENO: result: $pgac_cv_printf_arg_control 5
+ echo ${ECHO_T}$pgac_cv_printf_arg_control 6
+ 
+   if test $pgac_cv_printf_arg_control != yes ; then
+ pgac_need_repl_snprintf=yes
+   fi
+ fi
+ 
+ if test $pgac_need_repl_snprintf = yes; then
+   LIBOBJS=$LIBOBJS snprintf.$ac_objext
+ fi
+ 
  if test $HAVE_LONG_LONG_INT_64 = yes ; then
if test $pgac_need_repl_snprintf = no; then
  echo $as_me:$LINENO: checking snprintf format for long long int 5
***
*** 14911,14978 
  _ACEOF
  
  
- # Also force use of our snprintf if system's doesn't do arg control
- if test $pgac_need_repl_snprintf = no; then
-   echo $as_me:$LINENO: checking whether printf supports argument control 5
- echo $ECHO_N checking whether printf supports argument control... $ECHO_C 
6
- if test ${pgac_cv_printf_arg_control+set} = set; then
-   echo $ECHO_N (cached) $ECHO_C 6
- else
-   if test $cross_compiling = yes; then
-   pgac_cv_printf_arg_control=cross
- else
-   cat conftest.$ac_ext _ACEOF
- #line $LINENO configure
- #include confdefs.h
- #include stdio.h
- #include string.h
- 
- int main()
- {
-   char buf[100];
- 
-   /* can it swap arguments? */
-   snprintf(buf, 100, %2\$d %1\$d, 3, 4);
-   if (strcmp(buf, 4 3) != 0)
- return 1;
-   return 0;
- }
- _ACEOF
- rm -f conftest$ac_exeext
- if { (eval echo $as_me:$LINENO: \$ac_link\) 5
-   (eval $ac_link) 25
-   ac_status=$?
-   echo $as_me:$LINENO: \$? = $ac_status 5
-   (exit $ac_status); }  { ac_try='./conftest$ac_exeext'
-   { (eval echo $as_me:$LINENO: \$ac_try\) 5
-   (eval $ac_try) 25
-   ac_status=$?
-   echo $as_me:$LINENO: \$? = $ac_status 5
-   (exit $ac_status); }; }; then
-   pgac_cv_printf_arg_control=yes
- else
-   echo $as_me: program exited with status $ac_status 5
- echo $as_me: failed program was: 5
- cat conftest.$ac_ext 5
- ( exit $ac_status )
- pgac_cv_printf_arg_control=no
- fi
- rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext 
conftest.$ac_ext
- fi
- 

Re: [PATCHES] [HACKERS] snprintf causes regression tests to fail

2005-02-28 Thread Tom Lane
Bruce Momjian pgman@candle.pha.pa.us writes:
 Ah, the problem was introduced here:

Right, it was my fault.

 The problem is that the PGAC_FUNC_PRINTF_ARG_CONTROL call was moved
 below the printf 64-bit tests.  This commited patch moves
 PGAC_FUNC_PRINTF_ARG_CONTROL which is after we know AC_TRY_RUN works and
 just before printf 64-bit args are tested.

This patch breaks things in a different way: you should not have moved
the AC_LIBOBJ(snprintf) step.  Also you randomly placed the arg-control
test between a chunk of code and the comment describing same.

Corrected version committed.

regards, tom lane

---(end of broadcast)---
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]


Re: [PATCHES] [HACKERS] snprintf causes regression tests to fail

2005-02-28 Thread Bruce Momjian
Tom Lane wrote:
 Bruce Momjian pgman@candle.pha.pa.us writes:
  Ah, the problem was introduced here:
 
 Right, it was my fault.
 
  The problem is that the PGAC_FUNC_PRINTF_ARG_CONTROL call was moved
  below the printf 64-bit tests.  This commited patch moves
  PGAC_FUNC_PRINTF_ARG_CONTROL which is after we know AC_TRY_RUN works and
  just before printf 64-bit args are tested.
 
 This patch breaks things in a different way: you should not have moved
 the AC_LIBOBJ(snprintf) step.  Also you randomly placed the arg-control
 test between a chunk of code and the comment describing same.

Thanks.
-- 
  Bruce Momjian|  http://candle.pha.pa.us
  pgman@candle.pha.pa.us   |  (610) 359-1001
  +  If your life is a hard drive, |  13 Roberts Road
  +  Christ can be your backup.|  Newtown Square, Pennsylvania 19073

---(end of broadcast)---
TIP 9: the planner will ignore your desire to choose an index scan if your
  joining column's datatypes do not match