skip_hidden_files.diff

application/octet-stream

Filename: skip_hidden_files.diff
Type: application/octet-stream
Part: 0
Message: Re: pg_basebackup: errors on macOS on directories with ".DS_Store" files

Patch

Same data as JSON: GET /api/v1/attachments/:id/patch the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes. API reference →
Format: unified
File+
src/backend/backup/basebackup.c 4 0
src/bin/pg_checksums/pg_checksums.c 4 0
diff --git a/src/backend/backup/basebackup.c b/src/backend/backup/basebackup.c
index 5baea7535b..75b6af80cb 100644
--- a/src/backend/backup/basebackup.c
+++ b/src/backend/backup/basebackup.c
@@ -1202,6 +1202,10 @@ sendDir(bbsink *sink, const char *path, int basepathlen, bool sizeonly,
 					strlen(PG_TEMP_FILE_PREFIX)) == 0)
 			continue;
 
+		/* Skip hidden files */
+		if (de->d_name[0] == '.')
+			continue;
+
 		/*
 		 * Check if the postmaster has signaled us to exit, and abort with an
 		 * error in that case. The error handler further up will call
diff --git a/src/bin/pg_checksums/pg_checksums.c b/src/bin/pg_checksums/pg_checksums.c
index 19eb67e485..d3c16acf0d 100644
--- a/src/bin/pg_checksums/pg_checksums.c
+++ b/src/bin/pg_checksums/pg_checksums.c
@@ -337,6 +337,10 @@ scan_directory(const char *basedir, const char *subdir, bool sizeonly)
 					strlen(PG_TEMP_FILES_DIR)) == 0)
 			continue;
 
+		/* Skip hidden files */
+		if (de->d_name[0] == '.')
+			continue;
+
 		snprintf(fn, sizeof(fn), "%s/%s", path, de->d_name);
 		if (lstat(fn, &st) < 0)
 			pg_fatal("could not stat file \"%s\": %m", fn);