1 |
Hello. |
2 |
|
3 |
Anatoly raised really important concern and currently I've started to |
4 |
think about fix. One possible solution requires virtual/editor to suite |
5 |
glep 37 and thus affects many packages. So... wondering why this change |
6 |
was not done I'd like to discuss the problem on the list. |
7 |
|
8 |
Problem: |
9 |
There are programs (fcrontab, visudo, vipw and etc.) which require |
10 |
default editor to work. To select editor they use these two steps: |
11 |
1.) take editor name from environment (EDITOR or VISUAL vars) |
12 |
2.) if there is not editor use defined at build time compiled in default |
13 |
|
14 |
The problem is that both of methods suck in some special situations |
15 |
which, of course, happen in Gentoo with its extreme configurability. |
16 |
Currently it is impossible to specify build time dependency reliably for |
17 |
virtual/editor: most of packages either use nano or vi (either |
18 |
trough ./configure option or #define in sources) but in the system |
19 |
without nano or vi this package either not emerges [1,2] or fails to |
20 |
work[3,4] (yes... if EDITOR is not set). But EDITOR *is not* set when |
21 |
program is started from sudo because sudo for security reasons drops |
22 |
environment (are there any other cases when environment is dropped?). |
23 |
|
24 |
Well. One possible answer that this is not a problem: build time |
25 |
dependencies are weird, always set EDITOR and never run such programs |
26 |
from sudo because this allows to do everything with the system. But I'd |
27 |
like to point at two points: firstly, some users use sudo just to avoid |
28 |
logging in as root and, secondly, upstream consider compiled in defaults |
29 |
to work. Thus IMO this is a problem. |
30 |
|
31 |
The possible solution is to add virtual/editor ebuild which will besides |
32 |
enumerating all virtual providers install /usr/bin/editor program. This |
33 |
will be a simple wrapper (bash) script which will use EDITOR environment |
34 |
variable to start editor, in case environment variable does not exist |
35 |
use EDITOR from /etc/rc.conf and as the last resolve just issue error |
36 |
message identifying possible ways to setup editor. All programs that use |
37 |
compiled in default editor should use this wrapper script. This will |
38 |
solve ambiguity of build time dependency and allow to use sudo reliably. |
39 |
|
40 |
While I continue playing in my overlay I'd like to know if there are any |
41 |
problems with this solution? Currently this change seems to satisfy KISS |
42 |
concept and fix some problems... thus should be implemented. I'll wait |
43 |
for some time and open two trackers one for virtual/editor providers |
44 |
another for virtual/editor build time dependency users and then add |
45 |
virtual/editor ebuild, remove PROVIDErs and continue working on packages |
46 |
that use compiled in editor defaults. |
47 |
|
48 |
References: |
49 |
[1] https://bugs.gentoo.org/show_bug.cgi?id=124904 |
50 |
[2] https://bugs.gentoo.org/show_bug.cgi?id=94771 |
51 |
[3] https://bugs.gentoo.org/show_bug.cgi?id=149376 |
52 |
[4] https://bugs.gentoo.org/show_bug.cgi?id=149339 |
53 |
|
54 |
Thank you for your time, |
55 |
Peter. |