[tor-commits] [tor/master] chgrp the testing tempdir to ourself to clear the sticky bit

nickm at torproject.org nickm at torproject.org
Wed Nov 5 19:28:52 UTC 2014


commit 1dcc49229563192cd43258af5eab97d233146f90
Author: Nick Mathewson <nickm at torproject.org>
Date:   Wed Nov 5 14:27:05 2014 -0500

    chgrp the testing tempdir to ourself to clear the sticky bit
    
    Closes 13678.  Doesn't actually matter for older tors.
---
 changes/bug13678 |    6 ++++++
 src/test/test.c  |    4 ++++
 2 files changed, 10 insertions(+)

diff --git a/changes/bug13678 b/changes/bug13678
new file mode 100644
index 0000000..d71b88a
--- /dev/null
+++ b/changes/bug13678
@@ -0,0 +1,6 @@
+
+  o Testing:
+    - In the unit tests, use 'chgrp' to change the group of the unit test
+      temporary directory to the current user, so that the sticky bit doesn't
+      interfere with tests that check directory groups. Closes 13678.
+
diff --git a/src/test/test.c b/src/test/test.c
index 203b748..8b74c0a 100644
--- a/src/test/test.c
+++ b/src/test/test.c
@@ -123,6 +123,10 @@ setup_directory(void)
   tor_snprintf(temp_dir, sizeof(temp_dir), "/tmp/tor_test_%d_%s",
                (int) getpid(), rnd32);
   r = mkdir(temp_dir, 0700);
+  if (!r) {
+    /* undo sticky bit so tests don't get confused. */
+    r = chown(temp_dir, getuid(), getgid());
+  }
 #endif
   if (r) {
     fprintf(stderr, "Can't create directory %s:", temp_dir);



More information about the tor-commits mailing list