* [PATCH v4 0/4] wic: Fix permissions
@ 2020-04-09 10:49 Ricardo Ribalda
2020-04-09 10:49 ` [PATCH v4 1/4] wic: Fix permissions when using exclude or include path Ricardo Ribalda
` (4 more replies)
0 siblings, 5 replies; 7+ messages in thread
From: Ricardo Ribalda @ 2020-04-09 10:49 UTC (permalink / raw)
To: openembedded-core, Paul Barker; +Cc: Ricardo Ribalda Delgado
Hi
Today wic behaves differently if we run it from bitbake of directly from the
commandline.
When it is run from bitbake, the permissions/usersnames are handled by the
pseudo database of the main image.
When it is run from the comandline , it is run outside the main image database.
This results on permissions/usernames not working ok on some usecases on both
bitbake and wic.
This is an attempt to fix all the permission bugs that I am aware from wic.
Using the following usecases
#exclude-path
part / --source rootfs --fstype=ext4 --exclude-path=home
#split_partition
part / --source rootfs --ondisk sda --fstype=ext4 --exclude-path=etc/
part /etc --source rootfs --rootfs-dir=tmp/work/qt5222-poky-linux/core-image-minimal/1.0-r0/rootfs/etc/ --fstype=ext4
#multi_partition
part / --source rootfs --ondisk sda --fstype=ext4
part /export --source rootfs --rootfs=core-image-minimal-mtdutils --fstype=ext4
With the current master:
-------------------------
#exclude-path
From Bitbake: OK
wic cmdline: FAIL
#split_partition
From Bitbake: OK
wic cmdline: FAIL, permissions invalid on both partitions
#multi_partition
From Bitbake: FAIL second partition
wic cmdline: OK
After: wic: Fix permissions when using exclude or include path
--------------------------------------------------------------------
#exclude-path
From Bitbake: OK
wic cmdline: OK
#split_partition
From Bitbake: OK
wic cmdline: FAIL, permissions invalid on second partition
#multi_partition
From Bitbake: FAIL second partition
wic cmdline: OK
After: wic: Fix multi images .wks with bitbake
----------------------------------------------
#exclude-path
From Bitbake: OK
wic cmdline: OK
#split_partition
From Bitbake: FAIL, permissions invalid on second partition
wic cmdline: FAIL, permissions invalid on second partition
#multi_partition
From Bitbake: OK
wic cmdline: OK
After: wic: Add --change-directory argument
--------------------------------------------
we can have a .wks like:
part / --source rootfs --ondisk sda --fstype=ext4 --exclude-path=etc/
part /etc --source rootfs --fstype=ext4 --change-directory=/etc
Wich works fine from bitbake and from cmdline, and has the same functionality as
split_partition.
Ricardo Ribalda Delgado (4):
wic: Fix permissions when using exclude or include path
wic: Fix multi images .wks with bitbake
wic: Add --change-directory argument
wic: Continue if excluded_path does not exist
meta/classes/image_types_wic.bbclass | 8 +++-
scripts/lib/wic/help.py | 6 +++
scripts/lib/wic/ksparser.py | 1 +
scripts/lib/wic/partition.py | 15 ++++---
scripts/lib/wic/plugins/source/rootfs.py | 52 ++++++++++++++++++++++--
5 files changed, 68 insertions(+), 14 deletions(-)
--
2.25.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v4 1/4] wic: Fix permissions when using exclude or include path
2020-04-09 10:49 [PATCH v4 0/4] wic: Fix permissions Ricardo Ribalda
@ 2020-04-09 10:49 ` Ricardo Ribalda
2020-04-09 10:49 ` [PATCH v4 2/4] wic: Fix multi images .wks with bitbake Ricardo Ribalda
` (3 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Ricardo Ribalda @ 2020-04-09 10:49 UTC (permalink / raw)
To: openembedded-core, Paul Barker; +Cc: Ricardo Ribalda Delgado
When parameters include_path or exclude_path are passed to the rootfs
plugin, it will copy the partition content into a folder and make all
the modifications there.
This is done using copyhardlinktree(), which does not take into
consideration the content of the pseudo folder, which contains the
information about the right permissions and ownership of the folders.
This results in a rootfs owned by the user that is running the wic
command (usually UID 1000), which makes some rootfs unbootable.
This bug can be easily triggerd with the following .wks
part / --source rootfs --fstype=ext4 --exclude-path=home
And this sequence:
$ wic create test-permissions -e core-image-minimal -o test/
$ sudo mount test/test-permissions-202004080823-sda.direct.p1 /mnt
$ ls -la /mnt/etc/shadow
To fix this we copy the content of the pseudo folders to the new folder
and modify the pseudo database using the "pseudo -B" command.
If the rootfs is not a rootfs generated by bitbake a warning is shown
making the user aware that the permissions on the target might not match
what he expects.
WARNING: /tmp/test/../pseudo folder does not exist. Usernames and permissions will be invalid
Cc: Paul Barker <pbarker@konsulko.com>
Signed-off-by: Ricardo Ribalda Delgado <ricardo@ribalda.com>
---
scripts/lib/wic/partition.py | 7 +++--
scripts/lib/wic/plugins/source/rootfs.py | 36 ++++++++++++++++++++++--
2 files changed, 37 insertions(+), 6 deletions(-)
diff --git a/scripts/lib/wic/partition.py b/scripts/lib/wic/partition.py
index 2d95f78439..b02711be37 100644
--- a/scripts/lib/wic/partition.py
+++ b/scripts/lib/wic/partition.py
@@ -190,7 +190,7 @@ class Partition():
(self.mountpoint, self.size, self.fixed_size))
def prepare_rootfs(self, cr_workdir, oe_builddir, rootfs_dir,
- native_sysroot, real_rootfs = True):
+ native_sysroot, real_rootfs = True, pseudo_dir = None):
"""
Prepare content for a rootfs partition i.e. create a partition
and fill it from a /rootfs dir.
@@ -198,8 +198,9 @@ class Partition():
Currently handles ext2/3/4, btrfs, vfat and squashfs.
"""
p_prefix = os.environ.get("PSEUDO_PREFIX", "%s/usr" % native_sysroot)
- p_localstatedir = os.environ.get("PSEUDO_LOCALSTATEDIR",
- "%s/../pseudo" % rootfs_dir)
+ if (pseudo_dir == None):
+ pseudo_dir = "%s/../pseudo" % rootfs_dir
+ p_localstatedir = os.environ.get("PSEUDO_LOCALSTATEDIR", pseudo_dir)
p_passwd = os.environ.get("PSEUDO_PASSWD", rootfs_dir)
p_nosymlinkexp = os.environ.get("PSEUDO_NOSYMLINKEXP", "1")
pseudo = "export PSEUDO_PREFIX=%s;" % p_prefix
diff --git a/scripts/lib/wic/plugins/source/rootfs.py b/scripts/lib/wic/plugins/source/rootfs.py
index 705aeb5563..caad9efccc 100644
--- a/scripts/lib/wic/plugins/source/rootfs.py
+++ b/scripts/lib/wic/plugins/source/rootfs.py
@@ -20,7 +20,7 @@ from oe.path import copyhardlinktree
from wic import WicError
from wic.pluginbase import SourcePlugin
-from wic.misc import get_bitbake_var
+from wic.misc import get_bitbake_var, exec_native_cmd
logger = logging.getLogger('wic')
@@ -44,6 +44,15 @@ class RootfsPlugin(SourcePlugin):
return os.path.realpath(image_rootfs_dir)
+ @staticmethod
+ def __get_pseudo(native_sysroot, rootfs, pseudo_dir):
+ pseudo = "export PSEUDO_PREFIX=%s/usr;" % native_sysroot
+ pseudo += "export PSEUDO_LOCALSTATEDIR=%s;" % pseudo_dir
+ pseudo += "export PSEUDO_PASSWD=%s;" % rootfs
+ pseudo += "export PSEUDO_NOSYMLINKEXP=1;"
+ pseudo += "%s " % get_bitbake_var("FAKEROOTCMD")
+ return pseudo
+
@classmethod
def do_prepare_partition(cls, part, source_params, cr, cr_workdir,
oe_builddir, bootimg_dir, kernel_dir,
@@ -68,8 +77,14 @@ class RootfsPlugin(SourcePlugin):
"it is not a valid path, exiting" % part.rootfs_dir)
part.rootfs_dir = cls.__get_rootfs_dir(rootfs_dir)
+ pseudo_dir = os.path.join(part.rootfs_dir, "../pseudo")
+ if not os.path.lexists(pseudo_dir):
+ logger.warn("%s folder does not exist. "
+ "Usernames and permissions will be invalid " % pseudo_dir)
+ pseudo_dir = None
new_rootfs = None
+ new_pseudo = None
# Handle excluded paths.
if part.exclude_path or part.include_path:
# We need a new rootfs directory we can delete files from. Copy to
@@ -78,9 +93,23 @@ class RootfsPlugin(SourcePlugin):
if os.path.lexists(new_rootfs):
shutil.rmtree(os.path.join(new_rootfs))
-
copyhardlinktree(part.rootfs_dir, new_rootfs)
+ # Convert the pseudo directory to its new location
+ if (pseudo_dir):
+ new_pseudo = os.path.join(new_rootfs, "../pseudo%d" % part.lineno)
+ if os.path.lexists(new_pseudo):
+ shutil.rmtree(new_pseudo)
+ os.mkdir(new_pseudo)
+ shutil.copy(os.path.join(pseudo_dir, "files.db"),
+ os.path.join(new_pseudo, "files.db"))
+
+ pseudo_cmd = "%s -B -m %s -M %s" % (cls.__get_pseudo(native_sysroot,
+ new_rootfs,
+ new_pseudo),
+ part.rootfs_dir, new_rootfs)
+ exec_native_cmd(pseudo_cmd, native_sysroot)
+
for path in part.include_path or []:
copyhardlinktree(path, new_rootfs)
@@ -112,4 +141,5 @@ class RootfsPlugin(SourcePlugin):
shutil.rmtree(full_path)
part.prepare_rootfs(cr_workdir, oe_builddir,
- new_rootfs or part.rootfs_dir, native_sysroot)
+ new_rootfs or part.rootfs_dir, native_sysroot,
+ pseudo_dir = new_pseudo or pseudo_dir)
--
2.25.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v4 2/4] wic: Fix multi images .wks with bitbake
2020-04-09 10:49 [PATCH v4 0/4] wic: Fix permissions Ricardo Ribalda
2020-04-09 10:49 ` [PATCH v4 1/4] wic: Fix permissions when using exclude or include path Ricardo Ribalda
@ 2020-04-09 10:49 ` Ricardo Ribalda
2020-04-09 10:49 ` [PATCH v4 3/4] wic: Add --change-directory argument Ricardo Ribalda
` (2 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Ricardo Ribalda @ 2020-04-09 10:49 UTC (permalink / raw)
To: openembedded-core, Paul Barker; +Cc: Ricardo Ribalda Delgado
In order to support .wks files with multiple images inside bitbake we
need to explicitly set the pseudo database in use.
Eg: If we try this .mks:
part / --source rootfs --ondisk sda --fstype=ext4
part /export --source rootfs --rootfs=core-image-minimal-mtdutils --fstype=ext4
The username for all the files under /export will be set to the runner
of bitbake (usually UID 1000).
Before we run wic, we need to make sure that the pseudo database will be
flushed, and contains all the data needed.
Signed-off-by: Ricardo Ribalda Delgado <ricardo@ribalda.com>
---
meta/classes/image_types_wic.bbclass | 8 ++++++--
scripts/lib/wic/partition.py | 9 +++------
2 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/meta/classes/image_types_wic.bbclass b/meta/classes/image_types_wic.bbclass
index b83308b45c..96ed0473ee 100644
--- a/meta/classes/image_types_wic.bbclass
+++ b/meta/classes/image_types_wic.bbclass
@@ -32,8 +32,7 @@ IMAGE_CMD_wic () {
if [ -z "$wks" ]; then
bbfatal "No kickstart files from WKS_FILES were found: ${WKS_FILES}. Please set WKS_FILE or WKS_FILES appropriately."
fi
-
- BUILDDIR="${TOPDIR}" wic create "$wks" --vars "${STAGING_DIR}/${MACHINE}/imgdata/" -e "${IMAGE_BASENAME}" -o "$build_wic/" ${WIC_CREATE_EXTRA_ARGS}
+ BUILDDIR="${TOPDIR}" PSEUDO_UNLOAD=1 wic create "$wks" --vars "${STAGING_DIR}/${MACHINE}/imgdata/" -e "${IMAGE_BASENAME}" -o "$build_wic/" ${WIC_CREATE_EXTRA_ARGS}
mv "$build_wic/$(basename "${wks%.wks}")"*.direct "$out${IMAGE_NAME_SUFFIX}.wic"
}
IMAGE_CMD_wic[vardepsexclude] = "WKS_FULL_PATH WKS_FILES TOPDIR"
@@ -86,6 +85,10 @@ python do_write_wks_template () {
bb.utils.copyfile(wks_file, "%s/%s" % (depdir, basename + '-' + os.path.basename(wks_file)))
}
+do_flush_pseudodb() {
+ ${FAKEROOTENV} ${FAKEROOTCMD} -S
+}
+
python () {
if d.getVar('USING_WIC'):
wks_file_u = d.getVar('WKS_FULL_PATH', False)
@@ -139,6 +142,7 @@ python do_rootfs_wicenv () {
depdir = d.getVar('IMGDEPLOYDIR')
bb.utils.copyfile(os.path.join(outdir, basename) + '.env', os.path.join(depdir, basename) + '.env')
}
+addtask do_flush_pseudodb after do_image before do_image_wic
addtask do_rootfs_wicenv after do_image before do_image_wic
do_rootfs_wicenv[vardeps] += "${WICVARS}"
do_rootfs_wicenv[prefuncs] = 'set_image_size'
diff --git a/scripts/lib/wic/partition.py b/scripts/lib/wic/partition.py
index b02711be37..d850fbd1b1 100644
--- a/scripts/lib/wic/partition.py
+++ b/scripts/lib/wic/partition.py
@@ -200,13 +200,10 @@ class Partition():
p_prefix = os.environ.get("PSEUDO_PREFIX", "%s/usr" % native_sysroot)
if (pseudo_dir == None):
pseudo_dir = "%s/../pseudo" % rootfs_dir
- p_localstatedir = os.environ.get("PSEUDO_LOCALSTATEDIR", pseudo_dir)
- p_passwd = os.environ.get("PSEUDO_PASSWD", rootfs_dir)
- p_nosymlinkexp = os.environ.get("PSEUDO_NOSYMLINKEXP", "1")
pseudo = "export PSEUDO_PREFIX=%s;" % p_prefix
- pseudo += "export PSEUDO_LOCALSTATEDIR=%s;" % p_localstatedir
- pseudo += "export PSEUDO_PASSWD=%s;" % p_passwd
- pseudo += "export PSEUDO_NOSYMLINKEXP=%s;" % p_nosymlinkexp
+ pseudo += "export PSEUDO_LOCALSTATEDIR=%s;" % pseudo_dir
+ pseudo += "export PSEUDO_PASSWD=%s;" % rootfs_dir
+ pseudo += "export PSEUDO_NOSYMLINKEXP=1;"
pseudo += "%s " % get_bitbake_var("FAKEROOTCMD")
rootfs = "%s/rootfs_%s.%s.%s" % (cr_workdir, self.label,
--
2.25.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v4 3/4] wic: Add --change-directory argument
2020-04-09 10:49 [PATCH v4 0/4] wic: Fix permissions Ricardo Ribalda
2020-04-09 10:49 ` [PATCH v4 1/4] wic: Fix permissions when using exclude or include path Ricardo Ribalda
2020-04-09 10:49 ` [PATCH v4 2/4] wic: Fix multi images .wks with bitbake Ricardo Ribalda
@ 2020-04-09 10:49 ` Ricardo Ribalda
2020-04-09 10:49 ` [PATCH v4 4/4] wic: Continue if excluded_path does not exist Ricardo Ribalda
2020-04-09 11:10 ` [PATCH v4 0/4] wic: Fix permissions Paul Barker
4 siblings, 0 replies; 7+ messages in thread
From: Ricardo Ribalda @ 2020-04-09 10:49 UTC (permalink / raw)
To: openembedded-core, Paul Barker; +Cc: Ricardo Ribalda Delgado
This option allows to specify which part of a rootfs is going to be
included, the same way the -C argument on tar.
Thanks to this option we can make sure the permissions and usernames
on the target partition are respected, and also simplify the creation of
splitted partitons, not neeting to invoke external vars or using .wks.in
files. Eg:
part / --source rootfs --ondisk sda --fstype=ext4 --exclude-path=etc/
part /etc --source rootfs --fstype=ext4 --change-directory=/etc
Signed-off-by: Ricardo Ribalda Delgado <ricardo@ribalda.com>
---
scripts/lib/wic/help.py | 6 ++++++
scripts/lib/wic/ksparser.py | 1 +
scripts/lib/wic/partition.py | 1 +
scripts/lib/wic/plugins/source/rootfs.py | 17 ++++++++++++++---
4 files changed, 22 insertions(+), 3 deletions(-)
diff --git a/scripts/lib/wic/help.py b/scripts/lib/wic/help.py
index 1e3d06a87b..62a2a90e79 100644
--- a/scripts/lib/wic/help.py
+++ b/scripts/lib/wic/help.py
@@ -980,6 +980,12 @@ DESCRIPTION
copies. This option only has an effect with the rootfs
source plugin.
+ --change-directory: This option is specific to wic. It changes to the
+ given directory before copying the files. This
+ option is useful when we want to split a rootfs in
+ multiple partitions and we want to keep the right
+ permissions and usernames in all the partitions.
+
--extra-space: This option is specific to wic. It adds extra
space after the space filled by the content
of the partition. The final size can go
diff --git a/scripts/lib/wic/ksparser.py b/scripts/lib/wic/ksparser.py
index 650b976223..c60869d397 100644
--- a/scripts/lib/wic/ksparser.py
+++ b/scripts/lib/wic/ksparser.py
@@ -138,6 +138,7 @@ class KickStart():
part.add_argument('--align', type=int)
part.add_argument('--exclude-path', nargs='+')
part.add_argument('--include-path', nargs='+')
+ part.add_argument('--change-directory')
part.add_argument("--extra-space", type=sizetype)
part.add_argument('--fsoptions', dest='fsopts')
part.add_argument('--fstype', default='vfat',
diff --git a/scripts/lib/wic/partition.py b/scripts/lib/wic/partition.py
index d850fbd1b1..3240be072a 100644
--- a/scripts/lib/wic/partition.py
+++ b/scripts/lib/wic/partition.py
@@ -31,6 +31,7 @@ class Partition():
self.extra_space = args.extra_space
self.exclude_path = args.exclude_path
self.include_path = args.include_path
+ self.change_directory = args.change_directory
self.fsopts = args.fsopts
self.fstype = args.fstype
self.label = args.label
diff --git a/scripts/lib/wic/plugins/source/rootfs.py b/scripts/lib/wic/plugins/source/rootfs.py
index caad9efccc..d3742802bb 100644
--- a/scripts/lib/wic/plugins/source/rootfs.py
+++ b/scripts/lib/wic/plugins/source/rootfs.py
@@ -86,14 +86,25 @@ class RootfsPlugin(SourcePlugin):
new_rootfs = None
new_pseudo = None
# Handle excluded paths.
- if part.exclude_path or part.include_path:
+ if part.exclude_path or part.include_path or part.change_directory:
# We need a new rootfs directory we can delete files from. Copy to
# workdir.
new_rootfs = os.path.realpath(os.path.join(cr_workdir, "rootfs%d" % part.lineno))
if os.path.lexists(new_rootfs):
shutil.rmtree(os.path.join(new_rootfs))
- copyhardlinktree(part.rootfs_dir, new_rootfs)
+
+ if part.change_directory:
+ cd = part.change_directory
+ if cd[-1] == '/':
+ cd = cd[:-1]
+ if os.path.isabs(cd):
+ logger.error("Must be relative: --change-directory=%s" % cd)
+ sys.exit(1)
+ orig_dir = os.path.join(part.rootfs_dir, cd)
+ else:
+ orig_dir = part.rootfs_dir
+ copyhardlinktree(orig_dir, new_rootfs)
# Convert the pseudo directory to its new location
if (pseudo_dir):
@@ -107,7 +118,7 @@ class RootfsPlugin(SourcePlugin):
pseudo_cmd = "%s -B -m %s -M %s" % (cls.__get_pseudo(native_sysroot,
new_rootfs,
new_pseudo),
- part.rootfs_dir, new_rootfs)
+ orig_dir, new_rootfs)
exec_native_cmd(pseudo_cmd, native_sysroot)
for path in part.include_path or []:
--
2.25.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v4 4/4] wic: Continue if excluded_path does not exist
2020-04-09 10:49 [PATCH v4 0/4] wic: Fix permissions Ricardo Ribalda
` (2 preceding siblings ...)
2020-04-09 10:49 ` [PATCH v4 3/4] wic: Add --change-directory argument Ricardo Ribalda
@ 2020-04-09 10:49 ` Ricardo Ribalda
2020-04-09 11:10 ` [PATCH v4 0/4] wic: Fix permissions Paul Barker
4 siblings, 0 replies; 7+ messages in thread
From: Ricardo Ribalda @ 2020-04-09 10:49 UTC (permalink / raw)
To: openembedded-core, Paul Barker; +Cc: Ricardo Ribalda Delgado
If an excuded path does not exist, continue without an error.
This allows to seamleasly reuse .wks among different projects.
Eg:
part / --source rootfs --fstype=ext4 --exclude-path=/opt/private_keys
Where /opt/private_keys in only populated by some of the image.bb files.
Signed-off-by: Ricardo Ribalda Delgado <ricardo@ribalda.com>
---
scripts/lib/wic/plugins/source/rootfs.py | 3 +++
1 file changed, 3 insertions(+)
diff --git a/scripts/lib/wic/plugins/source/rootfs.py b/scripts/lib/wic/plugins/source/rootfs.py
index d3742802bb..8874ac62c4 100644
--- a/scripts/lib/wic/plugins/source/rootfs.py
+++ b/scripts/lib/wic/plugins/source/rootfs.py
@@ -131,6 +131,9 @@ class RootfsPlugin(SourcePlugin):
sys.exit(1)
full_path = os.path.realpath(os.path.join(new_rootfs, path))
+
+ if not os.path.lexists(full_path):
+ continue
# Disallow climbing outside of parent directory using '..',
# because doing so could be quite disastrous (we will delete the
--
2.25.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v4 0/4] wic: Fix permissions
2020-04-09 10:49 [PATCH v4 0/4] wic: Fix permissions Ricardo Ribalda
` (3 preceding siblings ...)
2020-04-09 10:49 ` [PATCH v4 4/4] wic: Continue if excluded_path does not exist Ricardo Ribalda
@ 2020-04-09 11:10 ` Paul Barker
2020-04-09 11:32 ` Ricardo Ribalda
4 siblings, 1 reply; 7+ messages in thread
From: Paul Barker @ 2020-04-09 11:10 UTC (permalink / raw)
To: Ricardo Ribalda Delgado; +Cc: openembedded-core
On Thu, 9 Apr 2020 12:49:47 +0200
Ricardo Ribalda Delgado <ricardo@ribalda.com> wrote:
> Hi
>
>
> Today wic behaves differently if we run it from bitbake of directly from the
> commandline.
>
> When it is run from bitbake, the permissions/usersnames are handled by the
> pseudo database of the main image.
>
> When it is run from the comandline , it is run outside the main image database.
>
> This results on permissions/usernames not working ok on some usecases on both
> bitbake and wic.
>
>
> This is an attempt to fix all the permission bugs that I am aware from wic.
> Using the following usecases
>
>
> #exclude-path
> part / --source rootfs --fstype=ext4 --exclude-path=home
>
> #split_partition
> part / --source rootfs --ondisk sda --fstype=ext4 --exclude-path=etc/
> part /etc --source rootfs --rootfs-dir=tmp/work/qt5222-poky-linux/core-image-minimal/1.0-r0/rootfs/etc/ --fstype=ext4
>
> #multi_partition
> part / --source rootfs --ondisk sda --fstype=ext4
> part /export --source rootfs --rootfs=core-image-minimal-mtdutils --fstype=ext4
>
>
> With the current master:
> -------------------------
> #exclude-path
> From Bitbake: OK
> wic cmdline: FAIL
>
> #split_partition
> From Bitbake: OK
> wic cmdline: FAIL, permissions invalid on both partitions
>
> #multi_partition
> From Bitbake: FAIL second partition
> wic cmdline: OK
>
>
> After: wic: Fix permissions when using exclude or include path
> --------------------------------------------------------------------
> #exclude-path
> From Bitbake: OK
> wic cmdline: OK
>
> #split_partition
> From Bitbake: OK
> wic cmdline: FAIL, permissions invalid on second partition
>
> #multi_partition
> From Bitbake: FAIL second partition
> wic cmdline: OK
>
>
> After: wic: Fix multi images .wks with bitbake
> ----------------------------------------------
> #exclude-path
> From Bitbake: OK
> wic cmdline: OK
>
> #split_partition
> From Bitbake: FAIL, permissions invalid on second partition
> wic cmdline: FAIL, permissions invalid on second partition
>
> #multi_partition
> From Bitbake: OK
> wic cmdline: OK
>
This looks really good, are you able to automate any of these tests and put
them in meta/lib/oeqa/selftest/cases/wic.py?
>
>
> After: wic: Add --change-directory argument
> --------------------------------------------
>
> we can have a .wks like:
> part / --source rootfs --ondisk sda --fstype=ext4 --exclude-path=etc/
> part /etc --source rootfs --fstype=ext4 --change-directory=/etc
>
>
> Wich works fine from bitbake and from cmdline, and has the same functionality as
> split_partition.
>
>
> Ricardo Ribalda Delgado (4):
> wic: Fix permissions when using exclude or include path
> wic: Fix multi images .wks with bitbake
> wic: Add --change-directory argument
> wic: Continue if excluded_path does not exist
>
> meta/classes/image_types_wic.bbclass | 8 +++-
> scripts/lib/wic/help.py | 6 +++
> scripts/lib/wic/ksparser.py | 1 +
> scripts/lib/wic/partition.py | 15 ++++---
> scripts/lib/wic/plugins/source/rootfs.py | 52 ++++++++++++++++++++++--
> 5 files changed, 68 insertions(+), 14 deletions(-)
>
I'll give this a detailed review over the weekend. Looks good at first
glance, though I may suggest renaming `--change-directory` to something else
so it's more obvious what it's doing when you just read that in a wks file.
Perhaps `--part-subdir`, I don't know. Let's not bikeshed it too much though.
Thanks,
--
Paul Barker
Konsulko Group
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v4 0/4] wic: Fix permissions
2020-04-09 11:10 ` [PATCH v4 0/4] wic: Fix permissions Paul Barker
@ 2020-04-09 11:32 ` Ricardo Ribalda
0 siblings, 0 replies; 7+ messages in thread
From: Ricardo Ribalda @ 2020-04-09 11:32 UTC (permalink / raw)
To: Paul Barker; +Cc: openembedded-core
Hi Paul
On Thu, Apr 9, 2020 at 1:10 PM Paul Barker <pbarker@konsulko.com> wrote:
>
> On Thu, 9 Apr 2020 12:49:47 +0200
> Ricardo Ribalda Delgado <ricardo@ribalda.com> wrote:
>
> > Hi
> >
> >
> > Today wic behaves differently if we run it from bitbake of directly from the
> > commandline.
> >
> > When it is run from bitbake, the permissions/usersnames are handled by the
> > pseudo database of the main image.
> >
> > When it is run from the comandline , it is run outside the main image database.
> >
> > This results on permissions/usernames not working ok on some usecases on both
> > bitbake and wic.
> >
> >
> > This is an attempt to fix all the permission bugs that I am aware from wic.
> > Using the following usecases
> >
> >
> > #exclude-path
> > part / --source rootfs --fstype=ext4 --exclude-path=home
> >
> > #split_partition
> > part / --source rootfs --ondisk sda --fstype=ext4 --exclude-path=etc/
> > part /etc --source rootfs --rootfs-dir=tmp/work/qt5222-poky-linux/core-image-minimal/1.0-r0/rootfs/etc/ --fstype=ext4
> >
> > #multi_partition
> > part / --source rootfs --ondisk sda --fstype=ext4
> > part /export --source rootfs --rootfs=core-image-minimal-mtdutils --fstype=ext4
> >
> >
> > With the current master:
> > -------------------------
> > #exclude-path
> > From Bitbake: OK
> > wic cmdline: FAIL
> >
> > #split_partition
> > From Bitbake: OK
> > wic cmdline: FAIL, permissions invalid on both partitions
> >
> > #multi_partition
> > From Bitbake: FAIL second partition
> > wic cmdline: OK
> >
> >
> > After: wic: Fix permissions when using exclude or include path
> > --------------------------------------------------------------------
> > #exclude-path
> > From Bitbake: OK
> > wic cmdline: OK
> >
> > #split_partition
> > From Bitbake: OK
> > wic cmdline: FAIL, permissions invalid on second partition
> >
> > #multi_partition
> > From Bitbake: FAIL second partition
> > wic cmdline: OK
> >
> >
> > After: wic: Fix multi images .wks with bitbake
> > ----------------------------------------------
> > #exclude-path
> > From Bitbake: OK
> > wic cmdline: OK
> >
> > #split_partition
> > From Bitbake: FAIL, permissions invalid on second partition
> > wic cmdline: FAIL, permissions invalid on second partition
> >
> > #multi_partition
> > From Bitbake: OK
> > wic cmdline: OK
> >
>
> This looks really good, are you able to automate any of these tests and put
> them in meta/lib/oeqa/selftest/cases/wic.py?
Havent done it before, but for sure I can give it a try.
Any good guide I can use? Last time I was playing with selftest
whenever I changed something on a test I had to run the whole test
from scratch, which is not very productive :).
>
> >
> >
> > After: wic: Add --change-directory argument
> > --------------------------------------------
> >
> > we can have a .wks like:
> > part / --source rootfs --ondisk sda --fstype=ext4 --exclude-path=etc/
> > part /etc --source rootfs --fstype=ext4 --change-directory=/etc
> >
> >
> > Wich works fine from bitbake and from cmdline, and has the same functionality as
> > split_partition.
> >
> >
> > Ricardo Ribalda Delgado (4):
> > wic: Fix permissions when using exclude or include path
> > wic: Fix multi images .wks with bitbake
> > wic: Add --change-directory argument
> > wic: Continue if excluded_path does not exist
> >
> > meta/classes/image_types_wic.bbclass | 8 +++-
> > scripts/lib/wic/help.py | 6 +++
> > scripts/lib/wic/ksparser.py | 1 +
> > scripts/lib/wic/partition.py | 15 ++++---
> > scripts/lib/wic/plugins/source/rootfs.py | 52 ++++++++++++++++++++++--
> > 5 files changed, 68 insertions(+), 14 deletions(-)
> >
>
> I'll give this a detailed review over the weekend. Looks good at first
> glance, though I may suggest renaming `--change-directory` to something else
> so it's more obvious what it's doing when you just read that in a wks file.
> Perhaps `--part-subdir`, I don't know. Let's not bikeshed it too much though.
>
I do not care about the name, I have used tar as "inspiration"
-C, --directory=DIR
Change to DIR before performing any operations. This option is
order-sensitive, i.e. it affects all options that follow.
If you have any preference on the name I will take it.
Thanks!
> Thanks,
>
> --
> Paul Barker
> Konsulko Group
--
Ricardo Ribalda
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2020-04-09 11:32 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-09 10:49 [PATCH v4 0/4] wic: Fix permissions Ricardo Ribalda
2020-04-09 10:49 ` [PATCH v4 1/4] wic: Fix permissions when using exclude or include path Ricardo Ribalda
2020-04-09 10:49 ` [PATCH v4 2/4] wic: Fix multi images .wks with bitbake Ricardo Ribalda
2020-04-09 10:49 ` [PATCH v4 3/4] wic: Add --change-directory argument Ricardo Ribalda
2020-04-09 10:49 ` [PATCH v4 4/4] wic: Continue if excluded_path does not exist Ricardo Ribalda
2020-04-09 11:10 ` [PATCH v4 0/4] wic: Fix permissions Paul Barker
2020-04-09 11:32 ` Ricardo Ribalda
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.