why cp in do_install() change file permission mode?


Lu, Lianhao <lianhao.lu@...>
 

Hi fellows,

Could anyone tell me why does the cp in do_install() change the file permission mode? Thanks!

do_install () {
rm -rf ${D}${installed_dir}
install -d ${D}${installed_dir}
cp -rp ${S}/* ${D}${installed_dir}
}

After "bitbake xxx -c install", I found the file under ${D}${installed_dir} had the permission mode of 0744 while the corresponding file under directory ${S} had the mode of 0644. Why did this happen? How to avoid this kind of mode change? Thanks!

Best Regards
-Lianhao Lu


Bruce Ashfield <bruce.ashfield@...>
 

On 10-12-02 05:16 AM, Lu, Lianhao wrote:
Hi fellows,

Could anyone tell me why does the cp in do_install() change the file permission mode? Thanks!

do_install () {
rm -rf ${D}${installed_dir}
install -d ${D}${installed_dir}
cp -rp ${S}/* ${D}${installed_dir}
}

After "bitbake xxx -c install", I found the file under ${D}${installed_dir} had the permission mode of 0744 while the corresponding file under directory ${S} had the mode of 0644. Why did this happen? How to avoid this kind of mode change? Thanks!
What's the umask of the your uid ? .. or maybe this is
one of those settings that is controlled by bitbake/poky.
But either way, it should just be that the cp is taking
the current umask which is changing the mode to 0744.

One option is to use install to copy the files, since it
allows a specific set of permissions to be set on its
command line.

I haven't looked into this at all, just some thoughts
off the top of my head.

Cheers,

Bruce


Best Regards
-Lianhao Lu
_______________________________________________
yocto mailing list
yocto@...
https://lists.yoctoproject.org/listinfo/yocto


Hatle, Mark <mark.hatle@...>
 

Sorry for the brief response, but...

Do_install is performed under 'pseudo'. Pseudo is a ld_preload that intercepts calls and captures permissions, users and groups settings to allow root-like actions to occur.

In order for the sstate components to be easily copied and manipulated outside of pseudo control, permissions are modified.

If you look at the produced package/filesystem image the permissions/owner/group will be as expected. If you don't see that behavior then we should investigate.

Note pseudo only captures the attributes as set. So if cp, install, etc doesn't set it -- pseudo won't capture it.

----- Original Message -----
From: Lu, Lianhao [mailto:lianhao.lu@...]
Sent: Thursday, December 02, 2010 02:16 AM
To: yocto@... <yocto@...>
Subject: [yocto] why cp in do_install() change file permission mode?

Hi fellows,

Could anyone tell me why does the cp in do_install() change the file permission mode? Thanks!

do_install () {
rm -rf ${D}${installed_dir}
install -d ${D}${installed_dir}
cp -rp ${S}/* ${D}${installed_dir}
}

After "bitbake xxx -c install", I found the file under ${D}${installed_dir} had the permission mode of 0744 while the corresponding file under directory ${S} had the mode of 0644. Why did this happen? How to avoid this kind of mode change? Thanks!

Best Regards
-Lianhao Lu
_______________________________________________
yocto mailing list
yocto@...
https://lists.yoctoproject.org/listinfo/yocto


Richard Purdie <rpurdie@...>
 

On Thu, 2010-12-02 at 18:16 +0800, Lu, Lianhao wrote:
Hi fellows,

Could anyone tell me why does the cp in do_install() change the file permission mode? Thanks!

do_install () {
rm -rf ${D}${installed_dir}
install -d ${D}${installed_dir}
cp -rp ${S}/* ${D}${installed_dir}
}

After "bitbake xxx -c install", I found the file under
${D}${installed_dir} had the permission mode of 0744 while the
corresponding file under directory ${S} had the mode of 0644. Why did
this happen? How to avoid this kind of mode change? Thanks!
do_install and all tasks that work on the output of do_install run under
pseduo which can mean the permissions on disk might not match the real
permissions as seen within a pseduo session.

To illustrate, in a do_install do something like

chown root.root somefile
ls -la somefile

then look at the file on disk and you'll see different owners. The
ownership works the same way as the permissions.

Cheers,

Richard

(Note Poky specific questions should be on the poky mailing list)