diff options
author | Alex Franco <alejandro.franco@linux.intel.com> | 2015-08-28 17:34:04 -0500 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-09-01 11:43:58 +0100 |
commit | cd61c1a6c5c4b27cfda837ec955a97c95dfa20c3 (patch) | |
tree | 49fd464ec03833597ebea3cda72d3906c49bd3c8 /meta/classes/sanity.bbclass | |
parent | 79de172a937ee37ae1824ced5d09609b809e4989 (diff) | |
download | poky-cd61c1a6c5c4b27cfda837ec955a97c95dfa20c3.tar.gz |
Fix mode +st on TMPDIR when creating it
A sanity check fails when TMPDIR has setuid, setgid set. It was
proposed to fix this on TMPDIR creation instead of failing with
a sanity test only. This patch handles removal of those special
bits (and additonally, the sticky bit) from BUILDDIR and TMPDIR
when these directories are created.
[YOCTO #7669]
(From OE-Core rev: 8236d57439640a185c0226312cd4903a3ce2f53b)
Signed-off-by: Alex Franco <alejandro.franco@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/sanity.bbclass')
-rw-r--r-- | meta/classes/sanity.bbclass | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/meta/classes/sanity.bbclass b/meta/classes/sanity.bbclass index ef90fc82b5..2864318632 100644 --- a/meta/classes/sanity.bbclass +++ b/meta/classes/sanity.bbclass | |||
@@ -686,6 +686,7 @@ def check_sanity_version_change(status, d): | |||
686 | status.addresult(check_not_nfs(tmpdir, "TMPDIR")) | 686 | status.addresult(check_not_nfs(tmpdir, "TMPDIR")) |
687 | 687 | ||
688 | def check_sanity_everybuild(status, d): | 688 | def check_sanity_everybuild(status, d): |
689 | import os, stat | ||
689 | # Sanity tests which test the users environment so need to run at each build (or are so cheap | 690 | # Sanity tests which test the users environment so need to run at each build (or are so cheap |
690 | # it makes sense to always run them. | 691 | # it makes sense to always run them. |
691 | 692 | ||
@@ -839,6 +840,10 @@ def check_sanity_everybuild(status, d): | |||
839 | status.addresult("Error, TMPDIR has changed location. You need to either move it back to %s or rebuild\n" % saved_tmpdir) | 840 | status.addresult("Error, TMPDIR has changed location. You need to either move it back to %s or rebuild\n" % saved_tmpdir) |
840 | else: | 841 | else: |
841 | bb.utils.mkdirhier(tmpdir) | 842 | bb.utils.mkdirhier(tmpdir) |
843 | # Remove setuid, setgid and sticky bits from TMPDIR | ||
844 | os.chmod(tmpdir, os.stat(tmpdir).st_mode & ~ stat.S_ISUID) | ||
845 | os.chmod(tmpdir, os.stat(tmpdir).st_mode & ~ stat.S_ISGID) | ||
846 | os.chmod(tmpdir, os.stat(tmpdir).st_mode & ~ stat.S_ISVTX) | ||
842 | with open(checkfile, "w") as f: | 847 | with open(checkfile, "w") as f: |
843 | f.write(tmpdir) | 848 | f.write(tmpdir) |
844 | 849 | ||