dcavalca / rpms / rpm

Forked from rpms/rpm 2 years ago
Clone

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

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