Re: pg_basebackup: errors on macOS on directories with ".DS_Store" files

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Daniel Gustafsson <daniel(at)yesql(dot)se>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Jacob Champion <jchampion(at)timescale(dot)com>, Tobias Bussmann <t(dot)bussmann(at)gmx(dot)net>, Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>, Mark Guertin <markguertin(at)gmail(dot)com>, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: pg_basebackup: errors on macOS on directories with ".DS_Store" files
Date: 2023-07-20 07:47:40
Message-ID: ZLjmnOdz5jT+2s4g@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Thu, Jul 20, 2023 at 01:16:45AM +0200, Daniel Gustafsson wrote:
> Attached is a version that just skips .DS_Store files as per the discussion
> here. I opted for not testing this on macOS since I don't want to create
> invalid .DS_Store files where they potentially can be seen by the Finder
> causing unwanted side effects.

@@ -398,6 +398,10 @@ recurse_dir(const char *datadir, const char *parentpath,
strcmp(xlde->d_name, "..") == 0)
continue;

+ /* Skip macOS system files */
+ if (strcmp(xlde->d_name, ".DS_Store") == 0)
+ continue;

Hmm. Are you sure that this is correct for pg_rewind? This should
work when using a local source with --source-pgdata, but under a
remote source with --source-pgdata, I get the impression that we'd
still copy a .DS_store into the target's data folder.

For example, see this little tweak in 003_extrafiles.pl that adds a
.DS_Store in the standby:
--- a/src/bin/pg_rewind/t/003_extrafiles.pl
+++ b/src/bin/pg_rewind/t/003_extrafiles.pl
@@ -53,6 +53,9 @@ sub run_test
append_to_file
"$test_standby_datadir/tst_standby_dir/standby_subdir/standby_file4",
"in standby4";
+ append_to_file
+ "$test_standby_datadir/tst_standby_dir/.DS_Store",
+ "in standby4";

Note that I have not updated the list associated to is_deeply(), to
check that this file is not copied over to the primary. This leads me
to a failure of the test for the remote case. Then, looking from
src/bin/pg_rewind/:
$ find . -name ".DS_Store"
./tmp_check/t_003_extrafiles_primary_remote_data/pgdata/tst_standby_dir/.DS_Store
./tmp_check/t_003_extrafiles_standby_local_data/pgdata/tst_standby_dir/.DS_Store
./tmp_check/t_003_extrafiles_standby_remote_data/pgdata/tst_standby_dir/.DS_Store
--
Michael

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Kyotaro Horiguchi 2023-07-20 08:29:24 Re: BUG #18014: Releasing catcache entries makes schema_to_xmlschema() fail when parallel workers are used
Previous Message Kyotaro Horiguchi 2023-07-20 07:44:59 Re: BUG #18014: Releasing catcache entries makes schema_to_xmlschema() fail when parallel workers are used