keiths / rpms / gdb

Forked from rpms/gdb 16 days ago
Clone
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
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
c499105
c499105
c499105
c499105
2008-04-21  Jan Kratochvil  <jan.kratochvil@redhat.com>
c499105
c499105
	* ada-lang.c (get_selections): Variable PROMPT made non-const and
c499105
	initialized with a trailing space now.  Use PROMPT_ARG of
c499105
	COMMAND_LINE_INPUT instead of printing it ourselves.
c499105
c499105
--- ./gdb/ada-lang.c	6 Apr 2008 08:56:36 -0000	1.137
c499105
+++ ./gdb/ada-lang.c	21 Apr 2008 13:33:42 -0000
c499105
@@ -3424,18 +3424,15 @@ get_selections (int *choices, int n_choi
c499105
                 int is_all_choice, char *annotation_suffix)
c499105
 {
c499105
   char *args;
c499105
-  const char *prompt;
c499105
+  char *prompt;
c499105
   int n_chosen;
c499105
   int first_choice = is_all_choice ? 2 : 1;
c499105
 
c499105
   prompt = getenv ("PS2");
c499105
   if (prompt == NULL)
c499105
-    prompt = ">";
c499105
+    prompt = "> ";
c499105
 
c499105
-  printf_unfiltered (("%s "), prompt);
c499105
-  gdb_flush (gdb_stdout);
c499105
-
c499105
-  args = command_line_input ((char *) NULL, 0, annotation_suffix);
c499105
+  args = command_line_input (prompt, 0, annotation_suffix);
c499105
 
c499105
   if (args == NULL)
c499105
     error_no_arg (_("one or more choice numbers"));
10f824b
10f824b
10f824b
10f824b
Found on RHEL-5.s390x.
10f824b
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"