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

Hash calculation seems buggy (but consistent) #96

Open
csachs opened this issue Dec 21, 2020 · 0 comments
Open

Hash calculation seems buggy (but consistent) #96

csachs opened this issue Dec 21, 2020 · 0 comments

Comments

@csachs
Copy link

csachs commented Dec 21, 2020

I was trying to recreate imagej-updater's hashing in Python, and while I had success with many files, I stumbled upon some very peculiar behaving files. Six hours of debugging later, I found two non-obvious bugs in imagej-updater's code.
While this seems to be two bugs, it doesn't really affect the updater, since the hashes are calculated consistently wrong ;) … or at least contrary to what taking a brief look at the code might suggest.

First: Contrary to what keepOnlyMainClass parameter (the default) suggests, the FilterManifest filter will never show the main class:

if (line.toUpperCase().startsWith("Main-Class:")) builder.append(line).append('\n');

After the .toUpperCase() call, it can never .startsWith() the mixed case text fragment ... hence just an empty manifest is passed.

Second: A missing super(). turns this simple supposedly-iterative (I presume) function into a rather unpredictable recursive affair ... contrary to what SkipHashedLines suggests, some lines starting with a # will hence remain in the resulting stream.

while ((ch = read()) != '\n' && ch != -1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant