Bug 12792 - RPM leaks pre-/postinstall scripts to /var/tmp
Summary: RPM leaks pre-/postinstall scripts to /var/tmp
Status: RESOLVED FIXED
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: Scripts and Tools (show other bugs)
Version: unspecified
Hardware: All Multiple
: Medium normal
Target Milestone: 2.6 M2
Assignee: Olof Johansson
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2018-06-18 09:14 UTC by Olof Johansson
Modified: 2018-07-05 11:43 UTC (History)
4 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments
Always remove written tmp scriptlets (1021 bytes, patch)
2018-06-18 09:14 UTC, Olof Johansson
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Olof Johansson 2018-06-18 09:14:37 UTC
Created attachment 4327 [details]
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 "/var/tmp/rpm-tmp.XXXXXX" (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 "out of free space" 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).
Comment 1 Olof Johansson 2018-06-20 09:21:10 UTC
Forgot to mention: the leakage seems to happen during do_rootfs for RPM based images.
Comment 2 Richard Purdie 2018-06-21 14:42:34 UTC
Hi, I think the best solution would be to apply this patch against rpm-native only. Could you send the patch please?
Comment 3 Olof Johansson 2018-06-21 15:49:33 UTC
Sure thing! I'll take a look at it on Monday, if not before. Happy midsummer... :-)
Comment 4 Olof Johansson 2018-06-25 12:35:37 UTC
Patch submitted!
Comment 5 Olof Johansson 2018-07-05 11:43:44 UTC
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 "chroots" 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's /var/tmp. We now remove them even if we are running with debug output from rpm.