Recent pg_regress changes break testing under SELinux - Mailing list pgsql-hackers

From Tom Lane
Subject Recent pg_regress changes break testing under SELinux
Date
Msg-id 11718.1200684807@sss.pgh.pa.us
Whole thread Raw
Responses Re: Recent pg_regress changes break testing under SELinux  (Alvaro Herrera <alvherre@commandprompt.com>)
List pgsql-hackers
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


pgsql-hackers by date:

Previous
From: "Kevin Grittner"
Date:
Subject: Re: testing result overview (was: 8.3 beta testing suggestions welcome)
Next
From: Tom Lane
Date:
Subject: Re: proposal: generic function, constructor function