Thread: Er ... does port/snprintf.c actually work?

Er ... does port/snprintf.c actually work?

From
Tom Lane
Date:
I started to do some simple testing of snprintf.c after doing the
cleanup work I had in mind, and soon found that neither my version
nor the original actually do parameter reordering correctly:

$ ./testf 'abc%2$sfoo%1$s' DEF GHI
sys:
abcGHIfooDEF            <--- looks right to me
ours:
abcDEFfooGHI            <--- wrong
done

I haven't dug into this too closely yet (offhand I think the problem
is that the loop at line 541ff is searching fmtpar[] and then using
fmtparptr[]) but was wondering why it hadn't been noticed before.
Which of our platforms actually use port/snprintf.c, and hasn't anyone
tried any of the internationalized message databases on one?
        regards, tom lane