Gentoo Archives: gentoo-science

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

Replies

Subject Author
Re: [gentoo-science] tip for installing files from tarballs Andrew Ammerlaan <andrewammerlaan@××××××.net>