Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc0f279c

Browse files
committed
Don't include file type bits in tar archive's mode field.
The "file mode" bits in the tar file header is not supposed to include thefile type bits, e.g. S_IFREG or S_IFDIR. The file type is stored in aseparate field. This isn't a problem in practice, all tar programs ignorethe extra bits, but let's be tidy.This came up in a discussion around bug #11949, reported by Hendrik Grewe,although this doesn't fix the issue with tar --append. That turned out to bea bug in GNU tar. Schilly's tartest program revealed this defect in the tarcreated by pg_basebackup.This problem goes as far as we we've had pg_basebackup, but since thishasn't caused any problems in practice, let's be conservative and fix inmaster only.
1 parentb27b6e7 commitc0f279c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

‎src/port/tar.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ tarCreateHeader(char *h, const char *filename, const char *linktarget,
7777
h[flen+1]='\0';
7878
}
7979

80-
/* Mode 8 */
81-
sprintf(&h[100],"%07o ", (int)mode);
80+
/* Mode 8- this doesn't include the file type bits (S_IFMT)*/
81+
sprintf(&h[100],"%07o ", (int)(mode&07777));
8282

8383
/* User ID 8 */
8484
sprintf(&h[108],"%07o ", (int)uid);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp