From: Michal J. <mi...@ha...> - 2004-08-10 21:26:50
|
There is a bug in a function show_deps(), modhelper.c, from beoboot-cm1.9. The code goes like that: while (p && *p) { np = strchr(p, ','); printf("%.*s", np-p, p) If there is no comma in a string p then np is set to NULL and np-p may overflow the second argument to printf which happens to be int. When this happens, which is pretty likely on 64-bit platforms, then printf errors out, returns a negaive value and nothing is printed. If you wonder I got hit by that. :-) On x86 you may usually get away with this. Here is a fix: --- beoboot-cm1.9/modhelper.c~ 2004-04-19 11:07:31.000000000 -0600 +++ beoboot-cm1.9/modhelper.c 2004-08-10 15:00:13.377034440 -0600 @@ -236,11 +236,13 @@ p = deps; while (p && *p) { np = strchr(p, ','); - printf("%.*s", np-p, p); - if (np) { - printf(" "); + if (np != NULL) { + printf("%.*s ", (int)(np-p), p); np++; } + else { + printf("%s", p); + } p = np; } printf("\n"); OTOH 'modhelper -d' is used in /usr/bin/beoboot script only in this function: module_dep() { local MODDIR="$1" local MOD="$2" local DEPS= local dep DEPS=`module_expand $MODDIR \`$BEOLIB/bin/modhelper -d "$MOD"\`` for dep in $DEPS; do echo "$dep" module_dep "$MODDIR" "$dep" done } which could be simply rewritten as module_dep() { [ -r "$1/modules.dep" ] || depmod sed -n 's!'"$2"': *!!p' "$1/modules.dep" } making all this recursion unnecessary (and skirting the bug in the process). Michal |