|From:||"Graham Leggett" <minfrin(at)sharp(dot)fm>|
|Subject:||BUG #4116: Cannot create tablespace: could not set permissions on directory|
|Views:||Raw Message | Whole Thread | Download mbox | Resend email|
The following bug has been logged online:
Bug reference: 4116
Logged by: Graham Leggett
Email address: minfrin(at)sharp(dot)fm
PostgreSQL version: 8.1.11
Operating system: Redhat Enterprise 5
Description: Cannot create tablespace: could not set permissions on
While making an attempt to create a tablespace, where the tablespace
directory has already been created, has the correct ownership, and has the
correct permissions (0700), the attempt will fail regardless:
postgres=# CREATE TABLESPACE fma LOCATION '/home/fma/db/pgsql';
ERROR: could not set permissions on directory "/home/fma/db/pgsql":
Looking in the source, the error message "could not set permissions on
directory" appears here:
01284 * Attempt to coerce target directory to safe permissions. If
01285 * fails, it doesn't exist or has the wrong owner.
01287 if (chmod(location, 0700) != 0)
01290 errmsg("could not set permissions on directory
This code makes the incorrect assumption that the platform will allow the
postgres user to set the permissions using chmod.
What this code should be doing is checking that the permissions on the
directory are 0700, and failing if they are not, leaving it up to the user
to fix the problem.
Redhat Enterprise Linux 5 refuses to allow a user to chmod a directory, even
though that user owns that directory. In addition, if SELinux is enabled,
this gives a further reason why the code will fail.
To fix this, check that the mode is 0700, don't try to set it.
|Next Message||Tom Lane||2008-04-19 15:26:57||Re: Inconsistent shift operator|
|Previous Message||Daniel Ruoso||2008-04-19 11:38:24||BUG #4115: PostgreSQL ISO format is not really ISO|