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

[1.3.10rc2] Multiple tracked files can have the same hash #2908

Closed
DominikPalo opened this issue Nov 24, 2018 · 4 comments
Closed

[1.3.10rc2] Multiple tracked files can have the same hash #2908

DominikPalo opened this issue Nov 24, 2018 · 4 comments
Assignees
Labels
bug Issue describes a bug done Done but not yet released

Comments

@DominikPalo
Copy link
Contributor

DominikPalo commented Nov 24, 2018

I've checked the implementation of the tracking plugin and have found, that the sha1 hash of a printed file is computed only from the file name (and the instance id):

sha = hashlib.sha1()
sha.update(payload.get("name"))
sha.update(self._settings.get([b"unique_id"]))

Wouldn't be better to include also the file path and location into that hash?

sha = hashlib.sha1()
sha.update(payload.get("origin"))
sha.update(payload.get("path"))
sha.update(payload.get("name"))
sha.update(self._settings.get([b"unique_id"]))

Because now I can imagine a situation when two completely different files with the same name that are stored in different locations, e.g.:

/project1/base.gcode
/project2/base.gcode

result in the same hash.

@GitIssueBot
Copy link

Hi @DominikPalo,

It looks like there is some information missing from your bug report that will be needed in order to solve the problem. Read the Contribution Guidelines which will provide you with a template to fill out here so that your bug report is ready to be investigated (I promise I'll go away then too!).

If you did not intend to report a bug but wanted to request a feature or brain storm about some kind of development, please take special note of the title format to use as described in the Contribution Guidelines.

Please do not abuse the bug tracker as a support forum - that can be found at discourse.octoprint.org. Go there for any kind of issues with network connectivity, webcam functionality, printer detection or any other kind of such support requests or general questions.

Also make sure you are at the right place - this is the bug tracker of the official version of OctoPrint, not the Raspberry Pi image OctoPi nor any unbundled third party OctoPrint plugins or unofficial versions. Make sure too that you have read through the Frequently Asked Questions and searched the existing tickets for your problem - try multiple search terms please.

I'm marking this one now as needing some more information. Please understand that if you do not provide that information within the next two weeks (until 2018-12-08 20:30 UTC) I'll close this ticket so it doesn't clutter the bug tracker. This is nothing personal, so please just be considerate and help the maintainers solve this problem quickly by following the guidelines linked above. Remember, the less time the devs have to spend running after information on tickets, the more time they have to actually solve problems and add awesome new features. Thank you!

Best regards,
~ Your friendly GitIssueBot

PS: I'm just an automated script, not a human being, so don't expect any replies from me :) Your ticket is read by humans too, I'm just not one of them.

@GitIssueBot GitIssueBot added the incomplete Issue template has not been fully filled out, no further processing until fixed label Nov 24, 2018
@foosel
Copy link
Member

foosel commented Nov 26, 2018

That's actually a really good point. Thanks for that.

The filename hashing is only used to be able to potentially track something like "file X was started and cancelled 4h later" for the same instance, but even for that it should definitely be able to differentiate between files in sub folders.

@foosel foosel added bug Issue describes a bug and removed incomplete Issue template has not been fully filled out, no further processing until fixed labels Nov 26, 2018
@foosel foosel self-assigned this Nov 26, 2018
@foosel
Copy link
Member

foosel commented Nov 26, 2018

Fixed by the above commit, to be part of 1.3.10rc3. In the end I went just for path instead of name - path contains name and origin is already provided as part of the payload anyhow.

@foosel foosel added the done Done but not yet released label Nov 26, 2018
@foosel
Copy link
Member

foosel commented Nov 28, 2018

1.3.10rc3 was just released.

@foosel foosel closed this as completed Nov 28, 2018
@foosel foosel modified the milestone: 1.3.11 Mar 25, 2019
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue describes a bug done Done but not yet released
Projects
None yet
Development

No branches or pull requests

3 participants