Gentoo Archives: gentoo-science

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

Replies

Subject Author
Re: [gentoo-science] tip for installing files from tarballs "François Bissey" <fbissey@××××××××××××.nz>