public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/setup] update_services: Fix deprecation warnings on install/update
@ 2026-06-22 15:56 Panu Matilainen
  0 siblings, 0 replies; only message in thread
From: Panu Matilainen @ 2026-06-22 15:56 UTC (permalink / raw)
  To: git-commits

            A new commit has been pushed.

            Repo   : rpms/setup
            Branch : update_services
            Commit : ec9da3703ff6b3b5888287983bf28240c40e9a87
            Author : Panu Matilainen <pmatilai@redhat.com>
            Date   : 2024-12-27T20:52:51+00:00
            Stats  : +11/-6 in 1 file(s)
            URL    : https://src.fedoraproject.org/rpms/setup/c/ec9da3703ff6b3b5888287983bf28240c40e9a87?branch=update_services

            Log:
            Fix deprecation warnings on install/update

Use rpm.spawn() if available (in rpm >= 4.20) but fall back to
posix.fork() and friends if not to preserve upgrade path from
older versions.

---
diff --git a/setup.spec b/setup.spec
index dd2fd9a..56f6b02 100644
--- a/setup.spec
+++ b/setup.spec
@@ -112,17 +112,22 @@ EOF
 
 #throw away useless and dangerous update stuff until rpm will be able to
 #handle it ( http://rpm.org/ticket/6 )
+# Use rpm.spawn() if available (in >= 4.20) but fallback to forking if not
 %post -p <lua>
 for i, name in ipairs({"passwd", "shadow", "group", "gshadow"}) do
    os.remove("/etc/"..name..".rpmnew")
 end
 if posix.access("/usr/bin/newaliases", "x") then
-  local pid = posix.fork()
-  if pid == 0 then
-    posix.redirect2null(1)
-    posix.exec("/usr/bin/newaliases")
-  elseif pid > 0 then
-    posix.wait(pid)
+  if rpm.spawn ~= nil then
+    rpm.spawn({'/usr/bin/newaliases'}, {stdout='/dev/null'})
+  else
+    local pid = posix.fork()
+    if pid == 0 then
+      posix.redirect2null(1)
+      posix.exec("/usr/bin/newaliases")
+    elseif pid > 0 then
+      posix.wait(pid)
+    end
   end
 end
 

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-06-22 15:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-22 15:56 [rpms/setup] update_services: Fix deprecation warnings on install/update Panu Matilainen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox