Hi,

        [Please retain the CC to [EMAIL PROTECTED] so
        that the bug tracking system can retain your input on this
        report]

        
 A makefile is at the bottom of this bug report. It is a (very) stripped down
version of a makefile from the debian package of X. Simply running "make"
on this Makefile causes make to output the following (caught in less).

joey@gumdrop:~/tmp>make -f Makefile.new 2>&1 |less
make: no-such-command: Command not found
<A0><FD>^N@<A0><FD>^N@echo hi
hi

Notice the high-bit characters. This is very disconcerting, to say the
least, when one runs make and gets their display messed up.

   ===
DUMMY:=$(shell exit 127)
all:
        echo hi
===

Note how it will print out garbage to stderr, before running the echo.

The problem is this.  A buffer is allocated, so that data read from the pipe
can be stored, for later assignment into whatever $(shell) is being assigned
to.  If there is any output, then the first byte of buffer will have valid
data, and the problem doesn't arise.

However, if the forked program outputs no data, then the first byte of the
buffer will be random garbage, and so fputs displays a random string on
stderr.
     
Note, that the child handler in make uses exit code 127 to communicate to the
parent make that the exec failed.  Explicitlly exitting with 127 works as
well, because the child handler passes the exit code on.
   
Anyways, here is the patch:
diff -ruN make-3.79.orig/function.c make-3.79/function.c
--- make-3.79.orig/function.c   Fri Jul 21 18:49:41 2000
+++ make-3.79/function.c        Fri Jul 21 18:40:22 2000
@@ -1431,6 +1431,7 @@

       maxlen = 200;
       buffer = (char *) xmalloc (maxlen + 1);
+      *buffer = 0;

       /* Read from the pipe until it gets EOF.  */
       i = 0;
===

-- 
 A good awakening have ever Gotama's disciples, whose recollection is
 always established, day and night on the Buddha. 296
Manoj Srivastava     <[EMAIL PROTECTED]>    <http://www.golden-gryphon.com/>
1024R/C7261095 print CB D9 F4 12 68 07 E4 05  CC 2D 27 12 1D F5 E8 6E
1024D/BF24424C print 4966 F272 D093 B493 410B  924B 21BA DABB BF24 424C

Reply via email to