{"thread":{"id":"29133","subject":"Breakage (?) in configure and git_vsnprintf()","startedAt":"2011-12-11T18:42:03Z","lastAt":"2011-12-12T23:25:11Z","messageCount":10,"participants":["Michael Haggerty","Jeff King","Johannes Sixt","Junio C Hamano","Andreas Schwab","Jonathan Nieder","Brandon Casey"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"180825","messageId":"4EE4F97B.9000202@alum.mit.edu","threadId":"29133","inReplyTo":null,"subject":"Breakage (?) in configure and git_vsnprintf()","fromName":"Michael Haggerty","fromEmail":"mhagger@alum.mit.edu","sentAt":"2011-12-11T18:42:03Z","receivedAt":"2011-12-11T18:42:03Z","isPatch":false,"sender":{"key":"mhagger@alum.mit.edu","avatar":"https://avatars.githubusercontent.com/u/119718?v=4"},"body":"I found a mysterious bunch of test suite failures when I compiled git on\na 64-bit Linux 3.0.0 using gcc 4.6.1:\n\n    git clean -f -x -d\n    make clean\n    make configure\n    ./configure --prefix=$HOME CFLAGS='-g -O0 -std=c89 -Wall -Werror'\n    make test\n\nThe failure unexpectedly depended on the presence of all three compiler\noptions \"-std=c89 -Wall -Werror\".  There is no difference between -O0\nand -O2.  The breakage is in v1.7.7, v1.7.8, and master (I didn't try\nolder versions).\n\nI have been using \"-std=c89\" when compiling to avoid accidentally using\nnewer C features.  Perhaps that is unwise :-)\n\nThe same test succeeds on 32-bit Linux 2.6.32 using gcc 4.4.3.\n\nThere seem to be two levels to the problem:\n\n\n1. With this choice of compiler options, configure incorrectly convinces\nitself that the system's snprintf() is broken and sets\nSNPRINTF_RETURNS_BOGUS.  From config.log:\n\nconfigure:5368: checking whether snprintf() and/or vsnprintf() return\nbogus value\nconfigure:5406: cc -o conftest -g -O0 --std=c89 -Wall -Werror\nconftest.c  >&5\nconftest.c: In function 'test_vsnprintf':\nconftest.c:62:5: error: implicit declaration of function 'vsnprintf'\n[-Werror=implicit-function-declaration]\nconftest.c: In function 'main':\nconftest.c:72:5: error: implicit declaration of function 'snprintf'\n[-Werror=implicit-function-declaration]\ncc1: all warnings being treated as errors\n\nconfigure:5406: $? = 1\nconfigure: program exited with status 1\n\nAccording to the manpage, snprintf() and vsnprintf() are truly not\nsupported for \"-std=c89\" and indeed they are not declared by any of the\nfiles included by the test program that configure is using.  (Oddly,\nalthough they are nominally not supported, vsnprintf() is used anyway in\nthe definition of git_vsnprintf().)\n\nIf I leave off any of the compilation options \"-std=c89 -Wall -Werror\"\nor if I toggle the \"#ifdef SNPRINTF_RETURNS_BOGUS\" line in\ngit-compat-util.h off, the problem goes away.\n\n\n2. The configure problem causes git_vsnprintf() to be wrapped around the\nC library version.  This leads to many failures in the test suite.  I\nsuppose that git_vsnprintf() is broken in some way.\n\n\nI'm kindof busy with my ref-api patch series so I won't have time to\nlook further into this problem in the near future.  But perhaps somebody\nwith experience with the configuration system and/or git_vsnprintf() is\ninterested.\n\nMichael\n\n-- \nMichael Haggerty\nmhagger@alum.mit.edu\nhttp://softwareswirl.blogspot.com/\n"},{"id":"180894","messageId":"20111212064305.GA16511@sigill.intra.peff.net","threadId":"29133","inReplyTo":"4EE4F97B.9000202@alum.mit.edu","subject":"Re: Breakage (?) in configure and git_vsnprintf()","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2011-12-12T06:43:05Z","receivedAt":"2011-12-12T06:43:05Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Sun, Dec 11, 2011 at 07:42:03PM +0100, Michael Haggerty wrote:\n\n> 2. The configure problem causes git_vsnprintf() to be wrapped around the\n> C library version.  This leads to many failures in the test suite.  I\n> suppose that git_vsnprintf() is broken in some way.\n\nI enabled SNPRINTF_RETURNS_BOGUS manually and was able to see the test\nsuite failures. Very oddly, I could get them while running the full\nsuite in parallel, but when I ran individual scripts, the problem went\naway. Which makes no sense to me at all.\n\nHowever, I peeked at the git_vsnprintf function, and one obvious error\nis that it calls vsnprintf multiple times on the same va_list.\n\nFixing that (patch below) makes the test failures go away. I think it's\nan Obviously Correct thing to do, anyway, but I'm slightly unnerved by\nnot understanding why it sometimes caused failures and sometimes not.\nClearly the existing code invokes nasal daemons and anything is allowed\nto happen, but it would be nice to understand what triggers the\ndifference.\n\nI'll leave the issue of \"-std=c89\" triggering SNPRINTF_RETURNS_BOGUS to\npeople who know and care about autoconf. My gut is to say \"don't do\nthat\". Git is not actually pure c89. We typically target systems that\nare _at least_ c89, but it's more important to match and run well on\nreal-world systems than what was defined in the standard. So we don't\ndepend on c99, but we do depend on quirks and features that were\nprominent in mid-90's Unix variants.\n\n-- >8 --\nSubject: [PATCH] compat/snprintf: don't look at va_list twice\n\nIf you define SNPRINTF_RETURNS_BOGUS, we use a special\ngit_vsnprintf wrapper assumes that vsnprintf returns \"-1\"\ninstead of the number of characters that you would need to\nstore the result.\n\nTo do this, it invokes vsnprintf multiple times, growing a\nheap buffer until we have enough space to hold the result.\nHowever, this means we evaluate the va_list parameter\nmultiple times, which is generally a bad thing (it may be\nmodified by calls to vsnprintf, yielding undefined\nbehavior).\n\nInstead, we must va_copy it and hand the copy to vsnprintf,\nso we always have a pristine va_list.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n compat/snprintf.c |    7 +++++--\n 1 files changed, 5 insertions(+), 2 deletions(-)\n\ndiff --git a/compat/snprintf.c b/compat/snprintf.c\nindex e1e0e75..38fc08d 100644\n--- a/compat/snprintf.c\n+++ b/compat/snprintf.c\n@@ -19,11 +19,13 @@\n #undef vsnprintf\n int git_vsnprintf(char *str, size_t maxsize, const char *format, va_list ap)\n {\n+\tva_list cp;\n \tchar *s;\n \tint ret = -1;\n \n \tif (maxsize > 0) {\n-\t\tret = vsnprintf(str, maxsize-SNPRINTF_SIZE_CORR, format, ap);\n+\t\tva_copy(cp, ap);\n+\t\tret = vsnprintf(str, maxsize-SNPRINTF_SIZE_CORR, format, cp);\n \t\tif (ret == maxsize-1)\n \t\t\tret = -1;\n \t\t/* Windows does not NUL-terminate if result fills buffer */\n@@ -42,7 +44,8 @@ int git_vsnprintf(char *str, size_t maxsize, const char *format, va_list ap)\n \t\tif (! str)\n \t\t\tbreak;\n \t\ts = str;\n-\t\tret = vsnprintf(str, maxsize-SNPRINTF_SIZE_CORR, format, ap);\n+\t\tva_copy(cp, ap);\n+\t\tret = vsnprintf(str, maxsize-SNPRINTF_SIZE_CORR, format, cp);\n \t\tif (ret == maxsize-1)\n \t\t\tret = -1;\n \t}\n-- \n1.7.8.13.g74677\n"},{"id":"180897","messageId":"4EE5B123.2030708@viscovery.net","threadId":"29133","inReplyTo":"20111212064305.GA16511@sigill.intra.peff.net","subject":"Re: Breakage (?) in configure and git_vsnprintf()","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2011-12-12T07:45:39Z","receivedAt":"2011-12-12T07:45:39Z","isPatch":false,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 12/12/2011 7:43, schrieb Jeff King:\n> I'll leave the issue of \"-std=c89\" triggering SNPRINTF_RETURNS_BOGUS to\n> people who know and care about autoconf. My gut is to say \"don't do\n> that\".\n\nRight. But Michael's problem was actually that SNPRINTF_RETURNS_BOGUS was\nset incorrectly; his system has a working snprintf (or so I assume). The\nreason for the failure is that ./configure's test program produced a\nwarning, and that warning was turned into an error due to -Werror. Without\n-Werror, the test program would have compiled successfully, and the\nworking snprintf would have been detected.\n\n-- Hannes\n"},{"id":"180903","messageId":"20111212081019.GA17725@sigill.intra.peff.net","threadId":"29133","inReplyTo":"4EE5B123.2030708@viscovery.net","subject":"Re: Breakage (?) in configure and git_vsnprintf()","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2011-12-12T08:10:19Z","receivedAt":"2011-12-12T08:10:19Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Dec 12, 2011 at 08:45:39AM +0100, Johannes Sixt wrote:\n\n> Am 12/12/2011 7:43, schrieb Jeff King:\n> > I'll leave the issue of \"-std=c89\" triggering SNPRINTF_RETURNS_BOGUS to\n> > people who know and care about autoconf. My gut is to say \"don't do\n> > that\".\n> \n> Right. But Michael's problem was actually that SNPRINTF_RETURNS_BOGUS was\n> set incorrectly; his system has a working snprintf (or so I assume). The\n> reason for the failure is that ./configure's test program produced a\n> warning, and that warning was turned into an error due to -Werror. Without\n> -Werror, the test program would have compiled successfully, and the\n> working snprintf would have been detected.\n\nRight, I understand that. But he has given a set of options that\nshouldn't compile git at all (he tells the compiler not to use snprintf\nvia -std=c89, but we require that it exists, because even our\ngit_vsnprintf wrapper uses the underlying system vsnprintf).\n\nSo yes, the configure script is broken to detect the situation as\nSNPRINTF_RETURNS_BOGUS and not \"this platform doesn't have snprintf at\nall\"[1]. But I'm saying that the \"we do not have snprintf at all\" case\nis not all that interesting: git needs it. So I'm not sure compiling\nwith -std=c89 really makes sense[2].\n\nIf somebody wants to make the configure script more accurate, I\ncertainly don't want to stop them. I'm just not sure it is worth\nanybody's time in this case.\n\n-Peff\n\n[1] Yes, obviously we do actually have it, but it is somewhat a fluke\n    that it works. We tell the compiler during the compile phase that we\n    don't have it, but then during the link phase it is magically\n    available in libc.\n\n[2] I can convince git to compile on recent Linux with gcc using\n    CFLAGS='-std=c89 -Dinline='.  Turning on \"-Wall -Werror\" doesn't\n    work because all of the inline functions appear to be unused\n    statics.  But if I understand Michael's problem correctly, wouldn't\n    we be missing the prototype for snprintf, which could cause subtle\n    errors?\n"},{"id":"180906","messageId":"7vr50a6vwf.fsf@alter.siamese.dyndns.org","threadId":"29133","inReplyTo":"20111212064305.GA16511@sigill.intra.peff.net","subject":"Re: Breakage (?) in configure and git_vsnprintf()","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-12-12T08:23:28Z","receivedAt":"2011-12-12T08:23:28Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Good analysis; thanks.\n\nBack when c4582f9 (Add compat/snprintf.c for systems that return bogus,\n2008-03-05) was done we didn't have va_copy emulation available in\ngit-compat-util.h but now we do, so I agree that this is an Obviously\nCorrect thing to do.\n"},{"id":"180919","messageId":"m262hmgmrw.fsf@igel.home","threadId":"29133","inReplyTo":"20111212064305.GA16511@sigill.intra.peff.net","subject":"Re: Breakage (?) in configure and git_vsnprintf()","fromName":"Andreas Schwab","fromEmail":"schwab@linux-m68k.org","sentAt":"2011-12-12T09:30:27Z","receivedAt":"2011-12-12T09:30:27Z","isPatch":false,"sender":{"key":"schwab@linux-m68k.org","avatar":"https://avatars.githubusercontent.com/u/2175493?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n>  \tif (maxsize > 0) {\n> -\t\tret = vsnprintf(str, maxsize-SNPRINTF_SIZE_CORR, format, ap);\n> +\t\tva_copy(cp, ap);\n> +\t\tret = vsnprintf(str, maxsize-SNPRINTF_SIZE_CORR, format, cp);\n\nYou also need to call va_end on the copy.\n\nAndreas.\n\n-- \nAndreas Schwab, schwab@linux-m68k.org\nGPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5\n\"And now for something completely different.\"\n"},{"id":"180922","messageId":"4EE5D694.7040407@alum.mit.edu","threadId":"29133","inReplyTo":"20111212064305.GA16511@sigill.intra.peff.net","subject":"Re: Breakage (?) in configure and git_vsnprintf()","fromName":"Michael Haggerty","fromEmail":"mhagger@alum.mit.edu","sentAt":"2011-12-12T10:25:24Z","receivedAt":"2011-12-12T10:25:24Z","isPatch":false,"sender":{"key":"mhagger@alum.mit.edu","avatar":"https://avatars.githubusercontent.com/u/119718?v=4"},"body":"On 12/12/2011 07:43 AM, Jeff King wrote:\n> On Sun, Dec 11, 2011 at 07:42:03PM +0100, Michael Haggerty wrote:\n>> 2. The configure problem causes git_vsnprintf() to be wrapped around the\n>> C library version.  This leads to many failures in the test suite.  I\n>> suppose that git_vsnprintf() is broken in some way.\n> \n> I enabled SNPRINTF_RETURNS_BOGUS manually and was able to see the test\n> suite failures. Very oddly, I could get them while running the full\n> suite in parallel, but when I ran individual scripts, the problem went\n> away. Which makes no sense to me at all.\n> \n> However, I peeked at the git_vsnprintf function, and one obvious error\n> is that it calls vsnprintf multiple times on the same va_list.\n\nThanks for the quick response!  Yes, I think you've hit the nail on the\nhead.  (Though I think Andreas is correct that va_end() needs to be\ncalled on the copies.)  Either with or without va_end(), your patch\nfixes the test suite failures for me.\n\n> I'll leave the issue of \"-std=c89\" triggering SNPRINTF_RETURNS_BOGUS to\n> people who know and care about autoconf. My gut is to say \"don't do\n> that\". Git is not actually pure c89. [...]\n\nOK, I can live with that.  Poor Junio will probably be stuck correcting\nmy non-c89isms again, though :-(\n\nMichael\n\n-- \nMichael Haggerty\nmhagger@alum.mit.edu\nhttp://softwareswirl.blogspot.com/\n"},{"id":"180930","messageId":"20111212142550.GA23875@sigill.intra.peff.net","threadId":"29133","inReplyTo":"m262hmgmrw.fsf@igel.home","subject":"Re: Breakage (?) in configure and git_vsnprintf()","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2011-12-12T14:25:51Z","receivedAt":"2011-12-12T14:25:51Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Dec 12, 2011 at 10:30:27AM +0100, Andreas Schwab wrote:\n\n> Jeff King <peff@peff.net> writes:\n> \n> >  \tif (maxsize > 0) {\n> > -\t\tret = vsnprintf(str, maxsize-SNPRINTF_SIZE_CORR, format, ap);\n> > +\t\tva_copy(cp, ap);\n> > +\t\tret = vsnprintf(str, maxsize-SNPRINTF_SIZE_CORR, format, cp);\n> \n> You also need to call va_end on the copy.\n\nSilly me. Thanks for catching.\n\nJunio, here's a corrected version.\n\n-- >8 --\nSubject: [PATCH] compat/snprintf: don't look at va_list twice\n\nIf you define SNPRINTF_RETURNS_BOGUS, we use a special\ngit_vsnprintf wrapper assumes that vsnprintf returns \"-1\"\ninstead of the number of characters that you would need to\nstore the result.\n\nTo do this, it invokes vsnprintf multiple times, growing a\nheap buffer until we have enough space to hold the result.\nHowever, this means we evaluate the va_list parameter\nmultiple times, which is generally a bad thing (it may be\nmodified by calls to vsnprintf, yielding undefined\nbehavior).\n\nInstead, we must va_copy it and hand the copy to vsnprintf,\nso we always have a pristine va_list.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n compat/snprintf.c |    9 +++++++--\n 1 files changed, 7 insertions(+), 2 deletions(-)\n\ndiff --git a/compat/snprintf.c b/compat/snprintf.c\nindex e1e0e75..42ea1ac 100644\n--- a/compat/snprintf.c\n+++ b/compat/snprintf.c\n@@ -19,11 +19,14 @@\n #undef vsnprintf\n int git_vsnprintf(char *str, size_t maxsize, const char *format, va_list ap)\n {\n+\tva_list cp;\n \tchar *s;\n \tint ret = -1;\n \n \tif (maxsize > 0) {\n-\t\tret = vsnprintf(str, maxsize-SNPRINTF_SIZE_CORR, format, ap);\n+\t\tva_copy(cp, ap);\n+\t\tret = vsnprintf(str, maxsize-SNPRINTF_SIZE_CORR, format, cp);\n+\t\tva_end(cp);\n \t\tif (ret == maxsize-1)\n \t\t\tret = -1;\n \t\t/* Windows does not NUL-terminate if result fills buffer */\n@@ -42,7 +45,9 @@ int git_vsnprintf(char *str, size_t maxsize, const char *format, va_list ap)\n \t\tif (! str)\n \t\t\tbreak;\n \t\ts = str;\n-\t\tret = vsnprintf(str, maxsize-SNPRINTF_SIZE_CORR, format, ap);\n+\t\tva_copy(cp, ap);\n+\t\tret = vsnprintf(str, maxsize-SNPRINTF_SIZE_CORR, format, cp);\n+\t\tva_end(cp);\n \t\tif (ret == maxsize-1)\n \t\t\tret = -1;\n \t}\n-- \n1.7.8.13.g74677\n"},{"id":"180980","messageId":"20111212215645.GA3024@elie.hsd1.il.comcast.net","threadId":"29133","inReplyTo":"20111212064305.GA16511@sigill.intra.peff.net","subject":"Re: Breakage (?) in configure and git_vsnprintf()","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2011-12-12T21:56:45Z","receivedAt":"2011-12-12T21:56:45Z","isPatch":false,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Jeff King wrote:\n\n> I'll leave the issue of \"-std=c89\" triggering SNPRINTF_RETURNS_BOGUS to\n> people who know and care about autoconf. My gut is to say \"don't do\n> that\". Git is not actually pure c89. We typically target systems that\n> are _at least_ c89, but it's more important to match and run well on\n> real-world systems than what was defined in the standard. So we don't\n> depend on c99, but we do depend on quirks and features that were\n> prominent in mid-90's Unix variants.\n\nUsing vsnprintf isn't even wrong from the standards-pedant point of\nview --- vsnprintf has been in POSIX for a long time.  The problem is\nthat the configure script is not setting appropriate feature test\nmacros such as _XOPEN_SOURCE (like git-compat-util.h does) during its\nfeature tests.\n\nMaybe it would be possible to hook the appropriate magic into\nAC_LANG_PROGRAM.\n"},{"id":"180991","messageId":"KDO2EaM6TnHQ6KGYqmkErS6Nq_qZc7b4J1aClSFkQwb60rk3bMZqU3iiY0O2LRaJukqzzBU6djUrNHGC505_oYXFc1BUezUo8EtdKcjEOSE@cipher.nrlssc.navy.mil","threadId":"29133","inReplyTo":"20111212142550.GA23875@sigill.intra.peff.net","subject":"Re: Breakage (?) in configure and git_vsnprintf()","fromName":"Brandon Casey","fromEmail":"casey@nrlssc.navy.mil","sentAt":"2011-12-12T23:25:11Z","receivedAt":"2011-12-12T23:25:11Z","isPatch":false,"sender":{"key":"drafnel@gmail.com","avatar":"https://avatars.githubusercontent.com/u/921167?v=4"},"body":"\nFYI: all tests passed on IRIX (not that I suspected otherwise).\n\n-Brandon\n\nOn 12/12/2011 08:25 AM, Jeff King wrote:\n> On Mon, Dec 12, 2011 at 10:30:27AM +0100, Andreas Schwab wrote:\n> \n>> Jeff King <peff@peff.net> writes:\n>>\n>>>  \tif (maxsize > 0) {\n>>> -\t\tret = vsnprintf(str, maxsize-SNPRINTF_SIZE_CORR, format, ap);\n>>> +\t\tva_copy(cp, ap);\n>>> +\t\tret = vsnprintf(str, maxsize-SNPRINTF_SIZE_CORR, format, cp);\n>>\n>> You also need to call va_end on the copy.\n> \n> Silly me. Thanks for catching.\n> \n> Junio, here's a corrected version.\n> \n> -- >8 --\n> Subject: [PATCH] compat/snprintf: don't look at va_list twice\n> \n> If you define SNPRINTF_RETURNS_BOGUS, we use a special\n> git_vsnprintf wrapper assumes that vsnprintf returns \"-1\"\n> instead of the number of characters that you would need to\n> store the result.\n> \n> To do this, it invokes vsnprintf multiple times, growing a\n> heap buffer until we have enough space to hold the result.\n> However, this means we evaluate the va_list parameter\n> multiple times, which is generally a bad thing (it may be\n> modified by calls to vsnprintf, yielding undefined\n> behavior).\n> \n> Instead, we must va_copy it and hand the copy to vsnprintf,\n> so we always have a pristine va_list.\n> \n> Signed-off-by: Jeff King <peff@peff.net>\n> ---\n>  compat/snprintf.c |    9 +++++++--\n>  1 files changed, 7 insertions(+), 2 deletions(-)\n> \n> diff --git a/compat/snprintf.c b/compat/snprintf.c\n> index e1e0e75..42ea1ac 100644\n> --- a/compat/snprintf.c\n> +++ b/compat/snprintf.c\n> @@ -19,11 +19,14 @@\n>  #undef vsnprintf\n>  int git_vsnprintf(char *str, size_t maxsize, const char *format, va_list ap)\n>  {\n> +\tva_list cp;\n>  \tchar *s;\n>  \tint ret = -1;\n>  \n>  \tif (maxsize > 0) {\n> -\t\tret = vsnprintf(str, maxsize-SNPRINTF_SIZE_CORR, format, ap);\n> +\t\tva_copy(cp, ap);\n> +\t\tret = vsnprintf(str, maxsize-SNPRINTF_SIZE_CORR, format, cp);\n> +\t\tva_end(cp);\n>  \t\tif (ret == maxsize-1)\n>  \t\t\tret = -1;\n>  \t\t/* Windows does not NUL-terminate if result fills buffer */\n> @@ -42,7 +45,9 @@ int git_vsnprintf(char *str, size_t maxsize, const char *format, va_list ap)\n>  \t\tif (! str)\n>  \t\t\tbreak;\n>  \t\ts = str;\n> -\t\tret = vsnprintf(str, maxsize-SNPRINTF_SIZE_CORR, format, ap);\n> +\t\tva_copy(cp, ap);\n> +\t\tret = vsnprintf(str, maxsize-SNPRINTF_SIZE_CORR, format, cp);\n> +\t\tva_end(cp);\n>  \t\tif (ret == maxsize-1)\n>  \t\t\tret = -1;\n>  \t}\n"}]}