[SV #39035] Compare OUT to the beginning of the OUT var/func, not IN.
authorPaul Smith <psmith@gnu.org>
Sun, 26 May 2013 17:56:51 +0000 (13:56 -0400)
committerPaul Smith <psmith@gnu.org>
Sun, 26 May 2013 17:56:51 +0000 (13:56 -0400)
ChangeLog
job.c
tests/ChangeLog
tests/scripts/misc/bs-nl

index 8499e9b..e4f9130 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2013-05-26  Paul Smith  <psmith@gnu.org>
+
+       * job.c (new_job): Compare OUT to the beginning of the OUT
+       var/function, not IN.  Fixes Savannah bug #39035.
+
 2013-05-22  Paul Smith  <psmith@gnu.org>
 
        * main.c (switches[]): Order switches so simple flags all come first.
diff --git a/job.c b/job.c
index 5f665a9..507b90d 100644 (file)
--- a/job.c
+++ b/job.c
@@ -2036,10 +2036,12 @@ new_job (struct file *file)
             {
               char openparen = *ref;
               char closeparen = openparen == '(' ? ')' : '}';
+              char *outref;
               int count;
               char *p;
 
               *out++ = *in++;   /* Copy OPENPAREN.  */
+              outref = out;
               /* IN now points past the opening paren or brace.
                  Count parens or braces until it is matched.  */
               count = 0;
@@ -2072,7 +2074,7 @@ new_job (struct file *file)
 
                           /* Discard any preceding whitespace that has
                              already been written to the output.  */
-                          while (out > ref
+                          while (out > outref
                                  && isblank ((unsigned char)out[-1]))
                             --out;
 
index 20c770e..1f93930 100644 (file)
@@ -1,3 +1,7 @@
+2013-05-26  Paul Smith  <psmith@gnu.org>
+
+       * scripts/misc/bs-nl: Test for Savannah bug #39035.
+
 2013-05-22  Paul Smith  <psmith@gnu.org>
 
        * scripts/options/dash-n: Fix results after MAKEFLAGS fixes.
index e27a3f7..aa7661e 100644 (file)
@@ -99,4 +99,26 @@ var = he\
 var:;@echo '|$(var)|'!,
               '', "|he   llo|");
 
+# Savannah #39035: handle whitespace in call
+run_make_test(q!
+f = echo $(1)
+t:; @$(call f,"a \
+            b"); \
+        $(call f,"a \
+            b")
+!,
+              '', "a b\na b\n");
+
+# Savannah #38945: handle backslash CRLF
+# We need our own makefile so we can set binmode
+my $m1 = get_tmpfile();
+open(MAKEFILE, "> $m1");
+binmode(MAKEFILE);
+print MAKEFILE "FOO = foo \\\r\nbar\nall: ; \@echo \$(FOO)\n";
+close(MAKEFILE);
+
+run_make_with_options($m1, '', get_logfile());
+compare_output("foo bar\n", get_logfile(1));
+
+
 1;