Skip tests that require sane behavior wrt permissions if the current uid is 0. So now if you run fakeroot sh -c ' make all test install install-doc prefix=/usr/local \ DESTDIR=wherever >packaged-git.log 2>&1 && cd wherever && tar -cf - . | gzip ' >packaged-git.tar.gz then this should successfully build a binary tarball for git, running some tests while at it. Signed-off-by: Jonathan Nieder <jrnieder@xxxxxxxxx> --- Goals ----- Before the POSIXPERM mechanism existed (which makes this change too easy to avoid considering), I think many people wanted to discourage running tests as root to avoid hosing people’s machines. Which makes some sense. But it is possible and may even be valuable to run tests in a sandbox. [1] [8] If that were the only reason to run tests as root, I would suggest requiring some particular environment variable to be set as a safety. In Debian, I think it might be policy to allow building as “root”. In this context, that almost always happens through some sort of ptrace or LD_PRELOAD hack like fakeroot. If a user knows to, it is easy to fall back to building as an unprivileged user, but really I think a user should not have to know to. [2] [3] If some non-POSIXPERM test fails when run as (fake) root, that is something that would be nice to know. [4] Which prerequisite? ------------------- It is possible to use autoconf-style tests to check for each capability we would like to lack. [5] Certainly, POSIXPERM does not actually describe the exact set of abilities one gains by running as an unprivileged user. [6] But unsetting POSIXPERM does successfully convey a simple truth: if you run tests as root, you have lost the ability to pay attention to permissions and keep your sanity. [7] [1] http://thread.gmane.org/gmane.comp.version-control.git/86885/focus=87664 [2] http://thread.gmane.org/gmane.comp.version-control.git/140128 [3] http://thread.gmane.org/gmane.comp.version-control.git/17904/focus=17910 [4] http://thread.gmane.org/gmane.comp.version-control.git/75561/focus=75568 [5] http://thread.gmane.org/gmane.comp.version-control.git/18667 [6] http://thread.gmane.org/gmane.comp.version-control.git/121502/focus=121531 [7] http://thread.gmane.org/gmane.comp.version-control.git/116729/focus=118385 [8] http://thread.gmane.org/gmane.comp.version-control.git/52654/focus=52689 Holy cow, that Solaris bug is still not fixed [9]. Maybe it would be worthwhile to make an unlink() wrapper in compat/ to avoid new uses leaving users on such operating systems in danger. [9] http://bugs.opensolaris.org/view_bug.do?bug_id=6581318 Thanks for reading. I hope the story was not too dull. t/test-lib.sh | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/t/test-lib.sh b/t/test-lib.sh index a53b6cf..0f51757 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -782,7 +782,10 @@ case $(uname -s) in # exec does not inherit the PID ;; *) - test_set_prereq POSIXPERM + if test $(id -u) != 0 + then + test_set_prereq POSIXPERM + fi test_set_prereq BSLASHPSPEC test_set_prereq EXECKEEPSPID ;; -- 1.7.1.rc1 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html