Who decided this part of pg_regress.c was a good idea?
/* try to create the test tablespace dir if it doesn't exist */snprintf(testtablespace, MAXPGPATH, "%s/testtablespace",
abs_builddir);if(directory_exists(testtablespace)) rmtree(testtablespace, true);make_directory(testtablespace);
The regression test Makefile is responsible for preparing that
directory, not pg_regress. This is important because in the Postgres
RPMs, we have to be careful to appease SELinux:
# The tests command the server to write into testtablespace and results.
# On a SELinux-enabled system this will fail unless we mark those directories
# as writable by the server.
cleandirs:-rm -rf testtablespace resultsmkdir testtablespace results[ -x /usr/bin/chcon ] && /usr/bin/chcon -u system_u
-robject_r -t postgresql_db_t testtablespace results
By blowing away the directory and remaking it, pg_regress causes this
carefully-applied labeling to be lost.
As far as I can see the rmtree/make_directory thrashing is useless, and
I'm going to remove it unless a pretty good counter-argument is made.
regards, tom lane