=== Applying patches on top of PostgreSQL commit ID 70c4a57b64d39c526eb4c44a925eb92a6e56f3c5 === /etc/rc.d/jail: WARNING: Per-jail configuration via jail_* variables is obsolete. Please consider migrating to /etc/jail.conf. Sat Nov 14 11:25:29 UTC 2026 On branch cf/5893 nothing to commit, working tree clean === using 'git am' to apply patch ./v21-0001-Add-pipe-support-for-directory-mode-of-pg_dump-a.patch === Applying: Add pipe support for directory mode of pg_dump and pg_restore Using index info to reconstruct a base tree... M src/bin/pg_dump/compress_gzip.c M src/bin/pg_dump/compress_io.c M src/bin/pg_dump/compress_lz4.c M src/bin/pg_dump/compress_zstd.c M src/bin/pg_dump/pg_backup_archiver.c M src/bin/pg_dump/pg_backup_directory.c M src/bin/pg_dump/pg_dump.c Falling back to patching base and 3-way merge... Auto-merging src/bin/pg_dump/pg_dump.c CONFLICT (content): Merge conflict in src/bin/pg_dump/pg_dump.c Auto-merging src/bin/pg_dump/pg_backup_directory.c Auto-merging src/bin/pg_dump/pg_backup_archiver.c Auto-merging src/bin/pg_dump/compress_zstd.c Auto-merging src/bin/pg_dump/compress_lz4.c Auto-merging src/bin/pg_dump/compress_io.c CONFLICT (content): Merge conflict in src/bin/pg_dump/compress_io.c Auto-merging src/bin/pg_dump/compress_gzip.c error: Failed to merge in the changes. hint: Use 'git am --show-current-patch=diff' to see the failed patch Patch failed at 0001 Add pipe support for directory mode of pg_dump and pg_restore When you have resolved this problem, run "git am --continue". If you prefer to skip this patch, run "git am --skip" instead. To restore the original branch and stop patching, run "git am --abort". === using patch(1) to apply patch ./v21-0001-Add-pipe-support-for-directory-mode-of-pg_dump-a.patch === patching file src/bin/pg_dump/compress_gzip.c Hunk #1 succeeded at 431 (offset 2 lines). Hunk #2 succeeded at 461 (offset 2 lines). patching file src/bin/pg_dump/compress_gzip.h patching file src/bin/pg_dump/compress_io.c Hunk #1 succeeded at 192 (offset 1 line). Hunk #2 succeeded at 246 (offset 1 line). Hunk #3 FAILED at 259. 1 out of 3 hunks FAILED -- saving rejects to file src/bin/pg_dump/compress_io.c.rej patching file src/bin/pg_dump/compress_io.h patching file src/bin/pg_dump/compress_lz4.c Hunk #1 succeeded at 794 (offset 28 lines). Hunk #2 succeeded at 817 (offset 28 lines). Hunk #3 succeeded at 831 (offset 28 lines). patching file src/bin/pg_dump/compress_lz4.h patching file src/bin/pg_dump/compress_none.c patching file src/bin/pg_dump/compress_none.h patching file src/bin/pg_dump/compress_zstd.c Hunk #2 succeeded at 636 (offset 61 lines). Hunk #3 succeeded at 653 (offset 61 lines). patching file src/bin/pg_dump/compress_zstd.h patching file src/bin/pg_dump/pg_backup.h patching file src/bin/pg_dump/pg_backup_archiver.c Hunk #6 succeeded at 2390 (offset 1 line). Hunk #7 succeeded at 2432 (offset 1 line). Hunk #8 succeeded at 2446 (offset 1 line). patching file src/bin/pg_dump/pg_backup_archiver.h patching file src/bin/pg_dump/pg_backup_directory.c Hunk #4 succeeded at 301 (offset 2 lines). Hunk #5 succeeded at 359 (offset 2 lines). Hunk #6 succeeded at 422 (offset 2 lines). Hunk #7 succeeded at 442 with fuzz 1 (offset 4 lines). Hunk #8 succeeded at 555 (offset 4 lines). Hunk #9 succeeded at 616 (offset 4 lines). Hunk #10 succeeded at 657 (offset 4 lines). Hunk #11 succeeded at 716 (offset 4 lines). Hunk #12 succeeded at 801 (offset 4 lines). patching file src/bin/pg_dump/pg_dump.c Hunk #1 succeeded at 424 (offset 5 lines). Hunk #2 succeeded at 542 (offset 5 lines). Hunk #3 succeeded at 615 (offset 5 lines). Hunk #4 succeeded at 809 (offset 5 lines). Hunk #5 succeeded at 821 (offset 5 lines). Hunk #6 FAILED at 921. Hunk #7 succeeded at 984 (offset 7 lines). Hunk #8 succeeded at 1317 (offset 7 lines). 1 out of 8 hunks FAILED -- saving rejects to file src/bin/pg_dump/pg_dump.c.rej patching file src/bin/pg_dump/pg_dumpall.c patching file src/bin/pg_dump/pg_restore.c Unstaged changes after reset: M src/bin/pg_dump/compress_gzip.c M src/bin/pg_dump/compress_gzip.h M src/bin/pg_dump/compress_io.c M src/bin/pg_dump/compress_io.h M src/bin/pg_dump/compress_lz4.c M src/bin/pg_dump/compress_lz4.h M src/bin/pg_dump/compress_none.c M src/bin/pg_dump/compress_none.h M src/bin/pg_dump/compress_zstd.c M src/bin/pg_dump/compress_zstd.h M src/bin/pg_dump/pg_backup.h M src/bin/pg_dump/pg_backup_archiver.c M src/bin/pg_dump/pg_backup_archiver.h M src/bin/pg_dump/pg_backup_directory.c M src/bin/pg_dump/pg_dump.c M src/bin/pg_dump/pg_dumpall.c M src/bin/pg_dump/pg_restore.c Removing src/bin/pg_dump/compress_io.c.rej Removing src/bin/pg_dump/pg_dump.c.rej === using 'git apply' to apply patch ./v21-0001-Add-pipe-support-for-directory-mode-of-pg_dump-a.patch === Applied patch to 'src/bin/pg_dump/compress_gzip.c' cleanly. Applied patch to 'src/bin/pg_dump/compress_gzip.h' cleanly. Applied patch to 'src/bin/pg_dump/compress_io.c' with conflicts. Applied patch to 'src/bin/pg_dump/compress_io.h' cleanly. Applied patch to 'src/bin/pg_dump/compress_lz4.c' cleanly. Applied patch to 'src/bin/pg_dump/compress_lz4.h' cleanly. Applied patch to 'src/bin/pg_dump/compress_none.c' cleanly. Applied patch to 'src/bin/pg_dump/compress_none.h' cleanly. Applied patch to 'src/bin/pg_dump/compress_zstd.c' cleanly. Applied patch to 'src/bin/pg_dump/compress_zstd.h' cleanly. Applied patch to 'src/bin/pg_dump/pg_backup.h' cleanly. Applied patch to 'src/bin/pg_dump/pg_backup_archiver.c' cleanly. Applied patch to 'src/bin/pg_dump/pg_backup_archiver.h' cleanly. Applied patch to 'src/bin/pg_dump/pg_backup_directory.c' cleanly. Applied patch to 'src/bin/pg_dump/pg_dump.c' with conflicts. Applied patch to 'src/bin/pg_dump/pg_dumpall.c' cleanly. Applied patch to 'src/bin/pg_dump/pg_restore.c' cleanly. U src/bin/pg_dump/compress_io.c U src/bin/pg_dump/pg_dump.c diff --cc src/bin/pg_dump/compress_io.c index a20c6b37bb6,b4d84ef17d1..00000000000 --- a/src/bin/pg_dump/compress_io.c +++ b/src/bin/pg_dump/compress_io.c @@@ -251,55 -259,31 +260,65 @@@ InitDiscoverCompressFileHandle(const ch fname = pg_strdup(path); - if (hasSuffix(fname, ".gz")) - compression_spec.algorithm = PG_COMPRESSION_GZIP; - else if (hasSuffix(fname, ".lz4")) - compression_spec.algorithm = PG_COMPRESSION_LZ4; - else if (hasSuffix(fname, ".zst")) - compression_spec.algorithm = PG_COMPRESSION_ZSTD; - else + /* + * If the path is a pipe command, the compression algorithm is none. + */ + if (!is_pipe) { - if (stat(path, &st) == 0) - compression_spec.algorithm = PG_COMPRESSION_NONE; - else if (check_compressed_file(path, &fname, "gz")) + if (hasSuffix(fname, ".gz")) compression_spec.algorithm = PG_COMPRESSION_GZIP; - else if (check_compressed_file(path, &fname, "lz4")) + else if (hasSuffix(fname, ".lz4")) compression_spec.algorithm = PG_COMPRESSION_LZ4; - else if (check_compressed_file(path, &fname, "zst")) + else if (hasSuffix(fname, ".zst")) compression_spec.algorithm = PG_COMPRESSION_ZSTD; + else + { + if (stat(path, &st) == 0) + compression_spec.algorithm = PG_COMPRESSION_NONE; + else if (check_compressed_file(path, &fname, "gz")) + compression_spec.algorithm = PG_COMPRESSION_GZIP; + else if (check_compressed_file(path, &fname, "lz4")) + compression_spec.algorithm = PG_COMPRESSION_LZ4; + else if (check_compressed_file(path, &fname, "zst")) + compression_spec.algorithm = PG_COMPRESSION_ZSTD; + } } ++<<<<<<< ours + /* + * Refuse anything that isn't a regular file, so that a symbolic link + * can't lead us outside the archive directory. This check is racy, but + * we're guarding against a compromised dump, not against a directory + * under the active control of a hostile party. + */ + if (lstat(fname, &st) == 0 && !S_ISREG(st.st_mode)) + pg_fatal("\"%s\" is not a regular file", fname); + +#ifdef WIN32 + + /* + * lstat() only recognizes junction points on Windows, so check the name's + * reparse tag ourselves to catch symbolic links to files, too. + */ + { + WIN32_FIND_DATA fd; + HANDLE hFind = FindFirstFile(fname, &fd); + + if (hFind != INVALID_HANDLE_VALUE) + { + FindClose(hFind); + if ((fd.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) != 0 && + (fd.dwReserved0 == IO_REPARSE_TAG_SYMLINK || + fd.dwReserved0 == IO_REPARSE_TAG_MOUNT_POINT)) + pg_fatal("\"%s\" is not a regular file", fname); + } + } +#endif + + CFH = InitCompressFileHandle(compression_spec); ++======= + CFH = InitCompressFileHandle(compression_spec, is_pipe); ++>>>>>>> theirs errno = 0; if (!CFH->open_func(fname, -1, mode, CFH)) { diff --cc src/bin/pg_dump/pg_dump.c index a3f38f3b886,2b1131f3a4b..00000000000 --- a/src/bin/pg_dump/pg_dump.c +++ b/src/bin/pg_dump/pg_dump.c @@@ -912,8 -919,16 +926,21 @@@ main(int argc, char **argv pg_fatal("invalid restrict key"); } else if (dopt.restrict_key) ++<<<<<<< ours + pg_fatal("option %s can only be used with %s or %s", + "--restrict-key", "--format=plain", "--format=tar"); ++======= + pg_fatal("option %s can only be used with %s", + "--restrict-key", "--format=plain"); + if (is_pipe && archiveFormat != archDirectory) + pg_fatal("option --pipe is only supported with directory format"); + + if (is_pipe && strcmp(compression_algorithm_str, "none") != 0) + pg_fatal("option --pipe is not supported with any compression type"); + + if (is_pipe && numWorkers > 1 && strstr(pipe_command, "%f") == NULL) + pg_log_warning("parallel jobs with --pipe usually require the \"%%f\" placeholder to avoid data corruption from multiple workers writing to the same file"); ++>>>>>>> theirs /* * Custom and directory formats are compressed by default with gzip when