Shell avoidance in make-3.79.1-3 !! CORRECTED !! needs attention from cygwin MAKE maintainer

Bernard Dautrevaux Dautrevaux@microprocess.com
Tue Jun 26 11:53:00 GMT 2001


> -----Original Message-----
> From: Randall R Schulz [ mailto:rrschulz@cris.com ]
> Sent: Tuesday, June 26, 2001 4:26 PM
> To: cygwin@cygwin.com
> Subject: Re: Shell avoidance in make-3.79.1-3 [Correction]
> 
> 
> Earl,
> 
> I'm guessing it's the semicolon. You found the code where the 
> decision is 
> made, what does it say?
> 
> But... Following your lead, I looked at ps.c. What a mess.
> 
> CORRECTION: ... I looked at >>> job.c <<<.
> 
> 
> Look at line 2414. Search for "sh_chars_sh" which is used to inialize 
> "sh_chars" which is tested on line 2569.
> 
> Why is the semicolon there in your makefile, anyway?

The semicolon is needed to *introduce* the commands of the rule, otherwise
ps would be a dependency. The other way to do is replace the semicolon by
NL/TAB, but I use semicolon myself quite often when the rule is so simple.

Just a thought (I don't have make source available right on): is it possible
make keeps the semicolon in the rule command?

... searching ... found make-3.79.1 ... 

looking at read.c, in read_makefile the semicolon seems to be stripped from
the command, so that should be OK; there just some bizarre twiddling with
variable_expands somewhere the first time one set cmdleft, but I take for
granted it works at least a bit, and as it overwrites the semicolon by a
NUL,...

To understand more you should try to debug make. Just trying... 

$ configure
	...
$ make
	...
$ mkdir TEST
$ cd TEST
$ echo "all: ; ps" > Makefile
$ ../make
ps
  PID TTY          TIME CMD
18681 ttya0    00:00:00 csh
20969 ttya0    00:00:00 make
20970 ttya0    00:00:00 ps

Hey!... What's the problem? it works!... Oh wait, I'm working on a Linux box
here :-) is there a difference under cygwin?

bash-2.05$ mkdir TEST
bash-2.05$ echo "all: ; ps"
all: ; ps
bash-2.05$ echo "all: ; ps" > Makefile
bash-2.05$ make
ps
      PID    PPID    PGID     WINPID TTY  UID    STIME COMMAND
      159       1     159        159  -1  500 17:37:55 /usr/bin/sh
      467     159     467        487  -1  500 17:37:58 /usr/bin/bash
       95     467      95        499  -1  500 17:38:27 /usr/bin/make
      310      95      95        232  -1  500 17:38:27 /usr/bin/sh
      562     310      95        358  -1  500 17:38:27 /usr/bin/ps

Hey, don't work... So the problem is in some WIN32/Cygwin specific code...
but I'm not able to check now; you should try to do it yourself, compiling
make for debug, then trying to debug it with gdb.

Wait, I can try this; it's a little bit longer on cygwin than on Linux
(especially as I had to "unload" my PC for cygwin to be able to configure),
but its running smoothly and, BADANG:

$ cd TEST
$ ../make
ps
      PID    PPID    PGID     WINPID TTY  UID    STIME COMMAND
      302       1     302        302  -1  500 17:46:53 /usr/bin/bash
      500     302     500         73  -1  500 18:30:48
/cygdrive/y/WORK/V3/i486-unknown-linux/Import
ed/cygnus/make/make
      453     500     500        331  -1  500 18:30:48 /usr/bin/ps

IT WORKS!...

So what version am I using?
$ ../make --version
GNU Make version 3.79.1, by Richard Stallman and Roland McGrath.
Built for i686-pc-cygwin
Copyright (C) 1988, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000
        Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

Report bugs to <bug-make@gnu.org>.

$ type make
make is hashed (/usr/bin/make)

$ make --version
GNU Make version 3.79.1, by Richard Stallman and Roland McGrath.
Built for i686-pc-cygwin
Copyright (C) 1988, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000
        Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

Report bugs to <bug-make@gnu.org>.

It seems to be the same MAKE version, except that I just rebuild it, OOTB
:-), from the sources I downloaded from a cygwin mirror... (my installed.db
says the installed make is 3.79.1-3 and I'm quite sure the sources were got
at the same time).

So probably there's something in the environment of the cygwin make
maintainer ?-0 I can't say more, regretfully, but I hope this will allow to
understand what's happenning.

HTH,

	Bernard

PS: To whom it can help, putting the ps on a separate line with th
efollowing Makefile:

all:
	ps

does not change anything: my recompiled make works OK, the standard one sill
fork a shell to execute ps...

> 
> Randy
> 
> 
> At 17:10 2001-06-25, you wrote:
> >Randall R Schulz wrote:
> > > That leaves only the question: Why are you asking when you know
> > > already?
> >
> >The makefile:
> >
> >         all: ; ps
> >
> >tells me:
> >
> >bash-2.05$ make -f ../foo.mk
> >ps
> >       PID    PPID    PGID     WINPID TTY  UID    STIME COMMAND
> >       317       1     317        317  -1  500 14:59:36 /bin/bash
> >       461     317     461        549  -1  500 14:59:41 /usr/bin/make
> >       591     461     461        224  -1  500 14:59:41 /bin/sh
> >       662     591     461        585  -1  500 14:59:41 /usr/bin/ps
> >
> >that make is invoking /bin/sh in order to invoke /usr/bin/ps.
> >
> >Why isn't make invoking /usr/bin/ps directly?
> >
> >Earl
> 
> 
> --
> Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
> Bug reporting:         http://cygwin.com/bugs.html
> Documentation:         http://cygwin.com/docs.html
> FAQ:                   http://cygwin.com/faq/
> 

--------------------------------------------
Bernard Dautrevaux
Microprocess Ingenierie
97 bis, rue de Colombes
92400 COURBEVOIE
FRANCE
Tel:	+33 (0) 1 47 68 80 80
Fax:	+33 (0) 1 47 88 97 85
e-mail:	dautrevaux@microprocess.com
		b.dautrevaux@usa.net
-------------------------------------------- 

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list