Package: tar / 1.30+dfsg-5

oldgnu-unknown-mode-bits.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
Description: Do not encode unknown mode bits with oldgnu format.
 The oldgnu format can encode large header fields in base-256. On the Hurd,
 for example, a fifo is a translator and its mode bits contain at least the
 S_IROOT (040000000) bit set. For the v7 and ustar formats all unknown
 mode bits are masked at the call site, and ustar, posix and gnu formats
 only encode known mode bits. But oldgnu is left unmasked and encoding all
 unknown bits, which is very unexpected as these are system-specific internal
 details on how to represent fifos (or other translators).
 .
 GNU tar should consider oldgnu in the same way as the gnu, posix and ustar
 formats, and ignore unknown bits when encoding the mode.
Author: Guillem Jover <guillem@debian.org>
Origin: vendor
Forwarded: no
Last-Update: 2018-10-14

---

--- tar-1.30+dfsg.orig/src/create.c
+++ tar-1.30+dfsg/src/create.c
@@ -384,7 +384,7 @@ static bool
 mode_to_chars (mode_t v, char *p, size_t s)
 {
   /* In the common case where the internal and external mode bits are the same,
-     and we are not using POSIX or GNU format,
+     and we are not using POSIX or GNU formats,
      propagate all unknown bits to the external mode.
      This matches historical practice.
      Otherwise, just copy the bits we know about.  */
@@ -396,6 +396,7 @@ mode_to_chars (mode_t v, char *p, size_t
       && S_IROTH == TOREAD && S_IWOTH == TOWRITE && S_IXOTH == TOEXEC
       && archive_format != POSIX_FORMAT
       && archive_format != USTAR_FORMAT
+      && archive_format != OLDGNU_FORMAT
       && archive_format != GNU_FORMAT)
     {
       negative = v < 0;