Skip to contentSkip to conversation

Avoid running whilst in a deleted directory.

PATCH In review Gordon Lack 2 participants 2 messages Nov 3, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Avoid running whilst in a deleted directory.

This caused a problem when building on Kubuntu 25.10.

Whilst the real problem is the cp in Rust coreutils, it makes sense not to be in the directory you are about to delete.

This is a resubmission to use "cd ${WORKDIR}" rather than "cd /".

---
 meta/recipes-devtools/perl/perl_5.40.2.bb | 6 ++++++
 1 file changed, 6 insertions(+)
meta/recipes-devtools/perl/perl_5.40.2.bb +6 -0
index a78d2ed0be..19de35fdc7 100644
@@ -57,7 +57,13 @@ CFLAGS:append:toolchain-clang = " -fno-strict-aliasing"
 # Needed with -march=x86-64-v3
 CFLAGS:append:toolchain-gcc:class-target:x86-64 = " -fno-builtin-memcpy -D__NO_STRING_INLINES -U_FORTIFY_SOURCE"
 
+# ${B} will have been set as our current directory immediately before
+# do_configure is called. So let's avoid any problems associated
+# with it being deleted from underneath us by moving to somewhere else.
+# We're being put back there (the new version) at the end of this code
+#
 do_configure:prepend() {
+    cd ${WORKDIR}
     rm -rf ${B}
     cp -rfp ${S} ${B}
     cp -rfp ${STAGING_DATADIR_NATIVE}/perl-cross/* ${B}
Signature · 1 line
2.51.0
#1 lore raw

meta/recipes-devtools/perl/perl_5.40.2.bb CFLAGS:append:toolchain-clang = " -fno-strict-aliasing" · line 66

Quoted 7 lines · Gordon Lack via lists.openembedded.org
meta/recipes-devtools/perl/perl_5.40.2.bb +6 -0
+# ${B} will have been set as our current directory immediately before
+# do_configure is called. So let's avoid any problems associated
+# with it being deleted from underneath us by moving to somewhere else.
+# We're being put back there (the new version) at the end of this code
+#
 do_configure:prepend() {
+    cd ${WORKDIR}

Placing the comment like this isn't great for readability either because it detaches it from the line it's commenting on. So the brain needs to do extra work to find the line (yes, it's the first line now, but may not stay that way in the future).

I really do think it's better to place it next to the line and indent to the line. Indenting comments is the de facto standard pretty much everywhere, and changing it to match your preference in one place will both introduce an inconsistency, and not actually help you read all other code.

Alex