214 Commits
Author SHA1 Message Date
Timofey Solomko d33ae76d85 [TAR] Add initializer to ext header which creates header with only necessary fields 2018-07-29 19:24:19 +03:00
Timofey Solomko b0be2ab38f [TAR] Sync TarEntry.data.count and TarEntry.info.size via property observer 2018-07-29 19:23:05 +03:00
Timofey Solomko 52b8a62f93 [TAR] Make TarEntry's info and data var-properties 2018-07-29 19:22:27 +03:00
Timofey Solomko 74b50be568 [TAR] Make TarEntry.init public and add argument labels 2018-07-29 19:21:25 +03:00
Timofey Solomko 9c7937504e [TAR] Add ustar implementation part of TarEntryInfo.generateContainerData 2018-07-29 18:04:25 +03:00
Timofey Solomko d3949524a1 [TAR] Add create function to TarContainer 2018-07-29 18:04:24 +03:00
Timofey Solomko 57a87dc1c8 [TAR] Implement TarEntry.generateContainerData() 2018-07-29 18:04:24 +03:00
Timofey Solomko 16e7fc7d44 [TAR] Add pre-POSIX implementation part of TarEntryInfo.generateContainerData() 2018-07-29 18:04:24 +03:00
Timofey Solomko 0281f11a86 [TAR] Add Data extension function which appends string field 2018-07-29 18:04:24 +03:00
Timofey Solomko 40ea63c456 [TAR] Add Data extension which appends numeric field value either in octal or base-256 format 2018-07-29 18:04:24 +03:00
Timofey Solomko 46bf2a6d94 [TAR] Add fileprivate extension to Data which works like String.padding and Data.prefix combined 2018-07-29 18:04:19 +03:00
Timofey Solomko 2e40dc903a [TAR] Add fileTypeIndicator property to TAR's ContainerEntryType extension 2018-07-29 18:04:19 +03:00
Timofey Solomko dcabef6e95 [TAR] Add basic public initializer to TarEntryInfo
It takes two the most necessary properties of EntryInfo as arguments: name and type.
2018-07-29 18:04:19 +03:00
Timofey Solomko 14a4df3182 [TAR] Make almost all properties of TarEntryInfo var (instead of let)
This also makes several nil-initializations redundant.
2018-07-29 18:04:11 +03:00
Timofey Solomko 3725c14fe4 [TAR] Implement generateContainerData for extended header 2018-07-25 20:59:03 +03:00
Timofey Solomko 14b3fb2774 [TAR] Add enum for creation errors
First case: unable to encode a string with UTF-8 encoding
2018-07-25 20:59:03 +03:00
Timofey Solomko 53d0c951e5 [TAR] Make extended header's unknownRecords variable and add empty init() so extended header could be used in tests 2018-07-25 20:59:03 +03:00
Timofey Solomko f2e3a02518 [TAR] Skip leading zeros and whitespaces in numeric fields
This is used by some other (old) implementations.
2018-07-25 20:49:13 +03:00
Timofey Solomko d17e772abf [TAR] Support Sun's version of pax extended headers
Their version's only noticeable difference is in the typeflag (aka fileTypeIndicator) used ("X" instead of "x").
2018-07-24 22:52:34 +03:00
Timofey Solomko 1a583b5bc8 [TAR] Remove radix argument from ByteReader.tarInt function
Reason: it is always equals to 8.
2018-07-24 22:42:52 +03:00
Timofey Solomko e795924b5d [TAR] Correctly read device major/minor number as octal number 2018-07-24 22:42:05 +03:00
Timofey Solomko 3a208ee047 [TAR] Handle base-256 encoding used for big or negative integer fields 2018-07-23 19:04:14 +03:00
Timofey Solomko a959703e2c [TAR] Remove hasRecognizedMagic property from TarEntryInfo 2018-07-23 09:34:17 +03:00
Timofey Solomko 12d70a4856 [TAR] Use new format property in formatOf function
As a result, gnu format is now returned correctly in some cases where previously ustar was a result.
2018-07-23 09:33:54 +03:00
Timofey Solomko 2d60b339fc [TAR] Add correctly set format property to TarEntryInfo 2018-07-23 09:27:39 +03:00
Timofey Solomko ef162c4b4f [TAR] Correctly handle gnu format when used for incremental backups
Previously, in such cases the resulting entries were having incorrect file names instead of having ctime/atime.
2018-07-23 09:25:06 +03:00
Timofey Solomko 6f5085bb03 [TAR] ExtendedHeader init(_:) is no longer failable 2018-07-17 19:58:04 +03:00
Timofey Solomko e461fae1d7 [TAR] Correctly read PAX extended headers with unicode characters in their content
The problem arised from my misunderstanding of what the length of the header entry is. Previously, it was treated as a length of entry converted to UTF-8 _string_, but apparently it is the byte-length. The problem manifests itself when a PAX entry contains multi-byte UTF-8 characters, and was undiscovered until now due to insufficient testing.
2018-07-16 20:18:03 +03:00
Timofey Solomko aee78e3030 [TAR] Correctly read uid and gid as octal numbers 2018-07-16 20:14:17 +03:00
Timofey Solomko 9f9fbc638e [TAR] Combine auxiliary buffer extension function into tarInt function 2018-07-14 20:55:03 +03:00
Timofey Solomko df347d850c [TAR] Add notes about wrongField being unused into its doc comment 2018-07-14 20:41:05 +03:00
Timofey Solomko 2a2842ebc3 [TAR] Replace nullEndedAsciiString function with a better version of it called tarCString
It uses String(cString:) initiliazer, since TAR's null-ending ASCII strings are, basically, CStrings. As a bonus this initializer is not failable, so there remains no situation where throwing wrongField error is necessary. This makes tarCString function non-throwing and also wrongField error case unused (thus, it is possible to remove it in the next major update).
2018-07-14 20:38:42 +03:00
Timofey Solomko ffe6265b3e [TAR] Slightly optimize checksum calculations 2018-07-13 23:23:45 +03:00
Timofey Solomko e20ff27d63 [TAR] Unparsable Integer fields no longer cause wrongField error
For unparsable checksum the wrongHeaderChecksum is thrown instead.
2018-07-13 23:16:59 +03:00
Timofey Solomko fe81ff1341 [TAR] truncatingIfNeeded optimizations for TarEntryInfo.init 2018-07-13 22:55:40 +03:00
Timofey Solomko 29ad403776 [TAR] Replace nullSpaceEndedAsciiString extension function of ByteReader with more specifc and properly documented tarInt() function 2018-07-13 22:55:12 +03:00
Timofey Solomko 4c12e6afdd [TAR] Decode all TAR fields as UTF-8 instead of ASCII
ASCII is a subset of UTF-8 so this change doesn't break anything, but instead allows to support wider range of characters that may be put into those TAR fields by other implementations.
2018-07-13 22:36:34 +03:00
Timofey Solomko 8434e7b1bd [docs] Add documentation for TarContainer.Format and formatOf(container:) 2018-04-13 18:45:28 +03:00
Timofey Solomko 477ebcf48e [TAR] Add TarContainer.formatOf function 2018-04-13 17:34:56 +03:00
Timofey Solomko 150a3cfc1f [TAR] Add internal property to entry info which shows if ustar-like magic was encountered 2018-04-13 17:34:56 +03:00
Timofey Solomko 58d96a1961 [TAR] Add Format enum 2018-04-13 17:34:56 +03:00
Timofey Solomko 41ca39d1fa Remove certain TODOs 2018-04-10 23:26:35 +03:00
Timofey Solomko 8045b7e7ab [TAR] Use info provider in info function 2018-04-07 13:44:19 +03:00
Timofey Solomko 100c9364f0 [TAR] Add entry info provider 2018-04-07 13:43:09 +03:00
Timofey Solomko 1d838c1d7e Slightly simplify and improve certain code 2018-04-07 13:38:00 +03:00
Timofey Solomko c9ea4f33fc [TAR] Use special entry type internal property of TarEntryInfo instead of several isSomething properties 2018-03-31 12:15:43 +03:00
Timofey Solomko 67f5ebba0f [TAR] Add nested SpecialEntryType enum into TarEntryInfo 2018-03-31 12:14:28 +03:00
Timofey Solomko 4959ec5fe0 [TAR] Add compressionMethod property to TarEntryInfo
Obviously, it is awlays equal to .copy because TAR format doesn't support any compression.
2018-03-18 01:03:14 +03:00
Timofey Solomko 309a07ed15 [docs] Slightly simplify notes about entries order of container functions 2018-03-17 15:37:41 +03:00
Timofey Solomko 08473e1aff Add missing documentation for unknownExtendedHeaderRecords 2018-03-04 12:09:31 +03:00