teknoraver / rpms / rpm

Forked from rpms/rpm 4 months ago
Clone

Blame rpm-4.11.2-macro-newlines.patch

Panu Matilainen 98f66a
commit 1bdcd0500865efd3566efd7f951228f69b58e755
Panu Matilainen 98f66a
Author: Panu Matilainen <pmatilai@redhat.com>
Panu Matilainen 98f66a
Date:   Wed Feb 19 14:16:38 2014 +0200
Panu Matilainen 98f66a
Panu Matilainen 98f66a
    Dont eat newlines on parametrized macro invocations (RhBug:1045723)
Panu Matilainen 98f66a
    
Panu Matilainen 98f66a
    - Makes the testcase from commit f082b5baa4dcf9601eeb1e0e520ff06e77dc61c0
Panu Matilainen 98f66a
      succeed. While the old behavior is non-sensical and most likely entirely
Panu Matilainen 98f66a
      unintentional, we're changing a very long-standing behavior here (tested
Panu Matilainen 98f66a
      back to rpm 4.4.x and almost certainly much much older than that) so
Panu Matilainen 98f66a
      its entirely possible people are actually relying on the old
Panu Matilainen 98f66a
      behavior. Lets see what breaks...
Panu Matilainen 98f66a
Panu Matilainen 98f66a
diff --git a/rpmio/macro.c b/rpmio/macro.c
Panu Matilainen 98f66a
index e1c2a91..72471a2 100644
Panu Matilainen 98f66a
--- a/rpmio/macro.c
Panu Matilainen 98f66a
+++ b/rpmio/macro.c
Panu Matilainen 98f66a
@@ -764,7 +764,7 @@ grabArgs(MacroBuf mb, const rpmMacroEntry me, const char * se,
Panu Matilainen 98f66a
 
Panu Matilainen 98f66a
 exit:
Panu Matilainen 98f66a
     argvFree(argv);
Panu Matilainen 98f66a
-    return *lastc ? lastc + 1 : lastc; 
Panu Matilainen 98f66a
+    return (*lastc == '\0' || *lastc == '\n') ? lastc : lastc + 1;
Panu Matilainen 98f66a
 }
Panu Matilainen 98f66a
 
Panu Matilainen 98f66a
 /**