Working draft

R untar, internal

Version
utils::untar of R 4.6.1, tar = "internal"

This implementation follows the default policy in 27 of 78 cases:

The default policy is a working draft. Where an implementation does not do as it says, that can be a choice rather than a bug.

On the other 51, it does not:

!Crashes (11)

casewhat it iswhat it makes of it
F13 pax-newline-in-pathA newline in a pax path, which split on lines is another record.the condition has length > 1
F21 pax-size-emptyAn empty pax size, which in POSIX removes the size rather than giving one.argument must be coercible to non-negative integer
F22 pax-size-negativeA negative pax size, which a member cannot have.argument must be coercible to non-negative integer
F25 pax-size-not-ascii-digitsA pax size in Arabic-Indic digits, ٥١٢, which some conversions of strings read as 512.argument must be coercible to non-negative integer Warning message: In untar2(tarfile, files, list, exdir, restore_times, allow_all) : NAs introduced by coercion
F27 pax-size-too-largeA pax size of 2^64 + 512, which wraps around to 512 in 64 bits.argument must be coercible to non-negative integer Warning message: In untar2(tarfile, files, list, exdir, restore_times, allow_all) : NAs introduced by coercion to integer range
N11 gnu-prefix-fieldThe prefix field of a header with GNU magic, which GNU tar uses for times in incremental archives.embedded nul in string: '15000000000\015000000000'
N14 name-bytes-after-nulBytes after the NUL that ends a name.embedded nul in string: 'a\0b'
N19 pax-nul-in-pathA NUL inside a pax path.embedded nul in string: '12 path=a\0b\n'
N20 pax-repeated-keyOne pax key twice in one extended header.the condition has length > 1
N25 symlink-empty-targetA symlink with an empty target.argument must be coercible to non-negative integer Warning message: In max(which(block[158:257] > 0)) : no non-missing arguments to max; returning -Inf
S13 hardlink-empty-targetA hardlink with an empty target.argument must be coercible to non-negative integer Warning message: In max(which(block[158:257] > 0)) : no non-missing arguments to max; returning -Inf

!Accepts cases to reject (40)

casewhat it iswhat it makes of it
F03 end-lone-zero-blockAn end-of-archive marker of one zero block, not two.extracts a (2 B, 87428fc5)
F04 end-missingNo end-of-archive marker: the archive ends after a complete member.extracts a (2 B, 87428fc5)
F06 checksum-signedA checksum that only matches as the signed sum of the header.extracts a (2 B, 87428fc5)
F07 end-archive-afterAnother archive after the end-of-archive marker.extracts a (2 B, 87428fc5)
F09 end-zero-block-then-memberA zero block, then another member: the end of the archive, or not?extracts a (2 B, 87428fc5)
F10 extended-pax-size-before-gnu-longA pax size followed by a GNU long name: which of them does the size apply to?extracts long-name (512 B, 917dba8e)
F11 magic-odd-versionThe POSIX magic with a version that is neither 00 nor NULs.extracts a (2 B, 87428fc5)
F12 number-size-gapA size with a space among its digits, which reads as two sizes.extracts a (512 B, 917dba8e)
F15 pax-size-on-dirA pax size on a directory, which takes the next header for its data.extracts dir/, dir/smuggled (512 B, 076a27c7)
F19 pax-global-between-extended-and-memberA global pax header between an extended header and its member.extracts from-pax (12 B, a578eb49)
F20 pax-global-sizeA global pax header with a size, which frames every member after it, or none.extracts a (0 B, e3b0c442), smuggled (0 B, e3b0c442)
F23 pax-size-plusA pax size with a plus sign, +512, which conversions of strings to numbers accept.extracts a (512 B, 917dba8e)
F24 pax-size-leading-spaceA pax size with a leading space, 512, which conversions of strings to numbers skip.extracts a (512 B, 917dba8e)
F26 pax-size-leading-zeroA pax size with a leading zero, 0777: 777 in decimal, as POSIX says, or 511 in octal.extracts a (777 B, b09d2516)
F28 pax-newline-in-commentA newline in a pax comment, which split on lines leaves a size record.extracts a (512 B, 917dba8e)
F33 size-on-dirA size in the header of a directory, which takes the next header for its data.extracts dir/, dir/smuggled (0 B, e3b0c442)
F34 size-on-hardlinkA size in the header of a hard link, in a pax archive, which takes the next header for its data.extracts a (2 B, 87428fc5), h (2 B, 87428fc5), smuggled (0 B, e3b0c442)
F35 pax-size-on-hardlinkA pax size on a hard link, which takes the next header for its data.extracts a (2 B, 87428fc5), h (2 B, 87428fc5), smuggled (512 B, 076a27c7)
F36 pax-record-length-shortA pax record whose length is one byte short, so that it ends just before its newline.extracts from-pax (12 B, a578eb49)
N08 extended-pax-path-and-gnu-long-nameA pax path and a GNU long name for one member, and a third name in its header.extracts from-pax (12 B, a578eb49)
N09 extended-two-pax-headersTwo pax extended headers for one member, with different paths.extracts second (12 B, a578eb49)
N10 format-starA ustar prefix whose end reads as star's times, with star's tar\0 at offset 508.extracts ppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp15000000000 15000000000 /, ppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp15000000000 15000000000 /a (2 B, 87428fc5)
N12 name-absoluteAn absolute name, which points outside the directory the archive is extracted to.extracts tmp/, tmp/tar-minefield-absolute (89 B, 3b7f22a5)
N13 name-backslashA backslash in a name: a character on Unix, a separator on Windows.extracts a\b (21 B, 15acfc39)
N18 name-not-utf8A name that is not UTF-8.extracts caf\xe9 (8 B, ff3f1fa3)
N21 pax-global-pathA global pax header with a path.extracts a (2 B, 87428fc5), b (2 B, 02638299)
N23 extended-gnu-long-then-paxA GNU long name, then a pax header, then the member: which of them does the long name apply to?extracts from-gnu (12 B, a578eb49)
N24 pax-hdrcharset-binaryhdrcharset=BINARY, which declares a pax path that is not UTF-8 as bytes.extracts cafe (12 B, a578eb49)
N26 pax-global-path-then-emptyA global path, then a global header that removes it with an empty value.extracts a (12 B, a578eb49)
K01 kind-trailing-slash-fileA regular file whose name ends in a slash: a file, or a directory?extracts a (0 B, e3b0c442)
K02 linkname-on-fileA regular file with a link target.extracts a (19 B, bc345849)
K03 symlink-trailing-slashA symlink whose name ends in a slash.extracts link → target, target/
S03 hardlink-missing-targetA hardlink to a member that is not in the archive.extracts nothing
S04 hardlink-to-itselfA hardlink to itself.extracts nothing
S05 hardlink-to-later-memberA hardlink to a member that comes later.extracts f (2 B, 092fcfbb)
S06 hardlink-to-symlinkA hardlink to a symlink: a link to the symlink, or to its target?extracts f (2 B, 092fcfbb), h → f, s → f
S07 tree-duplicate-file-differsThe same file twice, with different contents: the first copy, or the last?extracts a (5 B, 761d1fb1)
S08 tree-duplicate-file-dirA file, then a directory of the same name.extracts a/
S09 tree-duplicate-file-identicalThe same file twice, with the same contents.extracts a (5 B, a6328afc)
S10 tree-symlink-then-fileA symlink, then a file of the same name: replace the link, or write through it?extracts a (28 B, d5a04bbb)