Skip to content
Commits on Source (2)
......@@ -18,6 +18,10 @@ glibc (2.28-6) UNRELEASED; urgency=medium
* debian/patches/any/local-ldso-disable-hwcap.diff: only check for
/etc/ld.so.nohwcap on alpha, hurd-i386 and i386. Based on a patch from
Josh Triplett. Closes: #908928.
* debian/patches/any/git-libio-stdout-putc.diff: fix puts and putchar output
with change stdout pointer. Closes: #761300.
* debhelper.in/locales.bug-presubj: drop obsolete file, the dependency
mechanism for locales has been changes a lot of time ago.
 
-- Samuel Thibault <sthibault@debian.org> Tue, 22 Jan 2019 23:42:47 +0100
 
......
locales dependencies on glibc
=============================
If at some point (in unstable) you get messages like:
The following packages have unmet dependencies:
locales: Depends: glibc-2.6-1 which is a virtual package.
then please check for example on [1] that the glibc of the _same_ version as
the `locales` package you are trying to upgrade is in state _installed_ for
your architecture, and for how long.
If it's not, it is very likely that the corresponding libc has not been
built _and_ uploaded to the mirrors for your architecture yet, and that the
dependencies will be fixed soon. Please wait for the package to be installed
for more than 24 hours before reporting a bug about `locales` dependencies.
[1] http://buildd.debian.org/~jeroen/status/package.php?p=glibc
2019-01-31 Paul Pluzhnikov <ppluzhnikov@google.com>
[BZ #24051]
* libio/ioputs.c (_IO_puts): Use stdout instead of _IO_stdout.
* libio/fileops.c (_IO_new_file_underflow): Likewise
* libio/wfileops.c (_IO_wfile_underflow): Likewise
* libio/putchar.c (putchar): Likewise.
* libio/putchar_u.c (putchar_unlocked): Likewise.
* libio/putwchar.c (putchar): Likewise.
* libio/putwchar_u.c (putwchar_unlocked): Likewise.
* libio/tst-bz24051.c: New test.
* libio/Makefile (tests): Add tst-bz24051
--- a/libio/Makefile
+++ b/libio/Makefile
@@ -64,7 +64,8 @@
bug-memstream1 bug-wmemstream1 \
tst-setvbuf1 tst-popen1 tst-fgetwc bug-wsetpos tst-fseek \
tst-fwrite-error tst-ftell-partial-wide tst-ftell-active-handler \
- tst-ftell-append tst-fputws tst-bz22415 tst-fgetc-after-eof
+ tst-ftell-append tst-fputws tst-bz22415 tst-fgetc-after-eof \
+ tst-bz24051
tests-internal = tst-vtables tst-vtables-interposed tst-readline
--- a/libio/fileops.c
+++ b/libio/fileops.c
@@ -501,13 +501,13 @@
traditional Unix systems did this for stdout. stderr better
not be line buffered. So we do just that here
explicitly. --drepper */
- _IO_acquire_lock (_IO_stdout);
+ _IO_acquire_lock (stdout);
- if ((_IO_stdout->_flags & (_IO_LINKED | _IO_NO_WRITES | _IO_LINE_BUF))
+ if ((stdout->_flags & (_IO_LINKED | _IO_NO_WRITES | _IO_LINE_BUF))
== (_IO_LINKED | _IO_LINE_BUF))
- _IO_OVERFLOW (_IO_stdout, EOF);
+ _IO_OVERFLOW (stdout, EOF);
- _IO_release_lock (_IO_stdout);
+ _IO_release_lock (stdout);
}
_IO_switch_to_get_mode (fp);
--- a/libio/ioputs.c
+++ b/libio/ioputs.c
@@ -33,15 +33,15 @@
{
int result = EOF;
size_t len = strlen (str);
- _IO_acquire_lock (_IO_stdout);
+ _IO_acquire_lock (stdout);
- if ((_IO_vtable_offset (_IO_stdout) != 0
- || _IO_fwide (_IO_stdout, -1) == -1)
- && _IO_sputn (_IO_stdout, str, len) == len
- && _IO_putc_unlocked ('\n', _IO_stdout) != EOF)
+ if ((_IO_vtable_offset (stdout) != 0
+ || _IO_fwide (stdout, -1) == -1)
+ && _IO_sputn (stdout, str, len) == len
+ && _IO_putc_unlocked ('\n', stdout) != EOF)
result = MIN (INT_MAX, len + 1);
- _IO_release_lock (_IO_stdout);
+ _IO_release_lock (stdout);
return result;
}
--- a/libio/putchar.c
+++ b/libio/putchar.c
@@ -24,9 +24,9 @@
putchar (int c)
{
int result;
- _IO_acquire_lock (_IO_stdout);
- result = _IO_putc_unlocked (c, _IO_stdout);
- _IO_release_lock (_IO_stdout);
+ _IO_acquire_lock (stdout);
+ result = _IO_putc_unlocked (c, stdout);
+ _IO_release_lock (stdout);
return result;
}
--- a/libio/putchar_u.c
+++ b/libio/putchar_u.c
@@ -23,6 +23,6 @@
int
putchar_unlocked (int c)
{
- CHECK_FILE (_IO_stdout, EOF);
- return _IO_putc_unlocked (c, _IO_stdout);
+ CHECK_FILE (stdout, EOF);
+ return _IO_putc_unlocked (c, stdout);
}
--- a/libio/putwchar.c
+++ b/libio/putwchar.c
@@ -22,8 +22,8 @@
putwchar (wchar_t wc)
{
wint_t result;
- _IO_acquire_lock (_IO_stdout);
- result = _IO_putwc_unlocked (wc, _IO_stdout);
- _IO_release_lock (_IO_stdout);
+ _IO_acquire_lock (stdout);
+ result = _IO_putwc_unlocked (wc, stdout);
+ _IO_release_lock (stdout);
return result;
}
--- a/libio/putwchar_u.c
+++ b/libio/putwchar_u.c
@@ -21,6 +21,6 @@
wint_t
putwchar_unlocked (wchar_t wc)
{
- CHECK_FILE (_IO_stdout, WEOF);
- return _IO_putwc_unlocked (wc, _IO_stdout);
+ CHECK_FILE (stdout, WEOF);
+ return _IO_putwc_unlocked (wc, stdout);
}
--- /dev/null
+++ b/libio/tst-bz24051.c
@@ -0,0 +1,81 @@
+/* Test that assigning to stdout redirects puts, putchar, etc (BZ#24051)
+ Copyright (C) 2019 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
+ <http://www.gnu.org/licenses/>. */
+
+
+/* Prevent putchar -> _IO_putc inline expansion. */
+#define __NO_INLINE__
+#pragma GCC optimize("O0")
+
+#include <stdio.h>
+#include <string.h>
+#include <wchar.h>
+
+#include <array_length.h>
+#include <support/check.h>
+#include <support/temp_file.h>
+#include <support/test-driver.h>
+
+#undef putchar
+#undef putwchar
+
+static int
+do_test_narrow (void)
+{
+ char buf[100];
+ int fd = create_temp_file ("tst-bz24051", NULL);
+ stdout = fdopen (fd, "w+");
+ TEST_VERIFY_EXIT (stdout != NULL);
+
+ printf ("ab%s", "cd");
+ putchar ('e');
+ putchar_unlocked ('f');
+ puts ("ghi");
+
+ rewind (stdout);
+ TEST_VERIFY_EXIT (fgets (buf, sizeof (buf), stdout) != NULL);
+ TEST_VERIFY (strcmp (buf, "abcdefghi\n") == 0);
+
+ return 0;
+}
+
+static int
+do_test_wide (void)
+{
+ wchar_t buf[100];
+ int fd = create_temp_file ("tst-bz24051w", NULL);
+ stdout = fdopen (fd, "w+");
+ TEST_VERIFY_EXIT (stdout != NULL);
+
+ wprintf (L"ab%ls", L"cd");
+ putwchar (L'e');
+ putwchar_unlocked (L'f');
+
+ rewind (stdout);
+ TEST_VERIFY_EXIT (fgetws (buf, array_length (buf), stdout) != NULL);
+ TEST_VERIFY (wcscmp (buf, L"abcdef") == 0);
+
+ return 0;
+}
+
+static int
+do_test (void)
+{
+ return do_test_narrow () + do_test_wide ();
+}
+
+#include <support/test-driver.c>
--- a/libio/wfileops.c
+++ b/libio/wfileops.c
@@ -208,13 +208,13 @@
traditional Unix systems did this for stdout. stderr better
not be line buffered. So we do just that here
explicitly. --drepper */
- _IO_acquire_lock (_IO_stdout);
+ _IO_acquire_lock (stdout);
- if ((_IO_stdout->_flags & (_IO_LINKED | _IO_NO_WRITES | _IO_LINE_BUF))
+ if ((stdout->_flags & (_IO_LINKED | _IO_NO_WRITES | _IO_LINE_BUF))
== (_IO_LINKED | _IO_LINE_BUF))
- _IO_OVERFLOW (_IO_stdout, EOF);
+ _IO_OVERFLOW (stdout, EOF);
- _IO_release_lock (_IO_stdout);
+ _IO_release_lock (stdout);
}
_IO_switch_to_get_mode (fp);
......@@ -158,3 +158,4 @@ any/local-libpic.diff
any/local-bootstrap-headers.diff
any/submitted-resolv-unaligned.diff
any/local-cudacc-float128.diff
any/git-libio-stdout-putc.diff
......@@ -190,7 +190,7 @@ clean:: unpatch
rm -rf debian/include
rm -f debian/control.in/libc0.1 debian/control.in/libc0.3 \
debian/control.in/libc6 debian/control.in/libc6.1 \
debian/*.preinst.* debian/locales.bug-presubj
debian/*.preinst.*
# Required Debian targets
build-arch: $(stamp)info \
......