public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Lubos Kardos <lkardos@redhat.com>
To: git-commits@fedoraproject.org
Subject: [rpms/rpm] pmatilai-v6: - Add posix.redirect2null
Date: Mon, 23 Nov 2026 09:29:58 GMT [thread overview]
Message-ID: <179542619882.1.10962346114590341793.rpms-rpm-0b025ec5a14b@fedoraproject.org> (raw)
A new commit has been pushed.
Repo : rpms/rpm
Branch : pmatilai-v6
Commit : 0b025ec5a14bdf16fb1db41fce16dba449f64e13
Author : Lubos Kardos <lkardos@redhat.com>
Date : 2016-03-10T15:31:16+01:00
Stats : +76/-1 in 2 file(s)
URL : https://src.fedoraproject.org/rpms/rpm/c/0b025ec5a14bdf16fb1db41fce16dba449f64e13?branch=pmatilai-v6
Log:
- Add posix.redirect2null
- Resolves: #1287918
---
diff --git a/rpm-4.13.0-redirect2null.patch b/rpm-4.13.0-redirect2null.patch
new file mode 100644
index 0000000..36d3885
--- /dev/null
+++ b/rpm-4.13.0-redirect2null.patch
@@ -0,0 +1,71 @@
+From 19fe0d9ae12644b8af9513aa2a8cf7d16f7caa61 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
+Date: Fri, 4 Mar 2016 16:40:30 -0500
+Subject: [PATCH] Add posix.redirect2null
+
+This is useful to silence output in forked programs:
+https://bugzilla.redhat.com/show_bug.cgi?id=1287918
+
+Tested with the following scriptlet:
+%post -p <lua>
+pid = posix.fork()
+if pid == 0 then
+ assert(posix.exec("/bin/sed"))
+elseif pid > 0 then
+ posix.wait(pid)
+end
+pid = posix.fork()
+if pid == 0 then
+ posix.redirect2null(2)
+ assert(posix.exec("/bin/awk"))
+elseif pid > 0 then
+ posix.wait(pid)
+end
+
+As expected, the error message from sed is printed, the error message
+from awk is not.
+---
+ luaext/lposix.c | 20 ++++++++++++++++++++
+ 1 file changed, 20 insertions(+)
+
+diff --git a/luaext/lposix.c b/luaext/lposix.c
+index 51ea2b3..c578c5a 100644
+--- a/luaext/lposix.c
++++ b/luaext/lposix.c
+@@ -819,6 +819,25 @@ static int Pmkstemp(lua_State *L)
+ return 2;
+ }
+
++static int Predirect2null(lua_State *L)
++{
++ int target_fd, fd, r, e;
++
++ if (!have_forked)
++ return luaL_error(L, "silence_file_descriptor not permitted in this context");
++
++ target_fd = luaL_checkinteger(L, 1);
++
++ r = fd = open("/dev/null", O_WRONLY);
++ if (fd >= 0 && fd != target_fd) {
++ r = dup2(fd, target_fd);
++ e = errno;
++ (void) close(fd);
++ errno = e;
++ }
++ return pushresult(L, r, NULL);
++}
++
+ static const luaL_Reg R[] =
+ {
+ {"access", Paccess},
+@@ -861,6 +880,7 @@ static const luaL_Reg R[] =
+ {"wait", Pwait},
+ {"setenv", Psetenv},
+ {"unsetenv", Punsetenv},
++ {"redirect2null", Predirect2null},
+ {NULL, NULL}
+ };
+
+--
+1.9.3
+
diff --git a/rpm.spec b/rpm.spec
index ff7f83a..744e63e 100644
--- a/rpm.spec
+++ b/rpm.spec
@@ -29,7 +29,7 @@
Summary: The RPM package management system
Name: rpm
Version: %{rpmver}
-Release: %{?snapver:0.%{snapver}.}26%{?dist}
+Release: %{?snapver:0.%{snapver}.}27%{?dist}
Group: System Environment/Base
Url: http://www.rpm.org/
Source0: http://rpm.org/releases/rpm-4.12.x/%{name}-%{srcver}.tar.bz2
@@ -72,6 +72,7 @@ Patch116: rpm-4.13.0-idle-and-sleep-in-systemd-inhibit.patch
Patch117: rpm-4.13.0-add-mipsr6-support.patch
Patch118: rpm-4.13.0-Use-pkg-dpaths-during-dependency-generation.patch
Patch119: rpm-4.13.0-Noarch-ExclusiveArch.patch
+Patch120: rpm-4.13.0-redirect2null.patch
# These are not yet upstream
Patch302: rpm-4.7.1-geode-i686.patch
@@ -583,6 +584,9 @@ exit 0
%doc doc/librpm/html/*
%changelog
+* Thu Mar 10 2016 Lubos Kardos <lkardos@redhat.com> 4.13.0-0.rc1.27
+- Add posix.redirect2null (#1287918)
+
* Fri Feb 26 2016 Florian Festi <ffesti@rpm.org> - 4.4.13.0-0.rc1.26
- Fix ExclusiveArch/ExcludeArch for noarch packages (#1298668)
reply other threads:[~2026-11-23 9:29 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=179542619882.1.10962346114590341793.rpms-rpm-0b025ec5a14b@fedoraproject.org \
--to=lkardos@redhat.com \
--cc=git-commits@fedoraproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox