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