<feed xmlns='http://www.w3.org/2005/Atom'>
<title>musl/src/stdio, branch v1.1.20</title>
<subtitle>musl - an implementation of the standard library for Linux-based systems</subtitle>
<link rel='alternate' type='text/html' href='http://git.musl-libc.org/cgit/musl/'/>
<entry>
<title>prevent perror from clobbering stderr's orientation</title>
<updated>2018-08-30T04:08:16+00:00</updated>
<author>
<name>Rich Felker</name>
<email>dalias@aerifal.cx</email>
</author>
<published>2018-08-30T04:08:16+00:00</published>
<link rel='alternate' type='text/html' href='http://git.musl-libc.org/cgit/musl/commit/?id=cff4b910ab210e5c35f768c75c4562b3ae3e86f2'/>
<id>cff4b910ab210e5c35f768c75c4562b3ae3e86f2</id>
<content type='text'>
this requirement is specified by POSIX.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
this requirement is specified by POSIX.
</pre>
</div>
</content>
</entry>
<entry>
<title>make vfprintf set stream orientation even for zero-length output</title>
<updated>2018-08-30T03:53:45+00:00</updated>
<author>
<name>Rich Felker</name>
<email>dalias@aerifal.cx</email>
</author>
<published>2018-08-30T03:53:45+00:00</published>
<link rel='alternate' type='text/html' href='http://git.musl-libc.org/cgit/musl/commit/?id=a43a7b215cf7b71d1371c63927c17bae7177aa95'/>
<id>a43a7b215cf7b71d1371c63927c17bae7177aa95</id>
<content type='text'>
if no output is produced, no underlying fwrite will ever be called,
but byte-oriented printf functions are still required to set the
orientation of the stream to byte-oriented. call __towrite explicitly
if the FILE is not already in write mode.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
if no output is produced, no underlying fwrite will ever be called,
but byte-oriented printf functions are still required to set the
orientation of the stream to byte-oriented. call __towrite explicitly
if the FILE is not already in write mode.
</pre>
</div>
</content>
</entry>
<entry>
<title>re-fix vfprintf temporary buffer logic</title>
<updated>2018-08-30T03:45:43+00:00</updated>
<author>
<name>Rich Felker</name>
<email>dalias@aerifal.cx</email>
</author>
<published>2018-08-30T03:45:43+00:00</published>
<link rel='alternate' type='text/html' href='http://git.musl-libc.org/cgit/musl/commit/?id=f1791f42ef6d22e68dfc1ee45c0a478b156ce46d'/>
<id>f1791f42ef6d22e68dfc1ee45c0a478b156ce46d</id>
<content type='text'>
commit b5a8b28915aad17b6f49ccacd6d3fef3890844d1 setup the write buffer
bound pointers for the temporary buffer manually to fix a buffer
overflow issue, but in doing so, caused vfprintf on unbuffered files
never to call __towrite, thereby failing to set the stream orientation
to byte-oriented, failing to clear any prior read mode, and failing to
produce an error when the stream is not writable.

revert the inline setup of the bounds pointers and instead zero them,
so that the underlying fwrite code will call __towrite to set them up.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit b5a8b28915aad17b6f49ccacd6d3fef3890844d1 setup the write buffer
bound pointers for the temporary buffer manually to fix a buffer
overflow issue, but in doing so, caused vfprintf on unbuffered files
never to call __towrite, thereby failing to set the stream orientation
to byte-oriented, failing to clear any prior read mode, and failing to
produce an error when the stream is not writable.

revert the inline setup of the bounds pointers and instead zero them,
so that the underlying fwrite code will call __towrite to set them up.
</pre>
</div>
</content>
</entry>
<entry>
<title>fix missing flush of stderr at exit if it was put in buffered mode</title>
<updated>2018-08-30T03:40:49+00:00</updated>
<author>
<name>Rich Felker</name>
<email>dalias@aerifal.cx</email>
</author>
<published>2018-08-30T03:40:49+00:00</published>
<link rel='alternate' type='text/html' href='http://git.musl-libc.org/cgit/musl/commit/?id=ddc947eda311331959c73dbc4491afcfe2326346'/>
<id>ddc947eda311331959c73dbc4491afcfe2326346</id>
<content type='text'>
commit 0b80a7b0404b6e49b0b724e3e3fe0ed5af3b08ef added the ability to
set application-provided stdio FILE buffers, adding the possibility
that stderr might be buffered at exit time, but __stdio_exit did not
have code to flush it.

this regression was not present in any release.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 0b80a7b0404b6e49b0b724e3e3fe0ed5af3b08ef added the ability to
set application-provided stdio FILE buffers, adding the possibility
that stderr might be buffered at exit time, but __stdio_exit did not
have code to flush it.

this regression was not present in any release.
</pre>
</div>
</content>
</entry>
<entry>
<title>vfwprintf: honor field width with 'c' format type</title>
<updated>2018-08-29T01:31:05+00:00</updated>
<author>
<name>A. Wilcox</name>
<email>AWilcox@Wilcox-Tech.com</email>
</author>
<published>2018-08-23T13:06:12+00:00</published>
<link rel='alternate' type='text/html' href='http://git.musl-libc.org/cgit/musl/commit/?id=9cdaf1a86bf7790c8dec749118392ee78101ee37'/>
<id>9cdaf1a86bf7790c8dec749118392ee78101ee37</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>set stream orientations in open_[w]memstream</title>
<updated>2018-08-29T00:01:25+00:00</updated>
<author>
<name>Rich Felker</name>
<email>dalias@aerifal.cx</email>
</author>
<published>2018-08-28T23:22:13+00:00</published>
<link rel='alternate' type='text/html' href='http://git.musl-libc.org/cgit/musl/commit/?id=b152d575fdde1b4173afb4cade55f35b6b2e9128'/>
<id>b152d575fdde1b4173afb4cade55f35b6b2e9128</id>
<content type='text'>
fundamentally there is no good reason these functions need to set an
orientation (morally it should be possible to write a wchar_t[] memory
stream using byte functions, or a char[] memory stream using wide
functions), but it's a part of the specification that they do. aside
from being able to inspect the orientation with fwide, failure to set
the orientation in open_wmemstream is observable if the locale changes
between open_wmemstream and the first operation on the stream; this is
because the encoding rule (locale) for the stream is required to be
bound at the time the stream becomes wide-oriented.

for open_wmemstream, call fwide to avoid duplicating the logic for
binding the encoding rule. for open_memstream it suffices just to set
the mode field in the FILE struct.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
fundamentally there is no good reason these functions need to set an
orientation (morally it should be possible to write a wchar_t[] memory
stream using byte functions, or a char[] memory stream using wide
functions), but it's a part of the specification that they do. aside
from being able to inspect the orientation with fwide, failure to set
the orientation in open_wmemstream is observable if the locale changes
between open_wmemstream and the first operation on the stream; this is
because the encoding rule (locale) for the stream is required to be
bound at the time the stream becomes wide-oriented.

for open_wmemstream, call fwide to avoid duplicating the logic for
binding the encoding rule. for open_memstream it suffices just to set
the mode field in the FILE struct.
</pre>
</div>
</content>
</entry>
<entry>
<title>make fmemopen's w+ mode truncate the buffer</title>
<updated>2018-08-28T23:16:40+00:00</updated>
<author>
<name>Rich Felker</name>
<email>dalias@aerifal.cx</email>
</author>
<published>2018-08-28T23:16:40+00:00</published>
<link rel='alternate' type='text/html' href='http://git.musl-libc.org/cgit/musl/commit/?id=f66022dda8d18e6732626c7806f6c4d32023d574'/>
<id>f66022dda8d18e6732626c7806f6c4d32023d574</id>
<content type='text'>
the w+ mode is specified to "truncate the buffer contents". like most
of fmemopen, exactly what this means is underspecified. mode w and w+
of course implicitly 'truncate' the buffer if a write from the initial
position is flushed, so in order for this part of the text about w+
not to be spurious, it should be interpreted as requiring something
else, and the obvious reasonable interpretation is that the truncation
is immediately visible if you attempt to read from the stream or the
buffer before writing/flushing.

