[mythtv-commits] Ticket #4860: Change scaled preview image filesystem permissions

MythTV mythtv at cvs.mythtv.org
Tue Mar 4 19:12:32 UTC 2008


#4860: Change scaled preview image filesystem permissions
----------------------------------------------+-----------------------------
 Reporter:  sphery <mtdean at thirdcontact.com>  |       Owner:  ijr    
     Type:  patch                             |      Status:  new    
 Priority:  minor                             |   Milestone:  unknown
Component:  mythtv                            |     Version:  head   
 Severity:  medium                            |     Mlocked:  0      
----------------------------------------------+-----------------------------
 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.

-- 
Ticket URL: <http://svn.mythtv.org/trac/ticket/4860>
MythTV <http://svn.mythtv.org/trac>
MythTV


More information about the mythtv-commits mailing list