Index: conf.c =================================================================== RCS file: /cvsroot/poldek/poldek/conf.c,v retrieving revision 1.84 diff -u -r1.84 conf.c --- conf.c 27 Jun 2007 21:47:43 -0000 1.84 +++ conf.c 28 Jun 2007 15:47:04 -0000 @@ -944,6 +944,9 @@ addparam_flags |= ADD_PARAM_FOREIGN; } + if (flags & POLDEK_LDCONF_NOVALIDATE) + validate = 0; + if (flags & POLDEK_LDCONF_UPDATE) update = 1; Index: conf.h =================================================================== RCS file: /cvsroot/poldek/poldek/conf.h,v retrieving revision 1.18 diff -u -r1.18 conf.h --- conf.h 27 Jun 2007 00:44:47 -0000 1.18 +++ conf.h 28 Jun 2007 15:47:04 -0000 @@ -6,10 +6,11 @@ #include #include -#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: cli/main.c =================================================================== RCS file: /cvsroot/poldek/poldek/cli/main.c,v retrieving revision 1.56 diff -u -r1.56 main.c --- cli/main.c 27 Jun 2007 00:44:47 -0000 1.56 +++ cli/main.c 28 Jun 2007 15:47:05 -0000 @@ -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: tests/sh/04-conf =================================================================== RCS file: /cvsroot/poldek/poldek/tests/sh/04-conf,v retrieving revision 1.2 diff -u -r1.2 04-conf --- tests/sh/04-conf 27 Jun 2007 21:47:42 -0000 1.2 +++ tests/sh/04-conf 28 Jun 2007 15:47:05 -0000 @@ -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() {