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

PICARD-1143: Prevent loading .smbdelete* files #785

Merged

Conversation

Sophist-UK
Copy link
Contributor

@Sophist-UK Sophist-UK commented Oct 4, 2017

.smbdelete files are temporary versions of files that should have been deleted but cannot be due to samba bug(?). We should not load these files even if we have ignore-hidden-files unchecked.

Note: I am not running on a Mac and have not tested this code.

This PR resolves PICARD-1143.

.smbdelete files are temporary versions of files that should have been
deleted but cannot be due to  samba bug(?). We should not load these
files even if we have ignore-hidden-files unchecked.
@Sophist-UK Sophist-UK force-pushed the picard-1143_always-hide-.smbdelete-files branch from eda3e45 to 09195d5 Compare October 4, 2017 21:42
picard/tagger.py Outdated
@@ -367,6 +367,9 @@ def add_files(self, filenames, target=None):
if ignore_hidden and is_hidden(filename):
log.debug("File ignored (hidden): %r" % (filename))
continue
if os.path.basename(filename).startswith(".smbdelete") and is_hidden(filename):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does not make sense to have just 1 extension as a special case. Can we instead create a new constant list in picard.constant, and check force all the files with the extension in that extension list?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree in general - but can we leave it until we have a second case to create a general solution?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, can you add a comment explaining this special case then? And a TODO for future reference when we do need to shift to a general case

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a specific need to test if the file is hidden, i think we want to ignore all files started with .smbdelete whether they are hidden or not.
For reference, this kind of files are created by http://www.opensource.apple.com/source/smb/smb-759.40.1/kernel/smbfs/smbfs_smb.c

About handling general case, no need for now, just add a comment about why we need to ignore such files.

picard/tagger.py Outdated
@@ -367,6 +367,9 @@ def add_files(self, filenames, target=None):
if ignore_hidden and is_hidden(filename):
log.debug("File ignored (hidden): %r" % (filename))
continue
if os.path.basename(filename).startswith(".smbdelete") and is_hidden(filename):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a specific need to test if the file is hidden, i think we want to ignore all files started with .smbdelete whether they are hidden or not.
For reference, this kind of files are created by http://www.opensource.apple.com/source/smb/smb-759.40.1/kernel/smbfs/smbfs_smb.c

About handling general case, no need for now, just add a comment about why we need to ignore such files.

Copy link
Contributor Author

@Sophist-UK Sophist-UK left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested done.

@samj1912 samj1912 merged commit c2f2282 into metabrainz:master Oct 23, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants