Extend printf family testing (RHEL-119390)

Resolves: RHEL-119390
This commit is contained in:
Frédéric Bérat 2025-11-04 11:49:25 +01:00
parent ec3eae8e16
commit a3fbf57163
12 changed files with 7455 additions and 0 deletions

2531
glibc-RHEL-119390-1.patch Normal file

File diff suppressed because it is too large Load Diff

428
glibc-RHEL-119390-10.patch Normal file
View File

@ -0,0 +1,428 @@
commit 6018ba05c01b1e17d77742a123e8c443f8fc713c
Author: Maciej W. Rozycki <macro@redhat.com>
Date: Thu Nov 7 06:14:24 2024 +0000
stdio-common: Add tests for formatted vfprintf output specifiers
Wire vfprintf into test infrastructure for formatted printf output
specifiers.
Reviewed-by: DJ Delorie <dj@redhat.com>
diff --git a/stdio-common/Makefile b/stdio-common/Makefile
index 01018c53b0f4a13f..65f3ddc13141e4d6 100644
--- a/stdio-common/Makefile
+++ b/stdio-common/Makefile
@@ -24,7 +24,7 @@ subdir := stdio-common
include ../Makeconfig
# List of markers for printf family function tests.
-xprintf-funcs := p as d f s sn v vas vd
+xprintf-funcs := p as d f s sn v vas vd vf
# List of data types and formats for individual per-conversion printf tests.
fmt-convs := double ldouble
diff --git a/stdio-common/tst-printf-format-vf-c.c b/stdio-common/tst-printf-format-vf-c.c
new file mode 100644
index 0000000000000000..b31b551327bb4ebe
--- /dev/null
+++ b/stdio-common/tst-printf-format-vf-c.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'vfprintf' output for the 'c' conversion.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-vf.h"
+#include "tst-printf-format-skeleton-c.c"
diff --git a/stdio-common/tst-printf-format-vf-char.c b/stdio-common/tst-printf-format-vf-char.c
new file mode 100644
index 0000000000000000..daa2886adb9f1636
--- /dev/null
+++ b/stdio-common/tst-printf-format-vf-char.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'vfprintf' output for signed char conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-vf.h"
+#include "tst-printf-format-skeleton-char.c"
diff --git a/stdio-common/tst-printf-format-vf-double.c b/stdio-common/tst-printf-format-vf-double.c
new file mode 100644
index 0000000000000000..63ec8c0cae6c272e
--- /dev/null
+++ b/stdio-common/tst-printf-format-vf-double.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'vfprintf' output for double conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-vf.h"
+#include "tst-printf-format-skeleton-double.c"
diff --git a/stdio-common/tst-printf-format-vf-int.c b/stdio-common/tst-printf-format-vf-int.c
new file mode 100644
index 0000000000000000..e687099b1052d040
--- /dev/null
+++ b/stdio-common/tst-printf-format-vf-int.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'vfprintf' output for int conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-vf.h"
+#include "tst-printf-format-skeleton-int.c"
diff --git a/stdio-common/tst-printf-format-vf-ldouble.c b/stdio-common/tst-printf-format-vf-ldouble.c
new file mode 100644
index 0000000000000000..801e359dab8ca159
--- /dev/null
+++ b/stdio-common/tst-printf-format-vf-ldouble.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'vfprintf' output for long double conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-vf.h"
+#include "tst-printf-format-skeleton-ldouble.c"
diff --git a/stdio-common/tst-printf-format-vf-llong.c b/stdio-common/tst-printf-format-vf-llong.c
new file mode 100644
index 0000000000000000..a1b9ae340c4aa5ff
--- /dev/null
+++ b/stdio-common/tst-printf-format-vf-llong.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'vfprintf' output for long long int conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-vf.h"
+#include "tst-printf-format-skeleton-llong.c"
diff --git a/stdio-common/tst-printf-format-vf-long.c b/stdio-common/tst-printf-format-vf-long.c
new file mode 100644
index 0000000000000000..7afc127b844d1e10
--- /dev/null
+++ b/stdio-common/tst-printf-format-vf-long.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'vfprintf' output for long int conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-vf.h"
+#include "tst-printf-format-skeleton-long.c"
diff --git a/stdio-common/tst-printf-format-vf-s.c b/stdio-common/tst-printf-format-vf-s.c
new file mode 100644
index 0000000000000000..6faa6d0dfe4b4132
--- /dev/null
+++ b/stdio-common/tst-printf-format-vf-s.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'vfprintf' output for the 's' conversion.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-vf.h"
+#include "tst-printf-format-skeleton-s.c"
diff --git a/stdio-common/tst-printf-format-vf-short.c b/stdio-common/tst-printf-format-vf-short.c
new file mode 100644
index 0000000000000000..c3d17ca501974f83
--- /dev/null
+++ b/stdio-common/tst-printf-format-vf-short.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'vfprintf' output for short int conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-vf.h"
+#include "tst-printf-format-skeleton-short.c"
diff --git a/stdio-common/tst-printf-format-vf-uchar.c b/stdio-common/tst-printf-format-vf-uchar.c
new file mode 100644
index 0000000000000000..643438c693abf51f
--- /dev/null
+++ b/stdio-common/tst-printf-format-vf-uchar.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'vfprintf' output for unsigned char conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-vf.h"
+#include "tst-printf-format-skeleton-uchar.c"
diff --git a/stdio-common/tst-printf-format-vf-uint.c b/stdio-common/tst-printf-format-vf-uint.c
new file mode 100644
index 0000000000000000..844192cc9ccf5db8
--- /dev/null
+++ b/stdio-common/tst-printf-format-vf-uint.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'vfprintf' output for unsigned int conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-vf.h"
+#include "tst-printf-format-skeleton-uint.c"
diff --git a/stdio-common/tst-printf-format-vf-ullong.c b/stdio-common/tst-printf-format-vf-ullong.c
new file mode 100644
index 0000000000000000..ab58abd7f8c4e267
--- /dev/null
+++ b/stdio-common/tst-printf-format-vf-ullong.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'vfprintf' output for unsigned long long int conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-vf.h"
+#include "tst-printf-format-skeleton-ullong.c"
diff --git a/stdio-common/tst-printf-format-vf-ulong.c b/stdio-common/tst-printf-format-vf-ulong.c
new file mode 100644
index 0000000000000000..e76251f9d0e3337f
--- /dev/null
+++ b/stdio-common/tst-printf-format-vf-ulong.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'vfprintf' output for unsigned long int conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-vf.h"
+#include "tst-printf-format-skeleton-ulong.c"
diff --git a/stdio-common/tst-printf-format-vf-ushort.c b/stdio-common/tst-printf-format-vf-ushort.c
new file mode 100644
index 0000000000000000..bf78a919a6599054
--- /dev/null
+++ b/stdio-common/tst-printf-format-vf-ushort.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'vfprintf' output for unsigned short int conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-vf.h"
+#include "tst-printf-format-skeleton-ushort.c"
diff --git a/stdio-common/tst-printf-format-vf.h b/stdio-common/tst-printf-format-vf.h
new file mode 100644
index 0000000000000000..f824364f4c041ab8
--- /dev/null
+++ b/stdio-common/tst-printf-format-vf.h
@@ -0,0 +1,34 @@
+/* Test feature wrapper for formatted 'vfprintf' output.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include <stdarg.h>
+#include <stdio.h>
+
+static int
+printf_under_test (const char *restrict fmt, ...)
+{
+ va_list ap;
+ int result;
+
+ va_start (ap, fmt);
+ result = vfprintf (stdout, fmt, ap);
+ va_end (ap);
+ if (result < 0)
+ perror ("vfprintf");
+ return result;
+}

458
glibc-RHEL-119390-11.patch Normal file
View File

@ -0,0 +1,458 @@
commit ac72dd90905e1693c108c9f36f0c7e79d6ad5501
Author: Maciej W. Rozycki <macro@redhat.com>
Date: Thu Nov 7 06:14:24 2024 +0000
stdio-common: Add tests for formatted vsprintf output specifiers
Wire vsprintf into test infrastructure for formatted printf output
specifiers.
Reviewed-by: DJ Delorie <dj@redhat.com>
diff --git a/stdio-common/Makefile b/stdio-common/Makefile
index 65f3ddc13141e4d6..529fc90945524a7b 100644
--- a/stdio-common/Makefile
+++ b/stdio-common/Makefile
@@ -24,7 +24,7 @@ subdir := stdio-common
include ../Makeconfig
# List of markers for printf family function tests.
-xprintf-funcs := p as d f s sn v vas vd vf
+xprintf-funcs := p as d f s sn v vas vd vf vs
# List of data types and formats for individual per-conversion printf tests.
fmt-convs := double ldouble
diff --git a/stdio-common/tst-printf-format-vs-c.c b/stdio-common/tst-printf-format-vs-c.c
new file mode 100644
index 0000000000000000..72bcb5f04957c4ef
--- /dev/null
+++ b/stdio-common/tst-printf-format-vs-c.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'vsprintf' output for the 'c' conversion.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-vs.h"
+#include "tst-printf-format-skeleton-c.c"
diff --git a/stdio-common/tst-printf-format-vs-char.c b/stdio-common/tst-printf-format-vs-char.c
new file mode 100644
index 0000000000000000..30135cf1be1616ac
--- /dev/null
+++ b/stdio-common/tst-printf-format-vs-char.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'vsprintf' output for signed char conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-vs.h"
+#include "tst-printf-format-skeleton-char.c"
diff --git a/stdio-common/tst-printf-format-vs-double.c b/stdio-common/tst-printf-format-vs-double.c
new file mode 100644
index 0000000000000000..56290d383ebc33c8
--- /dev/null
+++ b/stdio-common/tst-printf-format-vs-double.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'vsprintf' output for double conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-vs.h"
+#include "tst-printf-format-skeleton-double.c"
diff --git a/stdio-common/tst-printf-format-vs-int.c b/stdio-common/tst-printf-format-vs-int.c
new file mode 100644
index 0000000000000000..f954e1f4f8277c64
--- /dev/null
+++ b/stdio-common/tst-printf-format-vs-int.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'vsprintf' output for int conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-vs.h"
+#include "tst-printf-format-skeleton-int.c"
diff --git a/stdio-common/tst-printf-format-vs-ldouble.c b/stdio-common/tst-printf-format-vs-ldouble.c
new file mode 100644
index 0000000000000000..3088e42813abd537
--- /dev/null
+++ b/stdio-common/tst-printf-format-vs-ldouble.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'vsprintf' output for long double conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-vs.h"
+#include "tst-printf-format-skeleton-ldouble.c"
diff --git a/stdio-common/tst-printf-format-vs-llong.c b/stdio-common/tst-printf-format-vs-llong.c
new file mode 100644
index 0000000000000000..348ec2c3d73b8f88
--- /dev/null
+++ b/stdio-common/tst-printf-format-vs-llong.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'vsprintf' output for long long int conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-vs.h"
+#include "tst-printf-format-skeleton-llong.c"
diff --git a/stdio-common/tst-printf-format-vs-long.c b/stdio-common/tst-printf-format-vs-long.c
new file mode 100644
index 0000000000000000..874e3ba479eda8fb
--- /dev/null
+++ b/stdio-common/tst-printf-format-vs-long.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'vsprintf' output for long int conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-vs.h"
+#include "tst-printf-format-skeleton-long.c"
diff --git a/stdio-common/tst-printf-format-vs-s.c b/stdio-common/tst-printf-format-vs-s.c
new file mode 100644
index 0000000000000000..051f1b79bf2cb028
--- /dev/null
+++ b/stdio-common/tst-printf-format-vs-s.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'vsprintf' output for the 's' conversion.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-vs.h"
+#include "tst-printf-format-skeleton-s.c"
diff --git a/stdio-common/tst-printf-format-vs-short.c b/stdio-common/tst-printf-format-vs-short.c
new file mode 100644
index 0000000000000000..36595a82b445e8a3
--- /dev/null
+++ b/stdio-common/tst-printf-format-vs-short.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'vsprintf' output for short int conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-vs.h"
+#include "tst-printf-format-skeleton-short.c"
diff --git a/stdio-common/tst-printf-format-vs-uchar.c b/stdio-common/tst-printf-format-vs-uchar.c
new file mode 100644
index 0000000000000000..8e35614110bd7d57
--- /dev/null
+++ b/stdio-common/tst-printf-format-vs-uchar.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'vsprintf' output for unsigned char conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-vs.h"
+#include "tst-printf-format-skeleton-uchar.c"
diff --git a/stdio-common/tst-printf-format-vs-uint.c b/stdio-common/tst-printf-format-vs-uint.c
new file mode 100644
index 0000000000000000..4a13d6c409ad4245
--- /dev/null
+++ b/stdio-common/tst-printf-format-vs-uint.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'vsprintf' output for unsigned int conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-vs.h"
+#include "tst-printf-format-skeleton-uint.c"
diff --git a/stdio-common/tst-printf-format-vs-ullong.c b/stdio-common/tst-printf-format-vs-ullong.c
new file mode 100644
index 0000000000000000..313dfaf02bda3059
--- /dev/null
+++ b/stdio-common/tst-printf-format-vs-ullong.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'vsprintf' output for unsigned long long int conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-vs.h"
+#include "tst-printf-format-skeleton-ullong.c"
diff --git a/stdio-common/tst-printf-format-vs-ulong.c b/stdio-common/tst-printf-format-vs-ulong.c
new file mode 100644
index 0000000000000000..5ab7e2e7fe9b237a
--- /dev/null
+++ b/stdio-common/tst-printf-format-vs-ulong.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'vsprintf' output for unsigned long int conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-vs.h"
+#include "tst-printf-format-skeleton-ulong.c"
diff --git a/stdio-common/tst-printf-format-vs-ushort.c b/stdio-common/tst-printf-format-vs-ushort.c
new file mode 100644
index 0000000000000000..a4af138a2f8485ab
--- /dev/null
+++ b/stdio-common/tst-printf-format-vs-ushort.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'vsprintf' output for unsigned short int conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-vs.h"
+#include "tst-printf-format-skeleton-ushort.c"
diff --git a/stdio-common/tst-printf-format-vs.h b/stdio-common/tst-printf-format-vs.h
new file mode 100644
index 0000000000000000..e00e1b085bc58150
--- /dev/null
+++ b/stdio-common/tst-printf-format-vs.h
@@ -0,0 +1,64 @@
+/* Test feature wrapper for formatted 'vsprintf' output.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <support/next_to_fault.h>
+
+#define SPRINTF_BUFFER_SIZE 65536
+
+static struct support_next_to_fault ntf;
+
+#define PREPARE printf_under_test_init
+static void
+printf_under_test_init (int argc, char **argv)
+{
+ ntf = support_next_to_fault_allocate (SPRINTF_BUFFER_SIZE);
+}
+
+static void __attribute__ ((destructor))
+printf_under_test_fini (void)
+{
+ support_next_to_fault_free (&ntf);
+}
+
+static int
+printf_under_test (const char *restrict fmt, ...)
+{
+ char *str = ntf.buffer;
+ va_list ap;
+ int result;
+
+ va_start (ap, fmt);
+ result = vsprintf (str, fmt, ap);
+ va_end (ap);
+ if (result < 0)
+ {
+ perror ("vsprintf");
+ goto out;
+ }
+ if (fwrite (str, sizeof (*str), result, stdout) != result)
+ {
+ perror ("fwrite");
+ result = -1;
+ }
+out:
+ return result;
+}

458
glibc-RHEL-119390-12.patch Normal file
View File

@ -0,0 +1,458 @@
commit 11a2169e4066e6b848f1e6e4c31ec4e2210cecd8
Author: Maciej W. Rozycki <macro@redhat.com>
Date: Thu Nov 7 06:14:24 2024 +0000
stdio-common: Add tests for formatted vsnprintf output specifiers
Wire vsnprintf into test infrastructure for formatted printf output
specifiers.
Reviewed-by: DJ Delorie <dj@redhat.com>
diff --git a/stdio-common/Makefile b/stdio-common/Makefile
index 529fc90945524a7b..cb86a6259ff5823b 100644
--- a/stdio-common/Makefile
+++ b/stdio-common/Makefile
@@ -24,7 +24,7 @@ subdir := stdio-common
include ../Makeconfig
# List of markers for printf family function tests.
-xprintf-funcs := p as d f s sn v vas vd vf vs
+xprintf-funcs := p as d f s sn v vas vd vf vs vsn
# List of data types and formats for individual per-conversion printf tests.
fmt-convs := double ldouble
diff --git a/stdio-common/tst-printf-format-vsn-c.c b/stdio-common/tst-printf-format-vsn-c.c
new file mode 100644
index 0000000000000000..47c8a0f5dfbddb49
--- /dev/null
+++ b/stdio-common/tst-printf-format-vsn-c.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'vsnprintf' output for the 'c' conversion.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-vsn.h"
+#include "tst-printf-format-skeleton-c.c"
diff --git a/stdio-common/tst-printf-format-vsn-char.c b/stdio-common/tst-printf-format-vsn-char.c
new file mode 100644
index 0000000000000000..48d4393a46d80e33
--- /dev/null
+++ b/stdio-common/tst-printf-format-vsn-char.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'vsnprintf' output for signed char conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-vsn.h"
+#include "tst-printf-format-skeleton-char.c"
diff --git a/stdio-common/tst-printf-format-vsn-double.c b/stdio-common/tst-printf-format-vsn-double.c
new file mode 100644
index 0000000000000000..06c1003fb5fde4b0
--- /dev/null
+++ b/stdio-common/tst-printf-format-vsn-double.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'vsnprintf' output for double conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-vsn.h"
+#include "tst-printf-format-skeleton-double.c"
diff --git a/stdio-common/tst-printf-format-vsn-int.c b/stdio-common/tst-printf-format-vsn-int.c
new file mode 100644
index 0000000000000000..2aae92616f2f6007
--- /dev/null
+++ b/stdio-common/tst-printf-format-vsn-int.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'vsnprintf' output for int conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-vsn.h"
+#include "tst-printf-format-skeleton-int.c"
diff --git a/stdio-common/tst-printf-format-vsn-ldouble.c b/stdio-common/tst-printf-format-vsn-ldouble.c
new file mode 100644
index 0000000000000000..0b5aafb124307526
--- /dev/null
+++ b/stdio-common/tst-printf-format-vsn-ldouble.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'vsnprintf' output for long double conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-vsn.h"
+#include "tst-printf-format-skeleton-ldouble.c"
diff --git a/stdio-common/tst-printf-format-vsn-llong.c b/stdio-common/tst-printf-format-vsn-llong.c
new file mode 100644
index 0000000000000000..8e79b8384f6858c6
--- /dev/null
+++ b/stdio-common/tst-printf-format-vsn-llong.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'vsnprintf' output for long long int conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-vsn.h"
+#include "tst-printf-format-skeleton-llong.c"
diff --git a/stdio-common/tst-printf-format-vsn-long.c b/stdio-common/tst-printf-format-vsn-long.c
new file mode 100644
index 0000000000000000..e94f7dec23ece2ca
--- /dev/null
+++ b/stdio-common/tst-printf-format-vsn-long.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'vsnprintf' output for long int conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-vsn.h"
+#include "tst-printf-format-skeleton-long.c"
diff --git a/stdio-common/tst-printf-format-vsn-s.c b/stdio-common/tst-printf-format-vsn-s.c
new file mode 100644
index 0000000000000000..efd8a4c23f5f42e6
--- /dev/null
+++ b/stdio-common/tst-printf-format-vsn-s.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'vsnprintf' output for the 's' conversion.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-vsn.h"
+#include "tst-printf-format-skeleton-s.c"
diff --git a/stdio-common/tst-printf-format-vsn-short.c b/stdio-common/tst-printf-format-vsn-short.c
new file mode 100644
index 0000000000000000..3d375b59e7a990f0
--- /dev/null
+++ b/stdio-common/tst-printf-format-vsn-short.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'vsnprintf' output for short int conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-vsn.h"
+#include "tst-printf-format-skeleton-short.c"
diff --git a/stdio-common/tst-printf-format-vsn-uchar.c b/stdio-common/tst-printf-format-vsn-uchar.c
new file mode 100644
index 0000000000000000..6d0f396481d3e2d6
--- /dev/null
+++ b/stdio-common/tst-printf-format-vsn-uchar.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'vsnprintf' output for unsigned char conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-vsn.h"
+#include "tst-printf-format-skeleton-uchar.c"
diff --git a/stdio-common/tst-printf-format-vsn-uint.c b/stdio-common/tst-printf-format-vsn-uint.c
new file mode 100644
index 0000000000000000..b637f7bdb11f7913
--- /dev/null
+++ b/stdio-common/tst-printf-format-vsn-uint.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'vsnprintf' output for unsigned int conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-vsn.h"
+#include "tst-printf-format-skeleton-uint.c"
diff --git a/stdio-common/tst-printf-format-vsn-ullong.c b/stdio-common/tst-printf-format-vsn-ullong.c
new file mode 100644
index 0000000000000000..d2442715f087acaf
--- /dev/null
+++ b/stdio-common/tst-printf-format-vsn-ullong.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'vsnprintf' output for unsigned long long int conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-vsn.h"
+#include "tst-printf-format-skeleton-ullong.c"
diff --git a/stdio-common/tst-printf-format-vsn-ulong.c b/stdio-common/tst-printf-format-vsn-ulong.c
new file mode 100644
index 0000000000000000..67417d174043a605
--- /dev/null
+++ b/stdio-common/tst-printf-format-vsn-ulong.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'vsnprintf' output for unsigned long int conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-vsn.h"
+#include "tst-printf-format-skeleton-ulong.c"
diff --git a/stdio-common/tst-printf-format-vsn-ushort.c b/stdio-common/tst-printf-format-vsn-ushort.c
new file mode 100644
index 0000000000000000..396ea43ae7067c86
--- /dev/null
+++ b/stdio-common/tst-printf-format-vsn-ushort.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'vsnprintf' output for unsigned short int conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-vsn.h"
+#include "tst-printf-format-skeleton-ushort.c"
diff --git a/stdio-common/tst-printf-format-vsn.h b/stdio-common/tst-printf-format-vsn.h
new file mode 100644
index 0000000000000000..4f25f1af767dc221
--- /dev/null
+++ b/stdio-common/tst-printf-format-vsn.h
@@ -0,0 +1,64 @@
+/* Test feature wrapper for formatted 'vsnprintf' output.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <support/next_to_fault.h>
+
+#define SPRINTF_BUFFER_SIZE 65536
+
+static struct support_next_to_fault ntf;
+
+#define PREPARE printf_under_test_init
+static void
+printf_under_test_init (int argc, char **argv)
+{
+ ntf = support_next_to_fault_allocate (SPRINTF_BUFFER_SIZE);
+}
+
+static void __attribute__ ((destructor))
+printf_under_test_fini (void)
+{
+ support_next_to_fault_free (&ntf);
+}
+
+static int
+printf_under_test (const char *restrict fmt, ...)
+{
+ char *str = ntf.buffer;
+ va_list ap;
+ int result;
+
+ va_start (ap, fmt);
+ result = vsnprintf (str, ntf.length, fmt, ap);
+ va_end (ap);
+ if (result < 0)
+ {
+ perror ("vsnprintf");
+ goto out;
+ }
+ if (fwrite (str, sizeof (*str), result, stdout) != result)
+ {
+ perror ("fwrite");
+ result = -1;
+ }
+out:
+ return result;
+}

459
glibc-RHEL-119390-2.patch Normal file
View File

@ -0,0 +1,459 @@
commit b350a60b6ecd77b7ec30c7969de1df8b73642e55
Author: Maciej W. Rozycki <macro@redhat.com>
Date: Thu Nov 7 06:14:24 2024 +0000
stdio-common: Add tests for formatted asprintf output specifiers
Wire asprintf into test infrastructure for formatted printf output
specifiers.
Owing to mtrace logging of lots of memory allocation calls these tests
take a considerable amount of time to complete, except for the character
conversion, taking from 00m20s for 'tst-printf-format-as-s --direct s',
through 01m10s and 03m53s for 'tst-printf-format-as-char --direct i' and
'tst-printf-format-as-double --direct f' respectively, to 19m24s for
'tst-printf-format-as-ldouble --direct f', all in standalone execution
from NFS on a RISC-V FU740@1.2GHz system and with output redirected over
100Mbps network via SSH. It is with the skeleton's stub implementation
of dladdr(3); execution times with regular dladdr(3) are up to over
twice longer.
Set timeouts for the tests accordingly then, with a global default for
all the asprintf tests, and then individual higher settings for double
and long double tests each.
Reviewed-by: DJ Delorie <dj@redhat.com>
diff --git a/stdio-common/Makefile b/stdio-common/Makefile
index 3e50c5a20ed7e679..54fb75e6232ddc2a 100644
--- a/stdio-common/Makefile
+++ b/stdio-common/Makefile
@@ -24,7 +24,7 @@ subdir := stdio-common
include ../Makeconfig
# List of markers for printf family function tests.
-xprintf-funcs := p
+xprintf-funcs := p as
# List of data types and formats for individual per-conversion printf tests.
fmt-convs := double ldouble
diff --git a/stdio-common/tst-printf-format-as-c.c b/stdio-common/tst-printf-format-as-c.c
new file mode 100644
index 0000000000000000..9eaf7aec73201b4d
--- /dev/null
+++ b/stdio-common/tst-printf-format-as-c.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'asprintf' output for the 'c' conversion.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-as.h"
+#include "tst-printf-format-skeleton-c.c"
diff --git a/stdio-common/tst-printf-format-as-char.c b/stdio-common/tst-printf-format-as-char.c
new file mode 100644
index 0000000000000000..d9266d5760fb8808
--- /dev/null
+++ b/stdio-common/tst-printf-format-as-char.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'asprintf' output for signed char conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-as.h"
+#include "tst-printf-format-skeleton-char.c"
diff --git a/stdio-common/tst-printf-format-as-double.c b/stdio-common/tst-printf-format-as-double.c
new file mode 100644
index 0000000000000000..370ce8c11bd94fe8
--- /dev/null
+++ b/stdio-common/tst-printf-format-as-double.c
@@ -0,0 +1,22 @@
+/* Test for formatted 'asprintf' output for double conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#define TIMEOUT (DEFAULT_TIMEOUT * 32)
+
+#include "tst-printf-format-as.h"
+#include "tst-printf-format-skeleton-double.c"
diff --git a/stdio-common/tst-printf-format-as-int.c b/stdio-common/tst-printf-format-as-int.c
new file mode 100644
index 0000000000000000..e6e10a9769f079a4
--- /dev/null
+++ b/stdio-common/tst-printf-format-as-int.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'asprintf' output for int conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-as.h"
+#include "tst-printf-format-skeleton-int.c"
diff --git a/stdio-common/tst-printf-format-as-ldouble.c b/stdio-common/tst-printf-format-as-ldouble.c
new file mode 100644
index 0000000000000000..e7f72208cec76078
--- /dev/null
+++ b/stdio-common/tst-printf-format-as-ldouble.c
@@ -0,0 +1,22 @@
+/* Test for formatted 'asprintf' output for long double conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#define TIMEOUT (DEFAULT_TIMEOUT * 128)
+
+#include "tst-printf-format-as.h"
+#include "tst-printf-format-skeleton-ldouble.c"
diff --git a/stdio-common/tst-printf-format-as-llong.c b/stdio-common/tst-printf-format-as-llong.c
new file mode 100644
index 0000000000000000..beaad73c235c344e
--- /dev/null
+++ b/stdio-common/tst-printf-format-as-llong.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'asprintf' output for long long int conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-as.h"
+#include "tst-printf-format-skeleton-llong.c"
diff --git a/stdio-common/tst-printf-format-as-long.c b/stdio-common/tst-printf-format-as-long.c
new file mode 100644
index 0000000000000000..7d968a873c3b5e29
--- /dev/null
+++ b/stdio-common/tst-printf-format-as-long.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'asprintf' output for long int conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-as.h"
+#include "tst-printf-format-skeleton-long.c"
diff --git a/stdio-common/tst-printf-format-as-s.c b/stdio-common/tst-printf-format-as-s.c
new file mode 100644
index 0000000000000000..baa883d5316cbf2f
--- /dev/null
+++ b/stdio-common/tst-printf-format-as-s.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'asprintf' output for the 's' conversion.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-as.h"
+#include "tst-printf-format-skeleton-s.c"
diff --git a/stdio-common/tst-printf-format-as-short.c b/stdio-common/tst-printf-format-as-short.c
new file mode 100644
index 0000000000000000..8d0b078815f299a6
--- /dev/null
+++ b/stdio-common/tst-printf-format-as-short.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'asprintf' output for short int conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-as.h"
+#include "tst-printf-format-skeleton-short.c"
diff --git a/stdio-common/tst-printf-format-as-uchar.c b/stdio-common/tst-printf-format-as-uchar.c
new file mode 100644
index 0000000000000000..8e46254a2f32b457
--- /dev/null
+++ b/stdio-common/tst-printf-format-as-uchar.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'asprintf' output for unsigned char conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-as.h"
+#include "tst-printf-format-skeleton-uchar.c"
diff --git a/stdio-common/tst-printf-format-as-uint.c b/stdio-common/tst-printf-format-as-uint.c
new file mode 100644
index 0000000000000000..8cf38d71a2f53358
--- /dev/null
+++ b/stdio-common/tst-printf-format-as-uint.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'asprintf' output for unsigned int conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-as.h"
+#include "tst-printf-format-skeleton-uint.c"
diff --git a/stdio-common/tst-printf-format-as-ullong.c b/stdio-common/tst-printf-format-as-ullong.c
new file mode 100644
index 0000000000000000..30b31ed8f7b36ae1
--- /dev/null
+++ b/stdio-common/tst-printf-format-as-ullong.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'asprintf' output for unsigned long long int conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-as.h"
+#include "tst-printf-format-skeleton-ullong.c"
diff --git a/stdio-common/tst-printf-format-as-ulong.c b/stdio-common/tst-printf-format-as-ulong.c
new file mode 100644
index 0000000000000000..9b108aa2b5132686
--- /dev/null
+++ b/stdio-common/tst-printf-format-as-ulong.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'asprintf' output for unsigned long int conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-as.h"
+#include "tst-printf-format-skeleton-ulong.c"
diff --git a/stdio-common/tst-printf-format-as-ushort.c b/stdio-common/tst-printf-format-as-ushort.c
new file mode 100644
index 0000000000000000..44b912fc38c46d28
--- /dev/null
+++ b/stdio-common/tst-printf-format-as-ushort.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'asprintf' output for unsigned short int conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-as.h"
+#include "tst-printf-format-skeleton-ushort.c"
diff --git a/stdio-common/tst-printf-format-as.h b/stdio-common/tst-printf-format-as.h
new file mode 100644
index 0000000000000000..c30d2e2c42822f24
--- /dev/null
+++ b/stdio-common/tst-printf-format-as.h
@@ -0,0 +1,46 @@
+/* Test feature wrapper for formatted 'asprintf' output.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#define printf_under_test(...) \
+({ \
+ __label__ out; \
+ int result; \
+ char *str; \
+ \
+ result = asprintf (&str, __VA_ARGS__); \
+ if (result < 0) \
+ { \
+ perror ("asprintf"); \
+ goto out; \
+ } \
+ if (fwrite (str, sizeof (*str), result, stdout) != result) \
+ { \
+ perror ("fwrite"); \
+ result = -1; \
+ } \
+ free (str); \
+out: \
+ result; \
+})
+
+#ifndef TIMEOUT
+# define TIMEOUT (DEFAULT_TIMEOUT * 12)
+#endif

452
glibc-RHEL-119390-3.patch Normal file
View File

@ -0,0 +1,452 @@
commit b3e8a756ad569fd31181b74b3729d29df3eb55f3
Author: Maciej W. Rozycki <macro@redhat.com>
Date: Thu Nov 7 06:14:24 2024 +0000
stdio-common: Add tests for formatted dprintf output specifiers
Wire dprintf into test infrastructure for formatted printf output
specifiers.
Reviewed-by: DJ Delorie <dj@redhat.com>
diff --git a/stdio-common/Makefile b/stdio-common/Makefile
index 54fb75e6232ddc2a..850bc89517931652 100644
--- a/stdio-common/Makefile
+++ b/stdio-common/Makefile
@@ -24,7 +24,7 @@ subdir := stdio-common
include ../Makeconfig
# List of markers for printf family function tests.
-xprintf-funcs := p as
+xprintf-funcs := p as d
# List of data types and formats for individual per-conversion printf tests.
fmt-convs := double ldouble
diff --git a/stdio-common/tst-printf-format-d-c.c b/stdio-common/tst-printf-format-d-c.c
new file mode 100644
index 0000000000000000..61fd06654d2a957e
--- /dev/null
+++ b/stdio-common/tst-printf-format-d-c.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'dprintf' output for the 'c' conversion.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-d.h"
+#include "tst-printf-format-skeleton-c.c"
diff --git a/stdio-common/tst-printf-format-d-char.c b/stdio-common/tst-printf-format-d-char.c
new file mode 100644
index 0000000000000000..baa6e1683e923841
--- /dev/null
+++ b/stdio-common/tst-printf-format-d-char.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'dprintf' output for signed char conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-d.h"
+#include "tst-printf-format-skeleton-char.c"
diff --git a/stdio-common/tst-printf-format-d-double.c b/stdio-common/tst-printf-format-d-double.c
new file mode 100644
index 0000000000000000..e432a9570d46e776
--- /dev/null
+++ b/stdio-common/tst-printf-format-d-double.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'dprintf' output for double conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-d.h"
+#include "tst-printf-format-skeleton-double.c"
diff --git a/stdio-common/tst-printf-format-d-int.c b/stdio-common/tst-printf-format-d-int.c
new file mode 100644
index 0000000000000000..6d59b23517b54a85
--- /dev/null
+++ b/stdio-common/tst-printf-format-d-int.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'dprintf' output for int conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-d.h"
+#include "tst-printf-format-skeleton-int.c"
diff --git a/stdio-common/tst-printf-format-d-ldouble.c b/stdio-common/tst-printf-format-d-ldouble.c
new file mode 100644
index 0000000000000000..67a2bae1bc4e0301
--- /dev/null
+++ b/stdio-common/tst-printf-format-d-ldouble.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'dprintf' output for long double conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-d.h"
+#include "tst-printf-format-skeleton-ldouble.c"
diff --git a/stdio-common/tst-printf-format-d-llong.c b/stdio-common/tst-printf-format-d-llong.c
new file mode 100644
index 0000000000000000..950a2b84b9fc1abc
--- /dev/null
+++ b/stdio-common/tst-printf-format-d-llong.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'dprintf' output for long long int conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-d.h"
+#include "tst-printf-format-skeleton-llong.c"
diff --git a/stdio-common/tst-printf-format-d-long.c b/stdio-common/tst-printf-format-d-long.c
new file mode 100644
index 0000000000000000..4fabb41b0b013011
--- /dev/null
+++ b/stdio-common/tst-printf-format-d-long.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'dprintf' output for long int conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-d.h"
+#include "tst-printf-format-skeleton-long.c"
diff --git a/stdio-common/tst-printf-format-d-s.c b/stdio-common/tst-printf-format-d-s.c
new file mode 100644
index 0000000000000000..1ef896e6e7d146bc
--- /dev/null
+++ b/stdio-common/tst-printf-format-d-s.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'dprintf' output for the 's' conversion.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-d.h"
+#include "tst-printf-format-skeleton-s.c"
diff --git a/stdio-common/tst-printf-format-d-short.c b/stdio-common/tst-printf-format-d-short.c
new file mode 100644
index 0000000000000000..17767bb30d2f0d3e
--- /dev/null
+++ b/stdio-common/tst-printf-format-d-short.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'dprintf' output for short int conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-d.h"
+#include "tst-printf-format-skeleton-short.c"
diff --git a/stdio-common/tst-printf-format-d-uchar.c b/stdio-common/tst-printf-format-d-uchar.c
new file mode 100644
index 0000000000000000..732479ecab2cdc4e
--- /dev/null
+++ b/stdio-common/tst-printf-format-d-uchar.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'dprintf' output for unsigned char conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-d.h"
+#include "tst-printf-format-skeleton-uchar.c"
diff --git a/stdio-common/tst-printf-format-d-uint.c b/stdio-common/tst-printf-format-d-uint.c
new file mode 100644
index 0000000000000000..5b68aec803f653ac
--- /dev/null
+++ b/stdio-common/tst-printf-format-d-uint.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'dprintf' output for unsigned int conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-d.h"
+#include "tst-printf-format-skeleton-uint.c"
diff --git a/stdio-common/tst-printf-format-d-ullong.c b/stdio-common/tst-printf-format-d-ullong.c
new file mode 100644
index 0000000000000000..0e20a1dccd58e84b
--- /dev/null
+++ b/stdio-common/tst-printf-format-d-ullong.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'dprintf' output for unsigned long long int conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-d.h"
+#include "tst-printf-format-skeleton-ullong.c"
diff --git a/stdio-common/tst-printf-format-d-ulong.c b/stdio-common/tst-printf-format-d-ulong.c
new file mode 100644
index 0000000000000000..62085ace806b6d33
--- /dev/null
+++ b/stdio-common/tst-printf-format-d-ulong.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'dprintf' output for unsigned long int conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-d.h"
+#include "tst-printf-format-skeleton-ulong.c"
diff --git a/stdio-common/tst-printf-format-d-ushort.c b/stdio-common/tst-printf-format-d-ushort.c
new file mode 100644
index 0000000000000000..7d8ef76d60b70e2d
--- /dev/null
+++ b/stdio-common/tst-printf-format-d-ushort.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'dprintf' output for unsigned short int conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-d.h"
+#include "tst-printf-format-skeleton-ushort.c"
diff --git a/stdio-common/tst-printf-format-d.h b/stdio-common/tst-printf-format-d.h
new file mode 100644
index 0000000000000000..af7f26c17bde88ea
--- /dev/null
+++ b/stdio-common/tst-printf-format-d.h
@@ -0,0 +1,58 @@
+/* Test feature wrapper for formatted 'dprintf' output.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <stdio.h>
+#include <unistd.h>
+
+/* We need to go through the POSIX-mandated dance to switch between
+ handles on an open file description. */
+
+#define printf_under_test(...) \
+({ \
+ __label__ out; \
+ int result; \
+ \
+ result = fflush (stdout); \
+ if (result == EOF) \
+ { \
+ perror ("fflush"); \
+ goto out; \
+ } \
+ result = lseek (STDOUT_FILENO, 0, SEEK_END); \
+ if (result < 0 && errno == ESPIPE) \
+ result = 0; \
+ if (result < 0) \
+ { \
+ perror ("lseek"); \
+ goto out; \
+ } \
+ result = dprintf (STDOUT_FILENO, __VA_ARGS__); \
+ if (result < 0) \
+ { \
+ perror ("dprintf"); \
+ goto out; \
+ } \
+ result = fseek (stdout, 0, SEEK_END); \
+ if (result < 0 && errno == ESPIPE) \
+ result = 0; \
+ if (result < 0) \
+ perror ("fseek"); \
+out: \
+ result; \
+})

423
glibc-RHEL-119390-4.patch Normal file
View File

@ -0,0 +1,423 @@
commit 1dc5cdc3da19e10d47e50a5ea2ea3ce62ee2fa82
Author: Maciej W. Rozycki <macro@redhat.com>
Date: Thu Nov 7 06:14:24 2024 +0000
stdio-common: Add tests for formatted fprintf output specifiers
Wire fprintf into test infrastructure for formatted printf output
specifiers.
Reviewed-by: DJ Delorie <dj@redhat.com>
diff --git a/stdio-common/Makefile b/stdio-common/Makefile
index 850bc89517931652..a40b4e15e346d170 100644
--- a/stdio-common/Makefile
+++ b/stdio-common/Makefile
@@ -24,7 +24,7 @@ subdir := stdio-common
include ../Makeconfig
# List of markers for printf family function tests.
-xprintf-funcs := p as d
+xprintf-funcs := p as d f
# List of data types and formats for individual per-conversion printf tests.
fmt-convs := double ldouble
diff --git a/stdio-common/tst-printf-format-f-c.c b/stdio-common/tst-printf-format-f-c.c
new file mode 100644
index 0000000000000000..1db9e2b5f3bb2d32
--- /dev/null
+++ b/stdio-common/tst-printf-format-f-c.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'fprintf' output for the 'c' conversion.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-f.h"
+#include "tst-printf-format-skeleton-c.c"
diff --git a/stdio-common/tst-printf-format-f-char.c b/stdio-common/tst-printf-format-f-char.c
new file mode 100644
index 0000000000000000..a492f318620bc82e
--- /dev/null
+++ b/stdio-common/tst-printf-format-f-char.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'fprintf' output for signed char conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-f.h"
+#include "tst-printf-format-skeleton-char.c"
diff --git a/stdio-common/tst-printf-format-f-double.c b/stdio-common/tst-printf-format-f-double.c
new file mode 100644
index 0000000000000000..906ef0b90b9e7d1d
--- /dev/null
+++ b/stdio-common/tst-printf-format-f-double.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'fprintf' output for double conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-f.h"
+#include "tst-printf-format-skeleton-double.c"
diff --git a/stdio-common/tst-printf-format-f-int.c b/stdio-common/tst-printf-format-f-int.c
new file mode 100644
index 0000000000000000..92dc0c919771ae26
--- /dev/null
+++ b/stdio-common/tst-printf-format-f-int.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'fprintf' output for int conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-f.h"
+#include "tst-printf-format-skeleton-int.c"
diff --git a/stdio-common/tst-printf-format-f-ldouble.c b/stdio-common/tst-printf-format-f-ldouble.c
new file mode 100644
index 0000000000000000..0a0c88d64c873061
--- /dev/null
+++ b/stdio-common/tst-printf-format-f-ldouble.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'fprintf' output for long double conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-f.h"
+#include "tst-printf-format-skeleton-ldouble.c"
diff --git a/stdio-common/tst-printf-format-f-llong.c b/stdio-common/tst-printf-format-f-llong.c
new file mode 100644
index 0000000000000000..ceb8d035faaf0a12
--- /dev/null
+++ b/stdio-common/tst-printf-format-f-llong.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'fprintf' output for long long int conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-f.h"
+#include "tst-printf-format-skeleton-llong.c"
diff --git a/stdio-common/tst-printf-format-f-long.c b/stdio-common/tst-printf-format-f-long.c
new file mode 100644
index 0000000000000000..a4a5dca5ebd7b3a4
--- /dev/null
+++ b/stdio-common/tst-printf-format-f-long.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'fprintf' output for long int conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-f.h"
+#include "tst-printf-format-skeleton-long.c"
diff --git a/stdio-common/tst-printf-format-f-s.c b/stdio-common/tst-printf-format-f-s.c
new file mode 100644
index 0000000000000000..da0e0f8bacab6992
--- /dev/null
+++ b/stdio-common/tst-printf-format-f-s.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'fprintf' output for the 's' conversion.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-f.h"
+#include "tst-printf-format-skeleton-s.c"
diff --git a/stdio-common/tst-printf-format-f-short.c b/stdio-common/tst-printf-format-f-short.c
new file mode 100644
index 0000000000000000..3abd134d0aeeef87
--- /dev/null
+++ b/stdio-common/tst-printf-format-f-short.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'fprintf' output for short int conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-f.h"
+#include "tst-printf-format-skeleton-short.c"
diff --git a/stdio-common/tst-printf-format-f-uchar.c b/stdio-common/tst-printf-format-f-uchar.c
new file mode 100644
index 0000000000000000..f104cde37b322b60
--- /dev/null
+++ b/stdio-common/tst-printf-format-f-uchar.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'fprintf' output for unsigned char conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-f.h"
+#include "tst-printf-format-skeleton-uchar.c"
diff --git a/stdio-common/tst-printf-format-f-uint.c b/stdio-common/tst-printf-format-f-uint.c
new file mode 100644
index 0000000000000000..0e1fdb4b367032a2
--- /dev/null
+++ b/stdio-common/tst-printf-format-f-uint.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'fprintf' output for unsigned int conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-f.h"
+#include "tst-printf-format-skeleton-uint.c"
diff --git a/stdio-common/tst-printf-format-f-ullong.c b/stdio-common/tst-printf-format-f-ullong.c
new file mode 100644
index 0000000000000000..b4669fcbb7dd3282
--- /dev/null
+++ b/stdio-common/tst-printf-format-f-ullong.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'fprintf' output for unsigned long long int conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-f.h"
+#include "tst-printf-format-skeleton-ullong.c"
diff --git a/stdio-common/tst-printf-format-f-ulong.c b/stdio-common/tst-printf-format-f-ulong.c
new file mode 100644
index 0000000000000000..3f4f900362a153b5
--- /dev/null
+++ b/stdio-common/tst-printf-format-f-ulong.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'fprintf' output for unsigned long int conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-f.h"
+#include "tst-printf-format-skeleton-ulong.c"
diff --git a/stdio-common/tst-printf-format-f-ushort.c b/stdio-common/tst-printf-format-f-ushort.c
new file mode 100644
index 0000000000000000..d49c2371403e20a6
--- /dev/null
+++ b/stdio-common/tst-printf-format-f-ushort.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'fprintf' output for unsigned short int conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-f.h"
+#include "tst-printf-format-skeleton-ushort.c"
diff --git a/stdio-common/tst-printf-format-f.h b/stdio-common/tst-printf-format-f.h
new file mode 100644
index 0000000000000000..efb3283a032f44a7
--- /dev/null
+++ b/stdio-common/tst-printf-format-f.h
@@ -0,0 +1,29 @@
+/* Test feature wrapper for formatted 'fprintf' output.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include <stdio.h>
+
+#define printf_under_test(...) \
+({ \
+ int result; \
+ \
+ result = fprintf (stdout, __VA_ARGS__); \
+ if (result < 0) \
+ perror ("fprintf"); \
+ result; \
+})

454
glibc-RHEL-119390-5.patch Normal file
View File

@ -0,0 +1,454 @@
commit c683ac8520e8064e7be3a22922d80849271290ac
Author: Maciej W. Rozycki <macro@redhat.com>
Date: Thu Nov 7 06:14:24 2024 +0000
stdio-common: Add tests for formatted sprintf output specifiers
Wire sprintf into test infrastructure for formatted printf output
specifiers.
Reviewed-by: DJ Delorie <dj@redhat.com>
diff --git a/stdio-common/Makefile b/stdio-common/Makefile
index a40b4e15e346d170..f4e4a8554319f16e 100644
--- a/stdio-common/Makefile
+++ b/stdio-common/Makefile
@@ -24,7 +24,7 @@ subdir := stdio-common
include ../Makeconfig
# List of markers for printf family function tests.
-xprintf-funcs := p as d f
+xprintf-funcs := p as d f s
# List of data types and formats for individual per-conversion printf tests.
fmt-convs := double ldouble
diff --git a/stdio-common/tst-printf-format-s-c.c b/stdio-common/tst-printf-format-s-c.c
new file mode 100644
index 0000000000000000..87dad077b9c05216
--- /dev/null
+++ b/stdio-common/tst-printf-format-s-c.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'sprintf' output for the 'c' conversion.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-s.h"
+#include "tst-printf-format-skeleton-c.c"
diff --git a/stdio-common/tst-printf-format-s-char.c b/stdio-common/tst-printf-format-s-char.c
new file mode 100644
index 0000000000000000..f67ac94a5dd70cf4
--- /dev/null
+++ b/stdio-common/tst-printf-format-s-char.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'sprintf' output for signed char conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-s.h"
+#include "tst-printf-format-skeleton-char.c"
diff --git a/stdio-common/tst-printf-format-s-double.c b/stdio-common/tst-printf-format-s-double.c
new file mode 100644
index 0000000000000000..16186b5dc55eabaf
--- /dev/null
+++ b/stdio-common/tst-printf-format-s-double.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'sprintf' output for double conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-s.h"
+#include "tst-printf-format-skeleton-double.c"
diff --git a/stdio-common/tst-printf-format-s-int.c b/stdio-common/tst-printf-format-s-int.c
new file mode 100644
index 0000000000000000..2ed7b2df471cd96d
--- /dev/null
+++ b/stdio-common/tst-printf-format-s-int.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'sprintf' output for int conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-s.h"
+#include "tst-printf-format-skeleton-int.c"
diff --git a/stdio-common/tst-printf-format-s-ldouble.c b/stdio-common/tst-printf-format-s-ldouble.c
new file mode 100644
index 0000000000000000..0362cc50f78ffdfa
--- /dev/null
+++ b/stdio-common/tst-printf-format-s-ldouble.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'sprintf' output for long double conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-s.h"
+#include "tst-printf-format-skeleton-ldouble.c"
diff --git a/stdio-common/tst-printf-format-s-llong.c b/stdio-common/tst-printf-format-s-llong.c
new file mode 100644
index 0000000000000000..b49f84998a7e7ca2
--- /dev/null
+++ b/stdio-common/tst-printf-format-s-llong.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'sprintf' output for long long int conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-s.h"
+#include "tst-printf-format-skeleton-llong.c"
diff --git a/stdio-common/tst-printf-format-s-long.c b/stdio-common/tst-printf-format-s-long.c
new file mode 100644
index 0000000000000000..49224d7f29d7e65c
--- /dev/null
+++ b/stdio-common/tst-printf-format-s-long.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'sprintf' output for long int conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-s.h"
+#include "tst-printf-format-skeleton-long.c"
diff --git a/stdio-common/tst-printf-format-s-s.c b/stdio-common/tst-printf-format-s-s.c
new file mode 100644
index 0000000000000000..3a400f8907895db0
--- /dev/null
+++ b/stdio-common/tst-printf-format-s-s.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'sprintf' output for the 's' conversion.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-s.h"
+#include "tst-printf-format-skeleton-s.c"
diff --git a/stdio-common/tst-printf-format-s-short.c b/stdio-common/tst-printf-format-s-short.c
new file mode 100644
index 0000000000000000..c98a808cff51c52a
--- /dev/null
+++ b/stdio-common/tst-printf-format-s-short.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'sprintf' output for short int conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-s.h"
+#include "tst-printf-format-skeleton-short.c"
diff --git a/stdio-common/tst-printf-format-s-uchar.c b/stdio-common/tst-printf-format-s-uchar.c
new file mode 100644
index 0000000000000000..befc36894975a9a1
--- /dev/null
+++ b/stdio-common/tst-printf-format-s-uchar.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'sprintf' output for unsigned char conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-s.h"
+#include "tst-printf-format-skeleton-uchar.c"
diff --git a/stdio-common/tst-printf-format-s-uint.c b/stdio-common/tst-printf-format-s-uint.c
new file mode 100644
index 0000000000000000..f3a4c49632a3be07
--- /dev/null
+++ b/stdio-common/tst-printf-format-s-uint.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'sprintf' output for unsigned int conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-s.h"
+#include "tst-printf-format-skeleton-uint.c"
diff --git a/stdio-common/tst-printf-format-s-ullong.c b/stdio-common/tst-printf-format-s-ullong.c
new file mode 100644
index 0000000000000000..4ce559037921e01f
--- /dev/null
+++ b/stdio-common/tst-printf-format-s-ullong.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'sprintf' output for unsigned long long int conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-s.h"
+#include "tst-printf-format-skeleton-ullong.c"
diff --git a/stdio-common/tst-printf-format-s-ulong.c b/stdio-common/tst-printf-format-s-ulong.c
new file mode 100644
index 0000000000000000..81f9eea893c194d2
--- /dev/null
+++ b/stdio-common/tst-printf-format-s-ulong.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'sprintf' output for unsigned long int conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-s.h"
+#include "tst-printf-format-skeleton-ulong.c"
diff --git a/stdio-common/tst-printf-format-s-ushort.c b/stdio-common/tst-printf-format-s-ushort.c
new file mode 100644
index 0000000000000000..4b1cca6e6cf6b342
--- /dev/null
+++ b/stdio-common/tst-printf-format-s-ushort.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'sprintf' output for unsigned short int conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-s.h"
+#include "tst-printf-format-skeleton-ushort.c"
diff --git a/stdio-common/tst-printf-format-s.h b/stdio-common/tst-printf-format-s.h
new file mode 100644
index 0000000000000000..7d1e72cffb7b20fb
--- /dev/null
+++ b/stdio-common/tst-printf-format-s.h
@@ -0,0 +1,60 @@
+/* Test feature wrapper for formatted 'sprintf' output.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <support/next_to_fault.h>
+
+#define SPRINTF_BUFFER_SIZE 65536
+
+static struct support_next_to_fault ntf;
+
+#define PREPARE printf_under_test_init
+static void
+printf_under_test_init (int argc, char **argv)
+{
+ ntf = support_next_to_fault_allocate (SPRINTF_BUFFER_SIZE);
+}
+
+static void __attribute__ ((destructor))
+printf_under_test_fini (void)
+{
+ support_next_to_fault_free (&ntf);
+}
+
+#define printf_under_test(...) \
+({ \
+ __label__ out; \
+ char *str = ntf.buffer; \
+ int result; \
+ \
+ result = sprintf (str, __VA_ARGS__); \
+ if (result < 0) \
+ { \
+ perror ("sprintf"); \
+ goto out; \
+ } \
+ if (fwrite (str, sizeof (*str), result, stdout) != result) \
+ { \
+ perror ("fwrite"); \
+ result = -1; \
+ } \
+out: \
+ result; \
+})

454
glibc-RHEL-119390-6.patch Normal file
View File

@ -0,0 +1,454 @@
commit 0b6379cb98590c28088f017ddcc0edb8ad7d0131
Author: Maciej W. Rozycki <macro@redhat.com>
Date: Thu Nov 7 06:14:24 2024 +0000
stdio-common: Add tests for formatted snprintf output specifiers
Wire snprintf into test infrastructure for formatted printf output
specifiers.
Reviewed-by: DJ Delorie <dj@redhat.com>
diff --git a/stdio-common/Makefile b/stdio-common/Makefile
index f4e4a8554319f16e..80833d42c24ea899 100644
--- a/stdio-common/Makefile
+++ b/stdio-common/Makefile
@@ -24,7 +24,7 @@ subdir := stdio-common
include ../Makeconfig
# List of markers for printf family function tests.
-xprintf-funcs := p as d f s
+xprintf-funcs := p as d f s sn
# List of data types and formats for individual per-conversion printf tests.
fmt-convs := double ldouble
diff --git a/stdio-common/tst-printf-format-sn-c.c b/stdio-common/tst-printf-format-sn-c.c
new file mode 100644
index 0000000000000000..59f51d635bc46d28
--- /dev/null
+++ b/stdio-common/tst-printf-format-sn-c.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'snprintf' output for the 'c' conversion.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-sn.h"
+#include "tst-printf-format-skeleton-c.c"
diff --git a/stdio-common/tst-printf-format-sn-char.c b/stdio-common/tst-printf-format-sn-char.c
new file mode 100644
index 0000000000000000..8b682dd2d52f04d2
--- /dev/null
+++ b/stdio-common/tst-printf-format-sn-char.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'snprintf' output for signed char conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-sn.h"
+#include "tst-printf-format-skeleton-char.c"
diff --git a/stdio-common/tst-printf-format-sn-double.c b/stdio-common/tst-printf-format-sn-double.c
new file mode 100644
index 0000000000000000..4719a58d84bda809
--- /dev/null
+++ b/stdio-common/tst-printf-format-sn-double.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'snprintf' output for double conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-sn.h"
+#include "tst-printf-format-skeleton-double.c"
diff --git a/stdio-common/tst-printf-format-sn-int.c b/stdio-common/tst-printf-format-sn-int.c
new file mode 100644
index 0000000000000000..94c42f246fc8ce49
--- /dev/null
+++ b/stdio-common/tst-printf-format-sn-int.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'snprintf' output for int conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-sn.h"
+#include "tst-printf-format-skeleton-int.c"
diff --git a/stdio-common/tst-printf-format-sn-ldouble.c b/stdio-common/tst-printf-format-sn-ldouble.c
new file mode 100644
index 0000000000000000..921f3ffe3b79a05d
--- /dev/null
+++ b/stdio-common/tst-printf-format-sn-ldouble.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'snprintf' output for long double conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-sn.h"
+#include "tst-printf-format-skeleton-ldouble.c"
diff --git a/stdio-common/tst-printf-format-sn-llong.c b/stdio-common/tst-printf-format-sn-llong.c
new file mode 100644
index 0000000000000000..013552791e087d0c
--- /dev/null
+++ b/stdio-common/tst-printf-format-sn-llong.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'snprintf' output for long long int conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-sn.h"
+#include "tst-printf-format-skeleton-llong.c"
diff --git a/stdio-common/tst-printf-format-sn-long.c b/stdio-common/tst-printf-format-sn-long.c
new file mode 100644
index 0000000000000000..58c8912746c1108b
--- /dev/null
+++ b/stdio-common/tst-printf-format-sn-long.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'snprintf' output for long int conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-sn.h"
+#include "tst-printf-format-skeleton-long.c"
diff --git a/stdio-common/tst-printf-format-sn-s.c b/stdio-common/tst-printf-format-sn-s.c
new file mode 100644
index 0000000000000000..aa3f170c14790926
--- /dev/null
+++ b/stdio-common/tst-printf-format-sn-s.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'snprintf' output for the 's' conversion.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-sn.h"
+#include "tst-printf-format-skeleton-s.c"
diff --git a/stdio-common/tst-printf-format-sn-short.c b/stdio-common/tst-printf-format-sn-short.c
new file mode 100644
index 0000000000000000..f7baa1211d16e203
--- /dev/null
+++ b/stdio-common/tst-printf-format-sn-short.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'snprintf' output for short int conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-sn.h"
+#include "tst-printf-format-skeleton-short.c"
diff --git a/stdio-common/tst-printf-format-sn-uchar.c b/stdio-common/tst-printf-format-sn-uchar.c
new file mode 100644
index 0000000000000000..6ae5f121bd76ab9d
--- /dev/null
+++ b/stdio-common/tst-printf-format-sn-uchar.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'snprintf' output for unsigned char conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-sn.h"
+#include "tst-printf-format-skeleton-uchar.c"
diff --git a/stdio-common/tst-printf-format-sn-uint.c b/stdio-common/tst-printf-format-sn-uint.c
new file mode 100644
index 0000000000000000..f0a0c3063f89781a
--- /dev/null
+++ b/stdio-common/tst-printf-format-sn-uint.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'snprintf' output for unsigned int conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-sn.h"
+#include "tst-printf-format-skeleton-uint.c"
diff --git a/stdio-common/tst-printf-format-sn-ullong.c b/stdio-common/tst-printf-format-sn-ullong.c
new file mode 100644
index 0000000000000000..0dc0a50c4f2362a2
--- /dev/null
+++ b/stdio-common/tst-printf-format-sn-ullong.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'snprintf' output for unsigned long long int conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-sn.h"
+#include "tst-printf-format-skeleton-ullong.c"
diff --git a/stdio-common/tst-printf-format-sn-ulong.c b/stdio-common/tst-printf-format-sn-ulong.c
new file mode 100644
index 0000000000000000..23ff5a27d7c25c34
--- /dev/null
+++ b/stdio-common/tst-printf-format-sn-ulong.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'snprintf' output for unsigned long int conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-sn.h"
+#include "tst-printf-format-skeleton-ulong.c"
diff --git a/stdio-common/tst-printf-format-sn-ushort.c b/stdio-common/tst-printf-format-sn-ushort.c
new file mode 100644
index 0000000000000000..1c5cffbeb414048e
--- /dev/null
+++ b/stdio-common/tst-printf-format-sn-ushort.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'snprintf' output for unsigned short int conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-sn.h"
+#include "tst-printf-format-skeleton-ushort.c"
diff --git a/stdio-common/tst-printf-format-sn.h b/stdio-common/tst-printf-format-sn.h
new file mode 100644
index 0000000000000000..ec2645bf57da8bbb
--- /dev/null
+++ b/stdio-common/tst-printf-format-sn.h
@@ -0,0 +1,60 @@
+/* Test feature wrapper for formatted 'snprintf' output.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <support/next_to_fault.h>
+
+#define SPRINTF_BUFFER_SIZE 65536
+
+static struct support_next_to_fault ntf;
+
+#define PREPARE printf_under_test_init
+static void
+printf_under_test_init (int argc, char **argv)
+{
+ ntf = support_next_to_fault_allocate (SPRINTF_BUFFER_SIZE);
+}
+
+static void __attribute__ ((destructor))
+printf_under_test_fini (void)
+{
+ support_next_to_fault_free (&ntf);
+}
+
+#define printf_under_test(...) \
+({ \
+ __label__ out; \
+ char *str = ntf.buffer; \
+ int result; \
+ \
+ result = snprintf (str, ntf.length, __VA_ARGS__); \
+ if (result < 0) \
+ { \
+ perror ("snprintf"); \
+ goto out; \
+ } \
+ if (fwrite (str, sizeof (*str), result, stdout) != result) \
+ { \
+ perror ("fwrite"); \
+ result = -1; \
+ } \
+out: \
+ result; \
+})

428
glibc-RHEL-119390-7.patch Normal file
View File

@ -0,0 +1,428 @@
commit bad554d9b4f10988eb7fdb814fbaa5e89416d781
Author: Maciej W. Rozycki <macro@redhat.com>
Date: Thu Nov 7 06:14:24 2024 +0000
stdio-common: Add tests for formatted vprintf output specifiers
Wire vprintf into test infrastructure for formatted printf output
specifiers.
Reviewed-by: DJ Delorie <dj@redhat.com>
diff --git a/stdio-common/Makefile b/stdio-common/Makefile
index 80833d42c24ea899..bdf99f9ce043566d 100644
--- a/stdio-common/Makefile
+++ b/stdio-common/Makefile
@@ -24,7 +24,7 @@ subdir := stdio-common
include ../Makeconfig
# List of markers for printf family function tests.
-xprintf-funcs := p as d f s sn
+xprintf-funcs := p as d f s sn v
# List of data types and formats for individual per-conversion printf tests.
fmt-convs := double ldouble
diff --git a/stdio-common/tst-printf-format-v-c.c b/stdio-common/tst-printf-format-v-c.c
new file mode 100644
index 0000000000000000..94aa3042aaee6d97
--- /dev/null
+++ b/stdio-common/tst-printf-format-v-c.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'vprintf' output for the 'c' conversion.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-v.h"
+#include "tst-printf-format-skeleton-c.c"
diff --git a/stdio-common/tst-printf-format-v-char.c b/stdio-common/tst-printf-format-v-char.c
new file mode 100644
index 0000000000000000..c813d81e53956295
--- /dev/null
+++ b/stdio-common/tst-printf-format-v-char.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'vprintf' output for signed char conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-v.h"
+#include "tst-printf-format-skeleton-char.c"
diff --git a/stdio-common/tst-printf-format-v-double.c b/stdio-common/tst-printf-format-v-double.c
new file mode 100644
index 0000000000000000..90cc1704eb3da2f3
--- /dev/null
+++ b/stdio-common/tst-printf-format-v-double.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'vprintf' output for double conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-v.h"
+#include "tst-printf-format-skeleton-double.c"
diff --git a/stdio-common/tst-printf-format-v-int.c b/stdio-common/tst-printf-format-v-int.c
new file mode 100644
index 0000000000000000..6529425b263975c8
--- /dev/null
+++ b/stdio-common/tst-printf-format-v-int.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'vprintf' output for int conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-v.h"
+#include "tst-printf-format-skeleton-int.c"
diff --git a/stdio-common/tst-printf-format-v-ldouble.c b/stdio-common/tst-printf-format-v-ldouble.c
new file mode 100644
index 0000000000000000..813f4a510dc833cc
--- /dev/null
+++ b/stdio-common/tst-printf-format-v-ldouble.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'vprintf' output for long double conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-v.h"
+#include "tst-printf-format-skeleton-ldouble.c"
diff --git a/stdio-common/tst-printf-format-v-llong.c b/stdio-common/tst-printf-format-v-llong.c
new file mode 100644
index 0000000000000000..270ad08bf5e948fd
--- /dev/null
+++ b/stdio-common/tst-printf-format-v-llong.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'vprintf' output for long long int conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-v.h"
+#include "tst-printf-format-skeleton-llong.c"
diff --git a/stdio-common/tst-printf-format-v-long.c b/stdio-common/tst-printf-format-v-long.c
new file mode 100644
index 0000000000000000..2f5f653fecb25040
--- /dev/null
+++ b/stdio-common/tst-printf-format-v-long.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'vprintf' output for long int conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-v.h"
+#include "tst-printf-format-skeleton-long.c"
diff --git a/stdio-common/tst-printf-format-v-s.c b/stdio-common/tst-printf-format-v-s.c
new file mode 100644
index 0000000000000000..ebc253b3e83291f2
--- /dev/null
+++ b/stdio-common/tst-printf-format-v-s.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'vprintf' output for the 's' conversion.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-v.h"
+#include "tst-printf-format-skeleton-s.c"
diff --git a/stdio-common/tst-printf-format-v-short.c b/stdio-common/tst-printf-format-v-short.c
new file mode 100644
index 0000000000000000..92a59d9fd3972f1e
--- /dev/null
+++ b/stdio-common/tst-printf-format-v-short.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'vprintf' output for short int conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-v.h"
+#include "tst-printf-format-skeleton-short.c"
diff --git a/stdio-common/tst-printf-format-v-uchar.c b/stdio-common/tst-printf-format-v-uchar.c
new file mode 100644
index 0000000000000000..045ffd2864f8158f
--- /dev/null
+++ b/stdio-common/tst-printf-format-v-uchar.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'vprintf' output for unsigned char conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-v.h"
+#include "tst-printf-format-skeleton-uchar.c"
diff --git a/stdio-common/tst-printf-format-v-uint.c b/stdio-common/tst-printf-format-v-uint.c
new file mode 100644
index 0000000000000000..17b1ce3aa7780209
--- /dev/null
+++ b/stdio-common/tst-printf-format-v-uint.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'vprintf' output for unsigned int conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-v.h"
+#include "tst-printf-format-skeleton-uint.c"
diff --git a/stdio-common/tst-printf-format-v-ullong.c b/stdio-common/tst-printf-format-v-ullong.c
new file mode 100644
index 0000000000000000..590b04f339e01cf6
--- /dev/null
+++ b/stdio-common/tst-printf-format-v-ullong.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'vprintf' output for unsigned long long int conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-v.h"
+#include "tst-printf-format-skeleton-ullong.c"
diff --git a/stdio-common/tst-printf-format-v-ulong.c b/stdio-common/tst-printf-format-v-ulong.c
new file mode 100644
index 0000000000000000..6747677a42b38e37
--- /dev/null
+++ b/stdio-common/tst-printf-format-v-ulong.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'vprintf' output for unsigned long int conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-v.h"
+#include "tst-printf-format-skeleton-ulong.c"
diff --git a/stdio-common/tst-printf-format-v-ushort.c b/stdio-common/tst-printf-format-v-ushort.c
new file mode 100644
index 0000000000000000..1e782715627f7b77
--- /dev/null
+++ b/stdio-common/tst-printf-format-v-ushort.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'vprintf' output for unsigned short int conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-v.h"
+#include "tst-printf-format-skeleton-ushort.c"
diff --git a/stdio-common/tst-printf-format-v.h b/stdio-common/tst-printf-format-v.h
new file mode 100644
index 0000000000000000..711b290b59df8781
--- /dev/null
+++ b/stdio-common/tst-printf-format-v.h
@@ -0,0 +1,34 @@
+/* Test feature wrapper for formatted 'vprintf' output.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include <stdarg.h>
+#include <stdio.h>
+
+static int
+printf_under_test (const char *restrict fmt, ...)
+{
+ va_list ap;
+ int result;
+
+ va_start (ap, fmt);
+ result = vprintf (fmt, ap);
+ va_end (ap);
+ if (result < 0)
+ perror ("vprintf");
+ return result;
+}

454
glibc-RHEL-119390-8.patch Normal file
View File

@ -0,0 +1,454 @@
commit 349670f8093d920d4d683472c88029f6901f7ae7
Author: Maciej W. Rozycki <macro@redhat.com>
Date: Thu Nov 7 06:14:24 2024 +0000
stdio-common: Add tests for formatted vasprintf output specifiers
Wire vasprintf into test infrastructure for formatted printf output
specifiers.
Owing to mtrace logging these tests take amounts of time to complete
similar to those of corresponding asprintf tests, so set timeouts for
the tests accordingly, with a global default for all the vasprintf
tests, and then individual higher settings for double and long double
tests each.
Reviewed-by: DJ Delorie <dj@redhat.com>
diff --git a/stdio-common/Makefile b/stdio-common/Makefile
index bdf99f9ce043566d..40327c698da75a0a 100644
--- a/stdio-common/Makefile
+++ b/stdio-common/Makefile
@@ -24,7 +24,7 @@ subdir := stdio-common
include ../Makeconfig
# List of markers for printf family function tests.
-xprintf-funcs := p as d f s sn v
+xprintf-funcs := p as d f s sn v vas
# List of data types and formats for individual per-conversion printf tests.
fmt-convs := double ldouble
diff --git a/stdio-common/tst-printf-format-vas-c.c b/stdio-common/tst-printf-format-vas-c.c
new file mode 100644
index 0000000000000000..f8cf814c8c3bc293
--- /dev/null
+++ b/stdio-common/tst-printf-format-vas-c.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'vasprintf' output for the 'c' conversion.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-vas.h"
+#include "tst-printf-format-skeleton-c.c"
diff --git a/stdio-common/tst-printf-format-vas-char.c b/stdio-common/tst-printf-format-vas-char.c
new file mode 100644
index 0000000000000000..39c6e73977f3f32f
--- /dev/null
+++ b/stdio-common/tst-printf-format-vas-char.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'vasprintf' output for signed char conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-vas.h"
+#include "tst-printf-format-skeleton-char.c"
diff --git a/stdio-common/tst-printf-format-vas-double.c b/stdio-common/tst-printf-format-vas-double.c
new file mode 100644
index 0000000000000000..25a21bb0adc2726f
--- /dev/null
+++ b/stdio-common/tst-printf-format-vas-double.c
@@ -0,0 +1,22 @@
+/* Test for formatted 'vasprintf' output for double conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#define TIMEOUT (DEFAULT_TIMEOUT * 32)
+
+#include "tst-printf-format-vas.h"
+#include "tst-printf-format-skeleton-double.c"
diff --git a/stdio-common/tst-printf-format-vas-int.c b/stdio-common/tst-printf-format-vas-int.c
new file mode 100644
index 0000000000000000..9cd70c8fcbae1c03
--- /dev/null
+++ b/stdio-common/tst-printf-format-vas-int.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'vasprintf' output for int conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-vas.h"
+#include "tst-printf-format-skeleton-int.c"
diff --git a/stdio-common/tst-printf-format-vas-ldouble.c b/stdio-common/tst-printf-format-vas-ldouble.c
new file mode 100644
index 0000000000000000..60c3933fab1b9216
--- /dev/null
+++ b/stdio-common/tst-printf-format-vas-ldouble.c
@@ -0,0 +1,22 @@
+/* Test for formatted 'vasprintf' output for long double conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#define TIMEOUT (DEFAULT_TIMEOUT * 128)
+
+#include "tst-printf-format-vas.h"
+#include "tst-printf-format-skeleton-ldouble.c"
diff --git a/stdio-common/tst-printf-format-vas-llong.c b/stdio-common/tst-printf-format-vas-llong.c
new file mode 100644
index 0000000000000000..5d5322b8b9dfe0a4
--- /dev/null
+++ b/stdio-common/tst-printf-format-vas-llong.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'vasprintf' output for long long int conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-vas.h"
+#include "tst-printf-format-skeleton-llong.c"
diff --git a/stdio-common/tst-printf-format-vas-long.c b/stdio-common/tst-printf-format-vas-long.c
new file mode 100644
index 0000000000000000..d9651053f8f14dcd
--- /dev/null
+++ b/stdio-common/tst-printf-format-vas-long.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'vasprintf' output for long int conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-vas.h"
+#include "tst-printf-format-skeleton-long.c"
diff --git a/stdio-common/tst-printf-format-vas-s.c b/stdio-common/tst-printf-format-vas-s.c
new file mode 100644
index 0000000000000000..6d74ab83e3038b44
--- /dev/null
+++ b/stdio-common/tst-printf-format-vas-s.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'vasprintf' output for the 's' conversion.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-vas.h"
+#include "tst-printf-format-skeleton-s.c"
diff --git a/stdio-common/tst-printf-format-vas-short.c b/stdio-common/tst-printf-format-vas-short.c
new file mode 100644
index 0000000000000000..a6d76a97055fbb89
--- /dev/null
+++ b/stdio-common/tst-printf-format-vas-short.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'vasprintf' output for short int conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-vas.h"
+#include "tst-printf-format-skeleton-short.c"
diff --git a/stdio-common/tst-printf-format-vas-uchar.c b/stdio-common/tst-printf-format-vas-uchar.c
new file mode 100644
index 0000000000000000..c3dee11b7d8092d9
--- /dev/null
+++ b/stdio-common/tst-printf-format-vas-uchar.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'vasprintf' output for unsigned char conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-vas.h"
+#include "tst-printf-format-skeleton-uchar.c"
diff --git a/stdio-common/tst-printf-format-vas-uint.c b/stdio-common/tst-printf-format-vas-uint.c
new file mode 100644
index 0000000000000000..e56e89374db69c3f
--- /dev/null
+++ b/stdio-common/tst-printf-format-vas-uint.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'vasprintf' output for unsigned int conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-vas.h"
+#include "tst-printf-format-skeleton-uint.c"
diff --git a/stdio-common/tst-printf-format-vas-ullong.c b/stdio-common/tst-printf-format-vas-ullong.c
new file mode 100644
index 0000000000000000..05691bc3181c6d18
--- /dev/null
+++ b/stdio-common/tst-printf-format-vas-ullong.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'vasprintf' output for unsigned long long int conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-vas.h"
+#include "tst-printf-format-skeleton-ullong.c"
diff --git a/stdio-common/tst-printf-format-vas-ulong.c b/stdio-common/tst-printf-format-vas-ulong.c
new file mode 100644
index 0000000000000000..767d9cb6a6ac64a2
--- /dev/null
+++ b/stdio-common/tst-printf-format-vas-ulong.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'vasprintf' output for unsigned long int conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-vas.h"
+#include "tst-printf-format-skeleton-ulong.c"
diff --git a/stdio-common/tst-printf-format-vas-ushort.c b/stdio-common/tst-printf-format-vas-ushort.c
new file mode 100644
index 0000000000000000..284d79f75364504f
--- /dev/null
+++ b/stdio-common/tst-printf-format-vas-ushort.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'vasprintf' output for unsigned short int conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-vas.h"
+#include "tst-printf-format-skeleton-ushort.c"
diff --git a/stdio-common/tst-printf-format-vas.h b/stdio-common/tst-printf-format-vas.h
new file mode 100644
index 0000000000000000..3e38e729ec97ceed
--- /dev/null
+++ b/stdio-common/tst-printf-format-vas.h
@@ -0,0 +1,50 @@
+/* Test feature wrapper for formatted 'vasprintf' output.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+static int
+printf_under_test (const char *restrict fmt, ...)
+{
+ va_list ap;
+ int result;
+ char *str;
+
+ va_start (ap, fmt);
+ result = vasprintf (&str, fmt, ap);
+ va_end (ap);
+ if (result < 0)
+ {
+ perror ("vasprintf");
+ goto out;
+ }
+ if (fwrite (str, sizeof (*str), result, stdout) != result)
+ {
+ perror ("fwrite");
+ result = -1;
+ }
+ free (str);
+out:
+ return result;
+}
+
+#ifndef TIMEOUT
+# define TIMEOUT (DEFAULT_TIMEOUT * 12)
+#endif

456
glibc-RHEL-119390-9.patch Normal file
View File

@ -0,0 +1,456 @@
commit fae4eacae75e4f2767998aca703d6efaae2a747f
Author: Maciej W. Rozycki <macro@redhat.com>
Date: Thu Nov 7 06:14:24 2024 +0000
stdio-common: Add tests for formatted vdprintf output specifiers
Wire vdprintf into test infrastructure for formatted printf output
specifiers.
Reviewed-by: DJ Delorie <dj@redhat.com>
diff --git a/stdio-common/Makefile b/stdio-common/Makefile
index 40327c698da75a0a..01018c53b0f4a13f 100644
--- a/stdio-common/Makefile
+++ b/stdio-common/Makefile
@@ -24,7 +24,7 @@ subdir := stdio-common
include ../Makeconfig
# List of markers for printf family function tests.
-xprintf-funcs := p as d f s sn v vas
+xprintf-funcs := p as d f s sn v vas vd
# List of data types and formats for individual per-conversion printf tests.
fmt-convs := double ldouble
diff --git a/stdio-common/tst-printf-format-vd-c.c b/stdio-common/tst-printf-format-vd-c.c
new file mode 100644
index 0000000000000000..209b1784896a0bfd
--- /dev/null
+++ b/stdio-common/tst-printf-format-vd-c.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'vdprintf' output for the 'c' conversion.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-vd.h"
+#include "tst-printf-format-skeleton-c.c"
diff --git a/stdio-common/tst-printf-format-vd-char.c b/stdio-common/tst-printf-format-vd-char.c
new file mode 100644
index 0000000000000000..8286b6d5b227e83a
--- /dev/null
+++ b/stdio-common/tst-printf-format-vd-char.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'vdprintf' output for signed char conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-vd.h"
+#include "tst-printf-format-skeleton-char.c"
diff --git a/stdio-common/tst-printf-format-vd-double.c b/stdio-common/tst-printf-format-vd-double.c
new file mode 100644
index 0000000000000000..e89a2ca5983697ce
--- /dev/null
+++ b/stdio-common/tst-printf-format-vd-double.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'vdprintf' output for double conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-vd.h"
+#include "tst-printf-format-skeleton-double.c"
diff --git a/stdio-common/tst-printf-format-vd-int.c b/stdio-common/tst-printf-format-vd-int.c
new file mode 100644
index 0000000000000000..598a888b1c937361
--- /dev/null
+++ b/stdio-common/tst-printf-format-vd-int.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'vdprintf' output for int conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-vd.h"
+#include "tst-printf-format-skeleton-int.c"
diff --git a/stdio-common/tst-printf-format-vd-ldouble.c b/stdio-common/tst-printf-format-vd-ldouble.c
new file mode 100644
index 0000000000000000..d3ada6ff0bcdd9c1
--- /dev/null
+++ b/stdio-common/tst-printf-format-vd-ldouble.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'vdprintf' output for long double conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-vd.h"
+#include "tst-printf-format-skeleton-ldouble.c"
diff --git a/stdio-common/tst-printf-format-vd-llong.c b/stdio-common/tst-printf-format-vd-llong.c
new file mode 100644
index 0000000000000000..ea6ea7b2157dc0c9
--- /dev/null
+++ b/stdio-common/tst-printf-format-vd-llong.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'vdprintf' output for long long int conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-vd.h"
+#include "tst-printf-format-skeleton-llong.c"
diff --git a/stdio-common/tst-printf-format-vd-long.c b/stdio-common/tst-printf-format-vd-long.c
new file mode 100644
index 0000000000000000..4ee1cdacffb4fe77
--- /dev/null
+++ b/stdio-common/tst-printf-format-vd-long.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'vdprintf' output for long int conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-vd.h"
+#include "tst-printf-format-skeleton-long.c"
diff --git a/stdio-common/tst-printf-format-vd-s.c b/stdio-common/tst-printf-format-vd-s.c
new file mode 100644
index 0000000000000000..df7cf9a6fbf04c9b
--- /dev/null
+++ b/stdio-common/tst-printf-format-vd-s.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'vdprintf' output for the 's' conversion.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-vd.h"
+#include "tst-printf-format-skeleton-s.c"
diff --git a/stdio-common/tst-printf-format-vd-short.c b/stdio-common/tst-printf-format-vd-short.c
new file mode 100644
index 0000000000000000..87128c8303b57cd8
--- /dev/null
+++ b/stdio-common/tst-printf-format-vd-short.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'vdprintf' output for short int conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-vd.h"
+#include "tst-printf-format-skeleton-short.c"
diff --git a/stdio-common/tst-printf-format-vd-uchar.c b/stdio-common/tst-printf-format-vd-uchar.c
new file mode 100644
index 0000000000000000..90dea719471dcb30
--- /dev/null
+++ b/stdio-common/tst-printf-format-vd-uchar.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'vdprintf' output for unsigned char conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-vd.h"
+#include "tst-printf-format-skeleton-uchar.c"
diff --git a/stdio-common/tst-printf-format-vd-uint.c b/stdio-common/tst-printf-format-vd-uint.c
new file mode 100644
index 0000000000000000..feb95dc018ee20fe
--- /dev/null
+++ b/stdio-common/tst-printf-format-vd-uint.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'vdprintf' output for unsigned int conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-vd.h"
+#include "tst-printf-format-skeleton-uint.c"
diff --git a/stdio-common/tst-printf-format-vd-ullong.c b/stdio-common/tst-printf-format-vd-ullong.c
new file mode 100644
index 0000000000000000..8f62fb0aeeaca3a3
--- /dev/null
+++ b/stdio-common/tst-printf-format-vd-ullong.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'vdprintf' output for unsigned long long int conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-vd.h"
+#include "tst-printf-format-skeleton-ullong.c"
diff --git a/stdio-common/tst-printf-format-vd-ulong.c b/stdio-common/tst-printf-format-vd-ulong.c
new file mode 100644
index 0000000000000000..59b2015cd33aaede
--- /dev/null
+++ b/stdio-common/tst-printf-format-vd-ulong.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'vdprintf' output for unsigned long int conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-vd.h"
+#include "tst-printf-format-skeleton-ulong.c"
diff --git a/stdio-common/tst-printf-format-vd-ushort.c b/stdio-common/tst-printf-format-vd-ushort.c
new file mode 100644
index 0000000000000000..5d096502d9f44959
--- /dev/null
+++ b/stdio-common/tst-printf-format-vd-ushort.c
@@ -0,0 +1,20 @@
+/* Test for formatted 'vdprintf' output for unsigned short int conversions.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include "tst-printf-format-vd.h"
+#include "tst-printf-format-skeleton-ushort.c"
diff --git a/stdio-common/tst-printf-format-vd.h b/stdio-common/tst-printf-format-vd.h
new file mode 100644
index 0000000000000000..d721edadc6f7786b
--- /dev/null
+++ b/stdio-common/tst-printf-format-vd.h
@@ -0,0 +1,62 @@
+/* Test feature wrapper for formatted 'vdprintf' output.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <unistd.h>
+
+/* We need to go through the POSIX-mandated dance to switch between
+ handles on an open file description. */
+
+static int
+printf_under_test (const char *restrict fmt, ...)
+{
+ va_list ap;
+ int result;
+
+ result = fflush (stdout);
+ if (result == EOF)
+ {
+ perror ("fflush");
+ goto out;
+ }
+ result = lseek (STDOUT_FILENO, 0, SEEK_END);
+ if (result < 0 && errno == ESPIPE)
+ result = 0;
+ if (result < 0)
+ {
+ perror ("lseek");
+ goto out;
+ }
+ va_start (ap, fmt);
+ result = vdprintf (STDOUT_FILENO, fmt, ap);
+ va_end (ap);
+ if (result < 0)
+ {
+ perror ("vdprintf");
+ goto out;
+ }
+ result = fseek (stdout, 0, SEEK_END);
+ if (result < 0 && errno == ESPIPE)
+ result = 0;
+ if (result < 0)
+ perror ("fseek");
+out:
+ return result;
+}