Skip to contentSkip to conversation

Fix recursive mode -st on BUILDDIR setup

PATCH Superseded Alex Franco 4 participants 10 messages Sep 2, 2015 – Sep 3, 2015

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix recursive mode -st on BUILDDIR setup

Removing recursive option from chmod -st on BUILDDIR as it would take very long on existing build directories

[YOCTO 7669]

---
 scripts/oe-setup-builddir | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/oe-setup-builddir +1 -1
index f5b7e4e..44c7dcc 100755
@@ -24,7 +24,7 @@ if [ -z "$BUILDDIR" ]; then
 fi
 
 mkdir -p "$BUILDDIR/conf"
-chmod -R -st "$BUILDDIR" 
+chmod -st "$BUILDDIR"
 
 if [ ! -d "$BUILDDIR" ]; then
     echo >&2 "Error: The builddir ($BUILDDIR) does not exist!"
Signature · 1 line
2.5.1
#1 lore raw
Quoted 15 lines · Alex Franco

Removing recursive option from chmod -st on BUILDDIR as it would take very long on existing build directories

[YOCTO 7669]

---
 scripts/oe-setup-builddir | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/oe-setup-builddir +0 -0
index f5b7e4e..44c7dcc 100755

scripts/oe-setup-builddir if [ -z "$BUILDDIR" ]; then · line 27

Quoted 5 lines
scripts/oe-setup-builddir +1 -1
@@ -24,7 +24,7 @@ if [ -z "$BUILDDIR" ]; then
 fi
 
 mkdir -p "$BUILDDIR/conf"
-chmod -R -st "$BUILDDIR" 
+chmod -st "$BUILDDIR"

I think you did this so that conf/ gets the right permissions too. Perhaps the best approach is:

+chmod -st "$BUILDDIR" $BUILDDIR/conf"

?

Cheers,

Richard

#2 lore raw
Quoted 18 lines · Richard Purdie
Quoted 17 lines · Alex Franco

Removing recursive option from chmod -st on BUILDDIR as it would take very long on existing build directories

[YOCTO 7669]

---
 scripts/oe-setup-builddir | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/oe-setup-builddir +0 -0
index f5b7e4e..44c7dcc 100755
@@ -24,7 +24,7 @@ if [ -z "$BUILDDIR" ]; then
 fi
 
Quoted 8 lines

scripts/oe-setup-builddir if [ -z "$BUILDDIR" ]; then · line 27

Quoted 3 lines
scripts/oe-setup-builddir +1 -1
 mkdir -p "$BUILDDIR/conf"
-chmod -R -st "$BUILDDIR" 
+chmod -st "$BUILDDIR"

I think you did this so that conf/ gets the right permissions too. Perhaps the best approach is:

+chmod -st "$BUILDDIR" $BUILDDIR/conf"

Can we add "|| bbwarn foo"

for cases when it doesn't work for whatever reason or check the permissions of these 2 dirs before calling chmod?

Quoted 12 lines

?

Cheers,

Richard

Signature · 4 lines
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core
Signature · 1 line
Martin 'JaMa' Jansa     jabber: [email protected]
#3 lore raw

Checking may be the better approach, as warning here would do little more than what the current failure does (informing that chmod failed)

Alex Franco

Quoted 42 lines · Martin Jansa
Quoted 18 lines · Richard Purdie
Quoted 17 lines · Alex Franco

Removing recursive option from chmod -st on BUILDDIR as it would take very long on existing build directories

[YOCTO 7669]

---
  scripts/oe-setup-builddir | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
scripts/oe-setup-builddir +0 -0
index f5b7e4e..44c7dcc 100755
@@ -24,7 +24,7 @@ if [ -z "$BUILDDIR" ]; then
  fi
 
Quoted 7 lines

scripts/oe-setup-builddir if [ -z "$BUILDDIR" ]; then · line 27

