summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2008-07-22 09:20:52 +0200
committerJim Meyering <meyering@redhat.com>2008-07-22 13:15:02 +0200
commit9bb0d5766eeb200dae447a616903f14a0079aa63 (patch)
tree8d29b188d5b47afc1d67a7edce3d2803218af5bc
parent1ee81530c09644492d5926b17174140c0a08ad22 (diff)
downloadcoreutils-9bb0d5766eeb200dae447a616903f14a0079aa63.tar.xz
tests: ensure "make check" w/tainted build dir no longer impacts $HOME
* maint.mk (taint-distcheck): New rule. (maintainer-distcheck): Make it.
-rw-r--r--maint.mk31
1 files changed, 31 insertions, 0 deletions
diff --git a/maint.mk b/maint.mk
index 19b7f121e..eb241b60b 100644
--- a/maint.mk
+++ b/maint.mk
@@ -667,6 +667,7 @@ cvs-check: vc-diff-check
maintainer-distcheck:
$(MAKE) distcheck
+ $(MAKE) taint-distcheck
$(MAKE) my-distcheck
@@ -695,6 +696,36 @@ TMPDIR ?= /tmp
t=$(TMPDIR)/$(PACKAGE)/test
pfx=$(t)/i
+# More than once, tainted build and source directory names would
+# have caused at least one "make check" test to apply "chmod 700"
+# to all directories under $HOME. Make sure it doesn't happen again.
+tp := $(shell echo "$(TMPDIR)/$(PACKAGE)-$$$$")
+t_prefix = $(tp)/a
+t_taint = '$(t_prefix) b'
+fake_home = $(tp)/home
+
+# Ensure that tests run from tainted build and src dir names work,
+# and don't affect anything in $HOME. Create witness files in $HOME,
+# record their attributes, and build/test. Then ensure that the
+# witnesses were not affected.
+taint-distcheck: $(DIST_ARCHIVES)
+ test -d $(t_taint) && chmod -R 700 $(t_taint) || :
+ -rm -rf $(t_taint) $(fake_home)
+ mkdir -p $(t_prefix) $(t_taint) $(fake_home)
+ GZIP=$(GZIP_ENV) $(AMTAR) -C $(t_taint) -zxf $(distdir).tar.gz
+ mkfifo $(fake_home)/fifo
+ touch $(fake_home)/f
+ mkdir -p $(fake_home)/d/e
+ ls -lR $(fake_home) $(t_prefix) > $(tp)/.ls-before
+ cd $(t_taint)/$(distdir) \
+ && ./configure \
+ && $(MAKE) \
+ && HOME=$(fake_home) $(MAKE) check \
+ && ls -lR $(fake_home) $(t_prefix) > $(tp)/.ls-after \
+ && diff $(tp)/.ls-before $(tp)/.ls-after \
+ && test -d $(t_prefix)
+ rm -rf $(tp)
+
# Verify that a twisted use of --program-transform-name=PROGRAM works.
define install-transform-check
rm -rf $(pfx); \