From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by sourceware.org (Postfix) with ESMTPS id 59DE0388A416 for ; Thu, 27 Oct 2022 14:54:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 59DE0388A416 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id A92571F8DC for ; Thu, 27 Oct 2022 14:54:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1666882450; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=OXyvnCo1j0EuRRy5+4MD5nnse/dR+otQ6zr4T5Ewzy0=; b=XscWbCOFba8F9yWM7ZcV4hhrkZPebjx7j0L+h9wwW5pI10BCkqbFdo9o3fXP6i7TZ7hXyU CyFclq2dP20g/D1P1N6enkTYBXYJX3Ht0riTsewt8IV5c1/JFXFaf/+Q+QEcW3lXrF+Gg8 qvdtvDYNYIOAll+ksyTOKBPUmfWdjjQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1666882450; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=OXyvnCo1j0EuRRy5+4MD5nnse/dR+otQ6zr4T5Ewzy0=; b=v/jkmcaQS2L7okwJXeXRICS3hSkikpj8IJxKdAMnFdIPxnl5KtIN3nwn7VcWggOcUnJpZB eOPaSU+bqqMSrLCQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 94FBB134CA for ; Thu, 27 Oct 2022 14:54:10 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id JZ4rI5KbWmPTHwAAMHmgww (envelope-from ) for ; Thu, 27 Oct 2022 14:54:10 +0000 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [pushed 1/3] [gdb/testsuite] Use remote_exec chmod instead of remote_spawn Date: Thu, 27 Oct 2022 16:54:08 +0200 Message-Id: <20221027145410.22466-1-tdevries@suse.de> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-13.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: I build gdb using -O2, and ran the testsuite using taskset -c 0, and ran into: ... (gdb) PASS: gdb.server/connect-with-no-symbol-file.exp: sysroot=: \ action=delete: setup: adjust sysroot builtin_spawn gdbserver --once localhost:2385 /connect-with-no-symbol-file^M /bin/bash: connect-with-no-symbol-file: Permission denied^M /bin/bash: line 0: exec: connect-with-no-symbol-file: cannot execute: \ Permission denied^M During startup program exited with code 126.^M Exiting^M target remote localhost:2385^M `connect-with-no-symbol-file' has disappeared; keeping its symbols.^M localhost:2385: Connection timed out.^M (gdb) FAIL: gdb.server/connect-with-no-symbol-file.exp: sysroot=: \ action=delete: connection to GDBserver succeeded ... The expected series of events is (skipping disconnect and detach as I don't think they're relevant to the problem): - enter scenario "permission" - cp $exec.bak $exec - gdbserver start with $exec - chmod 000 $exec - connect to gdbserver - enter scenario "delete" - cp $exec.bak $exec - gdbserver start with $exec - delete $exec - connect to gdbserver The problem is that the chmod is executed using remote_spawn: ... } elseif { $action == "permission" } { remote_spawn target "chmod 000 $target_exec" } ... without waiting on the resulting spawn id, so we're not sure when the chmod will have effect. The FAIL we're seeing above is explained by the chmod having effect during the delete scenario, after the "cp $exec.bak $exec" and before the "gdbserver start with $exec". Fix this by using remote_exec instead. Likewise, fix a similar case in gdb.mi/mi-exec-run.exp. Tested on x86_64-linux. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29726 --- gdb/testsuite/gdb.mi/mi-exec-run.exp | 2 +- gdb/testsuite/gdb.server/connect-with-no-symbol-file.exp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gdb/testsuite/gdb.mi/mi-exec-run.exp b/gdb/testsuite/gdb.mi/mi-exec-run.exp index f8e6550850f..3b373b2c84d 100644 --- a/gdb/testsuite/gdb.mi/mi-exec-run.exp +++ b/gdb/testsuite/gdb.mi/mi-exec-run.exp @@ -171,7 +171,7 @@ proc test {inftty_mode mi_mode force_fail} { # Create a not-executable copy of the program, in order to exercise # vfork->exec failing. gdb_remote_download host $binfile $binfile.nox -remote_spawn target "chmod \"a-x\" $binfile.nox" +remote_exec target "chmod \"a-x\" $binfile.nox" foreach_with_prefix inferior-tty {"main" "separate"} { foreach_with_prefix mi {"main" "separate"} { diff --git a/gdb/testsuite/gdb.server/connect-with-no-symbol-file.exp b/gdb/testsuite/gdb.server/connect-with-no-symbol-file.exp index d45e958a529..0ada144a803 100644 --- a/gdb/testsuite/gdb.server/connect-with-no-symbol-file.exp +++ b/gdb/testsuite/gdb.server/connect-with-no-symbol-file.exp @@ -66,7 +66,7 @@ proc connect_no_symbol_file { sysroot action } { if { $action == "delete" } then { remote_file target delete $target_exec } elseif { $action == "permission" } { - remote_spawn target "chmod 000 $target_exec" + remote_exec target "chmod 000 $target_exec" } # Connect to GDBserver. base-commit: f52fb009085e63da25eeacd39990ac6243ffed76 -- 2.35.3