Hi list!
There is a bug tracked in Red Hat bugzilla
http://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=219409
The problem is best demonstrated by this Makefile snippet:
all:;@echo e\
cho
With this make invocation, it works as intended:
$ make 'SHELL=/bin/sh'
echo
But when the SHELL variable contains quotes, it fails:
$ make 'SHELL="/bin/sh"'
e
/bin/sh: line 1: cho: command not found
make: *** [all] Error 127
The problem is that when SHELL contains quotations etc., /bin/sh is
invoked, and whole command is passed through that. But the outer shell
then destroys the backslash-newline sequences. The solution is to
singly-quote these. The attached patch against make 3.81 does this.
Testsuite passes. Comments welcome.
Thanks,
PM
--- make-3.81-orig/job.c 2007-02-21 19:10:54.000000000 +0100
+++ make-3.81-pm/job.c 2007-02-22 18:13:59.000000000 +0100
@@ -2706,7 +2706,7 @@
unsigned int line_len = strlen (line);
char *new_line = (char *) alloca (shell_len + (sizeof (minus_c) - 1)
- + (line_len * 2) + 1);
+ + (line_len * 4) + 1);
char *command_ptr = NULL; /* used for batch_mode_shell mode */
# ifdef __EMX__ /* is this necessary? */
@@ -2740,9 +2740,10 @@
#endif
if (PRESERVE_BSNL)
{
- *(ap++) = '\\';
+ *(ap++) = '\'';
*(ap++) = '\\';
*(ap++) = '\n';
+ *(ap++) = '\'';
}
++p;
_______________________________________________
Bug-make mailing list
Bug-make@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-make