Don't try to create a temp install without abs_top_builddir.
authorRobert Haas
Mon, 28 Sep 2015 14:47:05 +0000 (10:47 -0400)
committerRobert Haas
Mon, 28 Sep 2015 14:52:19 +0000 (10:52 -0400)
Otherwise, we effectively act as if abs_top_builddir were the root
directory, which is quite dangerous if the user happens to have
permissions to do things there.  This can crop up in PGXS builds,
for example.

Report by Sandro Santilli, patch by me, review by Noah Misch.

src/Makefile.global.in

index e2c8aeacd40bbc19e3264a531d37a66ac77048d0..13755148b55a18930e1c0985d96300c47cc9ee46 100644 (file)
@@ -320,6 +320,7 @@ check: temp-install
 .PHONY: temp-install
 temp-install:
 ifndef NO_TEMP_INSTALL
+ifneq ($(abs_top_builddir),)
 ifeq ($(MAKELEVEL),0)
    rm -rf '$(abs_top_builddir)'/tmp_install
    $(MKDIR_P) '$(abs_top_builddir)'/tmp_install/log
@@ -327,6 +328,7 @@ ifeq ($(MAKELEVEL),0)
 endif
    $(if $(EXTRA_INSTALL),for extra in $(EXTRA_INSTALL); do $(MAKE) -C '$(top_builddir)'/$$extra DESTDIR='$(abs_top_builddir)'/tmp_install install >>'$(abs_top_builddir)'/tmp_install/log/install.log || exit; done)
 endif
+endif
 
 PROVE = @PROVE@
 PG_PROVE_FLAGS = -I $(top_srcdir)/src/test/perl/