Skip to content

Toolkit: Fix readdirent toolchain errors for reusable chroots#10222

Merged
dmcilvaney merged 1 commit intomicrosoft:3.0-devfrom
dmcilvaney:damcilva/3.0/readdirent_debug_fix
Aug 23, 2024
Merged

Toolkit: Fix readdirent toolchain errors for reusable chroots#10222
dmcilvaney merged 1 commit intomicrosoft:3.0-devfrom
dmcilvaney:damcilva/3.0/readdirent_debug_fix

Conversation

@dmcilvaney
Copy link
Copy Markdown
Contributor

@dmcilvaney dmcilvaney commented Aug 22, 2024

Merge Checklist

All boxes should be checked before merging the PR (just tick any boxes which don't apply to this PR)

  • The toolchain has been rebuilt successfully (or no changes were made to it)
  • The toolchain/worker package manifests are up-to-date
  • Any updated packages successfully build (or no packages were changed)
  • Packages depending on static components modified in this PR (Golang, *-static subpackages, etc.) have had their Release tag incremented.
  • Package tests (%check section) have been verified with RUN_CHECK=y for existing SPEC files, or added to new SPEC files
  • All package sources are available
  • cgmanifest files are up-to-date and sorted (./cgmanifest.json, ./toolkit/scripts/toolchain/cgmanifest.json, .github/workflows/cgmanifest.json)
  • LICENSE-MAP files are up-to-date (./LICENSES-AND-NOTICES/SPECS/data/licenses.json, ./LICENSES-AND-NOTICES/SPECS/LICENSES-MAP.md, ./LICENSES-AND-NOTICES/SPECS/LICENSE-EXCEPTIONS.PHOTON)
  • All source files have up-to-date hashes in the *.signatures.json files
  • sudo make go-tidy-all and sudo make go-test-coverage pass
  • Documentation has been updated to match any changes to the build system
  • Ready to merge

Summary

When using the Docker compatible reusable chroots (CHROOT_DIR=...), a number of mount points need to be established external to the toolkit. One set is ./build/toolchain_rpms{x86_64,aarch64,noarch}:chroot-1/toolchainrpms/{x86_64,aarch64,noarch} (and similar for other chroots).

As part of #9899 and #9963 the $(STATUS_FLAGS_DIR)/toolchain_auto_cleanup.flag was added which removes all toolchain rpms from the repo folder ./build/toolchain_rpms (to remove the chance of unexpected conflicts with signatures or validation state). It simply removed the outer ./build/toolchain_rpms directory, breaking the mountpoints in the docker environment.

Oddly, as the build runs, it re-creates the toolchain folder, and the mount points contained in it reappear, but are broken.
image

The pkgworker tool has a function removeLibArchivesFromSystem() which walks the entirety of the chroot's filesystem looking for *.la files and removing them. The broken mount points are sufficiently "real" that filepath.Walk() will detect them and try to recursively walk them, but then hits readdirent /toolchainrpms/aarch64: no such file or directory (this is not unique to aarch64, it occurs on all three mounts).

We can resolve this by preserving the directory structure of the toolchain folder when running the sanitization step, so the mounts will remain intact.

Change Log
  • Use find ... -exec rm ... in $(STATUS_FLAGS_DIR)/toolchain_auto_cleanup.flag instead of a simple rm to avoid breaking docker chroot mounts.
Does this affect the toolchain?

NO

Associated issues
Test Methodology
  • Locally reproduced version of the pipeline VMs which use Docker + reusable chroots, running build commands manually.

@dmcilvaney dmcilvaney requested a review from a team as a code owner August 22, 2024 00:25
@dmcilvaney dmcilvaney changed the title Fix readdirent toolchain errors for reusable chroots Toolkit: Fix readdirent toolchain errors for reusable chroots Aug 22, 2024
@mfrw mfrw added the 3.0-dev PRs Destined for AzureLinux 3.0 label Aug 22, 2024
@dmcilvaney dmcilvaney added the bug Something isn't working label Aug 22, 2024
@dmcilvaney dmcilvaney merged commit db9a27c into microsoft:3.0-dev Aug 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3.0-dev PRs Destined for AzureLinux 3.0 bug Something isn't working Tools

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants