Bug 1287918 - rpm lua scripts need a way to close stdout / stderr
rpm lua scripts need a way to close stdout / stderr
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: rpm (Show other bugs)
24
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: packaging-team-maint
Fedora Extras Quality Assurance
: Reopened
Depends On:
Blocks: 1288081
  Show dependency treegraph
 
Reported: 2015-12-02 19:29 EST by Zbigniew Jędrzejewski-Szmek
Modified: 2016-03-26 14:13 EDT (History)
6 users (show)

See Also:
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 14:13:30 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Zbigniew Jędrzejewski-Szmek 2015-12-02 19:29:00 EST
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 15:56:59 EST
https://github.com/rpm-software-management/rpm/pull/44
Comment 2 Ľuboš Kardoš 2016-02-19 09:32:13 EST
Please can you react on comment in pull request.
Comment 3 Zbigniew Jędrzejewski-Szmek 2016-02-19 09:39:23 EST
Yeah, sorry for the delay. It's on my list.
Comment 4 Jan Kurik 2016-02-24 09:05:13 EST
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 09:58:36 EST
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 10:03:13 EST
If F24 was possible, that'd be great.
Comment 8 Fedora Update System 2016-03-10 10:55:15 EST
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 14:27:27 EST
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 14:13:27 EDT
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.

Note You need to log in before you can comment on or make changes to this bug.