Fix and improve comment in gdb_remote_download

Message ID 1460557393-12354-1-git-send-email-simon.marchi@ericsson.com
State Committed
Headers

Commit Message

Simon Marchi April 13, 2016, 2:23 p.m. UTC
  This patch fixes the current comment in gdb_remote_download, which is
false (the "except if that's already where it is" part).  It also
improves it, by explaining why pass TOFILE through standard_output_file,
even it is an absolute path.

gdb/testsuite/ChangeLog:

	* lib/gdb.exp (gdb_remote_download): Fix and extend comment.
---
 gdb/testsuite/lib/gdb.exp | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
  

Comments

Pedro Alves April 13, 2016, 2:46 p.m. UTC | #1
On 04/13/2016 03:23 PM, Simon Marchi wrote:
> This patch fixes the current comment in gdb_remote_download, which is
> false (the "except if that's already where it is" part).  It also
> improves it, by explaining why pass TOFILE through standard_output_file,
> even it is an absolute path.
> 
> gdb/testsuite/ChangeLog:
> 
> 	* lib/gdb.exp (gdb_remote_download): Fix and extend comment.

OK.

Thanks,
Pedro Alves
  
Simon Marchi April 13, 2016, 2:48 p.m. UTC | #2
On 16-04-13 10:46 AM, Pedro Alves wrote:
> On 04/13/2016 03:23 PM, Simon Marchi wrote:
>> This patch fixes the current comment in gdb_remote_download, which is
>> false (the "except if that's already where it is" part).  It also
>> improves it, by explaining why pass TOFILE through standard_output_file,
>> even it is an absolute path.
>>
>> gdb/testsuite/ChangeLog:
>>
>> 	* lib/gdb.exp (gdb_remote_download): Fix and extend comment.
> 
> OK.
> 
> Thanks,
> Pedro Alves
> 

Thanks, pushed.
  

Patch

diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 1ef6a96..0d8a3b0 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -4211,8 +4211,13 @@  proc gdb_remote_download {dest fromfile {tofile {}}} {
 
 	return $destname
     } else {
-	# When the DEST is local, we copy the file to the test directory
-	# (where the executable is), except if that's already where it is.
+	# When the DEST is local, we copy the file to the test directory (where
+	# the executable is).
+	#
+	# Note that we pass TOFILE through standard_output_file, regardless of
+	# whether it is absolute or relative, because we don't want the tests
+	# to be able to write outside their standard output directory.
+
 	set tofile [standard_output_file $tofile]
 
 	file copy -force $fromfile $tofile