Quoted 3 lines
scripts/oe-setup-builddir +1 -1
  mkdir -p "$BUILDDIR/conf"
-chmod -R -st "$BUILDDIR"
+chmod -st "$BUILDDIR"

I think you did this so that conf/ gets the right permissions too. Perhaps the best approach is:

+chmod -st "$BUILDDIR" $BUILDDIR/conf"

Can we add "|| bbwarn foo"

for cases when it doesn't work for whatever reason or check the permissions of these 2 dirs before calling chmod?

Quoted 11 lines

?

Cheers,

Richard

Signature · 4 lines
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core
#4 lore raw

Warning informing that chmod failed is better than fatal error preventing me to build anything in that setup with tmpfs.

Quoted 56 lines · Alex Franco

Checking may be the better approach, as warning here would do little more than what the current failure does (informing that chmod failed)

Alex Franco

Quoted 47 lines · Martin Jansa
Quoted 25 lines · Richard Purdie
Quoted 15 lines · Alex Franco

Removing recursive option from chmod -st on BUILDDIR as it would take very long on existing build directories

[YOCTO 7669]

---
  scripts/oe-setup-builddir | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
scripts/oe-setup-builddir +0 -0
index f5b7e4e..44c7dcc 100755

scripts/oe-setup-builddir if [ -z "$BUILDDIR" ]; then · line 27

Quoted 5 lines
scripts/oe-setup-builddir +1 -1
@@ -24,7 +24,7 @@ if [ -z "$BUILDDIR" ]; then
  fi
    mkdir -p "$BUILDDIR/conf"
-chmod -R -st "$BUILDDIR"
+chmod -st "$BUILDDIR"
 

I think you did this so that conf/ gets the right permissions too. Perhaps the best approach is:

Quoted 2 lines

+chmod -st "$BUILDDIR" $BUILDDIR/conf"

Can we add "|| bbwarn foo"

for cases when it doesn't work for whatever reason or check the permissions of these 2 dirs before calling chmod?

?

Quoted 11 lines

Cheers,

Richard

--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

#5 lore raw

Hello Martin, so the error you are seeing is related to the chmodding being done in sanity.bbclass, not the chmodding taking place in oe-setup-builddir. I am adding a catch and a warning for that, as I reproduce your setup so I can also reproduce the OSError.

Alex

Quoted 67 lines · Martin Jansa

Warning informing that chmod failed is better than fatal error preventing me to build anything in that setup with tmpfs.

On Wed, Sep 2, 2015 at 11:27 PM, Alex Franco <[email protected] <mailto:[email protected]>> wrote:

Checking may be the better approach, as warning here would do little more than what the current failure does (informing that chmod failed)

Alex Franco

On 09/02/2015 01:25 PM, Martin Jansa wrote:

On Wed, Sep 02, 2015 at 06:51:23PM +0100, Richard Purdie wrote:

On Wed, 2015-09-02 at 11:36 -0500, Alex Franco wrote:

Removing recursive option from chmod -st on BUILDDIR as it would
take very long on existing build directories

[YOCTO 7669]

Signed-off-by: Alex Franco <[email protected] <mailto:[email protected]>>
---
scripts/oe-setup-builddir | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/oe-setup-builddir b/scripts/oe-setup-builddir
index f5b7e4e..44c7dcc 100755
--- a/scripts/oe-setup-builddir
+++ b/scripts/oe-setup-builddir
@@ -24,7 +24,7 @@ if [ -z "$BUILDDIR" ]; then
fi
mkdir -p "$BUILDDIR/conf"
-chmod -R -st "$BUILDDIR"
+chmod -st "$BUILDDIR"

I think you did this so that conf/ gets the right permissions too.
Perhaps the best approach is:

+chmod -st "$BUILDDIR" $BUILDDIR/conf"

Can we add "|| bbwarn foo"

for cases when it doesn't work for whatever reason or check the permissions of these 2 dirs before calling chmod?

?

Cheers,

