dcavalca / rpms / rpm

Forked from rpms/rpm 2 years ago
Clone

Blame rpm-4.14.3-fix-ambiguous-diagnostics-on-file-triggers.patch

James Antill ee2eaf
diff -up rpm-4.14.3/lib/rpmscript.c.orig rpm-4.14.3/lib/rpmscript.c
James Antill ee2eaf
--- rpm-4.14.3/lib/rpmscript.c.orig	2021-02-08 14:07:44.527197946 +0100
James Antill ee2eaf
+++ rpm-4.14.3/lib/rpmscript.c	2021-02-08 14:09:05.732749080 +0100
James Antill ee2eaf
@@ -46,27 +46,27 @@ struct scriptInfo_s {
James Antill ee2eaf
 };
James Antill ee2eaf
 
James Antill ee2eaf
 static const struct scriptInfo_s scriptInfo[] = {
James Antill ee2eaf
-    { RPMSCRIPT_PREIN, "%prein", 0,
James Antill ee2eaf
+    { RPMSCRIPT_PREIN, "prein", 0,
James Antill ee2eaf
 	RPMTAG_PREIN, RPMTAG_PREINPROG, RPMTAG_PREINFLAGS },
James Antill ee2eaf
-    { RPMSCRIPT_PREUN, "%preun", 0,
James Antill ee2eaf
+    { RPMSCRIPT_PREUN, "preun", 0,
James Antill ee2eaf
 	RPMTAG_PREUN, RPMTAG_PREUNPROG, RPMTAG_PREUNFLAGS },
James Antill ee2eaf
-    { RPMSCRIPT_POSTIN, "%post", 0,
James Antill ee2eaf
+    { RPMSCRIPT_POSTIN, "post", 0,
James Antill ee2eaf
 	RPMTAG_POSTIN, RPMTAG_POSTINPROG, RPMTAG_POSTINFLAGS },
James Antill ee2eaf
-    { RPMSCRIPT_POSTUN, "%postun", 0,
James Antill ee2eaf
+    { RPMSCRIPT_POSTUN, "postun", 0,
James Antill ee2eaf
 	RPMTAG_POSTUN, RPMTAG_POSTUNPROG, RPMTAG_POSTUNFLAGS },
James Antill ee2eaf
-    { RPMSCRIPT_PRETRANS, "%pretrans", 0,
James Antill ee2eaf
+    { RPMSCRIPT_PRETRANS, "pretrans", 0,
James Antill ee2eaf
 	RPMTAG_PRETRANS, RPMTAG_PRETRANSPROG, RPMTAG_PRETRANSFLAGS },
James Antill ee2eaf
-    { RPMSCRIPT_POSTTRANS, "%posttrans", 0,
James Antill ee2eaf
+    { RPMSCRIPT_POSTTRANS, "posttrans", 0,
James Antill ee2eaf
 	RPMTAG_POSTTRANS, RPMTAG_POSTTRANSPROG, RPMTAG_POSTTRANSFLAGS },
James Antill ee2eaf
-    { RPMSCRIPT_TRIGGERPREIN, "%triggerprein", RPMSENSE_TRIGGERPREIN,
James Antill ee2eaf
+    { RPMSCRIPT_TRIGGERPREIN, "triggerprein", RPMSENSE_TRIGGERPREIN,
James Antill ee2eaf
 	RPMTAG_TRIGGERPREIN, 0, 0 },
James Antill ee2eaf
-    { RPMSCRIPT_TRIGGERUN, "%triggerun", RPMSENSE_TRIGGERUN,
James Antill ee2eaf
+    { RPMSCRIPT_TRIGGERUN, "triggerun", RPMSENSE_TRIGGERUN,
James Antill ee2eaf
 	RPMTAG_TRIGGERUN, 0, 0 },
James Antill ee2eaf
-    { RPMSCRIPT_TRIGGERIN, "%triggerin", RPMSENSE_TRIGGERIN,
James Antill ee2eaf
+    { RPMSCRIPT_TRIGGERIN, "triggerin", RPMSENSE_TRIGGERIN,
James Antill ee2eaf
 	RPMTAG_TRIGGERIN, 0, 0 },
James Antill ee2eaf
-    { RPMSCRIPT_TRIGGERPOSTUN, "%triggerpostun", RPMSENSE_TRIGGERPOSTUN,
James Antill ee2eaf
+    { RPMSCRIPT_TRIGGERPOSTUN, "triggerpostun", RPMSENSE_TRIGGERPOSTUN,
James Antill ee2eaf
 	RPMTAG_TRIGGERPOSTUN, 0, 0 },
James Antill ee2eaf
-    { RPMSCRIPT_VERIFY, "%verify", 0,
James Antill ee2eaf
+    { RPMSCRIPT_VERIFY, "verify", 0,
James Antill ee2eaf
 	RPMTAG_VERIFYSCRIPT, RPMTAG_VERIFYSCRIPTPROG, RPMTAG_VERIFYSCRIPTFLAGS},
James Antill ee2eaf
     { 0, "unknown", 0,
James Antill ee2eaf
 	RPMTAG_NOT_FOUND, RPMTAG_NOT_FOUND, RPMTAG_NOT_FOUND }
James Antill ee2eaf
@@ -457,7 +457,7 @@ static const char * tag2sln(rpmTagVal ta
James Antill ee2eaf
 }
James Antill ee2eaf
 
James Antill ee2eaf
 static rpmScript rpmScriptNew(Header h, rpmTagVal tag, const char *body,
James Antill ee2eaf
-			      rpmscriptFlags flags)
James Antill ee2eaf
+			      rpmscriptFlags flags, const char *prefix)
James Antill ee2eaf
 {
James Antill ee2eaf
     char *nevra = headerGetAsString(h, RPMTAG_NEVRA);
James Antill ee2eaf
     rpmScript script = xcalloc(1, sizeof(*script));
James Antill ee2eaf
@@ -465,7 +465,7 @@ static rpmScript rpmScriptNew(Header h,
James Antill ee2eaf
     script->type = getScriptType(tag);
James Antill ee2eaf
     script->flags = flags;
James Antill ee2eaf
     script->body = (body != NULL) ? xstrdup(body) : NULL;
James Antill ee2eaf
-    rasprintf(&script->descr, "%s(%s)", tag2sln(tag), nevra);
James Antill ee2eaf
+    rasprintf(&script->descr, "%%%s%s(%s)", prefix, tag2sln(tag), nevra);
James Antill ee2eaf
 
James Antill ee2eaf
     /* macros need to be expanded before possible queryformat */
James Antill ee2eaf
     if (script->body && (script->flags & RPMSCRIPT_FLAG_EXPAND)) {
James Antill ee2eaf
@@ -556,6 +556,7 @@ rpmScript rpmScriptFromTriggerTag(Header
James Antill ee2eaf
     rpmScript script = NULL;
James Antill ee2eaf
     struct rpmtd_s tscripts, tprogs, tflags;
James Antill ee2eaf
     headerGetFlags hgflags = HEADERGET_MINMEM;
James Antill ee2eaf
+    const char *prefix = "";
James Antill ee2eaf
 
James Antill ee2eaf
     switch (tm) {
James Antill ee2eaf
 	case RPMSCRIPT_NORMALTRIGGER:
James Antill ee2eaf
@@ -567,11 +568,13 @@ rpmScript rpmScriptFromTriggerTag(Header
James Antill ee2eaf
 	    headerGet(h, RPMTAG_FILETRIGGERSCRIPTS, &tscripts, hgflags);
James Antill ee2eaf
 	    headerGet(h, RPMTAG_FILETRIGGERSCRIPTPROG, &tprogs, hgflags);
James Antill ee2eaf
 	    headerGet(h, RPMTAG_FILETRIGGERSCRIPTFLAGS, &tflags, hgflags);
James Antill ee2eaf
+	    prefix = "file";
James Antill ee2eaf
 	    break;
James Antill ee2eaf
 	case RPMSCRIPT_TRANSFILETRIGGER:
James Antill ee2eaf
 	    headerGet(h, RPMTAG_TRANSFILETRIGGERSCRIPTS, &tscripts, hgflags);
James Antill ee2eaf
 	    headerGet(h, RPMTAG_TRANSFILETRIGGERSCRIPTPROG, &tprogs, hgflags);
James Antill ee2eaf
 	    headerGet(h, RPMTAG_TRANSFILETRIGGERSCRIPTFLAGS, &tflags, hgflags);
James Antill ee2eaf
+	    prefix = "transfile";
James Antill ee2eaf
 	    break;
James Antill ee2eaf
     }
James Antill ee2eaf
 
James Antill ee2eaf
@@ -582,7 +585,8 @@ rpmScript rpmScriptFromTriggerTag(Header
James Antill ee2eaf
 	if (rpmtdSetIndex(&tflags, ix) >= 0)
James Antill ee2eaf
 	    sflags = rpmtdGetNumber(&tflags);
James Antill ee2eaf
 
James Antill ee2eaf
-	script = rpmScriptNew(h, triggerTag, rpmtdGetString(&tscripts), sflags);
James Antill ee2eaf
+	script = rpmScriptNew(h, triggerTag,
James Antill ee2eaf
+				rpmtdGetString(&tscripts), sflags, prefix);
James Antill ee2eaf
 
James Antill ee2eaf
 	/* hack up a hge-style NULL-terminated array */
James Antill ee2eaf
 	script->args = xmalloc(2 * sizeof(*script->args) + strlen(prog) + 1);
James Antill ee2eaf
@@ -608,7 +612,7 @@ rpmScript rpmScriptFromTag(Header h, rpm
James Antill ee2eaf
 
James Antill ee2eaf
 	script = rpmScriptNew(h, scriptTag,
James Antill ee2eaf
 			      headerGetString(h, scriptTag),
James Antill ee2eaf
-			      headerGetNumber(h, getFlagTag(scriptTag)));
James Antill ee2eaf
+			      headerGetNumber(h, getFlagTag(scriptTag)), "");
James Antill ee2eaf
 
James Antill ee2eaf
 	if (headerGet(h, progTag, &prog, (HEADERGET_ALLOC|HEADERGET_ARGV))) {
James Antill ee2eaf
 	    script->args = prog.data;