1 |
On Fri, 13 May 2022 09:11:30 +0200 |
2 |
Ulrich Mueller <ulm@g.o> wrote: |
3 |
|
4 |
> Recently Debian has started to transition away from the "which" |
5 |
> command. [1] |
6 |
> |
7 |
> which is a non-POSIX command which prints out the location of |
8 |
> specified executables that are in your path. Unfortunately, there are |
9 |
> several versions of the program around which are not compatible with |
10 |
> each other. We package the GNU version as sys-apps/which, which is in |
11 |
> the system set since 2004. |
12 |
> |
13 |
> Already in 2007, vapier asked developers to avoid which in ebuilds. |
14 |
> [2] The replacement in most circumstances is "type -p" which is a bash |
15 |
> builtin command. |
16 |
> |
17 |
> So, should we join the "which hunt", with the goal of removing |
18 |
> sys-apps/which from the system set and from stage1? I think the first |
19 |
> step would be to identify which packages use which, and add it as an |
20 |
> explicit dependency. (Maybe the tinderbox could help there?) A bug for |
21 |
> this [3] has already been filed by mgorny some time ago. |
22 |
> |
23 |
> Unfortunately, the command pops up in unexpected places, e.g. it |
24 |
> appears to be an (indirect) build-time dependency of systemd. [4] |
25 |
> |
26 |
> Ulrich |
27 |
> |
28 |
> [1] https://lwn.net/Articles/874049/ |
29 |
> [2] |
30 |
> https://archives.gentoo.org/gentoo-dev/message/e04d4db72572dd5fec48e87c6b18c525 |
31 |
> [3] https://bugs.gentoo.org/646588 [4] https://bugs.gentoo.org/502084 |
32 |
|
33 |
To solve this exact issue I wrote a pure shell script to find |
34 |
executable files in the user's $PATH. It should work with posix |
35 |
compatible shell and about as fast as which(1). |
36 |
|
37 |
https://notabug.org/orbea/exists/src/master/exists.sh |
38 |
|
39 |
There are a lot of tests as well. |
40 |
|
41 |
https://notabug.org/orbea/exists/src/master/test.sh |