Richard

--
_______________________________________________
Openembedded-core mailing list [email protected] <mailto:[email protected]>
http://lists.openembedded.org/mailman/listinfo/openembedded-core

#6 lore raw
Quoted 4 lines · Alex Franco

Hello Martin, so the error you are seeing is related to the chmodding being done in sanity.bbclass, not the chmodding taking place in oe-setup-builddir. I am adding a catch and a warning for that, as I reproduce your setup so I can also reproduce the OSError.

Thanks.

My point was that even when such setup isn't safe from reasons other people mentioned, the sanity.bbclass shouldn't fail with OSError exception.

And as the issue isn't fatal for the build (I was using setup like this for very long time and haven't noticed host-permissions-contamination from this yet), then I would prefer just bbwarn instead of bbfatal - in both cases is should show clear message what's wrong and what user should do about it instead of OSError and user having to read sanity.bbclass to see what and why failed.

Regards,

Quoted 74 lines

Alex

Quoted 70 lines · Martin Jansa

Warning informing that chmod failed is better than fatal error preventing me to build anything in that setup with tmpfs.

On Wed, Sep 2, 2015 at 11:27 PM, Alex Franco
<[email protected]
<mailto:[email protected]>> wrote:

Checking may be the better approach, as warning here would do little more than what the current failure does (informing that chmod failed)

Alex Franco

On 09/02/2015 01:25 PM, Martin Jansa wrote:

On Wed, Sep 02, 2015 at 06:51:23PM +0100, Richard Purdie wrote:

On Wed, 2015-09-02 at 11:36 -0500, Alex Franco wrote:

Removing recursive option from chmod -st on BUILDDIR as it would
take very long on existing build directories

[YOCTO 7669]

Signed-off-by: Alex Franco <[email protected] <mailto:[email protected]>>
---
scripts/oe-setup-builddir | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/oe-setup-builddir b/scripts/oe-setup-builddir
index f5b7e4e..44c7dcc 100755
--- a/scripts/oe-setup-builddir
+++ b/scripts/oe-setup-builddir
@@ -24,7 +24,7 @@ if [ -z "$BUILDDIR" ]; then
fi
mkdir -p "$BUILDDIR/conf"
-chmod -R -st "$BUILDDIR"
+chmod -st "$BUILDDIR"

I think you did this so that conf/ gets the right permissions too.
Perhaps the best approach is:

+chmod -st "$BUILDDIR" $BUILDDIR/conf"

Can we add "|| bbwarn foo"

for cases when it doesn't work for whatever reason or check the permissions of these 2 dirs before calling chmod?

?

Cheers,

Richard

--
_______________________________________________
Openembedded-core mailing list [email protected] <mailto:[email protected]>
http://lists.openembedded.org/mailman/listinfo/openembedded-core

Signature · 1 line
Martin 'JaMa' Jansa     jabber: [email protected]
#7 lore raw

Yes, I agree and in fact the patch is just now shipping

Alex Franco

Quoted 93 lines · Martin Jansa
Quoted 4 lines · Alex Franco

Hello Martin, so the error you are seeing is related to the chmodding being done in sanity.bbclass, not the chmodding taking place in oe-setup-builddir. I am adding a catch and a warning for that, as I reproduce your setup so I can also reproduce the OSError.

Thanks.

My point was that even when such setup isn't safe from reasons other people mentioned, the sanity.bbclass shouldn't fail with OSError exception.

And as the issue isn't fatal for the build (I was using setup like this for very long time and haven't noticed host-permissions-contamination from this yet), then I would prefer just bbwarn instead of bbfatal - in both cases is should show clear message what's wrong and what user should do about it instead of OSError and user having to read sanity.bbclass to see what and why failed.

Regards,

Quoted 73 lines

Alex

Quoted 70 lines · Martin Jansa

Warning informing that chmod failed is better than fatal error preventing me to build anything in that setup with tmpfs.

