1 |
Actually I should be a bit more precise. Ownership of file was changed without |
2 |
any issues. |
3 |
Ownership of folders was not. So the files are replaced but the folders are not, |
4 |
and that means if you change the ownership of the folders between revisions |
5 |
of the same ebuild (or next version of the package), it is not done without |
6 |
extra action. |
7 |
|
8 |
It is alright if you get it right the first time. But here it is a bit of an |
9 |
after thought. |
10 |
|
11 |
I have two packages so far that do the tarball unpacking thing that can give |
12 |
funny ownership if you don’t do it right. I suspect there are more out there. |
13 |
|
14 |
> On 9/02/2021, at 21:28, Andrew Ammerlaan <andrewammerlaan@××××××.net> wrote: |
15 |
> |
16 |
> On 09/02/2021 00:39, François Bissey wrote: |
17 |
>> It looks like “--no-same-owner” does work in the end. |
18 |
>> However, I bumped into a probably subtle bug in portage. |
19 |
>> |
20 |
>> Before the permission were right I had to un-merge the |
21 |
>> package (emerge -C …) first, then merge it again. |
22 |
>> It looks like the ownership is not changed if there are files |
23 |
>> from a previous install. Even if the new install has different |
24 |
>> ownership. It could be interesting to see if permission are |
25 |
>> affected as well. |
26 |
>> |
27 |
> I'm pretty sure this behavior is intentional and not a bug. If an user were to change the permissions/owner of some file to adapt it to his/her configuration and an update would overwrite this. Well that would lead to annoying breakage on this users system on every update/rebuild. |
28 |
> |
29 |
> If an ebuild for whatever reason has to change the owner/permissions of an existing file I guess the pkg_postinst/pkg_preinst phases could be used. |
30 |
> |
31 |
>>> On 9/02/2021, at 12:03, François Bissey <frp.bissey@×××××.com> wrote: |
32 |
>>> |
33 |
>>> Just for the record so that some root cause of the issue are more clear. |
34 |
>>> From “man tar” |
35 |
>>> --no-same-owner |
36 |
>>> Extract files as yourself (default for ordinary users). |
37 |
>>> |
38 |
>>> |
39 |
>>> --same-owner |
40 |
>>> Try extracting files with the same ownership as exists in the archive (default for superuser). |
41 |
>>> |
42 |
>>> ====== |
43 |
>>> |
44 |
>>> So, by default, when you emerge with root, tar will try to preserve ownership |
45 |
>>> as stated inside the tarball. I was hoping that inserting “—no-same-owner” |
46 |
>>> in the tar command would changes things a little bit. But for some reasons |
47 |
>>> it didn’t have any effect when I inserted it inside the makefile. |
48 |
>>> |
49 |
>>>> On 9/02/2021, at 11:55, François Bissey <frp.bissey@×××××.com> wrote: |
50 |
>>>> |
51 |
>>>> Nope, just plain emerge as root. |
52 |
>>>> |
53 |
>>>>> On 9/02/2021, at 11:55, Aisha Tammy <gentoo.science@×××××.cc> wrote: |
54 |
>>>>> |
55 |
>>>>> Are you installing/building with the ebuild command and then merging with sudo or |
56 |
>>>>> something similar? |
57 |
>>>>> That may be one reason something like this is happening. |
58 |
>>>>> |
59 |
>>>>> On 2/8/21 5:28 PM, François Bissey wrote: |
60 |
>>>>>> Hi all, |
61 |
>>>>>> |
62 |
>>>>>> I discovered an issue in a couple of packages for which sage-on-gentoo |
63 |
>>>>>> provides ebuilds. |
64 |
>>>>>> Some packages install data directly from a tar command. By that I mean |
65 |
>>>>>> Makefile.am will a line like |
66 |
>>>>>> cd $(DESTDIR)$(dbdir) && tar xf $(dist_db_DATA) && rm $(dist_db_DATA) |
67 |
>>>>>> |
68 |
>>>>>> From a real Makefile at |
69 |
>>>>>> https://github.com/sagemath/p_group_cohomology/blob/master/present/Makefile.am |
70 |
>>>>>> |
71 |
>>>>>> I looks innocuous until you realise it has some funny effects on ownership. |
72 |
>>>>>> fbissey@moonloop ~ $ ll /usr/share/pGroupCohomology/ |
73 |
>>>>>> total 1.1M |
74 |
>>>>>> drwxr-xr-x 270 root root 12K Feb 3 21:55 . |
75 |
>>>>>> drwxr-xr-x 319 root root 12K Feb 3 21:55 .. |
76 |
>>>>>> drwxr-xr-x 3 fbissey fbissey 4.0K Feb 9 10:46 64gp1 |
77 |
>>>>>> drwxr-xr-x 4 fbissey fbissey 4.0K Feb 9 10:46 64gp10 |
78 |
>>>>>> drwxr-xr-x 4 fbissey fbissey 4.0K Feb 9 10:46 64gp100 |
79 |
>>>>>> drwxr-xr-x 4 fbissey fbissey 4.0K Feb 9 10:46 64gp101 |
80 |
>>>>>> drwxr-xr-x 4 fbissey fbissey 4.0K Feb 9 10:46 64gp102 |
81 |
>>>>>> |
82 |
>>>>>> the files in the tarball are owned by user/group 1001:1001 |
83 |
>>>>>> and on my system it is my personal user. |
84 |
>>>>>> sci-mathematics/singular and that may include the version in the main tree, |
85 |
>>>>>> would have to check, install its documentation from a tarball as well |
86 |
>>>>>> fbissey@moonloop ~ $ ll /usr/share/doc/singular-4.1.1_p2-r3/ |
87 |
>>>>>> total 216K |
88 |
>>>>>> drwxr-xr-x 3 2345 uucp 4.0K Nov 10 10:49 . |
89 |
>>>>>> drwxr-xr-x 1361 root root 64K Feb 9 10:39 .. |
90 |
>>>>>> drwxr-xr-x 2 2345 uucp 128K Nov 10 10:49 html |
91 |
>>>>>> -rw-r--r-- 1 root root 497 Nov 10 10:48 README.bz2 |
92 |
>>>>>> -rw-r--r-- 1 root root 517 Nov 10 10:48 README.md.bz2 |
93 |
>>>>>> -rw-r--r-- 1 root root 585 Nov 10 10:48 README.pkg.bz2 |
94 |
>>>>>> fbissey@moonloop ~ $ ll /usr/share/doc/singular-4.1.1_p2-r3/html |
95 |
>>>>>> total 30M |
96 |
>>>>>> drwxr-xr-x 2 2345 uucp 128K Nov 10 10:49 . |
97 |
>>>>>> drwxr-xr-x 3 2345 uucp 4.0K Nov 10 10:49 .. |
98 |
>>>>>> -rwxr-xr-x 1 2345 uucp 915 Feb 14 2018 a_begin.gif |
99 |
>>>>>> -rwxr-xr-x 1 2345 uucp 909 Feb 14 2018 a_begin_na.gif |
100 |
>>>>>> -rwxr-xr-x 1 2345 uucp 927 Feb 14 2018 a_document.gif |
101 |
>>>>>> |
102 |
>>>>>> I tried to use fowners inside the ebuild, but it only fixes file ownership, |
103 |
>>>>>> folders are not touched. I tried to insert “—no-same-owner” in the call to tar |
104 |
>>>>>> and that didn’t really help either. At best, I am expecting ownership to change |
105 |
>>>>>> to portage:portage. |
106 |
>>>>>> |
107 |
>>>>>> Has anyone dealt with something like this before? Apart from “recursively” |
108 |
>>>>>> scripting install in the make file is there anything simple I could do? |
109 |
>>>>>> |
110 |
>>>>>> Cheers, |
111 |
>>>>>> François |
112 |
>>>>> |
113 |
>>>> |
114 |
>>> |
115 |
>> |
116 |
> |
117 |
> |