Re: F40 Change Proposal: Optimized Binaries for the AMD64 Architecture (System-Wide)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 12/31/23 18:27, Dominique Martinet wrote:
John Reiser wrote on Sun, Dec 31, 2023 at 02:52:53PM -0800:
Additional paths will be inserted into the search path used for
executables on systems which have a compatible CPU.

Searching $PATH is a slow operation. It is so slow that a shell script which
typically processes many files using utilities from packages coreutils
and/or binutils often factors-out the PATH search by using
shell variables:

	CP=$(which cp)
	  ...
	$(CP) $file.in $file.out

(getting slighly off topic, sorry)
That hasn't been needed for as long as I've used a compter, all^W most
shells already do this for you.

(It's obvious in interactive mode when you need to use hash/rehash
built-ins after moving a binary that you ran once, but it's true as well
when running scripts: if you e.g. strace for stat() calls a script that
calls cp twice you'll see it only looks through PATH once. This is true
of at least bash, zsh, dash, and even busybox ash... Interestingly fish
doesn't seem to do it, I'm a bit surpised here)

Some programs DO search $PATH because they use execlp() or
execvp() or execvpe().  Example of /usr/bin/rpm searching for "sh":
===== [edited for clarity]
$ echo $PATH
/A:/B:/usr/local/bin:/usr/bin: ...
$ strace -f -e trace=newfstatat rpm --install -p zip-3.0-37.fc38.src.rpm
19792 newfstatat(AT_FDCWD, "/A/sh", 0x7fff8c204840, 0) = -1 ENOENT
19792 newfstatat(AT_FDCWD, "/B/sh", 0x7fff8c204840, 0) = -1 ENOENT
19792 newfstatat(AT_FDCWD, "/usr/local/bin/sh", 0x7fff8c204840, 0) = -1 ENOENT
19792 newfstatat(AT_FDCWD, "/usr/bin/sh", ...}, 0) = 0
=====
That's with rpm-4.18.2-1.fc38.x86_64 and glibc-2.37-16.fc38.x86_64.
--
_______________________________________________
devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx
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@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Users]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]

  Powered by Linux