base-files/fs-perms.txt fix up odd perm inconsistencies.
cover base-files/fs-perms.txt fix up odd perm inconsistencies.
Originally I was aiming to fix YOCTO #6579 -- where we had drwxr-sr-x set for /home for no particular reason (other than historical reasons; see the commit log for details). In doing so I also uncovered a couple other small inconsistencies that could use a cleanup, as follows:
-the group we called dir2775 we were chmod'ing as 2755 (7 vs 5)
-the /var/mail from the lsb additions was incorrect perms and group
-the grouping headings given for the lsb dirs (e.g. "dir4775") were
completely misleading; it appears the original author used the 1st digit ("4") as a group counter and not part of the perms.
The last two lsb related items are in both in the last commit below, since they end up touching the same lines.
Build tested with MACHINE="intel-corei7-64" from meta-intel with the core-image-sato. We can see /home does not have "s" set anymore.
poky$ls -ld build/tmp/work/intel_corei7_64-poky-linux/core-image-sato/1.0-r0/rootfs/home/ drwxr-xr-x 4 paul paul 4096 Jul 25 20:27 build/tmp/work/intel_corei7_64-poky-linux/core-image-sato/1.0-r0/rootfs/home/ poky$
Bug:
https://bugzilla.yoctoproject.org/show_bug.cgi?id=6579
Paul.
---
Paul Gortmaker (3):
base-files: actually install 2775 dirs as 2775, not 2755
base-files: remove strange 2775 perms from dirs like /home
base-files: fix up misleading dir grouping names for lsb dirs
meta/files/fs-perms.txt | 16 +++++++-------- meta/recipes-core/base-files/base-files_3.0.14.bb | 24 ++++++++++++----------- 2 files changed, 21 insertions(+), 19 deletions(-)
Signature · 1 line
2.0.1
PATCH 1/3 base-files: actually install 2775 dirs as 2775, not 2755
Nothing interesting to see in the git history ; appears to have been this way since its creation.
--- meta/recipes-core/base-files/base-files_3.0.14.bb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-core/base-files/base-files_3.0.14.bb +1 -1
@@ -72,7 +72,7 @@ do_install () { install -m 1777 -d ${D}$d done for d in ${dirs2775}; do - install -m 2755 -d ${D}$d + install -m 2775 -d ${D}$d done for d in ${volatiles}; do ln -sf volatile/$d ${D}${localstatedir}/$d
Signature · 1 line
2.0.1
PATCH 2/3 base-files: remove strange 2775 perms from dirs like /home
In reply to Paul GortmakerMark Hatle did the historical research into why this was so, and found that it originally was via debian import, and then it morphed over time:
<fray> +# chown -R root:root ${D}
<fray> +# cd ${D} && chown root:src usr/src
<fray> +# cd ${D} && chown root:staff var/local
<fray> +# cd ${D} && chown root:staff home
<fray> + cd ${D} && chmod 755 `find . -type d`
<fray> + cd ${D} && chmod 1777 `cat ${S}/debian/1777-dirs`
<fray> + cd ${D} && chmod 2775 `cat ${S}/debian/2775-dirs`<fray> that was the original code
<fray> so THAT is why they're 2775..
<fray> they were original 'src' and 'staff'.. which has gotten lost
sometime in the last 10 years
<fray> AND the origin:
<fray> commit b45c9ed40bb4f893f99127a21776aef3ae888ad7 <fray> Author: Chris Larson <[email protected]>
<fray> Date: Tue Sep 30 16:30:41 2003 +0000
<fray> Add base-files 3.0.10 (from debian).
<fray> thats where the brain damage started ... Debian in 2003..
Here we simply convert them to being normal 755 dirs.
[YOCTO #6579]
--- meta/files/fs-perms.txt | 10 +++++----- meta/recipes-core/base-files/base-files_3.0.14.bb | 3 ++- 2 files changed, 7 insertions(+), 6 deletions(-)
meta/files/fs-perms.txt +5 -5
@@ -50,16 +50,16 @@ ${localstatedir}/log link volatile/log ${localstatedir}/lock link /run/lock ${localstatedir}/tmp link volatile/tmp +/home 0755 root root false - - - +/srv 0755 root root false - - - +${prefix}/src 0755 root root false - - - +${localstatedir}/local 0755 root root false - - - + # Special permissions from base-files # Set 1777 /tmp 01777 root root false - - - ${localstatedir}/volatile/tmp 01777 root root false - - - -# Set 2775 -/home 02755 root root false - - - -${prefix}/src 02755 root root false - - - -${localstatedir}/local 02755 root root false - - - - # Set 3755 /srv 0755 root root false - - -
meta/recipes-core/base-files/base-files_3.0.14.bb +2 -1
@@ -32,7 +32,7 @@ INHIBIT_DEFAULT_DEPS = "1" docdir_append = "/${P}" dirs1777 = "/tmp ${localstatedir}/volatile/tmp" -dirs2775 = "/home ${prefix}/src ${localstatedir}/local" +dirs2775 = "" dirs755 = "/bin /boot /dev ${sysconfdir} ${sysconfdir}/default \ ${sysconfdir}/skel /lib /mnt /proc ${ROOT_HOME} /run /sbin \ ${prefix} ${bindir} ${docdir} /usr/games ${includedir} \
@@ -43,6 +43,7 @@ dirs755 = "/bin /boot /dev ${sysconfdir} ${sysconfdir}/default \ /sys ${localstatedir}/lib/misc ${localstatedir}/spool \ ${localstatedir}/volatile \ ${localstatedir}/volatile/log \ + /home ${prefix}/src ${localstatedir}/local \ /media" dirs3755 = "/srv \ ${prefix}/local ${prefix}/local/bin ${prefix}/local/games \
Signature · 1 line
2.0.1
PATCH 3/3 base-files: fix up misleading dir grouping names for lsb dirs
In reply to Paul GortmakerIn commit b0df35f47fb79dc149504bd66d1186b3276f9510 ("base-files: Add to make some directories needed by LSB.") there were new groupings of dirs made. But rather than keep the grouping names permissions based as they clearly were, it seems that it was unfortunately misinterpreted as a counter, simply incrementing as a new group was added.
This leads to dir3755 getting chmod'd to 0755 and dir4775 being chmod'd to 2775 which to any new reader of the code is terribly confusing.
Choose names that clearly reflect the permissions, and add a lsb suffix to indicate the role.
Also note that the settings for /var/mail seem incorrect, and so they have been aligned with what is seen in most common distros.
--- meta/files/fs-perms.txt | 6 +++--- meta/recipes-core/base-files/base-files_3.0.14.bb | 19 ++++++++++--------- 2 files changed, 13 insertions(+), 12 deletions(-)
meta/files/fs-perms.txt +3 -3
@@ -60,8 +60,8 @@ ${localstatedir}/local 0755 root root false - - - /tmp 01777 root root false - - - ${localstatedir}/volatile/tmp 01777 root root false - - - -# Set 3755 +# Set 755-lsb /srv 0755 root root false - - - -# Set 4775 -/var/mail 02755 root root false - - - +# Set 2775-lsb +/var/mail 02775 root mail false - - -
meta/recipes-core/base-files/base-files_3.0.14.bb +10 -9
@@ -45,12 +45,13 @@ dirs755 = "/bin /boot /dev ${sysconfdir} ${sysconfdir}/default \ ${localstatedir}/volatile/log \ /home ${prefix}/src ${localstatedir}/local \ /media" -dirs3755 = "/srv \ - ${prefix}/local ${prefix}/local/bin ${prefix}/local/games \ - ${prefix}/local/include ${prefix}/local/lib ${prefix}/local/sbin \ - ${prefix}/local/share ${prefix}/local/src \ - ${prefix}/lib/locale" -dirs4775 = "/var/mail" + +dirs755-lsb = "/srv \ + ${prefix}/local ${prefix}/local/bin ${prefix}/local/games \ + ${prefix}/local/include ${prefix}/local/lib ${prefix}/local/sbin \ + ${prefix}/local/share ${prefix}/local/src \ + ${prefix}/lib/locale" +dirs2775-lsb = "/var/mail" volatiles = "log tmp" conffiles = "${sysconfdir}/debian_version ${sysconfdir}/host.conf \
@@ -130,12 +131,12 @@ do_install_basefilesissue () { } do_install_append_linuxstdbase() { - for d in ${dirs3755}; do + for d in ${dirs755-lsb}; do install -m 0755 -d ${D}$d done - for d in ${dirs4775}; do - install -m 2755 -d ${D}$d + for d in ${dirs2775-lsb}; do + install -m 2775 -d ${D}$d done }
Signature · 1 line
2.0.1