public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: Re: [PATCH 3/9] [gdb/testsuite] Add REMOTE_TARGET_USERNAME in remote-gdbserver-on-localhost.exp
Date: Wed, 9 Nov 2022 21:49:13 +0100	[thread overview]
Message-ID: <a7786939-1f87-a0d7-5c0d-a429ceab2bfd@suse.de> (raw)
In-Reply-To: <82fbd0bb-ac01-ac12-6152-2ef2568c7ba3@suse.de>

[-- Attachment #1: Type: text/plain, Size: 626 bytes --]

On 11/8/22 10:18, Tom de Vries wrote:
> On 11/7/22 17:13, Tom de Vries via Gdb-patches wrote:
>> +    # Make sure remote target can't see files on build.  Note that we're
>> +    # currently using $objdir/output instead of $objdir because of 
>> gdbserver
>> +    # being accessed on the target using 
>> $objdir/../../gdbserver/gdbserver.
>> +    remote_exec build "chmod go-rx $objdir/outputs"
> 
> And this follow-up patch fixes that limitation.

But suffers from the fact that it picks up /usr/bin/gdbserver instead of 
~$remote_user_name/gdbserver.

So, fix this more simply, with this patch.

Thanks,
- Tom

[-- Attachment #2: 0010-gdb-testsuite-Normalize-gdbserver-path-name.patch --]
[-- Type: text/x-patch, Size: 2466 bytes --]

From c66a25f241bb954dcedb28f401e6a9075f2e787f Mon Sep 17 00:00:00 2001
From: Tom de Vries <tdevries@suse.de>
Date: Tue, 8 Nov 2022 09:44:31 +0100
Subject: [PATCH 10/19] [gdb/testsuite] Normalize gdbserver path name

Currently for the target board remote-gdbserver-on-localhost we use the
gdbserver file on build, using a file name which includes "/../".

Fix this by using a normalized file name instead.

This allows us to be more restrictive about which files REMOTE_TARGET_USERNAME
can access:
...
-    remote_exec build "chmod go-rx $objdir/outputs"
+    remote_exec build "chmod go-rx $objdir"
...

Tested on x86_64-linux.
---
 gdb/testsuite/boards/gdbserver-base.exp                | 3 ++-
 gdb/testsuite/boards/remote-gdbserver-on-localhost.exp | 6 ++----
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/gdb/testsuite/boards/gdbserver-base.exp b/gdb/testsuite/boards/gdbserver-base.exp
index 20ee90d6116..633ac7e2342 100644
--- a/gdb/testsuite/boards/gdbserver-base.exp
+++ b/gdb/testsuite/boards/gdbserver-base.exp
@@ -22,7 +22,8 @@ process_multilib_options ""
 set_board_info compiler "[find_gcc]"
 
 # Test the copy of gdbserver in the build directory.
-set_board_info gdb_server_prog "[pwd]/../../gdbserver/gdbserver"
+set_board_info gdb_server_prog \
+    "[file normalize [pwd]/../../gdbserver/gdbserver]"
 
 # gdbserver does not intercept target file operations and perform them
 # on the host.
diff --git a/gdb/testsuite/boards/remote-gdbserver-on-localhost.exp b/gdb/testsuite/boards/remote-gdbserver-on-localhost.exp
index 931fba7fa26..af23eaad083 100644
--- a/gdb/testsuite/boards/remote-gdbserver-on-localhost.exp
+++ b/gdb/testsuite/boards/remote-gdbserver-on-localhost.exp
@@ -42,10 +42,8 @@ if { [board_info $board username] != $env(USER) } {
     # We're pretending that some local user account is remote target.
     # Make things a bit more realistic by restricting file permissions.
 
-    # Make sure remote target can't see files on build.  Note that we're
-    # currently using $objdir/output instead of $objdir because of gdbserver
-    # being accessed on the target using $objdir/../../gdbserver/gdbserver.
-    remote_exec build "chmod go-rx $objdir/outputs"
+    # Make sure remote target can't see files on build.
+    remote_exec build "chmod go-rx $objdir"
 
     # 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
-- 
2.35.3


  reply	other threads:[~2022-11-09 20:49 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-07 16:13 [PATCH 0/9] [gdb/testsuite] Fix remote target test fails Tom de Vries
2022-11-07 16:13 ` [PATCH 1/9] [gdb/testsuite] Fix gdb.base/foll-exec.exp for remote target Tom de Vries
2022-11-07 16:13 ` [PATCH 2/9] [gdb/testsuite] Fix gdb.base/info_sources_2.exp " Tom de Vries
2022-11-07 16:13 ` [PATCH 3/9] [gdb/testsuite] Add REMOTE_TARGET_USERNAME in remote-gdbserver-on-localhost.exp Tom de Vries
2022-11-08  9:18   ` Tom de Vries
2022-11-09 20:49     ` Tom de Vries [this message]
2022-11-15 14:31       ` Tom de Vries
2022-11-07 16:13 ` [PATCH 4/9] [gdb/testsuite] Fix gdb.base/print-file-var.exp for remote target Tom de Vries
2022-11-07 16:13 ` [PATCH 5/9] [gdb/testsuite] Fix gdb.base/infcall-exec.exp " Tom de Vries
2022-11-07 16:13 ` [PATCH 6/9] [gdb/testsuite] Fix gdb.base/solib-vanish.exp " Tom de Vries
2022-11-07 16:13 ` [PATCH 7/9] [gdb/testsuite] Fix gdb.base/info-shared.exp " Tom de Vries
2022-11-07 16:13 ` [PATCH 8/9] [gdb/testsuite] Fix gdb.base/jit-reader-exec.exp " Tom de Vries
2022-11-07 16:13 ` [PATCH 9/9] [gdb/testsuite] Fix gdb.base/jit-elf-so.exp " Tom de Vries
2022-11-15 14:30 ` [PATCH 0/9] [gdb/testsuite] Fix remote target test fails Tom de Vries

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a7786939-1f87-a0d7-5c0d-a429ceab2bfd@suse.de \
    --to=tdevries@suse.de \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).