View Issue Details

IDProjectCategoryView StatusLast Update
0005614GNUnetotherpublic2019-08-01 23:40
Reporternikita Assigned Tonikita Due Date
PrioritylowSeveritytweakReproducibilityhave not tried
Status closedResolutionwon't fix 
Product VersionGit master 
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.py (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.
Attached Files

Activities

Christian Grothoff

2019-02-28 10: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'!?

nikita

2019-02-28 11:00

reporter   ~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.

nikita

2019-02-28 14:15

reporter   ~0014105

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

Christian Grothoff

2019-03-02 06:51

manager   ~0014111

Ok, but what is a good alternative?

nikita

2019-03-09 11:05

reporter   ~0014177

I'll look into this.

nikita

2019-03-14 01:25

reporter   ~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 12: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.

nikita

2019-03-14 13:23

reporter   ~0014199

Okay.

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.

nikita

2019-03-14 13:37

reporter   ~0014200

Last edited: 2019-03-14 13:37

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 01: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.

nikita

2019-03-15 14:58

reporter   ~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

nikita

2019-07-28 16:16

reporter   ~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 ModifiedUsernameFieldChange
2019-02-27 19:20nikitaNew Issue
2019-02-27 19:21nikitaSummaryremove usage of which(1) in our sourcetree => remove usage of which(1) in our code
2019-02-27 19:37nikitaTarget Version => 0.11.1
2019-02-28 10:47Christian GrothoffNote Added: 0014100
2019-02-28 10:47Christian GrothoffStatusnew => acknowledged
2019-02-28 11:00nikitaNote Added: 0014102
2019-02-28 14:15nikitaNote Added: 0014105
2019-03-02 06:51Christian GrothoffNote Added: 0014111
2019-03-09 11:04nikitaTarget Version0.11.1 => 0.12.0
2019-03-09 11:05nikitaNote Added: 0014177
2019-03-09 11:05nikitaAssigned To => nikita
2019-03-09 11:05nikitaStatusacknowledged => assigned
2019-03-14 01:25nikitaNote Added: 0014194
2019-03-14 01:25nikitaAssigned Tonikita => Christian Grothoff
2019-03-14 01:25nikitaStatusassigned => feedback
2019-03-14 12:29Christian GrothoffNote Added: 0014198
2019-03-14 13:23nikitaFile Added: iamsaintvitus_thewhichfindergeneral.log
2019-03-14 13:23nikitaNote Added: 0014199
2019-03-14 13:23nikitaStatusfeedback => assigned
2019-03-14 13:37nikitaNote Added: 0014200
2019-03-14 13:37nikitaNote Edited: 0014200
2019-03-15 01:45Christian GrothoffNote Added: 0014206
2019-03-15 01:46Christian GrothoffAssigned ToChristian Grothoff => nikita
2019-03-15 14:58nikitaNote Added: 0014211
2019-07-28 16:16nikitaNote Added: 0014752
2019-07-28 16:17nikitaStatusassigned => resolved
2019-07-28 16:17nikitaResolutionopen => won't fix
2019-08-01 23:39Christian GrothoffProduct Version => Git master
2019-08-01 23:39Christian GrothoffFixed in Version => 0.11.7
2019-08-01 23:39Christian GrothoffTarget Version0.12.0 => 0.11.7
2019-08-01 23:40Christian GrothoffStatusresolved => closed