Bug 2291927

Summary: deprecation warning in %postun when updating libgcc via dnf
Product: [Fedora] Fedora Reporter: Mark E. Fuller <mark.e.fuller>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: NEW --- QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: unspecified    
Version: 42CC: blind-confused, customercare, dmalcolm, fweimer, jakub, jlaw, josmyers, jwakely, mcermak, mpolacek, msebor, nickc, nixuser, noloader, rgibons, sipoyare
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Mark E. Fuller 2024-06-12 11:30:15 UTC
Terminal output:

Running post-uninstall scriptlet: libgcc-0:14.1.1-4.fc41.x86_64warning: posix.fork(): .fork(), .exec(), .wait() and .redirect2null() are deprecated, use rpm.execute() instead
warning: posix.wait(): .fork(), .exec(), .wait() and .redirect2null() are deprecated, use rpm.execute() instead


Reproducible: Always

Comment 1 Jonathan Wakely 2025-01-13 10:09:11 UTC
*** Bug 2337295 has been marked as a duplicate of this bug. ***

Comment 2 Jonathan Wakely 2025-01-15 13:11:08 UTC
*** Bug 2338127 has been marked as a duplicate of this bug. ***

Comment 3 Jonathan Wakely 2025-01-31 14:16:45 UTC
*** Bug 2343197 has been marked as a duplicate of this bug. ***

Comment 4 Jonathan Wakely 2025-01-31 14:25:53 UTC
(In reply to Mark E. Fuller from comment #0)
> warning: posix.wait(): .fork(), .exec(), .wait() and .redirect2null() are
> deprecated, use rpm.execute() instead

This RPM warning would be A LOT more helpful if it linked to:
https://rpm-software-management.github.io/rpm/manual/lua.html#executepath--arg1-

Trying to find that with a web search is hard.

I think we want this fix:

--- a/gcc.spec
+++ b/gcc.spec
@@ -2429,22 +2429,12 @@ fi
 # libgcc is installed
 %post -n libgcc -p <lua>
 if posix.access ("/sbin/ldconfig", "x") then
-  local pid = posix.fork ()
-  if pid == 0 then
-    posix.exec ("/sbin/ldconfig")
-  elseif pid ~= -1 then
-    posix.wait (pid)
-  end
+  rpm.execute('/sbin/ldconfig')
 end
 
 %postun -n libgcc -p <lua>
 if posix.access ("/sbin/ldconfig", "x") then
-  local pid = posix.fork ()
-  if pid == 0 then
-    posix.exec ("/sbin/ldconfig")
-  elseif pid ~= -1 then
-    posix.wait (pid)
-  end
+  rpm.execute('/sbin/ldconfig')
 end
 
 %ldconfig_scriptlets -n libstdc++

Comment 5 Florian Weimer 2025-01-31 14:28:42 UTC
(In reply to Jonathan Wakely from comment #4)
> --- a/gcc.spec
> +++ b/gcc.spec
> @@ -2429,22 +2429,12 @@ fi
>  # libgcc is installed
>  %post -n libgcc -p <lua>
>  if posix.access ("/sbin/ldconfig", "x") then
> -  local pid = posix.fork ()
> -  if pid == 0 then
> -    posix.exec ("/sbin/ldconfig")
> -  elseif pid ~= -1 then
> -    posix.wait (pid)
> -  end
> +  rpm.execute('/sbin/ldconfig')
>  end

You should check if you still need to run /sbin/ldconfig. Fedora default is to ship the symbolic links pre-installed.

If you need to keep this, you need to check if rpm.execute ~= nil and use the old code otherwise, to support in-place upgrades from older Fedora release/RHEL 10.

Comment 6 Jonathan Wakely 2025-01-31 14:46:48 UTC
rpm.execute is in rpm >= 4.15 which mean fedora 31 had it. I don't think we support in-place upgrades from F31 to F41. RHEL 9 has rpm 4.16 so this would only be a problem for in-place upgrade from RHEL 8 to some future version of RHEL that would rebase on the Fedora spec.

Comment 7 Jeffrey Walton 2025-01-31 15:08:15 UTC
(In reply to Jonathan Wakely from comment #6)
> rpm.execute is in rpm >= 4.15 which mean fedora 31 had it. I don't think we
> support in-place upgrades from F31 to F41. RHEL 9 has rpm 4.16 so this would
> only be a problem for in-place upgrade from RHEL 8 to some future version of
> RHEL that would rebase on the Fedora spec.

For Fedora using DNF (not RPM), Fedora supports a stride up to two. The most someone should perform is F31 -> F33. Also see <https://docs.fedoraproject.org/en-US/quick-docs/upgrading-fedora-offline/>.

I don't think I've seen Fedora documentation on using RPM to perform a system upgrade. Or I don't recall reading it.

Comment 8 Florian Weimer 2025-01-31 16:40:18 UTC
(In reply to Jonathan Wakely from comment #6)
> rpm.execute is in rpm >= 4.15 which mean fedora 31 had it. I don't think we
> support in-place upgrades from F31 to F41. RHEL 9 has rpm 4.16 so this would
> only be a problem for in-place upgrade from RHEL 8 to some future version of
> RHEL that would rebase on the Fedora spec.

Ahh, I didn't  realize that rpm.execute is not recent. With glibc, we also prefer the output redirection feature, and that is definitely quite recent.

Comment 9 Jonathan Wakely 2025-01-31 16:57:14 UTC
Yes rpm.spawn needs rpm >= 4.20

Comment 10 Jakub Jelinek 2025-01-31 16:58:13 UTC
So perhaps
--- gcc.spec	2025-01-30 18:47:39.793081153 +0100
+++ gcc.spec	2025-01-31 17:55:39.378072567 +0100
@@ -2424,28 +2424,20 @@ if [ $1 = 0 ]; then
   %{_sbindir}/update-alternatives --remove go %{_prefix}/bin/go.gcc
 fi
 
+%{?ldconfig:
 # Because glibc Prereq's libgcc and /sbin/ldconfig
 # comes from glibc, it might not exist yet when
 # libgcc is installed
 %post -n libgcc -p <lua>
-if posix.access ("/sbin/ldconfig", "x") then
-  local pid = posix.fork ()
-  if pid == 0 then
-    posix.exec ("/sbin/ldconfig")
-  elseif pid ~= -1 then
-    posix.wait (pid)
-  end
+if posix.access ("%ldconfig", "x") then
+  rpm.execute ("%ldconfig")
 end
 
 %postun -n libgcc -p <lua>
-if posix.access ("/sbin/ldconfig", "x") then
-  local pid = posix.fork ()
-  if pid == 0 then
-    posix.exec ("/sbin/ldconfig")
-  elseif pid ~= -1 then
-    posix.wait (pid)
-  end
+if posix.access ("%ldconfig", "x") then
+  rpm.execute ("%ldconfig")
 end
+}
 
 %ldconfig_scriptlets -n libstdc++
 
then to make it compatible with %ldconfig_scriptlets in /usr/lib/rpm/macros.d/macros.ldconfig ?

Comment 11 Jonathan Wakely 2025-02-06 09:49:05 UTC
*** Bug 2344146 has been marked as a duplicate of this bug. ***

Comment 12 Aoife Moloney 2025-02-26 13:03:51 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 42 development cycle.
Changing version to 42.