On Sat, Dec 30, 2023 at 08:27:46AM +0000, Mattia Verga via devel wrote:
> Il 28/12/23 18:25, Robert Marcano via devel ha scritto:
> > On 12/28/23 12:58 PM, Chris Adams wrote:
> >> Once upon a time, Aoife Moloney <amolo...@redhat.com> said:
> >>> Systemd will be modified to insert the additional directories into the
> >>> `$PATH` environment variable (affecting all programs on the system)
> >> Anything that depends on PATH entries is IMHO doomed to failure.  There
> >> are way too many things that explicitly set PATH to "known" values (for
> >> good and bad reasons) to be able to depend on extending it.  Heck, it
> >> took a long time to get sudo just to include /usr/local/{bin,sbin}.
> >>
> > Maybe replacing the /usr/bin related entries with a generic wrapper that
> > launch the best binary from the per architecture directories.
> >
> > Note: This may affect a few programs that use argv[0] for something
> > meaningful.
> > --
> 
> I've got not much knowledge on this matter, anyway here's my 2c:
> 
> Since we're talking about a few packages that will gain from this change 
> and that they're must be manually "enabled" to build with this feature, 
> I'd prefer this kind of wrapper approach instead of changing the PATH 
> globally.

This is also a valid approach. This is the first alternative proposal
which makes me say "hmm, this would also work". It is possibly even
simpler than setting the $PATH. A very small disadvantage is that the
wrapper would need to do its work every time the binary is called.
But the wrapper could be trivially implemented in shell or it could be
a compiled binary, making the wrapper very cheap.

Hmm, what do other people think?

> Maybe a RPM macro could be provided for using in specfile where we want 
> optimized binaries. Those binaries will be created like 'xz-x86-64-v2', 
> 'xz-x86-64-v3' and so on and all installed in /usr/bin. Then a 'xz' 
> wrapper will call the appropriate executable based on what supported 
> instruction set is detected available. 

xYes.

> And maybe in future we could have 
> dnf to install the appropriate optimized subpackage binaries.

I didn't cover this in my proposal because it seemed a bit premature
to figure out a way to install variants automatically even before we
know if and how many of those we will have.

My general idea was to have an anchor package like "system-x86-64-v3"
(name to be figured out) and then use rich dependencies to pull in
the -v2 and -v3 variants on systems which have it installed.
Either the user or the installer would only need to install the
right anchor packages and then the rest would be handled automatically
by dnf.

> It may be much more complex than just injecting new PATHs, but I think 
> it's more elegant and could be a shared mechanism with other linux 
> distributions.

The mechanism with $PATH would also be shared with other distros.
If the code is added in systemd, it would become automatically
available everywhere.

Zbyszek
--
_______________________________________________
devel mailing list -- devel@lists.fedoraproject.org
To unsubscribe send an email to devel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org
Do not reply to spam, report it: 
https://pagure.io/fedora-infrastructure/new_issue

Reply via email to