I'm using Yocto 2.1.1 and I've noticed that files/folders permissions are changed when creating ext4 image. Steps to reproduce: 1) in pkg_postinst task set wanted file permissions: ---> chmod -R 521 "$D/opt/my_folder" 2) generate the rootfs image Results: 1)my_folder has correct permissions on rootfs: I can verify it from devshell (so pseudo is correctly handling them) 2)my_folder has correct permissions in rootfs archive 3)my_folder hasn't correct permissions on rootfs ext4 image -> permissions are changed to 751 I think that the cause is in mkfs itself see line 119 on https://github.com/tytso/e2fsprogs/blob/master/misc/create_inode.c inode.i_mode |= st->st_mode; I've also opened a discussion on e2fsprogs: https://sourceforge.net/p/e2fsprogs/discussion/7053/thread/33e8a603/#a89f I'd like to have a feedback from Yocto community to understand if this a bug or rather a misconfiguration of my set up. Can anyone reproduce this issue? Thanks, Alessio
Just an update: I've cross-checked and only folder permissions are wrong, file are correct. It seems that mkfs.ext4 forces rwx for user permission on folders and that permissions for group and other is the one specified in the recipe.
Hello, I've found the rootcause in lib/ext2fs/mkdir.c, function ext2fs_mkdir: inode for folder is being created using a default umask inode.i_mode = LINUX_S_IFDIR | (0777 & ~fs->umask); this is ok when creating a filesystem from scratch, but causes permission changes when creating an image starting from a folder. I've a quick patch to fix the issue, but I think that the best solution is to add a parameter to mkfs in order to select if using or not the default umask when using -d option as well. BR, Alessio
Merged into master: http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=aa9e2c73f3987a2dad0d7ba80fbb97994c348a1e