Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Build tools broken - nbmake



On Mon, Dec 01, 2008 at 10:32:46AM -0800, Paul Goyette wrote:
> On Mon, 1 Dec 2008, Paul Goyette wrote:
>
>> On Mon, 1 Dec 2008, Hisashi T Fujinaka wrote:
>>
>>> On Mon, 1 Dec 2008, Paul Goyette wrote:
>>>
>>>> On port amd64, with sources updated just minutes ago:
>>>>
>>>> ...
>>>> cc  -O -DDEFSHELL_CUSTOM="/bin/sh" -DHAVE_SETENV=1 -DHAVE_STRDUP=1  
>>>> -DHAVE_STRERROR=1 -DHAVE_STRFTIME=1 -DHAVE_VSNPRINTF=1  -c  
>>>> /build/netbsd-local/src/tools/make/../../usr.bin/make/lst.lib/lstSucc.c
>>>> cc  -O -o nbmake *.o
>>>> [1]   Segmentation fault (core dumped) "${make}" -m ${T...
>>>>
>>>> ERROR: raw_getmakevar TOOLCHAIN_MISSING: /tmp/nbbuild15746/nbmake failed
>>>> *** BUILD ABORTED ***
>>>
>>> It's an error in for.c, afaict.
>>
>> Yes, it seems so.  I have reverted to rev 1.32 of usr.bin/make/for.c 
>> and my build is proceeding normally.
>
> With big clue from cube@ I have applied the following patch, which seems  
> to make things work.
>
> Index: for.c
> ===================================================================
> RCS file: /cvsroot/src/usr.bin/make/for.c,v
> retrieving revision 1.33
> diff -u -p -r1.33 for.c
> --- for.c       30 Nov 2008 22:37:55 -0000      1.33
> +++ for.c       1 Dec 2008 18:29:41 -0000
> @@ -124,10 +124,10 @@ ForAddVar(const char *data, size_t len)
>       int nvars;
>
>       nvars = accumFor.nvars;
> -     accumFor.nvars = nvars + 1;
> +     accumFor.nvars = ++nvars;
>       accumFor.vars = bmake_realloc(accumFor.vars, nvars * sizeof(char *));
>
> -     accumFor.vars[nvars] = make_str(data, len);
> +     accumFor.vars[--nvars] = make_str(data, len);
>  }
>
>  /*-
>
>
> I have no idea if this is correct or complete, but it _does_ work.  :)

I don't think it is (but then I haven't committed my "fix", there's a
reason), because in a function name something_Add_something, I'd except
the array being reallocated to, well, grow by an element, as the
previous code did.

In my tree i simply changed nvars into accumFor.nvars in the realloc.

-- 
Quentin Garnier - cube%cubidou.net@localhost - cube%NetBSD.org@localhost
"See the look on my face from staying too long in one place
[...] every time the morning breaks I know I'm closer to falling"
KT Tunstall, Saving My Face, Drastic Fantastic, 2007.

Attachment: pgpBL8HMquOuz.pgp
Description: PGP signature



Home | Main Index | Thread Index | Old Index