Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/1] package/python3: use depth first search for directory removal
@ 2024-07-16 14:58 Vincent Fazio
  2024-07-16 21:28 ` Thomas Petazzoni via buildroot
  0 siblings, 1 reply; 2+ messages in thread
From: Vincent Fazio @ 2024-07-16 14:58 UTC (permalink / raw)
  To: buildroot; +Cc: James Hilliard, Vincent Fazio, Asaf Kahlon, Thomas Petazzoni

Previously, Python builds could intermittently fail when removing files
if `find` removed a directory before searching within it [0].

An arbitrary example:

  /tmp/tmp.h9KMUse5zO $ find . -type d -name __pycache__ -exec rm -rvf {} \; ; echo -e "RETURN CODE: $?"
  removed directory './a/b/c/d/e/__pycache__'
  find: ‘./a/b/c/d/e/__pycache__’: No such file or directory
  removed directory './a/b/c/d/e/f/__pycache__'
  find: ‘./a/b/c/d/e/f/__pycache__’: No such file or directory
  removed directory './a/b/c/d/e/f/g/__pycache__'
  RETURN CODE: 1

Now, pass the `-depth` argument to `find` so a depth-first search is
performed to avoid trying to search within an already deleted folder.

Fixes: 54d48c8cad4e ("package/python3: miscellaneous fixups")
Fixes: http://autobuild.buildroot.net/results/ba1d4213ae9912d53412ded6d8e257b67a4f7c0e/
Signed-off-by: Vincent Fazio <vfazio@gmail.com>
---
 package/python3/python3.mk | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/package/python3/python3.mk b/package/python3/python3.mk
index a82bc47a57..f85dcfad30 100644
--- a/package/python3/python3.mk
+++ b/package/python3/python3.mk
@@ -205,8 +205,8 @@ define PYTHON3_REMOVE_USELESS_FILES
 	rm -f $(TARGET_DIR)/usr/bin/python$(PYTHON3_VERSION_MAJOR)-config
 	rm -f $(TARGET_DIR)/usr/bin/python3-config
 	find $(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)/config-$(PYTHON3_VERSION_MAJOR)*/ \
-		-type f -not -name Makefile -exec rm -rf {} \;
-	find $(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)/ -type d \
+		-depth -type f -not -name Makefile -exec rm -rf {} \;
+	find $(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)/ -depth -type d \
 		-name __pycache__ -exec rm -rf {} \;
 endef
 
-- 
2.34.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-07-16 21:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-16 14:58 [Buildroot] [PATCH 1/1] package/python3: use depth first search for directory removal Vincent Fazio
2024-07-16 21:28 ` Thomas Petazzoni via buildroot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox