Mail Archives: djgpp/1999/04/04/03:20:47
On Fri, 2 Apr 1999, Gisle Vanem wrote:
> I've discovered what I regard as a rather serious bug in make 3.77.
It's not a bug in Make, it's a DOS ``feature''.
> $(CP) expands to `' causing `libvgagl.a e:/djgpp/lib' to be executed.
> `CP = cp.exe' was in `makefile.cfg'.
>
> This "shell command" resulted in crash inside DOS (seg 273h) and some
> lost clusters. No serious harm done (chkdsk fixed it).
>
> What is make trying to do here?
It tried to invoke libvgagl.a as if it were a .COM-style executable.
The empty string is just a whitespace at the beginning of the
command: Make simply skips it, since valid command lines can have
leading whitespace.
> And how on earth can an archive be executed like this?
That's what DOS does, Make cannot do anything to prevent it. DOS
first looks for the "MZ" signature in the file, and if it isn't
present, assumes the file is a .COM image and ``runs'' it, with
obvious consequences.
Make cannot avoid this, because otherwise it would need to know about
all possible formats of executable files, including PE/NE executables,
.bat, .btm, Perl and whatever batch files/shell scripts, etc. It
currently only knows about a handful of these, and leaves the rest to
DOS and the user (you) to figure out.
- Raw text -