public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Panu Matilainen <pmatilai@redhat.com>
To: git-commits@fedoraproject.org
Subject: [rpms/setup] update_services: Fix deprecation warnings on install/update
Date: Mon, 22 Jun 2026 15:56:24 GMT	[thread overview]
Message-ID: <178214378437.1.10075361576277963321.rpms-setup-ec9da3703ff6@fedoraproject.org> (raw)

            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
 

                 reply	other threads:[~2026-06-22 15:56 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=178214378437.1.10075361576277963321.rpms-setup-ec9da3703ff6@fedoraproject.org \
    --to=pmatilai@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