From f2b4b472983817021d9ffb60838b2b36b9376b20 Mon Sep 17 00:00:00 2001 From: Ivan Petkov Date: Sun, 24 Nov 2024 00:12:23 +0000 Subject: [PATCH] removeReferencesToVendoredSourcesHook: dedup references (#745) Debug builds might have a ton of references to sources, and `sed` does not like it when we feed it a massive amount of duplicates --- CHANGELOG.md | 4 ++++ lib/setupHooks/removeReferencesToVendoredSourcesHook.sh | 1 + 2 files changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c2907a9c..318bab79 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## Unreleased +### Fixed +* `removeReferencesToVendoredSources` now deduplicates any found references to + avoid pathological memory usage before removing them. + ## [0.19.3] - 2024-11-18 A republish of 0.19.2 which was incorrectly tagged. diff --git a/lib/setupHooks/removeReferencesToVendoredSourcesHook.sh b/lib/setupHooks/removeReferencesToVendoredSourcesHook.sh index 5f121452..8e339c19 100644 --- a/lib/setupHooks/removeReferencesToVendoredSourcesHook.sh +++ b/lib/setupHooks/removeReferencesToVendoredSourcesHook.sh @@ -23,6 +23,7 @@ removeReferencesToVendoredSources() { xargs -I DIR find -H DIR -type l -exec readlink '{}' \; ) | grep --only-matching '@storeDir@/[a-z0-9]\{32\}' | + sort -u | while read crateSource; do echo -n '\|'"${crateSource#@storeDir@/}"; done || true # Handle if vendoredDir doesn't point to the store