Allow pre- and posttrans to omit interpreter or body (again)
authorPanu Matilainen <pmatilai@redhat.com>
Thu, 1 Dec 2011 13:06:53 +0000 (15:06 +0200)
committerPanu Matilainen <pmatilai@redhat.com>
Thu, 1 Dec 2011 13:06:53 +0000 (15:06 +0200)
- While most scriptlets have both an interpreter and a body, neither
  is strictly required: body can be omitted in cases like special
  purpose executables (eg -p /sbin/ldconfig) and for interpreter,
  /bin/sh is used if missing. This has been "broken" from somewhere
  around rpm 4.7.x and nobody noticed :)

lib/rpmte.c

index ac1f1a4..5b5d2ad 100644 (file)
@@ -240,10 +240,10 @@ static void addTE(rpmte p, Header h, fnpyKey key, rpmRelocation * relocs)
     p->fi = getFI(p, h);
 
     /* See if we have pre/posttrans scripts. */
-    p->transscripts |= (headerIsEntry(h, RPMTAG_PRETRANS) &&
+    p->transscripts |= (headerIsEntry(h, RPMTAG_PRETRANS) ||
                         headerIsEntry(h, RPMTAG_PRETRANSPROG)) ?
                        RPMTE_HAVE_PRETRANS : 0;
-    p->transscripts |= (headerIsEntry(h, RPMTAG_POSTTRANS) &&
+    p->transscripts |= (headerIsEntry(h, RPMTAG_POSTTRANS) ||
                         headerIsEntry(h, RPMTAG_POSTTRANSPROG)) ?
                        RPMTE_HAVE_POSTTRANS : 0;