From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id md/NN6hmFWrYwhwAWB0awg (envelope-from ) for ; Tue, 26 May 2026 05:23:52 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=o9SEYfQE; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=YeZpvQs/; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=o9SEYfQE; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=YeZpvQs/; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id DF96F1E0A3; Tue, 26 May 2026 05:23:52 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [38.145.34.32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 4C9FF1E062 for ; Tue, 26 May 2026 05:23:51 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 305454BA5435 for ; Tue, 26 May 2026 09:23:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 305454BA5435 Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=o9SEYfQE; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=YeZpvQs/; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=o9SEYfQE; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=YeZpvQs/ Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) by sourceware.org (Postfix) with ESMTPS id 671F14BA2E3A for ; Tue, 26 May 2026 09:22:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 671F14BA2E3A Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 671F14BA2E3A Authentication-Results: sourceware.org; arc=none smtp.remote-ip=195.135.223.131 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1779787347; cv=none; b=Cl9pb55n/bVRAs+RSz+Ta9dmc4cZko1wlPsiAFf4BuVIFEeMc3qNAoLQUB5OVsNeLo5behpEpl3g8kht9JlYS7LfUfSj46VR1xE3rZ8VGBhuML7IHwI2zVRhFClqWLYLjHIttXySfO/gXtWlVRLS0JVEc9MKprfq6/n4ob/qjuo= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1779787347; c=relaxed/simple; bh=VXR0uk22aEQ38YEtEANXwNBwkjiY3GoFMxIOUkXZpjQ=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature: Message-ID:Date:MIME-Version:Subject:To:From; b=kb0BjiWRKdqHbHb+QFnnnETot0aIhNxlEdiYOXcDsI4wssYgsaIXulP99RhrPkfSA3tHyzTGgkLeDRWBZaJdka4blpYjCYjizoX3+qOrPhLLMdFFnyiVcGW91JmYnmGIgOqYda6y1Xgl86DE+9VvHv8EYIh6quUfTWXOsQDndu8= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=o9SEYfQE; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=YeZpvQs/; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=o9SEYfQE; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=YeZpvQs/ DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 671F14BA2E3A Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 1E3ED67233; Tue, 26 May 2026 09:22:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1779787340; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5bRDF8XDeptXiR3WOW83t5irjEUNv/KWi+ylorJnsUY=; b=o9SEYfQEIXMd0GAO3B82amOkowVX88YI7Dfn7HGc5dD0oc2o6OkeaPVQf7pxonP77vg/Hg tuQvg4owOy31ocz7BwJ4IVP9A0tSa/Y866GyTQpBS0XCHxdVsNrTvvWxeg2v0GH/XgvmGC JNlfjd8I4dLzVP2aA0SJNdX9XZIph/4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1779787340; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5bRDF8XDeptXiR3WOW83t5irjEUNv/KWi+ylorJnsUY=; b=YeZpvQs/ldLGW5cC3DAf3ddMnm8GZyK7IeGgCCosq93fsHuxNVehOKbVIMkvTuezMKnJ+l CHEuTrBxkB+ny/DQ== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=o9SEYfQE; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b="YeZpvQs/" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1779787340; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5bRDF8XDeptXiR3WOW83t5irjEUNv/KWi+ylorJnsUY=; b=o9SEYfQEIXMd0GAO3B82amOkowVX88YI7Dfn7HGc5dD0oc2o6OkeaPVQf7pxonP77vg/Hg tuQvg4owOy31ocz7BwJ4IVP9A0tSa/Y866GyTQpBS0XCHxdVsNrTvvWxeg2v0GH/XgvmGC JNlfjd8I4dLzVP2aA0SJNdX9XZIph/4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1779787340; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5bRDF8XDeptXiR3WOW83t5irjEUNv/KWi+ylorJnsUY=; b=YeZpvQs/ldLGW5cC3DAf3ddMnm8GZyK7IeGgCCosq93fsHuxNVehOKbVIMkvTuezMKnJ+l CHEuTrBxkB+ny/DQ== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 06D8D5A126; Tue, 26 May 2026 09:22:19 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id ZUpsO0tmFWqkegAAD6G6ig (envelope-from ); Tue, 26 May 2026 09:22:19 +0000 Message-ID: <6032850a-7dcf-4daf-8b1e-258ab0906754@suse.de> Date: Tue, 26 May 2026 11:22:19 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] [gdb/testsuite, Tcl 9] Fix EILSEQ problems for UTF8 related tests To: Kevin Buettner , gdb-patches@sourceware.org References: <20260525051442.2805651-2-kevinb@redhat.com> Content-Language: en-US From: Tom de Vries In-Reply-To: <20260525051442.2805651-2-kevinb@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 1E3ED67233 X-Rspamd-Action: no action X-Spamd-Result: default: False [-4.51 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; RCVD_TLS_ALL(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; MIME_TRACE(0.00)[0:+]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; MID_RHS_MATCH_FROM(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCVD_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:rdns,imap1.dmz-prg2.suse.org:helo,suse.de:email,suse.de:mid,suse.de:dkim]; DNSWL_BLOCKED(0.00)[2a07:de40:b281:106:10:150:64:167:received]; TO_MATCH_ENVRCPT_ALL(0.00)[]; internal_greylist_whitelist(0.00)[2a07:de40:b281:104:10:150:64:97]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org On 5/25/26 7:14 AM, Kevin Buettner wrote: > On Fedora 44 and Rawhide (Fedora 45), these tests... > > gdb.ada/non-ascii-utf-8.exp > gdb.base/utf8-identifiers.exp > gdb.rust/unicode.exp > > ...all die due to these errors: > > Running ...gdb/testsuite/gdb.base/utf8-identifiers.exp ... > ERROR: tcl error sourcing .../gdb/testsuite/gdb.base/utf8-identifiers.exp. > ERROR: tcl error code POSIX EILSEQ {invalid or incomplete multibyte or wide character} > error writing "file6": invalid or incomplete multibyte or wide character > ... > > (I've shortened some of the pathnames for brevity.) > > These Fedora systems are using Tcl 9 and also an updated version of > dejagnu with this change applied: > > * Thu Apr 16 2026 Jakub Jelinek - 1:1.6.3-17 > - Apply full set of Tcl 9 compatibility fixes from upstream PR80674 branch > (#2448542) > > That runtest change is responsible for the POSIX EILSEQ errors on > machines with that change. The change to runtest causing the change > in behavior for GDB is the addition of these lines near the top of > the runtest script: > > # Ensure that DejaGnu will be run in the POSIX locale > LC_ALL=C > export LC_ALL > > TCL 8 used a permissive encoding strategy: bytes that could not be > represented in the current encoding were silently mangled or > substituted. TCL 9 changed this default to a strict profile, which > means that any attempt to write a character that cannot be expressed > in the channel's encoding raises a POSIX EILSEQ error ("invalid or > incomplete multibyte or wide character"). > > So, together, this Tcl 9 behavior combined with the dejagnu change > to runtest causes the EILSEQ error for the tests mentioned earlier. > > Fix it by using "fconfigure $handle -encoding utf-8 -profile replace" > in proc spawn_capture_tty_name, and proc gdb_stdin_log_init. Also, > the open_logs wrapper has been changed to invoke fconfigure using only > "-encoding utf-8". Testing showed that "-profile replace" wasn't > necessary there. > Hi Kevin, this LGTM, so: Reviewed-By: Tom de Vries I also reviewed this using Claude code, and there were two notes: - using catch for one fconfigure, but not the other two. - it might be a good idea to add a comment in open_logs to make it explicit that unlike elsewhere, "-profile replace" isn't used. Thanks, - Tom > Tested on Fedora 28 (Tcl 8.6.8), Fedora 43 (Tcl 9.0.2 / 8.6.16; expect > uses 8.6.16), Fedora 44 (Tcl 9.0.2 / 8.6.17; expect uses 9.0.2), and > Rawhide / Fedora 45 (Tcl 9.0.3 / 8.6.18; expect uses 9.0.3). > --- > gdb/testsuite/lib/gdb.exp | 33 +++++++++++++++++++++++++++++++++ > 1 file changed, 33 insertions(+) > > diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp > index 28709004570..52e4be9122d 100644 > --- a/gdb/testsuite/lib/gdb.exp > +++ b/gdb/testsuite/lib/gdb.exp > @@ -166,6 +166,27 @@ proc load_lib { file } { > return $result > } > > +# Tcl 9.0 changed the default channel encoding profile to "strict". When > +# runtest sets LC_ALL=C the system encoding is iso8859-1, so file channels > +# opened by DejaGNU (gdb.sum, gdb.log) and spawn channels (for GDB and > +# subprocesses) default to iso8859-1 with strict profile. Writing > +# non-Latin-1 characters in test names then raises EILSEQ, and sending them > +# to GDB truncates the command at the unrepresentable character. > +# > +# Fix this by: > +# 1. Overriding open_logs to reconfigure gdb.sum to utf-8 after DejaGNU > +# opens it with the system (iso8859-1) encoding. > +# 2. Reconfiguring each new spawn channel to utf-8 in > +# spawn_capture_tty_name, which wraps every spawn call. > +# 3. Reconfiguring gdb.in to utf-8 in gdb_stdin_log_init. > + > +rename open_logs saved_open_logs > +proc open_logs {} { > + saved_open_logs > + global sum_file > + fconfigure $sum_file -encoding utf-8 > +} > + > load_lib libgloss.exp > load_lib cache.exp > load_lib gdb-utils.exp > @@ -2633,6 +2654,7 @@ proc gdb_file_cmd { arg {kill_flag 1} } { > proc spawn_capture_tty_name { args } { > set result [uplevel builtin_spawn $args] > upvar spawn_out spawn_out > + upvar spawn_id spawn_id > if { [info exists spawn_out(slave,name)] } { > set ::last_spawn_tty_name $spawn_out(slave,name) > } else { > @@ -2648,6 +2670,12 @@ proc spawn_capture_tty_name { args } { > # use -nocomplain here we would otherwise get an error. > unset -nocomplain ::last_spawn_tty_name > } > + # Tcl 9.0 defaults spawn channels to iso8859-1/strict, which raises > + # EILSEQ when non-Latin-1 characters (e.g. function names with UTF-8 > + # letters) are written to or read from the channel. Use utf-8 instead. > + if {[tcl_version_at_least 9 0 0]} { > + catch {fconfigure $spawn_id -encoding utf-8 -profile replace} > + } > return $result > } > > @@ -10419,6 +10447,11 @@ proc gdb_stdin_log_init { } { > set logfile [standard_output_file_with_gdb_instance gdb.in] > set in_file [open $logfile w] > > + if {[tcl_version_at_least 9 0 0]} { > + # Tcl 9 strict profile: gdb.in must accept UTF-8 command strings. > + fconfigure $in_file -encoding utf-8 -profile replace > + } > + > verbose -log "" > verbose -log "Starting logfile: $logfile" > verbose -log ""