Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parsing-related issues #6

Closed
Alepod opened this issue Sep 10, 2021 · 3 comments
Closed

Parsing-related issues #6

Alepod opened this issue Sep 10, 2021 · 3 comments
Assignees
Labels
solved Issue is solved support request Support Request user error User error

Comments

@Alepod
Copy link

Alepod commented Sep 10, 2021

Here's folder listing:

Filename                         Size
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Complete Arcane.pdf              5,52 MB
Complete Mage.pdf                4,12 MB
Complete Psionic.pdf             3,20 MB
Expanded Psionics Handbook.pdf   7,04 MB
Heroes Of Horror.pdf             6,45 MB
Miniatures Handbook.pdf          6,83 MB
Player's Handbook II.pdf        19,51 MB
Player's Handbook.pdf            7,87 MB
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
8 files- 60,525 MB

We use:
jacksum -a md5 -8 -s \t -O dnd.hash "Dungeons & Dragons 3.0 and 3.5"
We got dnd.hash of this content:

4554e83783e3ccfaf939002e98478899	Dungeons & Dragons 3.0 and 3.5\Complete Arcane.pdf
dbbc5f9a26bbf594eaf2dbaccd10491c	Dungeons & Dragons 3.0 and 3.5\Complete Mage.pdf
44babcd353a3db448e19b6573f8edfa6	Dungeons & Dragons 3.0 and 3.5\Complete Psionic.pdf
3de6ee6ecf3d729df96a561dae387482	Dungeons & Dragons 3.0 and 3.5\Expanded Psionics Handbook.pdf
eabf343b60adf0c144530e7b7537c271	Dungeons & Dragons 3.0 and 3.5\Miniatures Handbook.pdf
da0bcd5a95e74812f4453b51db64e86c	Dungeons & Dragons 3.0 and 3.5\Heroes Of Horror.pdf
f6fc49a656eec3ca5971bd75b8e8196e	Dungeons & Dragons 3.0 and 3.5\Player's Handbook.pdf
df9685be4a78d13d4006d985993d4658	Dungeons & Dragons 3.0 and 3.5\Player's Handbook II.pdf

Trying to verify the same folder against this hashlist (working from 1 level up from listed folder):

>jacksum -a md5 -E hex -8 -s \t -c dnd.hash
Jacksum: Error: & Dragons 3.0 and 3.5\Complete Arcane.pdf: does not exist.
  MISSING  & Dragons 3.0 and 3.5\Complete Arcane.pdf
Jacksum: Error: & Dragons 3.0 and 3.5\Complete Mage.pdf: does not exist.
  MISSING  & Dragons 3.0 and 3.5\Complete Mage.pdf
Jacksum: Error: & Dragons 3.0 and 3.5\Complete Psionic.pdf: does not exist.
  MISSING  & Dragons 3.0 and 3.5\Complete Psionic.pdf
Jacksum: Error: & Dragons 3.0 and 3.5\Expanded Psionics Handbook.pdf: does not exist.
  MISSING  & Dragons 3.0 and 3.5\Expanded Psionics Handbook.pdf
Jacksum: Error: & Dragons 3.0 and 3.5\Miniatures Handbook.pdf: does not exist.
  MISSING  & Dragons 3.0 and 3.5\Miniatures Handbook.pdf
Jacksum: Error: & Dragons 3.0 and 3.5\Heroes Of Horror.pdf: does not exist.
  MISSING  & Dragons 3.0 and 3.5\Heroes Of Horror.pdf
Jacksum: Error: & Dragons 3.0 and 3.5\Player's Handbook.pdf: does not exist.
  MISSING  & Dragons 3.0 and 3.5\Player's Handbook.pdf
Jacksum: Error: & Dragons 3.0 and 3.5\Player's Handbook II.pdf: does not exist.
  MISSING  & Dragons 3.0 and 3.5\Player's Handbook II.pdf

Jacksum: total lines in check file: 8
Jacksum: improperly formatted lines in check file: 0
Jacksum: correctness of check file: 100.00 %

Jacksum: matches (OK): 0
Jacksum: mismatches (FAILED): 0
Jacksum: new files (NEW): 0
Jacksum: missing files (MISSING): 8

Jacksum: total files read: 0
Jacksum: total bytes read: 0
Jacksum: total bytes read (human readable): 0 bytes
Jacksum: total file read errors: 8

Jacksum: elapsed time: 139 ms

I guess it has something to do with & char, but I'm not sure. We see, it ignores Dungeons part of relative path.

@jonelo jonelo self-assigned this Sep 10, 2021
@jonelo jonelo added the support request Support Request label Sep 10, 2021
@jonelo
Copy link
Owner

jonelo commented Sep 10, 2021

Thank you for the report! Well, actually it has nothing to do with the ampersand, but it has to do with the -s option.

If you customize the output by specifying a different separator using the option -s, Jacksum may not be able to parse the output again by default using -c. It is documented in the manpage

$ jacksum -h -s
    -s <string>
    --separator <string>
            a custom separator string (\t, \n, \r, \", \' and \\ will be
            translated). The default value depends on the checksum algorithm,
            usually it is a single blank.
            If you customize the separator, Jacksum may not be able to parse
            the output again by default using -c. In that case you could write
            your own compatibility file, see also -C.
            Available since Jacksum 1.0.0, see also -F

From there, you have the following options

A) don't use -s if you want to parse the output without a compatibility file

or

B) use a compatibility file. It helps Jacksum to parse the customized format properly.

For demonstration purposes, I have stored the required definitions from the case above to a file called alepod.format:

algorithm.default=md5
algorithm.userSelectable=true
compat.authors=jonelo
compat.description=parser and formatter definitions for Alepod
compat.license=public domain
compat.name=alepod
compat.syntaxVersion=1
compat.version=1
formatter.format=#HASH{hex}\t#FILENAME
formatter.hash.encoding=hex
formatter.stdinName=<stdin>
formattter.stdinName=-
parser.ignoreEmptyLines=true
parser.ignoreLinesStartingWithString=#
parser.regexp.filenamePos=2
parser.regexp.hashPos=1
parser.regexp.nibbles=32
parser.regexp=^([a-z0-9]{#NIBBLES})\\t(.*)$

and now you can check the file by typing

jacksum -8 -C alepod.format -c dnd.hash

BTW, alepod.format can be stored anywhere, you just need to specify the location if it is not in the current working directory.
2nd BTW, if you also want to get informed about new files in the formerly checked folder (and not just the files that are stored in dnd.hash), you can specify the folder as well:

jacksum -8 -C alepod.format -c dnd.hash "Dungeons & Dragons 3.0 and 3.5"

The nice thing about the compatibility definitions is that it simplifies the creation of the check file as well:

jacksum -8 -C alepod.format -O dnd.hash "Dungeons & Dragons 3.0 and 3.5"

Does that answer your question?

@jonelo jonelo added user error User error solved Issue is solved labels Sep 10, 2021
@Alepod
Copy link
Author

Alepod commented Sep 12, 2021

Well, yes. Thanks.

@jonelo
Copy link
Owner

jonelo commented Sep 14, 2021

I have created issue #9 because I think it should be done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
solved Issue is solved support request Support Request user error User error
Projects
None yet
Development

No branches or pull requests

2 participants