Sanity check trigger scriptlet arguments on build
authorPanu Matilainen <pmatilai@redhat.com>
Mon, 12 Sep 2011 08:36:27 +0000 (11:36 +0300)
committerPanu Matilainen <pmatilai@redhat.com>
Mon, 12 Sep 2011 08:40:49 +0000 (11:40 +0300)
- Trigger scriptlets differ from other types in that additional
  arguments to scriptlet interpreter are not supported due to the
  way trigger data is stored in the header. Until now any extra
  arguments have just been quietly discarded, make it an hard
  error to avoid surprises.

build/parseScript.c

index 0a70ccd..45250a1 100644 (file)
@@ -316,6 +316,12 @@ int parseScript(rpmSpec spec, int parsePart)
     /* Trigger script insertion is always delayed in order to */
     /* get the index right.                                   */
     if (tag == RPMTAG_TRIGGERSCRIPTS) {
+       if (progArgc > 1) {
+           rpmlog(RPMLOG_ERR,
+             _("line %d: interpreter arguments not allowed in triggers: %s\n"),
+             spec->lineNum, prog);
+           goto exit;
+       }
        /* Add file/index/prog triple to the trigger file list */
        index = addTriggerIndex(pkg, file, p, progArgv[0], scriptFlags);