From 8f1ac265e46f3ecdbd3fdfe7bfdae5ea4d93da33 Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Mon, 15 Apr 2019 12:46:06 -0700 Subject: [PATCH] restore-backup: Reset cwd when switching to postgres user. Fixes permission errors when running restore-backup from a cwd inaccessible to the postgres user. Signed-off-by: Anders Kaseorg --- scripts/setup/restore-backup | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/setup/restore-backup b/scripts/setup/restore-backup index ed6d308494..7e6077ec7f 100755 --- a/scripts/setup/restore-backup +++ b/scripts/setup/restore-backup @@ -84,7 +84,7 @@ if __name__ == "__main__": "zulip_base", ] ) - as_postgres = ["su", "-s", "/usr/bin/env", "--", POSTGRES_USER] + as_postgres = ["su", "-s", "/usr/bin/env", "-", "--", POSTGRES_USER] run(as_postgres + ["dropdb", "--if-exists", "--", db_name]) run(as_postgres + ["createdb", "-O", "zulip", "-T", "template0", "--", db_name]) run(as_postgres + ["pg_restore", "-d", db_name, "--", db_dir])