Current issues:
- At present, NZBDrone blindly tries to apply the requested file attributes (file date, owner, group, permissions) regardless of whether they can succeed.
- With the current master branch, a GUI setting of “None” for Change File Date generates the following warning when importing episodes: “Unable to set last write time: Invalid parameter”
- I believe the current wording in the GUI is incorrect for the options “File chmod mask” and “Folder chmod mask.” Instead these should probably read “File mode (octal)” and “Folder mode (octal).” A mask is generally set per-process and decrements a mode by a given amount. e.g. A process with a umask of 022 creating a file with no restrictions (777) will yield a file with mode 755. I don’t think that’s what was intended here.
I’m suggesting that the following logic be implemented on *nix for modifying file attributes including file date (modification time), file/folder owner (chown User), file/folder group (chown Group), and file/folder modes (File chmod mask/Folder chmod mask):
-
Is the NZBDrone process running as root?
Yes --> No further checks required. Super-user access.
No --> Will not be able to change file owner. Continue checking ability to modify remaining attributes. Continue to next check. -
Is target file owned by the same user as the NZBDrone process?
Yes --> Able to change mod time and perms. Can change group but ONLY to the NZBDrone process group or any supplementary groups of which the process user is a member of.
No --> Will not be able to change file group or permissions. Continue checking ability to modify file modification time. Continue to next check. -
Is the target file writable by the NZBDrone process?
Yes --> Able to change the file modification time.
No --> NZBDrone is unable to change any of the file attributes we are checking for.
The above logic should work across all *nix systems with very few exceptions e.g. a file/folder has been made immutable or the process is running with heightened security which removes its ability to change attributes.
It could also be handy if the GUI recognized if NZBDrone was running as root and, if not, removed the “chown User” option and looked up the supplementary groups it is a member of and listed those as the possible “chown Group” options with the disclaimer that only those files/folders owned by the NZBDrone process user would be modified.