diff mbox series

[isar-cip-core,v2,2/3] erofs: ensure only dir prefixes are excluded

Message ID 20241211095456.2735691-2-felix.moessbauer@siemens.com (mailing list archive)
State New
Headers show
Series [isar-cip-core,v2,1/3] fix expansion of erofs exclude dirs | expand

Commit Message

Felix Moessbauer Dec. 11, 2024, 9:54 a.m. UTC
The regex used to implement the path exclusions in erofs needs to be
"anchored" to only match path prefixes but not arbitrary sections of the
path. Previously, also paths that contained an excluded part were
excluded as well. Further, we must single-quote the regex to ensure that
the '*' is not expanded by bash-globbing.

I further considered to use --exclude-path, but this is not an option as
it excludes the excluded directory as well. In case of /var and /boot
the directories (not the content) needs to be present as mountpoint.
These semantics differ from the equally named parameter in squashfs.

Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
---
 classes/erofs.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/classes/erofs.bbclass b/classes/erofs.bbclass
index 189c1ea..72458bb 100644
--- a/classes/erofs.bbclass
+++ b/classes/erofs.bbclass
@@ -23,7 +23,7 @@  python __anonymous() {
     # Use regex to exclude only content of the directory.
     # This allows to use the directory as a mount point.
     for dir in exclude_directories:
-        args += " --exclude-regex {dir}/.* ".format(dir=dir)
+        args += " --exclude-regex '^{dir}/.*' ".format(dir=dir)
     d.appendVar('EROFS_CREATION_ARGS', args)
 }