tags 694892 + patch
thanks

On Sat, 01 Dec 2012 21:36:19 +0100
Andreas Beckmann <deb...@abeckmann.de> wrote:
> 0m34.1s ERROR: FAIL: Package purging left files on system:
>   /root/.tvtime/       not owned
This is due to tvtime-configure being called in the postinst script.
tvtime-configure uses config_new() which in turn contains this code:

    /* Make the ~/.tvtime directory every time on startup, to be safe. */
    if( asprintf( &temp_dirname, "%s/.tvtime", getenv( "HOME" ) ) < 0 ) {
        /* FIXME: Clean up ?? */
        return 0;
    }
    mkdir_and_force_owner( temp_dirname, ct->uid, getgid() );
    free( temp_dirname );

Therefore, tvtime-configure creates $HOME/.tvtime everytime you
run it, even when the invocation is something like 
tvtime-configure -F /etc/tvtime/tvtime.xml

I have attached a patch which will fix the bug (that is, not create
$HOME/.tvtime on every run) but will still work correctly by creating
dirname(config_filename) before saving. I tested it by changing the
deinterlacing setting.

-- 
Best regards,
Michael
--- O/src/tvtimeconf.c	2005-09-08 06:07:56.000000000 +0200
+++ N/src/tvtimeconf.c	2012-12-02 23:53:09.119478245 +0100
@@ -34,6 +34,7 @@
 #include <errno.h>
 #include <libxml/parser.h>
 #include <math.h>
+#include <libgen.h>
 #ifdef HAVE_CONFIG_H
 # include "config.h"
 #endif
@@ -512,6 +513,13 @@
     xmlDocPtr doc;
     xmlNodePtr top;
     int create_file = 0;
+    char *temp_config;
+
+    if ((temp_config = strdup(config_filename)) == NULL) {
+        return 0;
+    }
+    mkdir_and_force_owner( dirname(temp_config), getuid(), getgid() );
+    free( temp_config );
 
     doc = xmlParseFile( config_filename );
     if( !doc ) {
@@ -844,14 +852,6 @@
     ct->buttonmapmenu[ 4 ] = TVTIME_MENU_UP;
     ct->buttonmapmenu[ 5 ] = TVTIME_MENU_DOWN;
 
-    /* Make the ~/.tvtime directory every time on startup, to be safe. */
-    if( asprintf( &temp_dirname, "%s/.tvtime", getenv( "HOME" ) ) < 0 ) {
-        /* FIXME: Clean up ?? */
-        return 0;
-    }
-    mkdir_and_force_owner( temp_dirname, ct->uid, getgid() );
-    free( temp_dirname );
-
     /* First read in global settings. */
     asprintf( &base, "%s/tvtime.xml", CONFDIR );
     if( file_is_openable_for_read( base ) ) {

Reply via email to