On 30/05/2022 14:32, Kristian Amlie wrote:
On 30/05/2022 13:48, richard.pur...@linuxfoundation.org wrote:
On Mon, 2022-05-30 at 13:46 +0200, Kristian Amlie wrote:
On 27/05/2022 16:19, richard.pur...@linuxfoundation.org wrote:
On Fri, 2022-05-27 at 14:07 +0200, Kristian Amlie via
lists.openembedded.org wrote:
Hey all,

I have a problem on kirkstone where using the "externalsrc" class wipes
out the directory mentioned in EXTERNALSRC, in other words my personal
development repository.

I have traced it down to the "do_unpack[cleandirs]" variable flag. This
flag is supposed to be removed here [1] when using "externalsrc", and
indeed I have verified that this is the case. But when the function is
about to be executed, the "cleandirs" variable flag has somehow been
restored [2]. This causes the directory to be removed after all, despite
the attempt at avoiding it.

At this point I'm a bit lost, I don't really know what happens between
those two steps. Does anyone have any idea what might be happening? It
sounds like a pretty serious bug to me, wiping out things in the home
directory of the user.

[1]
https://git.yoctoproject.org/poky/tree/meta/classes/externalsrc.bbclass?h=kirkstone#n93
[2]
https://git.yoctoproject.org/poky/tree/bitbake/lib/bb/build.py?h=kirkstone#n191

That certainly isn't supposed to happen. As you say, the code is
supposed to disable that and isn't behaving as intended. It is hard to
say more though.

Is there a test case you can share with us so we can reproduce the
issue? Without some way to replicate of more details of the environment
this occurred in, debugging it will be very hard.

Here's a way to reproduce it:

1. Take any recipe, let's say recipes-core/busybox/busybox_1.35.0.bb

2. Add "inherit go" to that recipe.

3. Add 'INHERIT += "externalsrc"' to local.conf.

4. Add 'EXTERNALSRC:pn-busybox = "/tmp/busybox"' to local.conf.

5. Run "mkdir -p /tmp/busybox/keep".

6. Run "bitbake -fc unpack busybox".

7. Afterwards, observe that "/tmp/busybox/keep" has vanished.

The key part here appears to be the "EXPORT_FUNCTIONS" statement inside
go.bbclass. If "do_unpack" is removed from there, then the mechanism
works correctly again.

Thanks, a reproducer helps a lot. This was almost certainly a result
of:

https://git.yoctoproject.org/poky/commit/?id=73fa855f6af5ef9c3a78656aa56f09d213601be2

Indeed, but that seems to only have revealed the problem. The desired behavior is for cleandirs to work, but *also* for externalsrc to be able to delete it, right?

Just for the record, and for any people googling this: Until this is fixed, just reverting the above commit works to fix this problem.

Richard, correct me if I'm wrong, but I have not yet seen any fixes for this. And unfortunately this is too deep in Bitbake for me to fix it myself. Do you think it makes sense to revert that commit in the official poky branches? I mean, the consequences of this bug are unusually dire. Especially in combination with go's common pattern of putting all source code in one directory, externalsrc can wipe out most of the source code in the user's home directory.

--
Kristian

Attachment: OpenPGP_signature
Description: OpenPGP digital signature

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#167094): 
https://lists.openembedded.org/g/openembedded-core/message/167094
Mute This Topic: https://lists.openembedded.org/mt/91374926/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to