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

remove md5 hash from incomplete files in JFSFileDirList() #88

Closed
antonhagg opened this issue Jan 28, 2016 · 5 comments
Closed

remove md5 hash from incomplete files in JFSFileDirList() #88

antonhagg opened this issue Jan 28, 2016 · 5 comments
Milestone

Comments

@antonhagg
Copy link

When going through the code in the JFSFileDirList class i found that it takes into consideration that an incomplete file doesn't have a size. This is the case for md5 aswell and therefore I think the code should be:

                    else:
                        # an incomplete file
                        t.append(treefile(unicode(file_.attrib['name']),
                                          -1, # incomplete files have no size
                                          unicode(""), # incomplete files have no md5
                                          unicode(file_.attrib['uuid'])
                                          )
                                 )
            self.tree[posixpath.join(path, foldername)] = t

insted of the code:

                    else:
                        # an incomplete file
                        t.append(treefile(unicode(file_.attrib['name']),
                                          -1, # incomplete files have no size
                                          unicode(file_.currentRevision.md5),
                                          unicode(file_.attrib['uuid'])
                                          )
                                 )
            self.tree[posixpath.join(path, foldername)] = t
@antonhagg antonhagg mentioned this issue Jan 29, 2016
@havardgulldahl
Copy link
Owner

havardgulldahl commented Jun 25, 2016

@antonhagg Tell me more about your case and the error you're getting. In my tests, incomplete files do have md5 hashes.

I see now that this conclusion is quite naive:

if hasattr(file_, 'currentRevision'): # a normal file

We should really explicitly test for the file's state instead. Maybe you're encountering corrupt files? What's the value of state in those files, do you know?

@havardgulldahl havardgulldahl changed the title Minor change in class JFSFileDirList() remove md5 hash from incomplete files in JFSFileDirList() Jun 25, 2016
havardgulldahl added a commit that referenced this issue Jun 25, 2016
…d revamp logic to be more resilient to unexpected file objects. See #88
@havardgulldahl
Copy link
Owner

@antonhagg Please test the newly commited code in 6c844dd and let me know if it fixes things for you

@antonhagg
Copy link
Author

I cant remember, but I think the file had no values at all, just the state incomplete. Could this be linked with #104?

@antonhagg
Copy link
Author

I have tried to figure this thing out, and latest commit doesn't return any error: 1c41eaa

@havardgulldahl
Copy link
Owner

Thank you for your detective work, @antonhagg, as you see I have used some of your logic in 6c844dd. So I'm considering this as fixed.

@havardgulldahl havardgulldahl added this to the 0.5 milestone Jun 30, 2016
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

2 participants