[PATCH v5 0/2] libio: Keep memstream result buffers independent of setvbuf

Alex Gao gaoxiang@kylinos.cn
Mon May 18 07:57:07 GMT 2026


在 2026/5/8 14:04, Gao Xiang 写道:
> From: Xiang Gao <gaoxiang@kylinos.cn>
> 
> This series fixes two paths where setbuf/setvbuf can interfere with
> the growable result buffers managed by open_memstream and
> open_wmemstream.
> 
> Patch 1 keeps the v2 setbuf fix: memstream-specific setbuf hooks keep
> the internal growable result buffer unchanged.
> 
> Patch 2 handles the setvbuf (stream, NULL, _IOFBF, 0) path, which can
> call _IO_DOALLOCATE and return without invoking the stream setbuf hook.
> 
> Changes in v5:
>   * Address coding-style comments following the GNU Coding Standards:
>     - Drop unrelated style changes in existing libioP.h declarations.
>     - Remove unnecessary casts for unused hook parameters.
>     - Fix GNU comment spacing.
> 
> Changes in v4:
>   * Refactor the test cases in both patches by using libio/tst-memstream.h,
>     so that the regression tests cover both open_memstream and
>     open_wmemstream, as suggested by Andreas Schwab.
>   * Use TEST_VERIFY_EXIT for pointer guard checks.
>   * Fix typos.
> 
> Tested on x86_64-linux-gnu with no regression:
>    make -j$(nproc) subdirs=libio check
> 
> 
> Xiang Gao (2):
>    libio: Ignore setbuf for open_memstream and open_wmemstream [BZ
>      #34019]
>    libio: Ignore doallocate for open_memstream and open_wmemstream [BZ
>      #34019]
> 
>   libio/Makefile                            |  4 ++
>   libio/libioP.h                            |  6 +++
>   libio/memstream.c                         | 17 +++++++
>   libio/tst-memstream-setbuf.c              | 41 +++++++++++++++
>   libio/tst-memstream-setvbuf-doallocate.c  | 61 +++++++++++++++++++++++
>   libio/tst-wmemstream-setbuf.c             | 20 ++++++++
>   libio/tst-wmemstream-setvbuf-doallocate.c | 20 ++++++++
>   libio/vtables.c                           | 12 +++--
>   libio/wmemstream.c                        | 17 +++++++
>   9 files changed, 194 insertions(+), 4 deletions(-)
>   create mode 100644 libio/tst-memstream-setbuf.c
>   create mode 100644 libio/tst-memstream-setvbuf-doallocate.c
>   create mode 100644 libio/tst-wmemstream-setbuf.c
>   create mode 100644 libio/tst-wmemstream-setvbuf-doallocate.c
> 

Hi,

Ping for this series.

v5 addresses the review comments from v4, is there anything else I 
should adjust, or is this version OK for commit?


More information about the Libc-alpha mailing list