From: Justin Pryzby <pryzby@telsasoft.com>
To: Michael Paquier <michael@paquier.xyz>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Daniel Gustafsson <daniel@yesql.se>
Cc: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
Cc: Andrew Dunstan <andrew@dunslane.net>
Cc: Bruce Momjian <bruce@momjian.us>
Cc: pgsql-hackers@lists.postgresql.org
Subject: Re: pg_upgrade should truncate/remove its logs before running
Date: Wed, 19 Jan 2022 18:05:40 -0600
Message-ID: <20220120000540.GG23027@telsasoft.com> (raw)
In-Reply-To: <YefIHrNYTNH/PML4@paquier.xyz>
References: <20211221033926.GX17618@telsasoft.com>
<YcLYAPsiDlWF6w7o@paquier.xyz>
<238201.1640184746@sss.pgh.pa.us>
<20211222163611.GC17618@telsasoft.com>
<20220108184857.GI14051@telsasoft.com>
<Yd00xmV+rdffAQxf@paquier.xyz>
<20220111200307.GA14051@telsasoft.com>
<Yd5SOupY+FHbiXLD@paquier.xyz>
<20220112040813.GD14051@telsasoft.com>
<YefIHrNYTNH/PML4@paquier.xyz>
On Wed, Jan 19, 2022 at 05:13:18PM +0900, Michael Paquier wrote:
> On Tue, Jan 11, 2022 at 10:08:13PM -0600, Justin Pryzby wrote:
> > I asked about that before. Right now, it'll exit(1) when mkdir fails.
> >
> > I had written a patch to allow "." by skipping mkdir (or allowing it to fail if
> > errno == EEXIST), but it seems like an awfully bad idea to try to make that
> > work with rmtree().
I still don't know if it even needs to be configurable.
> - Add some sanity check about the path used, aka no parent reference
> allowed and the output path should not be a direct parent of the
> current working directory.
I'm not sure these restrictions are needed ?
+ outputpath = make_absolute_path(log_opts.basedir);
+ if (path_contains_parent_reference(outputpath))
+ pg_fatal("reference to parent directory not allowed\n");
Besides, you're passing the wrong path here.
> I have noticed a couple of incorrect things in the docs, and some
> other things. It is a bit late here, so I may have missed a couple of
> things but I'll look at this stuff once again in a couple of days.
> + <command>pg_upgrade</command>, and is be removed after a successful
remove "be"
> + if (mkdir(log_opts.basedir, S_IRWXU | S_IRWXG | S_IRWXO))
S_IRWXG | S_IRWXO are useless due to the umask, right ?
Maybe use PG_DIR_MODE_OWNER ?
> + if (mkdir(log_opts.basedir, S_IRWXU | S_IRWXG | S_IRWXO))
> + pg_fatal("could not create directory \"%s\": %m\n", filename_path);
> + if (mkdir(log_opts.dumpdir, S_IRWXU | S_IRWXG | S_IRWXO))
> + pg_fatal("could not create directory \"%s\": %m\n", filename_path);
> + if (mkdir(log_opts.logdir, S_IRWXU | S_IRWXG | S_IRWXO))
> + pg_fatal("could not create directory \"%s\": %m\n", filename_path);
You're printing the wrong var. filename_path is not initialized.
--
Justin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: pryzby@telsasoft.com, michael@paquier.xyz, tgl@sss.pgh.pa.us, daniel@yesql.se, peter.eisentraut@enterprisedb.com, andrew@dunslane.net, bruce@momjian.us, pgsql-hackers@lists.postgresql.org
Subject: Re: pg_upgrade should truncate/remove its logs before running
In-Reply-To: <20220120000540.GG23027@telsasoft.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox