Mail Archives: djgpp-workers/1996/09/12/09:22:04
Hi Eli,
I have tested you make port and found some bugs:
1) You are using the external variables 'dos_status' and 'dos_command_running',
but 'dos_command_running' is nowhere defined and 'dos_status' is defined
only as static. These are only minor bugs, which can be solved with my
patch for 'job.c' or you can do it in an other way.
2) The next bug in job.c is much bigger which has to do with 'dos_bname',
please read my comments in the diff.
3) And the last thing has to do with your implementation of setting $SHELL.
I'm not aggree with you, to set this variable automatically every time.
I think, it should be set only in your way, when it is set explicit in
the makefile, because if you set it every time, all the makefiles are
broken, which do not set this variable and assume, that $SHELL points
to the default shell and most commands are executed without the shell.
But if you set this variable, it is in most case different from the default
shell and so every command will be executed by the shell.
Robert
The following patches are against the sources, when your patch is already
applied:
*** job.ori Wed Apr 26 21:13:56 1995
--- job.c Wed Sep 11 00:16:36 1996
***************
*** 29,35 ****
#ifdef __MSDOS__
#include <process.h>
static int dos_pid = 123;
! static int dos_status;
static char *dos_bname;
static char *dos_bename;
static int dos_batch_file;
--- 29,35 ----
#ifdef __MSDOS__
#include <process.h>
static int dos_pid = 123;
! int dos_status,dos_command_running;
static char *dos_bname;
static char *dos_bename;
static int dos_batch_file;
***************
*** 1377,1388 ****
dos_batch_file = 1;
if (dos_bname == 0)
{
! dos_bname = tempnam (".", "mk");
for (i = 0; dos_bname[i] != '\0'; ++i)
if (dos_bname[i] == '/')
dos_bname[i] = '\\';
dos_bename = (char *) xmalloc (strlen (dos_bname) + 5);
strcpy (dos_bename, dos_bname);
strcat (dos_bname, ".bat");
strcat (dos_bename, ".err");
}
--- 1377,1395 ----
dos_batch_file = 1;
if (dos_bname == 0)
{
! /* I call tmpnam() direct, because tempnam("...","...") does
! nothing else than calling tmpnam(NULL) RH. */
! dos_bname = tmpnam(NULL);
for (i = 0; dos_bname[i] != '\0'; ++i)
if (dos_bname[i] == '/')
dos_bname[i] = '\\';
dos_bename = (char *) xmalloc (strlen (dos_bname) + 5);
strcpy (dos_bename, dos_bname);
+ /* We must alloc dos_bname, because the returned string from
+ tmpnam() is a static buffer and may be overwritten (for me
+ this happens and bombs my system out!!! RH. */
+ dos_bname = (char *) xmalloc (strlen(dos_bname) + 5);
+ strcpy (dos_bname, dos_bename);
strcat (dos_bname, ".bat");
strcat (dos_bename, ".err");
}
*** variable.ori Wed Sep 11 00:11:38 1996
--- variable.c Wed Sep 11 00:20:42 1996
***************
*** 379,385 ****
which is just the default setting on many Makefiles. */
struct variable *shp = lookup_variable (shell_str, shlen);
! if (!shp || (!strcmp (shp->value, "/bin/sh") && shp->origin == o_file))
(void) define_variable (shell_str, shlen, comp->value, o_env, 0);
}
}
--- 379,391 ----
which is just the default setting on many Makefiles. */
struct variable *shp = lookup_variable (shell_str, shlen);
! /* Do not set $SHELL, when it is not defined, because this breaks
! most makefiles, which assumes no explicit $SHELL is set and
! want to run the commands without a shell. If we set $SHELL to
! $COMSPEC, ANY command will be executed by $COMSPEC, because it
! is in most cases different from default_shell, which is checked
! in construct_command_argv_internal() RH. */
! if (shp && (!strcmp (shp->value, "/bin/sh") && shp->origin == o_file))
(void) define_variable (shell_str, shlen, comp->value, o_env, 0);
}
}
- Raw text -