Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 826986 - sys-apps/portage:install phase does not properly follow relative symlinks to folders, resulting in 'grep' chatter
Summary: sys-apps/portage:install phase does not properly follow relative symlinks to ...
Status: UNCONFIRMED
Alias: None
Product: Gentoo/Alt
Classification: Unclassified
Component: Prefix Support (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Prefix
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-11-24 02:34 UTC by Steven Trogdon
Modified: 2021-12-15 20:59 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Steven Trogdon 2021-11-24 02:34:47 UTC
This issue may appear when the install phase needs to follow non-relative symlinks; however, the specific example exposing the issue is when relative symlinks need to be followed. The issue was exposed at https://github.com/cschwan/sage-on-gentoo/issues/660 where during the install of sage-doc-9999 we get chatter like

grep: /storage/strogdon/gentoo-rap/var/tmp/portage/sci-mathematics/sage-doc-9999/image/storage/strogdon/gentoo-rap/usr/share/jupyter/kernels/sagemath/doc: Is a directory
grep: /storage/strogdon/gentoo-rap/var/tmp/portage/sci-mathematics/sage-doc-9999/image/storage/strogdon/gentoo-rap/usr/share/doc/sage-doc-9999/pdf/en/reference/_static: Is a directory
grep: /storage/strogdon/gentoo-rap/var/tmp/portage/sci-mathematics/sage-doc-9999/image/storage/strogdon/gentoo-rap/usr/share/doc/sage-doc-9999/html/fr/tutorial/_static: Is a directory
grep: /storage/strogdon/gentoo-rap/var/tmp/portage/sci-mathematics/sage-doc-9999/image/storage/strogdon/gentoo-rap/usr/share/doc/sage-doc-9999/html/fr/a_tour_of_sage/_static: Is a directory
grep: /storage/strogdon/gentoo-rap/var/tmp/portage/sci-mathematics/sage-doc-9999/image/storage/strogdon/gentoo-rap/usr/share/doc/sage-doc-9999/html/en/prep/_static: Is a directory
grep: /storage/strogdon/gentoo-rap/var/tmp/portage/sci-mathematics/sage-doc-9999/image/storage/strogdon/gentoo-rap/usr/share/doc/sage-doc-9999/html/en/_static: Is a directory

For example, for the first 'grep:' item, usr/share/jupyter/kernels/sagemath/doc is a relative symlink to a folder

/storage/strogdon/gentoo-rap/var/tmp/portage/sci-mathematics/sage-doc-9999/image/storage/strogdon/gentoo-rap/usr/share/jupyter/kernels/sagemath/doc -> ../../../doc/sage-doc-9999/html/en

with contents

ls -al /storage/strogdon/gentoo-rap/var/tmp/portage/sci-mathematics/sage-doc-9999/image/storage/strogdon/gentoo-rap/usr/share/jupyter/kernels/sagemath/doc/
total 104
drwxr-xr-x 13 terry terry  4096 Nov 23 18:16 .
drwxr-xr-x  5 terry terry  4096 Nov 23 18:16 ..
drwxr-xr-x  4 terry terry  4096 Nov 23 18:16 a_tour_of_sage
-rw-r--r--  1 terry terry   230 Nov 23 18:15 .buildinfo
drwxr-xr-x  4 terry terry  4096 Nov 23 18:16 constructions
drwxr-xr-x  4 terry terry  4096 Nov 23 18:16 developer
drwxr-xr-x  3 terry terry  4096 Nov 23 18:16 faq
-rw-r--r--  1 terry terry  6274 Nov 23 18:15 genindex-all.html
-rw-r--r--  1 terry terry  6434 Nov 23 18:15 genindex.html
-rw-r--r--  1 terry terry 12629 Nov 23 18:15 index.html
drwxr-xr-x  3 terry terry  4096 Nov 23 18:16 installation
-rw-r--r--  1 terry terry   257 Nov 23 18:15 objects.inv
drwxr-xr-x  5 terry terry  4096 Nov 23 18:16 prep
drwxr-xr-x 81 terry terry  4096 Nov 23 18:16 reference
-rw-r--r--  1 terry terry  6826 Nov 23 18:15 search.html
-rw-r--r--  1 terry terry   619 Nov 23 18:15 searchindex.js
drwxr-xr-x  2 terry terry  4096 Nov 23 18:16 _sources
lrwxrwxrwx  1 terry terry    10 Nov 23 18:15 _static -> ../_static
drwxr-xr-x 10 terry terry  4096 Nov 23 18:16 thematic_tutorials
drwxr-xr-x  3 terry terry  4096 Nov 23 18:16 tutorial
drwxr-xr-x  3 terry terry  4096 Nov 23 18:16 website

We were able to remove the chatter by changing


        # this is hell expensive, but how else?
        find "${ED}" -executable \! -type d -print0 \

to        

        # this is hell expensive, but how else?
        find -L "${ED}" -executable \! -type d -print0 \

in ${EPREFIX}/usr/lib/portage/python3.9/install-qa-check.d/05prefix so that the 'find' command would properly follow relative symlinks.
Comment 1 François Bissey 2021-11-24 02:45:48 UTC
In summary that find command in `install-qa-check.d/05prefix` tries to find executables and then checks them to see if shebangs need to be replaced if they are scripts. The find command tries to make sure its results are executable and not directories but completely misses out on links to directories. The extra `-L` takes care of that scenario.
Comment 2 Marco Scardovi (scardracs) 2021-11-24 06:34:19 UTC
Please always reports in title the category/app to make bug wrangling faster. I'd suggest to use a title like -- sci-mathematics/sage-doc-9999:install phase does not properly follow relative symlinks to folders, resulting in 'grep' chatter.
Comment 3 François Bissey 2021-11-24 06:48:07 UTC
(In reply to Marco Scardovi (scardracs) from comment #2)
> Please always reports in title the category/app to make bug wrangling
> faster. I'd suggest to use a title like --
> sci-mathematics/sage-doc-9999:install phase does not properly follow
> relative symlinks to folders, resulting in 'grep' chatter.

Even we have identified that the bug is not in fact in the ebuild but in portage?
Comment 4 Steven Trogdon 2021-11-24 18:37:18 UTC
Yes, this is a portage issue. The referenced ebuild, sci-mathematics/sage-doc-9999 is only needed to expose the defect.