-
-
Notifications
You must be signed in to change notification settings - Fork 337
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
Files unrelated to job get removed when post-processing Cleanup List runs #2577
Comments
certain things that sab does only affects things that are tracked but yes the cleanup just runs post to cleanup anything left over in the completed dir ( https://github.com/sabnzbd/sabnzbd/blob/develop/sabnzbd/postproc.py#L1071). it doesnt really care what was tracked (as things could be created post extraction/rename/repaired/etc). and empty dir do get removed during this process as well. its a bit blunt but its also kinda the point of it, you said you dont want x. it will get rid of x. |
I understand that's how it works currently, it's not smart enough to do it any better, I'm just not sure that's how it should work. Especially not with per-category cleanup coming soon. Download an app and then download a movie and you lose your app. I'm not brave enough to test this, but imagine somebody made their final directory C:\ root, would SAB then wipe all of the exe files from the Program Files and Windows folders? Even something as simple as the default Windows |
sab just does what the user tells it. we have quite a few guards in sab, but its hard to do certain things like restrict what paths are safe to use. because of different use cases.. different os. people running sab on one os but then volume mounts to others.. or running things in containers/virtual fs. like disabling cleanup feature if user decides to do * on a cat to prevent jobs, which means dump them in the completed folder.. that might sound good but then that breaks the use case of people that actually want that and know what they are doing. I can understand that pitch if your worried exposed sab instance doesnt have auth (or really bad auth) and your running it as root on a production system. but my argument there would be to just run in docker to sandbox it, have auth, use reverse proxy, or dont even expose it externally. now about cleanup, having it be recursive or not to limit scope is double edge. there would be people that would be unhappy no matter what we do. but generically most people want recursive because they dont have bad paths and the downloads are segmented, let alone this is happening from within the job folder. the feature is there, we dont force it on anyone. we can only protect people so much before we reduce functionality. i dont see any easy wins we can do without a negative impact towards functionality/usability. if you are worried about abuse, secure your setup. we do offer up the ability to lock down sab config via a .ini only option https://sabnzbd.org/wiki/configuration/4.0/special#toc2 |
I was being admittedly hyperbolic, but all I'm really saying is: Download app > Download movie > App is now gone Download picture > Download TV show > Picture is now gone This seems incorrect and unintended. I get what you're saying about recursive being double edged, but there's no reason to have the cleanup script working in folders or with files that aren't part of the job. |
but the cleanup process happens from within the job. why im saying you would have to go out of your way to downloading one job, then update the cat to point to that job folder to then cause the issue |
lets say i set my completed folder to
|
We keep a list of all files that belong to a job. However, when using Sorting this list is emptied due to limitations in the current implementation. |
I see what you're saying. Maybe I'm just unique in that all of my sorting on my main PC just goes to a blanket downloads folder, I don't have individual TV/Movie/whatever subfolders for sorting on it. On my media server Sonarr and Radarr are handling all that, so SAB sorting isn't even involved. I guess I previously assumed that post-processing the cleanup list happened before the move to its final destination. I would think it would make more sense to clean up the job while it's in the temp folder before it gets moved. Obviously the files on cleanup lists are generally very tiny, so the real world impact of moving them across drives and network shares just to immediately delete them is minimal, but it seems inefficient and can clearly lead to problems with unrelated files being deleted. Anyway, it sounds like @Safihre is saying this isn't really feasible without a lot of work, so feel free to close this since it probably affects so few people. |
Its hard to cleanup in incomplete when were not unpacking in it... Some setups, it would be optimal to unpack to incomplete and do the cleanup and THEN move whats left. |
Fair enough, I'm gonna go ahead and close this, especially since it sounds like the upcoming per-category cleanup wouldn't be any different than the current situation so there's no improvements to be made there either. Thanks for all the feedback. |
I'll reopen this because I really want to fix that the Sorter clears out the file tracking. If that's fixed, this can more easily be managed. |
I wasn't sure the best way to title this, but essentially I noticed that if you have any files in your final download folder or any subfolder that are on your Cleanup List then they get removed when the job finishes running, regardless of whether or not they're related to the actual job. This might be a bug, or it might be just be a consequence of having a Cleanup List at all, but it seems to me that it shouldn't be removing files unrelated to the download.
Quick reproducible example:
exe, png, nfo, nzb
MyApplication
fake.exe
,fake.png
,fake.nfo
,fake.nzb
,fake.ext
(.ext for control)Default
and no sorting)Result: All of the cleanup list files are gone from the
MyApplication
subfolder. In fact, if there's only cleanup files in the folder then the whole folder is removed.Initial structure:
After download and cleanup completes:
Some logging:
Other potentially relevant info:
SABnzb version 4.0.0 [5e42e25]
Windows 10 Pro
Category is set to TV with the Sort String set to
%dn.%ext
The text was updated successfully, but these errors were encountered: