head	1.2;
access;
symbols
	netbsd-11-0-RC3:1.2
	netbsd-11-0-RC2:1.2
	netbsd-11-0-RC1:1.2
	perseant-exfatfs-base-20250801:1.2
	netbsd-11:1.2.0.8
	netbsd-11-base:1.2
	netbsd-10-1-RELEASE:1.2.4.2
	netbsd-9:1.2.0.6
	netbsd-10:1.2.0.4
	perseant-exfatfs-base-20240630:1.2
	perseant-exfatfs:1.2.0.2
	perseant-exfatfs-base:1.2;
locks; strict;
comment	@# @;


1.2
date	2024.05.20.11.20.53;	author riastradh;	state Exp;
branches
	1.2.4.1
	1.2.6.1;
next	1.1;
commitid	uqSijp38QRPAiJaF;

1.1
date	2024.04.28.01.21.27;	author riastradh;	state Exp;
branches;
next	;
commitid	TT7xsEOMeEiNGQ7F;

1.2.4.1
date	2024.05.20.11.20.53;	author martin;	state dead;
branches;
next	1.2.4.2;
commitid	DAdadJ9gBwPRBYmF;

1.2.4.2
date	2024.08.23.18.28.09;	author martin;	state Exp;
branches;
next	;
commitid	DAdadJ9gBwPRBYmF;

1.2.6.1
date	2024.05.20.11.20.53;	author martin;	state dead;
branches;
next	1.2.6.2;
commitid	fwGsKyqA176oDYmF;

1.2.6.2
date	2024.08.23.18.32.36;	author martin;	state Exp;
branches;
next	;
commitid	fwGsKyqA176oDYmF;


desc
@@


1.2
log
@libstdc++: Don't try to fflush stdin.

It doesn't work.  It's undefined behaviour.  On NetBSD, it will fail
with EBADF, if fd 0 isn't open for write, or if fd 0 is open for
write, it will write heap garbage to fd 0.

   If stream points to an output stream or an update stream in which
   the most recent operation was not input, the fflush function causes
   any unwritten data for that stream to be delivered to the host
   environment to be written to the file; otherwise, the behavior is
   undefined.

   (ISO C11 and ISO C17, Sec. 7.21.5.2 `The fflush function')

PR lib/58206
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114879
@
text
@#	$NetBSD: t_sync_with_stdio.sh,v 1.1 2024/04/28 01:21:27 riastradh Exp $
#
# Copyright (c) 2024 The NetBSD Foundation, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
#    notice, this list of conditions and the following disclaimer in the
#    documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#

cin_nosync_head()
{
	atf_set descr "Check cin works after std::ios::sync_with_stdio(false)"
}
cin_nosync_body()
{
	echo hello >in
	atf_check -o inline:'6\n' "$(atf_get_srcdir)"/h_cin_nosync <in
}

atf_init_test_cases()
{
	atf_add_test_case cin_nosync
}
@


1.2.6.1
log
@file t_sync_with_stdio.sh was added on branch netbsd-9 on 2024-08-23 18:32:35 +0000
@
text
@d1 41
@


1.2.6.2
log
@Pull up following revision(s) (requested by riastradh in ticket #1877):

	tests/lib/libstdc++/h_cin_nosync.cc: revision 1.1
	tests/lib/libstdc++/t_sync_with_stdio.sh: revision 1.1
	tests/lib/libstdc++/t_sync_with_stdio.sh: revision 1.2
	etc/mtree/NetBSD.dist.tests: revision 1.204
	distrib/sets/lists/tests/mi: revision 1.1313 (patch)
	tests/lib/libstdc++/Makefile: revision 1.1
	distrib/sets/lists/debug/mi: revision 1.433
	external/gpl3/gcc/dist/libstdc++-v3/config/io/basic_file_stdio.cc: revision 1.2

libstdc++: Add test for PR lib/58206, sync_with_stdio busted.

libstdc++: Don't try to fflush stdin.

It doesn't work.  It's undefined behaviour.  On NetBSD, it will fail
with EBADF, if fd 0 isn't open for write, or if fd 0 is open for
write, it will write heap garbage to fd 0.

   If stream points to an output stream or an update stream in which
   the most recent operation was not input, the fflush function causes
   any unwritten data for that stream to be delivered to the host
   environment to be written to the file; otherwise, the behavior is
   undefined.
   (ISO C11 and ISO C17, Sec. 7.21.5.2 `The fflush function')

PR lib/58206
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114879
@
text
@a0 41
#	$NetBSD: t_sync_with_stdio.sh,v 1.2 2024/05/20 11:20:53 riastradh Exp $
#
# Copyright (c) 2024 The NetBSD Foundation, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
#    notice, this list of conditions and the following disclaimer in the
#    documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#

cin_nosync_head()
{
	atf_set descr "Check cin works after std::ios::sync_with_stdio(false)"
}
cin_nosync_body()
{
	echo hello >in
	atf_check -o inline:'6\n' "$(atf_get_srcdir)"/h_cin_nosync <in
}

atf_init_test_cases()
{
	atf_add_test_case cin_nosync
}
@


1.2.4.1
log
@file t_sync_with_stdio.sh was added on branch netbsd-10 on 2024-08-23 18:28:09 +0000
@
text
@d1 41
@


1.2.4.2
log
@Pull up following revision(s) (requested by riastradh in ticket #801):

	tests/lib/libstdc++/h_cin_nosync.cc: revision 1.1
	tests/lib/libstdc++/t_sync_with_stdio.sh: revision 1.1
	tests/lib/libstdc++/t_sync_with_stdio.sh: revision 1.2
	etc/mtree/NetBSD.dist.tests: revision 1.204
	distrib/sets/lists/tests/mi: revision 1.1313
	tests/lib/libstdc++/Makefile: revision 1.1
	distrib/sets/lists/debug/mi: revision 1.433
	external/gpl3/gcc/dist/libstdc++-v3/config/io/basic_file_stdio.cc: revision 1.2

libstdc++: Add test for PR lib/58206, sync_with_stdio busted.

libstdc++: Don't try to fflush stdin.

It doesn't work.  It's undefined behaviour.  On NetBSD, it will fail
with EBADF, if fd 0 isn't open for write, or if fd 0 is open for
write, it will write heap garbage to fd 0.

   If stream points to an output stream or an update stream in which
   the most recent operation was not input, the fflush function causes
   any unwritten data for that stream to be delivered to the host
   environment to be written to the file; otherwise, the behavior is
   undefined.
   (ISO C11 and ISO C17, Sec. 7.21.5.2 `The fflush function')

PR lib/58206
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114879
@
text
@a0 41
#	$NetBSD: t_sync_with_stdio.sh,v 1.1 2024/04/28 01:21:27 riastradh Exp $
#
# Copyright (c) 2024 The NetBSD Foundation, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
#    notice, this list of conditions and the following disclaimer in the
#    documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#

cin_nosync_head()
{
	atf_set descr "Check cin works after std::ios::sync_with_stdio(false)"
}
cin_nosync_body()
{
	echo hello >in
	atf_check -o inline:'6\n' "$(atf_get_srcdir)"/h_cin_nosync <in
}

atf_init_test_cases()
{
	atf_add_test_case cin_nosync
}
@


1.1
log
@libstdc++: Add test for PR lib/58206, sync_with_stdio busted.
@
text
@d1 1
a1 1
#	$NetBSD$
a34 1
	atf_expect_fail "PR lib/58206: sync_with_stdio breaks reads from cin"
@

