public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Yaakov Selkowitz <yselkowi@redhat.com>
To: git-commits@fedoraproject.org
Subject: [rpms/flatpak-runtime-config] f45: Enable dynamic ld.so.cache generation
Date: Thu, 10 Sep 2026 21:21:58 GMT	[thread overview]
Message-ID: <178907531850.1.9423567153216324165.rpms-flatpak-runtime-config-641ea400561c@fedoraproject.org> (raw)

            A new commit has been pushed.

            Repo   : rpms/flatpak-runtime-config
            Branch : f45
            Commit : 641ea400561c1c79405c4e88aa248c8add914e19
            Author : Yaakov Selkowitz <yselkowi@redhat.com>
            Date   : 2024-12-10T17:45:54-05:00
            Stats  : +12/-3 in 1 file(s)
            URL    : https://src.fedoraproject.org/rpms/flatpak-runtime-config/c/641ea400561c1c79405c4e88aa248c8add914e19?branch=f45

            Log:
            Enable dynamic ld.so.cache generation

Using LD_LIBRARY_PATH for adding to the default library search path is not
always reliable, as sometimes subprocesses may be launched without this
environment variable, which may cause it to fail if it needs libraries
outside of the runtime.

Instead, we should follow the lead of Flathub flatpaks, and use dynamic
ld.so.cache generation instead.  This automatically creates (or updates) a
cache file in ~/.var/app/$APP_ID/.ld.so/ based on the runtime, app, and any
extensions, and works even for subprocesses with a limited environment.

To implement this, in addition to the changes here, the runtimes need to
*not* pass --env=LD_LIBRARY_PATH, and add the following to finish-args:

    # enable dynamic ld.so.cache generation
    [ -e /usr/bin/ldconfig ] || ln -s ../sbin/ldconfig /usr/bin/ldconfig
    cat /etc/ld.so.conf.d/*.conf > /etc/ld.so.conf
    rm -f /etc/ld.so.conf.d/*.conf

This is necessary because the feature requires ldconfig in /bin (where we
still have a separate /sbin), and the code is not designed to handle
/etc/ld.so.conf.d/*.conf.  This also allows %_sysconfdir/ld.so.conf.d to
work for both RPM builds and flatpak apps rather than having to defining
--env=LD_LIBRARY_PATH in the app too.

https://github.com/flatpak/flatpak/blob/1.15.12/common/flatpak-run.c#L2663
https://github.com/flatpak/flatpak/blob/1.15.12/common/flatpak-run.c#L3083

Fixes: rhbz#2272376

---
diff --git a/flatpak-runtime-config.spec b/flatpak-runtime-config.spec
index 96bd386..254f9eb 100644
--- a/flatpak-runtime-config.spec
+++ b/flatpak-runtime-config.spec
@@ -4,7 +4,7 @@
 
 Name:           flatpak-runtime-config
 Version:        41
-Release:        1%{?dist}
+Release:        2%{?dist}
 Summary:        Configuration files that live inside the flatpak runtime
 Source1:        50-flatpak.conf
 Source2:        sitecustomize.py
@@ -67,7 +67,13 @@ sed -e 's|%%{_libdir}|%{_libdir}|' \
     %{SOURCE3} > $RPM_BUILD_ROOT%{_sysconfdir}/flatpak-builder/defaults.json
 
 mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/ld.so.conf.d/
-echo "/app/%{_lib}" > $RPM_BUILD_ROOT%{_sysconfdir}/ld.so.conf.d/app.conf
+cat > $RPM_BUILD_ROOT%{_sysconfdir}/ld.so.conf.d/app.conf <<_EOF
+include /run/flatpak/ld.so.conf.d/app-*.conf
+include /app/etc/ld.so.conf
+include /app/etc/ld.so.conf.d/*.conf
+/app/%{_lib}
+include /run/flatpak/ld.so.conf.d/runtime-*.conf
+_EOF
 
 # We duplicate selected file triggers from packages in the runtime, to
 # extend them to cover /app as well. Some other functions that RPM file
@@ -82,7 +88,7 @@ echo "/app/%{_lib}" > $RPM_BUILD_ROOT%{_sysconfdir}/ld.so.conf.d/app.conf
 
 %post -p /sbin/ldconfig
 
-%transfiletriggerin -P 1999999 -- /app/lib /app/lib64
+%transfiletriggerin -P 1999999 -- /app/lib /app/lib64 /app/etc/ld.so.conf.d
 /sbin/ldconfig
 
 %transfiletriggerin -- /app/share/glib-2.0/schemas
@@ -110,6 +116,9 @@ done
 %{_sysconfdir}/ld.so.conf.d/app.conf
 
 %changelog
+* Tue Dec 10 2024 Yaakov Selkowitz <yselkowi@redhat.com> - 41-2
+- Enable dynamic ld.so.cache generation
+
 * Thu Aug 15 2024 Yaakov Selkowitz <yselkowi@redhat.com> - 41-1
 - Bump version
 

                 reply	other threads:[~2026-09-10 21:21 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=178907531850.1.9423567153216324165.rpms-flatpak-runtime-config-641ea400561c@fedoraproject.org \
    --to=yselkowi@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