Opened 12 years ago

Closed 10 years ago

#4860 closed patch (fixed)

Change scaled preview image filesystem permissions

Reported by: sphery <mtdean@…> Owned by: sphery
Priority: minor Milestone: unknown
Component: MythTV - General Version: head
Severity: medium Keywords:
Cc: Ticket locked: no

Description

The primary purpose of the attached patch, mythtv-scaled_preview_filesystem_permissions-makeFileAccessible.patch , is to modify the filesystem permissions of the scaled preview images created by MythXML to match the permissions of those created directly by the preview generator. Changesets [9566] and [9571] added a hack to allow all frontends/backends to access preview files even if the user fails to properly configure the umask/environment settings as required for their system configuration (i.e. with different users running mythfrontend/mythbackend or using NFS with different users/UID's on different hosts). Note that the patch does not modify permissions on any of the other images generated by MythXML (i.e. channel icons, album art images, ...).

When I mentioned the change in IRC, Daniel suggested that rather than duplicating the hack again, we should abstract the chmod hack to its own function so that we could easily modify it if we come up with a better solution or only apply the hack on a misconfigured system (if we add an approach to detect or allow the user to specify their system is misconfigured). Therefore, I added a function makeFileAccessible() that currently only contains the chmod hack. This replaces all calls to chmod in Myth code with the exception of one in dbutil.cpp which sets the permission of the defaults-extra-file (containing the DB password) to be readable only by the user--so it basically requires the opposite funtionality as provided by makeFileAccessible().

After removing the call to chmod, it appears that the #includes for <sys/types.h> and <sys/stat.h> are no longer necessary in datadirect.cpp or in previewgenerator.cpp. After removing them, I was able to compile without problems on my system. Therefore, I included an additional patch mythtv-scaled_preview_filesystem_permissions-makeFileAccessible-headers.patch , which removes the #includes. In previewgenerator.cpp , the #includes had comments specifying that they were used by stat, but I saw no use of *stat in the file, so without the chmod call, the includes should be unnecessary (as well as the #include <unistd.h>). Note, also, that <sys/types.h>, <sys/stat.h>, and <unistd.h> were double-included in previewgenerator.cpp, so they were removed twice.

If anyone has suggestions for additional code for makeFileAccessible() (i.e. to detect misconfigured systems so we only apply the hack when necessary), please let me know and I'll be happy to write it up.

Attachments (11)

mythtv-scaled_preview_filesystem_permissions-makeFileAccessible.patch (1.6 KB) - added by sphery <mtdean@…> 12 years ago.
mythtv-scaled_preview_filesystem_permissions-makeFileAccessible-headers.patch (929 bytes) - added by sphery <mtdean@…> 12 years ago.
mythtv-scaled_preview_filesystem_permissions-makeFileAccessible-20080307.patch (3.5 KB) - added by sphery <mtdean@…> 12 years ago.
Actually includes makeFileAccessible() function
mythtv-4860-scaled_preview_filesystem_permissions-makeFileAccessible.patch (3.4 KB) - added by sphery <mtdean@…> 12 years ago.
Updated patch for post-Qt4 trunk
mythtv-4860-scaled_preview_filesystem_permissions-makeFileAccessible-headers.patch (934 bytes) - added by sphery <mtdean@…> 12 years ago.
Updated patch for post-Qt4 trunk
mythtv-4860-scaled_preview_filesystem_permissions-makeFileAccessible-20080728.patch (3.6 KB) - added by sphery <mtdean@…> 11 years ago.
Updated for changes in trunk.
mythtv-4860-scaled_preview_filesystem_permissions-makeFileAccessible-headers-20080728.patch (1020 bytes) - added by sphery <mtdean@…> 11 years ago.
Updated for changes in trunk
mythtv-4860-scaled_preview_filesystem_permissions-makeFileAccessible-20080728-2.patch (3.6 KB) - added by sphery <mtdean@…> 11 years ago.
The correct updated patch ( mythtv-4860-scaled_preview_filesystem_permissions-makeFileAccessible-20080728.patch was missing a change)
mythtv-4860-scaled_preview_filesystem_permissions-makeFileAccessible-20080927.patch (3.8 KB) - added by sphery <mtdean@…> 11 years ago.
Updated patch for changes to util.h
mythtv-4860-scaled_preview_filesystem_permissions-makeFileAccessible.2.patch (3.8 KB) - added by sphery <mtdean@…> 11 years ago.
Updated patch.
mythtv-4860-scaled_preview_filesystem_permissions-makeFileAccessible-headers.2.patch (1018 bytes) - added by sphery <mtdean@…> 11 years ago.
Updated patch.

Download all attachments as: .zip

Change History (16)

Changed 12 years ago by sphery <mtdean@…>

Changed 12 years ago by sphery <mtdean@…>

comment:1 Changed 12 years ago by sphery <mtdean@…>

Forgot to include libs/libmyth/util.{h,cpp} when I ran svn diff (and somehow didn't notice), so the patch was missing the actual function. Updated patch, mythtv-scaled_preview_filesystem_permissions-makeFileAccessible-20080307.patch , replaces mythtv-scaled_preview_filesystem_permissions-makeFileAccessible.patch .

Changed 12 years ago by sphery <mtdean@…>

Actually includes makeFileAccessible() function

Changed 12 years ago by sphery <mtdean@…>

Updated patch for post-Qt4 trunk

Changed 12 years ago by sphery <mtdean@…>

Updated patch for post-Qt4 trunk

comment:2 Changed 12 years ago by sphery <mtdean@…>

mythtv-4860-scaled_preview_filesystem_permissions-makeFileAccessible.patch and mythtv-4860-scaled_preview_filesystem_permissions-makeFileAccessible-headers.patch are updated patches tested with post-Qt4 trunk.

Changed 11 years ago by sphery <mtdean@…>

Updated for changes in trunk.

Changed 11 years ago by sphery <mtdean@…>

Updated for changes in trunk

Changed 11 years ago by sphery <mtdean@…>

The correct updated patch ( mythtv-4860-scaled_preview_filesystem_permissions-makeFileAccessible-20080728.patch was missing a change)

comment:3 Changed 11 years ago by sphery <mtdean@…>

Updated patches to work with the recent changes to trunk that removed .ascii() calls. mythtv-4860-scaled_preview_filesystem_permissions-makeFileAccessible-20080728-2.patch and mythtv-4860-scaled_preview_filesystem_permissions-makeFileAccessible-headers-20080728.patch are the current set of patches. (I uploaded an old version with a missing change in mythtv-4860-scaled_preview_filesystem_permissions-makeFileAccessible-20080728.patch .)

Changed 11 years ago by sphery <mtdean@…>

Updated patch for changes to util.h

Changed 11 years ago by sphery <mtdean@…>

Updated patch.

Changed 11 years ago by sphery <mtdean@…>

Updated patch.

comment:4 Changed 10 years ago by stuartm

Component: mythtvMythTV - General
Owner: changed from Isaac Richards to sphery
Status: newassigned

comment:5 Changed 10 years ago by sphery

Resolution: fixed
Status: assignedclosed

(In [23113]) Make scaled preview image filesystem permissions match those of the "default-sized" preview images.

This change basically applies the same preview-image chmod 666 hack added in [9566] and [9571] to the preview images created by MythXML. Rather than replicate the hack, yet again, it moves the chmod to makeFileAccessible() in libs/libmyth/util.cpp and updates all the previous code to call that function.

The patch also removes some includes that no longer seem to be necessary after removing the calls to chmod(). Please send an e-mail to the list or mention on IRC if your compiler disagrees with me/my compiler.

Closes #4860 with patch from sphery.

Note: See TracTickets for help on using tickets.