pg_upgrade permission check - Mailing list pgsql-hackers

From Bruce Momjian
Subject pg_upgrade permission check
Date
Msg-id 201105161510.p4GFA3b19383@momjian.us
Whole thread Raw
Responses Re: pg_upgrade permission check  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
I have added the attached patch to pg_upgrade to print a clear error
message if you don't have read/write/execute permission in the current
directory, which is needed for pg_upgrade to read/write temporary files.

This is based on a bug report I received from EnterpriseDB usage
testing.

--
  Bruce Momjian  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + It's impossible for everything to be true. +
diff --git a/contrib/pg_upgrade/exec.c b/contrib/pg_upgrade/exec.c
new file mode 100644
index 71e8439..a66aeb0
*** a/contrib/pg_upgrade/exec.c
--- b/contrib/pg_upgrade/exec.c
*************** is_server_running(const char *datadir)
*** 93,98 ****
--- 93,103 ----
  void
  verify_directories(void)
  {
+
+     if (access(".", R_OK | W_OK | X_OK) != 0)
+         pg_log(PG_FATAL,
+         "You must have full access permissions in the current directory.\n");
+
      prep_status("Checking old data directory (%s)", old_cluster.pgdata);
      check_data_dir(old_cluster.pgdata);
      check_ok();

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: pg_dump vs casts in extensions
Next
From: Leonardo Francalanci
Date:
Subject: use less space in xl_xact_commit patch