-z      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxy None *3579FGRemove tmp on run success? Remove tmp on run error? Stream for env text. Stream for run text. Data unpacking text.      None*3579FA chunk describes a block of binary data ready for inclusion in a shell script. For many data blocks, no encoding or decoding is necessary; these are stored in a =. Those blocks needing byte-translation are stored in an . Converts a z into a string safe for inclusion in a shell HERE document and annotates with information to construct a shell decoder for that document, if necessary.A z with nulls is rewritten in a complicated way. Two escape characters are chosen from a class of ASCII printable characters that look like reasonable escape characters; the two that show up least frequently in the document (including 0 times) become the null replacer and the escaper. All instances of these two characters are rewritten to escape sequences formed with the escaper, while nulls are rewritten to the null replacer. Given the two characters thus chosen, a command line with tr and sed7 in sequence can be constructed to decode the document.This encoding doubles the amount of space consumed by the escape characters. In the worst case, where the data is made of all 20 potential escapes, evenly distributed, and one null (so we can't punt on escaping), the data will grow in size by 10 percent. For data that is more evenly distributed over the bytes -- as we might expect of compressed tarballs -- we expect a size growth of two 256ths, or less than 0.8 percent.*Given a byte to replace nulls and an escape byte, rewrites the data such that nulls are mapped to the replace byte, replace bytes are mapped to a pair of escape bytes and the escape byte is is mapped to an escape byte followed by an underscore. For example, if the null replace byte is ! and the escape byte is # then all nulls become !, any ! become ## and all # become #_.This escaping scheme is dictated by the needs of our Sed decoder, which is just two global substitions, one after another. If the escaping were such that, with our characters above, # escaped to ## and ! to #_ , then #_ in the input becomes ##_). We want to run the subsitution for ## first, to catch this; it produces #_V; then Sed feeds the input to the second substitution which unfortunately renders !4. In the alternate scheme, the input is encoded #__, the !1 decoder runs first and ignores it, then the # decoder runs and catches it. When using a pipeline of stream processors to interpret escape sequences, it seems best to ensure that only the very last processor inserts escape characters, to prevent their further interpretation.Given the byte used to replace nulls and the escape byte, undoes the result of the encode operation -- rewriting null replacers to literal nulls and escape patterns to the original bytes. This function is not intended to be used in practice -- it will be shell commands that unpack the data -- but serves to document the ideas behind decoding as well as offering a way to check the encoder.NThe candidate escape characters, with the forms to be used in constructed tr and sed commands.IMany binary strings can be embedded as-is in a HEREDOC, without escaping.[Predicate to determine whether data is represented as an encoded chunk or is unencoded.     Safe *3579FN9Non-overlapping classes of command line argument strings.An  has the form  shellvar name= string. For example, SENDIN=the_clowns.A ! is a file path starting with /, ./, or ../.A  is a string of two dashes, --@, commonly used to indicate the end of options processing.A I is a string beginning with two dashes and then at least one non-dash.A  is a single dash, -*, commonly used to indicate input from stdin or output to stdout. A  > is a beginning with a dash and then at least one non-dash.!A !X is a scheme, separated from the resource, represented as an arbitrary string, by ://z. The scheme consists of ASCII, lower-case letters and digits, and may be multi-part, with each part separated by a + or / (for example, git+ssh). An example URL:  http://example.com/?q=special."A "P is a sequence of hexadecimal digits, upper or lower case, beginning with 0x; for example: 0x01a3.#A ## is a string of decimal digits: 123123.$A $N is a decimal number followed by a multiplicative suffix, in the manner of dd or head0. Note that counts in terms of bytes require B (unlike dd or head'). For a full list of suffixes, see 1 below.%Determine if a particular z matches the given  of token.&Determine if a particular z matches any  of token.'3A ByteString stand-in that demoes each token class.(The recognizer appropriate to each token class. Parses successfully if a the token class is recognized, returning '()'. Most token types are defined in terms of a prefix of the input -- for example, b -- and the parsers for these tokens naturally return as soon as the prefix is recognized.1WA map from suffixes to sizes, following the conventions of command line tools (GNU dd or headW and many others) as well as the standard for binary sizes established by the IEC.  B = 1 K = KiB = 1024B kB = 1000B M = MiB = 1024K MB = 1000kB G = GiB = 1024M GB = 1000MB T = TiB = 1024G TB = 1000GB P = PiB = 1024T PB = 1000TB E = EiB = 1024P EB = 1000PB Z = ZiB = 1024E ZB = 1000EB Y = YiB = 1024Z YB = 1000ZB 20Parse a size, consuming the entire input string.3gParse a size, consuming the entire input string, with the final result bounded by the maximum of a { type. !"#$%&'()*+,-./0123 !"#$%&'()*+,-./0123 !"#$%&'()*+,-./0123  !"#$%&'()*+,-./0123Safe*3579F4Handled styles of Tar archive.8&Scan a lazy ByteString for file magic.456789:;456789:;456789:;456789:;None*3579F@Valid shell variable names consist of a leading letter or underscore and then any number of letters, underscores or digits.A4Valid shell string values contain any byte but null.<=>?@|A}BCD~ <=>?@ABCD AC@DB>?<= <=>?@|A}BCD~None*3579FF-A source of bytes (no writing, only reading).IUA byte-oriented store that can be read from or written to in a streaming fashion.EFGHIJKLMNOPQRSTUVWXYZ[\EFGHIJKLMNOPQRSTUVWXYZ[\LMNOPQRSTUIJKFGHEVWXYZ[\EFGHIJKLMNOPQRSTUVWXYZ[\ZNone*3579F]A ] program archives streams to produce a script that unpacks the file data in a temporary location and runs the command with the attached environment information in that location. The command may be any executable file contents, modulo architectural compatibility. It is written along side the temporary work location, to ensure it does not collide with any files in the archive. The two boolean flags determine when to delete the temporary directory. The first flag determines whether or not to delete successful (exit code zero) runs; the second determines whether or not to delete failed (exit code non-zero) runs._An _T program processes byte streams with the specified chunking to produce a script.a7ARX subprograms process some input to produce a script.]^_`abcd]^_`abab_`d]^c]^_`abcd None*3579F45678@ACD]^_`abab_`]^AC@D45678None*3579Fi/Run CLI tool, processing arguments and options.j.Apply defaulting and overrides appropriate to _ programs.l.Apply defaulting and overrides appropriate to ] programs.sBy default, we encode binary data to HERE docs 4MiB at a time. (The encoded result may be up to 10% larger, though 1% is more likely.)t$The default task is a no-op call to  /bin/true.efghijklmnopqrstuvwxyefghijklmnopqrstuvwxijklmnopqrstefghyuvwxefghijklmnopqrstuvwxy      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOOPQRSTUVWX YZ[\]^_`abbccdefghijklmnopqrstuvwxyz{|}~NGHarx_JaqNwBoab0V2Pnm2W1vtJSSystem.Posix.ARX.TMPXToolsSystem.Posix.ARX.HEREDatSystem.Posix.ARX.CLI.CLTokensSystem.Posix.ARX.TarSystem.Posix.ARX.ShSystem.Posix.ARX.CLI.OptionsSystem.Posix.ARX.ProgramsSystem.Posix.ARX.CLISystem.Posix.ARXTemplaterm0rm1envrundatrender findChunkscoalesce markHolesisHole$fShowTemplate EscapeCharChunk SafeChunk EncodedChunkchunkencodedecodeescapessafeForHereDocencodedscript$fIsStringChunkClass EnvBinding QualifiedPathDashDash LongOptionDash ShortOptionURLHexNum DecimalNumSizematch recognizeexemplar recognizerschemeSeparatorvarFirstvarBodyisLongOptionCharisShortOptionChar isSchemeChar isHexDigitisURLSchemeCharsizessize sizeBoundedTarTARTGZTBZmagicbzMagicgzMagictarMagicRawrawRenderVarValsetEUvalvar ArgsParser ByteSource ByteStringIOStreamSTDIOPathshdattmpx blockSize outputFileioStreamqPathrm scriptToRuncmdsatisfyanyArgargargPrim<@>tokCLslashesTMPXSHDATARX interpret $fARXTMPX[]$fARXSHDATByteStringZOMZeroOneManymain shdatResolveshdatCheckStreams tmpxResolvetmpxCheckStreamstmpxOpenopenByteSource inIOStream outIOStream arIOStream defaultBlock defaultTaskstreamsMessage blockMessageerrdie $fMonoidZOMbytes_6VWy06pWzJq9evDvK2d4w6Data.ByteString.InternalbaseGHC.EnumBounded $fRender[] $fRender[]0$fRawVar $fRenderVar$fRawVal $fRenderVal