Bug 1287918

Summary: rpm lua scripts need a way to close stdout / stderr
Product: [Fedora] Fedora Reporter: Zbigniew Jędrzejewski-Szmek <zbyszek>
Component: rpmAssignee: Packaging Maintenance Team <packaging-team-maint>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 24CC: jzeleny, lkardos, novyjindrich, packaging-team-maint, pknirsch, zbyszek
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: rpm-4.13.0-0.rc1.26.fc24 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-03-26 18:13:30 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1288081    

Description Zbigniew Jędrzejewski-Szmek 2015-12-03 00:29:00 UTC
Description of problem:
Scriptlets often need to redirect output to /dev/null, for example when calling external programs. How to do this in lua without starting a shell?

This works in plain lua but not in rpm:

posix = require 'posix'
pid = posix.fork()
if pid == 0 then
    posix.close(2)
    posix.open("/dev/null")
    assert(posix.exec("/bin/systemctl", "daemon-reload"))
elseif pid > 0 then
    posix.wait(pid)
end

I asked on the mailing list, but got not response:
http://lists.rpm.org/pipermail/rpm-ecosystem/2015-November/000287.html

Comment 1 Zbigniew Jędrzejewski-Szmek 2016-01-14 20:56:59 UTC
https://github.com/rpm-software-management/rpm/pull/44

Comment 2 Ľuboš Kardoš 2016-02-19 14:32:13 UTC
Please can you react on comment in pull request.

Comment 3 Zbigniew Jędrzejewski-Szmek 2016-02-19 14:39:23 UTC
Yeah, sorry for the delay. It's on my list.

Comment 4 Jan Kurik 2016-02-24 14:05:13 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 24 development cycle.
Changing version to '24'.

More information and reason for this action is here:
https://fedoraproject.org/wiki/Fedora_Program_Management/HouseKeeping/Fedora24#Rawhide_Rebase

Comment 6 Ľuboš Kardoš 2016-03-10 14:58:36 UTC
Your pull request was accepted upstream and I also pushed patch into rawhide (rpm-4.13.0-0.rc1.27.fc25) and I am closing this bug. If you need this to be fixed also in f24, f23 or f22 then please reopen this bug.

Comment 7 Zbigniew Jędrzejewski-Szmek 2016-03-10 15:03:13 UTC
If F24 was possible, that'd be great.

Comment 8 Fedora Update System 2016-03-10 15:55:15 UTC
rpm-4.13.0-0.rc1.26.fc24 has been submitted as an update to Fedora 24. https://bodhi.fedoraproject.org/updates/FEDORA-2016-fbc487888f

Comment 9 Fedora Update System 2016-03-11 19:27:27 UTC
rpm-4.13.0-0.rc1.26.fc24 has been pushed to the Fedora 24 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-fbc487888f

Comment 10 Fedora Update System 2016-03-26 18:13:27 UTC
rpm-4.13.0-0.rc1.26.fc24 has been pushed to the Fedora 24 stable repository. If problems still persist, please make note of it in this bug report.