public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
* [PATCH 1/1] wic: disable generation of python bytecode cache
@ 2025-06-05 14:58 'Felix Moessbauer' via isar-users
  2025-06-06  6:19 ` 'Heinisch, Alexander' via isar-users
  0 siblings, 1 reply; 8+ messages in thread
From: 'Felix Moessbauer' via isar-users @ 2025-06-05 14:58 UTC (permalink / raw)
  To: isar-users; +Cc: jan.kiszka, Felix Moessbauer

Wic is executed as root, so the python bytecode cache is also
created as root. This is problematic as the cache is created inside the
source tree in a folder__pycache__ next to the python script itself. By
that, we end up with files belonging to root inside the repo source
tree, which makes it impossible to delete the source tree as a regular
user.

This problem became visible with the kas purge plugin that removes the
fetched layers as a regular user (these layers are fetched and managed
by kas). Also the read-only mounting of repos in kas does not help here,
as the fetched repos are not mounted ro for obvious reasons.

Anyways, we should not create files inside the source tree that do not
belong to the calling user. To fix this, we just disable the python
cache for the wic task. This is the only task that executes a python
script from the source tree as root.

Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
---
 meta/classes/imagetypes_wic.bbclass | 1 +
 1 file changed, 1 insertion(+)

diff --git a/meta/classes/imagetypes_wic.bbclass b/meta/classes/imagetypes_wic.bbclass
index 7a050e73..fb0b81a9 100644
--- a/meta/classes/imagetypes_wic.bbclass
+++ b/meta/classes/imagetypes_wic.bbclass
@@ -157,6 +157,7 @@ generate_wic_image() {
     export FAKEROOTCMD=${FAKEROOTCMD}
     export BUILDDIR=${TOPDIR}
     export MTOOLS_SKIP_CHECK=1
+    export PYTHONDONTWRITEBYTECODE=1
     mkdir -p ${IMAGE_ROOTFS}/../pseudo
     touch ${IMAGE_ROOTFS}/../pseudo/files.db
 
-- 
2.49.0

-- 
You received this message because you are subscribed to the Google Groups "isar-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/isar-users/20250605145837.1384007-1-felix.moessbauer%40siemens.com.

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

end of thread, other threads:[~2025-06-06  8:02 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-06-05 14:58 [PATCH 1/1] wic: disable generation of python bytecode cache 'Felix Moessbauer' via isar-users
2025-06-06  6:19 ` 'Heinisch, Alexander' via isar-users
2025-06-06  6:21   ` 'Jan Kiszka' via isar-users
2025-06-06  7:18     ` 'MOESSBAUER, Felix' via isar-users
2025-06-06  7:38       ` 'Jan Kiszka' via isar-users
2025-06-06  7:42         ` 'Heinisch, Alexander' via isar-users
2025-06-06  7:54           ` 'MOESSBAUER, Felix' via isar-users
2025-06-06  8:02             ` 'Heinisch, Alexander' via isar-users

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