mirror of
https://github.com/postgres/postgres.git
synced 2026-02-11 14:53:31 -05:00
The tar format (at least the version we are using), does not support file names or symlink targets longer than 99 bytes. Until now, the tar creation code would silently truncate any names that are too long. (Its original application was pg_dump, where this never happens.) This creates problems when running base backups over the replication protocol. The most important problem is when a tablespace path is longer than 99 bytes, which will result in a truncated tablespace path being backed up. Less importantly, the basebackup protocol also promises to back up any other files it happens to find in the data directory, which would also lead to file name truncation if someone put a file with a long name in there. Now both of these cases result in an error during the backup. Add tests that fail when a too-long file name or symlink is attempted to be backed up. Reviewed-by: Robert Hass <robertmhaas@gmail.com>
23 lines
691 B
C
23 lines
691 B
C
/*-------------------------------------------------------------------------
|
|
*
|
|
* pgtar.h
|
|
* Functions for manipulating tarfile datastructures (src/port/tar.c)
|
|
*
|
|
*
|
|
* Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
|
|
* Portions Copyright (c) 1994, Regents of the University of California
|
|
*
|
|
* src/include/pgtar.h
|
|
*
|
|
*-------------------------------------------------------------------------
|
|
*/
|
|
|
|
enum tarError
|
|
{
|
|
TAR_OK = 0,
|
|
TAR_NAME_TOO_LONG,
|
|
TAR_SYMLINK_TOO_LONG
|
|
};
|
|
|
|
extern enum tarError tarCreateHeader(char *h, const char *filename, const char *linktarget, size_t size, mode_t mode, uid_t uid, gid_t gid, time_t mtime);
|
|
extern int tarChecksum(char *header);
|