From patchwork Tue Mar 21 12:53:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 66683 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9A5863857B93 for ; Tue, 21 Mar 2023 12:54:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9A5863857B93 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1679403243; bh=clF9UxDA1/QbALrA4UB1Ok5n8f2z5PJJHuf/DKtwLWo=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=LGYjTV2bIW9Obk/aJadXBMuYOywazJ8WYxFPJxLyZlaxldSObwNcy1UT/pBd+wpze YBQujNirXDaVmLq0yWx2LWKQrU9rxtqXVGZiKxSYN95J3xY4SO5s+qpvtYrY0it++A At+WjMAxU+79/YrAbc4bzZGpYcydw8sobCtL+DBM= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by sourceware.org (Postfix) with ESMTPS id 315A03858D37 for ; Tue, 21 Mar 2023 12:53:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 315A03858D37 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-out1.suse.de (Postfix) with ESMTPS id 55CB021D01 for ; Tue, 21 Mar 2023 12:53:40 +0000 (UTC) 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 4280713440 for ; Tue, 21 Mar 2023 12:53:40 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id l6IQD9SoGWRgcgAAMHmgww (envelope-from ) for ; Tue, 21 Mar 2023 12:53:40 +0000 To: gdb-patches@sourceware.org Subject: [pushed 1/2] [gdb/testsuite] Add missing quote in remote-gdbserver-on-localhost.exp Date: Tue, 21 Mar 2023 13:53:40 +0100 Message-Id: <20230321125341.20523-1-tdevries@suse.de> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, 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 X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Tom de Vries via Gdb-patches From: Tom de Vries Reply-To: Tom de Vries Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" In a recent commit I forgot to add a double quote before chmod here: ... remote_exec build $rsh_cmd chmod go-rx ." ... Fix it by adding the missing double quote. --- gdb/testsuite/boards/remote-gdbserver-on-localhost.exp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) base-commit: ccd7caeea05eec1d43a1e63a7784db3570c02db0 diff --git a/gdb/testsuite/boards/remote-gdbserver-on-localhost.exp b/gdb/testsuite/boards/remote-gdbserver-on-localhost.exp index 530e744c9b4..a38edacf130 100644 --- a/gdb/testsuite/boards/remote-gdbserver-on-localhost.exp +++ b/gdb/testsuite/boards/remote-gdbserver-on-localhost.exp @@ -56,7 +56,7 @@ save_vars {rsh_cmd res} { # Make sure build can't see files on remote target. We can't use # remote_exec target, because we're in the middle of parsing the # target board. - remote_exec build $rsh_cmd chmod go-rx ." + remote_exec build $rsh_cmd "chmod go-rx ." } # Set remotedir by default, to force remote_download target to give an From patchwork Tue Mar 21 12:53:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 66684 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 40E5A3858020 for ; Tue, 21 Mar 2023 12:54:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 40E5A3858020 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1679403244; bh=0dPvb4ruxgJnp9wC8mR3KlK1IoGbK0m/W0IMyqpIBKk=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=b6+D4L/uGoV+Wa1WRw0xbj8Dk+DqRFsVhkDo3JaKGV+FG5Bi/J/vPUFg9X4FGJA+c 61+33Vp/TDCWRRUlVWrrvN5i2rpqFX171QujaoB4GlJKMH1/xjMpMa8z8NoKVoi4NQ +jt4ZanKQxdBpAmkVI229p6bIkbi22rax2LwFMPY= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by sourceware.org (Postfix) with ESMTPS id 3A9243858D38 for ; Tue, 21 Mar 2023 12:53:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3A9243858D38 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 6D84320010 for ; Tue, 21 Mar 2023 12:53:40 +0000 (UTC) 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 5B63313440 for ; Tue, 21 Mar 2023 12:53:40 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id MLQzFdSoGWRgcgAAMHmgww (envelope-from ) for ; Tue, 21 Mar 2023 12:53:40 +0000 To: gdb-patches@sourceware.org Subject: [pushed 2/2] [gdb/testsuite] Check remote_exec results in board files Date: Tue, 21 Mar 2023 13:53:41 +0100 Message-Id: <20230321125341.20523-2-tdevries@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230321125341.20523-1-tdevries@suse.de> References: <20230321125341.20523-1-tdevries@suse.de> MIME-Version: 1.0 X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, 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 X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Tom de Vries via Gdb-patches From: Tom de Vries Reply-To: Tom de Vries Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" Make sure the result of each remote_exec in gdb/testsuite/boards/*.exp is checked. Tested on x86_64-linux. --- gdb/testsuite/boards/local-remote-host.exp | 45 +++++++++++-------- .../boards/remote-gdbserver-on-localhost.exp | 14 +++--- 2 files changed, 36 insertions(+), 23 deletions(-) diff --git a/gdb/testsuite/boards/local-remote-host.exp b/gdb/testsuite/boards/local-remote-host.exp index 021b2203d33..e8ac676f788 100644 --- a/gdb/testsuite/boards/local-remote-host.exp +++ b/gdb/testsuite/boards/local-remote-host.exp @@ -32,30 +32,39 @@ if { [info exists REMOTE_HOST_USERNAME] } { set_board_info username $env(USER) } -# Handle separate test account. -if { [board_info $board username] != $env(USER) } { - # We're pretending that some local user account is remote host. - # Make things a bit more realistic by restricting file permissions. - - # Make sure remote host can't see files on build. - remote_exec build "chmod go-rx $objdir" - - # Make sure build can't see files on remote host. We can't use - # remote_exec host, because we're in the middle of parsing the - # host board. - remote_exec build \ - "[board_info $board rsh_prog] \ - -l [board_info $board username] \ - [board_info $board hostname] \ - chmod go-rx ." -} - # The ssh key should be correctly set up that you ssh to localhost # without having to type password. set_board_info rsh_prog /usr/bin/ssh set_board_info rcp_prog /usr/bin/scp set_board_info file_transfer "rsh" +save_vars {rsh_cmd res} { + set rsh_cmd \ + [join \ + [list \ + [board_info $board rsh_prog] \ + -l [board_info $board username] \ + [board_info $board hostname]]] + + # Handle separate test account. + if { [board_info $board username] != $env(USER) } { + # We're pretending that some local user account is remote host. + # Make things a bit more realistic by restricting file permissions. + + # Make sure remote host can't see files on build. + set res [remote_exec build "chmod go-rx $objdir"] + if { [lindex $res 0] != 0 } { + error "Couldn't remove permissions for $objdir on build" + } + + # Make sure build can't see files on remote host. + set res [remote_exec build $rsh_cmd "chmod go-rx ."] + if { [lindex $res 0] != 0 } { + error "Couldn't remove permissions for . on host" + } + } +} + # Like standard_spawn, but force pseudo-tty allocation, with 'ssh -t'. proc ${board}_spawn { board cmd } { diff --git a/gdb/testsuite/boards/remote-gdbserver-on-localhost.exp b/gdb/testsuite/boards/remote-gdbserver-on-localhost.exp index a38edacf130..6e3cbc290a5 100644 --- a/gdb/testsuite/boards/remote-gdbserver-on-localhost.exp +++ b/gdb/testsuite/boards/remote-gdbserver-on-localhost.exp @@ -51,12 +51,16 @@ save_vars {rsh_cmd res} { # Make things a bit more realistic by restricting file permissions. # Make sure remote target can't see files on build. - remote_exec build "chmod go-rx $objdir" + set res [remote_exec build "chmod go-rx $objdir"] + if { [lindex $res 0] != 0 } { + error "Couldn't remove permissions for $objdir on build" + } - # Make sure build can't see files on remote target. We can't use - # remote_exec target, because we're in the middle of parsing the - # target board. - remote_exec build $rsh_cmd "chmod go-rx ." + # Make sure build can't see files on remote target. + set res [remote_exec build $rsh_cmd "chmod go-rx ."] + if { [lindex $res 0] != 0 } { + error "Couldn't remove permissions for . on target" + } } # Set remotedir by default, to force remote_download target to give an