|
|
861f93 |
gdb/testsuite/gdb.base/fileio.c:
|
|
|
861f93 |
gdb/testsuite/gdb.base/fileio.exp:
|
|
|
861f93 |
2007-12-08 Jan Kratochvil <jan.kratochvil@redhat.com>
|
|
|
861f93 |
|
|
|
861f93 |
* gdb.base/fileio.c (ROOTSUBDIR): New macro.
|
|
|
861f93 |
(main): CHDIR into ROOTSUBDIR. CHOWN ROOTSUBDIR and CHDIR into
|
|
|
861f93 |
ROOTSUBDIR if we are being run as root.
|
|
|
861f93 |
* gdb.base/fileio.exp: Change the startup and finish cleanup.
|
|
|
861f93 |
Change the test file reference to be into the `fileio.dir' directory.
|
|
|
861f93 |
|
|
|
861f93 |
|
|
|
861f93 |
sources/gdb/testsuite/gdb.base/dump.exp:
|
|
|
861f93 |
Found on RHEL-5.s390x.
|
|
|
861f93 |
|
|
|
861f93 |
|
|
|
861f93 |
gdb-6.8.50.20090209/gdb/testsuite/gdb.base/auxv.exp:
|
|
|
861f93 |
random FAIL: gdb.base/auxv.exp: matching auxv data from live and gcore
|
|
|
861f93 |
|
|
|
861f93 |
|
|
|
861f93 |
gdb-6.8.50.20090209/gdb/testsuite/gdb.base/annota1.exp:
|
|
|
861f93 |
frames-invalid can happen asynchronously.
|
|
|
861f93 |
|
|
|
861f93 |
Index: gdb-7.4.50.20120103/gdb/testsuite/gdb.base/fileio.c
|
|
|
861f93 |
===================================================================
|
|
|
861f93 |
--- gdb-7.4.50.20120103.orig/gdb/testsuite/gdb.base/fileio.c 2009-10-01 17:39:13.000000000 +0200
|
|
|
861f93 |
+++ gdb-7.4.50.20120103/gdb/testsuite/gdb.base/fileio.c 2012-01-03 15:21:28.122729249 +0100
|
|
|
861f93 |
@@ -58,6 +58,8 @@ system (const char * string);
|
|
|
861f93 |
1) Invalid string/command. - returns 127. */
|
|
|
861f93 |
static const char *strerrno (int err);
|
|
|
861f93 |
|
|
|
861f93 |
+#define ROOTSUBDIR "fileio.dir"
|
|
|
861f93 |
+
|
|
|
861f93 |
#define FILENAME "foo.fileio.test"
|
|
|
861f93 |
#define RENAMED "bar.fileio.test"
|
|
|
861f93 |
#define NONEXISTANT "nofoo.fileio.test"
|
|
|
861f93 |
@@ -542,6 +544,37 @@ strerrno (int err)
|
|
|
861f93 |
int
|
|
|
861f93 |
main ()
|
|
|
861f93 |
{
|
|
|
861f93 |
+ /* ROOTSUBDIR is already prepared by fileio.exp. We use it for easy cleanup
|
|
|
861f93 |
+ (by fileio.exp) if we are run by multiple users in the same directory. */
|
|
|
861f93 |
+
|
|
|
861f93 |
+ if (chdir (ROOTSUBDIR) != 0)
|
|
|
861f93 |
+ {
|
|
|
861f93 |
+ printf ("chdir " ROOTSUBDIR ": %s\n", strerror (errno));
|
|
|
861f93 |
+ exit (1);
|
|
|
861f93 |
+ }
|
|
|
861f93 |
+
|
|
|
861f93 |
+ /* These tests
|
|
|
861f93 |
+ Open for write but no write permission returns EACCES
|
|
|
861f93 |
+ Unlinking a file in a directory w/o write access returns EACCES
|
|
|
861f93 |
+ fail if we are being run as root - drop the privileges here. */
|
|
|
861f93 |
+
|
|
|
861f93 |
+ if (geteuid () == 0)
|
|
|
861f93 |
+ {
|
|
|
861f93 |
+ uid_t uid = 99;
|
|
|
861f93 |
+
|
|
|
861f93 |
+ if (chown (".", uid, uid) != 0)
|
|
|
861f93 |
+ {
|
|
|
861f93 |
+ printf ("chown %d.%d " ROOTSUBDIR ": %s\n", (int) uid, (int) uid,
|
|
|
861f93 |
+ strerror (errno));
|
|
|
861f93 |
+ exit (1);
|
|
|
861f93 |
+ }
|
|
|
861f93 |
+ if (setuid (uid) || geteuid () == 0)
|
|
|
861f93 |
+ {
|
|
|
861f93 |
+ printf ("setuid %d: %s\n", (int) uid, strerror (errno));
|
|
|
861f93 |
+ exit (1);
|
|
|
861f93 |
+ }
|
|
|
861f93 |
+ }
|
|
|
861f93 |
+
|
|
|
861f93 |
/* Don't change the order of the calls. They partly depend on each other */
|
|
|
861f93 |
test_open ();
|
|
|
861f93 |
test_write ();
|
|
|
861f93 |
Index: gdb-7.4.50.20120103/gdb/testsuite/gdb.base/fileio.exp
|
|
|
861f93 |
===================================================================
|
|
|
861f93 |
--- gdb-7.4.50.20120103.orig/gdb/testsuite/gdb.base/fileio.exp 2011-12-26 12:24:55.000000000 +0100
|
|
|
861f93 |
+++ gdb-7.4.50.20120103/gdb/testsuite/gdb.base/fileio.exp 2012-01-03 15:22:02.716601956 +0100
|
|
|
861f93 |
@@ -42,8 +42,8 @@ if [get_compiler_info ${binfile}] {
|
|
|
861f93 |
return -1;
|
|
|
861f93 |
}
|
|
|
861f93 |
|
|
|
861f93 |
-remote_exec build {sh -xc test\ -r\ dir2.fileio.test\ &&\ chmod\ -f\ +w\ dir2.fileio.test}
|
|
|
861f93 |
-remote_exec build {sh -xc rm\ -rf\ *.fileio.test}
|
|
|
861f93 |
+remote_exec build {sh -xc rm\ -rf\ fileio.dir}
|
|
|
861f93 |
+remote_exec build {sh -xc mkdir\ -m777\ fileio.dir}
|
|
|
861f93 |
|
|
|
861f93 |
set oldtimeout $timeout
|
|
|
861f93 |
set timeout [expr "$timeout + 60"]
|
|
|
861f93 |
@@ -85,7 +85,7 @@ gdb_test continue \
|
|
|
861f93 |
|
|
|
861f93 |
gdb_test "continue" ".*" ""
|
|
|
861f93 |
|
|
|
861f93 |
-catch "system \"chmod -f -w nowrt.fileio.test\""
|
|
|
861f93 |
+catch "system \"chmod -f -w fileio.dir/nowrt.fileio.test\""
|
|
|
861f93 |
|
|
|
861f93 |
gdb_test continue \
|
|
|
861f93 |
"Continuing\\..*open 5:.*EACCES$stop_msg" \
|
|
|
861f93 |
@@ -251,8 +251,8 @@ gdb_exit
|
|
|
861f93 |
# Wait till GDB really exits.
|
|
|
861f93 |
sleep 1
|
|
|
861f93 |
|
|
|
861f93 |
-remote_exec build {sh -xc test\ -r\ dir2.fileio.test\ &&\ chmod\ -f\ +w\ dir2.fileio.test}
|
|
|
861f93 |
-remote_exec build {sh -xc rm\ -rf\ *.fileio.test}
|
|
|
861f93 |
+remote_exec build {sh -xc test\ -r\ fileio.dir/dir2.fileio.test\ &&\ chmod\ -f\ +w\ fileio.dir/dir2.fileio.test}
|
|
|
861f93 |
+remote_exec build {sh -xc rm\ -rf\ fileio.dir}
|
|
|
861f93 |
|
|
|
861f93 |
set timeout $oldtimeout
|
|
|
861f93 |
return 0
|