View Issue Details

IDProjectCategoryView StatusLast Update
0005614GNUnetotherpublic2019-08-02 01:40
Reporterng0Assigned Tong0 
PrioritylowSeveritytweakReproducibilityhave not tried
Status closedResolutionwon't fix 
Product VersionSVN HEAD 
Target Version0.11.7Fixed in Version0.11.7 
Summary0005614: remove usage of which(1) in our code
DescriptionWhile it's reasonable to assume that which exists, it's easier to assume it does not.
It's mostly shell scripts this exists in.

I have avoided usage of which in the shell script for src/util/ (gnunet-qr is the
shell script). It's not clear if this solution is the most portable one or fastest.
Any solution which replaces which has this one condition - be portable across all systems.
TagsNo tags attached.


Christian Grothoff

2019-02-28 11:47

manager   ~0014100

I must admit I neither _know_ of a good alternative nor do I really see the need. Are there really systems without 'which'!?


2019-02-28 12:00

developer   ~0014102

When you have a very limited buildchroot, you have to pull in which, either as part of your base system or as part of gnu which.
There are userlands which do not provide which. Although I'm not sure if someone with busybox (for example Alpinelinux?) would run the tests. It's low priority because those are edgecases which
I still consider support worthy.


2019-02-28 15:15

developer   ~0014105

One example, see our own guix definition for gnunet. which is not part of the standard build environment.

Christian Grothoff

2019-03-02 07:51

manager   ~0014111

Ok, but what is a good alternative?


2019-03-09 12:05

developer   ~0014177

I'll look into this.


2019-03-14 02:25

developer   ~0014194

How about bundling a minimal which in C which is used when no host which is found? I'm half way there, I just need to implement the code for Linux (works on NetBSD so far).

Christian Grothoff

2019-03-14 13:29

manager   ~0014198

I don't like the idea very much. which is such a standard tool, we really shouldn't re-implement those. Where do we need it? If it's just some test cases, I'd rather disable those tests on platforms where 'which' is unavailable.


2019-03-14 14:23

developer   ~0014199


search for which appended (note that this is local, some files don't exist in your git).
I think last time I checked it was just a couple of files where it really mattered:
- parts of contrib (including apparmor)
- some tests

If you think it's reasonable to switch it like this, I'm okay with it.
We need to do an inventory first, where which is used.

iamsaintvitus_thewhichfindergeneral.log (324,072 bytes)


2019-03-14 14:37

developer   ~0014200

Last edited: 2019-03-14 14:37

View 2 revisions

All of these can be adjusted with some scripting to not use which(1), so switching them off is not permanent.

- src/credential/: less than 10 testfiles using which(1).
- src/gns: a number of tests
- src/gns, runtime: gnunet-gns-proxy-setup-ca
- src/namestore: a couple of tests
- src/reclaim: same
- src/dns: a couple of tests
- our pre-commit hook.

That's it I think

Christian Grothoff

2019-03-15 02:45

manager   ~0014206

The use of 'which' in gnunet-gns-proxy-setup-ca can easily be replaced, i.e. by simply invoking
"openssl version" and checking the return code of that. Ditto for certutil. So please first do a quick check which ones are actually necessary, and then I'm sure the rest can be skipped if which is unavailable.


2019-03-15 15:58

developer   ~0014211

- src/credential/: less than 10 testfiles using which(1).
- src/gns: a number of tests
- src/gns, runtime: gnunet-gns-proxy-setup-ca -> DONE
- src/namestore: a couple of tests
- src/reclaim: same
- src/dns: a couple of tests
- our pre-commit hook. -> DONE


2019-07-28 18:16

developer   ~0014752

with what I have watched in how tests are written, how proposals were rejected, I'm going to drop this as sisyphus work. I could fix the usage of which(1) still left, have identified the ways to do so and learned more, but it's just not worth the time spend with it. If someone who is affected by this finds we should address this, please reference this ticket and open a new one.

Issue History

Date Modified Username Field Change
2019-02-27 20:20 ng0 New Issue
2019-02-27 20:21 ng0 Summary remove usage of which(1) in our sourcetree => remove usage of which(1) in our code
2019-02-27 20:37 ng0 Target Version => 0.11.1
2019-02-28 11:47 Christian Grothoff Note Added: 0014100
2019-02-28 11:47 Christian Grothoff Status new => acknowledged
2019-02-28 12:00 ng0 Note Added: 0014102
2019-02-28 15:15 ng0 Note Added: 0014105
2019-03-02 07:51 Christian Grothoff Note Added: 0014111
2019-03-09 12:04 ng0 Target Version 0.11.1 => 0.12.0
2019-03-09 12:05 ng0 Note Added: 0014177
2019-03-09 12:05 ng0 Assigned To => ng0
2019-03-09 12:05 ng0 Status acknowledged => assigned
2019-03-14 02:25 ng0 Note Added: 0014194
2019-03-14 02:25 ng0 Assigned To ng0 => Christian Grothoff
2019-03-14 02:25 ng0 Status assigned => feedback
2019-03-14 13:29 Christian Grothoff Note Added: 0014198
2019-03-14 14:23 ng0 File Added: iamsaintvitus_thewhichfindergeneral.log
2019-03-14 14:23 ng0 Note Added: 0014199
2019-03-14 14:23 ng0 Status feedback => assigned
2019-03-14 14:37 ng0 Note Added: 0014200
2019-03-14 14:37 ng0 Note Edited: 0014200 View Revisions
2019-03-15 02:45 Christian Grothoff Note Added: 0014206
2019-03-15 02:46 Christian Grothoff Assigned To Christian Grothoff => ng0
2019-03-15 15:58 ng0 Note Added: 0014211
2019-07-28 18:16 ng0 Note Added: 0014752
2019-07-28 18:17 ng0 Status assigned => resolved
2019-07-28 18:17 ng0 Resolution open => won't fix
2019-08-02 01:39 Christian Grothoff Product Version => SVN HEAD
2019-08-02 01:39 Christian Grothoff Fixed in Version => 0.11.7
2019-08-02 01:39 Christian Grothoff Target Version 0.12.0 => 0.11.7
2019-08-02 01:40 Christian Grothoff Status resolved => closed