On Wed, Sep 2, 2015 at 11:27 PM, Alex Franco
<[email protected]
<mailto:[email protected]>> wrote:

Checking may be the better approach, as warning here would do little more than what the current failure does (informing that chmod failed)

Alex Franco

On 09/02/2015 01:25 PM, Martin Jansa wrote:

On Wed, Sep 02, 2015 at 06:51:23PM +0100, Richard Purdie wrote:

On Wed, 2015-09-02 at 11:36 -0500, Alex Franco wrote:

Removing recursive option from chmod -st on BUILDDIR as it would
take very long on existing build directories

[YOCTO 7669]

Signed-off-by: Alex Franco <[email protected] <mailto:[email protected]>>
---
scripts/oe-setup-builddir | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/oe-setup-builddir b/scripts/oe-setup-builddir
index f5b7e4e..44c7dcc 100755
--- a/scripts/oe-setup-builddir
+++ b/scripts/oe-setup-builddir
@@ -24,7 +24,7 @@ if [ -z "$BUILDDIR" ]; then
fi
mkdir -p "$BUILDDIR/conf"
-chmod -R -st "$BUILDDIR"
+chmod -st "$BUILDDIR"

I think you did this so that conf/ gets the right permissions too.
Perhaps the best approach is:

+chmod -st "$BUILDDIR" $BUILDDIR/conf"

Can we add "|| bbwarn foo"

for cases when it doesn't work for whatever reason or check the permissions of these 2 dirs before calling chmod?

?

Cheers,

Richard

--
_______________________________________________
Openembedded-core mailing list [email protected] <mailto:[email protected]>
http://lists.openembedded.org/mailman/listinfo/openembedded-core

#8 lore raw
In reply to Alex Franco

scripts/oe-setup-builddir if [ -z "$BUILDDIR" ]; then · line 27

Quoted 2 lines · On Wed, 2 Sep 2015 11:36:45 -0500 Alex Franco…
scripts/oe-setup-builddir +1 -1
-chmod -R -st "$BUILDDIR" 
+chmod -st "$BUILDDIR"

I was about to say! I just did an update to a version with this, and as it happens, my build dir also contains about four full copies of tmp-glibc and sstate-cache corresponding to different versions of pseudo I was comparing between...

I'd say maybe both $BUILDDIR and $BUILDDIR/conf. Although it might not be a horrible idea to think about cleaning out sticky bits, because it occurs to
me: pseudo is not stripping the set* bits when writing to the filesystem. Which means that a build directory can end up containing files owned by the build user, and setuid, which is maybe a Bad Thing.

... It may be that pseudo should strip those bits from the filesystem.

-s

Signature · 1 line
Listen, get this.  Nobody with a good compiler needs to be justified.
#9 lore raw

Yes, it was also suggested to check the directories prior to chmod'ing. But I'm still not so sure about that, or how extensive the checking should be. Perhaps cleaning out sticky bits more extensively could be suggested in the documentation.

Alex Franco

Quoted 19 lines · Peter Seebach

scripts/oe-setup-builddir if [ -z "$BUILDDIR" ]; then · line 27

Quoted 2 lines · On Wed, 2 Sep 2015 11:36:45 -0500 Alex Franco…
scripts/oe-setup-builddir +1 -1
-chmod -R -st "$BUILDDIR"
+chmod -st "$BUILDDIR"

I was about to say! I just did an update to a version with this, and as it happens, my build dir also contains about four full copies of tmp-glibc and sstate-cache corresponding to different versions of pseudo I was comparing between...

I'd say maybe both $BUILDDIR and $BUILDDIR/conf. Although it might not be a horrible idea to think about cleaning out sticky bits, because it occurs to
me: pseudo is not stripping the set* bits when writing to the filesystem. Which means that a build directory can end up containing files owned by the build user, and setuid, which is maybe a Bad Thing.

... It may be that pseudo should strip those bits from the filesystem.

-s