Sujet : Re: FreeTDS port to VMS V9.x on x86?
De : arne (at) *nospam* vajhoej.dk (Arne Vajhøj)
Groupes : comp.os.vmsDate : 06. Jun 2025, 02:35:50
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <101tglm$1s66m$1@dont-email.me>
References : 1 2 3 4 5 6 7 8
User-Agent : Mozilla Thunderbird
On 6/5/2025 5:16 PM, Craig A. Berry wrote:
On 6/5/25 12:33 PM, Simon Clubley wrote:
On 2025-06-05, Arne Vajhøj <arne@vajhoej.dk> wrote:
Mysterious.
>
stat = dbfcmd(con, "INSERT INTO t1 VALUES(%d, '%s')", f1, f2esc);
>
fails.
>
char buf[1000];
sprintf(buf, "INSERT INTO t1 VALUES(%d, '%s')", f1, f2esc);
stat = dbcmd(con, buf);
>
works.
>
And DBLIB.C contains:
>
RETCODE
dbfcmd(DBPROCESS * dbproc, const char *fmt, ...)
{
va_start(ap, fmt);
len = vasprintf(&s, fmt, ap);
va_end(ap);
Does this _exact_ code work on Alpha ?
>
If yes, try building your test code with compiler optimisation disabled.
>
If that doesn't work, try building the library itself with compiler
optimisation disabled.
$ mmk clean
$ @[.vms]configure
$ mmk/MACRO=__DEBUG__=1
It is vasprintf that return -1.
It happens with both normal build and /DEB/NOOPT.
I have not tried on Alpha yet.
Any compiler build warnings either in the library or your test code ?
(Try setting warnings to fatal to abort the build if you get a lot of
output during building).
There are just a few %CC-I-QUESTCOMPARE.
I am trying to eliminate the possibility you may have stumbled across
a compiler bug.
It is a mystery.
I have a query that use dbfcmd and it works. But it fails for
my updates.
I created a standalone example doing the same just without any FreeTDS.
It works fine.
$ typ z.c
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdarg.h>
void dbfcmd(void *dbproc, const char *fmt, ...)
{
va_list ap;
char *s;
int len;
va_start(ap, fmt);
len = vasprintf(&s, fmt, ap);
va_end(ap);
printf("len=%d s=|%s|\n", len, s);
free(s);
}
int main()
{
dbfcmd(NULL, "INSERT INTO t1 VALUES(%d, '%s')", 999, "XXX");
dbfcmd(NULL, "INSERT INTO t1 VALUES(%d, '%s')", 999, "XXX");
dbfcmd(NULL, "INSERT INTO t1 VALUES(%d, '%s')", 999, "XXXXXX");
return 0;
}
$ r z
len=33 s=|INSERT INTO t1 VALUES(999, 'XXX')|
len=33 s=|INSERT INTO t1 VALUES(999, 'XXX')|
len=36 s=|INSERT INTO t1 VALUES(999, 'XXXXXX')|
I must be missing something.
Arne