poldek: poldek/conf.c, poldek/conf.h, poldek/cli/main.c, poldek/te...

mis mis at pld-linux.org
Thu Jun 28 17:58:25 CEST 2007


Author: mis                          Date: Thu Jun 28 15:58:25 2007 GMT
Module: poldek                        Tag: HEAD
---- Log message:
- assertion failed when running as root (do_su())

---- Files affected:
poldek/poldek:
   conf.c (1.84 -> 1.85) , conf.h (1.18 -> 1.19) 
poldek/poldek/cli:
   main.c (1.56 -> 1.57) 
poldek/poldek/tests/sh:
   04-conf (1.2 -> 1.3) 

---- Diffs:

================================================================
Index: poldek/poldek/conf.c
diff -u poldek/poldek/conf.c:1.84 poldek/poldek/conf.c:1.85
--- poldek/poldek/conf.c:1.84	Wed Jun 27 23:47:43 2007
+++ poldek/poldek/conf.c	Thu Jun 28 17:58:20 2007
@@ -944,6 +944,9 @@
         addparam_flags |= ADD_PARAM_FOREIGN;
     }
 
+    if (flags & POLDEK_LDCONF_NOVALIDATE)
+        validate = 0;
+
     if (flags & POLDEK_LDCONF_UPDATE)
         update = 1;
 

================================================================
Index: poldek/poldek/conf.h
diff -u poldek/poldek/conf.h:1.18 poldek/poldek/conf.h:1.19
--- poldek/poldek/conf.h:1.18	Wed Jun 27 02:44:47 2007
+++ poldek/poldek/conf.h	Thu Jun 28 17:58:20 2007
@@ -6,10 +6,11 @@
 #include <trurl/narray.h>
 #include <trurl/nhash.h>
 
-#define POLDEK_LDCONF_FOREIGN     (1 << 0) /* not a poldek file */
-#define POLDEK_LDCONF_UPDATE      (1 << 1) /* resync with remote config */
-#define POLDEK_LDCONF_NOINCLUDE   (1 << 2) /* ignore %include directives */
-#define POLDEK_LDCONF_GLOBALONLY  (1 << 9) /* for early cachedir setup */
+#define POLDEK_LDCONF_FOREIGN     (1 << 0) /* not a poldek config file */
+#define POLDEK_LDCONF_NOVALIDATE  (1 << 1) /* do not validate config variables */
+#define POLDEK_LDCONF_UPDATE      (1 << 2) /* resync with remote config */
+#define POLDEK_LDCONF_NOINCLUDE   (1 << 3) /* ignore %include directives */
+#define POLDEK_LDCONF_GLOBALONLY  (1 << 4) /* for early cachedir setup */
 
 /* default localization is used if path is NULL */
 tn_hash *poldek_conf_load(const char *path, unsigned flags);

================================================================
Index: poldek/poldek/cli/main.c
diff -u poldek/poldek/cli/main.c:1.56 poldek/poldek/cli/main.c:1.57
--- poldek/poldek/cli/main.c:1.56	Wed Jun 27 02:44:47 2007
+++ poldek/poldek/cli/main.c	Thu Jun 28 17:58:20 2007
@@ -587,7 +587,8 @@
     } else if (noautosu == 0 && getuid() == 0) {  /* check config's runas */
         tn_hash *cnf;
         
-        cnf = poldek_conf_load_default(POLDEK_LDCONF_NOINCLUDE | POLDEK_LDCONF_FOREIGN);
+        cnf = poldek_conf_load_default(POLDEK_LDCONF_GLOBALONLY |
+                                       POLDEK_LDCONF_NOVALIDATE);
         if (cnf) {
             tn_hash *global;
             const char *u;

================================================================
Index: poldek/poldek/tests/sh/04-conf
diff -u poldek/poldek/tests/sh/04-conf:1.2 poldek/poldek/tests/sh/04-conf:1.3
--- poldek/poldek/tests/sh/04-conf:1.2	Wed Jun 27 23:47:42 2007
+++ poldek/poldek/tests/sh/04-conf	Thu Jun 28 17:58:20 2007
@@ -28,12 +28,43 @@
 
     is_verbose_mode && $poldek_l
 
-    n=$($poldek_l | grep -vE '^dbg:' | wc -l)
+    n=$($poldek_l | grep 'test://' | wc -l)
     assertEquals "2 sources expected" "$n" "2"
 
     n=$($poldek_l | grep -E '^test[12] ' | wc -l)
     assertEquals "2 sources expected, but not those" "$n" "2"
 }
+
+testConfAsRoot() 
+{
+    create_local_conf
+    msgn "--conf"
+    poldek_l="$POLDEK --conf $TMPDIR/poldek.conf -q  -l"
+
+    is_verbose_mode && $poldek_l
+
+    n=$(fakeroot $poldek_l | grep 'test://' | wc -l)
+    assertEquals "2 sources expected" "$n" "2"
+
+    n=$(fakeroot $poldek_l | grep -E '^test[12] ' | wc -l)
+    assertEquals "2 sources expected, but not those" "$n" "2"
+
+    msgn "default conf"
+    mkdir $TMPDIR/home || fail "mkdir"
+    mv -f $TMPDIR/poldek.conf $TMPDIR/home/.poldekrc
+    HOME=$TMPDIR/home
+    export HOME
+
+    poldek_l="$POLDEK -q -l"
+    is_verbose_mode && $poldek_l
+
+    n=$(fakeroot $poldek_l | grep 'test://' | wc -l)
+    assertEquals "2 sources expected" "$n" "2"
+
+    n=$(fakeroot $poldek_l | grep -E '^test[12] ' | wc -l)
+    assertEquals "2 sources expected, but not those" "$n" "2"
+}
+
 
 testConfInclude() 
 {
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/poldek/poldek/conf.c?r1=1.84&r2=1.85&f=u
    http://cvs.pld-linux.org/poldek/poldek/conf.h?r1=1.18&r2=1.19&f=u
    http://cvs.pld-linux.org/poldek/poldek/cli/main.c?r1=1.56&r2=1.57&f=u
    http://cvs.pld-linux.org/poldek/poldek/tests/sh/04-conf?r1=1.2&r2=1.3&f=u



More information about the pld-cvs-commit mailing list