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

overwrite does wrong checksum validation #245

Closed
jjkoehorst opened this issue Aug 16, 2024 · 2 comments · Fixed by #248
Closed

overwrite does wrong checksum validation #245

jjkoehorst opened this issue Aug 16, 2024 · 2 comments · Fixed by #248
Assignees
Labels
bug Something isn't working
Milestone

Comments

@jjkoehorst
Copy link

Describe the bug
When setting the overwrite it will do a checksum test but it does the sha2 checksum and not the md5 that is being used in the iRODS instance I have access to.

To Reproduce
Make sure your irods uses the md5 checksum
Download a file with overwrite...

        if not (
            local_path.is_file() and (calc_checksum(irods_path) == calc_checksum(local_path))
        ):

# Will call

    if isinstance(filepath, IrodsPath):
        return filepath.checksum
    f_hash=sha256()
    memv=memoryview(bytearray(128*1024))
    with open(filepath, 'rb', buffering=0) as file:
        for item in iter(lambda : file.readinto(memv), 0):
            f_hash.update(memv[:item])
    return f"sha2:{str(base64.b64encode(f_hash.digest()), encoding='utf-8')}"

Provide some information:

  • OS: Mac osx
  • Software version or branch you are working on
  • python version 3.12.4
  • iRODS version
  • python-irodsclient version (python -c "import irods; print(irods.__version__)" )
@qubixes
Copy link
Collaborator

qubixes commented Aug 16, 2024

@jjkoehorst Thanks for noticing this. I will work on this before our next release.

@qubixes qubixes self-assigned this Aug 16, 2024
@qubixes qubixes added this to the v1.1 milestone Aug 16, 2024
@qubixes qubixes added the bug Something isn't working label Aug 16, 2024
@qubixes
Copy link
Collaborator

qubixes commented Aug 20, 2024

@jjkoehorst I have created a PR in #248 for this issue. I have a difficult time testing it properly, because of some issues we currently have switching hash types. Could you check if the PR fixes the issue for you?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants