On Fri, Mar 19, 2010 at 12:28 AM, Samuel Thibault <sthiba...@debian.org> wrote: (...) > Jérémie Koenig, le Fri 19 Mar 2010 00:15:15 +0100, a écrit : >> I've started tinkering with busybox, as suggested on the ideas pages, > > Ok, I realize I have forgotten to mention that I have already patched it > to get the .debs/udebs built (very crude patch). Of course, more work > is needed to re-enable the tools that will be needed during d-i.
I've only gotten as far as de-PATH_MAXing kconfig for now (patch attached, for what it's worth). Maybe you could send me your patch so I can start from there / polish them ? > (...) > Don't hesitate to come on both #hurd (freenode) and #debian-hurd (oftc). Ok, I'll meet you there! -- Jérémie Koenig <j...@jk.fr.eu.org> http://jk.fr.eu.org/
Index: busybox-1.15.3/scripts/basic/fixdep.c =================================================================== --- busybox-1.15.3.orig/scripts/basic/fixdep.c 2009-12-12 02:45:09.000000000 +0100 +++ busybox-1.15.3/scripts/basic/fixdep.c 2010-03-13 14:28:48.000000000 +0100 @@ -203,7 +203,7 @@ */ void use_config(char *m, int slen) { - char s[PATH_MAX]; + char *s = alloca(slen+1); char *p; if (is_defined_config(m, slen)) @@ -310,7 +310,7 @@ char *m = map; char *end = m + len; char *p; - char s[PATH_MAX]; + char *s = alloca(len); p = memchr(m, ':', len); if (!p) { Index: busybox-1.15.3/scripts/kconfig/confdata.c =================================================================== --- busybox-1.15.3.orig/scripts/kconfig/confdata.c 2009-12-12 02:45:09.000000000 +0100 +++ busybox-1.15.3/scripts/kconfig/confdata.c 2010-03-13 14:28:48.000000000 +0100 @@ -70,12 +70,13 @@ char *conf_get_default_confname(void) { struct stat buf; - static char fullname[PATH_MAX+1]; + static char *fullname = NULL; char *env, *name; name = conf_expand_value(conf_defname); env = getenv(SRCTREE); if (env) { + fullname = realloc(fullname, strlen(env) + strlen(name) + 2); sprintf(fullname, "%s/%s", env, name); if (!stat(fullname, &buf)) return fullname; Index: busybox-1.15.3/scripts/kconfig/mconf.c =================================================================== --- busybox-1.15.3.orig/scripts/kconfig/mconf.c 2009-12-12 02:45:09.000000000 +0100 +++ busybox-1.15.3/scripts/kconfig/mconf.c 2010-03-13 14:28:48.000000000 +0100 @@ -258,7 +258,7 @@ static char buf[4096], *bufptr = buf; static char input_buf[4096]; -static char filename[PATH_MAX+1] = ".config"; +static const char *filename = ".config"; static char *args[1024], **argptr = args; static int indent; static struct termios ios_org; Index: busybox-1.15.3/scripts/kconfig/zconf.l =================================================================== --- busybox-1.15.3.orig/scripts/kconfig/zconf.l 2009-12-12 02:45:09.000000000 +0100 +++ busybox-1.15.3/scripts/kconfig/zconf.l 2010-03-13 14:28:48.000000000 +0100 @@ -265,13 +265,14 @@ */ FILE *zconf_fopen(const char *name) { - char *env, fullname[PATH_MAX+1]; + char *env, *fullname; FILE *f; f = fopen(name, "r"); if (!f && name[0] != '/') { env = getenv(SRCTREE); if (env) { + fullname = alloca(strlen(env) + strlen(name) + 2); sprintf(fullname, "%s/%s", env, name); f = fopen(fullname, "r"); } Index: busybox-1.15.3/scripts/basic/docproc.c =================================================================== --- busybox-1.15.3.orig/scripts/basic/docproc.c 2010-03-13 14:33:49.000000000 +0100 +++ busybox-1.15.3/scripts/basic/docproc.c 2010-03-13 14:33:56.000000000 +0100 @@ -79,7 +79,9 @@ { pid_t pid; int ret; - char real_filename[PATH_MAX + 1]; + char *real_filename; + int rflen; + /* Make sure output generated so far are flushed */ fflush(stdout); switch(pid=fork()) { @@ -87,10 +89,11 @@ perror("fork"); exit(1); case 0: - memset(real_filename, 0, sizeof(real_filename)); - strncat(real_filename, getenv("SRCTREE"), PATH_MAX); - strncat(real_filename, KERNELDOCPATH KERNELDOC, - PATH_MAX - strlen(real_filename)); + rflen = strlen(getenv("SRCTREE")); + rflen += strlen(KERNELDOCPATH KERNELDOC); + real_filename = malloc(rflen + 1); + strcpy(real_filename, getenv("SRCTREE")); + strcat(real_filename, KERNELDOCPATH KERNELDOC); execvp(real_filename, svec); fprintf(stderr, "exec "); perror(real_filename); @@ -166,11 +169,10 @@ struct symfile *sym; char line[MAXLINESZ]; if (filename_exist(filename) == NULL) { - char real_filename[PATH_MAX + 1]; - memset(real_filename, 0, sizeof(real_filename)); - strncat(real_filename, getenv("SRCTREE"), PATH_MAX); - strncat(real_filename, filename, - PATH_MAX - strlen(real_filename)); + int rflen = strlen(getenv("SRCTREE")) + strlen(filename); + char *real_filename = alloca(rflen + 1); + strcpy(real_filename, getenv("SRCTREE")); + strcat(real_filename, filename); sym = add_new_file(filename); fp = fopen(real_filename, "r"); if (fp == NULL) Index: busybox-1.15.3/scripts/kconfig/Makefile =================================================================== --- busybox-1.15.3.orig/scripts/kconfig/Makefile 2010-03-13 14:34:32.000000000 +0100 +++ busybox-1.15.3/scripts/kconfig/Makefile 2010-03-13 14:48:11.000000000 +0100 @@ -269,3 +269,10 @@ cp $@ $...@_shipped endif + +# do this one nontheless +$(obj)/lex.zconf.c: $(src)/zconf.l +lex.%.c: %.l + flex -L -P$(notdir $*) -o$@ $< + cp $@ $...@_shipped +