Project

General

Profile

Bug #2969

umask: inconsistent behaviour

Added by Dreamcat 4 over 9 years ago. Updated over 9 years ago.

Status:
Fixed
Priority:
Normal
Assignee:
Category:
PVR / DVR
Target version:
-
Start date:
2015-06-24
Due date:
% Done:

100%

Estimated time:
Found in version:
tvheadend: version 4.0.5-4~g7a7b3b3
Affected Versions:

Description

the process umask is only cleared when tvheadend is launched in daemon mode. Affects the file permissions for recordings.

This is a bug because the behaviour should apply equally (be consistent) whether the tvheadend server is launched in daemon mode as background or foreground task. Since those 2 features are independant to each other.

This code:

https://github.com/tvheadend/tvheadend/blob/3f4405eb55bf1b3329baf7b972d1d9e34c160fd7/src/main.c#L934

I think is desirable in all cases. Since with umask cleared to '0' then the recordings file permissions are exactly as user has set.

hans_s has given me a temporary workaround to make the behaviour consistent. Which is:

$ umask 0 ; tvheadend <flags>

I tried that and it fixed the bug so that the DVR profile directory permissions are correctly honored. Furthermore, the documentation states that:

"Note that the applicable umask applies, so 0777 with umask 0022 will produce 0755 (rwxr-xr-x). See also File permissions in Recording File Options."

http://docs.tvheadend.org/webui/config_dvr/#subdirectory-options

Which is not desirable behaviour.

I recommend:

  • 1. Clear umask always

or failing that:

  • At least be consistent in the behaviour.

It is a very simple code change (move the line 'umask 0' out of the if(fork) statement so it applies always). Then DVR file permissions should be respected regardless of the process umask.

The Documentation would also need a slight ammendment to remove that note about umask.

History

#1

Updated by S. Benz over 9 years ago

I would recommend to NOT clear umask globally, as the DVR recordings are not the only files created by tvheadend, and the umask should be respected for those other files.

My recommendation would be to explicitly call fchmod() on the DVR file descriptor after opening it (the permissions are currently passed as parameter to open(), which respects umask and therefore results in the reported behaviour). This solution would both respect umask for files created without explicit permissions and set the DVR file permissions exactly to the permissions set in the DVR profile.

#2

Updated by Jaroslav Kysela over 9 years ago

  • Status changed from New to Fixed
  • % Done changed from 0 to 100

Applied in changeset commit:tvheadend|d2cf4dd01c362b46a2701aa81148f6804efdefc6.

#3

Updated by Dreamcat 4 over 9 years ago

Thanks!

Also available in: Atom PDF