Bug 212681

Summary: %pre scripts fail if /var/tmp is missing (rpm --root)
Product: Red Hat Enterprise Linux 3 Reporter: Aaron Hanson <a.hanson>
Component: rpmAssignee: Panu Matilainen <pmatilai>
Status: CLOSED WONTFIX QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 3.0   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2007-10-19 18:40:16 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Aaron Hanson 2006-10-27 23:50:53 UTC
Description of problem:
Doing a package install to an alternate root, %pre scripts will not run at all
if /var/tmp doesn't exist

Version-Release number of selected component (if applicable):
RPM version 4.2.3

How reproducible:
consistent

Steps to Reproduce:
1.make a trivial package with a %pre script
2.initialize an alternate root area:
  a. (rpm --initdb ...)
  b. get /bin/sh working in the chroot
3.install the package to the alternate root (rpm -i --root ...)
  
Actual results:
%pre scripts always fail, like this:
error:   install: %pre scriptlet failed (2), skipping ...

Additional info:
add step 2.c: mkdir /var/tmp in the chroot area; then the pre script will run...
per Jeff Johnson:
> Hmmm, I'm pretty sure that I added a lazy mkdir on /var/tmp the 14th 
> or 15th time I had to diagnose this problem years ago.

Comment 1 Jeff Johnson 2007-04-11 01:44:13 UTC
Yes, here's the lazy mkdir when creating temporary files in order to run scriptlets:

    /* Create the temp directory if it doesn't already exist. */
    /*@-branchstate@*/
    if (!_initialized) {
        _initialized = 1;
        tempfn = rpmGenPath(prefix, tpmacro, NULL);
        if (rpmioMkpath(tempfn, 0755, (uid_t) -1, (gid_t) -1))
            goto errxit;
    }

%pre scripts are run in lib/psm.c, with the scritlet written to a temp file created by makeTempFile().

WORKSFORME

Comment 2 RHEL Program Management 2007-10-19 18:40:16 UTC
This bug is filed against RHEL 3, which is in maintenance phase.
During the maintenance phase, only security errata and select mission
critical bug fixes will be released for enterprise products. Since
this bug does not meet that criteria, it is now being closed.
 
For more information of the RHEL errata support policy, please visit:
http://www.redhat.com/security/updates/errata/
 
If you feel this bug is indeed mission critical, please contact your
support representative. You may be asked to provide detailed
information on how this bug is affecting you.