1 |
Hi, |
2 |
|
3 |
I only have a local overlay for now. |
4 |
The shadow team still did'nt had time to merge my pull request on github. |
5 |
But you can use my github branch: |
6 |
https://github.com/fariouche/shadow.git |
7 |
|
8 |
In the bugzilla you will find all the needed patches, except the shadow ebuild modified to use my branch. |
9 |
Feel free to host the overlay if you want to test. It's pretty straightforward. :-) |
10 |
|
11 |
|
12 |
I feel like an ebuild should never use directly the $ROOT prefix. I believe it is prone to errors and is better suited to be handled by the portage installation system. |
13 |
|
14 |
Regards, |
15 |
Farid |
16 |
|
17 |
-------------------------------------------- |
18 |
En date de : Mer 8.6.16, Benda Xu <heroxbd@g.o> a écrit : |
19 |
|
20 |
Objet: [gentoo-dev] Re: Modification proposal for user/group creation when ROOT!="/" |
21 |
À: gentoo-dev@l.g.o |
22 |
Date: Mercredi 8 juin 2016, 6h44 |
23 |
|
24 |
Hi Farid, |
25 |
|
26 |
This is an excellent idea! |
27 |
It is very helpful for Gentoo Prefix/libc, |
28 |
where we maintain a set of nss databases |
29 |
(passwd, group, shadow, etc.) |
30 |
inside a |
31 |
directory prefix. |
32 |
|
33 |
Farid |
34 |
BENAMROUCHE <fariouche@×××××.fr> |
35 |
writes: |
36 |
|
37 |
> Currently |
38 |
there is an old known limitation when using ROOT= option |
39 |
to |
40 |
> install a package in a folder: |
41 |
user/groups are created in the host |
42 |
> |
43 |
filesystem, not the target root filesystem. |
44 |
|
45 |
Exactly. |
46 |
|
47 |
> So I've pushed some modifications to |
48 |
the upstream shadow repo. |
49 |
> Basically, |
50 |
I've added a --prefix option to user{add,mod,del} and |
51 |
> group{add,mod,del} This option does the |
52 |
same as --root option, but |
53 |
> whithout a |
54 |
chroot (so compatible when cross compiling) |
55 |
|
56 |
Cool. |
57 |
|
58 |
> You can see more details (and the |
59 |
limitation of my implementation) in |
60 |
> the |
61 |
shadow github repo: |
62 |
> https://github.com/shadow-maint/shadow/issues/18 |
63 |
|
64 |
Hope the upstream accept your |
65 |
patch soon. |
66 |
|
67 |
> Now, for |
68 |
the gentoo part, I do have a working solution that |
69 |
I've |
70 |
> pushed in the following |
71 |
bugzilla: |
72 |
> https://bugs.gentoo.org/show_bug.cgi?id=541406 |
73 |
> |
74 |
> A new user.eclass |
75 |
file with modified enewuser,enewgroup and egetent |
76 |
> that all supports ${ROOT} option via |
77 |
--prefix in shadow utilities. |
78 |
> For now |
79 |
I've only added this option for linux. |
80 |
|
81 |
The new user.eclass requires |
82 |
the new shadow. After the upstream makes a |
83 |
new release, it will take a long time for |
84 |
Gentoo to use the feature. |
85 |
Because we should |
86 |
carefully handle the compatibility with the old |
87 |
systems. |
88 |
|
89 |
> |
90 |
However, I've encountered some unexpected issues: some |
91 |
ebuilds are |
92 |
> using direct calls to chown |
93 |
and fowners. Both are not compatible with |
94 |
> ${ROOT}... |
95 |
|
96 |
Those ebuilds are broken and should be |
97 |
fixed. |
98 |
|
99 |
> To solve this, |
100 |
I've created 2 new calls in user.eclass: echown and |
101 |
> efowners. The only thing the new |
102 |
functions are doing is to get the |
103 |
> |
104 |
uid/gid from the correct passwd/group files from ${ROOT} |
105 |
using the |
106 |
> modified egetent function and |
107 |
pass that to the native chown/fowners... |
108 |
> |
109 |
> For example, in |
110 |
sys-power/nut we can find: chown nut:nut |
111 |
> ${ROOT}/var/lib/nut |
112 |
> |
113 |
> This should be |
114 |
changed to echown nut:nut ${ROOT}/var/lib/nut |
115 |
|
116 |
Brilliant. |
117 |
|
118 |
> Same to fowners. If the modification is |
119 |
not done, either the ebuild |
120 |
> will fail |
121 |
because the nut user does not exists in the host, or the |
122 |
> incorrect uid will be user in ${ROOT} |
123 |
> |
124 |
> The solution is not |
125 |
perfect, but at least better than what we have |
126 |
> today, and totally usable I believe. |
127 |
> |
128 |
> I've uploaded the |
129 |
patches for lighttpd and nut, plus my patch for |
130 |
> user.eclass for review in this bug... we |
131 |
do have time until upstream |
132 |
> shadow team |
133 |
reviews and commits my modifications (at least). |
134 |
> |
135 |
> Side note: it's a |
136 |
bit complicated to know when to add ${ROOT} and when |
137 |
> not in a ebuild... For example, chown |
138 |
needs ${ROOT} but fowners must |
139 |
> |
140 |
not!... |
141 |
|
142 |
Why not? Could |
143 |
you give more details? |
144 |
|
145 |
> |
146 |
Side note 2: maybe I should add a verification to check |
147 |
if |
148 |
> useradd/groupadd supports my new |
149 |
--prefix solution, and fallback to |
150 |
> |
151 |
original behavior if not? |
152 |
|
153 |
IMHO, useradd/groupadd supporting --prefix will |
154 |
be captured by a new |
155 |
EAPI in the (far) |
156 |
future. At present we don't need to worry about it. |
157 |
|
158 |
> Tests: I've compiled |
159 |
a full working system with my above solution, and |
160 |
> it works. (cross compilation in a |
161 |
dedicated target root path) |
162 |
|
163 |
Do you have an overlay for me reproduce your |
164 |
result? I am also |
165 |
interested in hosting it |
166 |
in proj/android.git[1] if you do not have one |
167 |
yet. |
168 |
|
169 |
Keep on |
170 |
your good work. |
171 |
|
172 |
Yours, |
173 |
Benda |
174 |
|
175 |
1. |
176 |
https://gitweb.gentoo.org/proj/android.git/ |