this interpretation agrees with reported conformance test failures.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
the w+ mode is specified to "truncate the buffer contents". like most
of fmemopen, exactly what this means is underspecified. mode w and w+
of course implicitly 'truncate' the buffer if a write from the initial
position is flushed, so in order for this part of the text about w+
not to be spurious, it should be interpreted as requiring something
else, and the obvious reasonable interpretation is that the truncation
is immediately visible if you attempt to read from the stream or the
buffer before writing/flushing.

this interpretation agrees with reported conformance test failures.
</pre>
</div>
</content>
</entry>
<entry>
<title>set errno when fileno is called on a FILE with no underlying fd</title>
<updated>2018-08-28T22:41:12+00:00</updated>
<author>
<name>Rich Felker</name>
<email>dalias@aerifal.cx</email>
</author>
<published>2018-08-28T22:40:15+00:00</published>
<link rel='alternate' type='text/html' href='http://git.musl-libc.org/cgit/musl/commit/?id=b39b47bac8ee5505cfc595000a140c35460e1cac'/>
<id>b39b47bac8ee5505cfc595000a140c35460e1cac</id>
<content type='text'>
this is a POSIX requirement.

also remove the gratuitous locking shenanigans and simply access f-&gt;fd
under control of the lock. there is no advantage to not doing so, and
it made the correctness non-obvious at best.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
this is a POSIX requirement.

also remove the gratuitous locking shenanigans and simply access f-&gt;fd
under control of the lock. there is no advantage to not doing so, and
it made the correctness non-obvious at best.
</pre>
</div>
</content>
</entry>
<entry>
<title>fix printf precision specifier for hex floats on non-ld80 archs</title>
<updated>2018-08-23T19:24:03+00:00</updated>
<author>
<name>Rich Felker</name>
<email>dalias@aerifal.cx</email>
</author>
<published>2018-08-23T19:24:03+00:00</published>
<link rel='alternate' type='text/html' href='http://git.musl-libc.org/cgit/musl/commit/?id=cfa0a54c082d41db6446638eed1d57f163434092'/>
<id>cfa0a54c082d41db6446638eed1d57f163434092</id>
<content type='text'>
the code to perform rounding to the desired precision wrongly assumed
the long double mantissa was an integral number of nibbles (hex
digits) in length. this is true for 80-bit extended precision (64-bit
mantissa) but not for double (53) or quad (113).

scale the rounding value by 1&lt;&lt;(LDBL_MANT_DIG%4) to compensate.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
the code to perform rounding to the desired precision wrongly assumed
the long double mantissa was an integral number of nibbles (hex
digits) in length. this is true for 80-bit extended precision (64-bit
mantissa) but not for double (53) or quad (113).

scale the rounding value by 1&lt;&lt;(LDBL_MANT_DIG%4) to compensate.
</pre>
</div>
</content>
</entry>
<entry>
<title>fix writes outside buffer by ungetc after setvbuf</title>
<updated>2018-07-14T01:56:27+00:00</updated>
<author>
<name>Rich Felker</name>
<email>dalias@aerifal.cx</email>
</author>
<published>2018-07-14T01:56:27+00:00</published>
<link rel='alternate' type='text/html' href='http://git.musl-libc.org/cgit/musl/commit/?id=9cad27a3dc1a4eb349b6591e4dc8cc89dce32277'/>
<id>9cad27a3dc1a4eb349b6591e4dc8cc89dce32277</id>
<content type='text'>
commit 0b80a7b0404b6e49b0b724e3e3fe0ed5af3b08ef, which added non-stub
setvbuf, applied the UNGET pushback adjustment to the size of the
buffer passed in, but inadvertently omitted offsetting the start by
the same amount, thereby allowing unget to clobber up to 8 bytes
before the start of the buffer. this bug was introduced in the present
release cycle; no releases are affected.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 0b80a7b0404b6e49b0b724e3e3fe0ed5af3b08ef, which added non-stub
setvbuf, applied the UNGET pushback adjustment to the size of the
buffer passed in, but inadvertently omitted offsetting the start by
the same amount, thereby allowing unget to clobber up to 8 bytes
before the start of the buffer. this bug was introduced in the present
release cycle; no releases are affected.
</pre>
</div>
</content>
</entry>
</feed>
