-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
fetchart: Creates files with incorrect permissions #4622
Comments
Hi! Can you please include your full configuration, and perhaps a verbose log from a case where |
The issue is cause by the fact that temporary files are created with 600 permissions. In Lines 1340 to 1343 in 6989bce
So if copy is false, the temporary files are copied over, including their incorrect permissions. The value of copy is from not self.src_removed , here:Line 1064 in 6989bce
where self.src_removed is:Lines 981 to 982 in 6989bce
so the issue occurs whenever delete or move are set. I believe the solution is to not use move for temporary files, I'm not sure how to best implement that. |
Hmm; I'm not entirely sure I understand the root cause: namely, it seems important to know why the original files (the ones being moved) are created with 0600 permissions. It seems like those should be created with umask defaults? |
From the python documentation (https://docs.python.org/3/library/tempfile.html#tempfile.mkstemp)
So this is expected behavior from the library. I see in the util folder: Lines 468 to 475 in 6989bce
So here it is implied that removing metadata is bad—which is probably true when moving existing images—but when using new images downloaded by the program, the metadata (from tempfile) should be discarded in favor of the default metadata. |
Got it; wow; thanks for clarifying!! I did not know this about Seems like we clearly need to either:
|
|
That makes sense, although it's a tad unfortunate. There are two things that make that route (leaving the temporary files as they are, and copying them instead of moving):
|
Yeah, the second one is why I couldn't figure out a good way to implement it. It would probably be the best to just reset the permissions, but I haven't found a great way of doing that in python that is cross-platform. |
Hi, I'm getting this problem when importing music from a zip file. It looks like the temporary files created here (https://github.com/beetbox/beets/blob/master/beets/util/__init__.py#L527) are created with 600 permissions. I was wondering why util.move uses all the code it does instead of using something like shutil.move (https://docs.python.org/3/library/shutil.html#shutil.move)? |
On linux, running beet fetchart creates files with
600
permissions, rather than 644 (or using the default provided by umask).Setup
My configuration (output of
beet config
) is:The text was updated successfully, but these errors were encountered: