Check-in [1272c814e3]
Not logged in
Overview
Comment:BSD related bugfix
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 1272c814e3d045b90aa3a9012e9df99b6e05c253
User & Date: martin_vahi on 2016-06-24 17:15:53
Other Links: manifest | tags
Context
2016-06-24 17:29
BSD related bugfix 2 check-in: 8276376b64 user: martin_vahi tags: trunk
2016-06-24 17:15
BSD related bugfix check-in: 1272c814e3 user: martin_vahi tags: trunk
2016-06-24 16:40
Silktorrent milestone release 2016_06_24 check-in: 76268374d5 user: martin_vahi tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Modified milestone_releases/2016_06_24_Silktorrent/README.md from [233d073974] to [0143b10a32].

    54     54   feet, mail-drones, commuters, who just pick up and
    55     55   dump files through their cellphone WiFi, etc.
    56     56   **Silktorrent e-mail or an instant messaging
    57     57   service can be implemented by saving extra
    58     58   records to a separate database, where there is a
    59     59   relation between the tar-file name, recipient ID and 
    60     60   suggested-deletion-date.** 
    61         -Counter-measures for Denial-of-Service attacks is 
           61  +Counter-measures for Denial-of-Service attacks are 
    62     62   based on authentication, timing, location(channel).
    63     63   
    64     64   
    65     65   One of the core ideas of the Silktorrent is that 
    66     66   the Silktorrent applications must assume that the 
    67     67   location of the tar-file can not be concluded from
    68     68   its name. Silktorrent applications ask for tar-files
    69         -from agents, who might not have the asked tar-file 
           69  +from agents, who might not have the requested tar-file 
    70     70   available and the agents might not even be able to 
    71         -retrieve the asked tar-file. The agents are free to
           71  +retrieve the requested tar-file. The agents are free to
    72     72   use whatever [crazy](http://longterm.softf1.com/specifications/lightmsgp/v2/)
    73     73   addressing scheme that they want.
    74     74   
    75     75   
    76     76   ---------------------------------------------------------------------------
    77     77   
    78     78   ##             Further Censorship Countermeasures
................................................................................
    98     98   e-mail server, told the e-mail server the 
    99     99   suggested-deletion-date. The header contains a file
   100    100   named 
   101    101   
   102    102       ./silktorrent_salt.txt
   103    103       
   104    104   which probabilistically guarantees that the 
   105         -size and bits-tream of the payload can not be
          105  +size and bit-stream of the payload can not be
   106    106   fully deduced from the tar-file name, forcing
   107    107   censoring parties to download a considerable 
   108    108   amount of tar-files that they do not need.
   109    109   
   110    110   
   111    111   ---------------------------------------------------------------------------
   112    112   

Added milestone_releases/2016_06_24_Silktorrent/src/74b21173ca6e7d0f1c268e9844a5d25672ebed801e71d0bfi_d708a73cdf8dfa3f34b368ba9a36b00792adf887724c201734cdec9e90ef87aeh_0217994s_1000v.stblob version [].


Deleted milestone_releases/2016_06_24_Silktorrent/src/silktorrent_packager_t1.bash version [8fbcdf9517].

     1         -#!/usr/bin/env bash
     2         -#==========================================================================
     3         -#
     4         -# The MIT license from the 
     5         -# http://www.opensource.org/licenses/mit-license.php
     6         -#
     7         -# Copyright 2016, martin.vahi@softf1.com that has an
     8         -# Estonian personal identification code of 38108050020.
     9         -#
    10         -# Permission is hereby granted, free of charge, to 
    11         -# any person obtaining a copy of this software and 
    12         -# associated documentation files (the "Software"), 
    13         -# to deal in the Software without restriction, including 
    14         -# without limitation the rights to use, copy, modify, merge, publish, 
    15         -# distribute, sublicense, and/or sell copies of the Software, and 
    16         -# to permit persons to whom the Software is furnished to do so, 
    17         -# subject to the following conditions:
    18         -#
    19         -# The above copyright notice and this permission notice shall be included 
    20         -# in all copies or substantial portions of the Software.
    21         -#
    22         -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 
    23         -# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 
    24         -# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 
    25         -# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 
    26         -# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 
    27         -# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 
    28         -# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
    29         -#
    30         -#==========================================================================
    31         -S_FP_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
    32         -S_FP_ORIG="`pwd`"
    33         -S_TIMESTAMP="`date +%Y`_`date +%m`_`date +%d`_T_`date +%H`h_`date +%M`min_`date +%S`s"
    34         -
    35         -#--------------------------------------------------------------------------
    36         -
    37         -SB_TMP_FOLDER_EXISTS="f" # to omit one useless and slow file system access
    38         -S_FP_TMP_FOLDER=""
    39         -
    40         -
    41         -func_mmmv_silktorrent_packager_t1_exit_without_any_errors() {
    42         -    local S_0=""
    43         -    local S_1=""
    44         -    if [ "$SB_TMP_FOLDER_EXISTS" == "t" ]; then
    45         -       S_0= 
    46         -    fi
    47         -    exit 0 # exit without an error
    48         -} # func_mmmv_silktorrent_packager_t1_exit_without_any_errors
    49         -
    50         -#--------------------------------------------------------------------------
    51         -
    52         -S_FUNC_MMMV_OPERATING_SYSTEM_TYPE_T1_RESULT=""
    53         -func_mmmv_operating_system_type_t1() {
    54         -    if [ "$S_FUNC_MMMV_OPERATING_SYSTEM_TYPE_T1_RESULT" == "" ]; then
    55         -        S_TMP_0="`uname -a | grep -E [Ll]inux`"
    56         -        if [ "$S_TMP_0" != "" ]; then
    57         -            S_FUNC_MMMV_OPERATING_SYSTEM_TYPE_T1_RESULT="Linux"
    58         -        else
    59         -            S_TMP_0="`uname -a | grep BSD `"
    60         -            if [ "$S_TMP_0" != "" ]; then
    61         -                S_FUNC_MMMV_OPERATING_SYSTEM_TYPE_T1_RESULT="BSD"
    62         -            else
    63         -                S_FUNC_MMMV_OPERATING_SYSTEM_TYPE_T1_RESULT="undetermined"
    64         -            fi
    65         -        fi
    66         -    fi
    67         -} # func_mmmv_operating_system_type_t1
    68         -
    69         -#--------------------------------------------------------------------------
    70         -
    71         -func_mmmv_operating_system_type_t1
    72         -if [ "$S_FUNC_MMMV_OPERATING_SYSTEM_TYPE_T1_RESULT" != "Linux" ]; then
    73         -    if [ "$S_FUNC_MMMV_OPERATING_SYSTEM_TYPE_T1_RESULT" != "BSD" ]; then
    74         -        echo ""
    75         -        echo "  The classical command line utilities at "
    76         -        echo "  different operating systems, for example, Linux and BSD,"
    77         -        echo "  differ. This script is designed to run only on "
    78         -        echo "  Linux and some BSD variants."
    79         -        echo "  If You are willing to risk that some of Your data "
    80         -        echo "  is deleted and/or Your operating system instance"
    81         -        echo "  becomes permanently flawed, to the point that "
    82         -        echo "  it will not even boot, then You may edit the Bash script that "
    83         -        echo "  displays this error message by modifying the test that "
    84         -        echo "  checks for the operating system type."
    85         -        echo ""
    86         -        echo "  If You do decide to edit this Bash script, then "
    87         -        echo "  a recommendation is to test Your modifications "
    88         -        echo "  within a virtual machine or, if virtual machines are not"
    89         -        echo "  an option, as some new operating system user that does not have "
    90         -        echo "  any access to the vital data/files."
    91         -        echo "  GUID=='ae8bec13-4773-4811-94a2-83f2c08160e7'"
    92         -        echo ""
    93         -        echo "  Aborting script without doing anything."
    94         -        echo ""
    95         -        exit 1 # exit with error
    96         -    fi
    97         -fi
    98         -
    99         -
   100         -#--------------------------------------------------------------------------
   101         -
   102         -SB_EXISTS_ON_PATH_T1_RESULT="f"
   103         -func_sb_exists_on_path_t1 () {
   104         -    local S_NAME_OF_THE_EXECUTABLE_1="$1" # first function argument
   105         -    #--------
   106         -    # Function calls like
   107         -    #
   108         -    #     func_sb_exists_on_path_t1 ""
   109         -    #     func_sb_exists_on_path_t1 " "
   110         -    #     func_sb_exists_on_path_t1 "ls ps" # contains a space
   111         -    #
   112         -    # are not allowed.
   113         -    if [ "$S_NAME_OF_THE_EXECUTABLE_1" == "" ] ; then
   114         -        echo ""
   115         -        echo "The Bash function "
   116         -        echo ""
   117         -        echo "    func_sb_exists_on_path_t1 "
   118         -        echo ""
   119         -        echo "is not designed to handle an argument that "
   120         -        echo "equals with an empty string."
   121         -        echo "GUID=='d26d1825-90bf-4ab7-94a2-83f2c08160e7'"
   122         -        echo ""
   123         -        #----
   124         -        cd $S_FP_ORIG
   125         -        exit 1 # exit with error
   126         -    fi
   127         -    local S_TMP_0="`printf \"$S_NAME_OF_THE_EXECUTABLE_1\" | gawk '{gsub(/\s/,"");printf "%s", $1 }'`"
   128         -    if [ "$S_NAME_OF_THE_EXECUTABLE_1" != "$S_TMP_0" ] ; then
   129         -        echo ""
   130         -        echo "The Bash function "
   131         -        echo ""
   132         -        echo "    func_sb_exists_on_path_t1 "
   133         -        echo ""
   134         -        echo "is not designed to handle an argument value that contains "
   135         -        echo "spaces or tabulation characters."
   136         -        echo "The received value in parenthesis:($S_NAME_OF_THE_EXECUTABLE_1)."
   137         -        echo "GUID=='8b402457-dd5b-4921-b2a2-83f2c08160e7'"
   138         -        echo ""
   139         -        #----
   140         -        cd $S_FP_ORIG
   141         -        exit 1 # exit with error
   142         -    fi
   143         -    #--------
   144         -    S_TMP_0="\`which $S_NAME_OF_THE_EXECUTABLE_1 2>/dev/null\`"
   145         -    local S_TMP_1=""
   146         -    local S_TMP_2="S_TMP_1=$S_TMP_0"
   147         -    eval ${S_TMP_2}
   148         -    #----
   149         -    if [ "$S_TMP_1" == "" ] ; then
   150         -        SB_EXISTS_ON_PATH_T1_RESULT="f"
   151         -    else
   152         -        SB_EXISTS_ON_PATH_T1_RESULT="t"
   153         -    fi
   154         -} # func_sb_exists_on_path_t1 
   155         -
   156         -
   157         -
   158         -func_assert_exists_on_path_t2 () {
   159         -    local S_NAME_OF_THE_EXECUTABLE_1="$1" # first function argument
   160         -    local S_NAME_OF_THE_EXECUTABLE_2="$2" # optional argument
   161         -    local S_NAME_OF_THE_EXECUTABLE_3="$3" # optional argument
   162         -    local S_NAME_OF_THE_EXECUTABLE_4="$4" # optional argument
   163         -    #--------
   164         -    # Function calls like
   165         -    #
   166         -    #     func_assert_exists_on_path_t2  ""    ""  "ls"
   167         -    #     func_assert_exists_on_path_t2  "ls"  ""  "ps"
   168         -    #
   169         -    # are not allowed by the spec of this function, but it's OK to call
   170         -    #
   171         -    #     func_assert_exists_on_path_t2  "ls" "" 
   172         -    #     func_assert_exists_on_path_t2  "ls" "ps" ""
   173         -    #     func_assert_exists_on_path_t2  "ls" ""   "" ""
   174         -    #
   175         -    #
   176         -    local SB_THROW="f"
   177         -    if [ "$S_NAME_OF_THE_EXECUTABLE_1" == "" ] ; then
   178         -        SB_THROW="t"
   179         -    else
   180         -        if [ "$S_NAME_OF_THE_EXECUTABLE_2" == "" ] ; then
   181         -            if [ "$S_NAME_OF_THE_EXECUTABLE_3" != "" ] ; then
   182         -                SB_THROW="t"
   183         -            fi
   184         -            if [ "$S_NAME_OF_THE_EXECUTABLE_4" != "" ] ; then
   185         -                SB_THROW="t"
   186         -            fi
   187         -        else
   188         -            if [ "$S_NAME_OF_THE_EXECUTABLE_3" == "" ] ; then
   189         -                if [ "$S_NAME_OF_THE_EXECUTABLE_4" != "" ] ; then
   190         -                    SB_THROW="t"
   191         -                fi
   192         -            fi
   193         -        fi
   194         -    fi
   195         -    #----
   196         -    if [ "$SB_THROW" == "t" ] ; then
   197         -        echo ""
   198         -        echo "The Bash function "
   199         -        echo ""
   200         -        echo "    func_assert_exists_on_path_t2 "
   201         -        echo ""
   202         -        echo "is not designed to handle series of arguments, where "
   203         -        echo "empty strings preced non-empty strings."
   204         -        echo "GUID=='ebdae326-6445-46bf-9292-83f2c08160e7'"
   205         -        echo ""
   206         -        #----
   207         -        cd $S_FP_ORIG
   208         -        exit 1 # exit with error
   209         -    fi
   210         -    if [ "$5" != "" ] ; then
   211         -        echo ""
   212         -        echo "This Bash function is designed to work with at most 4 input arguments"
   213         -        echo "GUID=='522b025f-199b-49f1-a292-83f2c08160e7'"
   214         -        echo ""
   215         -        #----
   216         -        cd $S_FP_ORIG
   217         -        exit 1 # exit with error
   218         -    fi
   219         -    #--------
   220         -    # Function calls like
   221         -    #
   222         -    #     func_assert_exists_on_path_t2 " "
   223         -    #     func_assert_exists_on_path_t2 "ls ps" # contains a space
   224         -    #
   225         -    # are not allowed.
   226         -    SB_THROW="f" 
   227         -    local S_TMP_0=""
   228         -    local S_TMP_1=""
   229         -    local S_TMP_2=""
   230         -    #----
   231         -    if [ "$SB_THROW" == "f" ] ; then
   232         -        S_TMP_0="`printf \"$S_NAME_OF_THE_EXECUTABLE_1\" | gawk '{gsub(/\s/,"");printf "%s", $1 }'`"
   233         -        if [ "$S_NAME_OF_THE_EXECUTABLE_1" != "$S_TMP_0" ] ; then
   234         -            SB_THROW="t" 
   235         -            S_TMP_1="$S_NAME_OF_THE_EXECUTABLE_1"
   236         -            S_TMP_2="GUID=='4f034735-f71d-4fda-9192-83f2c08160e7'"
   237         -        fi
   238         -    fi
   239         -    #----
   240         -    if [ "$SB_THROW" == "f" ] ; then
   241         -        S_TMP_0="`printf \"$S_NAME_OF_THE_EXECUTABLE_2\" | gawk '{gsub(/\s/,"");printf "%s", $1 }'`"
   242         -        if [ "$S_NAME_OF_THE_EXECUTABLE_2" != "$S_TMP_0" ] ; then
   243         -            SB_THROW="t" 
   244         -            S_TMP_1="$S_NAME_OF_THE_EXECUTABLE_2"
   245         -            S_TMP_2="GUID=='d8ee8e35-3634-4963-b192-83f2c08160e7'"
   246         -        fi
   247         -    fi
   248         -    #----
   249         -    if [ "$SB_THROW" == "f" ] ; then
   250         -        S_TMP_0="`printf \"$S_NAME_OF_THE_EXECUTABLE_3\" | gawk '{gsub(/\s/,"");printf "%s", $1 }'`"
   251         -        if [ "$S_NAME_OF_THE_EXECUTABLE_3" != "$S_TMP_0" ] ; then
   252         -            SB_THROW="t" 
   253         -            S_TMP_1="$S_NAME_OF_THE_EXECUTABLE_3"
   254         -            S_TMP_2="GUID=='198c2e17-f678-451d-8192-83f2c08160e7'"
   255         -        fi
   256         -    fi
   257         -    #----
   258         -    if [ "$SB_THROW" == "f" ] ; then
   259         -        S_TMP_0="`printf \"$S_NAME_OF_THE_EXECUTABLE_4\" | gawk '{gsub(/\s/,"");printf "%s", $1 }'`"
   260         -        if [ "$S_NAME_OF_THE_EXECUTABLE_4" != "$S_TMP_0" ] ; then
   261         -            SB_THROW="t" 
   262         -            S_TMP_1="$S_NAME_OF_THE_EXECUTABLE_4"
   263         -            S_TMP_2="GUID=='405c6c1c-7830-4bc4-a492-83f2c08160e7'"
   264         -        fi
   265         -    fi
   266         -    #--------
   267         -    if [ "$SB_THROW" == "t" ] ; then
   268         -        echo ""
   269         -        echo "The Bash function "
   270         -        echo ""
   271         -        echo "    func_assert_exists_on_path_t2 "
   272         -        echo ""
   273         -        echo "is not designed to handle an argument value that contains "
   274         -        echo "spaces or tabulation characters."
   275         -        echo "The unaccepted value in parenthesis:($S_TMP_1)."
   276         -        echo "Branch $S_TMP_2."
   277         -        echo "GUID=='efcc3ce1-f52a-4f28-b582-83f2c08160e7'"
   278         -        echo ""
   279         -        #----
   280         -        cd $S_FP_ORIG
   281         -        exit 1 # exit with error
   282         -    fi
   283         -    SB_THROW="f" # Just a reset, should I forget to reset it later.
   284         -    #---------------
   285         -    S_TMP_0="\`which $S_NAME_OF_THE_EXECUTABLE_1 2>/dev/null\`"
   286         -    local S_TMP_1=""
   287         -    local S_TMP_2="S_TMP_1=$S_TMP_0"
   288         -    eval ${S_TMP_2}
   289         -    #----
   290         -    if [ "$S_TMP_1" == "" ] ; then
   291         -        if [ "$S_NAME_OF_THE_EXECUTABLE_2" == "" ] ; then
   292         -        if [ "$S_NAME_OF_THE_EXECUTABLE_3" == "" ] ; then
   293         -        if [ "$S_NAME_OF_THE_EXECUTABLE_4" == "" ] ; then
   294         -            echo ""
   295         -            echo "This bash script requires the \"$S_NAME_OF_THE_EXECUTABLE_1\" to be on the PATH."
   296         -            echo "GUID=='b10b8c12-1d9e-4a4b-b482-83f2c08160e7'"
   297         -            echo ""
   298         -            #----
   299         -            cd $S_FP_ORIG
   300         -            exit 1 # exit with error
   301         -        fi
   302         -        fi
   303         -        fi
   304         -    else
   305         -        return # at least one of the programs was available at the PATH
   306         -    fi
   307         -    #--------
   308         -    S_TMP_0="\`which $S_NAME_OF_THE_EXECUTABLE_2 2>/dev/null\`"
   309         -    S_TMP_1=""
   310         -    S_TMP_2="S_TMP_1=$S_TMP_0"
   311         -    eval ${S_TMP_2}
   312         -    #----
   313         -    if [ "$S_TMP_1" == "" ] ; then
   314         -        if [ "$S_NAME_OF_THE_EXECUTABLE_3" == "" ] ; then
   315         -        if [ "$S_NAME_OF_THE_EXECUTABLE_4" == "" ] ; then
   316         -            echo ""
   317         -            echo "This bash script requires that either \"$S_NAME_OF_THE_EXECUTABLE_1\" or "
   318         -            echo " \"$S_NAME_OF_THE_EXECUTABLE_2\" is available on the PATH."
   319         -            echo "GUID=='a3730829-4edf-4221-9482-83f2c08160e7'"
   320         -            echo ""
   321         -            #----
   322         -            cd $S_FP_ORIG
   323         -            exit 1 # exit with error
   324         -        fi
   325         -        fi
   326         -    else
   327         -        return # at least one of the programs was available at the PATH
   328         -    fi
   329         -    #--------
   330         -    S_TMP_0="\`which $S_NAME_OF_THE_EXECUTABLE_3 2>/dev/null\`"
   331         -    S_TMP_1=""
   332         -    S_TMP_2="S_TMP_1=$S_TMP_0"
   333         -    eval ${S_TMP_2}
   334         -    #----
   335         -    if [ "$S_TMP_1" == "" ] ; then
   336         -        if [ "$S_NAME_OF_THE_EXECUTABLE_4" == "" ] ; then
   337         -            echo ""
   338         -            echo "This bash script requires that either \"$S_NAME_OF_THE_EXECUTABLE_1\" or "
   339         -            echo " \"$S_NAME_OF_THE_EXECUTABLE_2\" or \"$S_NAME_OF_THE_EXECUTABLE_3\" "
   340         -            echo "is available on the PATH."
   341         -            echo "GUID=='50757072-5884-4bf0-8482-83f2c08160e7'"
   342         -            echo ""
   343         -            #----
   344         -            cd $S_FP_ORIG
   345         -            exit 1 # exit with error
   346         -        fi
   347         -    else
   348         -        return # at least one of the programs was available at the PATH
   349         -    fi
   350         -    #--------
   351         -    S_TMP_0="\`which $S_NAME_OF_THE_EXECUTABLE_4 2>/dev/null\`"
   352         -    S_TMP_1=""
   353         -    S_TMP_2="S_TMP_1=$S_TMP_0"
   354         -    eval ${S_TMP_2}
   355         -    #----
   356         -    if [ "$S_TMP_1" == "" ] ; then
   357         -        echo ""
   358         -        echo "This bash script requires that either \"$S_NAME_OF_THE_EXECUTABLE_1\" or "
   359         -        echo " \"$S_NAME_OF_THE_EXECUTABLE_2\" or \"$S_NAME_OF_THE_EXECUTABLE_3\" or "
   360         -        echo " \"$S_NAME_OF_THE_EXECUTABLE_4\" is available on the PATH."
   361         -        echo "GUID=='ece93119-b340-44ea-8382-83f2c08160e7'"
   362         -        echo ""
   363         -        #----
   364         -        cd $S_FP_ORIG
   365         -        exit 1 # exit with error
   366         -    else
   367         -        return # at least one of the programs was available at the PATH
   368         -    fi
   369         -    #--------
   370         -} # func_assert_exists_on_path_t2
   371         -
   372         -func_assert_exists_on_path_t2 "bash"     # this is a bash script, but it does not hurt
   373         -func_assert_exists_on_path_t2 "basename" # for extracting file names from full paths
   374         -func_assert_exists_on_path_t2 "cat"    # opposite to split
   375         -func_assert_exists_on_path_t2 "sha256sum" "sha256" "rhash"
   376         -func_assert_exists_on_path_t2 "tigerdeep" "rhash"
   377         -func_assert_exists_on_path_t2 "whirlpooldeep" "rhash"
   378         -func_assert_exists_on_path_t2 "tar"
   379         -#--------
   380         -func_assert_exists_on_path_t2 "file"   # for checking the MIME type of the potential tar file
   381         -func_assert_exists_on_path_t2 "filesize" "ruby"
   382         -func_assert_exists_on_path_t2 "gawk"
   383         -#func_assert_exists_on_path_t2 "grep"
   384         -#func_assert_exists_on_path_t2 "readlink"
   385         -func_assert_exists_on_path_t2 "ruby"  # anything over/equal v.2.1 will probably do
   386         -#func_assert_exists_on_path_t2 "split" # for cutting files
   387         -#func_assert_exists_on_path_t2 "test"
   388         -func_assert_exists_on_path_t2 "uname"  # to check the OS type
   389         -func_assert_exists_on_path_t2 "uuidgen" "uuid" # GUID generation on Linux and BSD
   390         -#func_assert_exists_on_path_t2 "xargs"   
   391         -func_assert_exists_on_path_t2 "wc" # for checking hash lengths   
   392         -
   393         -
   394         -#--------------------------------------------------------------------------
   395         -
   396         -func_mmmv_exc_hash_function_input_verification_t1() { 
   397         -    local S_NAME_OF_THE_BASH_FUNCTION="$1" # The name of the Bash function.
   398         -    local S_FP_2_AN_EXISTING_FILE="$2" # The first argument of the Bash function.
   399         -    #--------
   400         -    if [ "$S_NAME_OF_THE_BASH_FUNCTION" == "" ] ; then
   401         -        echo ""
   402         -        echo "The implementation of the function that "
   403         -        echo "calls the "
   404         -        echo ""
   405         -        echo "    func_mmmv_exc_hash_function_input_verification_t1"
   406         -        echo ""
   407         -        echo "is flawed. The call to the "
   408         -        echo ""
   409         -        echo "    func_mmmv_exc_hash_function_input_verification_t1"
   410         -        echo ""
   411         -        echo "misses the first argument or the first argument is an empty string."
   412         -        echo "GUID=='5daa2d36-5d4a-45ac-b482-83f2c08160e7'"
   413         -        echo ""
   414         -        #----
   415         -        cd $S_FP_ORIG
   416         -        exit 1 # exit with error
   417         -    fi
   418         -    local S_TMP_0="`printf \"$S_NAME_OF_THE_BASH_FUNCTION\" | gawk '{gsub(/\s/,"");printf "%s", $1 }'`"
   419         -    if [ "$S_NAME_OF_THE_BASH_FUNCTION" != "$S_TMP_0" ] ; then
   420         -        echo ""
   421         -        echo "The implementation of the function that "
   422         -        echo "calls the "
   423         -        echo ""
   424         -        echo "    func_mmmv_exc_hash_function_input_verification_t1"
   425         -        echo ""
   426         -        echo "is flawed. Function names are not allowed to contain spaces or tabs."
   427         -        echo "GUID=='32fcb7e5-7f9c-42c5-a382-83f2c08160e7'"
   428         -        echo ""
   429         -        #----
   430         -        cd $S_FP_ORIG
   431         -        exit 1 # exit with error
   432         -    fi
   433         -    #--------
   434         -    # Function calls like
   435         -    #
   436         -    #     <function name> ""
   437         -    #     <function name> " "
   438         -    #
   439         -    # are not allowed.
   440         -    local S_TMP_0="`printf \"$S_FP_2_AN_EXISTING_FILE\" | gawk '{gsub(/\s/,"");printf "%s", $1 }'`"
   441         -    if [ "$S_TMP_0" == "" ] ; then
   442         -        echo ""
   443         -        echo "The Bash function "
   444         -        echo ""
   445         -        echo "    $S_NAME_OF_THE_BASH_FUNCTION"
   446         -        echo ""
   447         -        echo "is not designed to handle an argument that "
   448         -        echo "equals with an empty string or a series of spaces and tabs."
   449         -        echo "GUID=='59c6d156-1693-41f5-a282-83f2c08160e7'"
   450         -        echo ""
   451         -        #----
   452         -        cd $S_FP_ORIG
   453         -        exit 1 # exit with error
   454         -    fi
   455         -    #--------
   456         -    if [ ! -e $S_FP_2_AN_EXISTING_FILE ] ; then
   457         -        echo ""
   458         -        echo "The file "
   459         -        echo ""
   460         -        echo "    $S_FP_2_AN_EXISTING_FILE "
   461         -        echo ""
   462         -        echo "is missing or it is a broken link."
   463         -        echo "GUID=='2bdfa731-a82d-4c24-9182-83f2c08160e7'"
   464         -        echo ""
   465         -        #----
   466         -        cd $S_FP_ORIG
   467         -        exit 1 # exit with error
   468         -    fi
   469         -    if [ -d $S_FP_2_AN_EXISTING_FILE ] ; then
   470         -        echo ""
   471         -        echo "The file path "
   472         -        echo ""
   473         -        echo "    $S_FP_2_AN_EXISTING_FILE "
   474         -        echo ""
   475         -        echo "references a folder, but a file is expected."
   476         -        echo "GUID=='342e52a2-f7fa-41c9-b572-83f2c08160e7'"
   477         -        echo ""
   478         -        #----
   479         -        cd $S_FP_ORIG
   480         -        exit 1 # exit with error
   481         -    fi
   482         -    #--------------------
   483         -    # At this line the verifications have all passed.
   484         -    #--------------------
   485         -} # func_mmmv_exc_hash_function_input_verification_t1
   486         -
   487         -
   488         -#--------------------------------------------------------------------------
   489         -
   490         -S_FUNC_MMMV_GUID_T1_RESULT="not_yet_set"
   491         -S_FUNC_MMMV_GUID_T1_MODE="" # optim. to skip repeating console tool selection
   492         -func_mmmv_GUID_t1() { 
   493         -    # Does not take any arguments.
   494         -    #--------
   495         -    #func_mmmv_exc_hash_function_input_verification_t1 "func_mmmv_GUID_t1" "$1"
   496         -    #--------------------
   497         -    # Mode selection:
   498         -    if [ "$S_FUNC_MMMV_GUID_T1_MODE" == "" ] ; then
   499         -        SB_EXISTS_ON_PATH_T1_RESULT="f"  # if-block init
   500         -        #----
   501         -        if [ "$SB_EXISTS_ON_PATH_T1_RESULT" == "f" ] ; then
   502         -            S_TMP_0="uuidgen" # Linux version
   503         -            func_sb_exists_on_path_t1 "$S_TMP_0" 
   504         -            if [ "$SB_EXISTS_ON_PATH_T1_RESULT" == "t" ] ; then
   505         -                 S_FUNC_MMMV_GUID_T1_MODE="$S_TMP_0"
   506         -            fi
   507         -        fi
   508         -        #----
   509         -        if [ "$SB_EXISTS_ON_PATH_T1_RESULT" == "f" ] ; then
   510         -            S_TMP_0="uuid"    # BSD version
   511         -            func_sb_exists_on_path_t1 "$S_TMP_0" 
   512         -            if [ "$SB_EXISTS_ON_PATH_T1_RESULT" == "t" ] ; then
   513         -                 S_FUNC_MMMV_GUID_T1_MODE="$S_TMP_0"
   514         -            fi
   515         -        fi
   516         -        #--------
   517         -        if [ "$S_FUNC_MMMV_GUID_T1_MODE" == "" ] ; then
   518         -            echo ""
   519         -            echo "All of the GUID generation implementations that this script " 
   520         -            echo "is capable of using (uuidgen, uuid) "
   521         -            echo "are missing from the PATH."
   522         -            echo "GUID=='92cc9502-5791-4674-8672-83f2c08160e7'"
   523         -            echo ""
   524         -            #----
   525         -            cd $S_FP_ORIG
   526         -            exit 1 # exit with error
   527         -        fi
   528         -        #--------
   529         -        if [ "$?" != "0" ]; then
   530         -            echo ""
   531         -            echo "This script is flawed."
   532         -            echo "GUID=='69f2c03e-920f-4bbf-8472-83f2c08160e7'"
   533         -            echo ""
   534         -            #----
   535         -            cd $S_FP_ORIG
   536         -            exit 1 # exit with error
   537         -        fi
   538         -        #--------
   539         -    fi
   540         -    #--------------------
   541         -    S_FUNC_MMMV_GUID_T1_RESULT=""
   542         -    #--------------------
   543         -    if [ "$S_FUNC_MMMV_GUID_T1_MODE" == "uuidgen" ]; then
   544         -        S_TMP_0="`uuidgen`"
   545         -        if [ "$?" != "0" ]; then
   546         -            echo ""
   547         -            echo "The console application \"uuidgen\" "
   548         -            echo "exited with an error."
   549         -            echo ""
   550         -            echo "----console--outut--citation--start-----"
   551         -            echo "`uuidgen`" # stdout and stderr
   552         -            echo "----console--outut--citation--end-------"
   553         -            echo ""
   554         -            echo "GUID=='899ef135-d280-406a-b362-83f2c08160e7'"
   555         -            echo ""
   556         -            #----
   557         -            cd $S_FP_ORIG
   558         -            exit 1 # exit with error
   559         -        fi
   560         -        #---- 
   561         -        S_FUNC_MMMV_GUID_T1_RESULT="$S_TMP_0"
   562         -    fi
   563         -    #--------------------
   564         -    if [ "$S_FUNC_MMMV_GUID_T1_MODE" == "uuid" ]; then
   565         -        S_TMP_0="`uuid`"
   566         -        if [ "$?" != "0" ]; then
   567         -            echo ""
   568         -            echo "The console application \"uuid\" "
   569         -            echo "exited with an error."
   570         -            echo ""
   571         -            echo "----console--outut--citation--start-----"
   572         -            echo "`uuid`" # stdout and stderr
   573         -            echo "----console--outut--citation--end-------"
   574         -            echo ""
   575         -            echo "GUID=='185b4073-5086-4196-9462-83f2c08160e7'"
   576         -            echo ""
   577         -            #----
   578         -            cd $S_FP_ORIG
   579         -            exit 1 # exit with error
   580         -        fi
   581         -        #---- 
   582         -        S_FUNC_MMMV_GUID_T1_RESULT="$S_TMP_0"
   583         -    fi
   584         -    #--------------------
   585         -    S_TMP_0="`printf \"$S_FUNC_MMMV_GUID_T1_RESULT\" | wc -m `"
   586         -    S_TMP_1="36"
   587         -    if [ "$S_TMP_0" != "$S_TMP_1" ]; then
   588         -        echo ""
   589         -        echo "According to the GUID specification, IETF RFC 4122,  "
   590         -        echo "the lenght of the GUID is "
   591         -        echo "$S_TMP_1 characters, but the result of the "
   592         -        echo ""
   593         -        echo "    func_mmmv_GUID_t1"
   594         -        echo ""
   595         -        echo "is something else. The flawed GUID candidate in parenthesis:"
   596         -        echo "($S_FUNC_MMMV_GUID_T1_RESULT)"
   597         -        echo ""
   598         -        echo "The lenght candidate of the flawed GUID candidate in parenthesis:"
   599         -        echo "($S_TMP_0)."
   600         -        echo ""
   601         -        echo "GUID=='8fc9064f-4364-490c-9262-83f2c08160e7'"
   602         -        echo ""
   603         -        #----
   604         -        cd $S_FP_ORIG
   605         -        exit 1 # exit with error
   606         -    fi
   607         -    #--------------------
   608         -} # func_mmmv_GUID_t1
   609         -
   610         -
   611         -#--------------------------------------------------------------------------
   612         -
   613         -S_FUNC_MMMV_SHA256_T1_RESULT="not_yet_set"
   614         -S_FUNC_MMMV_SHA256_T1_MODE="" # optim. to skip repeating console tool selection
   615         -func_mmmv_sha256_t1() { # requires also ruby and gawk 
   616         -    local S_FP_2_AN_EXISTING_FILE="$1" # first function argument
   617         -    #--------
   618         -    func_mmmv_exc_hash_function_input_verification_t1 "func_mmmv_sha256_t1" "$1"
   619         -    #--------------------
   620         -    # Mode selection:
   621         -    if [ "$S_FUNC_MMMV_SHA256_T1_MODE" == "" ] ; then
   622         -        SB_EXISTS_ON_PATH_T1_RESULT="f"  # if-block init
   623         -        #----
   624         -        if [ "$SB_EXISTS_ON_PATH_T1_RESULT" == "f" ] ; then
   625         -            S_TMP_0="sha256sum" # usually available on Linux
   626         -            func_sb_exists_on_path_t1 "$S_TMP_0" 
   627         -            if [ "$SB_EXISTS_ON_PATH_T1_RESULT" == "t" ] ; then
   628         -                 S_FUNC_MMMV_SHA256_T1_MODE="$S_TMP_0"
   629         -            fi
   630         -        fi
   631         -        #----
   632         -        if [ "$SB_EXISTS_ON_PATH_T1_RESULT" == "f" ] ; then
   633         -            S_TMP_0="rhash"    # part of the BSD package collection in 2016
   634         -            func_sb_exists_on_path_t1 "$S_TMP_0" 
   635         -            if [ "$SB_EXISTS_ON_PATH_T1_RESULT" == "t" ] ; then
   636         -                 S_FUNC_MMMV_SHA256_T1_MODE="$S_TMP_0"
   637         -            fi
   638         -        fi
   639         -        #----
   640         -        if [ "$SB_EXISTS_ON_PATH_T1_RESULT" == "f" ] ; then
   641         -            S_TMP_0="sha256"    # usually available on BSD
   642         -            func_sb_exists_on_path_t1 "$S_TMP_0" 
   643         -            if [ "$SB_EXISTS_ON_PATH_T1_RESULT" == "t" ] ; then
   644         -                 S_FUNC_MMMV_SHA256_T1_MODE="$S_TMP_0"
   645         -            fi
   646         -        fi
   647         -        # The console application "rhash" is preferred to the "sha256"
   648         -        # because the "rhash" output can be simply processed with 
   649         -        # "gawk", which takes over 5x less memory than the Ruby interpreter,
   650         -        # not to mention the initialization cost of the Ruby interpreter.
   651         -        #--------
   652         -        if [ "$S_FUNC_MMMV_SHA256_T1_MODE" == "" ] ; then
   653         -            echo ""
   654         -            echo "All of the SHA-256 implementations that this script " 
   655         -            echo "is capable of using (sha256sum, rhash, sha256) "
   656         -            echo "are missing from the PATH."
   657         -            echo "GUID=='446b14b1-7fc2-494d-8362-83f2c08160e7'"
   658         -            echo ""
   659         -            #----
   660         -            cd $S_FP_ORIG
   661         -            exit 1 # exit with error
   662         -        fi
   663         -        #--------
   664         -        if [ "$?" != "0" ]; then
   665         -            echo ""
   666         -            echo "This script is flawed."
   667         -            echo "GUID=='7d241052-f154-434c-a262-83f2c08160e7'"
   668         -            echo ""
   669         -            #----
   670         -            cd $S_FP_ORIG
   671         -            exit 1 # exit with error
   672         -        fi
   673         -        #--------
   674         -    fi
   675         -    #--------------------
   676         -    S_FUNC_MMMV_SHA256_T1_RESULT=""
   677         -    #--------------------
   678         -    if [ "$S_FUNC_MMMV_SHA256_T1_MODE" == "sha256sum" ]; then
   679         -        S_TMP_0="`sha256sum $S_FP_2_AN_EXISTING_FILE 2>/dev/null`"
   680         -        if [ "$?" != "0" ]; then
   681         -            echo ""
   682         -            echo "The console application \"sha256sum\" "
   683         -            echo "exited with an error."
   684         -            echo ""
   685         -            echo "----console--outut--citation--start-----"
   686         -            echo "`sha256sum $S_FP_2_AN_EXISTING_FILE`" # stdout and stderr
   687         -            echo "----console--outut--citation--end-------"
   688         -            echo ""
   689         -            echo "GUID=='ec70acd6-b0de-4e1b-a262-83f2c08160e7'"
   690         -            echo ""
   691         -            #----
   692         -            cd $S_FP_ORIG
   693         -            exit 1 # exit with error
   694         -        fi
   695         -        #---- 
   696         -        # The gawk is used for selecting the 1. column because 
   697         -        # according to the
   698         -        #
   699         -        #     echo "aa bb" | time -v gawk '{printf $1}'
   700         -        #
   701         -        # the gawk takes about 3MiB, which is far less than the 
   702         -        #
   703         -        #     time -v ruby -e "puts 'hi'"
   704         -        #
   705         -        # indicated 16MiB
   706         -        #
   707         -        S_FUNC_MMMV_SHA256_T1_RESULT="`echo \"$S_TMP_0\" | gawk '{printf $1}'`"
   708         -    fi
   709         -    #--------------------
   710         -    if [ "$S_FUNC_MMMV_SHA256_T1_MODE" == "rhash" ]; then
   711         -        S_TMP_0="`rhash --sha256 $S_FP_2_AN_EXISTING_FILE 2>/dev/null`"
   712         -        if [ "$?" != "0" ]; then
   713         -            echo ""
   714         -            echo "The console application \"rhash\" "
   715         -            echo "exited with an error."
   716         -            echo ""
   717         -            echo "----console--outut--citation--start-----"
   718         -            echo "`rhash --sha256 $S_FP_2_AN_EXISTING_FILE `"
   719         -            echo "----console--outut--citation--end-------"
   720         -            echo ""
   721         -            echo "GUID=='56091f39-0544-449c-a562-83f2c08160e7'"
   722         -            echo ""
   723         -            #----
   724         -            cd $S_FP_ORIG
   725         -            exit 1 # exit with error
   726         -        fi
   727         -        S_FUNC_MMMV_SHA256_T1_RESULT="`echo \"$S_TMP_0\" | gawk '{printf $1}'`"
   728         -    fi
   729         -    #--------------------
   730         -    if [ "$S_FUNC_MMMV_SHA256_T1_MODE" == "sha256" ]; then
   731         -        #----
   732         -        S_FUNC_MMMV_SHA256_T1_RESULT=\
   733         -        "`S_TMP_0=\"\`sha256 $S_FP_2_AN_EXISTING_FILE\`\" ruby -e \"s0=ENV['S_TMP_0'].to_s;ix_0=s0.index(') = ');print s0[(ix_0+4)..(-1)]\" 2>/dev/null`"
   734         -        #----
   735         -        if [ "$?" != "0" ]; then
   736         -            echo ""
   737         -            echo "The console application \"sha256\" "
   738         -            echo "exited with an error."
   739         -            echo ""
   740         -            echo "----console--outut--citation--start-----"
   741         -            echo \
   742         -            "`S_TMP_0=\"\`sha256 $S_FP_2_AN_EXISTING_FILE\`\" ruby -e \"s0=ENV['S_TMP_0'].to_s;ix_0=s0.index(') = ');print s0[(ix_0+4)..(-1)]\"`"
   743         -            echo "----console--outut--citation--end-------"
   744         -            echo ""
   745         -            echo "GUID=='65d0c243-954c-4d36-a452-83f2c08160e7'"
   746         -            echo ""
   747         -            #----
   748         -            cd $S_FP_ORIG
   749         -            exit 1 # exit with error
   750         -        fi
   751         -    fi
   752         -    #--------------------
   753         -    S_TMP_0="`printf \"$S_FUNC_MMMV_SHA256_T1_RESULT\" | wc -m `"
   754         -    S_TMP_1="64"
   755         -    if [ "$S_TMP_0" != "$S_TMP_1" ]; then
   756         -        echo ""
   757         -        echo "According to the specification of the SHA-256 hash algorithm"
   758         -        echo "the lenght of the SHA-256 hash is "
   759         -        echo "$S_TMP_1 hexadecimal characters, but the result of the "
   760         -        echo ""
   761         -        echo "    func_mmmv_sha256_t1"
   762         -        echo ""
   763         -        echo "is something else. The flawed hash candidate in parenthesis:"
   764         -        echo "($S_FUNC_MMMV_SHA256_T1_RESULT)"
   765         -        echo ""
   766         -        echo "The lenght candidate of the flawed hash candidate in parenthesis:"
   767         -        echo "($S_TMP_0)."
   768         -        echo ""
   769         -        echo "GUID=='9fbed31c-5742-4c66-a352-83f2c08160e7'"
   770         -        echo ""
   771         -        #----
   772         -        cd $S_FP_ORIG
   773         -        exit 1 # exit with error
   774         -    fi
   775         -    #--------------------
   776         -} # func_mmmv_sha256_t1
   777         -
   778         -
   779         -#--------------------------------------------------------------------------
   780         -
   781         -S_FUNC_MMMV_TIGERHASH_T1_RESULT="not_yet_set"
   782         -S_FUNC_MMMV_TIGERHASH_T1_MODE="" # optim. to skip repeating console tool selection
   783         -func_mmmv_tigerhash_t1() { # requires also ruby and gawk 
   784         -    local S_FP_2_AN_EXISTING_FILE="$1" # first function argument
   785         -    #--------
   786         -    func_mmmv_exc_hash_function_input_verification_t1 "func_mmmv_tigerhash_t1" "$1"
   787         -    #--------------------
   788         -    # Mode selection:
   789         -    if [ "$S_FUNC_MMMV_TIGERHASH_T1_MODE" == "" ] ; then
   790         -        SB_EXISTS_ON_PATH_T1_RESULT="f"  # if-block init
   791         -        #----
   792         -        if [ "$SB_EXISTS_ON_PATH_T1_RESULT" == "f" ] ; then
   793         -            S_TMP_0="tigerdeep" # usually available on Linux
   794         -            func_sb_exists_on_path_t1 "$S_TMP_0" 
   795         -            if [ "$SB_EXISTS_ON_PATH_T1_RESULT" == "t" ] ; then
   796         -                 S_FUNC_MMMV_TIGERHASH_T1_MODE="$S_TMP_0"
   797         -            fi
   798         -        fi
   799         -        #----
   800         -        if [ "$SB_EXISTS_ON_PATH_T1_RESULT" == "f" ] ; then
   801         -            S_TMP_0="rhash"    # part of the BSD package collection in 2016
   802         -            func_sb_exists_on_path_t1 "$S_TMP_0" 
   803         -            if [ "$SB_EXISTS_ON_PATH_T1_RESULT" == "t" ] ; then
   804         -                 S_FUNC_MMMV_TIGERHASH_T1_MODE="$S_TMP_0"
   805         -            fi
   806         -        fi
   807         -        #--------
   808         -        if [ "$S_FUNC_MMMV_TIGERHASH_T1_MODE" == "" ] ; then
   809         -            echo ""
   810         -            echo "All of the Tiger hash implementations that this script " 
   811         -            echo "is capable of using (tigerdeep, rhash) "
   812         -            echo "are missing from the PATH."
   813         -            echo "GUID=='e0e0004d-7492-4aae-8152-83f2c08160e7'"
   814         -            echo ""
   815         -            #----
   816         -            cd $S_FP_ORIG
   817         -            exit 1 # exit with error
   818         -        fi
   819         -        #--------
   820         -        if [ "$?" != "0" ]; then
   821         -            echo ""
   822         -            echo "This script is flawed."
   823         -            echo "GUID=='4e6ce53e-0891-4a84-a152-83f2c08160e7'"
   824         -            echo ""
   825         -            #----
   826         -            cd $S_FP_ORIG
   827         -            exit 1 # exit with error
   828         -        fi
   829         -        #--------
   830         -    fi
   831         -    #--------------------
   832         -    S_FUNC_MMMV_TIGERHASH_T1_RESULT=""
   833         -    #--------------------
   834         -    if [ "$S_FUNC_MMMV_TIGERHASH_T1_MODE" == "tigerdeep" ]; then
   835         -        S_TMP_0="`tigerdeep $S_FP_2_AN_EXISTING_FILE 2>/dev/null`"
   836         -        if [ "$?" != "0" ]; then
   837         -            echo ""
   838         -            echo "The console application \"tigerdeep\" "
   839         -            echo "exited with an error."
   840         -            echo ""
   841         -            echo "----console--outut--citation--start-----"
   842         -            echo "`tigerdeep $S_FP_2_AN_EXISTING_FILE`" # stdout and stderr
   843         -            echo "----console--outut--citation--end-------"
   844         -            echo ""
   845         -            echo "GUID=='0ac9014e-b1d8-49c0-a352-83f2c08160e7'"
   846         -            echo ""
   847         -            #----
   848         -            cd $S_FP_ORIG
   849         -            exit 1 # exit with error
   850         -        fi
   851         -        S_FUNC_MMMV_TIGERHASH_T1_RESULT="`echo \"$S_TMP_0\" | gawk '{printf $1}'`"
   852         -    fi
   853         -    #--------------------
   854         -    if [ "$S_FUNC_MMMV_TIGERHASH_T1_MODE" == "rhash" ]; then
   855         -        S_TMP_0="`rhash --tiger $S_FP_2_AN_EXISTING_FILE 2>/dev/null`"
   856         -        if [ "$?" != "0" ]; then
   857         -            echo ""
   858         -            echo "The console application \"rhash\" "
   859         -            echo "exited with an error."
   860         -            echo ""
   861         -            echo "----console--outut--citation--start-----"
   862         -            echo "`rhash --tiger $S_FP_2_AN_EXISTING_FILE `"
   863         -            echo "----console--outut--citation--end-------"
   864         -            echo ""
   865         -            echo "GUID=='0d5ce111-3bf8-4eee-9252-83f2c08160e7'"
   866         -            echo ""
   867         -            #----
   868         -            cd $S_FP_ORIG
   869         -            exit 1 # exit with error
   870         -        fi
   871         -        S_FUNC_MMMV_TIGERHASH_T1_RESULT="`echo \"$S_TMP_0\" | gawk '{printf $1}'`"
   872         -    fi
   873         -    #--------------------
   874         -    S_TMP_0="`printf \"$S_FUNC_MMMV_TIGERHASH_T1_RESULT\" | wc -m `"
   875         -    S_TMP_1="48"
   876         -    if [ "$S_TMP_0" != "$S_TMP_1" ]; then
   877         -        echo ""
   878         -        echo "According to the specification of the Tiger hash algorithm"
   879         -        echo "the lenght of the Tiger hash is "
   880         -        echo "$S_TMP_1 hexadecimal characters, but the result of the "
   881         -        echo ""
   882         -        echo "    func_mmmv_tigerhash_t1"
   883         -        echo ""
   884         -        echo "is something else. The flawed hash candidate in parenthesis:"
   885         -        echo "($S_FUNC_MMMV_TIGERHASH_T1_RESULT)"
   886         -        echo ""
   887         -        echo "The lenght candidate of the flawed hash candidate in parenthesis:"
   888         -        echo "($S_TMP_0)."
   889         -        echo ""
   890         -        echo "GUID=='23b13133-f4fb-46fd-8552-83f2c08160e7'"
   891         -        echo ""
   892         -        #----
   893         -        cd $S_FP_ORIG
   894         -        exit 1 # exit with error
   895         -    fi
   896         -    #--------------------
   897         -} # func_mmmv_tigerhash_t1
   898         -
   899         -
   900         -#--------------------------------------------------------------------------
   901         -
   902         -S_FUNC_MMMV_WHIRLPOOLHASH_T1_RESULT="not_yet_set"
   903         -S_FUNC_MMMV_WHIRLPOOLHASH_T1_MODE="" # optim. to skip repeating console tool selection
   904         -func_mmmv_whirlpoolhash_t1() { # requires also ruby and gawk 
   905         -    local S_FP_2_AN_EXISTING_FILE="$1" # first function argument
   906         -    #--------
   907         -    func_mmmv_exc_hash_function_input_verification_t1 "func_mmmv_whirlpoolhash_t1" "$1"
   908         -    #--------------------
   909         -    # Mode selection:
   910         -    if [ "$S_FUNC_MMMV_WHIRLPOOLHASH_T1_MODE" == "" ] ; then
   911         -        SB_EXISTS_ON_PATH_T1_RESULT="f"  # if-block init
   912         -        #----
   913         -        if [ "$SB_EXISTS_ON_PATH_T1_RESULT" == "f" ] ; then
   914         -            S_TMP_0="whirlpooldeep" # usually available on Linux
   915         -            func_sb_exists_on_path_t1 "$S_TMP_0" 
   916         -            if [ "$SB_EXISTS_ON_PATH_T1_RESULT" == "t" ] ; then
   917         -                 S_FUNC_MMMV_WHIRLPOOLHASH_T1_MODE="$S_TMP_0"
   918         -            fi
   919         -        fi
   920         -        #----
   921         -        if [ "$SB_EXISTS_ON_PATH_T1_RESULT" == "f" ] ; then
   922         -            S_TMP_0="rhash"    # part of the BSD package collection in 2016
   923         -            func_sb_exists_on_path_t1 "$S_TMP_0" 
   924         -            if [ "$SB_EXISTS_ON_PATH_T1_RESULT" == "t" ] ; then
   925         -                 S_FUNC_MMMV_WHIRLPOOLHASH_T1_MODE="$S_TMP_0"
   926         -            fi
   927         -        fi
   928         -        #--------
   929         -        if [ "$S_FUNC_MMMV_WHIRLPOOLHASH_T1_MODE" == "" ] ; then
   930         -            echo ""
   931         -            echo "All of the Whirlpool hash implementations that this script " 
   932         -            echo "is capable of using (whirlpooldeep, rhash) "
   933         -            echo "are missing from the PATH."
   934         -            echo "GUID=='3ec66a62-8721-42e7-b252-83f2c08160e7'"
   935         -            echo ""
   936         -            #----
   937         -            cd $S_FP_ORIG
   938         -            exit 1 # exit with error
   939         -        fi
   940         -        #--------
   941         -        if [ "$?" != "0" ]; then
   942         -            echo ""
   943         -            echo "This script is flawed."
   944         -            echo "GUID=='a812ee31-2b39-4268-9242-83f2c08160e7'"
   945         -            echo ""
   946         -            #----
   947         -            cd $S_FP_ORIG
   948         -            exit 1 # exit with error
   949         -        fi
   950         -        #--------
   951         -    fi
   952         -    #--------------------
   953         -    S_FUNC_MMMV_WHIRLPOOLHASH_T1_RESULT=""
   954         -    #--------------------
   955         -    if [ "$S_FUNC_MMMV_WHIRLPOOLHASH_T1_MODE" == "whirlpooldeep" ]; then
   956         -        S_TMP_0="`whirlpooldeep $S_FP_2_AN_EXISTING_FILE 2>/dev/null`"
   957         -        if [ "$?" != "0" ]; then
   958         -            echo ""
   959         -            echo "The console application \"whirlpooldeep\" "
   960         -            echo "exited with an error."
   961         -            echo ""
   962         -            echo "----console--outut--citation--start-----"
   963         -            echo "`whirlpooldeep $S_FP_2_AN_EXISTING_FILE`" # stdout and stderr
   964         -            echo "----console--outut--citation--end-------"
   965         -            echo ""
   966         -            echo "GUID=='5ac1162f-5b05-4db9-8442-83f2c08160e7'"
   967         -            echo ""
   968         -            #----
   969         -            cd $S_FP_ORIG
   970         -            exit 1 # exit with error
   971         -        fi
   972         -        S_FUNC_MMMV_WHIRLPOOLHASH_T1_RESULT="`echo \"$S_TMP_0\" | gawk '{printf $1}'`"
   973         -    fi
   974         -    #--------------------
   975         -    if [ "$S_FUNC_MMMV_WHIRLPOOLHASH_T1_MODE" == "rhash" ]; then
   976         -        S_TMP_0="`rhash --whirlpool $S_FP_2_AN_EXISTING_FILE 2>/dev/null`"
   977         -        if [ "$?" != "0" ]; then
   978         -            echo ""
   979         -            echo "The console application \"rhash\" "
   980         -            echo "exited with an error."
   981         -            echo ""
   982         -            echo "----console--outut--citation--start-----"
   983         -            echo "`rhash --whirlpool $S_FP_2_AN_EXISTING_FILE `"
   984         -            echo "----console--outut--citation--end-------"
   985         -            echo ""
   986         -            echo "GUID=='37202b22-1600-406b-9142-83f2c08160e7'"
   987         -            echo ""
   988         -            #----
   989         -            cd $S_FP_ORIG
   990         -            exit 1 # exit with error
   991         -        fi
   992         -        S_FUNC_MMMV_WHIRLPOOLHASH_T1_RESULT="`echo \"$S_TMP_0\" | gawk '{printf $1}'`"
   993         -    fi
   994         -    #--------------------
   995         -    S_TMP_0="`printf \"$S_FUNC_MMMV_WHIRLPOOLHASH_T1_RESULT\" | wc -m `"
   996         -    S_TMP_1="128"
   997         -    if [ "$S_TMP_0" != "$S_TMP_1" ]; then
   998         -        echo ""
   999         -        echo "According to the specification of the Whirlpool hash algorithm"
  1000         -        echo "the lenght of the Tiger hash is "
  1001         -        echo "$S_TMP_1 hexadecimal characters, but the result of the "
  1002         -        echo ""
  1003         -        echo "    func_mmmv_whirlpoolhash_t1"
  1004         -        echo ""
  1005         -        echo "is something else. The flawed hash candidate in parenthesis:"
  1006         -        echo "($S_FUNC_MMMV_WHIRLPOOLHASH_T1_RESULT)"
  1007         -        echo ""
  1008         -        echo "The lenght candidate of the flawed hash candidate in parenthesis:"
  1009         -        echo "($S_TMP_0)."
  1010         -        echo ""
  1011         -        echo "GUID=='6f22524d-5309-48d6-9142-83f2c08160e7'"
  1012         -        echo ""
  1013         -        #----
  1014         -        cd $S_FP_ORIG
  1015         -        exit 1 # exit with error
  1016         -    fi
  1017         -    #--------------------
  1018         -} # func_mmmv_whirlpoolhash_t1
  1019         -
  1020         -
  1021         -#--------------------------------------------------------------------------
  1022         -
  1023         -S_FUNC_MMMV_FILESIZE_T1_RESULT="not_yet_set"
  1024         -S_FUNC_MMMV_FILESIZE_T1_MODE="" # optim. to skip repeating console tool selection
  1025         -func_mmmv_filesize_t1() { 
  1026         -    local S_FP_2_AN_EXISTING_FILE="$1" # first function argument
  1027         -    #--------
  1028         -    func_mmmv_exc_hash_function_input_verification_t1 "func_mmmv_filesize_t1" "$1"
  1029         -    #--------------------
  1030         -    # Mode selection:
  1031         -    if [ "$S_FUNC_MMMV_FILESIZE_T1_MODE" == "" ] ; then
  1032         -        SB_EXISTS_ON_PATH_T1_RESULT="f"  # if-block init
  1033         -        #----
  1034         -        if [ "$SB_EXISTS_ON_PATH_T1_RESULT" == "f" ] ; then
  1035         -            S_TMP_0="filesize" # usually available on Linux
  1036         -            func_sb_exists_on_path_t1 "$S_TMP_0" 
  1037         -            if [ "$SB_EXISTS_ON_PATH_T1_RESULT" == "t" ] ; then
  1038         -                 S_FUNC_MMMV_FILESIZE_T1_MODE="$S_TMP_0"
  1039         -            fi
  1040         -        fi
  1041         -        #----
  1042         -        if [ "$SB_EXISTS_ON_PATH_T1_RESULT" == "f" ] ; then
  1043         -            S_TMP_0="ruby"    # helps on BSD
  1044         -            func_sb_exists_on_path_t1 "$S_TMP_0" 
  1045         -            if [ "$SB_EXISTS_ON_PATH_T1_RESULT" == "t" ] ; then
  1046         -                 S_FUNC_MMMV_FILESIZE_T1_MODE="$S_TMP_0"
  1047         -            fi
  1048         -        fi
  1049         -        #--------
  1050         -        if [ "$S_FUNC_MMMV_FILESIZE_T1_MODE" == "" ] ; then
  1051         -            echo ""
  1052         -            echo "All of the applications that this function is " 
  1053         -            echo "capable of using for finding out file size (filesize, ruby)"
  1054         -            echo "are missing from the PATH."
  1055         -            echo "GUID=='c16c313b-1051-410e-a242-83f2c08160e7'"
  1056         -            echo ""
  1057         -            #----
  1058         -            cd $S_FP_ORIG
  1059         -            exit 1 # exit with error
  1060         -        fi
  1061         -        #--------
  1062         -        if [ "$?" != "0" ]; then
  1063         -            echo ""
  1064         -            echo "This script is flawed."
  1065         -            echo "GUID=='3b8d513c-90dd-406b-a442-83f2c08160e7'"
  1066         -            echo ""
  1067         -            #----
  1068         -            cd $S_FP_ORIG
  1069         -            exit 1 # exit with error
  1070         -        fi
  1071         -        #--------
  1072         -    fi
  1073         -    #--------------------
  1074         -    S_FUNC_MMMV_FILESIZE_T1_RESULT=""
  1075         -    #--------------------
  1076         -    if [ "$S_FUNC_MMMV_FILESIZE_T1_MODE" == "filesize" ]; then
  1077         -        S_TMP_0="`filesize $S_FP_2_AN_EXISTING_FILE 2>/dev/null`"
  1078         -        if [ "$?" != "0" ]; then
  1079         -            echo ""
  1080         -            echo "The console application \"filesize\" "
  1081         -            echo "exited with an error."
  1082         -            echo ""
  1083         -            echo "----console--outut--citation--start-----"
  1084         -            echo "`filesize $S_FP_2_AN_EXISTING_FILE`" # stdout and stderr
  1085         -            echo "----console--outut--citation--end-------"
  1086         -            echo ""
  1087         -            echo "GUID=='28f88541-0f95-4a94-8442-83f2c08160e7'"
  1088         -            echo ""
  1089         -            #----
  1090         -            cd $S_FP_ORIG
  1091         -            exit 1 # exit with error
  1092         -        fi
  1093         -        S_FUNC_MMMV_FILESIZE_T1_RESULT="`echo \"$S_TMP_0\" | gawk '{printf $1}'`"
  1094         -    fi
  1095         -    #--------------------
  1096         -    if [ "$S_FUNC_MMMV_FILESIZE_T1_MODE" == "ruby" ]; then
  1097         -        S_TMP_0="`ruby -e \"printf(File.size('$S_FP_2_AN_EXISTING_FILE').to_s)\" 2>/dev/null`"
  1098         -        if [ "$?" != "0" ]; then
  1099         -            echo ""
  1100         -            echo "The console application \"ruby\" "
  1101         -            echo "exited with an error."
  1102         -            echo ""
  1103         -            echo "----console--outut--citation--start-----"
  1104         -            echo "`ruby -e \"printf(File.size('$S_FP_2_AN_EXISTING_FILE').to_s)\"`"
  1105         -            echo "----console--outut--citation--end-------"
  1106         -            echo ""
  1107         -            echo "GUID=='53b91474-cdfe-43f8-b242-83f2c08160e7'"
  1108         -            echo ""
  1109         -            #----
  1110         -            cd $S_FP_ORIG
  1111         -            exit 1 # exit with error
  1112         -        fi
  1113         -        S_FUNC_MMMV_FILESIZE_T1_RESULT="$S_TMP_0"
  1114         -    fi
  1115         -    #--------------------
  1116         -    S_TMP_0="`printf \"$S_FUNC_MMMV_FILESIZE_T1_RESULT\" | gawk '{gsub(/\s/,"");printf "%s", $1 }'`"
  1117         -    local SB_THROW="f"
  1118         -    if [ "$S_TMP_0" != "$S_FUNC_MMMV_FILESIZE_T1_RESULT" ]; then
  1119         -        SB_THROW="t"
  1120         -    else
  1121         -        if [ "$S_FUNC_MMMV_FILESIZE_T1_RESULT" == "" ]; then
  1122         -            SB_THROW="t"
  1123         -        fi
  1124         -    fi
  1125         -    #----
  1126         -    if [ "$SB_THROW" == "t" ]; then
  1127         -        echo ""
  1128         -        echo "The result of the "
  1129         -        echo ""
  1130         -        echo "    func_mmmv_filesize_t1"
  1131         -        echo ""
  1132         -        echo "for "
  1133         -        echo ""
  1134         -        echo "($S_FUNC_MMMV_FILESIZE_T1_RESULT)"
  1135         -        echo ""
  1136         -        echo "either contain spaces, tabs or is an empty string," 
  1137         -        echo "which is wrong, because even a file with the size of 0 "
  1138         -        echo "should have a file size of \"0\", which is not an empty string."
  1139         -        echo "GUID=='4e5a622c-7b21-4de0-a432-83f2c08160e7'"
  1140         -        echo ""
  1141         -        #----
  1142         -        cd $S_FP_ORIG
  1143         -        exit 1 # exit with error
  1144         -    fi
  1145         -    #--------------------
  1146         -} # func_mmmv_filesize_t1
  1147         -
  1148         -
  1149         -#--------------------------------------------------------------------------
  1150         -
  1151         -func_mmmv_silktorrent_packager_t1_bash_print_help_msg_t1() { 
  1152         -    echo ""
  1153         -    echo "Command line format: "
  1154         -    echo ""
  1155         -    echo "<the name of this script>  ARGLIST "
  1156         -    echo ""
  1157         -    echo "        ARGLIST :== help | WRAP | UNWRAP | VERIFY | RUN_SELFTEST "
  1158         -    echo "           WRAP :== wrap <file path> "
  1159         -    echo "         UNWRAP :== unwrap <file path> "
  1160         -    echo "         VERIFY :== verify <file path> "
  1161         -    echo "   RUN_SELFTEST :== test_hash_t1 <file path> "
  1162         -    echo ""
  1163         -    echo ""
  1164         -    echo ""
  1165         -} # func_mmmv_silktorrent_packager_t1_bash_print_help_msg_t1
  1166         -
  1167         -#--------------------------------------------------------------------------
  1168         -
  1169         -func_mmmv_silktorrent_packager_t1_bash_exc_assert_wrappable_file_exists_t1() { 
  1170         -    local S_FP_0="$1" # Path to the file. 
  1171         -    #--------
  1172         -    if [ "$S_FP_0" == "" ]; then
  1173         -        echo ""
  1174         -        echo "The 2. console argument is expected to be "
  1175         -        echo "a path to a file, but currently "
  1176         -        echo "the 2. console argument is missing."
  1177         -        echo "GUID=='fe2aff9e-9555-40a3-b332-83f2c08160e7'"
  1178         -        echo ""
  1179         -        #----
  1180         -        cd $S_FP_ORIG
  1181         -        exit 1 # exit with error
  1182         -    fi
  1183         -    #--------
  1184         -    if [ ! -e "$S_FP_0" ]; then
  1185         -        if [ -h "$S_FP_0" ]; then
  1186         -            echo ""
  1187         -            echo "The file path "
  1188         -            echo ""
  1189         -            echo "    $S_FP_0"
  1190         -            echo ""
  1191         -            echo "is a path of a broken symlink, but symlinks "
  1192         -            echo "are not supported at all."
  1193         -            echo "The reason, why symlinks to files are not supported is that "
  1194         -            echo "the file size of symlinks can differ from "
  1195         -            echo "the file size of the target of the symlink."
  1196         -            echo "GUID=='60e5391a-37c5-48e4-b332-83f2c08160e7'"
  1197         -            echo ""
  1198         -        else
  1199         -            echo ""
  1200         -            echo "The file with the path of "
  1201         -            echo ""
  1202         -            echo "    $S_FP_0"
  1203         -            echo ""
  1204         -            echo "does not exist."
  1205         -            echo "GUID=='45c4b001-7a5c-4a0a-b732-83f2c08160e7'"
  1206         -            echo ""
  1207         -        fi
  1208         -        #----
  1209         -        cd $S_FP_ORIG
  1210         -        exit 1 # exit with error
  1211         -    fi
  1212         -    #--------
  1213         -    if [ -d "$S_FP_0" ]; then
  1214         -        if [ -h "$S_FP_0" ]; then
  1215         -            echo ""
  1216         -            echo "The path "
  1217         -            echo ""
  1218         -            echo "    $S_FP_0"
  1219         -            echo ""
  1220         -            echo "references a symlink that references folder, but "
  1221         -            echo "a file is expected."
  1222         -            echo "GUID=='4b3f22d7-441b-4de8-b432-83f2c08160e7'"
  1223         -            echo ""
  1224         -        else
  1225         -            echo ""
  1226         -            echo "The path "
  1227         -            echo ""
  1228         -            echo "    $S_FP_0"
  1229         -            echo ""
  1230         -            echo "references a folder, but it is expected to "
  1231         -            echo "to reference a file."
  1232         -            echo "GUID=='f3d00ec1-40be-4f84-a432-83f2c08160e7'"
  1233         -            echo ""
  1234         -        fi
  1235         -        #----
  1236         -        cd $S_FP_ORIG
  1237         -        exit 1 # exit with error
  1238         -    fi
  1239         -    #--------
  1240         -    if [ -h "$S_FP_0" ]; then
  1241         -        echo ""
  1242         -        echo "The path "
  1243         -        echo ""
  1244         -        echo "    $S_FP_0"
  1245         -        echo ""
  1246         -        echo "references a symlink, a file is expected."
  1247         -        echo "The reason, why symlinks to files are not supported is that "
  1248         -        echo "the file size of symlinks can differ from "
  1249         -        echo "the file size of the target of the symlink."
  1250         -        echo "GUID=='20430c48-653d-4a05-b432-83f2c08160e7'"
  1251         -        echo ""
  1252         -        #----
  1253         -        cd $S_FP_ORIG
  1254         -        exit 1 # exit with error
  1255         -    fi
  1256         -} # func_mmmv_silktorrent_packager_t1_bash_exc_assert_wrappable_file_exists_t1
  1257         -
  1258         -
  1259         -#--------------------------------------------------------------------------
  1260         -
  1261         -S_FUNC_MMMV_SILKTORRENT_PACKAGER_T1_BASH_REVERSE_STRING_REGISTER="for input and output"
  1262         -S_FUNC_MMMV_SILKTORRENT_PACKAGER_T1_BASH_REVERSE_STRING_MODE="" # optim.  hack
  1263         -func_mmmv_silktorrent_packager_t1_bash_reverse_string() { 
  1264         -    local S_IN="$S_FUNC_MMMV_SILKTORRENT_PACKAGER_T1_BASH_REVERSE_STRING_REGISTER"
  1265         -    #--------------------
  1266         -    local S_TMP_0="not set"
  1267         -    # Mode selection:
  1268         -    if [ "$S_FUNC_MMMV_SILKTORRENT_PACKAGER_T1_BASH_REVERSE_STRING_MODE" == "" ] ; then
  1269         -        SB_EXISTS_ON_PATH_T1_RESULT="f"  # if-block init
  1270         -        #----
  1271         -        if [ "$SB_EXISTS_ON_PATH_T1_RESULT" == "f" ] ; then
  1272         -            S_TMP_0="gawk" # usually available on Linux
  1273         -            func_sb_exists_on_path_t1 "$S_TMP_0" 
  1274         -            if [ "$SB_EXISTS_ON_PATH_T1_RESULT" == "t" ] ; then
  1275         -                 S_FUNC_MMMV_SILKTORRENT_PACKAGER_T1_BASH_REVERSE_STRING_MODE="$S_TMP_0"
  1276         -            fi
  1277         -        fi
  1278         -        #----
  1279         -        if [ "$SB_EXISTS_ON_PATH_T1_RESULT" == "f" ] ; then
  1280         -            S_TMP_0="ruby"    # helps on BSD
  1281         -            func_sb_exists_on_path_t1 "$S_TMP_0" 
  1282         -            if [ "$SB_EXISTS_ON_PATH_T1_RESULT" == "t" ] ; then
  1283         -                 S_FUNC_MMMV_SILKTORRENT_PACKAGER_T1_BASH_REVERSE_STRING_MODE="$S_TMP_0"
  1284         -            fi
  1285         -        fi
  1286         -        #--------
  1287         -        if [ "$S_FUNC_MMMV_SILKTORRENT_PACKAGER_T1_BASH_REVERSE_STRING_MODE" == "" ] ; then
  1288         -            echo ""
  1289         -            echo "All of the applications that this function is " 
  1290         -            echo "capable of using for finding out file size (gawk, ruby)"
  1291         -            echo "are missing from the PATH."
  1292         -            echo "GUID=='35084451-8a4f-465e-a222-83f2c08160e7'"
  1293         -            echo ""
  1294         -            #----
  1295         -            cd $S_FP_ORIG
  1296         -            exit 1 # exit with error
  1297         -        fi
  1298         -        #--------
  1299         -        if [ "$?" != "0" ]; then
  1300         -            echo ""
  1301         -            echo "This script is flawed."
  1302         -            echo "GUID=='d1cca38b-d5ee-4fc9-a822-83f2c08160e7'"
  1303         -            echo ""
  1304         -            #----
  1305         -            cd $S_FP_ORIG
  1306         -            exit 1 # exit with error
  1307         -        fi
  1308         -        #--------
  1309         -    fi
  1310         -    #--------------------
  1311         -    #--------------------
  1312         -    S_FUNC_MMMV_SILKTORRENT_PACKAGER_T1_BASH_REVERSE_STRING_REGISTER=""
  1313         -    #--------
  1314         -    if [ "$S_FUNC_MMMV_SILKTORRENT_PACKAGER_T1_BASH_REVERSE_STRING_MODE" == "gawk" ]; then
  1315         -        # The awk code example originates from 
  1316         -        # http://www.linuxandlife.com/2013/06/how-to-reverse-string.html
  1317         -        # archival copy: https://archive.is/Cx0xF
  1318         -        #----
  1319         -        S_TMP_0="`printf "$S_IN" | \
  1320         -            awk '{ for(i=length;i!=0;i--)x=x substr($0,i,1);}END{printf  x}'`"
  1321         -        if [ "$?" != "0" ]; then
  1322         -            echo ""
  1323         -            echo "The console application \"gawk\" "
  1324         -            echo "exited with an error."
  1325         -            echo ""
  1326         -            echo "----console--outut--citation--start-----"
  1327         -            echo "`printf "$S_IN" | awk '{ for(i=length;i!=0;i--)x=x substr($0,i,1);}END{printf  x}'`"
  1328         -            echo "----console--outut--citation--end-------"
  1329         -            echo ""
  1330         -            echo "GUID=='2e32181a-f13c-49bf-8222-83f2c08160e7'"
  1331         -            echo ""
  1332         -            #----
  1333         -            cd $S_FP_ORIG
  1334         -            exit 1 # exit with error
  1335         -        fi
  1336         -        S_FUNC_MMMV_SILKTORRENT_PACKAGER_T1_BASH_REVERSE_STRING_REGISTER="$S_TMP_0"
  1337         -    fi
  1338         -    #--------
  1339         -    if [ "$S_FUNC_MMMV_SILKTORRENT_PACKAGER_T1_BASH_REVERSE_STRING_MODE" == "ruby" ]; then
  1340         -        #----
  1341         -        S_TMP_0="`ruby -e \"puts(ARGV[0].to_s.reverse)\" "$S_IN" 2>/dev/null`"
  1342         -        if [ "$?" != "0" ]; then
  1343         -            echo ""
  1344         -            echo "The console application \"ruby\" "
  1345         -            echo "exited with an error."
  1346         -            echo ""
  1347         -            echo "----console--outut--citation--start-----"
  1348         -            echo "`ruby -e \"puts('$S_IN'.reverse)\"`" # with the stderr
  1349         -            echo "----console--outut--citation--end-------"
  1350         -            echo ""
  1351         -            echo "GUID=='4707c539-4300-4cb5-8322-83f2c08160e7'"
  1352         -            echo ""
  1353         -            #----
  1354         -            cd $S_FP_ORIG
  1355         -            exit 1 # exit with error
  1356         -        fi
  1357         -        S_FUNC_MMMV_SILKTORRENT_PACKAGER_T1_BASH_REVERSE_STRING_REGISTER="$S_TMP_0"
  1358         -    fi
  1359         -    #--------------------
  1360         -} # func_mmmv_silktorrent_packager_t1_bash_reverse_string
  1361         -
  1362         -
  1363         -#--------------------------------------------------------------------------
  1364         -
  1365         -# As of 2016 the maximum file name length on Linux is 255 characters.
  1366         -# At
  1367         -#
  1368         -#    http://unix.stackexchange.com/questions/32795/what-is-the-maximum-allowed-filename-and-folder-size-with-ecryptfs
  1369         -#
  1370         -# the eCryptfs related recommendation is to keep the lengths
  1371         -# of file names to less than 140 characters. 
  1372         -#
  1373         -# A citation from 
  1374         -# http://windows.microsoft.com/en-us/windows/file-names-extensions-faq#1TC=windows-7
  1375         -# archieval copy: https://archive.is/UKBmd
  1376         -#     "Windows limits a single path to 260 characters."
  1377         -#
  1378         -# A citation from CygWin mailing list:
  1379         -# https://cygwin.com/ml/cygwin/2004-10/msg01323.html
  1380         -# archival copy: https://archive.is/GRvFK
  1381         -#     "The Unicode versions of several functions permit a 
  1382         -#     maximum path length of 32,767 characters, 
  1383         -#     composed of components up to 255 characters in length. 
  1384         -#     To specify such a path, use the "\\?\" prefix. For example, 
  1385         -#     "\\?\D:\<path>". To specify such a UNC path, use the "\\?\UNC\" 
  1386         -#     prefix. For example, "\\?\UNC\<server>\<share>". 
  1387         -#     Note that these prefixes are not used as part of the path 
  1388         -#     itself. They indicate that the path should be passed to the 
  1389         -#     system with minimal modification. An implication of this is 
  1390         -#     that you cannot use forward slashes to represent path separators 
  1391         -#     or a period to represent the current directory."
  1392         -# Related pages:
  1393         -# https://msdn.microsoft.com/en-us/library/aa365247(VS.85).aspx
  1394         -# archival copy: https://archive.is/p891y
  1395         -#
  1396         -# To allow database indexes that store the 
  1397         -# file names of the blogs 
  1398         -# to work as efficiently as possible, the first
  1399         -# characters of the file name should be as 
  1400         -# uniformly random set of characters as possible.
  1401         -# If file name starts with a secure hash, then 
  1402         -# that requirement is met. 
  1403         -#
  1404         -# The parser that dismantles the file name to relevant components 
  1405         -# should be implementable in different programming languages
  1406         -# without investing considerable amount of development time.
  1407         -# The syntax of the file name should also allow the
  1408         -# file name to be parsed computationally cheaply.
  1409         -#
  1410         -# As of 2016_05 the file extension  .stblob seems to be unused.
  1411         -# Therefore the "silktorrent blob", .stblob, can be used for the 
  1412         -# extension of the blob files.
  1413         -#
  1414         -# Compression of the blobs IS NOT ALLOWED, because the 
  1415         -# blobs must be extractable without becoming a victim 
  1416         -# of an attack, where 100GiB of zeros is packed to a
  1417         -# small file. The container format is the tar format,
  1418         -# without any compression.
  1419         -S_FUNC_MMMV_SILKTORRENT_PACKAGER_T1_BASH_BLOB2FILENAME_T1_RESULT="not set"
  1420         -func_mmmv_silktorrent_packager_t1_bash_blob2filename_t1() { 
  1421         -    local S_FP_0="$1" # Path to the file. 
  1422         -    #----
  1423         -    func_mmmv_silktorrent_packager_t1_bash_exc_assert_wrappable_file_exists_t1 "$S_FP_0"
  1424         -    #--------
  1425         -    # The Tiger     hash has  48 characters.
  1426         -    # The Whirlpool hash has 128 characters.
  1427         -    # The SHA-256   hash has  64 characters.
  1428         -    #
  1429         -    # A file size of 1TiB is ~10^12 ~ 13 characters
  1430         -    # A file size of 1PiB is ~10^15 ~ 14 characters
  1431         -    # A file size of 1EiB is ~10^18 ~ 19 characters
  1432         -    # A file size of 1ZiB is ~10^21 ~ 22 characters
  1433         -    # A file size of 1YiB is ~10^24 ~ 25 characters
  1434         -    # 
  1435         -    # The max. file name length on Linux and 
  1436         -    # Windows (Unicode API) is 255 characters.
  1437         -    #----
  1438         -    # The character budget:
  1439         -    #        6 characters --- file name format type ID 
  1440         -    #                         rgx_in_ruby=/v[\d]{4}[_]/
  1441         -    # echo "v0034_s2342_" | gawk '{ gsub(/_/, "_\n"); print }' | \
  1442         -    #                       gawk '/^v[0-9]{4}_/ {printf "%s",$1 }' | \
  1443         -    #                       gawk '{gsub(/[v_]/,"");printf "%s", $1 }'
  1444         -    #
  1445         -    #   max 32 characters --- file size    
  1446         -    #                         rgx_in_ruby=/s[\d]+[_]/
  1447         -    #                         echo "v0034_" | gawk '/^v[0-9]{4}_/ {printf "%s",$1 }'
  1448         -    # echo "v0034_s2342_" | gawk '{ gsub(/_/, "_\n"); print }' | \
  1449         -    #                       gawk '/^s[0-9]+_/ {printf "%s",$1 }' | \
  1450         -    #                       gawk '{gsub(/[s_]/,"");printf "%s", $1 }'
  1451         -    #
  1452         -    #
  1453         -    #       66 characters --- SHA-256  
  1454         -    #                         rgx_in_ruby=/h[\dabcdef]{64}[_]/
  1455         -    # echo "h`sha256sum /dev/null | gawk '/[0-9abcdef]/ {printf "%s",$1}'`_" | \
  1456         -    #                               gawk '/^h[0-9abcdef]+_/ {printf "%s",$1 }' | \
  1457         -    #                               gawk '{gsub(/[h_]/,"");printf "%s", $1 }'
  1458         -    #
  1459         -    #
  1460         -    #       50 characters --- Tiger
  1461         -    #                         rgx_in_ruby=/i[\dabcdef]{48}$/   # lacks the ending "_" 
  1462         -    #                                                          # for db index optimization
  1463         -    #                         The gawk code is as with the sha256, 
  1464         -    #                         except that sha256sum-> tigerdeep, "^h"->"^i",
  1465         -    #                         "[h_]"->"[i_]"
  1466         -    #
  1467         -    #--------
  1468         -    # As the current version of this script depends on Ruby anyway,
  1469         -    # the gawk regex based branches that are really
  1470         -    # complex and require multiple gawk calls can be left unimplemented.
  1471         -    # That way this script becomes more succinct.
  1472         -    #--------------------
  1473         -    func_mmmv_tigerhash_t1 "$S_FP_0"
  1474         -    #echo "       Tiger: $S_FUNC_MMMV_TIGERHASH_T1_RESULT"
  1475         -    #func_mmmv_whirlpoolhash_t1 "$S_FP_0"
  1476         -    #echo "   Whirlpool: $S_FUNC_MMMV_WHIRLPOOLHASH_T1_RESULT"
  1477         -    func_mmmv_sha256_t1 "$S_FP_0"
  1478         -    #echo "      SHA256: $S_FUNC_MMMV_SHA256_T1_RESULT"
  1479         -    func_mmmv_filesize_t1 "$S_FP_0"
  1480         -    #echo "   file size: $S_FUNC_MMMV_FILESIZE_T1_RESULT"
  1481         -    #--------
  1482         -    local S_NAME_REVERSED="bolbts." # ".stblob".reverse
  1483         -    local S_0="v0001_s$S_FUNC_MMMV_FILESIZE_T1_RESULT"
  1484         -    S_NAME_REVERSED="$S_NAME_REVERSED$S_0"
  1485         -    S_0="_h$S_FUNC_MMMV_SHA256_T1_RESULT"
  1486         -    S_NAME_REVERSED="$S_NAME_REVERSED$S_0"
  1487         -    S_0="_i$S_FUNC_MMMV_TIGERHASH_T1_RESULT"
  1488         -    S_NAME_REVERSED="$S_NAME_REVERSED$S_0"
  1489         -    #----
  1490         -    S_FUNC_MMMV_SILKTORRENT_PACKAGER_T1_BASH_REVERSE_STRING_REGISTER="$S_NAME_REVERSED"
  1491         -    func_mmmv_silktorrent_packager_t1_bash_reverse_string
  1492         -    S_0="$S_FUNC_MMMV_SILKTORRENT_PACKAGER_T1_BASH_REVERSE_STRING_REGISTER"
  1493         -    S_FUNC_MMMV_SILKTORRENT_PACKAGER_T1_BASH_BLOB2FILENAME_T1_RESULT="$S_0"
  1494         -} # func_mmmv_silktorrent_packager_t1_bash_blob2filename_t1
  1495         -
  1496         -
  1497         -#--------------------------------------------------------------------------
  1498         -
  1499         -func_mmmv_delete_tmp_folder_t1(){
  1500         -    local S_FP_0="$1" # folder path
  1501         -    #--------
  1502         -    if [ ! -e "$S_FP_0" ]; then
  1503         -        echo ""
  1504         -        echo "This script is flawed. The folder "
  1505         -        echo "    $S_FP_0"
  1506         -        echo "is expected to exist during the "
  1507         -        echo "call to this function."
  1508         -        echo "GUID=='28744c23-746a-45de-8322-83f2c08160e7'"
  1509         -        echo ""
  1510         -        #----
  1511         -        cd $S_FP_ORIG
  1512         -        exit 1 # exit with error
  1513         -    fi
  1514         -    #--------
  1515         -    # To avoid a situation, where due to some 
  1516         -    # flaw the home folder or something else important 
  1517         -    # gets accidentally recursively deleted, 
  1518         -    # the following test transforms the path from 
  1519         -    # /tmp/../home/blabla
  1520         -    # to a full path without the dots and then studies, whether
  1521         -    # the full path points to somehwere in the /tmp
  1522         -    local S_FP_1="`cd $S_FP_0; pwd`"
  1523         -    if [ ! -e "$S_FP_1" ]; then
  1524         -        echo ""
  1525         -        echo "This script is flawed. The folder "
  1526         -        echo "    $S_FP_1"
  1527         -        echo "is missing."
  1528         -        echo "GUID=='d16bd124-bc70-4114-8322-83f2c08160e7'"
  1529         -        echo ""
  1530         -        #----
  1531         -        cd $S_FP_ORIG
  1532         -        exit 1 # exit with error
  1533         -    fi
  1534         -    local S_TMP_0="`echo \"$S_FP_1\" | grep -E ^/home `"
  1535         -    if [ "$S_TMP_0" != "" ]; then
  1536         -        echo ""
  1537         -        echo "This script is flawed."
  1538         -        echo "The temporary sandbox folder must reside in /tmp."
  1539         -        echo ""
  1540         -        echo "S_FP_0==$S_FP_0"
  1541         -        echo ""
  1542         -        echo "S_FP_1==$S_FP_1"
  1543         -        echo ""
  1544         -        echo "S_TMP_0==$S_TMP_0"
  1545         -        echo ""
  1546         -        echo "GUID=='5eca69e7-8b8d-47d8-8122-83f2c08160e7'"
  1547         -        echo ""
  1548         -        #----
  1549         -        cd $S_FP_ORIG
  1550         -        exit 1 # exit with error
  1551         -    fi
  1552         -    # Just to be sure, the same thing is checked by a slightly 
  1553         -    # different regex and using the "==" in stead of the "!=".
  1554         -    S_TMP_0="`echo \"$S_FP_1\" | grep -E ^/tmp/`" 
  1555         -    if [ "$S_TMP_0" == "" ]; then
  1556         -        echo ""
  1557         -        echo "This script is flawed."
  1558         -        echo "The temporary sandbox folder must reside in /tmp."
  1559         -        echo ""
  1560         -        echo "S_FP_0==$S_FP_0"
  1561         -        echo ""
  1562         -        echo "S_FP_1==$S_FP_1"
  1563         -        echo ""
  1564         -        echo "S_TMP_0==$S_TMP_0"
  1565         -        echo ""
  1566         -        echo "GUID=='2dafcbf1-68f7-4e41-8512-83f2c08160e7'"
  1567         -        echo ""
  1568         -        #----
  1569         -        cd $S_FP_ORIG
  1570         -        exit 1 # exit with error
  1571         -    fi
  1572         -    #--------
  1573         -    rm -fr $S_FP_1
  1574         -    if [ -e "$S_FP_1" ]; then
  1575         -        echo ""
  1576         -        echo "Something went wrong. The recursive deletion of the temporary folder, "
  1577         -        echo "    $S_FP_1"
  1578         -        echo "failed."
  1579         -        echo "GUID=='1de602b5-174e-4dee-b812-83f2c08160e7'"
  1580         -        echo ""
  1581         -        #----
  1582         -        cd $S_FP_ORIG
  1583         -        exit 1 # exit with error
  1584         -    fi
  1585         -} # func_mmmv_delete_tmp_folder_t1
  1586         -
  1587         -
  1588         -#--------------------------------------------------------------------------
  1589         -
  1590         -# Throws, if there exists a file with the same path.
  1591         -func_mmmv_create_folder_if_it_does_not_already_exist_t1(){
  1592         -    local S_FP_0="$1" # folder path
  1593         -    #--------
  1594         -    if [ "$S_FP_0" == "" ]; then
  1595         -        # Using gawk and alike to cover also cases, where
  1596         -        # $S_FP_0=="  "
  1597         -        # is intentionally left out to avoid the overhead, but
  1598         -        # due to some luck the mkdir exits with an error code greater than 0,
  1599         -        # if it misses a path argument. 
  1600         -        echo ""
  1601         -        echo "S_FP_0==\"\""
  1602         -        echo "GUID=='25389fb4-7fb5-4b04-b312-83f2c08160e7'"
  1603         -        echo ""
  1604         -        #----
  1605         -        cd $S_FP_ORIG
  1606         -        exit 1 # exit with error
  1607         -    fi
  1608         -    #--------------------
  1609         -    if [ -e "$S_FP_0" ]; then
  1610         -        if [ ! -d "$S_FP_0" ]; then
  1611         -            echo ""
  1612         -            echo "The path that is suppose to reference either "
  1613         -            echo "an existing folder or a non-existent folder, "
  1614         -            echo "references a file."
  1615         -            echo "GUID=='3d10cbe1-d097-42a5-9f12-83f2c08160e7'"
  1616         -            echo ""
  1617         -            #----
  1618         -            cd $S_FP_ORIG
  1619         -            exit 1 # exit with error
  1620         -        fi
  1621         -    fi
  1622         -    #--------
  1623         -    mkdir -p $S_FP_0
  1624         -    if [ "$?" != "0" ]; then 
  1625         -        echo ""
  1626         -        echo "mkdir for path "
  1627         -        echo "    $S_FP_0"
  1628         -        echo "failed."
  1629         -        echo "GUID=='15fbef3b-805a-45e2-9312-83f2c08160e7'"
  1630         -        echo ""
  1631         -        #----
  1632         -        cd $S_FP_ORIG
  1633         -        exit 1 # exit with error
  1634         -    fi
  1635         -    #----
  1636         -    if [ ! -e "$S_FP_0" ]; then
  1637         -        echo ""
  1638         -        echo "mkdir execution succeeded, but for some other reason the folder "
  1639         -        echo "    $S_FP_0"
  1640         -        echo "does not exist."
  1641         -        echo "GUID=='e281e242-6195-4fd5-b312-83f2c08160e7'"
  1642         -        echo ""
  1643         -        #----
  1644         -        cd $S_FP_ORIG
  1645         -        exit 1 # exit with error
  1646         -    fi
  1647         -} # func_mmmv_create_folder_if_it_does_not_already_exist_t1
  1648         -
  1649         -
  1650         -#--------------------------------------------------------------------------
  1651         -
  1652         -S_FUNC_FUNC_MMMV_CREATE_TMP_FOLDER_T1_RESULT="" # == "" on failure
  1653         -                                                # otherwise full file path
  1654         -func_mmmv_create_tmp_folder_t1(){
  1655         -    # Does not take any arguments.
  1656         -    #--------
  1657         -    #func_mmmv_exc_hash_function_input_verification_t1 "func_mmmv_GUID_t1" "$1"
  1658         -    #--------------------
  1659         -    S_FUNC_FUNC_MMMV_CREATE_TMP_FOLDER_T1_RESULT="" # value for failure
  1660         -    func_mmmv_GUID_t1
  1661         -    if [ "$S_FUNC_MMMV_GUID_T1_RESULT" == "" ]; then
  1662         -        echo ""
  1663         -        echo "This script is flawed. GUID generation failed and "
  1664         -        echo "the GUID generation function did not throw despite "
  1665         -        echo "the fact that it should have detected its own failure."
  1666         -        echo "GUID=='3cc92c1c-4df7-4091-8112-83f2c08160e7'"
  1667         -        echo ""
  1668         -        #----
  1669         -        cd $S_FP_ORIG
  1670         -        exit 1 # exit with error
  1671         -    fi
  1672         -    #----
  1673         -    local S_TMP_0="/tmp/tmp_silktorrent_$S_FUNC_MMMV_GUID_T1_RESULT"
  1674         -    # The following few if-clauses form a short unrolled loop. The unrolling 
  1675         -    # is for simplicity, because it is Bash, where loops are nasty.
  1676         -    if [ -e "$S_TMP_0" ]; then
  1677         -        func_mmmv_GUID_t1
  1678         -        S_TMP_0="/tmp/tmp_silktorrent_$S_FUNC_MMMV_GUID_T1_RESULT"
  1679         -    fi
  1680         -    if [ -e "$S_TMP_0" ]; then
  1681         -        func_mmmv_GUID_t1
  1682         -        S_TMP_0="/tmp/tmp_silktorrent_$S_FUNC_MMMV_GUID_T1_RESULT"
  1683         -    fi
  1684         -    if [ -e "$S_TMP_0" ]; then
  1685         -        func_mmmv_GUID_t1
  1686         -        S_TMP_0="/tmp/tmp_silktorrent_$S_FUNC_MMMV_GUID_T1_RESULT"
  1687         -    fi
  1688         -    if [ -e "$S_TMP_0" ]; then
  1689         -        func_mmmv_GUID_t1
  1690         -        S_TMP_0="/tmp/tmp_silktorrent_$S_FUNC_MMMV_GUID_T1_RESULT"
  1691         -    fi
  1692         -    #----
  1693         -    if [ -e "$S_TMP_0" ]; then
  1694         -        echo ""
  1695         -        echo "This script failed to generate a locally unique path."
  1696         -        echo "GUID=='208aa0d2-e05b-4d70-b512-83f2c08160e7'"
  1697         -        echo ""
  1698         -        #----
  1699         -        cd $S_FP_ORIG
  1700         -        exit 1 # exit with error
  1701         -    fi
  1702         -    func_mmmv_create_folder_if_it_does_not_already_exist_t1 "$S_TMP_0"
  1703         -    if [ ! -e "$S_TMP_0" ]; then
  1704         -        echo ""
  1705         -        echo "mkdir for path "
  1706         -        echo "    $S_TMP_0"
  1707         -        echo "failed."
  1708         -        echo "GUID=='9fe0c330-c713-46b9-b502-83f2c08160e7'"
  1709         -        echo ""
  1710         -        #----
  1711         -        cd $S_FP_ORIG
  1712         -        exit 1 # exit with error
  1713         -    fi
  1714         -    S_FUNC_FUNC_MMMV_CREATE_TMP_FOLDER_T1_RESULT="$S_TMP_0"
  1715         -} # func_mmmv_create_tmp_folder_t1 
  1716         -
  1717         -
  1718         -#--------------------------------------------------------------------------
  1719         -
  1720         -S_FUNC_MMMV_SILKTORRENT_PACKAGER_T1_BASH_GET_PACKET_FORMAT_VERSION_T1_RESULT="not set"
  1721         -func_mmmv_silktorrent_packager_t1_bash_get_packet_format_version_t1() { 
  1722         -    local S_FP_0="$1" # Path to the file. 
  1723         -    #----
  1724         -    # It's not necessary for the file to actually exist,
  1725         -    # because this function only analyzes the file path string.
  1726         -    # func_mmmv_silktorrent_packager_t1_bash_exc_assert_wrappable_file_exists_t1 "$S_FP_0"
  1727         -    if [ "$S_FP_0" == "" ]; then
  1728         -        echo ""
  1729         -        echo "The file path candidate must not be an empty string."
  1730         -        echo "GUID=='2edcf528-cd73-42d3-9402-83f2c08160e7'"
  1731         -        echo ""
  1732         -        #----
  1733         -        cd $S_FP_ORIG
  1734         -        exit 1 # exit with error
  1735         -    fi 
  1736         -    #----
  1737         -    # The 
  1738         -    #
  1739         -    #     basename /tmp/foo/
  1740         -    #
  1741         -    # returns
  1742         -    #
  1743         -    #     foo
  1744         -    #
  1745         -    # That is to say, the "basename" ignores the rightmost slash.
  1746         -    #----
  1747         -    local S_TMP_0="`ruby -e \"\
  1748         -        s='noslash';\
  1749         -        if(('$S_FP_0'.reverse)[0..0]=='/') then \
  1750         -            s='slash_present';\
  1751         -        end;\
  1752         -        puts(s);\
  1753         -        \"`"
  1754         -    if [ "$S_TMP_0" != "noslash" ]; then
  1755         -        echo ""
  1756         -        echo "The path candidate must not end with a slash."
  1757         -        echo ""
  1758         -        echo "    S_FP_0==$S_FP_0"
  1759         -        echo ""
  1760         -        echo "    S_TMP_0==$S_TMP_0"
  1761         -        echo ""
  1762         -        echo "GUID=='22c77358-4f17-4c98-9102-83f2c08160e7'"
  1763         -        echo ""
  1764         -        #----
  1765         -        cd $S_FP_ORIG
  1766         -        exit 1 # exit with error
  1767         -    fi
  1768         -    basename $S_FP_0 1>/dev/null # to set a value to the $? in this scope 
  1769         -    if [ "$?" != "0" ]; then
  1770         -        echo ""
  1771         -        echo "The command "
  1772         -        echo ""
  1773         -        echo "    basename $S_FP_0 "
  1774         -        echo ""
  1775         -        echo "exited with an error."
  1776         -        echo "GUID=='fba39e45-4c8a-4b37-b402-83f2c08160e7'"
  1777         -        echo ""
  1778         -        #----
  1779         -        cd $S_FP_ORIG
  1780         -        exit 1 # exit with error
  1781         -    fi 
  1782         -    S_TMP_0="`basename $S_FP_0`"
  1783         -    if [ "$S_TMP_0" == "" ]; then
  1784         -        echo ""
  1785         -        echo "The file path candidate must be a string that "
  1786         -        echo "is not an empty string after "
  1787         -        echo "all of the spaces and tabs have been removed from it."
  1788         -        echo "GUID=='90849917-3e05-40ae-a302-83f2c08160e7'"
  1789         -        echo ""
  1790         -        #----
  1791         -        cd $S_FP_ORIG
  1792         -        exit 1 # exit with error
  1793         -    fi 
  1794         -    #--------
  1795         -    S_FUNC_MMMV_SILKTORRENT_PACKAGER_T1_BASH_GET_PACKET_FORMAT_VERSION_T1_RESULT=""
  1796         -    local S_OUT="unsupported_by_this_script_version"
  1797         -    #--------
  1798         -    # In Ruby
  1799         -    #     "foo.stblob"[0..(-8)]=="foo"
  1800         -    #     "foo.stblob"[(-99)..(-1)]==nil
  1801         -    # 
  1802         -    local S_TMP_1="`ruby -e \"\
  1803         -        x='$S_TMP_0'[0..(-8)];\
  1804         -        if(x!=nil) then\
  1805         -            md=x.reverse.match(/v[\\d]+/);\
  1806         -            if(md!=nil) then\
  1807         -                s_0=(md[0].to_s)[1..(-1)];\
  1808         -                print(s_0.sub(/^[0]+/,''));\
  1809         -            end;\
  1810         -        end;\
  1811         -        \"`"
  1812         -    # echo "$S_TMP_0"
  1813         -    # echo "$S_TMP_1"
  1814         -    #----
  1815         -    if [ "$S_TMP_1" != "" ]; then
  1816         -        S_OUT="silktorrent_packet_format_version_$S_TMP_1"
  1817         -    fi 
  1818         -    S_FUNC_MMMV_SILKTORRENT_PACKAGER_T1_BASH_GET_PACKET_FORMAT_VERSION_T1_RESULT="$S_OUT"
  1819         -} # func_mmmv_silktorrent_packager_t1_bash_get_packet_format_version_t1
  1820         -
  1821         -
  1822         -#--------------------------------------------------------------------------
  1823         -
  1824         -S_FUNC_MMMV_SILKTORRENT_PACKAGER_T1_BASH_VERIFY_FILE_NAME_T1_RESULT="not set"
  1825         -func_mmmv_silktorrent_packager_t1_bash_verify_file_name_t1() { 
  1826         -    local S_FP_0="$1" # Path to the file. 
  1827         -    #----
  1828         -    func_mmmv_silktorrent_packager_t1_bash_exc_assert_wrappable_file_exists_t1 "$S_FP_0"
  1829         -    #--------
  1830         -    func_mmmv_silktorrent_packager_t1_bash_get_packet_format_version_t1 "$S_FP_0"
  1831         -    local S_PACKET_FORMAT="$S_FUNC_MMMV_SILKTORRENT_PACKAGER_T1_BASH_GET_PACKET_FORMAT_VERSION_T1_RESULT"
  1832         -    if [ "$S_PACKET_FORMAT" == "unsupported_by_this_script_version" ]; then
  1833         -        echo ""
  1834         -        echo "There exists a possibility that the "
  1835         -        echo "Silktorrent packet candidate is actually OK, but "
  1836         -        echo "this is an older version of the Silktorrent implementaiton and "
  1837         -        echo "the older version does not support "
  1838         -        echo "newer Silktorrent packet formats. "
  1839         -        echo "The file path of the Silktorrent packet candidate:"
  1840         -        echo ""
  1841         -        echo "    $S_FP_0"
  1842         -        echo ""
  1843         -        echo "GUID=='3e96d920-02dc-43a2-a202-83f2c08160e7'"
  1844         -        echo ""
  1845         -        #----
  1846         -        cd $S_FP_ORIG
  1847         -        exit 1 # exit with error
  1848         -    fi
  1849         -    #--------
  1850         -    local S_TMP_1=""
  1851         -    if [ "$S_PACKET_FORMAT" == "silktorrent_packet_format_version_1" ]; then
  1852         -        func_mmmv_silktorrent_packager_t1_bash_blob2filename_t1 "$S_FP_0"
  1853         -        #echo "$S_FUNC_MMMV_SILKTORRENT_PACKAGER_T1_BASH_BLOB2FILENAME_T1_RESULT"
  1854         -        S_TMP_1="$S_FUNC_MMMV_SILKTORRENT_PACKAGER_T1_BASH_BLOB2FILENAME_T1_RESULT"
  1855         -    fi
  1856         -    #----
  1857         -    if [ "$S_TMP_1" == "" ]; then
  1858         -        echo ""
  1859         -        echo "This script is flawed."
  1860         -        echo "It should have thrown before the control flow reaches this line."
  1861         -        echo "GUID=='95af1748-4736-48dd-b102-83f2c08160e7'"
  1862         -        echo ""
  1863         -        #----
  1864         -        cd $S_FP_ORIG
  1865         -        exit 1 # exit with error
  1866         -    fi
  1867         -    #--------
  1868         -    local S_TMP_0="`basename $S_FP_0`" # The S_TMP_0 must be evaluated 
  1869         -                                       # after the various functions to 
  1870         -                                       # counter a situation, where 
  1871         -                                       # the S_TMP_0 is overwritten 
  1872         -                                       # by the name-calc function 
  1873         -                                       # or by one of the sub-functions
  1874         -                                       # of the name-calc function.
  1875         -                                       # The flaw occurs, when the 
  1876         -                                       # S_TMP_0 is used within the 
  1877         -                                       # name-calc function without  
  1878         -                                       # declaring it to be a local
  1879         -                                       # variable.
  1880         -    #--------
  1881         -    #echo "S_FP_0==$S_FP_0"
  1882         -    #echo "S_TMP_0==$S_TMP_0"
  1883         -    #echo "S_TMP_1==$S_TMP_1"
  1884         -    local S_OUT=""
  1885         -    if [ "$S_TMP_1" == "$S_TMP_0" ]; then
  1886         -        S_OUT="verification_passed"
  1887         -    else
  1888         -        S_OUT="verification_failed"
  1889         -    fi
  1890         -    S_FUNC_MMMV_SILKTORRENT_PACKAGER_T1_BASH_VERIFY_FILE_NAME_T1_RESULT="$S_OUT"
  1891         -} # func_mmmv_silktorrent_packager_t1_bash_verify_file_name_t1
  1892         -
  1893         -
  1894         -#--------------------------------------------------------------------------
  1895         -
  1896         -func_mmmv_silktorrent_packager_t1_bash_test_1() { 
  1897         -    local S_FP_0="$1" # Path to the file. 
  1898         -    #----
  1899         -    func_mmmv_silktorrent_packager_t1_bash_exc_assert_wrappable_file_exists_t1 "$S_FP_0"
  1900         -    #--------
  1901         -    echo ""
  1902         -    #----
  1903         -    func_mmmv_tigerhash_t1 "$S_FP_0"
  1904         -    echo "       Tiger: $S_FUNC_MMMV_TIGERHASH_T1_RESULT"
  1905         -    func_mmmv_whirlpoolhash_t1 "$S_FP_0"
  1906         -    echo "   Whirlpool: $S_FUNC_MMMV_WHIRLPOOLHASH_T1_RESULT"
  1907         -    func_mmmv_sha256_t1 "$S_FP_0"
  1908         -    echo "      SHA256: $S_FUNC_MMMV_SHA256_T1_RESULT"
  1909         -    func_mmmv_filesize_t1 "$S_FP_0"
  1910         -    echo "   file size: $S_FUNC_MMMV_FILESIZE_T1_RESULT"
  1911         -    #----
  1912         -    echo ""
  1913         -} # func_mmmv_silktorrent_packager_t1_bash_test_1
  1914         -
  1915         -
  1916         -#--------------------------------------------------------------------------
  1917         -
  1918         -func_mmmv_silktorrent_packager_t1_bash_wrap_t1() {
  1919         -    local S_FP_0="$1" # Path to the file. 
  1920         -    #----
  1921         -    func_mmmv_silktorrent_packager_t1_bash_exc_assert_wrappable_file_exists_t1 "$S_FP_0"
  1922         -    #--------
  1923         -    func_mmmv_create_tmp_folder_t1
  1924         -    if [ "$S_FUNC_FUNC_MMMV_CREATE_TMP_FOLDER_T1_RESULT" == "" ]; then
  1925         -        echo "This script is flawed, because the folder "
  1926         -        echo "creation function should have thrown "
  1927         -        echo "before the control flow reaches this branch." 
  1928         -        echo "GUID=='86a9f465-fc12-4f17-b2f1-83f2c08160e7'"
  1929         -        #----
  1930         -        cd $S_FP_ORIG
  1931         -        exit 1 # exit with error
  1932         -    fi
  1933         -    local S_FP_TMP_0="$S_FUNC_FUNC_MMMV_CREATE_TMP_FOLDER_T1_RESULT"
  1934         -    if [ ! -e "$S_FP_TMP_0" ]; then
  1935         -        echo "This script is flawed."
  1936         -        echo "May be some other thread deleted the folder or"
  1937         -        echo "the folder creation function returned a valid path, but"
  1938         -        echo "did not actually create the folder that it was supposed create."
  1939         -        echo "S_FP_TMP_0==$S_FP_TMP_0"
  1940         -        echo "GUID=='58b79d45-c739-4cf0-a2f1-83f2c08160e7'"
  1941         -        #----
  1942         -        cd $S_FP_ORIG
  1943         -        exit 1 # exit with error
  1944         -    fi
  1945         -    #--------
  1946         -    local S_FP_TMP_SILKTORRENT_PACKET="$S_FP_TMP_0/silktorrent_packet"
  1947         -    local S_FP_TMP_SILKTORRENT_PACKET_TAR="$S_FP_TMP_0/silktorrent_packet.tar"
  1948         -    local S_FP_TMP_PAYLOAD="$S_FP_TMP_SILKTORRENT_PACKET/payload"
  1949         -    local S_FP_TMP_HEADER="$S_FP_TMP_SILKTORRENT_PACKET/header"
  1950         -    local S_FP_TMP_HEADER_SALT_TXT="$S_FP_TMP_HEADER/silktorrent_salt.txt"
  1951         -    func_mmmv_create_folder_if_it_does_not_already_exist_t1 "$S_FP_TMP_PAYLOAD" # uses mkdir -p
  1952         -    func_mmmv_create_folder_if_it_does_not_already_exist_t1 "$S_FP_TMP_HEADER"
  1953         -    #--------
  1954         -    # Salting makes sure that it is not possible to 
  1955         -    # conclude the payload bitstream from the 
  1956         -    # Silktorrent packet (file) name, forcing censoring
  1957         -    # parties to download packages 
  1958         -    # that they are not looking for and allowing
  1959         -    # censorship dodgers to publish the same payload bitstream
  1960         -    # in multiple, differet, Silktorrent packages.
  1961         -    func_mmmv_GUID_t1
  1962         -    echo "$S_FUNC_MMMV_GUID_T1_RESULT" >> $S_FP_TMP_HEADER_SALT_TXT
  1963         -    func_mmmv_GUID_t1
  1964         -    echo "$S_FUNC_MMMV_GUID_T1_RESULT" >> $S_FP_TMP_HEADER_SALT_TXT
  1965         -    func_mmmv_GUID_t1
  1966         -    echo "$S_FUNC_MMMV_GUID_T1_RESULT" >> $S_FP_TMP_HEADER_SALT_TXT
  1967         -    func_mmmv_GUID_t1
  1968         -    echo "$S_FUNC_MMMV_GUID_T1_RESULT" >> $S_FP_TMP_HEADER_SALT_TXT
  1969         -    func_mmmv_GUID_t1
  1970         -    echo "$S_FUNC_MMMV_GUID_T1_RESULT" >> $S_FP_TMP_HEADER_SALT_TXT
  1971         -    func_mmmv_GUID_t1
  1972         -    echo "$S_FUNC_MMMV_GUID_T1_RESULT" >> $S_FP_TMP_HEADER_SALT_TXT
  1973         -    #--------
  1974         -    # The file size/Silktorrent pakcket size must also be salted.
  1975         -    ruby -e \
  1976         -        "Random.new_seed;i=0;\
  1977         -         puts '';\
  1978         -         rand(10**6).times{\
  1979         -             i=i+1;\
  1980         -             print(rand(10**6).to_s(16));\
  1981         -             if((i%10)==0) then \
  1982         -                 puts '';\
  1983         -                 i=0;\
  1984         -             end;\
  1985         -         }" \
  1986         -         >> $S_FP_TMP_HEADER_SALT_TXT
  1987         -    #--------
  1988         -    cp -f $S_FP_0 $S_FP_TMP_PAYLOAD/
  1989         -    if [ "$?" != "0" ]; then
  1990         -        echo ""
  1991         -        echo "The command "
  1992         -        echo ""
  1993         -        echo "    cp -f \$S_FP_0 \$S_FP_TMP_PAYLOAD/ "
  1994         -        echo ""
  1995         -        echo "failed. Either this script is flawed or something else went wrong. "
  1996         -        echo ""
  1997         -        echo "    S_FP_0==$S_FP_0"
  1998         -        echo ""
  1999         -        echo "    S_FP_TMP_PAYLOAD=$S_FP_TMP_PAYLOAD"
  2000         -        echo ""
  2001         -        echo "GUID=='82573133-665f-4630-93f1-83f2c08160e7'"
  2002         -        echo ""
  2003         -        #----
  2004         -        cd $S_FP_ORIG
  2005         -        exit 1 # exit with error
  2006         -    fi
  2007         -    #--------
  2008         -    local S_FP_TMP_ORIG_0="`pwd`"
  2009         -    cd $S_FP_TMP_SILKTORRENT_PACKET/.. 
  2010         -    tar -cf $S_FP_TMP_SILKTORRENT_PACKET_TAR ./`basename $S_FP_TMP_SILKTORRENT_PACKET` 2>/dev/null
  2011         -    cd $S_FP_TMP_ORIG_0
  2012         -    if [ "$?" != "0" ]; then
  2013         -        echo ""
  2014         -        echo "The command "
  2015         -        echo ""
  2016         -        echo "    tar -cf \$S_FP_TMP_SILKTORRENT_PACKET_TAR \$S_FP_TMP_SILKTORRENT_PACKET "
  2017         -        echo ""
  2018         -        echo "failed. Either this script is flawed or something else went wrong. "
  2019         -        echo ""
  2020         -        echo "    S_FP_TMP_SILKTORRENT_PACKET=$S_FP_TMP_SILKTORRENT_PACKET"
  2021         -        echo ""
  2022         -        echo "    S_FP_TMP_SILKTORRENT_PACKET_TAR==$S_FP_TMP_SILKTORRENT_PACKET_TAR"
  2023         -        echo ""
  2024         -        echo "GUID=='36819d11-7f01-4740-a4f1-83f2c08160e7'"
  2025         -        echo ""
  2026         -        #----
  2027         -        cd $S_FP_ORIG
  2028         -        exit 1 # exit with error
  2029         -    fi
  2030         -    #----
  2031         -    func_mmmv_silktorrent_packager_t1_bash_blob2filename_t1 "$S_FP_TMP_SILKTORRENT_PACKET_TAR"
  2032         -    local S_FP_TMP_SILKTORRENT_PACKET_PUBLISHINGNAME="$S_FP_ORIG/$S_FUNC_MMMV_SILKTORRENT_PACKAGER_T1_BASH_BLOB2FILENAME_T1_RESULT"
  2033         -    mv $S_FP_TMP_SILKTORRENT_PACKET_TAR $S_FP_TMP_SILKTORRENT_PACKET_PUBLISHINGNAME
  2034         -    if [ "$?" != "0" ]; then
  2035         -        echo ""
  2036         -        echo "Something went wrong."
  2037         -        echo "The renaming and copying of "
  2038         -        echo "    $S_FP_TMP_SILKTORRENT_PACKET_TAR "
  2039         -        echo "to "
  2040         -        echo "    $S_FP_TMP_SILKTORRENT_PACKET_PUBLISHINGNAME "
  2041         -        echo "failed."
  2042         -        echo "GUID=='db65c191-4ba3-4672-b3f1-83f2c08160e7'"
  2043         -        echo ""
  2044         -        #----
  2045         -        cd $S_FP_ORIG
  2046         -        exit 1 # exit with error
  2047         -    fi
  2048         -    if [ ! -e "$S_FP_TMP_SILKTORRENT_PACKET_PUBLISHINGNAME" ]; then
  2049         -        echo ""
  2050         -        echo "Something went wrong."
  2051         -        echo "The renaming and copying of "
  2052         -        echo ""
  2053         -        echo "    $S_FP_TMP_SILKTORRENT_PACKET_TAR "
  2054         -        echo ""
  2055         -        echo "to "
  2056         -        echo ""
  2057         -        echo "    $S_FP_TMP_SILKTORRENT_PACKET_PUBLISHINGNAME "
  2058         -        echo ""
  2059         -        echo "failed. The mv command succeed, but for some reason "
  2060         -        echo "the destination file does not exist."
  2061         -        echo "GUID=='83fae955-7e6b-4a80-85f1-83f2c08160e7'"
  2062         -        echo ""
  2063         -        #----
  2064         -        cd $S_FP_ORIG
  2065         -        exit 1 # exit with error
  2066         -    fi
  2067         -    #--------
  2068         -    func_mmmv_delete_tmp_folder_t1 "$S_FP_TMP_0"
  2069         -    if [ -e "$S_FP_TMP_0" ]; then
  2070         -        echo ""
  2071         -        echo "Something went wrong."
  2072         -        echo "The deletion of the temporary folder, "
  2073         -        echo ""
  2074         -        echo "    $S_FP_TMP_0"
  2075         -        echo ""
  2076         -        echo "failed."
  2077         -        echo "GUID=='2dd1f121-5407-48a0-b2f1-83f2c08160e7'"
  2078         -        echo ""
  2079         -        #----
  2080         -        cd $S_FP_ORIG
  2081         -        exit 1 # exit with error
  2082         -    fi
  2083         -} # func_mmmv_silktorrent_packager_t1_bash_wrap_t1
  2084         -
  2085         -
  2086         -#--------------------------------------------------------------------------
  2087         -
  2088         -func_mmmv_silktorrent_packager_t1_bash_unwrap_t1() {
  2089         -    local S_FP_0="$1" # Path to the file. 
  2090         -    #----
  2091         -    func_mmmv_silktorrent_packager_t1_bash_exc_assert_wrappable_file_exists_t1 "$S_FP_0"
  2092         -    #--------
  2093         -    func_mmmv_silktorrent_packager_t1_bash_verify_file_name_t1 "$S_FP_0"
  2094         -    local S_PACKET_FORMAT="$S_FUNC_MMMV_SILKTORRENT_PACKAGER_T1_BASH_GET_PACKET_FORMAT_VERSION_T1_RESULT"
  2095         -    if [ "$S_FUNC_MMMV_SILKTORRENT_PACKAGER_T1_BASH_VERIFY_FILE_NAME_T1_RESULT" != "verification_passed" ]; then
  2096         -        echo ""
  2097         -        echo "The Silktorrent packet candidate, "
  2098         -        echo ""
  2099         -        echo "    $S_FP_0"
  2100         -        echo ""
  2101         -        echo "failed Silktorrent packet name verification."
  2102         -        echo "There exists a possibility that the "
  2103         -        echo "Silktorrent packet candidate is actually OK, but "
  2104         -        echo "this is an older version of the Silktorrent implementaiton and "
  2105         -        echo "this, the older, version does not support "
  2106         -        echo "newer Silktorrent packet formats. "
  2107         -        echo "GUID=='859bd022-e09e-4d45-94e1-83f2c08160e7'"
  2108         -        echo ""
  2109         -        #----
  2110         -        cd $S_FP_ORIG
  2111         -        exit 1 # exit with error
  2112         -    fi
  2113         -    #--------
  2114         -    local SB_FORMAT_BRANCH_EXISTS_IN_THIS_FUNCTION="f"
  2115         -    if [ "$S_PACKET_FORMAT" == "silktorrent_packet_format_version_1" ]; then
  2116         -        SB_FORMAT_BRANCH_EXISTS_IN_THIS_FUNCTION="t"
  2117         -        #----
  2118         -        local S_FP_TMP_SILKTORRENT_PACKET="`pwd`/silktorrent_packet"
  2119         -        if [ -e $S_FP_TMP_SILKTORRENT_PACKET ]; then
  2120         -            echo ""
  2121         -            echo "To avoid accidental deletion of files, "
  2122         -            echo "and some other types of flaws, "
  2123         -            echo "there is a requirement that the folder "
  2124         -            echo ""
  2125         -            echo "    ./silktorrent_packet"
  2126         -            echo ""
  2127         -            echo "must be explicitly deleted before calling this script."
  2128         -            echo "GUID=='c2967e69-c2b9-4774-91e1-83f2c08160e7'"
  2129         -            echo ""
  2130         -            #----
  2131         -            cd $S_FP_ORIG
  2132         -            exit 1 # exit with error
  2133         -        fi
  2134         -        #----
  2135         -        tar -xf $S_FP_0 2>/dev/null
  2136         -        if [ "$?" != "0" ]; then
  2137         -            echo ""
  2138         -            echo "Something went wrong. The command "
  2139         -            echo ""
  2140         -            echo "    tar -xf $S_FP_0"
  2141         -            echo ""
  2142         -            echo "exited with an error code, which is $? ."
  2143         -            echo "GUID=='aef74f24-a969-470f-85e1-83f2c08160e7'"
  2144         -            echo ""
  2145         -            #----
  2146         -            cd $S_FP_ORIG
  2147         -            exit 1 # exit with error
  2148         -        fi
  2149         -        rm -f $S_FP_TMP_SILKTORRENT_PACKET/header/silktorrent_salt.txt
  2150         -        #----
  2151         -        if [ ! -e $S_FP_TMP_SILKTORRENT_PACKET ]; then
  2152         -            echo ""
  2153         -            echo "Something went wrong. "
  2154         -            echo "The unpacking of the Silktorrent packet with the path of "
  2155         -            echo ""
  2156         -            echo "    $S_FP_0"
  2157         -            echo ""
  2158         -            echo "failed. The folder \"silktorrent_packet\" "
  2159         -            echo "is missing after the \"tar\" exited without any errors."
  2160         -            echo "GUID=='b6ee795a-4468-480f-a2e1-83f2c08160e7'"
  2161         -            echo ""
  2162         -            #----
  2163         -            cd $S_FP_ORIG
  2164         -            exit 1 # exit with error
  2165         -        fi
  2166         -    fi # silktorrent_packet_format_version_1
  2167         -    #--------
  2168         -    if [ "$SB_FORMAT_BRANCH_EXISTS_IN_THIS_FUNCTION" != "t" ]; then
  2169         -        echo ""
  2170         -        echo "This script is flawed."
  2171         -        echo "There is at least one branch missing from this function."
  2172         -        echo "GUID=='d0662736-c1b5-4902-a1e1-83f2c08160e7'"
  2173         -        echo ""
  2174         -        #----
  2175         -        cd $S_FP_ORIG
  2176         -        exit 1 # exit with error
  2177         -    fi
  2178         -    #--------
  2179         -} # func_mmmv_silktorrent_packager_t1_bash_unwrap_t1
  2180         -
  2181         -
  2182         -#--------------------------------------------------------------------------
  2183         -
  2184         -# The 
  2185         -S_SILKTORRENT_PACKAGER_T1_ACTION="" # is global to allow it to be used
  2186         -# in the error messages of different functions.
  2187         -
  2188         -func_mmmv_silktorrent_packager_t1_bash_determine_action() { 
  2189         -    local S_ARGV_0="$1" # Ruby style ARGV, 0 is the first command line argument.
  2190         -    local S_ARGV_1="$2" 
  2191         -    local S_ARGV_2="$3" 
  2192         -    local S_ARGV_3="$4" 
  2193         -    #--------
  2194         -    if [ "$S_ARGV_0" == "" ]; then
  2195         -        func_mmmv_silktorrent_packager_t1_bash_print_help_msg_t1
  2196         -        #----
  2197         -        cd $S_FP_ORIG
  2198         -        exit 1 # exit with an error
  2199         -    fi
  2200         -    #----
  2201         -    local SB_0="f"
  2202         -    if [ "$S_ARGV_0" == "help" ]; then
  2203         -        SB_0="t"
  2204         -    fi
  2205         -    if [ "$S_ARGV_0" == "--help" ]; then
  2206         -        SB_0="t"
  2207         -    fi
  2208         -    if [ "$S_ARGV_0" == "-?" ]; then
  2209         -        SB_0="t"
  2210         -    fi
  2211         -    if [ "$S_ARGV_0" == "-h" ]; then
  2212         -        SB_0="t"
  2213         -    fi
  2214         -    #----
  2215         -    if [ "$SB_0" == "t" ]; then
  2216         -        func_mmmv_silktorrent_packager_t1_bash_print_help_msg_t1
  2217         -        #----
  2218         -        cd $S_FP_ORIG
  2219         -        exit 0 # exit without an error
  2220         -    fi
  2221         -    #--------------------------
  2222         -    # Start of actions that require the existance of at least one file.
  2223         -    local S_TMP_0=""
  2224         -    local S_TMP_1=""
  2225         -    #----
  2226         -    S_TMP_0="wrap" 
  2227         -    if [ "$S_ARGV_0" == "$S_TMP_0" ]; then
  2228         -        S_SILKTORRENT_PACKAGER_T1_ACTION="$S_TMP_0"
  2229         -    fi
  2230         -    if [ "$S_ARGV_0" == "pack" ]; then   # alias
  2231         -        S_SILKTORRENT_PACKAGER_T1_ACTION="$S_TMP_0"
  2232         -    fi
  2233         -    #----
  2234         -    S_TMP_0="unwrap" 
  2235         -    if [ "$S_ARGV_0" == "$S_TMP_0" ]; then
  2236         -        S_SILKTORRENT_PACKAGER_T1_ACTION="$S_TMP_0"
  2237         -    fi
  2238         -    if [ "$S_ARGV_0" == "unpack" ]; then # alias
  2239         -        S_SILKTORRENT_PACKAGER_T1_ACTION="$S_TMP_0"
  2240         -    fi
  2241         -    #----
  2242         -    S_TMP_0="verify" # checks the matche between the blob and the file name
  2243         -    if [ "$S_ARGV_0" == "$S_TMP_0" ]; then
  2244         -        S_SILKTORRENT_PACKAGER_T1_ACTION="$S_TMP_0"
  2245         -    fi
  2246         -    #----
  2247         -    S_TMP_0="test_hash_t1" 
  2248         -    if [ "$S_ARGV_0" == "$S_TMP_0" ]; then
  2249         -        S_SILKTORRENT_PACKAGER_T1_ACTION="$S_TMP_0"
  2250         -    fi
  2251         -    #--------
  2252         -    if [ "$S_SILKTORRENT_PACKAGER_T1_ACTION" == "" ]; then
  2253         -        func_mmmv_silktorrent_packager_t1_bash_print_help_msg_t1
  2254         -        #----
  2255         -        cd $S_FP_ORIG
  2256         -        exit 1 # exit with an error
  2257         -    fi
  2258         -    # The action name test above has to be before the 
  2259         -    func_mmmv_silktorrent_packager_t1_bash_exc_assert_wrappable_file_exists_t1 "$S_ARGV_1"
  2260         -    # because otherwise the texts of the 
  2261         -    # error messages are incorrect. Indeed, it does
  2262         -    # introduce the following duplicating series of if-clauses,
  2263         -    # but it's all in the name of producing helpful error
  2264         -    # messages at different situations.
  2265         -    #----
  2266         -    if [ "$S_SILKTORRENT_PACKAGER_T1_ACTION" == "wrap" ]; then
  2267         -        func_mmmv_silktorrent_packager_t1_bash_wrap_t1 "$S_ARGV_1"
  2268         -        #----
  2269         -        cd $S_FP_ORIG
  2270         -        exit 0 # exit without an error
  2271         -    fi
  2272         -    #----
  2273         -    if [ "$S_SILKTORRENT_PACKAGER_T1_ACTION" == "unwrap" ]; then
  2274         -        func_mmmv_silktorrent_packager_t1_bash_unwrap_t1 "$S_ARGV_1"
  2275         -        #----
  2276         -        cd $S_FP_ORIG
  2277         -        exit 0 # exit without an error
  2278         -    fi
  2279         -    #----
  2280         -    if [ "$S_SILKTORRENT_PACKAGER_T1_ACTION" == "verify" ]; then
  2281         -        func_mmmv_silktorrent_packager_t1_bash_verify_file_name_t1 "$S_ARGV_1"
  2282         -        echo "$S_FUNC_MMMV_SILKTORRENT_PACKAGER_T1_BASH_VERIFY_FILE_NAME_T1_RESULT"
  2283         -        #----
  2284         -        cd $S_FP_ORIG
  2285         -        exit 0 # exit without an error
  2286         -    fi
  2287         -    #----
  2288         -    if [ "$S_SILKTORRENT_PACKAGER_T1_ACTION" == "test_hash_t1" ]; then
  2289         -        func_mmmv_silktorrent_packager_t1_bash_test_1 "$S_ARGV_1"
  2290         -        #----
  2291         -        cd $S_FP_ORIG
  2292         -        exit 0 # exit without an error
  2293         -    fi
  2294         -    #--------------------------
  2295         -        echo "" 
  2296         -        echo "This bash script is flawed. The control flow " 
  2297         -        echo "should have never reached this line."
  2298         -        echo "GUID=='87e4c185-e25f-4047-a8e1-83f2c08160e7'"
  2299         -        echo ""
  2300         -        #----
  2301         -        cd $S_FP_ORIG
  2302         -        exit 1 # exit with an error
  2303         -} # func_mmmv_silktorrent_packager_t1_bash_determine_action
  2304         -
  2305         -func_mmmv_silktorrent_packager_t1_bash_determine_action $1 $2 $3 $4 $5 $6 $7
  2306         -
  2307         -
  2308         -#--------------------------------------------------------------------------
  2309         -
  2310         -
  2311         -#--------------------------------------------------------------------------
  2312         -cd $S_FP_ORIG
  2313         -exit 0 # 
  2314         -
  2315         -#==========================================================================
  2316         -# Fragments of comments and code that might find use some times later:
  2317         -#--------------------------------------------------------------------------
  2318         -#
  2319         -#   max 55 characters --- package suggested deprecation date in nanoseconds
  2320         -#                         relative to the Unix Epoch, 
  2321         -#                         written in base 10. It can be negative.
  2322         -#                         rgx_in_ruby=/t((y[-]?[\d]+)|n)[_]/
  2323         -# echo "v0034_s2342_tn_" | gawk '{ gsub(/_/, "_\n"); print }' | \
  2324         -#                          gawk '/^t(y[-]?[0-9]+|n)_/ {printf "%s",$1 }' |
  2325         -#                          gawk '{gsub(/[tyn_]/,"");printf "%s", $1 }'
  2326         -#                         
  2327         -#
  2328         -
  2329         -
  2330         -#==========================================================================
  2331         -

Added milestone_releases/2016_06_24_Silktorrent/src/silktorrent_packager_t1_v2016_06_24.bash version [1d857208a9].

            1  +#!/usr/bin/env bash
            2  +#==========================================================================
            3  +#
            4  +# The MIT license from the 
            5  +# http://www.opensource.org/licenses/mit-license.php
            6  +#
            7  +# Copyright 2016, martin.vahi@softf1.com that has an
            8  +# Estonian personal identification code of 38108050020.
            9  +#
           10  +# Permission is hereby granted, free of charge, to 
           11  +# any person obtaining a copy of this software and 
           12  +# associated documentation files (the "Software"), 
           13  +# to deal in the Software without restriction, including 
           14  +# without limitation the rights to use, copy, modify, merge, publish, 
           15  +# distribute, sublicense, and/or sell copies of the Software, and 
           16  +# to permit persons to whom the Software is furnished to do so, 
           17  +# subject to the following conditions:
           18  +#
           19  +# The above copyright notice and this permission notice shall be included 
           20  +# in all copies or substantial portions of the Software.
           21  +#
           22  +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 
           23  +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 
           24  +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 
           25  +# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 
           26  +# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 
           27  +# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 
           28  +# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
           29  +#
           30  +#==========================================================================
           31  +S_FP_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
           32  +S_FP_ORIG="`pwd`"
           33  +S_TIMESTAMP="`date +%Y`_`date +%m`_`date +%d`_T_`date +%H`h_`date +%M`min_`date +%S`s"
           34  +
           35  +#--------------------------------------------------------------------------
           36  +
           37  +SB_TMP_FOLDER_EXISTS="f" # to omit one useless and slow file system access
           38  +S_FP_TMP_FOLDER=""
           39  +
           40  +
           41  +func_mmmv_silktorrent_packager_t1_exit_without_any_errors() {
           42  +    local S_0=""
           43  +    local S_1=""
           44  +    if [ "$SB_TMP_FOLDER_EXISTS" == "t" ]; then
           45  +       S_0= 
           46  +    fi
           47  +    exit 0 # exit without an error
           48  +} # func_mmmv_silktorrent_packager_t1_exit_without_any_errors
           49  +
           50  +#--------------------------------------------------------------------------
           51  +
           52  +S_FUNC_MMMV_OPERATING_SYSTEM_TYPE_T1_RESULT=""
           53  +func_mmmv_operating_system_type_t1() {
           54  +    if [ "$S_FUNC_MMMV_OPERATING_SYSTEM_TYPE_T1_RESULT" == "" ]; then
           55  +        S_TMP_0="`uname -a | grep -E [Ll]inux`"
           56  +        if [ "$S_TMP_0" != "" ]; then
           57  +            S_FUNC_MMMV_OPERATING_SYSTEM_TYPE_T1_RESULT="Linux"
           58  +        else
           59  +            S_TMP_0="`uname -a | grep BSD `"
           60  +            if [ "$S_TMP_0" != "" ]; then
           61  +                S_FUNC_MMMV_OPERATING_SYSTEM_TYPE_T1_RESULT="BSD"
           62  +            else
           63  +                S_FUNC_MMMV_OPERATING_SYSTEM_TYPE_T1_RESULT="undetermined"
           64  +            fi
           65  +        fi
           66  +    fi
           67  +} # func_mmmv_operating_system_type_t1
           68  +
           69  +#--------------------------------------------------------------------------
           70  +
           71  +func_mmmv_operating_system_type_t1
           72  +if [ "$S_FUNC_MMMV_OPERATING_SYSTEM_TYPE_T1_RESULT" != "Linux" ]; then
           73  +    if [ "$S_FUNC_MMMV_OPERATING_SYSTEM_TYPE_T1_RESULT" != "BSD" ]; then
           74  +        echo ""
           75  +        echo "  The classical command line utilities at "
           76  +        echo "  different operating systems, for example, Linux and BSD,"
           77  +        echo "  differ. This script is designed to run only on "
           78  +        echo "  Linux and some BSD variants."
           79  +        echo "  If You are willing to risk that some of Your data "
           80  +        echo "  is deleted and/or Your operating system instance"
           81  +        echo "  becomes permanently flawed, to the point that "
           82  +        echo "  it will not even boot, then You may edit the Bash script that "
           83  +        echo "  displays this error message by modifying the test that "
           84  +        echo "  checks for the operating system type."
           85  +        echo ""
           86  +        echo "  If You do decide to edit this Bash script, then "
           87  +        echo "  a recommendation is to test Your modifications "
           88  +        echo "  within a virtual machine or, if virtual machines are not"
           89  +        echo "  an option, as some new operating system user that does not have "
           90  +        echo "  any access to the vital data/files."
           91  +        echo "  GUID=='ae8bec13-4773-4811-94a2-83f2c08160e7'"
           92  +        echo ""
           93  +        echo "  Aborting script without doing anything."
           94  +        echo ""
           95  +        exit 1 # exit with error
           96  +    fi
           97  +fi
           98  +
           99  +
          100  +#--------------------------------------------------------------------------
          101  +
          102  +SB_EXISTS_ON_PATH_T1_RESULT="f"
          103  +func_sb_exists_on_path_t1 () {
          104  +    local S_NAME_OF_THE_EXECUTABLE_1="$1" # first function argument
          105  +    #--------
          106  +    # Function calls like
          107  +    #
          108  +    #     func_sb_exists_on_path_t1 ""
          109  +    #     func_sb_exists_on_path_t1 " "
          110  +    #     func_sb_exists_on_path_t1 "ls ps" # contains a space
          111  +    #
          112  +    # are not allowed.
          113  +    if [ "$S_NAME_OF_THE_EXECUTABLE_1" == "" ] ; then
          114  +        echo ""
          115  +        echo "The Bash function "
          116  +        echo ""
          117  +        echo "    func_sb_exists_on_path_t1 "
          118  +        echo ""
          119  +        echo "is not designed to handle an argument that "
          120  +        echo "equals with an empty string."
          121  +        echo "GUID=='d26d1825-90bf-4ab7-94a2-83f2c08160e7'"
          122  +        echo ""
          123  +        #----
          124  +        cd $S_FP_ORIG
          125  +        exit 1 # exit with error
          126  +    fi
          127  +    local S_TMP_0="`printf \"$S_NAME_OF_THE_EXECUTABLE_1\" | gawk '{gsub(/\s/,"");printf "%s", $1 }'`"
          128  +    if [ "$S_NAME_OF_THE_EXECUTABLE_1" != "$S_TMP_0" ] ; then
          129  +        echo ""
          130  +        echo "The Bash function "
          131  +        echo ""
          132  +        echo "    func_sb_exists_on_path_t1 "
          133  +        echo ""
          134  +        echo "is not designed to handle an argument value that contains "
          135  +        echo "spaces or tabulation characters."
          136  +        echo "The received value in parenthesis:($S_NAME_OF_THE_EXECUTABLE_1)."
          137  +        echo "GUID=='8b402457-dd5b-4921-b2a2-83f2c08160e7'"
          138  +        echo ""
          139  +        #----
          140  +        cd $S_FP_ORIG
          141  +        exit 1 # exit with error
          142  +    fi
          143  +    #--------
          144  +    S_TMP_0="\`which $S_NAME_OF_THE_EXECUTABLE_1 2>/dev/null\`"
          145  +    local S_TMP_1=""
          146  +    local S_TMP_2="S_TMP_1=$S_TMP_0"
          147  +    eval ${S_TMP_2}
          148  +    #----
          149  +    if [ "$S_TMP_1" == "" ] ; then
          150  +        SB_EXISTS_ON_PATH_T1_RESULT="f"
          151  +    else
          152  +        SB_EXISTS_ON_PATH_T1_RESULT="t"
          153  +    fi
          154  +} # func_sb_exists_on_path_t1 
          155  +
          156  +
          157  +
          158  +func_assert_exists_on_path_t2 () {
          159  +    local S_NAME_OF_THE_EXECUTABLE_1="$1" # first function argument
          160  +    local S_NAME_OF_THE_EXECUTABLE_2="$2" # optional argument
          161  +    local S_NAME_OF_THE_EXECUTABLE_3="$3" # optional argument
          162  +    local S_NAME_OF_THE_EXECUTABLE_4="$4" # optional argument
          163  +    #--------
          164  +    # Function calls like
          165  +    #
          166  +    #     func_assert_exists_on_path_t2  ""    ""  "ls"
          167  +    #     func_assert_exists_on_path_t2  "ls"  ""  "ps"
          168  +    #
          169  +    # are not allowed by the spec of this function, but it's OK to call
          170  +    #
          171  +    #     func_assert_exists_on_path_t2  "ls" "" 
          172  +    #     func_assert_exists_on_path_t2  "ls" "ps" ""
          173  +    #     func_assert_exists_on_path_t2  "ls" ""   "" ""
          174  +    #
          175  +    #
          176  +    local SB_THROW="f"
          177  +    if [ "$S_NAME_OF_THE_EXECUTABLE_1" == "" ] ; then
          178  +        SB_THROW="t"
          179  +    else
          180  +        if [ "$S_NAME_OF_THE_EXECUTABLE_2" == "" ] ; then
          181  +            if [ "$S_NAME_OF_THE_EXECUTABLE_3" != "" ] ; then
          182  +                SB_THROW="t"
          183  +            fi
          184  +            if [ "$S_NAME_OF_THE_EXECUTABLE_4" != "" ] ; then
          185  +                SB_THROW="t"
          186  +            fi
          187  +        else
          188  +            if [ "$S_NAME_OF_THE_EXECUTABLE_3" == "" ] ; then
          189  +                if [ "$S_NAME_OF_THE_EXECUTABLE_4" != "" ] ; then
          190  +                    SB_THROW="t"
          191  +                fi
          192  +            fi
          193  +        fi
          194  +    fi
          195  +    #----
          196  +    if [ "$SB_THROW" == "t" ] ; then
          197  +        echo ""
          198  +        echo "The Bash function "
          199  +        echo ""
          200  +        echo "    func_assert_exists_on_path_t2 "
          201  +        echo ""
          202  +        echo "is not designed to handle series of arguments, where "
          203  +        echo "empty strings preced non-empty strings."
          204  +        echo "GUID=='ebdae326-6445-46bf-9292-83f2c08160e7'"
          205  +        echo ""
          206  +        #----
          207  +        cd $S_FP_ORIG
          208  +        exit 1 # exit with error
          209  +    fi
          210  +    if [ "$5" != "" ] ; then
          211  +        echo ""
          212  +        echo "This Bash function is designed to work with at most 4 input arguments"
          213  +        echo "GUID=='522b025f-199b-49f1-a292-83f2c08160e7'"
          214  +        echo ""
          215  +        #----
          216  +        cd $S_FP_ORIG
          217  +        exit 1 # exit with error
          218  +    fi
          219  +    #--------
          220  +    # Function calls like
          221  +    #
          222  +    #     func_assert_exists_on_path_t2 " "
          223  +    #     func_assert_exists_on_path_t2 "ls ps" # contains a space
          224  +    #
          225  +    # are not allowed.
          226  +    SB_THROW="f" 
          227  +    local S_TMP_0=""
          228  +    local S_TMP_1=""
          229  +    local S_TMP_2=""
          230  +    #----
          231  +    if [ "$SB_THROW" == "f" ] ; then
          232  +        S_TMP_0="`printf \"$S_NAME_OF_THE_EXECUTABLE_1\" | gawk '{gsub(/\s/,"");printf "%s", $1 }'`"
          233  +        if [ "$S_NAME_OF_THE_EXECUTABLE_1" != "$S_TMP_0" ] ; then
          234  +            SB_THROW="t" 
          235  +            S_TMP_1="$S_NAME_OF_THE_EXECUTABLE_1"
          236  +            S_TMP_2="GUID=='4f034735-f71d-4fda-9192-83f2c08160e7'"
          237  +        fi
          238  +    fi
          239  +    #----
          240  +    if [ "$SB_THROW" == "f" ] ; then
          241  +        S_TMP_0="`printf \"$S_NAME_OF_THE_EXECUTABLE_2\" | gawk '{gsub(/\s/,"");printf "%s", $1 }'`"
          242  +        if [ "$S_NAME_OF_THE_EXECUTABLE_2" != "$S_TMP_0" ] ; then
          243  +            SB_THROW="t" 
          244  +            S_TMP_1="$S_NAME_OF_THE_EXECUTABLE_2"
          245  +            S_TMP_2="GUID=='d8ee8e35-3634-4963-b192-83f2c08160e7'"
          246  +        fi
          247  +    fi
          248  +    #----
          249  +    if [ "$SB_THROW" == "f" ] ; then
          250  +        S_TMP_0="`printf \"$S_NAME_OF_THE_EXECUTABLE_3\" | gawk '{gsub(/\s/,"");printf "%s", $1 }'`"
          251  +        if [ "$S_NAME_OF_THE_EXECUTABLE_3" != "$S_TMP_0" ] ; then
          252  +            SB_THROW="t" 
          253  +            S_TMP_1="$S_NAME_OF_THE_EXECUTABLE_3"
          254  +            S_TMP_2="GUID=='198c2e17-f678-451d-8192-83f2c08160e7'"
          255  +        fi
          256  +    fi
          257  +    #----
          258  +    if [ "$SB_THROW" == "f" ] ; then
          259  +        S_TMP_0="`printf \"$S_NAME_OF_THE_EXECUTABLE_4\" | gawk '{gsub(/\s/,"");printf "%s", $1 }'`"
          260  +        if [ "$S_NAME_OF_THE_EXECUTABLE_4" != "$S_TMP_0" ] ; then
          261  +            SB_THROW="t" 
          262  +            S_TMP_1="$S_NAME_OF_THE_EXECUTABLE_4"
          263  +            S_TMP_2="GUID=='405c6c1c-7830-4bc4-a492-83f2c08160e7'"
          264  +        fi
          265  +    fi
          266  +    #--------
          267  +    if [ "$SB_THROW" == "t" ] ; then
          268  +        echo ""
          269  +        echo "The Bash function "
          270  +        echo ""
          271  +        echo "    func_assert_exists_on_path_t2 "
          272  +        echo ""
          273  +        echo "is not designed to handle an argument value that contains "
          274  +        echo "spaces or tabulation characters."
          275  +        echo "The unaccepted value in parenthesis:($S_TMP_1)."
          276  +        echo "Branch $S_TMP_2."
          277  +        echo "GUID=='efcc3ce1-f52a-4f28-b582-83f2c08160e7'"
          278  +        echo ""
          279  +        #----
          280  +        cd $S_FP_ORIG
          281  +        exit 1 # exit with error
          282  +    fi
          283  +    SB_THROW="f" # Just a reset, should I forget to reset it later.
          284  +    #---------------
          285  +    S_TMP_0="\`which $S_NAME_OF_THE_EXECUTABLE_1 2>/dev/null\`"
          286  +    local S_TMP_1=""
          287  +    local S_TMP_2="S_TMP_1=$S_TMP_0"
          288  +    eval ${S_TMP_2}
          289  +    #----
          290  +    if [ "$S_TMP_1" == "" ] ; then
          291  +        if [ "$S_NAME_OF_THE_EXECUTABLE_2" == "" ] ; then
          292  +        if [ "$S_NAME_OF_THE_EXECUTABLE_3" == "" ] ; then
          293  +        if [ "$S_NAME_OF_THE_EXECUTABLE_4" == "" ] ; then
          294  +            echo ""
          295  +            echo "This bash script requires the \"$S_NAME_OF_THE_EXECUTABLE_1\" to be on the PATH."
          296  +            echo "GUID=='b10b8c12-1d9e-4a4b-b482-83f2c08160e7'"
          297  +            echo ""
          298  +            #----
          299  +            cd $S_FP_ORIG
          300  +            exit 1 # exit with error
          301  +        fi
          302  +        fi
          303  +        fi
          304  +    else
          305  +        return # at least one of the programs was available at the PATH
          306  +    fi
          307  +    #--------
          308  +    S_TMP_0="\`which $S_NAME_OF_THE_EXECUTABLE_2 2>/dev/null\`"
          309  +    S_TMP_1=""
          310  +    S_TMP_2="S_TMP_1=$S_TMP_0"
          311  +    eval ${S_TMP_2}
          312  +    #----
          313  +    if [ "$S_TMP_1" == "" ] ; then
          314  +        if [ "$S_NAME_OF_THE_EXECUTABLE_3" == "" ] ; then
          315  +        if [ "$S_NAME_OF_THE_EXECUTABLE_4" == "" ] ; then
          316  +            echo ""
          317  +            echo "This bash script requires that either \"$S_NAME_OF_THE_EXECUTABLE_1\" or "
          318  +            echo " \"$S_NAME_OF_THE_EXECUTABLE_2\" is available on the PATH."
          319  +            echo "GUID=='a3730829-4edf-4221-9482-83f2c08160e7'"
          320  +            echo ""
          321  +            #----
          322  +            cd $S_FP_ORIG
          323  +            exit 1 # exit with error
          324  +        fi
          325  +        fi
          326  +    else
          327  +        return # at least one of the programs was available at the PATH
          328  +    fi
          329  +    #--------
          330  +    S_TMP_0="\`which $S_NAME_OF_THE_EXECUTABLE_3 2>/dev/null\`"
          331  +    S_TMP_1=""
          332  +    S_TMP_2="S_TMP_1=$S_TMP_0"
          333  +    eval ${S_TMP_2}
          334  +    #----
          335  +    if [ "$S_TMP_1" == "" ] ; then
          336  +        if [ "$S_NAME_OF_THE_EXECUTABLE_4" == "" ] ; then
          337  +            echo ""
          338  +            echo "This bash script requires that either \"$S_NAME_OF_THE_EXECUTABLE_1\" or "
          339  +            echo " \"$S_NAME_OF_THE_EXECUTABLE_2\" or \"$S_NAME_OF_THE_EXECUTABLE_3\" "
          340  +            echo "is available on the PATH."
          341  +            echo "GUID=='50757072-5884-4bf0-8482-83f2c08160e7'"
          342  +            echo ""
          343  +            #----
          344  +            cd $S_FP_ORIG
          345  +            exit 1 # exit with error
          346  +        fi
          347  +    else
          348  +        return # at least one of the programs was available at the PATH
          349  +    fi
          350  +    #--------
          351  +    S_TMP_0="\`which $S_NAME_OF_THE_EXECUTABLE_4 2>/dev/null\`"
          352  +    S_TMP_1=""
          353  +    S_TMP_2="S_TMP_1=$S_TMP_0"
          354  +    eval ${S_TMP_2}
          355  +    #----
          356  +    if [ "$S_TMP_1" == "" ] ; then
          357  +        echo ""
          358  +        echo "This bash script requires that either \"$S_NAME_OF_THE_EXECUTABLE_1\" or "
          359  +        echo " \"$S_NAME_OF_THE_EXECUTABLE_2\" or \"$S_NAME_OF_THE_EXECUTABLE_3\" or "
          360  +        echo " \"$S_NAME_OF_THE_EXECUTABLE_4\" is available on the PATH."
          361  +        echo "GUID=='ece93119-b340-44ea-8382-83f2c08160e7'"
          362  +        echo ""
          363  +        #----
          364  +        cd $S_FP_ORIG
          365  +        exit 1 # exit with error
          366  +    else
          367  +        return # at least one of the programs was available at the PATH
          368  +    fi
          369  +    #--------
          370  +} # func_assert_exists_on_path_t2
          371  +
          372  +func_assert_exists_on_path_t2 "bash"     # this is a bash script, but it does not hurt
          373  +func_assert_exists_on_path_t2 "basename" # for extracting file names from full paths
          374  +func_assert_exists_on_path_t2 "cat"    # opposite to split
          375  +func_assert_exists_on_path_t2 "sha256sum" "sha256" "rhash"
          376  +func_assert_exists_on_path_t2 "tigerdeep" "rhash"
          377  +func_assert_exists_on_path_t2 "whirlpooldeep" "rhash"
          378  +func_assert_exists_on_path_t2 "tar"
          379  +#--------
          380  +func_assert_exists_on_path_t2 "file"   # for checking the MIME type of the potential tar file
          381  +func_assert_exists_on_path_t2 "filesize" "ruby"
          382  +func_assert_exists_on_path_t2 "gawk"
          383  +#func_assert_exists_on_path_t2 "grep"
          384  +#func_assert_exists_on_path_t2 "readlink"
          385  +func_assert_exists_on_path_t2 "ruby"  # anything over/equal v.2.1 will probably do
          386  +#func_assert_exists_on_path_t2 "split" # for cutting files
          387  +#func_assert_exists_on_path_t2 "test"
          388  +func_assert_exists_on_path_t2 "uname"  # to check the OS type
          389  +func_assert_exists_on_path_t2 "uuidgen" "uuid" # GUID generation on Linux and BSD
          390  +#func_assert_exists_on_path_t2 "xargs"   
          391  +func_assert_exists_on_path_t2 "wc" # for checking hash lengths   
          392  +
          393  +
          394  +#--------------------------------------------------------------------------
          395  +
          396  +func_mmmv_exc_hash_function_input_verification_t1() { 
          397  +    local S_NAME_OF_THE_BASH_FUNCTION="$1" # The name of the Bash function.
          398  +    local S_FP_2_AN_EXISTING_FILE="$2" # The first argument of the Bash function.
          399  +    #--------
          400  +    if [ "$S_NAME_OF_THE_BASH_FUNCTION" == "" ] ; then
          401  +        echo ""
          402  +        echo "The implementation of the function that "
          403  +        echo "calls the "
          404  +        echo ""
          405  +        echo "    func_mmmv_exc_hash_function_input_verification_t1"
          406  +        echo ""
          407  +        echo "is flawed. The call to the "
          408  +        echo ""
          409  +        echo "    func_mmmv_exc_hash_function_input_verification_t1"
          410  +        echo ""
          411  +        echo "misses the first argument or the first argument is an empty string."
          412  +        echo "GUID=='5daa2d36-5d4a-45ac-b482-83f2c08160e7'"
          413  +        echo ""
          414  +        #----
          415  +        cd $S_FP_ORIG
          416  +        exit 1 # exit with error
          417  +    fi
          418  +    local S_TMP_0="`printf \"$S_NAME_OF_THE_BASH_FUNCTION\" | gawk '{gsub(/\s/,"");printf "%s", $1 }'`"
          419  +    if [ "$S_NAME_OF_THE_BASH_FUNCTION" != "$S_TMP_0" ] ; then
          420  +        echo ""
          421  +        echo "The implementation of the function that "
          422  +        echo "calls the "
          423  +        echo ""
          424  +        echo "    func_mmmv_exc_hash_function_input_verification_t1"
          425  +        echo ""
          426  +        echo "is flawed. Function names are not allowed to contain spaces or tabs."
          427  +        echo "GUID=='32fcb7e5-7f9c-42c5-a382-83f2c08160e7'"
          428  +        echo ""
          429  +        #----
          430  +        cd $S_FP_ORIG
          431  +        exit 1 # exit with error
          432  +    fi
          433  +    #--------
          434  +    # Function calls like
          435  +    #
          436  +    #     <function name> ""
          437  +    #     <function name> " "
          438  +    #
          439  +    # are not allowed.
          440  +    local S_TMP_0="`printf \"$S_FP_2_AN_EXISTING_FILE\" | gawk '{gsub(/\s/,"");printf "%s", $1 }'`"
          441  +    if [ "$S_TMP_0" == "" ] ; then
          442  +        echo ""
          443  +        echo "The Bash function "
          444  +        echo ""
          445  +        echo "    $S_NAME_OF_THE_BASH_FUNCTION"
          446  +        echo ""
          447  +        echo "is not designed to handle an argument that "
          448  +        echo "equals with an empty string or a series of spaces and tabs."
          449  +        echo "GUID=='59c6d156-1693-41f5-a282-83f2c08160e7'"
          450  +        echo ""
          451  +        #----
          452  +        cd $S_FP_ORIG
          453  +        exit 1 # exit with error
          454  +    fi
          455  +    #--------
          456  +    if [ ! -e $S_FP_2_AN_EXISTING_FILE ] ; then
          457  +        echo ""
          458  +        echo "The file "
          459  +        echo ""
          460  +        echo "    $S_FP_2_AN_EXISTING_FILE "
          461  +        echo ""
          462  +        echo "is missing or it is a broken link."
          463  +        echo "GUID=='2bdfa731-a82d-4c24-9182-83f2c08160e7'"
          464  +        echo ""
          465  +        #----
          466  +        cd $S_FP_ORIG
          467  +        exit 1 # exit with error
          468  +    fi
          469  +    if [ -d $S_FP_2_AN_EXISTING_FILE ] ; then
          470  +        echo ""
          471  +        echo "The file path "
          472  +        echo ""
          473  +        echo "    $S_FP_2_AN_EXISTING_FILE "
          474  +        echo ""
          475  +        echo "references a folder, but a file is expected."
          476  +        echo "GUID=='342e52a2-f7fa-41c9-b572-83f2c08160e7'"
          477  +        echo ""
          478  +        #----
          479  +        cd $S_FP_ORIG
          480  +        exit 1 # exit with error
          481  +    fi
          482  +    #--------------------
          483  +    # At this line the verifications have all passed.
          484  +    #--------------------
          485  +} # func_mmmv_exc_hash_function_input_verification_t1
          486  +
          487  +
          488  +#--------------------------------------------------------------------------
          489  +
          490  +S_FUNC_MMMV_GUID_T1_RESULT="not_yet_set"
          491  +S_FUNC_MMMV_GUID_T1_MODE="" # optim. to skip repeating console tool selection
          492  +func_mmmv_GUID_t1() { 
          493  +    # Does not take any arguments.
          494  +    #--------
          495  +    #func_mmmv_exc_hash_function_input_verification_t1 "func_mmmv_GUID_t1" "$1"
          496  +    #--------------------
          497  +    # Mode selection:
          498  +    if [ "$S_FUNC_MMMV_GUID_T1_MODE" == "" ] ; then
          499  +        SB_EXISTS_ON_PATH_T1_RESULT="f"  # if-block init
          500  +        #----
          501  +        if [ "$SB_EXISTS_ON_PATH_T1_RESULT" == "f" ] ; then
          502  +            S_TMP_0="uuidgen" # Linux version
          503  +            func_sb_exists_on_path_t1 "$S_TMP_0" 
          504  +            if [ "$SB_EXISTS_ON_PATH_T1_RESULT" == "t" ] ; then
          505  +                 S_FUNC_MMMV_GUID_T1_MODE="$S_TMP_0"
          506  +            fi
          507  +        fi
          508  +        #----
          509  +        if [ "$SB_EXISTS_ON_PATH_T1_RESULT" == "f" ] ; then
          510  +            S_TMP_0="uuid"    # BSD version
          511  +            func_sb_exists_on_path_t1 "$S_TMP_0" 
          512  +            if [ "$SB_EXISTS_ON_PATH_T1_RESULT" == "t" ] ; then
          513  +                 S_FUNC_MMMV_GUID_T1_MODE="$S_TMP_0"
          514  +            fi
          515  +        fi
          516  +        #--------
          517  +        if [ "$S_FUNC_MMMV_GUID_T1_MODE" == "" ] ; then
          518  +            echo ""
          519  +            echo "All of the GUID generation implementations that this script " 
          520  +            echo "is capable of using (uuidgen, uuid) "
          521  +            echo "are missing from the PATH."
          522  +            echo "GUID=='92cc9502-5791-4674-8672-83f2c08160e7'"
          523  +            echo ""
          524  +            #----
          525  +            cd $S_FP_ORIG
          526  +            exit 1 # exit with error
          527  +        fi
          528  +        #--------
          529  +        if [ "$?" != "0" ]; then
          530  +            echo ""
          531  +            echo "This script is flawed."
          532  +            echo "GUID=='69f2c03e-920f-4bbf-8472-83f2c08160e7'"
          533  +            echo ""
          534  +            #----
          535  +            cd $S_FP_ORIG
          536  +            exit 1 # exit with error
          537  +        fi
          538  +        #--------
          539  +    fi
          540  +    #--------------------
          541  +    S_FUNC_MMMV_GUID_T1_RESULT=""
          542  +    #--------------------
          543  +    if [ "$S_FUNC_MMMV_GUID_T1_MODE" == "uuidgen" ]; then
          544  +        S_TMP_0="`uuidgen`"
          545  +        if [ "$?" != "0" ]; then
          546  +            echo ""
          547  +            echo "The console application \"uuidgen\" "
          548  +            echo "exited with an error."
          549  +            echo ""
          550  +            echo "----console--outut--citation--start-----"
          551  +            echo "`uuidgen`" # stdout and stderr
          552  +            echo "----console--outut--citation--end-------"
          553  +            echo ""
          554  +            echo "GUID=='899ef135-d280-406a-b362-83f2c08160e7'"
          555  +            echo ""
          556  +            #----
          557  +            cd $S_FP_ORIG
          558  +            exit 1 # exit with error
          559  +        fi
          560  +        #---- 
          561  +        S_FUNC_MMMV_GUID_T1_RESULT="$S_TMP_0"
          562  +    fi
          563  +    #--------------------
          564  +    if [ "$S_FUNC_MMMV_GUID_T1_MODE" == "uuid" ]; then
          565  +        S_TMP_0="`uuid`"
          566  +        if [ "$?" != "0" ]; then
          567  +            echo ""
          568  +            echo "The console application \"uuid\" "
          569  +            echo "exited with an error."
          570  +            echo ""
          571  +            echo "----console--outut--citation--start-----"
          572  +            echo "`uuid`" # stdout and stderr
          573  +            echo "----console--outut--citation--end-------"
          574  +            echo ""
          575  +            echo "GUID=='185b4073-5086-4196-9462-83f2c08160e7'"
          576  +            echo ""
          577  +            #----
          578  +            cd $S_FP_ORIG
          579  +            exit 1 # exit with error
          580  +        fi
          581  +        #---- 
          582  +        S_FUNC_MMMV_GUID_T1_RESULT="$S_TMP_0"
          583  +    fi
          584  +    #--------------------
          585  +    S_TMP_0="`printf \"$S_FUNC_MMMV_GUID_T1_RESULT\" | wc -m | gawk '{gsub(/\s/,"");printf "%s", $1 }'`"
          586  +    S_TMP_1="36"
          587  +    if [ "$S_TMP_0" != "$S_TMP_1" ]; then
          588  +        echo ""
          589  +        echo "According to the GUID specification, IETF RFC 4122,  "
          590  +        echo "the lenght of the GUID is "
          591  +        echo "$S_TMP_1 characters, but the result of the "
          592  +        echo ""
          593  +        echo "    func_mmmv_GUID_t1"
          594  +        echo ""
          595  +        echo "is something else. The flawed GUID candidate in parenthesis:"
          596  +        echo "($S_FUNC_MMMV_GUID_T1_RESULT)"
          597  +        echo ""
          598  +        echo "The lenght candidate of the flawed GUID candidate in parenthesis:"
          599  +        echo "($S_TMP_0)."
          600  +        echo ""
          601  +        echo "GUID=='8fc9064f-4364-490c-9262-83f2c08160e7'"
          602  +        echo ""
          603  +        #----
          604  +        cd $S_FP_ORIG
          605  +        exit 1 # exit with error
          606  +    fi
          607  +    #--------------------
          608  +} # func_mmmv_GUID_t1
          609  +
          610  +
          611  +#--------------------------------------------------------------------------
          612  +
          613  +S_FUNC_MMMV_SHA256_T1_RESULT="not_yet_set"
          614  +S_FUNC_MMMV_SHA256_T1_MODE="" # optim. to skip repeating console tool selection
          615  +func_mmmv_sha256_t1() { # requires also ruby and gawk 
          616  +    local S_FP_2_AN_EXISTING_FILE="$1" # first function argument
          617  +    #--------
          618  +    func_mmmv_exc_hash_function_input_verification_t1 "func_mmmv_sha256_t1" "$1"
          619  +    #--------------------
          620  +    # Mode selection:
          621  +    if [ "$S_FUNC_MMMV_SHA256_T1_MODE" == "" ] ; then
          622  +        SB_EXISTS_ON_PATH_T1_RESULT="f"  # if-block init
          623  +        #----
          624  +        if [ "$SB_EXISTS_ON_PATH_T1_RESULT" == "f" ] ; then
          625  +            S_TMP_0="sha256sum" # usually available on Linux
          626  +            func_sb_exists_on_path_t1 "$S_TMP_0" 
          627  +            if [ "$SB_EXISTS_ON_PATH_T1_RESULT" == "t" ] ; then
          628  +                 S_FUNC_MMMV_SHA256_T1_MODE="$S_TMP_0"
          629  +            fi
          630  +        fi
          631  +        #----
          632  +        if [ "$SB_EXISTS_ON_PATH_T1_RESULT" == "f" ] ; then
          633  +            S_TMP_0="rhash"    # part of the BSD package collection in 2016
          634  +            func_sb_exists_on_path_t1 "$S_TMP_0" 
          635  +            if [ "$SB_EXISTS_ON_PATH_T1_RESULT" == "t" ] ; then
          636  +                 S_FUNC_MMMV_SHA256_T1_MODE="$S_TMP_0"
          637  +            fi
          638  +        fi
          639  +        #----
          640  +        if [ "$SB_EXISTS_ON_PATH_T1_RESULT" == "f" ] ; then
          641  +            S_TMP_0="sha256"    # usually available on BSD
          642  +            func_sb_exists_on_path_t1 "$S_TMP_0" 
          643  +            if [ "$SB_EXISTS_ON_PATH_T1_RESULT" == "t" ] ; then
          644  +                 S_FUNC_MMMV_SHA256_T1_MODE="$S_TMP_0"
          645  +            fi
          646  +        fi
          647  +        # The console application "rhash" is preferred to the "sha256"
          648  +        # because the "rhash" output can be simply processed with 
          649  +        # "gawk", which takes over 5x less memory than the Ruby interpreter,
          650  +        # not to mention the initialization cost of the Ruby interpreter.
          651  +        #--------
          652  +        if [ "$S_FUNC_MMMV_SHA256_T1_MODE" == "" ] ; then
          653  +            echo ""
          654  +            echo "All of the SHA-256 implementations that this script " 
          655  +            echo "is capable of using (sha256sum, rhash, sha256) "
          656  +            echo "are missing from the PATH."
          657  +            echo "GUID=='446b14b1-7fc2-494d-8362-83f2c08160e7'"
          658  +            echo ""
          659  +            #----
          660  +            cd $S_FP_ORIG
          661  +            exit 1 # exit with error
          662  +        fi
          663  +        #--------
          664  +        if [ "$?" != "0" ]; then
          665  +            echo ""
          666  +            echo "This script is flawed."
          667  +            echo "GUID=='7d241052-f154-434c-a262-83f2c08160e7'"
          668  +            echo ""
          669  +            #----
          670  +            cd $S_FP_ORIG
          671  +            exit 1 # exit with error
          672  +        fi
          673  +        #--------
          674  +    fi
          675  +    #--------------------
          676  +    S_FUNC_MMMV_SHA256_T1_RESULT=""
          677  +    #--------------------
          678  +    if [ "$S_FUNC_MMMV_SHA256_T1_MODE" == "sha256sum" ]; then
          679  +        S_TMP_0="`sha256sum $S_FP_2_AN_EXISTING_FILE 2>/dev/null`"
          680  +        if [ "$?" != "0" ]; then
          681  +            echo ""
          682  +            echo "The console application \"sha256sum\" "
          683  +            echo "exited with an error."
          684  +            echo ""
          685  +            echo "----console--outut--citation--start-----"
          686  +            echo "`sha256sum $S_FP_2_AN_EXISTING_FILE`" # stdout and stderr
          687  +            echo "----console--outut--citation--end-------"
          688  +            echo ""
          689  +            echo "GUID=='ec70acd6-b0de-4e1b-a262-83f2c08160e7'"
          690  +            echo ""
          691  +            #----
          692  +            cd $S_FP_ORIG
          693  +            exit 1 # exit with error
          694  +        fi
          695  +        #---- 
          696  +        # The gawk is used for selecting the 1. column because 
          697  +        # according to the
          698  +        #
          699  +        #     echo "aa bb" | time -v gawk '{printf $1}'
          700  +        #
          701  +        # the gawk takes about 3MiB, which is far less than the 
          702  +        #
          703  +        #     time -v ruby -e "puts 'hi'"
          704  +        #
          705  +        # indicated 16MiB
          706  +        #
          707  +        S_FUNC_MMMV_SHA256_T1_RESULT="`echo \"$S_TMP_0\" | gawk '{printf $1}'`"
          708  +    fi
          709  +    #--------------------
          710  +    if [ "$S_FUNC_MMMV_SHA256_T1_MODE" == "rhash" ]; then
          711  +        S_TMP_0="`rhash --sha256 $S_FP_2_AN_EXISTING_FILE 2>/dev/null`"
          712  +        if [ "$?" != "0" ]; then
          713  +            echo ""
          714  +            echo "The console application \"rhash\" "
          715  +            echo "exited with an error."
          716  +            echo ""
          717  +            echo "----console--outut--citation--start-----"
          718  +            echo "`rhash --sha256 $S_FP_2_AN_EXISTING_FILE `"
          719  +            echo "----console--outut--citation--end-------"
          720  +            echo ""
          721  +            echo "GUID=='56091f39-0544-449c-a562-83f2c08160e7'"
          722  +            echo ""
          723  +            #----
          724  +            cd $S_FP_ORIG
          725  +            exit 1 # exit with error
          726  +        fi
          727  +        S_FUNC_MMMV_SHA256_T1_RESULT="`echo \"$S_TMP_0\" | gawk '{printf $1}'`"
          728  +    fi
          729  +    #--------------------
          730  +    if [ "$S_FUNC_MMMV_SHA256_T1_MODE" == "sha256" ]; then
          731  +        #----
          732  +        S_FUNC_MMMV_SHA256_T1_RESULT=\
          733  +        "`S_TMP_0=\"\`sha256 $S_FP_2_AN_EXISTING_FILE\`\" ruby -e \"s0=ENV['S_TMP_0'].to_s;ix_0=s0.index(') = ');print s0[(ix_0+4)..(-1)]\" 2>/dev/null`"
          734  +        #----
          735  +        if [ "$?" != "0" ]; then
          736  +            echo ""
          737  +            echo "The console application \"sha256\" "
          738  +            echo "exited with an error."
          739  +            echo ""
          740  +            echo "----console--outut--citation--start-----"
          741  +            echo \
          742  +            "`S_TMP_0=\"\`sha256 $S_FP_2_AN_EXISTING_FILE\`\" ruby -e \"s0=ENV['S_TMP_0'].to_s;ix_0=s0.index(') = ');print s0[(ix_0+4)..(-1)]\"`"
          743  +            echo "----console--outut--citation--end-------"
          744  +            echo ""
          745  +            echo "GUID=='65d0c243-954c-4d36-a452-83f2c08160e7'"
          746  +            echo ""
          747  +            #----
          748  +            cd $S_FP_ORIG
          749  +            exit 1 # exit with error
          750  +        fi
          751  +    fi
          752  +    #--------------------
          753  +    S_TMP_0="`printf \"$S_FUNC_MMMV_SHA256_T1_RESULT\" | wc -m | gawk '{gsub(/\s/,"");printf "%s", $1 }'`"
          754  +    S_TMP_1="64"
          755  +    if [ "$S_TMP_0" != "$S_TMP_1" ]; then
          756  +        echo ""
          757  +        echo "According to the specification of the SHA-256 hash algorithm"
          758  +        echo "the lenght of the SHA-256 hash is "
          759  +        echo "$S_TMP_1 hexadecimal characters, but the result of the "
          760  +        echo ""
          761  +        echo "    func_mmmv_sha256_t1"
          762  +        echo ""
          763  +        echo "is something else. The flawed hash candidate in parenthesis:"
          764  +        echo "($S_FUNC_MMMV_SHA256_T1_RESULT)"
          765  +        echo ""
          766  +        echo "The lenght candidate of the flawed hash candidate in parenthesis:"
          767  +        echo "($S_TMP_0)."
          768  +        echo ""
          769  +        echo "GUID=='9fbed31c-5742-4c66-a352-83f2c08160e7'"
          770  +        echo ""
          771  +        #----
          772  +        cd $S_FP_ORIG
          773  +        exit 1 # exit with error
          774  +    fi
          775  +    #--------------------
          776  +} # func_mmmv_sha256_t1
          777  +
          778  +
          779  +#--------------------------------------------------------------------------
          780  +
          781  +S_FUNC_MMMV_TIGERHASH_T1_RESULT="not_yet_set"
          782  +S_FUNC_MMMV_TIGERHASH_T1_MODE="" # optim. to skip repeating console tool selection
          783  +func_mmmv_tigerhash_t1() { # requires also ruby and gawk 
          784  +    local S_FP_2_AN_EXISTING_FILE="$1" # first function argument
          785  +    #--------
          786  +    func_mmmv_exc_hash_function_input_verification_t1 "func_mmmv_tigerhash_t1" "$1"
          787  +    #--------------------
          788  +    # Mode selection:
          789  +    if [ "$S_FUNC_MMMV_TIGERHASH_T1_MODE" == "" ] ; then
          790  +        SB_EXISTS_ON_PATH_T1_RESULT="f"  # if-block init
          791  +        #----
          792  +        if [ "$SB_EXISTS_ON_PATH_T1_RESULT" == "f" ] ; then
          793  +            S_TMP_0="tigerdeep" # usually available on Linux
          794  +            func_sb_exists_on_path_t1 "$S_TMP_0" 
          795  +            if [ "$SB_EXISTS_ON_PATH_T1_RESULT" == "t" ] ; then
          796  +                 S_FUNC_MMMV_TIGERHASH_T1_MODE="$S_TMP_0"
          797  +            fi
          798  +        fi
          799  +        #----
          800  +        if [ "$SB_EXISTS_ON_PATH_T1_RESULT" == "f" ] ; then
          801  +            S_TMP_0="rhash"    # part of the BSD package collection in 2016
          802  +            func_sb_exists_on_path_t1 "$S_TMP_0" 
          803  +            if [ "$SB_EXISTS_ON_PATH_T1_RESULT" == "t" ] ; then
          804  +                 S_FUNC_MMMV_TIGERHASH_T1_MODE="$S_TMP_0"
          805  +            fi
          806  +        fi
          807  +        #--------
          808  +        if [ "$S_FUNC_MMMV_TIGERHASH_T1_MODE" == "" ] ; then
          809  +            echo ""
          810  +            echo "All of the Tiger hash implementations that this script " 
          811  +            echo "is capable of using (tigerdeep, rhash) "
          812  +            echo "are missing from the PATH."
          813  +            echo "GUID=='e0e0004d-7492-4aae-8152-83f2c08160e7'"
          814  +            echo ""
          815  +            #----
          816  +            cd $S_FP_ORIG
          817  +            exit 1 # exit with error
          818  +        fi
          819  +        #--------
          820  +        if [ "$?" != "0" ]; then
          821  +            echo ""
          822  +            echo "This script is flawed."
          823  +            echo "GUID=='4e6ce53e-0891-4a84-a152-83f2c08160e7'"
          824  +            echo ""
          825  +            #----
          826  +            cd $S_FP_ORIG
          827  +            exit 1 # exit with error
          828  +        fi
          829  +        #--------
          830  +    fi
          831  +    #--------------------
          832  +    S_FUNC_MMMV_TIGERHASH_T1_RESULT=""
          833  +    #--------------------
          834  +    if [ "$S_FUNC_MMMV_TIGERHASH_T1_MODE" == "tigerdeep" ]; then
          835  +        S_TMP_0="`tigerdeep $S_FP_2_AN_EXISTING_FILE 2>/dev/null`"
          836  +        if [ "$?" != "0" ]; then
          837  +            echo ""
          838  +            echo "The console application \"tigerdeep\" "
          839  +            echo "exited with an error."
          840  +            echo ""
          841  +            echo "----console--outut--citation--start-----"
          842  +            echo "`tigerdeep $S_FP_2_AN_EXISTING_FILE`" # stdout and stderr
          843  +            echo "----console--outut--citation--end-------"
          844  +            echo ""
          845  +            echo "GUID=='0ac9014e-b1d8-49c0-a352-83f2c08160e7'"
          846  +            echo ""
          847  +            #----
          848  +            cd $S_FP_ORIG
          849  +            exit 1 # exit with error
          850  +        fi
          851  +        S_FUNC_MMMV_TIGERHASH_T1_RESULT="`echo \"$S_TMP_0\" | gawk '{printf $1}'`"
          852  +    fi
          853  +    #--------------------
          854  +    if [ "$S_FUNC_MMMV_TIGERHASH_T1_MODE" == "rhash" ]; then
          855  +        S_TMP_0="`rhash --tiger $S_FP_2_AN_EXISTING_FILE 2>/dev/null`"
          856  +        if [ "$?" != "0" ]; then
          857  +            echo ""
          858  +            echo "The console application \"rhash\" "
          859  +            echo "exited with an error."
          860  +            echo ""
          861  +            echo "----console--outut--citation--start-----"
          862  +            echo "`rhash --tiger $S_FP_2_AN_EXISTING_FILE `"
          863  +            echo "----console--outut--citation--end-------"
          864  +            echo ""
          865  +            echo "GUID=='0d5ce111-3bf8-4eee-9252-83f2c08160e7'"
          866  +            echo ""
          867  +            #----
          868  +            cd $S_FP_ORIG
          869  +            exit 1 # exit with error
          870  +        fi
          871  +        S_FUNC_MMMV_TIGERHASH_T1_RESULT="`echo \"$S_TMP_0\" | gawk '{printf $1}'`"
          872  +    fi
          873  +    #--------------------
          874  +    S_TMP_0="`printf \"$S_FUNC_MMMV_TIGERHASH_T1_RESULT\" | wc -m | gawk '{gsub(/\s/,"");printf "%s", $1 }'`"
          875  +    S_TMP_1="48"
          876  +    if [ "$S_TMP_0" != "$S_TMP_1" ]; then
          877  +        echo ""
          878  +        echo "According to the specification of the Tiger hash algorithm"
          879  +        echo "the lenght of the Tiger hash is "
          880  +        echo "$S_TMP_1 hexadecimal characters, but the result of the "
          881  +        echo ""
          882  +        echo "    func_mmmv_tigerhash_t1"
          883  +        echo ""
          884  +        echo "is something else. The flawed hash candidate in parenthesis:"
          885  +        echo "($S_FUNC_MMMV_TIGERHASH_T1_RESULT)"
          886  +        echo ""
          887  +        echo "The lenght candidate of the flawed hash candidate in parenthesis:"
          888  +        echo "($S_TMP_0)."
          889  +        echo ""
          890  +        echo "GUID=='23b13133-f4fb-46fd-8552-83f2c08160e7'"
          891  +        echo ""
          892  +        #----
          893  +        cd $S_FP_ORIG
          894  +        exit 1 # exit with error
          895  +    fi
          896  +    #--------------------
          897  +} # func_mmmv_tigerhash_t1
          898  +
          899  +
          900  +#--------------------------------------------------------------------------
          901  +
          902  +S_FUNC_MMMV_WHIRLPOOLHASH_T1_RESULT="not_yet_set"
          903  +S_FUNC_MMMV_WHIRLPOOLHASH_T1_MODE="" # optim. to skip repeating console tool selection
          904  +func_mmmv_whirlpoolhash_t1() { # requires also ruby and gawk 
          905  +    local S_FP_2_AN_EXISTING_FILE="$1" # first function argument
          906  +    #--------
          907  +    func_mmmv_exc_hash_function_input_verification_t1 "func_mmmv_whirlpoolhash_t1" "$1"
          908  +    #--------------------
          909  +    # Mode selection:
          910  +    if [ "$S_FUNC_MMMV_WHIRLPOOLHASH_T1_MODE" == "" ] ; then
          911  +        SB_EXISTS_ON_PATH_T1_RESULT="f"  # if-block init
          912  +        #----
          913  +        if [ "$SB_EXISTS_ON_PATH_T1_RESULT" == "f" ] ; then
          914  +            S_TMP_0="whirlpooldeep" # usually available on Linux
          915  +            func_sb_exists_on_path_t1 "$S_TMP_0" 
          916  +            if [ "$SB_EXISTS_ON_PATH_T1_RESULT" == "t" ] ; then
          917  +                 S_FUNC_MMMV_WHIRLPOOLHASH_T1_MODE="$S_TMP_0"
          918  +            fi
          919  +        fi
          920  +        #----
          921  +        if [ "$SB_EXISTS_ON_PATH_T1_RESULT" == "f" ] ; then
          922  +            S_TMP_0="rhash"    # part of the BSD package collection in 2016
          923  +            func_sb_exists_on_path_t1 "$S_TMP_0" 
          924  +            if [ "$SB_EXISTS_ON_PATH_T1_RESULT" == "t" ] ; then
          925  +                 S_FUNC_MMMV_WHIRLPOOLHASH_T1_MODE="$S_TMP_0"
          926  +            fi
          927  +        fi
          928  +        #--------
          929  +        if [ "$S_FUNC_MMMV_WHIRLPOOLHASH_T1_MODE" == "" ] ; then
          930  +            echo ""
          931  +            echo "All of the Whirlpool hash implementations that this script " 
          932  +            echo "is capable of using (whirlpooldeep, rhash) "
          933  +            echo "are missing from the PATH."
          934  +            echo "GUID=='3ec66a62-8721-42e7-b252-83f2c08160e7'"
          935  +            echo ""
          936  +            #----
          937  +            cd $S_FP_ORIG
          938  +            exit 1 # exit with error
          939  +        fi
          940  +        #--------
          941  +        if [ "$?" != "0" ]; then
          942  +            echo ""
          943  +            echo "This script is flawed."
          944  +            echo "GUID=='a812ee31-2b39-4268-9242-83f2c08160e7'"
          945  +            echo ""
          946  +            #----
          947  +            cd $S_FP_ORIG
          948  +            exit 1 # exit with error
          949  +        fi
          950  +        #--------
          951  +    fi
          952  +    #--------------------
          953  +    S_FUNC_MMMV_WHIRLPOOLHASH_T1_RESULT=""
          954  +    #--------------------
          955  +    if [ "$S_FUNC_MMMV_WHIRLPOOLHASH_T1_MODE" == "whirlpooldeep" ]; then
          956  +        S_TMP_0="`whirlpooldeep $S_FP_2_AN_EXISTING_FILE 2>/dev/null`"
          957  +        if [ "$?" != "0" ]; then
          958  +            echo ""
          959  +            echo "The console application \"whirlpooldeep\" "
          960  +            echo "exited with an error."
          961  +            echo ""
          962  +            echo "----console--outut--citation--start-----"
          963  +            echo "`whirlpooldeep $S_FP_2_AN_EXISTING_FILE`" # stdout and stderr
          964  +            echo "----console--outut--citation--end-------"
          965  +            echo ""
          966  +            echo "GUID=='5ac1162f-5b05-4db9-8442-83f2c08160e7'"
          967  +            echo ""
          968  +            #----
          969  +            cd $S_FP_ORIG
          970  +            exit 1 # exit with error
          971  +        fi
          972  +        S_FUNC_MMMV_WHIRLPOOLHASH_T1_RESULT="`echo \"$S_TMP_0\" | gawk '{printf $1}'`"
          973  +    fi
          974  +    #--------------------
          975  +    if [ "$S_FUNC_MMMV_WHIRLPOOLHASH_T1_MODE" == "rhash" ]; then
          976  +        S_TMP_0="`rhash --whirlpool $S_FP_2_AN_EXISTING_FILE 2>/dev/null`"
          977  +        if [ "$?" != "0" ]; then
          978  +            echo ""
          979  +            echo "The console application \"rhash\" "
          980  +            echo "exited with an error."
          981  +            echo ""
          982  +            echo "----console--outut--citation--start-----"
          983  +            echo "`rhash --whirlpool $S_FP_2_AN_EXISTING_FILE `"
          984  +            echo "----console--outut--citation--end-------"
          985  +            echo ""
          986  +            echo "GUID=='37202b22-1600-406b-9142-83f2c08160e7'"
          987  +            echo ""
          988  +            #----
          989  +            cd $S_FP_ORIG
          990  +            exit 1 # exit with error
          991  +        fi
          992  +        S_FUNC_MMMV_WHIRLPOOLHASH_T1_RESULT="`echo \"$S_TMP_0\" | gawk '{printf $1}'`"
          993  +    fi
          994  +    #--------------------
          995  +    S_TMP_0="`printf \"$S_FUNC_MMMV_WHIRLPOOLHASH_T1_RESULT\" | wc -m | gawk '{gsub(/\s/,"");printf "%s", $1 }'`"
          996  +    S_TMP_1="128"
          997  +    if [ "$S_TMP_0" != "$S_TMP_1" ]; then
          998  +        echo ""
          999  +        echo "According to the specification of the Whirlpool hash algorithm"
         1000  +        echo "the lenght of the Tiger hash is "
         1001  +        echo "$S_TMP_1 hexadecimal characters, but the result of the "
         1002  +        echo ""
         1003  +        echo "    func_mmmv_whirlpoolhash_t1"
         1004  +        echo ""
         1005  +        echo "is something else. The flawed hash candidate in parenthesis:"
         1006  +        echo "($S_FUNC_MMMV_WHIRLPOOLHASH_T1_RESULT)"
         1007  +        echo ""
         1008  +        echo "The lenght candidate of the flawed hash candidate in parenthesis:"
         1009  +        echo "($S_TMP_0)."
         1010  +        echo ""
         1011  +        echo "GUID=='6f22524d-5309-48d6-9142-83f2c08160e7'"
         1012  +        echo ""
         1013  +        #----
         1014  +        cd $S_FP_ORIG
         1015  +        exit 1 # exit with error
         1016  +    fi
         1017  +    #--------------------
         1018  +} # func_mmmv_whirlpoolhash_t1
         1019  +
         1020  +
         1021  +#--------------------------------------------------------------------------
         1022  +
         1023  +S_FUNC_MMMV_FILESIZE_T1_RESULT="not_yet_set"
         1024  +S_FUNC_MMMV_FILESIZE_T1_MODE="" # optim. to skip repeating console tool selection
         1025  +func_mmmv_filesize_t1() { 
         1026  +    local S_FP_2_AN_EXISTING_FILE="$1" # first function argument
         1027  +    #--------
         1028  +    func_mmmv_exc_hash_function_input_verification_t1 "func_mmmv_filesize_t1" "$1"
         1029  +    #--------------------
         1030  +    # Mode selection:
         1031  +    if [ "$S_FUNC_MMMV_FILESIZE_T1_MODE" == "" ] ; then
         1032  +        SB_EXISTS_ON_PATH_T1_RESULT="f"  # if-block init
         1033  +        #----
         1034  +        if [ "$SB_EXISTS_ON_PATH_T1_RESULT" == "f" ] ; then
         1035  +            S_TMP_0="filesize" # usually available on Linux
         1036  +            func_sb_exists_on_path_t1 "$S_TMP_0" 
         1037  +            if [ "$SB_EXISTS_ON_PATH_T1_RESULT" == "t" ] ; then
         1038  +                 S_FUNC_MMMV_FILESIZE_T1_MODE="$S_TMP_0"
         1039  +            fi
         1040  +        fi
         1041  +        #----
         1042  +        if [ "$SB_EXISTS_ON_PATH_T1_RESULT" == "f" ] ; then
         1043  +            S_TMP_0="ruby"    # helps on BSD
         1044  +            func_sb_exists_on_path_t1 "$S_TMP_0" 
         1045  +            if [ "$SB_EXISTS_ON_PATH_T1_RESULT" == "t" ] ; then
         1046  +                 S_FUNC_MMMV_FILESIZE_T1_MODE="$S_TMP_0"
         1047  +            fi
         1048  +        fi
         1049  +        #--------
         1050  +        if [ "$S_FUNC_MMMV_FILESIZE_T1_MODE" == "" ] ; then
         1051  +            echo ""
         1052  +            echo "All of the applications that this function is " 
         1053  +            echo "capable of using for finding out file size (filesize, ruby)"
         1054  +            echo "are missing from the PATH."
         1055  +            echo "GUID=='c16c313b-1051-410e-a242-83f2c08160e7'"
         1056  +            echo ""
         1057  +            #----
         1058  +            cd $S_FP_ORIG
         1059  +            exit 1 # exit with error
         1060  +        fi
         1061  +        #--------
         1062  +        if [ "$?" != "0" ]; then
         1063  +            echo ""
         1064  +            echo "This script is flawed."
         1065  +            echo "GUID=='3b8d513c-90dd-406b-a442-83f2c08160e7'"
         1066  +            echo ""
         1067  +            #----
         1068  +            cd $S_FP_ORIG
         1069  +            exit 1 # exit with error
         1070  +        fi
         1071  +        #--------
         1072  +    fi
         1073  +    #--------------------
         1074  +    S_FUNC_MMMV_FILESIZE_T1_RESULT=""
         1075  +    #--------------------
         1076  +    if [ "$S_FUNC_MMMV_FILESIZE_T1_MODE" == "filesize" ]; then
         1077  +        S_TMP_0="`filesize $S_FP_2_AN_EXISTING_FILE 2>/dev/null`"
         1078  +        if [ "$?" != "0" ]; then
         1079  +            echo ""
         1080  +            echo "The console application \"filesize\" "
         1081  +            echo "exited with an error."
         1082  +            echo ""
         1083  +            echo "----console--outut--citation--start-----"
         1084  +            echo "`filesize $S_FP_2_AN_EXISTING_FILE`" # stdout and stderr
         1085  +            echo "----console--outut--citation--end-------"
         1086  +            echo ""
         1087  +            echo "GUID=='28f88541-0f95-4a94-8442-83f2c08160e7'"
         1088  +            echo ""
         1089  +            #----
         1090  +            cd $S_FP_ORIG
         1091  +            exit 1 # exit with error
         1092  +        fi
         1093  +        S_FUNC_MMMV_FILESIZE_T1_RESULT="`echo \"$S_TMP_0\" | gawk '{printf $1}'`"
         1094  +    fi
         1095  +    #--------------------
         1096  +    if [ "$S_FUNC_MMMV_FILESIZE_T1_MODE" == "ruby" ]; then
         1097  +        S_TMP_0="`ruby -e \"printf(File.size('$S_FP_2_AN_EXISTING_FILE').to_s)\" 2>/dev/null`"
         1098  +        if [ "$?" != "0" ]; then
         1099  +            echo ""
         1100  +            echo "The console application \"ruby\" "
         1101  +            echo "exited with an error."
         1102  +            echo ""
         1103  +            echo "----console--outut--citation--start-----"
         1104  +            echo "`ruby -e \"printf(File.size('$S_FP_2_AN_EXISTING_FILE').to_s)\"`"
         1105  +            echo "----console--outut--citation--end-------"
         1106  +            echo ""
         1107  +            echo "GUID=='53b91474-cdfe-43f8-b242-83f2c08160e7'"
         1108  +            echo ""
         1109  +            #----
         1110  +            cd $S_FP_ORIG
         1111  +            exit 1 # exit with error
         1112  +        fi
         1113  +        S_FUNC_MMMV_FILESIZE_T1_RESULT="$S_TMP_0"
         1114  +    fi
         1115  +    #--------------------
         1116  +    S_TMP_0="`printf \"$S_FUNC_MMMV_FILESIZE_T1_RESULT\" | gawk '{gsub(/\s/,"");printf "%s", $1 }'`"
         1117  +    local SB_THROW="f"
         1118  +    if [ "$S_TMP_0" != "$S_FUNC_MMMV_FILESIZE_T1_RESULT" ]; then
         1119  +        SB_THROW="t"
         1120  +    else
         1121  +        if [ "$S_FUNC_MMMV_FILESIZE_T1_RESULT" == "" ]; then
         1122  +            SB_THROW="t"
         1123  +        fi
         1124  +    fi
         1125  +    #----
         1126  +    if [ "$SB_THROW" == "t" ]; then
         1127  +        echo ""
         1128  +        echo "The result of the "
         1129  +        echo ""
         1130  +        echo "    func_mmmv_filesize_t1"
         1131  +        echo ""
         1132  +        echo "for "
         1133  +        echo ""
         1134  +        echo "($S_FUNC_MMMV_FILESIZE_T1_RESULT)"
         1135  +        echo ""
         1136  +        echo "either contain spaces, tabs or is an empty string," 
         1137  +        echo "which is wrong, because even a file with the size of 0 "
         1138  +        echo "should have a file size of \"0\", which is not an empty string."
         1139  +        echo "GUID=='4e5a622c-7b21-4de0-a432-83f2c08160e7'"
         1140  +        echo ""
         1141  +        #----
         1142  +        cd $S_FP_ORIG
         1143  +        exit 1 # exit with error
         1144  +    fi
         1145  +    #--------------------
         1146  +} # func_mmmv_filesize_t1
         1147  +
         1148  +
         1149  +#--------------------------------------------------------------------------
         1150  +
         1151  +func_mmmv_silktorrent_packager_t1_bash_print_help_msg_t1() { 
         1152  +    echo ""
         1153  +    echo "Command line format: "
         1154  +    echo ""
         1155  +    echo "<the name of this script>  ARGLIST "
         1156  +    echo ""
         1157  +    echo "        ARGLIST :== help | WRAP | UNWRAP | VERIFY | RUN_SELFTEST "
         1158  +    echo "           WRAP :== wrap <file path> "
         1159  +    echo "         UNWRAP :== unwrap <file path> "
         1160  +    echo "         VERIFY :== verify <file path> "
         1161  +    echo "   RUN_SELFTEST :== test_hash_t1 <file path> "
         1162  +    echo ""
         1163  +    echo ""
         1164  +    echo ""
         1165  +} # func_mmmv_silktorrent_packager_t1_bash_print_help_msg_t1
         1166  +
         1167  +#--------------------------------------------------------------------------
         1168  +
         1169  +func_mmmv_silktorrent_packager_t1_bash_exc_assert_wrappable_file_exists_t1() { 
         1170  +    local S_FP_0="$1" # Path to the file. 
         1171  +    #--------
         1172  +    if [ "$S_FP_0" == "" ]; then
         1173  +        echo ""
         1174  +        echo "The 2. console argument is expected to be "
         1175  +        echo "a path to a file, but currently "
         1176  +        echo "the 2. console argument is missing."
         1177  +        echo "GUID=='fe2aff9e-9555-40a3-b332-83f2c08160e7'"
         1178  +        echo ""
         1179  +        #----
         1180  +        cd $S_FP_ORIG
         1181  +        exit 1 # exit with error
         1182  +    fi
         1183  +    #--------
         1184  +    if [ ! -e "$S_FP_0" ]; then
         1185  +        if [ -h "$S_FP_0" ]; then
         1186  +            echo ""
         1187  +            echo "The file path "
         1188  +            echo ""
         1189  +            echo "    $S_FP_0"
         1190  +            echo ""
         1191  +            echo "is a path of a broken symlink, but symlinks "
         1192  +            echo "are not supported at all."
         1193  +            echo "The reason, why symlinks to files are not supported is that "
         1194  +            echo "the file size of symlinks can differ from "
         1195  +            echo "the file size of the target of the symlink."
         1196  +            echo "GUID=='60e5391a-37c5-48e4-b332-83f2c08160e7'"
         1197  +            echo ""
         1198  +        else
         1199  +            echo ""
         1200  +            echo "The file with the path of "
         1201  +            echo ""
         1202  +            echo "    $S_FP_0"
         1203  +            echo ""
         1204  +            echo "does not exist."
         1205  +            echo "GUID=='45c4b001-7a5c-4a0a-b732-83f2c08160e7'"
         1206  +            echo ""
         1207  +        fi
         1208  +        #----
         1209  +        cd $S_FP_ORIG
         1210  +        exit 1 # exit with error
         1211  +    fi
         1212  +    #--------
         1213  +    if [ -d "$S_FP_0" ]; then
         1214  +        if [ -h "$S_FP_0" ]; then
         1215  +            echo ""
         1216  +            echo "The path "
         1217  +            echo ""
         1218  +            echo "    $S_FP_0"
         1219  +            echo ""
         1220  +            echo "references a symlink that references folder, but "
         1221  +            echo "a file is expected."
         1222  +            echo "GUID=='4b3f22d7-441b-4de8-b432-83f2c08160e7'"
         1223  +            echo ""
         1224  +        else
         1225  +            echo ""
         1226  +            echo "The path "
         1227  +            echo ""
         1228  +            echo "    $S_FP_0"
         1229  +            echo ""
         1230  +            echo "references a folder, but it is expected to "
         1231  +            echo "to reference a file."
         1232  +            echo "GUID=='f3d00ec1-40be-4f84-a432-83f2c08160e7'"
         1233  +            echo ""
         1234  +        fi
         1235  +        #----
         1236  +        cd $S_FP_ORIG
         1237  +        exit 1 # exit with error
         1238  +    fi
         1239  +    #--------
         1240  +    if [ -h "$S_FP_0" ]; then
         1241  +        echo ""
         1242  +        echo "The path "
         1243  +        echo ""
         1244  +        echo "    $S_FP_0"
         1245  +        echo ""
         1246  +        echo "references a symlink, a file is expected."
         1247  +        echo "The reason, why symlinks to files are not supported is that "
         1248  +        echo "the file size of symlinks can differ from "
         1249  +        echo "the file size of the target of the symlink."
         1250  +        echo "GUID=='20430c48-653d-4a05-b432-83f2c08160e7'"
         1251  +        echo ""
         1252  +        #----
         1253  +        cd $S_FP_ORIG
         1254  +        exit 1 # exit with error
         1255  +    fi
         1256  +} # func_mmmv_silktorrent_packager_t1_bash_exc_assert_wrappable_file_exists_t1
         1257  +
         1258  +
         1259  +#--------------------------------------------------------------------------
         1260  +
         1261  +S_FUNC_MMMV_SILKTORRENT_PACKAGER_T1_BASH_REVERSE_STRING_REGISTER="for input and output"
         1262  +S_FUNC_MMMV_SILKTORRENT_PACKAGER_T1_BASH_REVERSE_STRING_MODE="" # optim.  hack
         1263  +func_mmmv_silktorrent_packager_t1_bash_reverse_string() { 
         1264  +    local S_IN="$S_FUNC_MMMV_SILKTORRENT_PACKAGER_T1_BASH_REVERSE_STRING_REGISTER"
         1265  +    #--------------------
         1266  +    local S_TMP_0="not set"
         1267  +    # Mode selection:
         1268  +    if [ "$S_FUNC_MMMV_SILKTORRENT_PACKAGER_T1_BASH_REVERSE_STRING_MODE" == "" ] ; then
         1269  +        SB_EXISTS_ON_PATH_T1_RESULT="f"  # if-block init
         1270  +        #----
         1271  +        if [ "$SB_EXISTS_ON_PATH_T1_RESULT" == "f" ] ; then
         1272  +            S_TMP_0="gawk" # usually available on Linux
         1273  +            func_sb_exists_on_path_t1 "$S_TMP_0" 
         1274  +            if [ "$SB_EXISTS_ON_PATH_T1_RESULT" == "t" ] ; then
         1275  +                 S_FUNC_MMMV_SILKTORRENT_PACKAGER_T1_BASH_REVERSE_STRING_MODE="$S_TMP_0"
         1276  +            fi
         1277  +        fi
         1278  +        #----
         1279  +        if [ "$SB_EXISTS_ON_PATH_T1_RESULT" == "f" ] ; then
         1280  +            S_TMP_0="ruby"    # helps on BSD
         1281  +            func_sb_exists_on_path_t1 "$S_TMP_0" 
         1282  +            if [ "$SB_EXISTS_ON_PATH_T1_RESULT" == "t" ] ; then
         1283  +                 S_FUNC_MMMV_SILKTORRENT_PACKAGER_T1_BASH_REVERSE_STRING_MODE="$S_TMP_0"
         1284  +            fi
         1285  +        fi
         1286  +        #--------
         1287  +        if [ "$S_FUNC_MMMV_SILKTORRENT_PACKAGER_T1_BASH_REVERSE_STRING_MODE" == "" ] ; then
         1288  +            echo ""
         1289  +            echo "All of the applications that this function is " 
         1290  +            echo "capable of using for finding out file size (gawk, ruby)"
         1291  +            echo "are missing from the PATH."
         1292  +            echo "GUID=='35084451-8a4f-465e-a222-83f2c08160e7'"
         1293  +            echo ""
         1294  +            #----
         1295  +            cd $S_FP_ORIG
         1296  +            exit 1 # exit with error
         1297  +        fi
         1298  +        #--------
         1299  +        if [ "$?" != "0" ]; then
         1300  +            echo ""
         1301  +            echo "This script is flawed."
         1302  +            echo "GUID=='d1cca38b-d5ee-4fc9-a822-83f2c08160e7'"
         1303  +            echo ""
         1304  +            #----
         1305  +            cd $S_FP_ORIG
         1306  +            exit 1 # exit with error
         1307  +        fi
         1308  +        #--------
         1309  +    fi
         1310  +    #--------------------
         1311  +    #--------------------
         1312  +    S_FUNC_MMMV_SILKTORRENT_PACKAGER_T1_BASH_REVERSE_STRING_REGISTER=""
         1313  +    #--------
         1314  +    if [ "$S_FUNC_MMMV_SILKTORRENT_PACKAGER_T1_BASH_REVERSE_STRING_MODE" == "gawk" ]; then
         1315  +        # The awk code example originates from 
         1316  +        # http://www.linuxandlife.com/2013/06/how-to-reverse-string.html
         1317  +        # archival copy: https://archive.is/Cx0xF
         1318  +        #----
         1319  +        S_TMP_0="`printf "$S_IN" | \
         1320  +            awk '{ for(i=length;i!=0;i--)x=x substr($0,i,1);}END{printf  x}'`"
         1321  +        if [ "$?" != "0" ]; then
         1322  +            echo ""
         1323  +            echo "The console application \"gawk\" "
         1324  +            echo "exited with an error."
         1325  +            echo ""
         1326  +            echo "----console--outut--citation--start-----"
         1327  +            echo "`printf "$S_IN" | awk '{ for(i=length;i!=0;i--)x=x substr($0,i,1);}END{printf  x}'`"
         1328  +            echo "----console--outut--citation--end-------"
         1329  +            echo ""
         1330  +            echo "GUID=='2e32181a-f13c-49bf-8222-83f2c08160e7'"
         1331  +            echo ""
         1332  +            #----
         1333  +            cd $S_FP_ORIG
         1334  +            exit 1 # exit with error
         1335  +        fi
         1336  +        S_FUNC_MMMV_SILKTORRENT_PACKAGER_T1_BASH_REVERSE_STRING_REGISTER="$S_TMP_0"
         1337  +    fi
         1338  +    #--------
         1339  +    if [ "$S_FUNC_MMMV_SILKTORRENT_PACKAGER_T1_BASH_REVERSE_STRING_MODE" == "ruby" ]; then
         1340  +        #----
         1341  +        S_TMP_0="`ruby -e \"puts(ARGV[0].to_s.reverse)\" "$S_IN" 2>/dev/null`"
         1342  +        if [ "$?" != "0" ]; then
         1343  +            echo ""
         1344  +            echo "The console application \"ruby\" "
         1345  +            echo "exited with an error."
         1346  +            echo ""
         1347  +            echo "----console--outut--citation--start-----"
         1348  +            echo "`ruby -e \"puts('$S_IN'.reverse)\"`" # with the stderr
         1349  +            echo "----console--outut--citation--end-------"
         1350  +            echo ""
         1351  +            echo "GUID=='4707c539-4300-4cb5-8322-83f2c08160e7'"
         1352  +            echo ""
         1353  +            #----
         1354  +            cd $S_FP_ORIG
         1355  +            exit 1 # exit with error
         1356  +        fi
         1357  +        S_FUNC_MMMV_SILKTORRENT_PACKAGER_T1_BASH_REVERSE_STRING_REGISTER="$S_TMP_0"
         1358  +    fi
         1359  +    #--------------------
         1360  +} # func_mmmv_silktorrent_packager_t1_bash_reverse_string
         1361  +
         1362  +
         1363  +#--------------------------------------------------------------------------
         1364  +
         1365  +# As of 2016 the maximum file name length on Linux is 255 characters.
         1366  +# At
         1367  +#
         1368  +#    http://unix.stackexchange.com/questions/32795/what-is-the-maximum-allowed-filename-and-folder-size-with-ecryptfs
         1369  +#
         1370  +# the eCryptfs related recommendation is to keep the lengths
         1371  +# of file names to less than 140 characters. 
         1372  +#
         1373  +# A citation from 
         1374  +# http://windows.microsoft.com/en-us/windows/file-names-extensions-faq#1TC=windows-7
         1375  +# archieval copy: https://archive.is/UKBmd
         1376  +#     "Windows limits a single path to 260 characters."
         1377  +#
         1378  +# A citation from CygWin mailing list:
         1379  +# https://cygwin.com/ml/cygwin/2004-10/msg01323.html
         1380  +# archival copy: https://archive.is/GRvFK
         1381  +#     "The Unicode versions of several functions permit a 
         1382  +#     maximum path length of 32,767 characters, 
         1383  +#     composed of components up to 255 characters in length. 
         1384  +#     To specify such a path, use the "\\?\" prefix. For example, 
         1385  +#     "\\?\D:\<path>". To specify such a UNC path, use the "\\?\UNC\" 
         1386  +#     prefix. For example, "\\?\UNC\<server>\<share>". 
         1387  +#     Note that these prefixes are not used as part of the path 
         1388  +#     itself. They indicate that the path should be passed to the 
         1389  +#     system with minimal modification. An implication of this is 
         1390  +#     that you cannot use forward slashes to represent path separators 
         1391  +#     or a period to represent the current directory."
         1392  +# Related pages:
         1393  +# https://msdn.microsoft.com/en-us/library/aa365247(VS.85).aspx
         1394  +# archival copy: https://archive.is/p891y
         1395  +#
         1396  +# To allow database indexes that store the 
         1397  +# file names of the blogs 
         1398  +# to work as efficiently as possible, the first
         1399  +# characters of the file name should be as 
         1400  +# uniformly random set of characters as possible.
         1401  +# If file name starts with a secure hash, then 
         1402  +# that requirement is met. 
         1403  +#
         1404  +# The parser that dismantles the file name to relevant components 
         1405  +# should be implementable in different programming languages
         1406  +# without investing considerable amount of development time.
         1407  +# The syntax of the file name should also allow the
         1408  +# file name to be parsed computationally cheaply.
         1409  +#
         1410  +# As of 2016_05 the file extension  .stblob seems to be unused.
         1411  +# Therefore the "silktorrent blob", .stblob, can be used for the 
         1412  +# extension of the blob files.
         1413  +#
         1414  +# Compression of the blobs IS NOT ALLOWED, because the 
         1415  +# blobs must be extractable without becoming a victim 
         1416  +# of an attack, where 100GiB of zeros is packed to a
         1417  +# small file. The container format is the tar format,
         1418  +# without any compression.
         1419  +S_FUNC_MMMV_SILKTORRENT_PACKAGER_T1_BASH_BLOB2FILENAME_T1_RESULT="not set"
         1420  +func_mmmv_silktorrent_packager_t1_bash_blob2filename_t1() { 
         1421  +    local S_FP_0="$1" # Path to the file. 
         1422  +    #----
         1423  +    func_mmmv_silktorrent_packager_t1_bash_exc_assert_wrappable_file_exists_t1 "$S_FP_0"
         1424  +    #--------
         1425  +    # The Tiger     hash has  48 characters.
         1426  +    # The Whirlpool hash has 128 characters.
         1427  +    # The SHA-256   hash has  64 characters.
         1428  +    #
         1429  +    # A file size of 1TiB is ~10^12 ~ 13 characters
         1430  +    # A file size of 1PiB is ~10^15 ~ 14 characters
         1431  +    # A file size of 1EiB is ~10^18 ~ 19 characters
         1432  +    # A file size of 1ZiB is ~10^21 ~ 22 characters
         1433  +    # A file size of 1YiB is ~10^24 ~ 25 characters
         1434  +    # 
         1435  +    # The max. file name length on Linux and 
         1436  +    # Windows (Unicode API) is 255 characters.
         1437  +    #----
         1438  +    # The character budget:
         1439  +    #        6 characters --- file name format type ID 
         1440  +    #                         rgx_in_ruby=/v[\d]{4}[_]/
         1441  +    # echo "v0034_s2342_" | gawk '{ gsub(/_/, "_\n"); print }' | \
         1442  +    #                       gawk '/^v[0-9]{4}_/ {printf "%s",$1 }' | \
         1443  +    #                       gawk '{gsub(/[v_]/,"");printf "%s", $1 }'
         1444  +    #
         1445  +    #   max 32 characters --- file size    
         1446  +    #                         rgx_in_ruby=/s[\d]+[_]/
         1447  +    #                         echo "v0034_" | gawk '/^v[0-9]{4}_/ {printf "%s",$1 }'
         1448  +    # echo "v0034_s2342_" | gawk '{ gsub(/_/, "_\n"); print }' | \
         1449  +    #                       gawk '/^s[0-9]+_/ {printf "%s",$1 }' | \
         1450  +    #                       gawk '{gsub(/[s_]/,"");printf "%s", $1 }'
         1451  +    #
         1452  +    #
         1453  +    #       66 characters --- SHA-256  
         1454  +    #                         rgx_in_ruby=/h[\dabcdef]{64}[_]/
         1455  +    # echo "h`sha256sum /dev/null | gawk '/[0-9abcdef]/ {printf "%s",$1}'`_" | \
         1456  +    #                               gawk '/^h[0-9abcdef]+_/ {printf "%s",$1 }' | \
         1457  +    #                               gawk '{gsub(/[h_]/,"");printf "%s", $1 }'
         1458  +    #
         1459  +    #
         1460  +    #       50 characters --- Tiger
         1461  +    #                         rgx_in_ruby=/i[\dabcdef]{48}$/   # lacks the ending "_" 
         1462  +    #                                                          # for db index optimization
         1463  +    #                         The gawk code is as with the sha256, 
         1464  +    #                         except that sha256sum-> tigerdeep, "^h"->"^i",
         1465  +    #                         "[h_]"->"[i_]"
         1466  +    #
         1467  +    #--------
         1468  +    # As the current version of this script depends on Ruby anyway,
         1469  +    # the gawk regex based branches that are really
         1470  +    # complex and require multiple gawk calls can be left unimplemented.
         1471  +    # That way this script becomes more succinct.
         1472  +    #--------------------
         1473  +    func_mmmv_tigerhash_t1 "$S_FP_0"
         1474  +    #echo "       Tiger: $S_FUNC_MMMV_TIGERHASH_T1_RESULT"
         1475  +    #func_mmmv_whirlpoolhash_t1 "$S_FP_0"
         1476  +    #echo "   Whirlpool: $S_FUNC_MMMV_WHIRLPOOLHASH_T1_RESULT"
         1477  +    func_mmmv_sha256_t1 "$S_FP_0"
         1478  +    #echo "      SHA256: $S_FUNC_MMMV_SHA256_T1_RESULT"
         1479  +    func_mmmv_filesize_t1 "$S_FP_0"
         1480  +    #echo "   file size: $S_FUNC_MMMV_FILESIZE_T1_RESULT"
         1481  +    #--------
         1482  +    local S_NAME_REVERSED="bolbts." # ".stblob".reverse
         1483  +    local S_0="v0001_s$S_FUNC_MMMV_FILESIZE_T1_RESULT"
         1484  +    S_NAME_REVERSED="$S_NAME_REVERSED$S_0"
         1485  +    S_0="_h$S_FUNC_MMMV_SHA256_T1_RESULT"
         1486  +    S_NAME_REVERSED="$S_NAME_REVERSED$S_0"
         1487  +    S_0="_i$S_FUNC_MMMV_TIGERHASH_T1_RESULT"
         1488  +    S_NAME_REVERSED="$S_NAME_REVERSED$S_0"
         1489  +    #----
         1490  +    S_FUNC_MMMV_SILKTORRENT_PACKAGER_T1_BASH_REVERSE_STRING_REGISTER="$S_NAME_REVERSED"
         1491  +    func_mmmv_silktorrent_packager_t1_bash_reverse_string
         1492  +    S_0="$S_FUNC_MMMV_SILKTORRENT_PACKAGER_T1_BASH_REVERSE_STRING_REGISTER"
         1493  +    S_FUNC_MMMV_SILKTORRENT_PACKAGER_T1_BASH_BLOB2FILENAME_T1_RESULT="$S_0"
         1494  +} # func_mmmv_silktorrent_packager_t1_bash_blob2filename_t1
         1495  +
         1496  +
         1497  +#--------------------------------------------------------------------------
         1498  +
         1499  +func_mmmv_delete_tmp_folder_t1(){
         1500  +    local S_FP_0="$1" # folder path
         1501  +    #--------
         1502  +    if [ ! -e "$S_FP_0" ]; then
         1503  +        echo ""
         1504  +        echo "This script is flawed. The folder "
         1505  +        echo "    $S_FP_0"
         1506  +        echo "is expected to exist during the "
         1507  +        echo "call to this function."
         1508  +        echo "GUID=='28744c23-746a-45de-8322-83f2c08160e7'"
         1509  +        echo ""
         1510  +        #----
         1511  +        cd $S_FP_ORIG
         1512  +        exit 1 # exit with error
         1513  +    fi
         1514  +    #--------
         1515  +    # To avoid a situation, where due to some 
         1516  +    # flaw the home folder or something else important 
         1517  +    # gets accidentally recursively deleted, 
         1518  +    # the following test transforms the path from 
         1519  +    # /tmp/../home/blabla
         1520  +    # to a full path without the dots and then studies, whether
         1521  +    # the full path points to somehwere in the /tmp
         1522  +    local S_FP_1="`cd $S_FP_0; pwd`"
         1523  +    if [ ! -e "$S_FP_1" ]; then
         1524  +        echo ""
         1525  +        echo "This script is flawed. The folder "
         1526  +        echo "    $S_FP_1"
         1527  +        echo "is missing."
         1528  +        echo "GUID=='d16bd124-bc70-4114-8322-83f2c08160e7'"
         1529  +        echo ""
         1530  +        #----
         1531  +        cd $S_FP_ORIG
         1532  +        exit 1 # exit with error
         1533  +    fi
         1534  +    local S_TMP_0="`echo \"$S_FP_1\" | grep -E ^/home `"
         1535  +    if [ "$S_TMP_0" != "" ]; then
         1536  +        echo ""
         1537  +        echo "This script is flawed."
         1538  +        echo "The temporary sandbox folder must reside in /tmp."
         1539  +        echo ""
         1540  +        echo "S_FP_0==$S_FP_0"
         1541  +        echo ""
         1542  +        echo "S_FP_1==$S_FP_1"
         1543  +        echo ""
         1544  +        echo "S_TMP_0==$S_TMP_0"
         1545  +        echo ""
         1546  +        echo "GUID=='5eca69e7-8b8d-47d8-8122-83f2c08160e7'"
         1547  +        echo ""
         1548  +        #----
         1549  +        cd $S_FP_ORIG
         1550  +        exit 1 # exit with error
         1551  +    fi
         1552  +    # Just to be sure, the same thing is checked by a slightly 
         1553  +    # different regex and using the "==" in stead of the "!=".
         1554  +    S_TMP_0="`echo \"$S_FP_1\" | grep -E ^/tmp/`" 
         1555  +    if [ "$S_TMP_0" == "" ]; then
         1556  +        echo ""
         1557  +        echo "This script is flawed."
         1558  +        echo "The temporary sandbox folder must reside in /tmp."
         1559  +        echo ""
         1560  +        echo "S_FP_0==$S_FP_0"
         1561  +        echo ""
         1562  +        echo "S_FP_1==$S_FP_1"
         1563  +        echo ""
         1564  +        echo "S_TMP_0==$S_TMP_0"
         1565  +        echo ""
         1566  +        echo "GUID=='2dafcbf1-68f7-4e41-8512-83f2c08160e7'"
         1567  +        echo ""
         1568  +        #----
         1569  +        cd $S_FP_ORIG
         1570  +        exit 1 # exit with error
         1571  +    fi
         1572  +    #--------
         1573  +    rm -fr $S_FP_1
         1574  +    if [ -e "$S_FP_1" ]; then
         1575  +        echo ""
         1576  +        echo "Something went wrong. The recursive deletion of the temporary folder, "
         1577  +        echo "    $S_FP_1"
         1578  +        echo "failed."
         1579  +        echo "GUID=='1de602b5-174e-4dee-b812-83f2c08160e7'"
         1580  +        echo ""
         1581  +        #----
         1582  +        cd $S_FP_ORIG
         1583  +        exit 1 # exit with error
         1584  +    fi
         1585  +} # func_mmmv_delete_tmp_folder_t1
         1586  +
         1587  +
         1588  +#--------------------------------------------------------------------------
         1589  +
         1590  +# Throws, if there exists a file with the same path.
         1591  +func_mmmv_create_folder_if_it_does_not_already_exist_t1(){
         1592  +    local S_FP_0="$1" # folder path
         1593  +    #--------
         1594  +    if [ "$S_FP_0" == "" ]; then
         1595  +        # Using gawk and alike to cover also cases, where
         1596  +        # $S_FP_0=="  "
         1597  +        # is intentionally left out to avoid the overhead, but
         1598  +        # due to some luck the mkdir exits with an error code greater than 0,
         1599  +        # if it misses a path argument. 
         1600  +        echo ""
         1601  +        echo "S_FP_0==\"\""
         1602  +        echo "GUID=='25389fb4-7fb5-4b04-b312-83f2c08160e7'"
         1603  +        echo ""
         1604  +        #----
         1605  +        cd $S_FP_ORIG
         1606  +        exit 1 # exit with error
         1607  +    fi
         1608  +    #--------------------
         1609  +    if [ -e "$S_FP_0" ]; then
         1610  +        if [ ! -d "$S_FP_0" ]; then
         1611  +            echo ""
         1612  +            echo "The path that is suppose to reference either "
         1613  +            echo "an existing folder or a non-existent folder, "
         1614  +            echo "references a file."
         1615  +            echo "GUID=='3d10cbe1-d097-42a5-9f12-83f2c08160e7'"
         1616  +            echo ""
         1617  +            #----
         1618  +            cd $S_FP_ORIG
         1619  +            exit 1 # exit with error
         1620  +        fi
         1621  +    fi
         1622  +    #--------
         1623  +    mkdir -p $S_FP_0
         1624  +    if [ "$?" != "0" ]; then 
         1625  +        echo ""
         1626  +        echo "mkdir for path "
         1627  +        echo "    $S_FP_0"
         1628  +        echo "failed."
         1629  +        echo "GUID=='15fbef3b-805a-45e2-9312-83f2c08160e7'"
         1630  +        echo ""
         1631  +        #----
         1632  +        cd $S_FP_ORIG
         1633  +        exit 1 # exit with error
         1634  +    fi
         1635  +    #----
         1636  +    if [ ! -e "$S_FP_0" ]; then
         1637  +        echo ""
         1638  +        echo "mkdir execution succeeded, but for some other reason the folder "
         1639  +        echo "    $S_FP_0"
         1640  +        echo "does not exist."
         1641  +        echo "GUID=='e281e242-6195-4fd5-b312-83f2c08160e7'"
         1642  +        echo ""
         1643  +        #----
         1644  +        cd $S_FP_ORIG
         1645  +        exit 1 # exit with error
         1646  +    fi
         1647  +} # func_mmmv_create_folder_if_it_does_not_already_exist_t1
         1648  +
         1649  +
         1650  +#--------------------------------------------------------------------------
         1651  +
         1652  +S_FUNC_FUNC_MMMV_CREATE_TMP_FOLDER_T1_RESULT="" # == "" on failure
         1653  +                                                # otherwise full file path
         1654  +func_mmmv_create_tmp_folder_t1(){
         1655  +    # Does not take any arguments.
         1656  +    #--------
         1657  +    #func_mmmv_exc_hash_function_input_verification_t1 "func_mmmv_GUID_t1" "$1"
         1658  +    #--------------------
         1659  +    S_FUNC_FUNC_MMMV_CREATE_TMP_FOLDER_T1_RESULT="" # value for failure
         1660  +    func_mmmv_GUID_t1
         1661  +    if [ "$S_FUNC_MMMV_GUID_T1_RESULT" == "" ]; then
         1662  +        echo ""
         1663  +        echo "This script is flawed. GUID generation failed and "
         1664  +        echo "the GUID generation function did not throw despite "
         1665  +        echo "the fact that it should have detected its own failure."
         1666  +        echo "GUID=='3cc92c1c-4df7-4091-8112-83f2c08160e7'"
         1667  +        echo ""
         1668  +        #----
         1669  +        cd $S_FP_ORIG
         1670  +        exit 1 # exit with error
         1671  +    fi
         1672  +    #----
         1673  +    local S_TMP_0="/tmp/tmp_silktorrent_$S_FUNC_MMMV_GUID_T1_RESULT"
         1674  +    # The following few if-clauses form a short unrolled loop. The unrolling 
         1675  +    # is for simplicity, because it is Bash, where loops are nasty.
         1676  +    if [ -e "$S_TMP_0" ]; then
         1677  +        func_mmmv_GUID_t1
         1678  +        S_TMP_0="/tmp/tmp_silktorrent_$S_FUNC_MMMV_GUID_T1_RESULT"
         1679  +    fi
         1680  +    if [ -e "$S_TMP_0" ]; then
         1681  +        func_mmmv_GUID_t1
         1682  +        S_TMP_0="/tmp/tmp_silktorrent_$S_FUNC_MMMV_GUID_T1_RESULT"
         1683  +    fi
         1684  +    if [ -e "$S_TMP_0" ]; then
         1685  +        func_mmmv_GUID_t1
         1686  +        S_TMP_0="/tmp/tmp_silktorrent_$S_FUNC_MMMV_GUID_T1_RESULT"
         1687  +    fi
         1688  +    if [ -e "$S_TMP_0" ]; then
         1689  +        func_mmmv_GUID_t1
         1690  +        S_TMP_0="/tmp/tmp_silktorrent_$S_FUNC_MMMV_GUID_T1_RESULT"
         1691  +    fi
         1692  +    #----
         1693  +    if [ -e "$S_TMP_0" ]; then
         1694  +        echo ""
         1695  +        echo "This script failed to generate a locally unique path."
         1696  +        echo "GUID=='208aa0d2-e05b-4d70-b512-83f2c08160e7'"
         1697  +        echo ""
         1698  +        #----
         1699  +        cd $S_FP_ORIG
         1700  +        exit 1 # exit with error
         1701  +    fi
         1702  +    func_mmmv_create_folder_if_it_does_not_already_exist_t1 "$S_TMP_0"
         1703  +    if [ ! -e "$S_TMP_0" ]; then
         1704  +        echo ""
         1705  +        echo "mkdir for path "
         1706  +        echo "    $S_TMP_0"
         1707  +        echo "failed."
         1708  +        echo "GUID=='9fe0c330-c713-46b9-b502-83f2c08160e7'"
         1709  +        echo ""
         1710  +        #----
         1711  +        cd $S_FP_ORIG
         1712  +        exit 1 # exit with error
         1713  +    fi
         1714  +    S_FUNC_FUNC_MMMV_CREATE_TMP_FOLDER_T1_RESULT="$S_TMP_0"
         1715  +} # func_mmmv_create_tmp_folder_t1 
         1716  +
         1717  +
         1718  +#--------------------------------------------------------------------------
         1719  +
         1720  +S_FUNC_MMMV_SILKTORRENT_PACKAGER_T1_BASH_GET_PACKET_FORMAT_VERSION_T1_RESULT="not set"
         1721  +func_mmmv_silktorrent_packager_t1_bash_get_packet_format_version_t1() { 
         1722  +    local S_FP_0="$1" # Path to the file. 
         1723  +    #----
         1724  +    # It's not necessary for the file to actually exist,
         1725  +    # because this function only analyzes the file path string.
         1726  +    # func_mmmv_silktorrent_packager_t1_bash_exc_assert_wrappable_file_exists_t1 "$S_FP_0"
         1727  +    if [ "$S_FP_0" == "" ]; then
         1728  +        echo ""
         1729  +        echo "The file path candidate must not be an empty string."
         1730  +        echo "GUID=='2edcf528-cd73-42d3-9402-83f2c08160e7'"
         1731  +        echo ""
         1732  +        #----
         1733  +        cd $S_FP_ORIG
         1734  +        exit 1 # exit with error
         1735  +    fi 
         1736  +    #----
         1737  +    # The 
         1738  +    #
         1739  +    #     basename /tmp/foo/
         1740  +    #
         1741  +    # returns
         1742  +    #
         1743  +    #     foo
         1744  +    #
         1745  +    # That is to say, the "basename" ignores the rightmost slash.
         1746  +    #----
         1747  +    local S_TMP_0="`ruby -e \"\
         1748  +        s='noslash';\
         1749  +        if(('$S_FP_0'.reverse)[0..0]=='/') then \
         1750  +            s='slash_present';\
         1751  +        end;\
         1752  +        puts(s);\
         1753  +        \"`"
         1754  +    if [ "$S_TMP_0" != "noslash" ]; then
         1755  +        echo ""
         1756  +        echo "The path candidate must not end with a slash."
         1757  +        echo ""
         1758  +        echo "    S_FP_0==$S_FP_0"
         1759  +        echo ""
         1760  +        echo "    S_TMP_0==$S_TMP_0"
         1761  +        echo ""
         1762  +        echo "GUID=='22c77358-4f17-4c98-9102-83f2c08160e7'"
         1763  +        echo ""
         1764  +        #----
         1765  +        cd $S_FP_ORIG
         1766  +        exit 1 # exit with error
         1767  +    fi
         1768  +    basename $S_FP_0 1>/dev/null # to set a value to the $? in this scope 
         1769  +    if [ "$?" != "0" ]; then
         1770  +        echo ""
         1771  +        echo "The command "
         1772  +        echo ""
         1773  +        echo "    basename $S_FP_0 "
         1774  +        echo ""
         1775  +        echo "exited with an error."
         1776  +        echo "GUID=='fba39e45-4c8a-4b37-b402-83f2c08160e7'"
         1777  +        echo ""
         1778  +        #----
         1779  +        cd $S_FP_ORIG
         1780  +        exit 1 # exit with error
         1781  +    fi 
         1782  +    S_TMP_0="`basename $S_FP_0`"
         1783  +    if [ "$S_TMP_0" == "" ]; then
         1784  +        echo ""
         1785  +        echo "The file path candidate must be a string that "
         1786  +        echo "is not an empty string after "
         1787  +        echo "all of the spaces and tabs have been removed from it."
         1788  +        echo "GUID=='90849917-3e05-40ae-a302-83f2c08160e7'"
         1789  +        echo ""
         1790  +        #----
         1791  +        cd $S_FP_ORIG
         1792  +        exit 1 # exit with error
         1793  +    fi 
         1794  +    #--------
         1795  +    S_FUNC_MMMV_SILKTORRENT_PACKAGER_T1_BASH_GET_PACKET_FORMAT_VERSION_T1_RESULT=""
         1796  +    local S_OUT="unsupported_by_this_script_version"
         1797  +    #--------
         1798  +    # In Ruby
         1799  +    #     "foo.stblob"[0..(-8)]=="foo"
         1800  +    #     "foo.stblob"[(-99)..(-1)]==nil
         1801  +    # 
         1802  +    local S_TMP_1="`ruby -e \"\
         1803  +        x='$S_TMP_0'[0..(-8)];\
         1804  +        if(x!=nil) then\
         1805  +            md=x.reverse.match(/v[\\d]+/);\
         1806  +            if(md!=nil) then\
         1807  +                s_0=(md[0].to_s)[1..(-1)];\
         1808  +                print(s_0.sub(/^[0]+/,''));\
         1809  +            end;\
         1810  +        end;\
         1811  +        \"`"
         1812  +    # echo "$S_TMP_0"
         1813  +    # echo "$S_TMP_1"
         1814  +    #----
         1815  +    if [ "$S_TMP_1" != "" ]; then
         1816  +        S_OUT="silktorrent_packet_format_version_$S_TMP_1"
         1817  +    fi 
         1818  +    S_FUNC_MMMV_SILKTORRENT_PACKAGER_T1_BASH_GET_PACKET_FORMAT_VERSION_T1_RESULT="$S_OUT"
         1819  +} # func_mmmv_silktorrent_packager_t1_bash_get_packet_format_version_t1
         1820  +
         1821  +
         1822  +#--------------------------------------------------------------------------
         1823  +
         1824  +S_FUNC_MMMV_SILKTORRENT_PACKAGER_T1_BASH_VERIFY_FILE_NAME_T1_RESULT="not set"
         1825  +func_mmmv_silktorrent_packager_t1_bash_verify_file_name_t1() { 
         1826  +    local S_FP_0="$1" # Path to the file. 
         1827  +    #----
         1828  +    func_mmmv_silktorrent_packager_t1_bash_exc_assert_wrappable_file_exists_t1 "$S_FP_0"
         1829  +    #--------
         1830  +    func_mmmv_silktorrent_packager_t1_bash_get_packet_format_version_t1 "$S_FP_0"
         1831  +    local S_PACKET_FORMAT="$S_FUNC_MMMV_SILKTORRENT_PACKAGER_T1_BASH_GET_PACKET_FORMAT_VERSION_T1_RESULT"
         1832  +    if [ "$S_PACKET_FORMAT" == "unsupported_by_this_script_version" ]; then
         1833  +        echo ""
         1834  +        echo "There exists a possibility that the "
         1835  +        echo "Silktorrent packet candidate is actually OK, but "
         1836  +        echo "this is an older version of the Silktorrent implementaiton and "
         1837  +        echo "the older version does not support "
         1838  +        echo "newer Silktorrent packet formats. "
         1839  +        echo "The file path of the Silktorrent packet candidate:"
         1840  +        echo ""
         1841  +        echo "    $S_FP_0"
         1842  +        echo ""
         1843  +        echo "GUID=='3e96d920-02dc-43a2-a202-83f2c08160e7'"
         1844  +        echo ""
         1845  +        #----
         1846  +        cd $S_FP_ORIG
         1847  +        exit 1 # exit with error
         1848  +    fi
         1849  +    #--------
         1850  +    local S_TMP_1=""
         1851  +    if [ "$S_PACKET_FORMAT" == "silktorrent_packet_format_version_1" ]; then
         1852  +        func_mmmv_silktorrent_packager_t1_bash_blob2filename_t1 "$S_FP_0"
         1853  +        #echo "$S_FUNC_MMMV_SILKTORRENT_PACKAGER_T1_BASH_BLOB2FILENAME_T1_RESULT"
         1854  +        S_TMP_1="$S_FUNC_MMMV_SILKTORRENT_PACKAGER_T1_BASH_BLOB2FILENAME_T1_RESULT"
         1855  +    fi
         1856  +    #----
         1857  +    if [ "$S_TMP_1" == "" ]; then
         1858  +        echo ""
         1859  +        echo "This script is flawed."
         1860  +        echo "It should have thrown before the control flow reaches this line."
         1861  +        echo "GUID=='95af1748-4736-48dd-b102-83f2c08160e7'"
         1862  +        echo ""
         1863  +        #----
         1864  +        cd $S_FP_ORIG
         1865  +        exit 1 # exit with error
         1866  +    fi
         1867  +    #--------
         1868  +    local S_TMP_0="`basename $S_FP_0`" # The S_TMP_0 must be evaluated 
         1869  +                                       # after the various functions to 
         1870  +                                       # counter a situation, where 
         1871  +                                       # the S_TMP_0 is overwritten 
         1872  +                                       # by the name-calc function 
         1873  +                                       # or by one of the sub-functions
         1874  +                                       # of the name-calc function.
         1875  +                                       # The flaw occurs, when the 
         1876  +                                       # S_TMP_0 is used within the 
         1877  +                                       # name-calc function without  
         1878  +                                       # declaring it to be a local
         1879  +                                       # variable.
         1880  +    #--------
         1881  +    #echo "S_FP_0==$S_FP_0"
         1882  +    #echo "S_TMP_0==$S_TMP_0"
         1883  +    #echo "S_TMP_1==$S_TMP_1"
         1884  +    local S_OUT=""
         1885  +    if [ "$S_TMP_1" == "$S_TMP_0" ]; then
         1886  +        S_OUT="verification_passed"
         1887  +    else
         1888  +        S_OUT="verification_failed"
         1889  +    fi
         1890  +    S_FUNC_MMMV_SILKTORRENT_PACKAGER_T1_BASH_VERIFY_FILE_NAME_T1_RESULT="$S_OUT"
         1891  +} # func_mmmv_silktorrent_packager_t1_bash_verify_file_name_t1
         1892  +
         1893  +
         1894  +#--------------------------------------------------------------------------
         1895  +
         1896  +func_mmmv_silktorrent_packager_t1_bash_test_1() { 
         1897  +    local S_FP_0="$1" # Path to the file. 
         1898  +    #----
         1899  +    func_mmmv_silktorrent_packager_t1_bash_exc_assert_wrappable_file_exists_t1 "$S_FP_0"
         1900  +    #--------
         1901  +    echo ""
         1902  +    #----
         1903  +    func_mmmv_tigerhash_t1 "$S_FP_0"
         1904  +    echo "       Tiger: $S_FUNC_MMMV_TIGERHASH_T1_RESULT"
         1905  +    func_mmmv_whirlpoolhash_t1 "$S_FP_0"
         1906  +    echo "   Whirlpool: $S_FUNC_MMMV_WHIRLPOOLHASH_T1_RESULT"
         1907  +    func_mmmv_sha256_t1 "$S_FP_0"
         1908  +    echo "      SHA256: $S_FUNC_MMMV_SHA256_T1_RESULT"
         1909  +    func_mmmv_filesize_t1 "$S_FP_0"
         1910  +    echo "   file size: $S_FUNC_MMMV_FILESIZE_T1_RESULT"
         1911  +    #----
         1912  +    echo ""
         1913  +} # func_mmmv_silktorrent_packager_t1_bash_test_1
         1914  +
         1915  +
         1916  +#--------------------------------------------------------------------------
         1917  +
         1918  +func_mmmv_silktorrent_packager_t1_bash_wrap_t1() {
         1919  +    local S_FP_0="$1" # Path to the file. 
         1920  +    #----
         1921  +    func_mmmv_silktorrent_packager_t1_bash_exc_assert_wrappable_file_exists_t1 "$S_FP_0"
         1922  +    #--------
         1923  +    func_mmmv_create_tmp_folder_t1
         1924  +    if [ "$S_FUNC_FUNC_MMMV_CREATE_TMP_FOLDER_T1_RESULT" == "" ]; then
         1925  +        echo "This script is flawed, because the folder "
         1926  +        echo "creation function should have thrown "
         1927  +        echo "before the control flow reaches this branch." 
         1928  +        echo "GUID=='86a9f465-fc12-4f17-b2f1-83f2c08160e7'"
         1929  +        #----
         1930  +        cd $S_FP_ORIG
         1931  +        exit 1 # exit with error
         1932  +    fi
         1933  +    local S_FP_TMP_0="$S_FUNC_FUNC_MMMV_CREATE_TMP_FOLDER_T1_RESULT"
         1934  +    if [ ! -e "$S_FP_TMP_0" ]; then
         1935  +        echo "This script is flawed."
         1936  +        echo "May be some other thread deleted the folder or"
         1937  +        echo "the folder creation function returned a valid path, but"
         1938  +        echo "did not actually create the folder that it was supposed create."
         1939  +        echo "S_FP_TMP_0==$S_FP_TMP_0"
         1940  +        echo "GUID=='58b79d45-c739-4cf0-a2f1-83f2c08160e7'"
         1941  +        #----
         1942  +        cd $S_FP_ORIG
         1943  +        exit 1 # exit with error
         1944  +    fi
         1945  +    #--------
         1946  +    local S_FP_TMP_SILKTORRENT_PACKET="$S_FP_TMP_0/silktorrent_packet"
         1947  +    local S_FP_TMP_SILKTORRENT_PACKET_TAR="$S_FP_TMP_0/silktorrent_packet.tar"
         1948  +    local S_FP_TMP_PAYLOAD="$S_FP_TMP_SILKTORRENT_PACKET/payload"
         1949  +    local S_FP_TMP_HEADER="$S_FP_TMP_SILKTORRENT_PACKET/header"
         1950  +    local S_FP_TMP_HEADER_SALT_TXT="$S_FP_TMP_HEADER/silktorrent_salt.txt"
         1951  +    func_mmmv_create_folder_if_it_does_not_already_exist_t1 "$S_FP_TMP_PAYLOAD" # uses mkdir -p
         1952  +    func_mmmv_create_folder_if_it_does_not_already_exist_t1 "$S_FP_TMP_HEADER"
         1953  +    #--------
         1954  +    # Salting makes sure that it is not possible to 
         1955  +    # conclude the payload bitstream from the 
         1956  +    # Silktorrent packet (file) name, forcing censoring
         1957  +    # parties to download packages 
         1958  +    # that they are not looking for and allowing
         1959  +    # censorship dodgers to publish the same payload bitstream
         1960  +    # in multiple, differet, Silktorrent packages.
         1961  +    func_mmmv_GUID_t1
         1962  +    echo "$S_FUNC_MMMV_GUID_T1_RESULT" >> $S_FP_TMP_HEADER_SALT_TXT
         1963  +    func_mmmv_GUID_t1
         1964  +    echo "$S_FUNC_MMMV_GUID_T1_RESULT" >> $S_FP_TMP_HEADER_SALT_TXT
         1965  +    func_mmmv_GUID_t1
         1966  +    echo "$S_FUNC_MMMV_GUID_T1_RESULT" >> $S_FP_TMP_HEADER_SALT_TXT
         1967  +    func_mmmv_GUID_t1
         1968  +    echo "$S_FUNC_MMMV_GUID_T1_RESULT" >> $S_FP_TMP_HEADER_SALT_TXT
         1969  +    func_mmmv_GUID_t1
         1970  +    echo "$S_FUNC_MMMV_GUID_T1_RESULT" >> $S_FP_TMP_HEADER_SALT_TXT
         1971  +    func_mmmv_GUID_t1
         1972  +    echo "$S_FUNC_MMMV_GUID_T1_RESULT" >> $S_FP_TMP_HEADER_SALT_TXT
         1973  +    #--------
         1974  +    # The file size/Silktorrent pakcket size must also be salted.
         1975  +    ruby -e \
         1976  +        "Random.new_seed;i=0;\
         1977  +         puts '';\
         1978  +         rand(10**6).times{\
         1979  +             i=i+1;\
         1980  +             print(rand(10**6).to_s(16));\
         1981  +             if((i%10)==0) then \
         1982  +                 puts '';\
         1983  +                 i=0;\
         1984  +             end;\
         1985  +         }" \
         1986  +         >> $S_FP_TMP_HEADER_SALT_TXT
         1987  +    #--------
         1988  +    cp -f $S_FP_0 $S_FP_TMP_PAYLOAD/
         1989  +    if [ "$?" != "0" ]; then
         1990  +        echo ""
         1991  +        echo "The command "
         1992  +        echo ""
         1993  +        echo "    cp -f \$S_FP_0 \$S_FP_TMP_PAYLOAD/ "
         1994  +        echo ""
         1995  +        echo "failed. Either this script is flawed or something else went wrong. "
         1996  +        echo ""
         1997  +        echo "    S_FP_0==$S_FP_0"
         1998  +        echo ""
         1999  +        echo "    S_FP_TMP_PAYLOAD=$S_FP_TMP_PAYLOAD"
         2000  +        echo ""
         2001  +        echo "GUID=='82573133-665f-4630-93f1-83f2c08160e7'"
         2002  +        echo ""
         2003  +        #----
         2004  +        cd $S_FP_ORIG
         2005  +        exit 1 # exit with error
         2006  +    fi
         2007  +    #--------
         2008  +    local S_FP_TMP_ORIG_0="`pwd`"
         2009  +    cd $S_FP_TMP_SILKTORRENT_PACKET/.. 
         2010  +    tar -cf $S_FP_TMP_SILKTORRENT_PACKET_TAR ./`basename $S_FP_TMP_SILKTORRENT_PACKET` 2>/dev/null
         2011  +    cd $S_FP_TMP_ORIG_0
         2012  +    if [ "$?" != "0" ]; then
         2013  +        echo ""
         2014  +        echo "The command "
         2015  +        echo ""
         2016  +        echo "    tar -cf \$S_FP_TMP_SILKTORRENT_PACKET_TAR \$S_FP_TMP_SILKTORRENT_PACKET "
         2017  +        echo ""
         2018  +        echo "failed. Either this script is flawed or something else went wrong. "
         2019  +        echo ""
         2020  +        echo "    S_FP_TMP_SILKTORRENT_PACKET=$S_FP_TMP_SILKTORRENT_PACKET"
         2021  +        echo ""
         2022  +        echo "    S_FP_TMP_SILKTORRENT_PACKET_TAR==$S_FP_TMP_SILKTORRENT_PACKET_TAR"
         2023  +        echo ""
         2024  +        echo "GUID=='36819d11-7f01-4740-a4f1-83f2c08160e7'"
         2025  +        echo ""
         2026  +        #----
         2027  +        cd $S_FP_ORIG
         2028  +        exit 1 # exit with error
         2029  +    fi
         2030  +    #----
         2031  +    func_mmmv_silktorrent_packager_t1_bash_blob2filename_t1 "$S_FP_TMP_SILKTORRENT_PACKET_TAR"
         2032  +    local S_FP_TMP_SILKTORRENT_PACKET_PUBLISHINGNAME="$S_FP_ORIG/$S_FUNC_MMMV_SILKTORRENT_PACKAGER_T1_BASH_BLOB2FILENAME_T1_RESULT"
         2033  +    mv $S_FP_TMP_SILKTORRENT_PACKET_TAR $S_FP_TMP_SILKTORRENT_PACKET_PUBLISHINGNAME
         2034  +    if [ "$?" != "0" ]; then
         2035  +        echo ""
         2036  +        echo "Something went wrong."
         2037  +        echo "The renaming and copying of "
         2038  +        echo "    $S_FP_TMP_SILKTORRENT_PACKET_TAR "
         2039  +        echo "to "
         2040  +        echo "    $S_FP_TMP_SILKTORRENT_PACKET_PUBLISHINGNAME "
         2041  +        echo "failed."
         2042  +        echo "GUID=='db65c191-4ba3-4672-b3f1-83f2c08160e7'"
         2043  +        echo ""
         2044  +        #----
         2045  +        cd $S_FP_ORIG
         2046  +        exit 1 # exit with error
         2047  +    fi
         2048  +    if [ ! -e "$S_FP_TMP_SILKTORRENT_PACKET_PUBLISHINGNAME" ]; then
         2049  +        echo ""
         2050  +        echo "Something went wrong."
         2051  +        echo "The renaming and copying of "
         2052  +        echo ""
         2053  +        echo "    $S_FP_TMP_SILKTORRENT_PACKET_TAR "
         2054  +        echo ""
         2055  +        echo "to "
         2056  +        echo ""
         2057  +        echo "    $S_FP_TMP_SILKTORRENT_PACKET_PUBLISHINGNAME "
         2058  +        echo ""
         2059  +        echo "failed. The mv command succeed, but for some reason "
         2060  +        echo "the destination file does not exist."
         2061  +        echo "GUID=='83fae955-7e6b-4a80-85f1-83f2c08160e7'"
         2062  +        echo ""
         2063  +        #----
         2064  +        cd $S_FP_ORIG
         2065  +        exit 1 # exit with error
         2066  +    fi
         2067  +    #--------
         2068  +    func_mmmv_delete_tmp_folder_t1 "$S_FP_TMP_0"
         2069  +    if [ -e "$S_FP_TMP_0" ]; then
         2070  +        echo ""
         2071  +        echo "Something went wrong."
         2072  +        echo "The deletion of the temporary folder, "
         2073  +        echo ""
         2074  +        echo "    $S_FP_TMP_0"
         2075  +        echo ""
         2076  +        echo "failed."
         2077  +        echo "GUID=='2dd1f121-5407-48a0-b2f1-83f2c08160e7'"
         2078  +        echo ""
         2079  +        #----
         2080  +        cd $S_FP_ORIG
         2081  +        exit 1 # exit with error
         2082  +    fi
         2083  +} # func_mmmv_silktorrent_packager_t1_bash_wrap_t1
         2084  +
         2085  +
         2086  +#--------------------------------------------------------------------------
         2087  +
         2088  +func_mmmv_silktorrent_packager_t1_bash_unwrap_t1() {
         2089  +    local S_FP_0="$1" # Path to the file. 
         2090  +    #----
         2091  +    func_mmmv_silktorrent_packager_t1_bash_exc_assert_wrappable_file_exists_t1 "$S_FP_0"
         2092  +    #--------
         2093  +    func_mmmv_silktorrent_packager_t1_bash_verify_file_name_t1 "$S_FP_0"
         2094  +    local S_PACKET_FORMAT="$S_FUNC_MMMV_SILKTORRENT_PACKAGER_T1_BASH_GET_PACKET_FORMAT_VERSION_T1_RESULT"
         2095  +    if [ "$S_FUNC_MMMV_SILKTORRENT_PACKAGER_T1_BASH_VERIFY_FILE_NAME_T1_RESULT" != "verification_passed" ]; then
         2096  +        echo ""
         2097  +        echo "The Silktorrent packet candidate, "
         2098  +        echo ""
         2099  +        echo "    $S_FP_0"
         2100  +        echo ""
         2101  +        echo "failed Silktorrent packet name verification."
         2102  +        echo "There exists a possibility that the "
         2103  +        echo "Silktorrent packet candidate is actually OK, but "
         2104  +        echo "this is an older version of the Silktorrent implementaiton and "
         2105  +        echo "this, the older, version does not support "
         2106  +        echo "newer Silktorrent packet formats. "
         2107  +        echo "GUID=='859bd022-e09e-4d45-94e1-83f2c08160e7'"
         2108  +        echo ""
         2109  +        #----
         2110  +        cd $S_FP_ORIG
         2111  +        exit 1 # exit with error
         2112  +    fi
         2113  +    #--------
         2114  +    local SB_FORMAT_BRANCH_EXISTS_IN_THIS_FUNCTION="f"
         2115  +    if [ "$S_PACKET_FORMAT" == "silktorrent_packet_format_version_1" ]; then
         2116  +        SB_FORMAT_BRANCH_EXISTS_IN_THIS_FUNCTION="t"
         2117  +        #----
         2118  +        local S_FP_TMP_SILKTORRENT_PACKET="`pwd`/silktorrent_packet"
         2119  +        if [ -e $S_FP_TMP_SILKTORRENT_PACKET ]; then
         2120  +            echo ""
         2121  +            echo "To avoid accidental deletion of files, "
         2122  +            echo "and some other types of flaws, "
         2123  +            echo "there is a requirement that the folder "
         2124  +            echo ""
         2125  +            echo "    ./silktorrent_packet"
         2126  +            echo ""
         2127  +            echo "must be explicitly deleted before calling this script."
         2128  +            echo "GUID=='c2967e69-c2b9-4774-91e1-83f2c08160e7'"
         2129  +            echo ""
         2130  +            #----
         2131  +            cd $S_FP_ORIG
         2132  +            exit 1 # exit with error
         2133  +        fi
         2134  +        #----
         2135  +        tar -xf $S_FP_0 2>/dev/null
         2136  +        if [ "$?" != "0" ]; then
         2137  +            echo ""
         2138  +            echo "Something went wrong. The command "
         2139  +            echo ""
         2140  +            echo "    tar -xf $S_FP_0"
         2141  +            echo ""
         2142  +            echo "exited with an error code, which is $? ."
         2143  +            echo "GUID=='aef74f24-a969-470f-85e1-83f2c08160e7'"
         2144  +            echo ""
         2145  +            #----
         2146  +            cd $S_FP_ORIG
         2147  +            exit 1 # exit with error
         2148  +        fi
         2149  +        rm -f $S_FP_TMP_SILKTORRENT_PACKET/header/silktorrent_salt.txt
         2150  +        #----
         2151  +        if [ ! -e $S_FP_TMP_SILKTORRENT_PACKET ]; then
         2152  +            echo ""
         2153  +            echo "Something went wrong. "
         2154  +            echo "The unpacking of the Silktorrent packet with the path of "
         2155  +            echo ""
         2156  +            echo "    $S_FP_0"
         2157  +            echo ""
         2158  +            echo "failed. The folder \"silktorrent_packet\" "
         2159  +            echo "is missing after the \"tar\" exited without any errors."
         2160  +            echo "GUID=='b6ee795a-4468-480f-a2e1-83f2c08160e7'"
         2161  +            echo ""
         2162  +            #----
         2163  +            cd $S_FP_ORIG
         2164  +            exit 1 # exit with error
         2165  +        fi
         2166  +    fi # silktorrent_packet_format_version_1
         2167  +    #--------
         2168  +    if [ "$SB_FORMAT_BRANCH_EXISTS_IN_THIS_FUNCTION" != "t" ]; then
         2169  +        echo ""
         2170  +        echo "This script is flawed."
         2171  +        echo "There is at least one branch missing from this function."
         2172  +        echo "GUID=='d0662736-c1b5-4902-a1e1-83f2c08160e7'"
         2173  +        echo ""
         2174  +        #----
         2175  +        cd $S_FP_ORIG
         2176  +        exit 1 # exit with error
         2177  +    fi
         2178  +    #--------
         2179  +} # func_mmmv_silktorrent_packager_t1_bash_unwrap_t1
         2180  +
         2181  +
         2182  +#--------------------------------------------------------------------------
         2183  +
         2184  +# The 
         2185  +S_SILKTORRENT_PACKAGER_T1_ACTION="" # is global to allow it to be used
         2186  +# in the error messages of different functions.
         2187  +
         2188  +func_mmmv_silktorrent_packager_t1_bash_determine_action() { 
         2189  +    local S_ARGV_0="$1" # Ruby style ARGV, 0 is the first command line argument.
         2190  +    local S_ARGV_1="$2" 
         2191  +    local S_ARGV_2="$3" 
         2192  +    local S_ARGV_3="$4" 
         2193  +    #--------
         2194  +    if [ "$S_ARGV_0" == "" ]; then
         2195  +        func_mmmv_silktorrent_packager_t1_bash_print_help_msg_t1
         2196  +        #----
         2197  +        cd $S_FP_ORIG
         2198  +        exit 1 # exit with an error
         2199  +    fi
         2200  +    #----
         2201  +    local SB_0="f"
         2202  +    if [ "$S_ARGV_0" == "help" ]; then
         2203  +        SB_0="t"
         2204  +    fi
         2205  +    if [ "$S_ARGV_0" == "--help" ]; then
         2206  +        SB_0="t"
         2207  +    fi
         2208  +    if [ "$S_ARGV_0" == "-?" ]; then
         2209  +        SB_0="t"
         2210  +    fi
         2211  +    if [ "$S_ARGV_0" == "-h" ]; then
         2212  +        SB_0="t"
         2213  +    fi
         2214  +    #----
         2215  +    if [ "$SB_0" == "t" ]; then
         2216  +        func_mmmv_silktorrent_packager_t1_bash_print_help_msg_t1
         2217  +        #----
         2218  +        cd $S_FP_ORIG
         2219  +        exit 0 # exit without an error
         2220  +    fi
         2221  +    #--------------------------
         2222  +    # Start of actions that require the existance of at least one file.
         2223  +    local S_TMP_0=""
         2224  +    local S_TMP_1=""
         2225  +    #----
         2226  +    S_TMP_0="wrap" 
         2227  +    if [ "$S_ARGV_0" == "$S_TMP_0" ]; then
         2228  +        S_SILKTORRENT_PACKAGER_T1_ACTION="$S_TMP_0"
         2229  +    fi
         2230  +    if [ "$S_ARGV_0" == "pack" ]; then   # alias
         2231  +        S_SILKTORRENT_PACKAGER_T1_ACTION="$S_TMP_0"
         2232  +    fi
         2233  +    #----
         2234  +    S_TMP_0="unwrap" 
         2235  +    if [ "$S_ARGV_0" == "$S_TMP_0" ]; then
         2236  +        S_SILKTORRENT_PACKAGER_T1_ACTION="$S_TMP_0"
         2237  +    fi
         2238  +    if [ "$S_ARGV_0" == "unpack" ]; then # alias
         2239  +        S_SILKTORRENT_PACKAGER_T1_ACTION="$S_TMP_0"
         2240  +    fi
         2241  +    #----
         2242  +    S_TMP_0="verify" # checks the matche between the blob and the file name
         2243  +    if [ "$S_ARGV_0" == "$S_TMP_0" ]; then
         2244  +        S_SILKTORRENT_PACKAGER_T1_ACTION="$S_TMP_0"
         2245  +    fi
         2246  +    #----
         2247  +    S_TMP_0="test_hash_t1" 
         2248  +    if [ "$S_ARGV_0" == "$S_TMP_0" ]; then
         2249  +        S_SILKTORRENT_PACKAGER_T1_ACTION="$S_TMP_0"
         2250  +    fi
         2251  +    #--------
         2252  +    if [ "$S_SILKTORRENT_PACKAGER_T1_ACTION" == "" ]; then
         2253  +        func_mmmv_silktorrent_packager_t1_bash_print_help_msg_t1
         2254  +        #----
         2255  +        cd $S_FP_ORIG
         2256  +        exit 1 # exit with an error
         2257  +    fi
         2258  +    # The action name test above has to be before the 
         2259  +    func_mmmv_silktorrent_packager_t1_bash_exc_assert_wrappable_file_exists_t1 "$S_ARGV_1"
         2260  +    # because otherwise the texts of the 
         2261  +    # error messages are incorrect. Indeed, it does
         2262  +    # introduce the following duplicating series of if-clauses,
         2263  +    # but it's all in the name of producing helpful error
         2264  +    # messages at different situations.
         2265  +    #----
         2266  +    if [ "$S_SILKTORRENT_PACKAGER_T1_ACTION" == "wrap" ]; then
         2267  +        func_mmmv_silktorrent_packager_t1_bash_wrap_t1 "$S_ARGV_1"
         2268  +        #----
         2269  +        cd $S_FP_ORIG
         2270  +        exit 0 # exit without an error
         2271  +    fi
         2272  +    #----
         2273  +    if [ "$S_SILKTORRENT_PACKAGER_T1_ACTION" == "unwrap" ]; then
         2274  +        func_mmmv_silktorrent_packager_t1_bash_unwrap_t1 "$S_ARGV_1"
         2275  +        #----
         2276  +        cd $S_FP_ORIG
         2277  +        exit 0 # exit without an error
         2278  +    fi
         2279  +    #----
         2280  +    if [ "$S_SILKTORRENT_PACKAGER_T1_ACTION" == "verify" ]; then
         2281  +        func_mmmv_silktorrent_packager_t1_bash_verify_file_name_t1 "$S_ARGV_1"
         2282  +        echo "$S_FUNC_MMMV_SILKTORRENT_PACKAGER_T1_BASH_VERIFY_FILE_NAME_T1_RESULT"
         2283  +        #----
         2284  +        cd $S_FP_ORIG
         2285  +        exit 0 # exit without an error
         2286  +    fi
         2287  +    #----
         2288  +    if [ "$S_SILKTORRENT_PACKAGER_T1_ACTION" == "test_hash_t1" ]; then
         2289  +        func_mmmv_silktorrent_packager_t1_bash_test_1 "$S_ARGV_1"
         2290  +        #----
         2291  +        cd $S_FP_ORIG
         2292  +        exit 0 # exit without an error
         2293  +    fi
         2294  +    #--------------------------
         2295  +        echo "" 
         2296  +        echo "This bash script is flawed. The control flow " 
         2297  +        echo "should have never reached this line."
         2298  +        echo "GUID=='87e4c185-e25f-4047-a8e1-83f2c08160e7'"
         2299  +        echo ""
         2300  +        #----
         2301  +        cd $S_FP_ORIG
         2302  +        exit 1 # exit with an error
         2303  +} # func_mmmv_silktorrent_packager_t1_bash_determine_action
         2304  +
         2305  +func_mmmv_silktorrent_packager_t1_bash_determine_action $1 $2 $3 $4 $5 $6 $7
         2306  +
         2307  +
         2308  +#--------------------------------------------------------------------------
         2309  +
         2310  +
         2311  +#--------------------------------------------------------------------------
         2312  +cd $S_FP_ORIG
         2313  +exit 0 # 
         2314  +
         2315  +#==========================================================================
         2316  +# Fragments of comments and code that might find use some times later:
         2317  +#--------------------------------------------------------------------------
         2318  +#
         2319  +#   max 55 characters --- package suggested deprecation date in nanoseconds
         2320  +#                         relative to the Unix Epoch, 
         2321  +#                         written in base 10. It can be negative.
         2322  +#                         rgx_in_ruby=/t((y[-]?[\d]+)|n)[_]/
         2323  +# echo "v0034_s2342_tn_" | gawk '{ gsub(/_/, "_\n"); print }' | \
         2324  +#                          gawk '/^t(y[-]?[0-9]+|n)_/ {printf "%s",$1 }' |
         2325  +#                          gawk '{gsub(/[tyn_]/,"");printf "%s", $1 }'
         2326  +#                         
         2327  +#
         2328  +
         2329  +
         2330  +#==========================================================================
         2331  +