Bug#761300: libc6: putchar does not follow stdio
- To: Sven Joachim <svenjoac@gmx.de>
- Cc: 761300@bugs.debian.org
- Subject: Bug#761300: libc6: putchar does not follow stdio
- From: Florian Weimer <fw@deneb.enyo.de>
- Date: Fri, 28 Dec 2018 21:11:07 +0100
- Message-id: <[🔎] 875zvdtns4.fsf_-_@mid.deneb.enyo.de>
- Reply-to: Florian Weimer <fw@deneb.enyo.de>, 761300@bugs.debian.org
- In-reply-to: <878t30v8hg.fsf@turtle.gmx.de> (Sven Joachim's message of "Sun, 14 Oct 2018 17:44:11 +0200")
- References: <54131AFB.3030609@speakeasy.net> <54131AFB.3030609@speakeasy.net> <87in25vjdf.fsf@turtle.gmx.de> <87efcsoj14.fsf@mid.deneb.enyo.de> <54131AFB.3030609@speakeasy.net> <878t30v8hg.fsf@turtle.gmx.de> <54131AFB.3030609@speakeasy.net>
* Sven Joachim:
> Am 14.10.2018 um 13:38 schrieb Florian Weimer:
>
>> * Sven Joachim:
>>
>>> This result is rather surprising. After all, "putchar('x')" is supposed
>>> to do the same as "putc('x', stdout)", but here it does not.
>>
>> Can you reproduce this with something newer than 2.13-38+rpi2+deb7u3?
>> Or on something else besides armhf?
>
> Surely, I tested 2.27-6 on amd64.
Eh, right. We have this in glibc:
int
putchar (int c)
{
int result;
_IO_acquire_lock (_IO_stdout);
result = _IO_putc_unlocked (c, _IO_stdout);
_IO_release_lock (_IO_stdout);
return result;
}
_IO_stdout is the variable to which stdout points to default, so this
code was simply not adjusted when the assignment-to-stdout extension
was implemented. This should use stdout instead. The puts function
has the same problem.
It looks to me we can get away with fixing this bug.
Reply to: