Applied patch from Francis Russell which should greatly speed up

make-style dependency checking in startpar (Fracis's test
suggest patch causes just 0.25% number of loop/dependency checks
compared to original.)
This should close Debian bugs which report startpar is bailing
out when checking dependencies.
Addresses Debian bugs #609959 and #696359.
This commit is contained in:
Jesse Smith 2018-11-16 21:08:56 -04:00
parent 1b92de5e0e
commit 3304abe230
3 changed files with 25 additions and 9 deletions

View File

@ -1,9 +1,16 @@
startpar 0.61
===============
* Applied signal patch from Petter Heinholdtsen which shoudl avoid
* Applied signal patch from Petter Heinholdtsen which should avoid
masking SIGINT to services.
Addresses Debian bug #679630
* Applied patch from Francis Russell which should greatly speed up
make-style dependency checking in startpar (Fracis's test
suggest patch causes just 0.25% number of loop/dependency checks
compared to original.)
This should close Debian bugs which report startpar is bailing
out when checking dependencies.
Addresses Debian bugs #609959 and #696359.
startpar 0.60

View File

@ -47,6 +47,8 @@ static int o_flags = O_RDONLY;
#endif
#include "makeboot.h"
static int check_loop(struct makenode *dep, struct makenode *src);
static int check_loop_helper(struct makenode *dep, struct makenode *src);
int tree_entries = 0;
struct makenode *tree_list = NULL;
@ -85,6 +87,7 @@ static struct makenode *add_target(const char *name)
}
memset(node, 0, alignof(struct makenode)+strsize(name));
node->name = ((char*)node)+alignof(struct makenode);
node->cycle_check_value = -1;
strcpy(node->name, name);
/* append to the list in alphabetical order */
@ -129,21 +132,27 @@ static struct makelist *new_list(struct makenode *node, struct makelist *next)
/*
* check whether the given target would create an infinte loop
*/
static int loop;
static int cycle_check_value;
static int check_loop(struct makenode *dep, struct makenode *src)
{
++cycle_check_value;
return check_loop_helper(dep, src);
}
static int check_loop_helper(struct makenode *dep, struct makenode *src)
{
if (dep->cycle_check_value == cycle_check_value)
return 0;
else
dep->cycle_check_value = cycle_check_value;
struct makelist *s;
for (s = dep->depend; s; s = s->next) {
if (s->node == src) {
fprintf(stderr, "loop exists %s in %s!\n", dep->name, src->name);
return 1;
}
if (loop++ > 99999) {
fprintf(stderr, "too many loops! (loop=%d, dep->name=%s, src->name=%s)\n",
loop, dep->name, src->name);
return 1;
}
if (check_loop(s->node, src))
if (check_loop_helper(s->node, src))
return 1;
}
return 0;
@ -157,7 +166,6 @@ static void add_depend(struct makenode *node, const char *dst)
struct makenode *dep;
dep = add_target(dst);
loop = 0;
if (check_loop(dep, node))
return;
dep->select = new_list(node, dep->select);

View File

@ -35,6 +35,7 @@ struct makenode {
struct makenode *next;
int interactive;
int importance;
int cycle_check_value;
int filter_prefix;
};