On Tue, Mar 15, 2005 at 05:15:11PM +0100, matthieu castet wrote:
> I am not sure it is a dash bug, but this bug don't happen with bash and
> posh.
> 
> In dash if you do
> $ export CC=
> $ make
> Segmentation fault

Hi, I see two issues here.  The first is that dash puts 'CC' into the
environment and not 'CC=', which looks wrong to me:

$ env - dash -c 'export CC=; env'
PWD=/tmp
CC
$ 

The second is that make segfaults if it finds 'CC' in the environment as
you reported; I would consider that a bug in make.

Hi Herbert, I suggest the attached patch to fix the wrong environment.

Thanks, Gerrit.
Index: src/var.c
===================================================================
RCS file: /cvs/dash/src/var.c,v
retrieving revision 1.2
diff -u -r1.2 var.c
--- src/var.c   9 Jul 2004 19:10:17 -0000       1.2
+++ src/var.c   25 Mar 2005 08:10:23 -0000
@@ -232,7 +232,7 @@
        INTOFF;
        p = mempcpy(nameeq = ckmalloc(namelen + vallen + 2), name, namelen);
        *p++ = '\0';
-       if (vallen) {
+       if (val) {
                p[-1] = '=';
                p = mempcpy(p, val, vallen);
        }

Reply via email to