diff mbox series

Avoid running whilst in a deleted directory.

Message ID 20251103022936.10673-1-gordon.lack@dsl.pipex.com
State New
Headers show
Series Avoid running whilst in a deleted directory. | expand

Commit Message

Gordon Lack Nov. 3, 2025, 2:29 a.m. UTC
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(+)

Comments

Alexander Kanavin Nov. 3, 2025, 10:59 a.m. UTC | #1
On Mon, 3 Nov 2025 at 03:29, Gordon Lack via lists.openembedded.org
<gordon.lack=dsl.pipex.com@lists.openembedded.org> wrote:
> +# ${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
diff mbox series

Patch

diff --git a/meta/recipes-devtools/perl/perl_5.40.2.bb b/meta/recipes-devtools/perl/perl_5.40.2.bb
index a78d2ed0be..19de35fdc7 100644
--- a/meta/recipes-devtools/perl/perl_5.40.2.bb
+++ b/meta/recipes-devtools/perl/perl_5.40.2.bb
@@ -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}