Bug 2291927 - deprecation warning in %postun when updating libgcc via dnf
Summary: deprecation warning in %postun when updating libgcc via dnf
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: gcc
Version: 42
Hardware: x86_64
OS: Linux
unspecified
low
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
: 2337295 2338127 2343197 2344146 2391722 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2024-06-12 11:30 UTC by Mark E. Fuller
Modified: 2026-06-08 15:51 UTC (History)
16 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2026-06-08 15:51:08 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

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.

Comment 13 customercare 2025-06-25 20:42:19 UTC
also in f41

Comment 14 Jonathan Wakely 2025-08-29 08:29:36 UTC
*** Bug 2391722 has been marked as a duplicate of this bug. ***

Comment 15 Fedora Release Engineering 2026-05-06 11:43:02 UTC
This message is a reminder that Fedora Linux 42 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora Linux 42 on 2026-05-13.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
'version' of '42'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, change the 'version' 
to a later Fedora Linux version. Note that the version field may be hidden.
Click the "Show advanced fields" button if you do not see it.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora Linux 42 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora Linux, you are encouraged to change the 'version' to a later version
prior to this bug being closed.

Comment 16 Aoife Moloney 2026-06-08 15:51:08 UTC
Fedora Linux 42 entered end-of-life (EOL) status on 2026-05-27.

Fedora Linux 42 is no longer maintained, which means that it
will not receive any further security or bug fix updates. As a result we
are closing this bug.

If you can reproduce this bug against a currently maintained version of Fedora Linux
please feel free to reopen this bug against that version. Note that the version
field may be hidden. Click the "Show advanced fields" button if you do not see
the version field.

If you are unable to reopen this bug, please file a new report against an
active release.

Thank you for reporting this bug and we are sorry it could not be fixed.


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