Hi, vasnprintf and vasnwprintf put the zeros of the 0 flag before a '+' or ' ' sign whenever they do the padding themselves. In testdirs created with
gnulib-tool --create-testdir --dir=testdir \ vasnprintf-posix vasnwprintf-posix at commit eedf47b2d43288f528db62ccd1cd2ce55eda92d4, unchanged: macOS (arm64, Apple clang 21) and native Windows (mingw-w64 with the UCRT, GCC 14.2), narrow and wide: vasnprintf (NULL, &len, "%'+08d", 42) => "00000+42" vasnprintf (NULL, &len, "%' 08d", 42) => "00000 42" Alpine Linux (musl, GCC 15.2), wide only: vasnwprintf (NULL, &len, L"%+08d", 42) => L"00000+42" vasnwprintf (NULL, &len, L"% 08d", 42) => L"00000 42" vasnwprintf (NULL, &len, L"%+010.2f", 1.5) => L"00000+1.50" vasnwprintf (NULL, &len, L"%+010f", 1.0/0) => L"000000+inf" I expected "+0000042", " 0000042", "+000001.50" and " +inf", which is what the system's functions give. Negative numbers are fine. On glibc (Ubuntu 26.04, GCC 15.2) nothing shows, as the padding is left to the system there, but the same results appear when vasnprintf.c is compiled with -DNEED_PRINTF_FLAG_LEFTADJUST=1. In lib/vasnprintf.c the insertion point for the zeros is computed as pad_ptr = (*rp == '-' ? rp + 1 : rp); which skips a minus sign only, so the test for "inf" and "nan" which follows does not see the letters either. With pad_ptr = (*rp == '-' || *rp == '+' || *rp == ' ' ? rp + 1 : rp); all of the above come out as expected on the four platforms, also with NEED_PRINTF_FLAG_LEFTADJUST forced, and "make check" in the testdir gives the same results as before, without failures. The tests pass with and without the change, so none of them covers this case. Thanks, Kevin
