View Issue Details

IDProjectCategoryView StatusLast Update
0005614GNUnetotherpublic2019-08-02 01:40
Reporternikita Assigned Tonikita  
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 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'!?

nikita

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.

nikita

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?

nikita

2019-03-09 12:05

developer   ~0014177

I'll look into this.

nikita

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.

nikita

2019-03-14 14:23

developer   ~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 14:37

developer   ~0014200

Last edited: 2019-03-14 14: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 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.

nikita

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

nikita

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 nikita New Issue
2019-02-27 20:21 nikita Summary remove usage of which(1) in our sourcetree => remove usage of which(1) in our code
2019-02-27 20:37 nikita 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 nikita Note Added: 0014102
2019-02-28 15:15 nikita Note Added: 0014105
2019-03-02 07:51 Christian Grothoff Note Added: 0014111
2019-03-09 12:04 nikita Target Version 0.11.1 => 0.12.0
2019-03-09 12:05 nikita Note Added: 0014177
2019-03-09 12:05 nikita Assigned To => nikita
2019-03-09 12:05 nikita Status acknowledged => assigned
2019-03-14 02:25 nikita Note Added: 0014194
2019-03-14 02:25 nikita Assigned To nikita => Christian Grothoff
2019-03-14 02:25 nikita Status assigned => feedback
2019-03-14 13:29 Christian Grothoff Note Added: 0014198
2019-03-14 14:23 nikita File Added: iamsaintvitus_thewhichfindergeneral.log
2019-03-14 14:23 nikita Note Added: 0014199
2019-03-14 14:23 nikita Status feedback => assigned
2019-03-14 14:37 nikita Note Added: 0014200
2019-03-14 14:37 nikita Note Edited: 0014200
2019-03-15 02:45 Christian Grothoff Note Added: 0014206
2019-03-15 02:46 Christian Grothoff Assigned To Christian Grothoff => nikita
2019-03-15 15:58 nikita Note Added: 0014211
2019-07-28 18:16 nikita Note Added: 0014752
2019-07-28 18:17 nikita Status assigned => resolved
2019-07-28 18:17 nikita Resolution open => won't fix
2019-08-02 01:39 Christian Grothoff Product Version => Git master
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