Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 889418 - sys-apps/portage: incomplete cleanup with directories outside ${WORKDIR}
Summary: sys-apps/portage: incomplete cleanup with directories outside ${WORKDIR}
Status: CONFIRMED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-01-02 22:15 UTC by David Seifert
Modified: 2023-01-18 00:28 UTC (History)
2 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 David Seifert gentoo-dev 2023-01-02 22:15:11 UTC
1. ebuild antlr-cpp-4.11.1.ebuild install
2. ebuild antlr-cpp-4.11.1.ebuild clean

$ tree -d /var/tmp/portage/dev-cpp/
/var/tmp/portage/dev-cpp/
└── antlr-cpp-4.11.1
    └── work_build
        ├── CMakeFiles
        │   ├── 3.25.1
        │   │   ├── CompilerIdC
        │   │   │   └── tmp
        │   │   └── CompilerIdCXX
        │   │       └── tmp
        │   ├── CMakeScratch
        │   └── pkgRedirects
        └── runtime
            └── CMakeFiles
                └── antlr4_shared.dir
                    └── src
                        ├── atn
                        ├── dfa
                        ├── internal
                        ├── misc
                        ├── support
                        └── tree
                            ├── pattern
                            └── xpath

This happens due to a weird interaction in cmake.eclass with EAPI 8. When ${S} == ${WORKDIR}, the eclass creates a build dir that is not nested within ${WORKDIR}:

>>> Compiling source in /var/tmp/portage/dev-cpp/antlr-cpp-4.11.1/work ...
debug: cmake_src_compile: entering function, parameters: 
debug: cmake_build: entering function, parameters: 
 * Source directory (CMAKE_USE_DIR): "/var/tmp/portage/dev-cpp/antlr-cpp-4.11.1/work"
 * Build directory  (BUILD_DIR):     "/var/tmp/portage/dev-cpp/antlr-cpp-4.11.1/work_build"

which then causes issues with a subsequent compile, since we have stale old files lying around, breaking the build. Clearly, cmake.eclass is at fault, but portage should be robust enough to remove files outside ${WORKDIR}.
Comment 1 David Seifert gentoo-dev 2023-01-02 22:33:34 UTC
cmake.eclass bug: https://bugs.gentoo.org/889420
Comment 2 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2023-01-03 05:34:32 UTC
We should probably report unexpected files as a bug too.
Comment 3 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2023-01-03 05:34:43 UTC
(I mean, emit error in Portage)