81783d0
gdb/testsuite/gdb.base/fileio.c:
81783d0
gdb/testsuite/gdb.base/fileio.exp:
4a93050
2007-12-08  Jan Kratochvil  <jan.kratochvil@redhat.com>
4a93050
4a93050
	* gdb.base/fileio.c (ROOTSUBDIR): New macro.
4a93050
	(main): CHDIR into ROOTSUBDIR.  CHOWN ROOTSUBDIR and CHDIR into
4a93050
	ROOTSUBDIR if we are being run as root.
4a93050
	* gdb.base/fileio.exp: Change the startup and finish cleanup.
4a93050
	Change the test file reference to be into the `fileio.dir' directory.
4a93050
81783d0
81783d0
sources/gdb/testsuite/gdb.base/dump.exp:
81783d0
Found on RHEL-5.s390x.
81783d0
81783d0
81783d0
gdb-6.8.50.20090209/gdb/testsuite/gdb.base/auxv.exp:
81783d0
random FAIL: gdb.base/auxv.exp: matching auxv data from live and gcore
81783d0
81783d0
81783d0
gdb-6.8.50.20090209/gdb/testsuite/gdb.base/annota1.exp:
81783d0
frames-invalid can happen asynchronously.
81783d0
4a93050
--- ./gdb/testsuite/gdb.base/fileio.c	13 Jun 2006 08:55:22 -0000	1.10
4a93050
+++ ./gdb/testsuite/gdb.base/fileio.c	8 Dec 2007 16:04:10 -0000
4a93050
@@ -58,6 +58,8 @@ system (const char * string);
4a93050
 1) Invalid string/command. -  returns 127.  */
4a93050
 static const char *strerrno (int err);
4a93050
 
4a93050
+#define ROOTSUBDIR "fileio.dir"
4a93050
+
4a93050
 #define FILENAME    "foo.fileio.test"
4a93050
 #define RENAMED     "bar.fileio.test"
4a93050
 #define NONEXISTANT "nofoo.fileio.test"
4a93050
@@ -542,6 +544,37 @@ strerrno (int err)
4a93050
 int
4a93050
 main ()
4a93050
 {
4a93050
+  /* ROOTSUBDIR is already prepared by fileio.exp.  We use it for easy cleanup
4a93050
+     (by fileio.exp) if we are run by multiple users in the same directory.  */
4a93050
+
4a93050
+  if (chdir (ROOTSUBDIR) != 0)
4a93050
+    {
4a93050
+      printf ("chdir " ROOTSUBDIR ": %s\n", strerror (errno));
4a93050
+      exit (1);
4a93050
+    }
4a93050
+
4a93050
+  /* These tests
4a93050
+       Open for write but no write permission returns EACCES
4a93050
+       Unlinking a file in a directory w/o write access returns EACCES
4a93050
+     fail if we are being run as root - drop the privileges here.  */
4a93050
+
4a93050
+  if (geteuid () == 0)
4a93050
+    {
4a93050
+      uid_t uid = 99;
4a93050
+
4a93050
+      if (chown (".", uid, uid) != 0)
4a93050
+	{
4a93050
+	  printf ("chown %d.%d " ROOTSUBDIR ": %s\n", (int) uid, (int) uid,
4a93050
+		  strerror (errno));
4a93050
+	  exit (1);
4a93050
+	}
4a93050
+      if (setuid (uid) || geteuid () == 0)
4a93050
+	{
4a93050
+	  printf ("setuid %d: %s\n", (int) uid, strerror (errno));
4a93050
+	  exit (1);
4a93050
+	}
4a93050
+    }
4a93050
+
4a93050
   /* Don't change the order of the calls.  They partly depend on each other */
4a93050
   test_open ();
4a93050
   test_write ();
4a93050
--- ./gdb/testsuite/gdb.base/fileio.exp	23 Aug 2007 18:14:16 -0000	1.12
4a93050
+++ ./gdb/testsuite/gdb.base/fileio.exp	8 Dec 2007 16:04:10 -0000
4a93050
@@ -46,8 +46,8 @@ if [get_compiler_info ${binfile}] {
4a93050
     return -1;
4a93050
 }
4a93050
 
4a93050
-remote_exec build {sh -xc test\ -r\ dir2.fileio.test\ &&\ chmod\ -f\ +w\ dir2.fileio.test}
4a93050
-remote_exec build {sh -xc rm\ -rf\ *.fileio.test}
4a93050
+remote_exec build {sh -xc rm\ -rf\ fileio.dir}
4a93050
+remote_exec build {sh -xc mkdir\ -m777\ fileio.dir}
4a93050
 
4a93050
 set oldtimeout $timeout
4a93050
 set timeout [expr "$timeout + 60"]
4a93050
@@ -88,7 +88,7 @@ gdb_test continue \
4a93050
 "Opening nonexistant file returns ENOENT"
4a93050
 
4a93050
 send_gdb "continue\n" ; gdb_expect -re "$gdb_prompt $"
4a93050
-catch "system \"chmod -f -w nowrt.fileio.test\""
4a93050
+catch "system \"chmod -f -w fileio.dir/nowrt.fileio.test\""
4a93050
 
4a93050
 gdb_test continue \
4a93050
 "Continuing\\..*open 5:.*EACCES$stop_msg" \
4a93050
@@ -252,8 +252,8 @@ gdb_test continue \
4a93050
 send_gdb "quit\n"
4a93050
 send_gdb "y\n"
4a93050
 
4a93050
-remote_exec build {sh -xc test\ -r\ dir2.fileio.test\ &&\ chmod\ -f\ +w\ dir2.fileio.test}
4a93050
-remote_exec build {sh -xc rm\ -rf\ *.fileio.test}
4a93050
+remote_exec build {sh -xc test\ -r\ fileio.dir/dir2.fileio.test\ &&\ chmod\ -f\ +w\ fileio.dir/dir2.fileio.test}
4a93050
+remote_exec build {sh -xc rm\ -rf\ fileio.dir}
4a93050
 
4a93050
 set timeout $oldtimeout
4a93050
 return 0
10f824b
--- sources/gdb/testsuite/gdb.base/dump.exp-orig	2008-08-28 11:44:40.000000000 +0200
10f824b
+++ sources/gdb/testsuite/gdb.base/dump.exp	2008-08-28 11:44:49.000000000 +0200
10f824b
@@ -493,8 +493,10 @@ if ![string compare $is64bitonly "no"] t
10f824b
   gdb_test "print zero_all ()" "" ""
10f824b
 
10f824b
   # restore with expressions 
10f824b
+  # Address may fit in int32 but its negative result would be 0xffffxxxx for
10f824b
+  # 64-bit LONGEST addresses.
10f824b
   test_restore_saved_value \
10f824b
-	"intarr3.srec ${array2_start}-${array_start} &intarray\[3\] &intarray\[4\]" \
10f824b
+	"intarr3.srec (long)${array2_start}-${array_start} &intarray\[3\] &intarray\[4\]" \
10f824b
 	"array partial with expressions" 4 "intarray2\[3\]"
10f824b
 
10f824b
   gdb_test "print intarray2\[2\] == 0" " = 1" "element 2 not changed, == 4"
81783d0
--- gdb-6.8.50.20090209/gdb/testsuite/gdb.base/annota1.exp-orig	2009-02-09 16:31:11.000000000 +0100
81783d0
+++ gdb-6.8.50.20090209/gdb/testsuite/gdb.base/annota1.exp	2009-02-09 21:27:38.000000000 +0100
81783d0
@@ -286,7 +286,7 @@ if [target_info exists gdb,nosignals] {
81783d0
 } else {
81783d0
     send_gdb "signal SIGUSR1\n"
81783d0
     gdb_expect {
81783d0
-	-re "\r\n\032\032post-prompt\r\nContinuing with signal SIGUSR1.\r\n\r\n\032\032starting\r\n\r\n\032\032frames-invalid\r\n\r\n\032\032breakpoint 2\r\n\r\nBreakpoint 2, \r\n\032\032frame-begin 0 $hex\r\n\r\n\032\032frame-function-name\r\nhandle_USR1\r\n\032\032frame-args\r\n \\(\r\n\032\032arg-begin\r\nsig\r\n\032\032arg-name-end\r\n=\r\n\032\032arg-value -\r\n$decimal\r\n\032\032arg-end\r\n\\)\r\n\032\032frame-source-begin\r\n at \r\n\032\032frame-source-file\r\n${escapedsrcfile}\r\n\032\032frame-source-file-end\r\n:\r\n\032\032frame-source-line\r\n.*\r\n\032\032frame-source-end\r\n\r\n\r\n\032\032source.*annota1.c:.*:.*:beg:$hex\r\n\r\n\032\032frame-end\r\n\r\n\032\032stopped\r\n$gdb_prompt$" \
81783d0
+	-re "\r\n\032\032post-prompt\r\nContinuing with signal SIGUSR1.\r\n\r\n\032\032starting\r\n(\r\n\032\032frames-invalid\r\n)*\r\n\032\032breakpoint 2\r\n\r\nBreakpoint 2, \r\n\032\032frame-begin 0 $hex\r\n\r\n\032\032frame-function-name\r\nhandle_USR1\r\n\032\032frame-args\r\n \\(\r\n\032\032arg-begin\r\nsig\r\n\032\032arg-name-end\r\n=\r\n\032\032arg-value -\r\n$decimal\r\n\032\032arg-end\r\n\\)\r\n\032\032frame-source-begin\r\n at \r\n\032\032frame-source-file\r\n${escapedsrcfile}\r\n\032\032frame-source-file-end\r\n:\r\n\032\032frame-source-line\r\n.*\r\n\032\032frame-source-end\r\n\r\n\r\n\032\032source.*annota1.c:.*:.*:beg:$hex\r\n\r\n\032\032frame-end\r\n\r\n\032\032stopped\r\n$gdb_prompt$" \
81783d0
 	    { pass "send SIGUSR1" }
81783d0
 	-re "\r\n\032\032post-prompt\r\nContinuing with signal SIGUSR1.\r\n\r\n\032\032starting\r\n\r\n\032\032frames-invalid\r\n\r\n\032\032breakpoint 2\r\n\r\nBreakpoint 2, \r\n\032\032frame-begin 0 $hex\r\n\r\n\032\032frame-function-name\r\nhandle_USR1\r\n\032\032frame-args\r\n \\(\r\n\032\032arg-begin\r\nsig\r\n\032\032arg-name-end\r\n=\r\n\032\032arg-value -\r\n$decimal\r\n\032\032arg-end\r\n\\)\r\n\032\032frame-source-begin\r\n at \r\n\032\032frame-source-file\r\n.*${srcfile}\r\n\032\032frame-source-file-end\r\n:\r\n\032\032frame-source-line\r\n.*\r\n\032\032frame-source-end\r\n\r\n\r\n\032\032source.*annota1.c:.*:.*:beg:$hex\r\n\r\n\032\032frame-end\r\n\r\n\032\032stopped\r\n$gdb_prompt$" \
81783d0
 	    { setup_xfail "*-*-*" 1270
81783d0
--- ./gdb/testsuite/gdb.base/auxv.exp	2009-02-11 00:54:54.000000000 +0100
81783d0
+++ ./gdb/testsuite/gdb.base/auxv.exp	2009-02-11 00:51:30.000000000 +0100
81783d0
@@ -78,8 +78,10 @@ proc fetch_auxv {test} {
81783d0
 
81783d0
     set auxv_lines {}
81783d0
     set bad -1
81783d0
+    # Former trailing `\[\r\n\]+' may eat just \r leaving \n in the buffer
81783d0
+    # corrupting the next matches.
81783d0
     if {[gdb_test_multiple "info auxv" $test {
81783d0
-	-re "info auxv\[\r\n\]+" {
81783d0
+	-re "info auxv\r\n" {
81783d0
 	    exp_continue
81783d0
 	}
81783d0
 	-ex "The program has no auxiliary information now" {
81783d0
@@ -94,20 +96,20 @@ proc fetch_auxv {test} {
81783d0
 	    set bad 1
81783d0
 	    exp_continue
81783d0
 	}
81783d0
-	-re "^\[0-9\]+\[ \t\]+(AT_\[^ \t\]+)\[^\r\n\]+\[\r\n\]+" {
81783d0
+	-re "^\[0-9\]+\[ \t\]+(AT_\[^ \t\]+)\[^\r\n\]+\r\n" {
81783d0
 	    lappend auxv_lines $expect_out(0,string)
81783d0
 	    exp_continue
81783d0
 	}
81783d0
-	-re "^\[0-9\]+\[ \t\]+\\?\\?\\?\[^\r\n\]+\[\r\n\]+" {
81783d0
+	-re "^\[0-9\]+\[ \t\]+\\?\\?\\?\[^\r\n\]+\r\n" {
81783d0
 	    warning "Unrecognized tag value: $expect_out(0,string)"
81783d0
 	    set bad 1
81783d0
 	    lappend auxv_lines $expect_out(0,string)
81783d0
 	    exp_continue
81783d0
 	}
81783d0
-	-re ".*$gdb_prompt $" {
81783d0
+	-re "$gdb_prompt $" {
81783d0
 	    incr bad
81783d0
 	}
81783d0
-	-re "^\[^\r\n\]+\[\r\n\]+" {
81783d0
+	-re "^\[^\r\n\]+\r\n" {
81783d0
 	    if {!$bad} {
81783d0
 		warning "Unrecognized output: $expect_out(0,string)"
81783d0
 		set bad 1
81783d0
--- ./gdb/testsuite/gdb.base/callfuncs.exp	2009-01-03 06:58:03.000000000 +0100
81783d0
+++ ./gdb/testsuite/gdb.base/callfuncs.exp	2009-02-11 00:51:42.000000000 +0100
81783d0
@@ -249,15 +249,17 @@ proc fetch_all_registers {test} {
81783d0
 
81783d0
     set all_registers_lines {}
81783d0
     set bad -1
81783d0
+    # Former trailing `\[\r\n\]+' may eat just \r leaving \n in the buffer
81783d0
+    # corrupting the next matches.
81783d0
     if {[gdb_test_multiple "info all-registers" $test {
81783d0
-	-re "info all-registers\[\r\n\]+" {
81783d0
+	-re "info all-registers\r\n" {
81783d0
 	    exp_continue
81783d0
 	}
81783d0
 	-ex "The program has no registers now" {
81783d0
 	    set bad 1
81783d0
 	    exp_continue
81783d0
 	}
81783d0
-	-re "^bspstore\[ \t\]+\[^\r\n\]+\[\r\n\]+" {
81783d0
+	-re "^bspstore\[ \t\]+\[^\r\n\]+\r\n" {
81783d0
 	    if [istarget "ia64-*-*"] {
81783d0
 		# Filter out bspstore which is specially tied to bsp,
81783d0
 		# giving spurious differences.
81783d0
@@ -266,14 +268,14 @@ proc fetch_all_registers {test} {
81783d0
 	    }
81783d0
 	    exp_continue
81783d0
 	}
81783d0
-	-re "^\[^ \t\]+\[ \t\]+\[^\r\n\]+\[\r\n\]+" {
81783d0
+	-re "^\[^ \t\]+\[ \t\]+\[^\r\n\]+\r\n" {
81783d0
 	    lappend all_registers_lines $expect_out(0,string)
81783d0
 	    exp_continue
81783d0
 	}
81783d0
-	-re ".*$gdb_prompt $" {
81783d0
+	-re "$gdb_prompt $" {
81783d0
 	    incr bad
81783d0
 	}
81783d0
-	-re "^\[^\r\n\]+\[\r\n\]+" {
81783d0
+	-re "^\[^\r\n\]+\r\n" {
81783d0
 	    if {!$bad} {
81783d0
 		warning "Unrecognized output: $expect_out(0,string)"
81783d0
 		set bad 1