h*_y      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~0.6.3.0 Safe-InferredstarConstruct a `UArray Word32 Word32` from a ByteString of 32bit big endian words.Note: If using , be sure to force the result of running the IO action right away... (e.g. see calls to beToLe in StringTable)tar?The total array length (the number of 32bit words in the array)tarThe bytestring from which the UArray is constructed. The content must start in the first byte! (i.e. the meta-data words that shouldn't be part of the array, must have been dropped already) Safe-Inferred7Mtar=An efficient mapping from strings to a dense set of integers.tarLook up a string in the token table. If the string is present, return its corresponding index.tartarConvert a tar   to a Windows  ('\\' path separators).tar$Convert a unix FilePath to a native .tar%Convert a unix FilePath to a Windows .?tarThis is like the standard  function on lists, but for . It includes failure as an extra possibility that the stepper function may return.It can be used to generate  from some other type. For example it is used internally to lazily unfold entries from a .@tarThis is like the standard  function on lists, but for . Compared to  it takes an extra function to account for the possibility of failure.This is used to consume a sequence of entries. For example it could be used to scan a tarball for problems or to collect an index of the contents.AtarA -like function on Entries. It either returns the final accumulator result, or the failure along with the intermediate accumulator value.BtarThis is like the standard  function on lists, but for . It includes failure as a extra possible outcome of the mapping function.If your mapping function cannot fail it may be more convenient to use CCtarLike B- but the mapping function itself cannot fail.tartartartarpath name, 100 characters max.tar path prefix, 155 characters max.:tarIs the path for a directory? This is needed because for directories a   must always use a trailing /.tarid or unsafeInterleaveIOBtarFunction to apply to each entrytarInput sequence !#"$%&'.-(,)+* 24536/01 :789 ;<=>BC@A?5(c) 2007 Bjorn Bringert, 2008 Andrea Vezzosi, 2008-2009 Duncan Coutts, 2011 Max BolingbrokeBSD3duncan@community.haskell.orgportable Safe-Inferred5 Dtar:Errors that can be encountered when parsing a Tar archive.MtarConvert a data stream in the tar file format into an internal data structure. Decoding errors are reported by the  constructor of the  type.The conversion is done lazily. MDEFGHIJKL Safe-Inferred8NtarErrors raised by S.Otar Two adjacent  'K' nodes.Ptar Two adjacent  'L' nodes.Qtar 'K' node is not followed by a  / .Rtar(Translate high-level entries with POSIX s for files and symlinks into entries suitable for serialization by emitting additional  'K' and  'L' nodes.Input ,s must be POSIX file names, not native ones.StarTranslate low-level entries (usually freshly deserialized) into high-level entries with POSIX 6s for files and symlinks by parsing and eliminating  'K' and  'L' nodes. Resolved .s are still POSIX file names, not native ones.tar(LongLink entry, actual entry)tar&(LongLink symlink entry, actual entry)RSNOPQ(c) 2010-2015 Duncan CouttsBSD3duncan@community.haskell.orgportable Safe-Inferred7QTtar=The intermediate type used for incremental construction of a Y.Utar!An offset within a tar file. Use e, f or g.:This is actually a tar "record" number, not a byte offset.VtarThe result of  in a Y. It can either be a file directly, or a directory entry containing further entries (and all subdirectories recursively). Note that the subtrees are constructed lazily, so it's cheaper if you don't look at them.Ytar&An index of the entries in a tar file.This index type is designed to be quite compact and suitable to store either on disk or in memory.Ztar Look up a given filepath in the Y. It may return a W containing the U of the file within the tar file, or if the filepath identifies a directory then it returns a X5 containing the list of files within that directory. Given the U, you can then use one of the I/O operations:e to read the whole entry;f2 to read just the file metadata (e.g. its length);[tar4All the files in the index with their corresponding Us.Note that the files are in no special order. If you intend to read all or most files then is is recommended to sort by the U.\tarBuild a Y from a sequence of tar . The ! are assumed to start at offset 0 within a file.]tarThe initial empty T.^tar Add the next  into the T._tarUse this function if you want to skip some entries and not add them to the final Y.`tarFinish accumulating # information and build the compact Y lookup structure.atarThis is the offset immediately following the entry most recently added to the T. You might use this if you need to know the offsets but don't want to use the Y lookup structure. Use with g . See also c.btarThis is the offset immediately following the last entry in the tar file. This can be useful to append further entries into the tar file. Use with g, or just use j directly.ctarCalculate the U of the next entry, given the size and offset of the current entry.This is much like using _ and a, but without using an T.dtar!Resume building an existing indexA Y is optimized for a highly compact and efficient in-memory representation. This, however, makes it read-only. If you have an existing Y for a large file, and want to add to it, you can translate the Y back to an T. Be aware that this is a relatively costly operation (linear in the size of the Y9), though still faster than starting again from scratch.This is the left inverse to  (modulo ordering).etarReads an entire  at the given U in the tar file. The * must be open for reading and be seekable.This reads the whole entry into memory strictly, not incrementally. For more control, use f* and then read the entry content manually.ftarRead the header for a  at the given U in the tar file. The # will contain the correct metadata but an empty file content. The * must be open for reading and be seekable.The  position is advanced to the beginning of the entry content (if any). You must check the #! to see if the entry is of type . If it is, the  gives the content length and you are free to read this much data from the . entry <- Tar.hReadEntryHeader hnd case Tar.entryContent entry of Tar.NormalFile _ size -> do content <- BS.hGet hnd size ...6Of course you don't have to read it all in one go (as e does), you can use any appropriate method to read it incrementally.,In addition to I/O errors, this can throw a D if the offset is wrong, or if the file is not valid tar format.(There is also the lower level operation g.gtarSet the 6 position to the position corresponding to the given U.This position is where the entry metadata can be read. If you already know the entry has a body (and perhaps know it's length), you may wish to seek to the body content directly using h.htarSet the  position to the entry content position corresponding to the given U.This position is where the entry content can be read using ordinary I/O operations (though you have to know in advance how big the entry content is). This is  only valid if you  already know/ the entry has a body (i.e. is a normal file).itarThis is a low level variant on f, that can be used to iterate through a tar file, entry by entry.%It has a few differences compared to f:It returns an indication when the end of the tar file is reached.It does not move the 3 position to the beginning of the entry content.It returns the U of the next entry.After this action, the  position is not in any useful place. If you want to skip to the next entry, take the U returned and use i# again. Or if having inspected the  header you want to read the entry content (if it has one) then use h on the original input U.jtarSeek to the end of a tar file, to the position where new entries can be appended, and return that U.If you have a valid Y for this tar file then you should supply it because it allows seeking directly to the correct location.If you do not have an index, then this becomes an expensive linear operation because we have to read each tar entry header from the beginning to find the location immediately after the last entry (this is because tar files have a variable length trailer and we cannot reliably find that by starting at the end). In this mode, it will fail with an exception if the file is not in fact in the tar format.ktarThe Y is compact in memory, and it has a similarly compact external representation.ltar-Read the external representation back into a Y.YZVWX[Uef\T]^_`dklighjcba(c) 2010-2015 Duncan CouttsBSD3duncan@community.haskell.orgportable Safe-InferredQYZVWX[Uef\T]^_`dklighjcbaYZVWX[Uef\T]^_`dklighjcba(c) 2008-2012 Duncan Coutts 2011 Max BolingbrokeBSD3duncan@community.haskell.orgportable Safe-Inferred(7^ mtar9The name of a platform that portability issues arise fromntar%Portability problems in a tar archivestarAn error that occurs if a tar file is a "tar bomb" that would extract files outside of the intended directory.utarErrors arising from tar file names being in some way invalid or dangerousxtarytarThis function checks a sequence of tar entries for file name security problems. It checks that:file paths are not absolute.file paths do not refer outside of the archivefile names are validThese checks are from the perspective of the current OS. That means we check for "C:blah" files on Windows and "/blah" files on Unix. For archive entry types  and  the same checks are done for the link target. A failure in any entry terminates the sequence of entries with an error.#Whenever possible, consider fusing % with packing / unpacking by using  /  with  . Not only it is faster, but also alleviates issues with lazy I/O such as exhaustion of file handlers.ztar Worker of .{tarThis function checks a sequence of tar entries for being a "tar bomb". This means that the tar file does not follow the standard convention that all entries are within a single subdirectory, e.g. a file "foo.tar" would usually have all entries within the "foo/" subdirectory.Given the expected subdirectory, this function checks all entries are within that subdirectroy.2Note: This check must be used in conjunction with  (or ).#Whenever possible, consider fusing % with packing / unpacking by using  /  with . Not only it is faster, but also alleviates issues with lazy I/O such as exhaustion of file handlers.|tar Worker of {.}tarThis function checks a sequence of tar entries for a number of portability issues. It will complain if:The old "Unix V7" or "gnu" formats are used. For maximum portability only the POSIX standard "ustar" format should be used.A non-portable entry type is used. Only ordinary files, hard links, symlinks and directories are portable. Device files, pipes and others are not portable between all common operating systems.Non-ASCII characters are used in file names. There is no agreed portable convention for Unicode or other extended character sets in file names in tar archives.File names that would not be portable to both Unix and Windows. This check includes characters that are valid in both systems and the '/' vs '\' directory separator conventions.#Whenever possible, consider fusing }$ with packing / unpacking by using  /  with ~. Not only it is faster, but also alleviates issues with lazy I/O such as exhaustion of file handlers.~tar Worker of }.ttarPath inside archive.tarExpected top directory.yzuwvx{|st}~nopqrm(c) 2007 Bjorn Bringert, 2008 Andrea Vezzosi, 2008-2009, 2012, 2016 Duncan CouttsBSD3duncan@community.haskell.orgportable Safe-InferredjtarCreates a tar archive from a list of directory or files. Any directories specified will have their contents included recursively. Paths in the archive will be relative to the given base directory.This is a portable implementation of packing suitable for portable archives. In particular it only constructs ,  and  entries. Hard links are treated like ordinary files. Special files like FIFOs (named pipes), sockets or device files will cause problems.This function returns results lazily. Subdirectories are scanned and files are read one by one as the list of entries is consumed. Do not change their contents before the output of   was consumed in full.tarLike  , but allows to specify additional sanity/security checks on the input filenames. This is useful if you know which check will be used on client side in ! / .tar3Pack paths while accounting for overlong filepaths.tar,Construct a tar entry based on a local file.This sets the entry size, the data contained in the file and the file's modification time. If the file is executable then that information is also preserved. File ownership and detailed permissions are not preserved.!The file contents is read lazily.tarConstruct a tar entry based on a local directory (but not its contents).The only attribute of the directory that is used is its modification time. Directory ownership and detailed permissions are not preserved.tar/Construct a tar entry based on a local symlink.-This automatically checks symlink safety via z.tar&This is a utility function, much like . The difference is that it includes the contents of subdirectories.The paths returned are all relative to the top directory. Directory paths are distinguishable by having a trailing path separator (see ).All directories are listed before the files that they contain. Amongst the contents of a directory, subdirectories are listed after normal files. The overall result is that files within a directory will be together in a single contiguous group. This tends to improve file layout and IO performance when creating or extracting tar archives.This function returns results lazily. Subdirectories are not scanned until the files entries in the parent directory have been consumed. If the source directory structure changes before the result is used in full, the behaviour is undefined.tarBase directorytar7Files and directories to pack, relative to the base dirtarBase directorytar7Files and directories to pack, relative to the base dirtar,Full path to find the file on the local disktarPath to use for the tar   in the archivetar,Full path to find the file on the local disktarPath to use for the tar   in the archivetar,Full path to find the file on the local disktarPath to use for the tar   in the archive4(c) 2007 Bjorn Bringert, 2008 Andrea Vezzosi, 2008-2009 Duncan CouttsBSD3duncan@community.haskell.orgportable Safe-Inferredk: !#"$%&'.-(,+*) 23645/01 :789 ;<=>: !#"$%&'.-(,+*) 23645/01 :789 ;<=>(c) 2008-2012 Duncan Coutts 2011 Max BolingbrokeBSD3duncan@community.haskell.orgportable Safe-Inferredlyzuwvx{|st}~nopqrmyzuwvx{|st}~nopqrm"(c) 2007 Bjorn Bringert, 2008 Andrea Vezzosi, 2008-2009, 2012, 2016 Duncan CouttsBSD3duncan@community.haskell.orgportable Safe-Inferred(s{tarCreate local files and directories based on the entries of a tar archive.This is a portable implementation of unpacking suitable for portable archives. It handles  and ( entries and has simulated support for  and  entries. Links are implemented by copying the target file. This therefore works on Windows as well as Unix. All other entry types are ignored, that is they are not unpacked and no exception is raised.If the  ends in an error then it is raised an an exception. Any files or directories that have been unpacked before the error was encountered will not be deleted. For this reason you may want to unpack into an empty directory so that you can easily clean up if unpacking fails part-way.:On its own, this function only checks for security (using z). Use  if you need more checks.tarLike !3, but run custom sanity/security checks instead of z. For example, import Control.Exception (SomeException(..)) import Control.Applicative ((<|>)) unpackAndCheck (\x -> SomeException <$> checkEntryPortability x <|> SomeException <$> checkEntrySecurity x) dir entriestar?Recursively copy the contents of one directory to another path.#This is a rip-off of Cabal library.tarBase directorytarEntries to upacktar,Checks to run on each entry before unpackingtarBase directorytarEntries to upack#(c) 2007 Bjorn Bringert, 2008 Andrea Vezzosi, 2008-2009 Duncan CouttsBSD3duncan@community.haskell.orgportable Safe-InferredttarCreate the external representation of a tar archive by serialising a list of tar entries.The conversion is done lazily.(c) 2007 Bjorn Bringert, 2008 Andrea Vezzosi, 2008-2012 Duncan CouttsBSD3duncan@community.haskell.orgportable Safe-Inferredtar Create a new ".tar" file from a directory of files.)It is equivalent to calling the standard tar program like so: #$ tar -f tarball.tar -C base -c dirThis assumes a directory  ./base/dir with files inside, eg ./base/dir/foo.txt. The file names inside the resulting tar file will be relative to dir, eg  dir/foo.txt.This is a high level "all in one" operation. Since you may need variations on this function it is instructive to see how it is written. It is just: import qualified Data.ByteString.Lazy as BL BL.writeFile tar . Tar.write =<< Tar.pack base pathsNotes:The files and directories must not change during this operation or the result is not well defined.The intention of this function is to create tarballs that are portable between systems. It is not suitable for doing file system backups because file ownership and permissions are not fully preserved. File ownership is not preserved at all. File permissions are set to simple portable values: rw-r--r-- for normal files rwxr-xr-x for executable files rwxr-xr-x for directoriestar%Extract all the files contained in a ".tar" file.)It is equivalent to calling the standard tar program like so: $ tar -x -f tarball.tar -C dirSo for example if the  tarball.tar file contains  foo/bar.txt then this will extract it to dir/foo/bar.txt.This is a high level "all in one" operation. Since you may need variations on this function it is instructive to see how it is written. It is just: import qualified Data.ByteString.Lazy as BL Tar.unpack dir . Tar.read =<< BL.readFile tarNotes:Extracting can fail for a number of reasons. The tarball may be incorrectly formatted. There may be IO or permission errors. In such cases an exception will be thrown and extraction will not continue.Since the extraction may fail part way through it is not atomic. For this reason you may want to extract into an empty directory and, if the extraction fails, recursively delete the directory.Security: only files inside the target directory will be written. Tarballs containing entries that point outside of the tarball (either absolute paths or relative paths) will be caught and an exception will be thrown.tarAppend new entries to a ".tar" file from a directory of files.This is much like , except that all the entries are added to the end of an existing tar file. Or if the file does not already exists then it behaves the same as .tar!Path of the ".tar" file to write.tarBase directorytar6Files and directories to archive, relative to base dirtarDestination directorytarTarballtar!Path of the ".tar" file to write.tarBase directorytar6Files and directories to archive, relative to base dir0M #.BC@A?RSNOPQDEFGHIJKL0M .#BC@A?RSNOPQDEFGHIJKL$%&' ( ) * + , - . / 0 1 2 3 3 4 5 6 7 8 9 : ; < = > ? @ A B C B D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c defghijklmnopqrs tuvwxyz{|}~  "!"#|z|B                    .  -y"/tar-0.6.3.0-AHhMK80mIrX9LE5yZvtD6f-tar-internalCodec.Archive.Tar.Index.UtilsCodec.Archive.TarCodec.Archive.Tar.EntryCodec.Archive.Tar.IndexCodec.Archive.Tar.Checktar#Codec.Archive.Tar.Index.StringTableCodec.Archive.Tar.Index.IntTrieCodec.Archive.Tar.PackAsciiCodec.Archive.Tar.TypesdecodeLongNames entryTarPathcheckEntrySecurity Data.ListunfoldrfoldrfoldlmapCodec.Archive.Tar.ReadCodec.Archive.Tar.LongNames Codec.Archive.Tar.Index.Internallookupfinalise Codec.Archive.Tar.Check.Internal checkSecurity packAndCheckunpackAndCheckcheckPortability checkTarbombcheckEntryTarbombCodec.Archive.Tar.PackpackunpackCodec.Archive.Tar.UnpackCodec.Archive.Tar.WritebeToLe readInt32BEreadWord32OffPtrBE readWord32BEEntries GenEntriesNextDoneFail LinkTargetTarPathFormatV7Format UstarFormat GnuFormat Ownership ownerName groupNameownerIdgroupId EntryContentGenEntryContent NormalFile Directory SymbolicLinkHardLinkCharacterDevice BlockDevice NamedPipeOtherEntryTypeEntryGenEntry entryContententryPermissionsentryOwnership entryTime entryFormat PermissionsTypeCodeDevMinorDevMajor EpochTimeFileSize entryPathordinaryFilePermissionsexecutableFilePermissionsdirectoryPermissions simpleEntry fileEntry longLinkEntrylongSymLinkEntrydirectoryEntry fromTarPathfromTarPathToPosixPathfromTarPathToWindowsPath toTarPath toLinkTargetfromLinkTargetfromLinkTargetToPosixPathfromLinkTargetToWindowsPath unfoldEntries foldEntries foldlEntries mapEntriesmapEntriesNoFail FormatErrorTruncatedArchive ShortTrailer BadTrailer TrailingJunkChecksumIncorrect NotTarFormatUnrecognisedTarFormatHeaderBadNumericEncodingreadDecodeLongNamesErrorTwoTypeKEntriesTwoTypeLEntriesNoLinkEntryAfterTypeKEntryencodeLongNames IndexBuilderTarEntryOffset TarIndexEntry TarFileEntryTarDirTarIndextoListbuildempty addNextEntry skipNextEntryindexNextEntryOffsetindexEndEntryOffsetnextEntryOffset unfinalise hReadEntryhReadEntryHeaderhSeekEntryOffsethSeekEntryContentOffsethReadEntryHeaderOrEofhSeekEndEntryOffset serialise deserialisePortabilityPlatformPortabilityErrorNonPortableFormatNonPortableFileTypeNonPortableEntryNameCharNonPortableFileName TarBombError FileNameErrorInvalidFileNameAbsoluteFileNameUnsafeLinkTargetcheckEntryPortability packFileEntrypackDirectoryEntrypackSymlinkEntrygetDirectoryContentsRecursivewritecreateextractappendbase GHC.IO.UnsafeunsafePerformIO StringTableindex constructStringTableBuilderinsertinserts serialiseSize deserialiseV1 deserialiseV2index'KeytagLeaftagNodeIntTrieIntTrieBuilder TrieLookup CompletionsTrieNodeTrieLeafcompletionsFrom flattenTrieunKeyValueunValue toPosixStringfromPosixStringposixToByteStringbyteToPosixString packAsciiGHC.IOFilePathGHC.BaseMonoidToTarPathResult toTarPath' FileNameEmpty FileNameOKFileNameTooLongsymbolicLinkPermission symlinkEntry splitLongPath toLinkTarget'fromFilePathToNativefromFilePathToWindowsPathbytestring-0.11.5.2Data.ByteString.Lazy.Internal ByteString$fSemigroupGenEntries$fFoldableGenEntries$fTraversableGenEntriesunfoldEntriesM encodeTarPathencodeLinkTargetGHC.IO.Handle.TypesHandlePathComponentIdtoComponentIds serialiseLBS packPaths(directory-1.3.8.5-JAZD79m8kKdDS5sBH1nPFESystem.Directory listDirectory'filepath-1.5.2.0-19TVcaDRjE17YJhawrXYUGSystem.FilePath.PosixhasTrailingPathSeparatorcopyDirectoryRecursive