<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>12792</bug_id>
          
          <creation_ts>2018-06-18 09:14:37 +0000</creation_ts>
          <short_desc>RPM leaks pre-/postinstall scripts to /var/tmp</short_desc>
          <delta_ts>2018-07-05 11:43:44 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>7</classification_id>
          <classification>Build System, Metadata &amp; Runtime</classification>
          <product>OE-Core</product>
          <component>Scripts and Tools</component>
          <version>unspecified</version>
          <rep_platform>All</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>2.6 M2</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Olof Johansson">olof.johansson</reporter>
          <assigned_to name="Olof Johansson">olof.johansson</assigned_to>
          <cc>alex.kanavin</cc>
    
    <cc>olof.johansson</cc>
    
    <cc>richard.purdie</cc>
    
    <cc>ross.burton</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>No (bug/feature does not impact docs)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>80800</commentid>
    <comment_count>0</comment_count>
      <attachid>4327</attachid>
    <who name="Olof Johansson">olof.johansson</who>
    <bug_when>2018-06-18 09:14:37 +0000</bug_when>
    <thetext>Created attachment 4327
Always remove written tmp scriptlets

When running rpm with debug output enabled (as is the case when run from oe.package_manager), rpm will not clean up created scriptlet files as generated by mktemp &quot;/var/tmp/rpm-tmp.XXXXXX&quot; (see lib/rpmscript.c).

(Since this is not cleaned in any other way, the list of rpm-tmp files just keep growing until our developers face &quot;out of free space&quot; issues, because of no more free inodes.)

By patching rpm to make the removal unconditional, the problem goes away, but probably not the prettiest fix. Attaching such a patch only for reference.

This behavior was seen at least on Rocko and master (poky 0beae33, current at the time of writing).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>80839</commentid>
    <comment_count>1</comment_count>
    <who name="Olof Johansson">olof.johansson</who>
    <bug_when>2018-06-20 09:21:10 +0000</bug_when>
    <thetext>Forgot to mention: the leakage seems to happen during do_rootfs for RPM based images.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>80881</commentid>
    <comment_count>2</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2018-06-21 14:42:34 +0000</bug_when>
    <thetext>Hi, I think the best solution would be to apply this patch against rpm-native only. Could you send the patch please?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>80890</commentid>
    <comment_count>3</comment_count>
    <who name="Olof Johansson">olof.johansson</who>
    <bug_when>2018-06-21 15:49:33 +0000</bug_when>
    <thetext>Sure thing! I&apos;ll take a look at it on Monday, if not before. Happy midsummer... :-)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>80918</commentid>
    <comment_count>4</comment_count>
    <who name="Olof Johansson">olof.johansson</who>
    <bug_when>2018-06-25 12:35:37 +0000</bug_when>
    <thetext>Patch submitted!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>81012</commentid>
    <comment_count>5</comment_count>
    <who name="Olof Johansson">olof.johansson</who>
    <bug_when>2018-07-05 11:43:44 +0000</bug_when>
    <thetext>After with discussion with Alexander Kanavin, a variant of the patch I attached was accepted and is now integrated on master (poky 6d3617). The cause of this issue was related to how OE &quot;chroots&quot; rpm into the target sysroot, but this is not possible for all pre/postinst scriptlets, so the chrooting is avoided in this case. That leaves rpm writing tmp files in the host&apos;s /var/tmp. We now remove them even if we are running with debug output from rpm.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>4327</attachid>
            <date>2018-06-18 09:14:37 +0000</date>
            <delta_ts>2018-06-18 09:14:37 +0000</delta_ts>
            <desc>Always remove written tmp scriptlets</desc>
            <filename>0001-Always-remove-written-tmp-scriptlets-even-with-debug.patch</filename>
            <type>text/plain</type>
            <size>1021</size>
            <attacher name="Olof Johansson">olof.johansson</attacher>
            
              <data encoding="base64">RnJvbSBiNzRiNTQ5ZmY2MWFiOGEyYmRiMDQxZmViYmUxMzVhZDEwZmEzMDNjIE1vbiBTZXAgMTcg
MDA6MDA6MDAgMjAwMQpGcm9tOiBPbG9mIEpvaGFuc3NvbiA8b2xvZmpuQGF4aXMuY29tPgpEYXRl
OiBTdW4sIDE3IEp1biAyMDE4IDEyOjEyOjM2ICswMjAwClN1YmplY3Q6IFtQQVRDSF0gQWx3YXlz
IHJlbW92ZSB3cml0dGVuIHRtcCBzY3JpcHRsZXRzLCBldmVuIHdpdGggZGVidWdnaW5nCiBlbmFi
bGVkCgpBcyBkZWJ1Z2dpbmcgaXMgZW5hYmxlZCBieSBkZWZhdWx0IGluIG9wZW5lbWJlZGRlZCwg
YW5kIGVhY2ggc2NyaXB0bGV0CmlzIHdyaXR0ZW4gdG8gL3Zhci90bXAvcnBtLXRtcC5YWFhYWFgs
IGEgbG90IG9mIGZpbGVzIGdldCBjcmVhdGVkLiBTbwptYW55IHRoYXQgcGVvcGxlIHJ1biBvdXQg
b2YgaW5vZGVzLgoKVGhpcyBpcyBhIHF1aWNrIGZpeCB0byBhdm9pZCB0aGlzLiBJdCBkb2VzIGRl
Z3JhZGUgZnVuY3Rpb25hbGl0eSBmb3IKdGhvc2Ugd29ya2luZyB3aXRoIGRlYnVnZ2luZyBwcmUt
L3Bvc3RpbnRhbGwgc2NyaXB0cy4KClVwc3RyZWFtLVN0YXR1czogaW5hcHByb3ByaWF0ZSBbT0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