nzbget / nzbget

Efficient Usenet Downloader
https://nzbget.net
GNU General Public License v2.0
1.22k stars 195 forks source link

'Encrypted' downloads will unpack to a nested sub-directory and do not inheirt permissions from parent #787

Open veL556 opened 2 years ago

veL556 commented 2 years ago

Longtime NZBget user, and I've been trying to find the root cause of this issue for almost a year...

What I was observing.... The majority of all downloads complete as expected. They unpack at the destination directory, within their respective sub-folder with expected permissions.

%Destination Dir%/<Directory of unpack successful download>/<files>

Permissions is permissive, nobody:user 0777

Roughly 10% of the downloads had a difference. While these downloads unpacked successfully and everything was successful in NZBget, they were not the same. These downloads new directory contained a sub-directory with the same name. The files therefore are one level deeper than expected, and the permission inheritance doesn't pass to it.

%Destination Dir%/<Directory of unpack successful download>/<Directory of unpack successful download>/<files>

The permission inheritance doesn't carry thru, it becomes 0644, so my network SMB mapping from my network clients cannot edit/delete.

Which downloads exhibited this behavior? After many months, narrowed it down to 'encrypted' downloads that were exhibiting this issue. All downloads that were not encrypted did not have this issue.

What have a tried to work around it?

I explored unrar command line flags that may influence this, but haven't had one that works.

In the meantime I used 'dupescore' to lower the score of releases commonly known to be encrypted, so unencrypted releases will be prioritized that don't create this addition level deeper sub-folder.

I've thought about writing a extension script, but thought I'd do some research to see if others were seeing this, and report it here first, in the event hugbug can reproduce and thinks this should be resolved in the main app.

Cheers -- Lev

Uukrull commented 2 years ago

Yes. I have the same issue and it's a relief I'm not the only one.

Hobbabobba commented 2 years ago

I am having exactly the same issue.

Hobbabobba commented 2 years ago

Found this script: https://github.com/chazlarson/NZBGetScripts/blob/master/ExtendedUnrar.py it might fix the problem.

veL556 commented 2 years ago

Found this script: https://github.com/chazlarson/NZBGetScripts/blob/master/ExtendedUnrar.py it might fix the problem.

Thanks for that suggesting that @Hobbabobba , I took a look at that script and while it did not match the issue I'm seeing, the script was simple enough that it gave me the confidence to write my own PostProcessing script and try Python.

After a few hours, I have a working script that is applied to a Category that all Encrypted NZBs are assigned to. Then the custom PostProcessing is enabled for that Category and it moves all the files in that extra nested sub-directory, up one level, then deletes the now empty sub-directory. I'm quite happy with this workaround and using it as a opportunity to learn a bit more about scripting and Python.