Skip to contentSkip to conversation

glibc-locale: Rewrite do_install using install utility instead of cp

PATCH Superseded Khem Raj 6 participants 18 messages Feb 7, 2019 – Feb 28, 2019

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/1 glibc-locale: Rewrite do_install using install utility instead of cp

This has been a constant source of trouble for build failures due to host-user-contaminated QA errors of sort

ERROR: QA Issue: glibc-locale: /glibc-binary-localedata-ca-es+valencia/usr/lib/locale/ca_ES@valencia/LC_MONETARY is owned by uid 3004, which is the same as the user running bitbake. This may be due to host contamination [host-user-contaminated]

So far we have tried to mould cp command into not carrying the build user permissions into install area but it is never entirely fixed since the issue keeps popping up in various scenes

This patch replaces use of cp with install utility and specifies install mode for files explcitly

---
 meta/recipes-core/glibc/glibc-locale.inc | 44 ++++++++++++++----------
 1 file changed, 25 insertions(+), 19 deletions(-)
meta/recipes-core/glibc/glibc-locale.inc +25 -19
index 6384f9cbf1..9b256a5108 100644
@@ -72,27 +72,33 @@ FILES_localedef = "${bindir}/localedef"
 LOCALETREESRC = "${COMPONENTS_DIR}/${PACKAGE_ARCH}/glibc-stash-locale"
 
 do_install () {
-	mkdir -p ${D}${bindir} ${D}${datadir}
-	if [ -n "$(ls ${LOCALETREESRC}/${bindir})" ]; then
-		cp -R --no-dereference --preserve=mode,links ${LOCALETREESRC}/${bindir}/* ${D}${bindir}
-	fi
-	if [ -n "$(ls ${LOCALETREESRC}/${localedir})" ]; then
-		mkdir -p ${D}${localedir}
-		cp -R --no-dereference --preserve=mode,links ${LOCALETREESRC}/${localedir}/* ${D}${localedir}
-	fi
+        install -d ${D}${bindir}
+        find "${LOCALETREESRC}/${bindir}" -maxdepth 1 -type f \
+        -exec install -m 0755 -t "${D}${bindir}" {} \;
+
+        for d in . $(find "${LOCALETREESRC}/${localedir}" -type d -printf '%P ') ; do
+                install -d "${D}${localedir}/$d"
+                find "${LOCALETREESRC}/${localedir}/$d" -maxdepth 1 -type f \
+                -exec install -m 0644 -t "${D}${localedir}/$d" {} \;
+        done
 	if [ ${@d.getVar('PACKAGE_NO_GCONV')} -eq 0 ]; then
-		mkdir -p ${D}${libdir}
-		if [ -e ${LOCALETREESRC}/${libdir}/gconv ]; then
-			cp -R --no-dereference --preserve=mode,links ${LOCALETREESRC}/${libdir}/gconv ${D}${libdir}
-		fi
-		if [ -e ${LOCALETREESRC}/${datadir}/i18n ]; then
-			cp -R --no-dereference --preserve=mode,links ${LOCALETREESRC}/${datadir}/i18n ${D}${datadir}
-		fi
-	fi
-	if [ -e ${LOCALETREESRC}/${datadir}/locale ]; then
-		cp -R --no-dereference --preserve=mode,links ${LOCALETREESRC}/${datadir}/locale ${D}${datadir}
+                for d in . $(find "${LOCALETREESRC}/${libdir}/gconv" -type d -printf '%P ') ; do
+                        install -d "${D}${libdir}/gconv/$d"
+                        find "${LOCALETREESRC}/${libdir}/gconv/$d" -maxdepth 1 -type f \
+                        -exec install -m 0755 -t "${D}${libdir}/gconv/$d" {} \;
+                done
+                for d in . $(find "${LOCALETREESRC}/${datadir}/i18n" -type d -printf '%P ') ; do
+                        install -d "${D}${datadir}/i18n/$d"
+                        find "${LOCALETREESRC}/${datadir}/i18n/$d" -maxdepth 1 -type f \
+                        -exec install -m 0644 -t "${D}${datadir}/i18n/$d" {} \;
+                done
 	fi
-	cp -R --no-dereference --preserve=mode,links ${LOCALETREESRC}/SUPPORTED ${WORKDIR}
+        for d in . $(find "${LOCALETREESRC}/${datadir}/locale" -type d -printf '%P ') ; do
+                install -d "${D}${datadir}/locale/$d"
+                find "${LOCALETREESRC}/${datadir}/locale/$d" -maxdepth 1 -type f \
+                -exec install -m 0644 -t "${D}${datadir}/locale/$d" {} \;
+        done
+	install -m 0644 ${LOCALETREESRC}/SUPPORTED ${WORKDIR}/SUPPORTED
 }
 
 inherit libc-package
Signature · 1 line
2.20.1
#1 lore raw
Quoted 64 lines · Khem Raj

This has been a constant source of trouble for build failures due to host-user-contaminated QA errors of sort

ERROR: QA Issue: glibc-locale: /glibc-binary-localedata-ca-es+valencia/usr/lib/locale/ca_ES@valencia/LC_MONETARY is owned by uid 3004, which is the same as the user running bitbake. This may be due to host contamination [host-user-contaminated]

So far we have tried to mould cp command into not carrying the build user permissions into install area but it is never entirely fixed since the issue keeps popping up in various scenes

This patch replaces use of cp with install utility and specifies install mode for files explcitly

---
 meta/recipes-core/glibc/glibc-locale.inc | 44 ++++++++++++++----------
 1 file changed, 25 insertions(+), 19 deletions(-)
meta/recipes-core/glibc/glibc-locale.inc +19 -18
index 6384f9cbf1..9b256a5108 100644
@@ -72,27 +72,33 @@ FILES_localedef = "${bindir}/localedef"
 LOCALETREESRC = "${COMPONENTS_DIR}/${PACKAGE_ARCH}/glibc-stash-locale"
 
 do_install () {
-	mkdir -p ${D}${bindir} ${D}${datadir}
-	if [ -n "$(ls ${LOCALETREESRC}/${bindir})" ]; then
-		cp -R --no-dereference --preserve=mode,links ${LOCALETREESRC}/${bindir}/* ${D}${bindir}
-	fi
-	if [ -n "$(ls ${LOCALETREESRC}/${localedir})" ]; then
-		mkdir -p ${D}${localedir}
-		cp -R --no-dereference --preserve=mode,links ${LOCALETREESRC}/${localedir}/* ${D}${localedir}
-	fi
+        install -d ${D}${bindir}
+        find "${LOCALETREESRC}/${bindir}" -maxdepth 1 -type f \
+        -exec install -m 0755 -t "${D}${bindir}" {} \;
+
+        for d in . $(find "${LOCALETREESRC}/${localedir}" -type d -printf '%P ') ; do
+                install -d "${D}${localedir}/$d"
+                find "${LOCALETREESRC}/${localedir}/$d" -maxdepth 1 -type f \
+                -exec install -m 0644 -t "${D}${localedir}/$d" {} \;
+        done
 	if [ ${@d.getVar('PACKAGE_NO_GCONV')} -eq 0 ]; then
-		mkdir -p ${D}${libdir}
-		if [ -e ${LOCALETREESRC}/${libdir}/gconv ]; then
-			cp -R --no-dereference --preserve=mode,links ${LOCALETREESRC}/${libdir}/gconv ${D}${libdir}
-		fi
-		if [ -e ${LOCALETREESRC}/${datadir}/i18n ]; then
-			cp -R --no-dereference --preserve=mode,links ${LOCALETREESRC}/${datadir}/i18n ${D}${datadir}
-		fi
-	fi
-	if [ -e ${LOCALETREESRC}/${datadir}/locale ]; then
-		cp -R --no-dereference --preserve=mode,links ${LOCALETREESRC}/${datadir}/locale ${D}${datadir}
+                for d in . $(find "${LOCALETREESRC}/${libdir}/gconv" -type d -printf '%P ') ; do
+                        install -d "${D}${libdir}/gconv/$d"
+                        find "${LOCALETREESRC}/${libdir}/gconv/$d" -maxdepth 1 -type f \
+                        -exec install -m 0755 -t "${D}${libdir}/gconv/$d" {} \;
+                done
+                for d in . $(find "${LOCALETREESRC}/${datadir}/i18n" -type d -printf '%P ') ; do
+                        install -d "${D}${datadir}/i18n/$d"
+                        find "${LOCALETREESRC}/${datadir}/i18n/$d" -maxdepth 1 -type f \
+                        -exec install -m 0644 -t "${D}${datadir}/i18n/$d" {} \;
+                done
 	fi

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef" · line 104

Quoted 10 lines
meta/recipes-core/glibc/glibc-locale.inc +6 -1
-	cp -R --no-dereference --preserve=mode,links ${LOCALETREESRC}/SUPPORTED ${WORKDIR}
+        for d in . $(find "${LOCALETREESRC}/${datadir}/locale" -type d -printf '%P ') ; do
+                install -d "${D}${datadir}/locale/$d"
+                find "${LOCALETREESRC}/${datadir}/locale/$d" -maxdepth 1 -type f \
+                -exec install -m 0644 -t "${D}${datadir}/locale/$d" {} \;
+        done
+	install -m 0644 ${LOCALETREESRC}/SUPPORTED ${WORKDIR}/SUPPORTED
 }
 
 inherit libc-package

The trouble is this is a workaround. The cp commands should work and there is some underlying issue in pseudo causing this. We really need to figure out what that is since this will likely just mean we see the problem somewhere else :(

I still suspect some kind of inode number reuse problem which these cp commands trigger...

Cheers,

Richard

author
#2 lore raw
Quoted 75 lines · Richard Purdie
Quoted 73 lines · Khem Raj

This has been a constant source of trouble for build failures due to host-user-contaminated QA errors of sort

ERROR: QA Issue: glibc-locale: /glibc-binary-localedata-ca-es+valencia/usr/lib/locale/ca_ES@valencia/LC_MONETARY is owned by uid 3004, which is the same as the user running bitbake. This may be due to host contamination [host-user-contaminated]

So far we have tried to mould cp command into not carrying the build user permissions into install area but it is never entirely fixed since the issue keeps popping up in various scenes

This patch replaces use of cp with install utility and specifies install mode for files explcitly

---
 meta/recipes-core/glibc/glibc-locale.inc | 44 ++++++++++++++----------
 1 file changed, 25 insertions(+), 19 deletions(-)
meta/recipes-core/glibc/glibc-locale.inc +25 -19
index 6384f9cbf1..9b256a5108 100644
@@ -72,27 +72,33 @@ FILES_localedef = "${bindir}/localedef"
 LOCALETREESRC = "${COMPONENTS_DIR}/${PACKAGE_ARCH}/glibc-stash-locale"
 
 do_install () {
-     mkdir -p ${D}${bindir} ${D}${datadir}
-     if [ -n "$(ls ${LOCALETREESRC}/${bindir})" ]; then
-             cp -R --no-dereference --preserve=mode,links ${LOCALETREESRC}/${bindir}/* ${D}${bindir}
-     fi
-     if [ -n "$(ls ${LOCALETREESRC}/${localedir})" ]; then
-             mkdir -p ${D}${localedir}
-             cp -R --no-dereference --preserve=mode,links ${LOCALETREESRC}/${localedir}/* ${D}${localedir}
-     fi
+        install -d ${D}${bindir}
+        find "${LOCALETREESRC}/${bindir}" -maxdepth 1 -type f \
+        -exec install -m 0755 -t "${D}${bindir}" {} \;
+
+        for d in . $(find "${LOCALETREESRC}/${localedir}" -type d -printf '%P ') ; do
+                install -d "${D}${localedir}/$d"
+                find "${LOCALETREESRC}/${localedir}/$d" -maxdepth 1 -type f \
+                -exec install -m 0644 -t "${D}${localedir}/$d" {} \;
+        done
      if [ ${@d.getVar('PACKAGE_NO_GCONV')} -eq 0 ]; then
-             mkdir -p ${D}${libdir}
-             if [ -e ${LOCALETREESRC}/${libdir}/gconv ]; then
-                     cp -R --no-dereference --preserve=mode,links ${LOCALETREESRC}/${libdir}/gconv ${D}${libdir}
-             fi
-             if [ -e ${LOCALETREESRC}/${datadir}/i18n ]; then
-                     cp -R --no-dereference --preserve=mode,links ${LOCALETREESRC}/${datadir}/i18n ${D}${datadir}
-             fi
-     fi
-     if [ -e ${LOCALETREESRC}/${datadir}/locale ]; then
-             cp -R --no-dereference --preserve=mode,links ${LOCALETREESRC}/${datadir}/locale ${D}${datadir}
+                for d in . $(find "${LOCALETREESRC}/${libdir}/gconv" -type d -printf '%P ') ; do
+                        install -d "${D}${libdir}/gconv/$d"
+                        find "${LOCALETREESRC}/${libdir}/gconv/$d" -maxdepth 1 -type f \
+                        -exec install -m 0755 -t "${D}${libdir}/gconv/$d" {} \;
+                done
+                for d in . $(find "${LOCALETREESRC}/${datadir}/i18n" -type d -printf '%P ') ; do
+                        install -d "${D}${datadir}/i18n/$d"
+                        find "${LOCALETREESRC}/${datadir}/i18n/$d" -maxdepth 1 -type f \
+                        -exec install -m 0644 -t "${D}${datadir}/i18n/$d" {} \;
+                done
      fi
-     cp -R --no-dereference --preserve=mode,links ${LOCALETREESRC}/SUPPORTED ${WORKDIR}
+        for d in . $(find "${LOCALETREESRC}/${datadir}/locale" -type d -printf '%P ') ; do
+                install -d "${D}${datadir}/locale/$d"
+                find "${LOCALETREESRC}/${datadir}/locale/$d" -maxdepth 1 -type f \
+                -exec install -m 0644 -t "${D}${datadir}/locale/$d" {} \;
+        done
+     install -m 0644 ${LOCALETREESRC}/SUPPORTED ${WORKDIR}/SUPPORTED
 }
 
Quoted 6 lines

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef" · line 104

Quoted 1 line
meta/recipes-core/glibc/glibc-locale.inc +0 -0
 inherit libc-package

The trouble is this is a workaround. The cp commands should work and there is some underlying issue in pseudo causing this. We really need to figure out what that is since this will likely just mean we see the problem somewhere else :(

so far this is the only place where it shows in world builds that meta-oe does which includes many layers.

Quoted 3 lines

I still suspect some kind of inode number reuse problem which these cp commands trigger...

cp and install are not same when it comes to how they operate underneath. install is better when it comes to what we are doing here it also gives better control of permissions and mods,as a recipe writer someone would prefer then to let the tool ( cp ) assume it.

So there might be a pseudo issue, I dont disagree but not obvious and I believe using cp is subpar anyway.

Quoted 5 lines

Cheers,

Richard

#3 lore raw

There are other rare reproducers which don't involve cp/install (e.g. older qmake was triggering it quite often as well), I've mentioned some in:
https://bugzilla.yoctoproject.org/show_bug.cgi?id=12434

glibc-locale is the most common one for sure as pretty much everybody is building that one, I don't have objection converting this from cp to install to prevent this random error (very rare random failure doesn't really help with #12434 reproducer and whoever work on it, can either revert this change or try to reproduce with something else) - I've included few hundreds of INSANE_SKIPs to ignore _random_ host-user-contaminated QAs in LG layers to prevent our builds failing randomly and the one for glibc-locale is the longest part:
https://github.com/webosose/meta-webosose/blob/master/meta-webos/recipes-core/glibc/glibc-locale_%25.bbappend

Regards,

Quoted 133 lines · Khem Raj
Quoted 3 lines · Richard Purdie
Quoted 1 line · Khem Raj

This has been a constant source of trouble for build failures due to

host-user-contaminated QA

Quoted 3 lines
Quoted 3 lines

errors of sort

ERROR: QA Issue: glibc-locale:

/glibc-binary-localedata-ca-es+valencia/usr/lib/locale/ca_ES@valencia/LC_MONETARY is owned by uid 3004, which is the same as the user running bitbake. This may be due to host contamination [host-user-contaminated]

Quoted 6 lines
Quoted 6 lines

So far we have tried to mould cp command into not carrying the build user permissions into install area but it is never entirely fixed since the issue keeps popping up in various scenes

This patch replaces use of cp with install utility and specifies

install

Quoted 8 lines

Review

Quoted 8 lines

mode for files explcitly

---
 meta/recipes-core/glibc/glibc-locale.inc | 44 ++++++++++++++----------
 1 file changed, 25 insertions(+), 19 deletions(-)
(quoted diff) +0 -0

b/meta/recipes-core/glibc/glibc-locale.inc

Quoted 10 lines

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef" · line 77

Quoted 10 lines

index 6384f9cbf1..9b256a5108 100644

meta/recipes-core/glibc/glibc-locale.inc +0 -3
@@ -72,27 +72,33 @@ FILES_localedef = "${bindir}/localedef"
 LOCALETREESRC = "${COMPONENTS_DIR}/${PACKAGE_ARCH}/glibc-stash-locale"
 
 do_install () {
-     mkdir -p ${D}${bindir} ${D}${datadir}
-     if [ -n "$(ls ${LOCALETREESRC}/${bindir})" ]; then
-             cp -R --no-dereference --preserve=mode,links

${LOCALETREESRC}/${bindir}/* ${D}${bindir}

Quoted 4 lines

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef"

Quoted 4 lines
meta/recipes-core/glibc/glibc-locale.inc +0 -4
-     fi
-     if [ -n "$(ls ${LOCALETREESRC}/${localedir})" ]; then
-             mkdir -p ${D}${localedir}
-             cp -R --no-dereference --preserve=mode,links

${LOCALETREESRC}/${localedir}/* ${D}${localedir}

Quoted 6 lines

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef"

Quoted 6 lines
meta/recipes-core/glibc/glibc-locale.inc +5 -1
-     fi
+        install -d ${D}${bindir}
+        find "${LOCALETREESRC}/${bindir}" -maxdepth 1 -type f \
+        -exec install -m 0755 -t "${D}${bindir}" {} \;
+
+        for d in . $(find "${LOCALETREESRC}/${localedir}" -type d

-printf '%P ') ; do

Quoted 2 lines

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef" · line 81

Quoted 2 lines
meta/recipes-core/glibc/glibc-locale.inc +2 -0
+                install -d "${D}${localedir}/$d"
+                find "${LOCALETREESRC}/${localedir}/$d" -maxdepth 1

-type f \

Quoted 6 lines

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef"

Quoted 6 lines
meta/recipes-core/glibc/glibc-locale.inc +2 -3
+                -exec install -m 0644 -t "${D}${localedir}/$d" {} \;
+        done
      if [ ${@d.getVar('PACKAGE_NO_GCONV')} -eq 0 ]; then
-             mkdir -p ${D}${libdir}
-             if [ -e ${LOCALETREESRC}/${libdir}/gconv ]; then
-                     cp -R --no-dereference --preserve=mode,links

${LOCALETREESRC}/${libdir}/gconv ${D}${libdir}

Quoted 3 lines

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef"

Quoted 3 lines
meta/recipes-core/glibc/glibc-locale.inc +0 -3
-             fi
-             if [ -e ${LOCALETREESRC}/${datadir}/i18n ]; then
-                     cp -R --no-dereference --preserve=mode,links

${LOCALETREESRC}/${datadir}/i18n ${D}${datadir}

Quoted 4 lines

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef"

Quoted 4 lines
meta/recipes-core/glibc/glibc-locale.inc +0 -4
-             fi
-     fi
-     if [ -e ${LOCALETREESRC}/${datadir}/locale ]; then
-             cp -R --no-dereference --preserve=mode,links

${LOCALETREESRC}/${datadir}/locale ${D}${datadir}

Quoted 1 line

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef" · line 85

Quoted 1 line
meta/recipes-core/glibc/glibc-locale.inc +1 -0
+                for d in . $(find "${LOCALETREESRC}/${libdir}/gconv"

-type d -printf '%P ') ; do

Quoted 2 lines

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef" · line 87

Quoted 2 lines
meta/recipes-core/glibc/glibc-locale.inc +2 -0
+                        install -d "${D}${libdir}/gconv/$d"
+                        find "${LOCALETREESRC}/${libdir}/gconv/$d"

-maxdepth 1 -type f \

Quoted 1 line

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef" · line 88

Quoted 1 line
meta/recipes-core/glibc/glibc-locale.inc +1 -0
+                        -exec install -m 0755 -t

"${D}${libdir}/gconv/$d" {} \;

Quoted 2 lines

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef" · line 90

Quoted 2 lines
meta/recipes-core/glibc/glibc-locale.inc +2 -0
+                done
+                for d in . $(find "${LOCALETREESRC}/${datadir}/i18n"

-type d -printf '%P ') ; do

Quoted 2 lines

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef" · line 92

Quoted 2 lines
meta/recipes-core/glibc/glibc-locale.inc +2 -0
+                        install -d "${D}${datadir}/i18n/$d"
+                        find "${LOCALETREESRC}/${datadir}/i18n/$d"

-maxdepth 1 -type f \

Quoted 1 line

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef" · line 93

Quoted 1 line
meta/recipes-core/glibc/glibc-locale.inc +1 -0
+                        -exec install -m 0644 -t

"${D}${datadir}/i18n/$d" {} \;

Quoted 3 lines

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef"

Quoted 3 lines
meta/recipes-core/glibc/glibc-locale.inc +1 -1
+                done
      fi
-     cp -R --no-dereference --preserve=mode,links

${LOCALETREESRC}/SUPPORTED ${WORKDIR}

Quoted 1 line

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef" · line 96

Quoted 1 line
meta/recipes-core/glibc/glibc-locale.inc +1 -0
+        for d in . $(find "${LOCALETREESRC}/${datadir}/locale" -type

d -printf '%P ') ; do

Quoted 2 lines

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef" · line 98

Quoted 2 lines
meta/recipes-core/glibc/glibc-locale.inc +2 -0
+                install -d "${D}${datadir}/locale/$d"
+                find "${LOCALETREESRC}/${datadir}/locale/$d"

-maxdepth 1 -type f \

Quoted 1 line

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef" · line 99

Quoted 1 line
meta/recipes-core/glibc/glibc-locale.inc +1 -0
+                -exec install -m 0644 -t "${D}${datadir}/locale/$d"

{} \;

Quoted 10 lines

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef" · line 104

Quoted 5 lines
meta/recipes-core/glibc/glibc-locale.inc +2 -0
+        done
+     install -m 0644 ${LOCALETREESRC}/SUPPORTED ${WORKDIR}/SUPPORTED
 }
 
 inherit libc-package

The trouble is this is a workaround. The cp commands should work and there is some underlying issue in pseudo causing this. We really need to figure out what that is since this will likely just mean we see the problem somewhere else :(

so far this is the only place where it shows in world builds that meta-oe does which includes many layers.

Quoted 3 lines

I still suspect some kind of inode number reuse problem which these cp commands trigger...

cp and install are not same when it comes to how they operate underneath. install is better when it comes to what we are doing here it also gives better control of permissions and mods,as a recipe writer someone would prefer then to let the tool ( cp ) assume it.

So there might be a pseudo issue, I dont disagree but not obvious and I believe using cp is subpar anyway.

Quoted 5 lines

Cheers,

Richard

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

#4 lore raw

Martin,
Do you by any chance build in Docker (or some other transient container)? We recently found an issue with building in docker where when the primary container command would exit, causing the container to terminate. When the container terminates, the kernel unceremoniously sends SIGKILL to all its processes. This plays *very* poorly with pseudo because pseudo keeps it's entire database in a in-memory sqlite database and only flushes it out to disk on a periodic interval, or when it get SIGTERM (maybe SIGQUIT?) or exits normally. By default the pseudo daemon will also hang around for 20(?) seconds waiting for a new connection from a pseudo client, meaning that when our docker container was exiting, there were potentially several pseudo dameons sitting around waiting for a client with unflushed databases in memory that suddenly got a SIGKILL and all their data was lost. This was particularly bad if you aborted a build while it was running, or some build failure occurred. Since the pseudo database was lost, the only way to correct these errors was to clean and rebuild.
I think pseudo could handle this better and keep the database on disk instead of in memory, but in the short term you can hack bitbake to pass the -S flag when invoking the pseudo client which will make it tell the dameon to shutdown (and thus flush the database) if it is the last connection.

Quoted 263 lines · Martin Jansa

There are other rare reproducers which don't involve cp/install (e.g. older qmake was triggering it quite often as well), I've mentioned some in:https://bugzilla.yoctoproject.org/show_bug.cgi?id=12434

glibc-locale is the most common one for sure as pretty much everybody is building that one, I don't have objection converting this from cp to install to prevent this random error (very rare random failure doesn't really help with #12434 reproducer and whoever work on it, can either revert this change or try to reproduce with something else) - I've included few hundreds of INSANE_SKIPs to ignore _random_ host-user-contaminated QAs in LG layers to prevent our builds failing randomly and the one for glibc-locale is the longest part:
https://github.com/webosose/meta-webosose/blob/master/meta-webos/recipes-core/glibc/glibc-locale_%25.bbappend

Regards,

Quoted 246 lines · Khem Raj

On Thu, Feb 7, 2019 at 1:00 AM Richard Purdie

Quoted 5 lines · <[email protected]> wrote:
Quoted 1 line · Khem Raj

This has been a constant source of trouble for build failures

due to host-user-contaminated QA

Quoted 5 lines
Quoted 5 lines

errors of sort

ERROR: QA Issue: glibc-locale:

/glibc-binary-localedata-ca-es+valencia/usr/lib/locale/ca_ES@valencia /LC_MONETARY is owned by uid 3004, which is the same as the user running bitbake. This may be due to host contamination [host-user- contaminated]

Quoted 3 lines
Quoted 3 lines

So far we have tried to mould cp command into not carrying the

build

Quoted 1 line
Quoted 1 line

user permissions into install area but it is never entirely

fixed since

Quoted 5 lines
Quoted 5 lines

the issue keeps popping up in various scenes

This patch replaces use of cp with install utility and

specifies install

Quoted 9 lines
Quoted 9 lines

mode for files explcitly

---

 meta/recipes-core/glibc/glibc-locale.inc | 44 ++++++++++++++

----------

Quoted 5 lines

Review

Quoted 5 lines
 1 file changed, 25 insertions(+), 19 deletions(-)
(quoted diff) +0 -0

b/meta/recipes-core/glibc/glibc-locale.inc

Quoted 9 lines

Review FILES_localedef = "${bindir}/localedef" · line 73

Quoted 9 lines

index 6384f9cbf1..9b256a5108 100644

--- a/meta/recipes-core/glibc/glibc-locale.inc

+++ b/meta/recipes-core/glibc/glibc-locale.inc

(quoted diff) +0 -0
@@ -72,27 +72,33 @@ FILES_localedef = "${bindir}/localedef"
 
 LOCALETREESRC = "${COMPONENTS_DIR}/${PACKAGE_ARCH}/glibc-

stash-locale"

Quoted 9 lines

Review FILES_localedef = "${bindir}/localedef" · line 80

Quoted 9 lines
(quoted diff) +0 -3
 do_install () {
 
-     mkdir -p ${D}${bindir} ${D}${datadir}
 
-     if [ -n "$(ls ${LOCALETREESRC}/${bindir})" ]; then
 
-             cp -R --no-dereference --preserve=mode,links

${LOCALETREESRC}/${bindir}/* ${D}${bindir}

Quoted 7 lines

Review FILES_localedef = "${bindir}/localedef" · line 87

Quoted 7 lines
(quoted diff) +0 -4
-     fi
 
-     if [ -n "$(ls ${LOCALETREESRC}/${localedir})" ]; then
 
-             mkdir -p ${D}${localedir}
 
-             cp -R --no-dereference --preserve=mode,links

${LOCALETREESRC}/${localedir}/* ${D}${localedir}

Quoted 5 lines

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef"

Quoted 5 lines
meta/recipes-core/glibc/glibc-locale.inc +2 -1
-     fi
 
+        install -d ${D}${bindir}
 
+        find "${LOCALETREESRC}/${bindir}" -maxdepth 1 -type f

\

Quoted 5 lines

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef"

Quoted 5 lines
meta/recipes-core/glibc/glibc-locale.inc +3 -0
+        -exec install -m 0755 -t "${D}${bindir}" {} \;
 
+
 
+        for d in . $(find "${LOCALETREESRC}/${localedir}"

-type d -printf '%P ') ; do

Quoted 3 lines

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef"

Quoted 3 lines
meta/recipes-core/glibc/glibc-locale.inc +2 -0
+                install -d "${D}${localedir}/$d"
 
+                find "${LOCALETREESRC}/${localedir}/$d"

-maxdepth 1 -type f \

Quoted 1 line

Review FILES_localedef = "${bindir}/localedef" · line 93

Quoted 1 line
(quoted diff) +1 -0
+                -exec install -m 0644 -t "${D}${localedir}/$d"

{} \;

Quoted 9 lines

Review FILES_localedef = "${bindir}/localedef"

Quoted 9 lines
(quoted diff) +1 -3
+        done
 
      if [ ${@d.getVar('PACKAGE_NO_GCONV')} -eq 0 ]; then
 
-             mkdir -p ${D}${libdir}
 
-             if [ -e ${LOCALETREESRC}/${libdir}/gconv ]; then
 
-                     cp -R --no-dereference --

preserve=mode,links ${LOCALETREESRC}/${libdir}/gconv ${D}${libdir}

Quoted 5 lines

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef"

Quoted 5 lines
meta/recipes-core/glibc/glibc-locale.inc +0 -3
-             fi
 
-             if [ -e ${LOCALETREESRC}/${datadir}/i18n ]; then
 
-                     cp -R --no-dereference --

preserve=mode,links ${LOCALETREESRC}/${datadir}/i18n ${D}${datadir}

Quoted 7 lines

Review

Quoted 7 lines
(quoted diff) +0 -4
-             fi
 
-     fi
 
-     if [ -e ${LOCALETREESRC}/${datadir}/locale ]; then
 
-             cp -R --no-dereference --preserve=mode,links

${LOCALETREESRC}/${datadir}/locale ${D}${datadir}

Quoted 1 line
Quoted 1 line

+ for d in . $(find

"${LOCALETREESRC}/${libdir}/gconv" -type d -printf '%P ') ; do

Quoted 3 lines

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef"

Quoted 3 lines
meta/recipes-core/glibc/glibc-locale.inc +2 -0
+                        install -d "${D}${libdir}/gconv/$d"
 
+                        find

"${LOCALETREESRC}/${libdir}/gconv/$d" -maxdepth 1 -type f \

Quoted 1 line
Quoted 1 line

+ -exec install -m 0755 -t

"${D}${libdir}/gconv/$d" {} \;

Quoted 3 lines

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef"

Quoted 3 lines
meta/recipes-core/glibc/glibc-locale.inc +2 -0
+                done
 
+                for d in . $(find

"${LOCALETREESRC}/${datadir}/i18n" -type d -printf '%P ') ; do

Quoted 3 lines

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef"

Quoted 3 lines
meta/recipes-core/glibc/glibc-locale.inc +2 -0
+                        install -d "${D}${datadir}/i18n/$d"
 
+                        find

"${LOCALETREESRC}/${datadir}/i18n/$d" -maxdepth 1 -type f \

Quoted 1 line
Quoted 1 line

+ -exec install -m 0644 -t

"${D}${datadir}/i18n/$d" {} \;

Quoted 5 lines

Review

Quoted 5 lines
(quoted diff) +1 -1
+                done
 
      fi
 
-     cp -R --no-dereference --preserve=mode,links

${LOCALETREESRC}/SUPPORTED ${WORKDIR}

Quoted 1 line
Quoted 1 line

+ for d in . $(find "${LOCALETREESRC}/${datadir}/locale"

-type d -printf '%P ') ; do

Quoted 3 lines

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef"

Quoted 3 lines
meta/recipes-core/glibc/glibc-locale.inc +2 -0
+                install -d "${D}${datadir}/locale/$d"
 
+                find "${LOCALETREESRC}/${datadir}/locale/$d"

-maxdepth 1 -type f \

Quoted 1 line
Quoted 1 line

+ -exec install -m 0644 -t

"${D}${datadir}/locale/$d" {} \;

Quoted 3 lines

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef"

Quoted 3 lines
meta/recipes-core/glibc/glibc-locale.inc +2 -0
+        done
 
+     install -m 0644 ${LOCALETREESRC}/SUPPORTED

${WORKDIR}/SUPPORTED

Quoted 9 lines
Quoted 5 lines

}

inherit libc-package

The trouble is this is a workaround. The cp commands should work

and

Quoted 1 line

there is some underlying issue in pseudo causing this. We really

need

Quoted 1 line

to figure out what that is since this will likely just mean we

see the

Quoted 1 line

problem somewhere else :(

so far this is the only place where it shows in world builds that

meta-oe does which includes many layers.

Quoted 3 lines

I still suspect some kind of inode number reuse problem which

these cp

Quoted 1 line

commands trigger...

cp and install are not same when it comes to how they operate

underneath. install is better when it comes to what we are doing here

it also gives better control of permissions and mods,as a recipe writer

someone would prefer then to let the tool ( cp ) assume it.

So there might be a pseudo issue, I dont disagree but not obvious and

I believe using cp is subpar anyway.

Quoted 9 lines

Cheers,

Richard

Signature · 1 line
Joshua Watt <[email protected]>
#5 lore raw
Quoted 6 lines · Joshua Watt

Martin,

Do you by any chance build in Docker (or some other transient container)? We recently found an issue with building in docker where when the primary container command would exit, causing the container to terminate. When the container terminates, the kernel unceremoniously sends SIGKILL to all its processes. This plays *very* poorly with pseudo because pseudo keeps it's entire database in a in-memory sqlite database and only flushes it out to disk on a periodic interval, or when it get SIGTERM (maybe SIGQUIT?) or exits normally. By default the pseudo daemon will also hang around for 20(?) seconds waiting for a new connection from a pseudo client, meaning that when our docker container was exiting, there were potentially several pseudo dameons sitting around waiting for a client with unflushed databases in memory that suddenly got a SIGKILL and all their data was lost. This was particularly bad if you aborted a build while it was running, or some build failure occurred. Since the pseudo database was lost, the only way to correct these errors was to clean and rebuild.

I think pseudo could handle this better and keep the database on disk instead of in memory, but in the short term you can hack bitbake to pass the -S flag when invoking the pseudo client which will make it tell the dameon to shutdown (and thus flush the database) if it is the last connection.

FWIW, this patch makes it much easier to do that
http://lists.openembedded.org/pipermail/bitbake-devel/2019-February/019813.html
Just add
FAKEROOTCMD += "-S"
in local.conf

Quoted 122 lines · Martin Jansa

There are other rare reproducers which don't involve cp/install (e.g. older qmake was triggering it quite often as well), I've mentioned some in:
https://bugzilla.yoctoproject.org/show_bug.cgi?id=12434

glibc-locale is the most common one for sure as pretty much everybody is building that one, I don't have objection converting this from cp to install to prevent this random error (very rare random failure doesn't really help with #12434 reproducer and whoever work on it, can either revert this change or try to reproduce with something else) - I've included few hundreds of INSANE_SKIPs to ignore _random_ host-user-contaminated QAs in LG layers to prevent our builds failing randomly and the one for glibc-locale is the longest part:
https://github.com/webosose/meta-webosose/blob/master/meta-webos/recipes-core/glibc/glibc-locale_%25.bbappend

Regards,

On Thu, Feb 7, 2019 at 3:50 PM Khem Raj <[email protected]> wrote:

Quoted 75 lines · Richard Purdie
Quoted 73 lines · Khem Raj

This has been a constant source of trouble for build failures due to host-user-contaminated QA errors of sort

ERROR: QA Issue: glibc-locale: /glibc-binary-localedata-ca-es+valencia/usr/lib/locale/ca_ES@valencia/LC_MONETARY is owned by uid 3004, which is the same as the user running bitbake. This may be due to host contamination [host-user-contaminated]

So far we have tried to mould cp command into not carrying the build user permissions into install area but it is never entirely fixed since the issue keeps popping up in various scenes

This patch replaces use of cp with install utility and specifies install mode for files explcitly

---
 meta/recipes-core/glibc/glibc-locale.inc | 44 ++++++++++++++----------
 1 file changed, 25 insertions(+), 19 deletions(-)
meta/recipes-core/glibc/glibc-locale.inc +25 -19
index 6384f9cbf1..9b256a5108 100644
@@ -72,27 +72,33 @@ FILES_localedef = "${bindir}/localedef"
 LOCALETREESRC = "${COMPONENTS_DIR}/${PACKAGE_ARCH}/glibc-stash-locale"
 
 do_install () {
-     mkdir -p ${D}${bindir} ${D}${datadir}
-     if [ -n "$(ls ${LOCALETREESRC}/${bindir})" ]; then
-             cp -R --no-dereference --preserve=mode,links ${LOCALETREESRC}/${bindir}/* ${D}${bindir}
-     fi
-     if [ -n "$(ls ${LOCALETREESRC}/${localedir})" ]; then
-             mkdir -p ${D}${localedir}
-             cp -R --no-dereference --preserve=mode,links ${LOCALETREESRC}/${localedir}/* ${D}${localedir}
-     fi
+        install -d ${D}${bindir}
+        find "${LOCALETREESRC}/${bindir}" -maxdepth 1 -type f \
+        -exec install -m 0755 -t "${D}${bindir}" {} \;
+
+        for d in . $(find "${LOCALETREESRC}/${localedir}" -type d -printf '%P ') ; do
+                install -d "${D}${localedir}/$d"
+                find "${LOCALETREESRC}/${localedir}/$d" -maxdepth 1 -type f \
+                -exec install -m 0644 -t "${D}${localedir}/$d" {} \;
+        done
      if [ ${@d.getVar('PACKAGE_NO_GCONV')} -eq 0 ]; then
-             mkdir -p ${D}${libdir}
-             if [ -e ${LOCALETREESRC}/${libdir}/gconv ]; then
-                     cp -R --no-dereference --preserve=mode,links ${LOCALETREESRC}/${libdir}/gconv ${D}${libdir}
-             fi
-             if [ -e ${LOCALETREESRC}/${datadir}/i18n ]; then
-                     cp -R --no-dereference --preserve=mode,links ${LOCALETREESRC}/${datadir}/i18n ${D}${datadir}
-             fi
-     fi
-     if [ -e ${LOCALETREESRC}/${datadir}/locale ]; then
-             cp -R --no-dereference --preserve=mode,links ${LOCALETREESRC}/${datadir}/locale ${D}${datadir}
+                for d in . $(find "${LOCALETREESRC}/${libdir}/gconv" -type d -printf '%P ') ; do
+                        install -d "${D}${libdir}/gconv/$d"
+                        find "${LOCALETREESRC}/${libdir}/gconv/$d" -maxdepth 1 -type f \
+                        -exec install -m 0755 -t "${D}${libdir}/gconv/$d" {} \;
+                done
+                for d in . $(find "${LOCALETREESRC}/${datadir}/i18n" -type d -printf '%P ') ; do
+                        install -d "${D}${datadir}/i18n/$d"
+                        find "${LOCALETREESRC}/${datadir}/i18n/$d" -maxdepth 1 -type f \
+                        -exec install -m 0644 -t "${D}${datadir}/i18n/$d" {} \;
+                done
      fi
-     cp -R --no-dereference --preserve=mode,links ${LOCALETREESRC}/SUPPORTED ${WORKDIR}
+        for d in . $(find "${LOCALETREESRC}/${datadir}/locale" -type d -printf '%P ') ; do
+                install -d "${D}${datadir}/locale/$d"
+                find "${LOCALETREESRC}/${datadir}/locale/$d" -maxdepth 1 -type f \
+                -exec install -m 0644 -t "${D}${datadir}/locale/$d" {} \;
+        done
+     install -m 0644 ${LOCALETREESRC}/SUPPORTED ${WORKDIR}/SUPPORTED
 }
 
Quoted 6 lines

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef" · line 104

Quoted 1 line
meta/recipes-core/glibc/glibc-locale.inc +0 -0
 inherit libc-package

The trouble is this is a workaround. The cp commands should work and there is some underlying issue in pseudo causing this. We really need to figure out what that is since this will likely just mean we see the problem somewhere else :(

so far this is the only place where it shows in world builds that meta-oe does which includes many layers.

Quoted 3 lines

I still suspect some kind of inode number reuse problem which these cp commands trigger...

cp and install are not same when it comes to how they operate underneath. install is better when it comes to what we are doing here it also gives better control of permissions and mods,as a recipe writer someone would prefer then to let the tool ( cp ) assume it.

So there might be a pseudo issue, I dont disagree but not obvious and I believe using cp is subpar anyway.

Quoted 5 lines

Cheers,

Richard

--

Joshua Watt <[email protected]>

#6 lore raw
Quoted 6 lines · Joshua Watt
Quoted 5 lines · Joshua Watt

Martin,

Do you by any chance build in Docker (or some other transient container)? We recently found an issue with building in docker where when the primary container command would exit, causing the container to terminate. When the container terminates, the kernel unceremoniously sends SIGKILL to all its processes. This plays *very* poorly with pseudo because pseudo keeps it's entire database in a in-memory sqlite database and only flushes it out to disk on a periodic interval, or when it get SIGTERM (maybe SIGQUIT?) or exits normally. By default the pseudo daemon will also hang around for 20(?) seconds waiting for a new connection from a pseudo client, meaning that when our docker container was exiting, there were potentially several pseudo dameons sitting around waiting for a client with unflushed databases in memory that suddenly got a SIGKILL and all their data was lost. This was particularly bad if you aborted a build while it was running, or some build failure occurred. Since the pseudo database was lost, the only way to correct these errors was to clean and rebuild.

Quoted 7 lines
Quoted 1 line

I think pseudo could handle this better and keep the database on disk instead of in memory, but in the short term you can hack bitbake to pass the -S flag when invoking the pseudo client which will make it tell the dameon to shutdown (and thus flush the database) if it is the last connection.

FWIW, this patch makes it much easier to do that
http://lists.openembedded.org/pipermail/bitbake-devel/2019-February/019813.html
Just add
FAKEROOTCMD += "-S"
in local.conf

Hi Joshua,

most of the build failures caused by this weren't from the builds in Docker (or any other container), just plain Ubuntu (various versions 14.04 - 18.04) with just the prerequisites installed.

When I get access to some bigger build farm (probably in few months) I can run that for loop reproducer from the ticket again with FAKEROOTCMD += "-S"
to see if it makes any difference.

Regards,

Quoted 120 lines
Quoted 120 lines · Martin Jansa

There are other rare reproducers which don't involve cp/install (e.g. older qmake was triggering it quite often as well), I've mentioned some in:
https://bugzilla.yoctoproject.org/show_bug.cgi?id=12434

glibc-locale is the most common one for sure as pretty much everybody is building that one, I don't have objection converting this from cp to install to prevent this random error (very rare random failure doesn't really help with #12434 reproducer and whoever work on it, can either revert this change or try to reproduce with something else) - I've included few hundreds of INSANE_SKIPs to ignore _random_ host-user-contaminated QAs in LG layers to prevent our builds failing randomly and the one for glibc-locale is the longest part:
https://github.com/webosose/meta-webosose/blob/master/meta-webos/recipes-core/glibc/glibc-locale_%25.bbappend

Regards,

On Thu, Feb 7, 2019 at 3:50 PM Khem Raj <[email protected]> wrote:

Quoted 75 lines · Richard Purdie
Quoted 73 lines · Khem Raj

This has been a constant source of trouble for build failures due to host-user-contaminated QA errors of sort

ERROR: QA Issue: glibc-locale: /glibc-binary-localedata-ca-es+valencia/usr/lib/locale/ca_ES@valencia/LC_MONETARY is owned by uid 3004, which is the same as the user running bitbake. This may be due to host contamination [host-user-contaminated]

So far we have tried to mould cp command into not carrying the build user permissions into install area but it is never entirely fixed since the issue keeps popping up in various scenes

This patch replaces use of cp with install utility and specifies install mode for files explcitly

---
 meta/recipes-core/glibc/glibc-locale.inc | 44 ++++++++++++++----------
 1 file changed, 25 insertions(+), 19 deletions(-)
meta/recipes-core/glibc/glibc-locale.inc +25 -19
index 6384f9cbf1..9b256a5108 100644
@@ -72,27 +72,33 @@ FILES_localedef = "${bindir}/localedef"
 LOCALETREESRC = "${COMPONENTS_DIR}/${PACKAGE_ARCH}/glibc-stash-locale"
 
 do_install () {
-     mkdir -p ${D}${bindir} ${D}${datadir}
-     if [ -n "$(ls ${LOCALETREESRC}/${bindir})" ]; then
-             cp -R --no-dereference --preserve=mode,links ${LOCALETREESRC}/${bindir}/* ${D}${bindir}
-     fi
-     if [ -n "$(ls ${LOCALETREESRC}/${localedir})" ]; then
-             mkdir -p ${D}${localedir}
-             cp -R --no-dereference --preserve=mode,links ${LOCALETREESRC}/${localedir}/* ${D}${localedir}
-     fi
+        install -d ${D}${bindir}
+        find "${LOCALETREESRC}/${bindir}" -maxdepth 1 -type f \
+        -exec install -m 0755 -t "${D}${bindir}" {} \;
+
+        for d in . $(find "${LOCALETREESRC}/${localedir}" -type d -printf '%P ') ; do
+                install -d "${D}${localedir}/$d"
+                find "${LOCALETREESRC}/${localedir}/$d" -maxdepth 1 -type f \
+                -exec install -m 0644 -t "${D}${localedir}/$d" {} \;
+        done
      if [ ${@d.getVar('PACKAGE_NO_GCONV')} -eq 0 ]; then
-             mkdir -p ${D}${libdir}
-             if [ -e ${LOCALETREESRC}/${libdir}/gconv ]; then
-                     cp -R --no-dereference --preserve=mode,links ${LOCALETREESRC}/${libdir}/gconv ${D}${libdir}
-             fi
-             if [ -e ${LOCALETREESRC}/${datadir}/i18n ]; then
-                     cp -R --no-dereference --preserve=mode,links ${LOCALETREESRC}/${datadir}/i18n ${D}${datadir}
-             fi
-     fi
-     if [ -e ${LOCALETREESRC}/${datadir}/locale ]; then
-             cp -R --no-dereference --preserve=mode,links ${LOCALETREESRC}/${datadir}/locale ${D}${datadir}
+                for d in . $(find "${LOCALETREESRC}/${libdir}/gconv" -type d -printf '%P ') ; do
+                        install -d "${D}${libdir}/gconv/$d"
+                        find "${LOCALETREESRC}/${libdir}/gconv/$d" -maxdepth 1 -type f \
+                        -exec install -m 0755 -t "${D}${libdir}/gconv/$d" {} \;
+                done
+                for d in . $(find "${LOCALETREESRC}/${datadir}/i18n" -type d -printf '%P ') ; do
+                        install -d "${D}${datadir}/i18n/$d"
+                        find "${LOCALETREESRC}/${datadir}/i18n/$d" -maxdepth 1 -type f \
+                        -exec install -m 0644 -t "${D}${datadir}/i18n/$d" {} \;
+                done
      fi
-     cp -R --no-dereference --preserve=mode,links ${LOCALETREESRC}/SUPPORTED ${WORKDIR}
+        for d in . $(find "${LOCALETREESRC}/${datadir}/locale" -type d -printf '%P ') ; do
+                install -d "${D}${datadir}/locale/$d"
+                find "${LOCALETREESRC}/${datadir}/locale/$d" -maxdepth 1 -type f \
+                -exec install -m 0644 -t "${D}${datadir}/locale/$d" {} \;
+        done
+     install -m 0644 ${LOCALETREESRC}/SUPPORTED ${WORKDIR}/SUPPORTED
 }
 
Quoted 6 lines

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef" · line 104

Quoted 1 line
meta/recipes-core/glibc/glibc-locale.inc +0 -0
 inherit libc-package

The trouble is this is a workaround. The cp commands should work and there is some underlying issue in pseudo causing this. We really need to figure out what that is since this will likely just mean we see the problem somewhere else :(

so far this is the only place where it shows in world builds that meta-oe does which includes many layers.

Quoted 3 lines

I still suspect some kind of inode number reuse problem which these cp commands trigger...

cp and install are not same when it comes to how they operate underneath. install is better when it comes to what we are doing here it also gives better control of permissions and mods,as a recipe writer someone would prefer then to let the tool ( cp ) assume it.

So there might be a pseudo issue, I dont disagree but not obvious and I believe using cp is subpar anyway.

Quoted 5 lines

Cheers,

Richard

--

Joshua Watt <[email protected]>

Signature · 1 line
Martin 'JaMa' Jansa     jabber: [email protected]
#7 lore raw
In reply to Joshua Watt
Quoted 28 lines · Joshua Watt
Quoted 18 lines · Joshua Watt

Martin,

Do you by any chance build in Docker (or some other transient container)? We recently found an issue with building in docker where when the primary container command would exit, causing the container to terminate. When the container terminates, the kernel unceremoniously sends SIGKILL to all its processes. This plays *very* poorly with pseudo because pseudo keeps it's entire database in a in-memory sqlite database and only flushes it out to disk on a periodic interval, or when it get SIGTERM (maybe SIGQUIT?) or exits normally. By default the pseudo daemon will also hang around for 20(?) seconds waiting for a new connection from a pseudo client, meaning that when our docker container was exiting, there were potentially several pseudo dameons sitting around waiting for a client with unflushed databases in memory that suddenly got a SIGKILL and all their data was lost. This was particularly bad if you aborted a build while it was running, or some build failure occurred. Since

the pseudo database was lost, the only way to correct these errors
was to clean and rebuild.

Quoted 5 lines

I think pseudo could handle this better and keep the database on disk instead of in memory, but in the short term you can hack bitbake to pass the -S flag when invoking the pseudo client which will make it tell the dameon to shutdown (and thus flush the database) if it is the last connection.

Quoted 5 lines

FWIW, this patch makes it much easier to do that
http://lists.openembedded.org/pipermail/bitbake-devel/2019-February/019813.html
Just add
FAKEROOTCMD += "-S"
in local.conf

Should we be doing that by default? Is there a downside?

Keeping the database flushed to disk would likely be slow but this seems reasonable.

Cheers,

Richard

#8 lore raw
Quoted 32 lines · Richard Purdie
Quoted 31 lines · Joshua Watt
Quoted 13 lines · Joshua Watt

Martin,

Do you by any chance build in Docker (or some other transient container)? We recently found an issue with building in docker where when the primary container command would exit, causing the container to terminate. When the container terminates, the kernel unceremoniously sends SIGKILL to all its processes. This plays *very* poorly with pseudo because pseudo keeps it's entire database
in a in-memory sqlite database and only flushes it out to disk on a
periodic interval, or when it get SIGTERM (maybe SIGQUIT?) or exits

Quoted 8 lines

normally. By default the pseudo daemon will also hang around for 20(?) seconds waiting for a new connection from a pseudo client, meaning that when our docker container was exiting, there were potentially several pseudo dameons sitting around waiting for a client with unflushed databases in memory that suddenly got a SIGKILL and all their data was lost. This was particularly bad if you aborted a build while it was running, or some build failure occurred. Since

the pseudo database was lost, the only way to correct these errors
was to clean and rebuild.

Quoted 5 lines

I think pseudo could handle this better and keep the database on disk instead of in memory, but in the short term you can hack bitbake to pass the -S flag when invoking the pseudo client which will make it tell the dameon to shutdown (and thus flush the database) if it is the last connection.

Quoted 7 lines
Quoted 5 lines

FWIW, this patch makes it much easier to do that
http://lists.openembedded.org/pipermail/bitbake-devel/2019-February/019813.html
Just add
FAKEROOTCMD += "-S"
in local.conf

Should we be doing that by default? Is there a downside?

pseudo won't stick around waiting for connections from other clients. I'm not sure if this would impact performance at all, as I'm not sure how often a client is able to connect during the "grace period" to prevent a new server needing to be spun up. I would image this potentially cuts down on the spin up time for back-to-back fakeroot tasks in the same recipe?

Quoted 3 lines

Keeping the database flushed to disk would likely be slow but this seems reasonable.

I think there are 3 options in increasing order of complexity/risk/safety

1. Add -S to FAKEROOTCMD by default
2. Make pseudo flush the in memory cache every time the last client
disconnects
3. Remove the in-memory cache from pseudo completely and make it write
to disk each time. Even if we removed all disk flushes from the sqlite database to keep sync()'s down, it would no worse that what happens today in any case I can think of (specifically, a power loss will cause lost data), and in many cases it would be better (e.g. SIGKILL and crashes in pseudo wouldn't cause data loss).

Quoted 6 lines

Cheers,

Richard

Signature · 1 line
Joshua Watt <[email protected]>
#9 lore raw
In reply to Richard Purdie
Quoted 117 lines

-----Original Message-----
From: [email protected] <openembedded- [email protected]> On Behalf Of Richard Purdie
Sent: den 7 februari 2019 10:01
To: Khem Raj <[email protected]>; openembedded- [email protected]
Subject: Re: [OE-core] [PATCH] glibc-locale: Rewrite do_install using install utility instead of cp

Quoted 1 line · Khem Raj

This has been a constant source of trouble for build failures due to

host-user-contaminated QA

Quoted 3 lines

errors of sort

ERROR: QA Issue: glibc-locale: /glibc-binary-localedata-ca-

es+valencia/usr/lib/locale/ca_ES@valencia/LC_MONETARY is owned by uid 3004, which is the same as the user running bitbake. This may be due to host contamination [host-user-contaminated]

Quoted 3 lines

So far we have tried to mould cp command into not carrying the build user permissions into install area but it is never entirely fixed

since

Quoted 3 lines

the issue keeps popping up in various scenes

This patch replaces use of cp with install utility and specifies

install

Quoted 5 lines

mode for files explcitly

---
 meta/recipes-core/glibc/glibc-locale.inc | 44 ++++++++++++++--------

--

meta/recipes-

Quoted 3 lines
 1 file changed, 25 insertions(+), 19 deletions(-)
meta/recipes- renamed from meta/recipes-core/glibc/glibc-locale.inc +0 -0

core/glibc/glibc-locale.inc

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef" · line 72

Quoted 5 lines

index 6384f9cbf1..9b256a5108 100644

meta/recipes-core/glibc/glibc-locale.inc +0 -0
@@ -72,27 +72,33 @@ FILES_localedef = "${bindir}/localedef"
 LOCALETREESRC = "${COMPONENTS_DIR}/${PACKAGE_ARCH}/glibc-stash-

locale"

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef" · line 76

Quoted 5 lines
meta/recipes-core/glibc/glibc-locale.inc +0 -3
 do_install () {
-	mkdir -p ${D}${bindir} ${D}${datadir}
-	if [ -n "$(ls ${LOCALETREESRC}/${bindir})" ]; then
-		cp -R --no-dereference --preserve=mode,links

${LOCALETREESRC}/${bindir}/* ${D}${bindir}

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef" · line 80

Quoted 4 lines
meta/recipes-core/glibc/glibc-locale.inc +0 -4
-	fi
-	if [ -n "$(ls ${LOCALETREESRC}/${localedir})" ]; then
-		mkdir -p ${D}${localedir}
-		cp -R --no-dereference --preserve=mode,links

${LOCALETREESRC}/${localedir}/* ${D}${localedir}

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef" · line 78

Quoted 6 lines
meta/recipes-core/glibc/glibc-locale.inc +5 -1
-	fi
+        install -d ${D}${bindir}
+        find "${LOCALETREESRC}/${bindir}" -maxdepth 1 -type f \
+        -exec install -m 0755 -t "${D}${bindir}" {} \;
+
+        for d in . $(find "${LOCALETREESRC}/${localedir}" -type d -

printf '%P ') ; do

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef" · line 80

Quoted 2 lines
meta/recipes-core/glibc/glibc-locale.inc +2 -0
+                install -d "${D}${localedir}/$d"
+                find "${LOCALETREESRC}/${localedir}/$d" -maxdepth 1

-type f \

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef" · line 85

Quoted 6 lines
meta/recipes-core/glibc/glibc-locale.inc +2 -3
+                -exec install -m 0644 -t "${D}${localedir}/$d" {} \;
+        done
 	if [ ${@d.getVar('PACKAGE_NO_GCONV')} -eq 0 ]; then
-		mkdir -p ${D}${libdir}
-		if [ -e ${LOCALETREESRC}/${libdir}/gconv ]; then
-			cp -R --no-dereference --

preserve=mode,links ${LOCALETREESRC}/${libdir}/gconv ${D}${libdir}

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef" · line 88

Quoted 3 lines
meta/recipes-core/glibc/glibc-locale.inc +0 -3
-		fi
-		if [ -e ${LOCALETREESRC}/${datadir}/i18n ]; then
-			cp -R --no-dereference --

preserve=mode,links ${LOCALETREESRC}/${datadir}/i18n ${D}${datadir}

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef" · line 92

Quoted 4 lines
meta/recipes-core/glibc/glibc-locale.inc +0 -4
-		fi
-	fi
-	if [ -e ${LOCALETREESRC}/${datadir}/locale ]; then
-		cp -R --no-dereference --preserve=mode,links

${LOCALETREESRC}/${datadir}/locale ${D}${datadir}

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef" · line 84

Quoted 1 line
meta/recipes-core/glibc/glibc-locale.inc +1 -0
+                for d in . $(find "${LOCALETREESRC}/${libdir}/gconv"

-type d -printf '%P ') ; do

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef" · line 86

Quoted 2 lines
meta/recipes-core/glibc/glibc-locale.inc +2 -0
+                        install -d "${D}${libdir}/gconv/$d"
+                        find "${LOCALETREESRC}/${libdir}/gconv/$d" -

maxdepth 1 -type f \

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef" · line 87

Quoted 1 line
meta/recipes-core/glibc/glibc-locale.inc +1 -0
+                        -exec install -m 0755 -t

"${D}${libdir}/gconv/$d" {} \;

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef" · line 89

Quoted 2 lines
meta/recipes-core/glibc/glibc-locale.inc +2 -0
+                done
+                for d in . $(find "${LOCALETREESRC}/${datadir}/i18n"

-type d -printf '%P ') ; do

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef" · line 91

Quoted 2 lines
meta/recipes-core/glibc/glibc-locale.inc +2 -0
+                        install -d "${D}${datadir}/i18n/$d"
+                        find "${LOCALETREESRC}/${datadir}/i18n/$d" -

maxdepth 1 -type f \

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef" · line 92

Quoted 1 line
meta/recipes-core/glibc/glibc-locale.inc +1 -0
+                        -exec install -m 0644 -t

"${D}${datadir}/i18n/$d" {} \;

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef" · line 94

Quoted 3 lines
meta/recipes-core/glibc/glibc-locale.inc +1 -1
+                done
 	fi
-	cp -R --no-dereference --preserve=mode,links

${LOCALETREESRC}/SUPPORTED ${WORKDIR}

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef" · line 95

Quoted 1 line
meta/recipes-core/glibc/glibc-locale.inc +1 -0
+        for d in . $(find "${LOCALETREESRC}/${datadir}/locale" -type

d -printf '%P ') ; do

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef" · line 97

Quoted 2 lines
meta/recipes-core/glibc/glibc-locale.inc +2 -0
+                install -d "${D}${datadir}/locale/$d"
+                find "${LOCALETREESRC}/${datadir}/locale/$d" -

maxdepth 1 -type f \

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef" · line 98

Quoted 1 line
meta/recipes-core/glibc/glibc-locale.inc +1 -0
+                -exec install -m 0644 -t "${D}${datadir}/locale/$d"

{} \;

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef" · line 100

Quoted 2 lines
meta/recipes-core/glibc/glibc-locale.inc +2 -0
+        done
+	install -m 0644 ${LOCALETREESRC}/SUPPORTED

${WORKDIR}/SUPPORTED

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef" · line 103

Quoted 3 lines
meta/recipes-core/glibc/glibc-locale.inc +0 -0
 }
 
 inherit libc-package

The trouble is this is a workaround. The cp commands should work and there is some underlying issue in pseudo causing this. We really need to figure out what that is since this will likely just mean we see the problem somewhere else :(

Quoted 6 lines

I still suspect some kind of inode number reuse problem which these cp commands trigger...

Cheers,

Richard

For the record, even if I think the patch was the right thing to do, it did not help the situation. The first build I did after it was integrated, I was bit by the following:

Failed to determine the user name of UID 323 for tmp/work/core2-64-poky-linux/glibc-locale/2.29-r0/package/usr/lib/locale

where UID 323 is my UID. If you do not recognize the error message, it is because it comes from a local patch we have for rpm to protect us from any incorrect UIDs/GIDs causing incorrect RPMs to be generated (see below). I checked the build directory and the /usr/lib/locale directory was the only file or directory with an incorrect owner, which is typical of these pseudo related problems with incorrect owners.

[rpm will by default silently fall back to use root for any files where it cannot determine the name of the user or group based on its UID/GID. This can be due to missing information in the /etc/passwd or /etc/groups files, typically due to relying on another recipe in DEPENDS to create the user without also having an RDEPENDS on the package that creates the user, or because of pseudo messing up. After this bit us once where a device in /dev ended up in an rpm in the sstate cache with root as group instead of the intended video group, which in turn caused the video application to fail as it was no longer allowed to open its device, I created the patch. It is causing a fair bit of grief as it causes builds to fail randomly, but at least we don't end up with an incorrect sstate anymore, which is worse. I am not sure this patch is suitable for integration to OE-Core, but I have attached it if anyone is interested.]

//Peter

From 0f96b74bce4cf071ee5c22c4776f1352a1f43812 Mon Sep 17 00:00:00 2001
From: Peter Kjellerstedt <[email protected]>
Date: Fri, 3 Nov 2017 13:44:40 +0100
Subject: [PATCH] rpm: Make it an error if a UID/GID cannot be turned into a
name

Before, any unknown UID or GID would result in the name of the current user (typically root) being silently used instead, which leads to undeterministic behavior depending on whether the required user or group name is available in /etc/passwd or /etc/group, or not.

This is only appropriate for the native and nativesdk versions.

---
 ...error-if-a-UID-GID-cannot-be-turned-into-.patch | 49 ++++++++++++++++++++++
 meta/recipes-devtools/rpm/rpm_4.14.2.1.bb          |  2 +
 2 files changed, 51 insertions(+)
 create mode 100644 meta/recipes-devtools/rpm/files/0001-Make-it-an-error-if-a-UID-GID-cannot-be-turned-into-.patch
meta/recipes-devtools/rpm/files/0001-Make-it-an-error-if-a-UID-GID-cannot-be-turned-into-.patch new file +49 -0
new file mode 100644
index 0000000000..a9467dc298
@@ -0,0 +1,49 @@
+From 4777dc38c7554787caf9a37575c3e2912783ed23 Mon Sep 17 00:00:00 2001
+From: Peter Kjellerstedt <[email protected]>
+Date: Fri, 3 Nov 2017 13:41:09 +0100
+Subject: [PATCH] Make it an error if a UID/GID cannot be turned into a name
+
+Before, any unknown UID or GID would result in the name of the current
+user (typically root) being silently used instead, which leads to
+undeterministic behavior depending on whether the required user or
+group name is available in /etc/passwd or /etc/group, or not.
+
+Upstream-Status: Inappropriate
+Signed-off-by: Peter Kjellerstedt <[email protected]>
+
+---
+ build/files.c | 18 +++++++++++-------
+ 1 file changed, 11 insertions(+), 7 deletions(-)
+
+diff --git a/build/files.c b/build/files.c
+index 585d73e3f..f92ebd9e9 100644
+--- a/build/files.c
++++ b/build/files.c
+@@ -1373,13 +1373,17 @@ static rpmRC addFile(FileList fl, const char * diskPath,
+     } else {
+ 	fileGname = rpmugGname(fileGid);
+     }
+-	
+-    /* Default user/group to builder's user/group */
+-    if (fileUname == NULL)
+-	fileUname = rpmugUname(getuid());
+-    if (fileGname == NULL)
+-	fileGname = rpmugGname(getgid());
+-    
++
++    /* Fail if the user and/or group name cannot be determined */
++    if (fileUname == NULL) {
++	rpmlog(RPMLOG_ERR, _("Failed to determine the user name of UID %d for %s\n"), fileUid, diskPath);
++	goto exit;
++    }
++    if (fileGname == NULL) {
++	rpmlog(RPMLOG_ERR, _("Failed to determine the group name of GID %d for %s\n"), fileGid, diskPath);
++	goto exit;
++    }
++
+     /* S_XXX macro must be consistent with type in find call at check-files script */
+     if (check_fileList && (S_ISREG(fileMode) || S_ISLNK(fileMode))) {
+ 	appendStringBuf(check_fileList, diskPath);
+-- 
+2.12.0
+
meta/recipes-devtools/rpm/rpm_4.14.2.1.bb +2 -0
index 063f4269a5..3316c7d60f 100644
@@ -42,6 +42,8 @@ SRC_URI = "git://github.com/rpm-software-management/rpm;branch=rpm-4.14.x \
            file://0001-rpm-rpmio.c-restrict-virtual-memory-usage-if-limit-s.patch \
            file://0016-rpmscript.c-change-logging-level-around-scriptlets-t.patch \
            "
+SRC_URI_append_class-native = " file://0001-Make-it-an-error-if-a-UID-GID-cannot-be-turned-into-.patch"
+SRC_URI_append_class-nativesdk = " file://0001-Make-it-an-error-if-a-UID-GID-cannot-be-turned-into-.patch"
 
 PE = "1"
 SRCREV = "4a9440006398646583f0d9ae1837dad2875013aa"
Signature · 1 line
2.12.0
#10 lore raw
Quoted 180 lines

-----Original Message-----
From: [email protected] <openembedded- [email protected]> On Behalf Of Peter Kjellerstedt
Sent: den 10 februari 2019 02:29
To: Richard Purdie <[email protected]>; Khem Raj <[email protected]>; [email protected]
Subject: Re: [OE-core] [PATCH] glibc-locale: Rewrite do_install using install utility instead of cp

Quoted 11 lines

-----Original Message-----
From: [email protected] <openembedded- [email protected]> On Behalf Of Richard Purdie
Sent: den 7 februari 2019 10:01
To: Khem Raj <[email protected]>; openembedded- [email protected]
Subject: Re: [OE-core] [PATCH] glibc-locale: Rewrite do_install using install utility instead of cp

Quoted 1 line · Khem Raj

This has been a constant source of trouble for build failures due

to

Quoted 6 lines

host-user-contaminated QA

Quoted 3 lines

errors of sort

ERROR: QA Issue: glibc-locale: /glibc-binary-localedata-ca-

es+valencia/usr/lib/locale/ca_ES@valencia/LC_MONETARY is owned by uid 3004, which is the same as the user running bitbake. This may be due

to

Quoted 3 lines

host contamination [host-user-contaminated]

Quoted 2 lines

So far we have tried to mould cp command into not carrying the

build

Quoted 11 lines
Quoted 1 line

user permissions into install area but it is never entirely fixed

since

Quoted 3 lines

the issue keeps popping up in various scenes

This patch replaces use of cp with install utility and specifies

install

Quoted 5 lines

mode for files explcitly

---
 meta/recipes-core/glibc/glibc-locale.inc | 44 ++++++++++++++------

--

Quoted 4 lines

--

Review

Quoted 3 lines
 1 file changed, 25 insertions(+), 19 deletions(-)
(quoted diff) +0 -0

b/meta/recipes-

Quoted 18 lines

core/glibc/glibc-locale.inc

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef" · line 72

Quoted 5 lines

index 6384f9cbf1..9b256a5108 100644

meta/recipes-core/glibc/glibc-locale.inc +0 -0
@@ -72,27 +72,33 @@ FILES_localedef = "${bindir}/localedef"
 LOCALETREESRC = "${COMPONENTS_DIR}/${PACKAGE_ARCH}/glibc-stash-

locale"

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef" · line 76

Quoted 5 lines
meta/recipes-core/glibc/glibc-locale.inc +0 -3
 do_install () {
-	mkdir -p ${D}${bindir} ${D}${datadir}
-	if [ -n "$(ls ${LOCALETREESRC}/${bindir})" ]; then
-		cp -R --no-dereference --preserve=mode,links

${LOCALETREESRC}/${bindir}/* ${D}${bindir}

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef" · line 80

Quoted 4 lines
meta/recipes-core/glibc/glibc-locale.inc +0 -4
-	fi
-	if [ -n "$(ls ${LOCALETREESRC}/${localedir})" ]; then
-		mkdir -p ${D}${localedir}
-		cp -R --no-dereference --preserve=mode,links

${LOCALETREESRC}/${localedir}/* ${D}${localedir}

Quoted 6 lines

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef" · line 78

Quoted 6 lines
meta/recipes-core/glibc/glibc-locale.inc +5 -1
-	fi
+        install -d ${D}${bindir}
+        find "${LOCALETREESRC}/${bindir}" -maxdepth 1 -type f \
+        -exec install -m 0755 -t "${D}${bindir}" {} \;
+
+        for d in . $(find "${LOCALETREESRC}/${localedir}" -type d

-

Quoted 3 lines

printf '%P ') ; do

Quoted 2 lines
meta/recipes-core/glibc/glibc-locale.inc +2 -0
+                install -d "${D}${localedir}/$d"
+                find "${LOCALETREESRC}/${localedir}/$d" -maxdepth

1

Quoted 2 lines

-type f \

Quoted 1 line
meta/recipes-core/glibc/glibc-locale.inc +1 -0
+                -exec install -m 0644 -t "${D}${localedir}/$d" {}

\;

Quoted 10 lines

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef" · line 85

Quoted 5 lines
meta/recipes-core/glibc/glibc-locale.inc +1 -3
+        done
 	if [ ${@d.getVar('PACKAGE_NO_GCONV')} -eq 0 ]; then
-		mkdir -p ${D}${libdir}
-		if [ -e ${LOCALETREESRC}/${libdir}/gconv ]; then
-			cp -R --no-dereference --

preserve=mode,links ${LOCALETREESRC}/${libdir}/gconv ${D}${libdir}

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef" · line 88

Quoted 3 lines
meta/recipes-core/glibc/glibc-locale.inc +0 -3
-		fi
-		if [ -e ${LOCALETREESRC}/${datadir}/i18n ]; then
-			cp -R --no-dereference --

preserve=mode,links ${LOCALETREESRC}/${datadir}/i18n ${D}${datadir}

Quoted 6 lines

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef" · line 92

Quoted 4 lines
meta/recipes-core/glibc/glibc-locale.inc +0 -4
-		fi
-	fi
-	if [ -e ${LOCALETREESRC}/${datadir}/locale ]; then
-		cp -R --no-dereference --preserve=mode,links

${LOCALETREESRC}/${datadir}/locale ${D}${datadir}

Quoted 1 line
meta/recipes-core/glibc/glibc-locale.inc +1 -0
+                for d in . $(find

"${LOCALETREESRC}/${libdir}/gconv"

Quoted 3 lines

-type d -printf '%P ') ; do

Quoted 2 lines
meta/recipes-core/glibc/glibc-locale.inc +2 -0
+                        install -d "${D}${libdir}/gconv/$d"
+                        find "${LOCALETREESRC}/${libdir}/gconv/$d"

-

Quoted 5 lines

maxdepth 1 -type f \

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef" · line 87

Quoted 1 line
meta/recipes-core/glibc/glibc-locale.inc +1 -0
+                        -exec install -m 0755 -t

"${D}${libdir}/gconv/$d" {} \;

Quoted 2 lines
meta/recipes-core/glibc/glibc-locale.inc +2 -0
+                done
+                for d in . $(find

"${LOCALETREESRC}/${datadir}/i18n"

Quoted 3 lines

-type d -printf '%P ') ; do

Quoted 2 lines
meta/recipes-core/glibc/glibc-locale.inc +2 -0
+                        install -d "${D}${datadir}/i18n/$d"
+                        find "${LOCALETREESRC}/${datadir}/i18n/$d"

-

Quoted 8 lines

maxdepth 1 -type f \

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef" · line 92

Quoted 1 line
meta/recipes-core/glibc/glibc-locale.inc +1 -0
+                        -exec install -m 0644 -t

"${D}${datadir}/i18n/$d" {} \;

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef" · line 94

Quoted 3 lines
meta/recipes-core/glibc/glibc-locale.inc +1 -1
+                done
 	fi
-	cp -R --no-dereference --preserve=mode,links

${LOCALETREESRC}/SUPPORTED ${WORKDIR}

Quoted 1 line
meta/recipes-core/glibc/glibc-locale.inc +1 -0
+        for d in . $(find "${LOCALETREESRC}/${datadir}/locale" -

type

Quoted 5 lines

d -printf '%P ') ; do

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef" · line 97

Quoted 2 lines
meta/recipes-core/glibc/glibc-locale.inc +2 -0
+                install -d "${D}${datadir}/locale/$d"
+                find "${LOCALETREESRC}/${datadir}/locale/$d" -

maxdepth 1 -type f \

Quoted 1 line
meta/recipes-core/glibc/glibc-locale.inc +1 -0
+                -exec install -m 0644 -t

"${D}${datadir}/locale/$d"

Quoted 11 lines

{} \;

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef" · line 100

Quoted 2 lines
meta/recipes-core/glibc/glibc-locale.inc +2 -0
+        done
+	install -m 0644 ${LOCALETREESRC}/SUPPORTED

${WORKDIR}/SUPPORTED

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef" · line 103

Quoted 3 lines
meta/recipes-core/glibc/glibc-locale.inc +0 -0
 }
 
 inherit libc-package

The trouble is this is a workaround. The cp commands should work and there is some underlying issue in pseudo causing this. We really need to figure out what that is since this will likely just mean we see

the

Quoted 3 lines

problem somewhere else :(

I still suspect some kind of inode number reuse problem which these

cp

Quoted 5 lines

commands trigger...

Cheers,

Richard

For the record, even if I think the patch was the right thing to do, it did not help the situation. The first build I did after it was integrated, I was bit by the following:

Failed to determine the user name of UID 323 for tmp/work/core2-64-poky-linux/glibc-locale/2.29-r0/package/usr/lib/locale

where UID 323 is my UID. If you do not recognize the error message, it is because it comes from a local patch we have for rpm to protect us from any incorrect UIDs/GIDs causing incorrect RPMs to be generated (see below). I checked the build directory and the /usr/lib/locale directory was the only file or directory with an incorrect owner, which is typical of these pseudo related problems with incorrect owners.

[rpm will by default silently fall back to use root for any files where it cannot determine the name of the user or group based on its UID/GID. This can be due to missing information in the /etc/passwd or /etc/groups files, typically due to relying on another recipe in DEPENDS to create the user without also having an RDEPENDS on the package that creates the user, or because of pseudo messing up. After this bit us once where a device in /dev ended up in an rpm in the sstate cache with root as group instead of the intended video group, which in turn caused the video application to fail as it was no longer allowed to open its device, I created the patch. It is causing a fair bit of grief as it causes builds to fail randomly, but at least we don't end up with an incorrect sstate anymore, which is worse. I am not sure this patch is suitable for integration to OE-Core, but I have attached it if anyone is interested.]

Quoted 1 line

//Peter

Ok, this just got a lot more weird. At the time I wrote the mail above, I had only tried to rebuild once. Now I have done it a number of more times, and the result is not random any more. Every build fails the same way. I've done bitbake glibc-locale -c cleansstate followed by bitbake glibc-locale and the result is consistent. What I have noted now, is that it is _not_ do_install that causes the problem. The /usr/lib/locale directory created in ${D} has the correct owner. It is when the data is copied to ${PKGD} that it somehow ends up with the wrong owner. I cannot tell from a quick glance what differs /usr/lib/locale from, e.g., /usr/lib/gconv, where the latter does get the correct owner.

Unfortunately, I do not have more time to look at this right now, but I thought I should share this information with you. If anyone has any ideas of what to look at to determine why ${PKGD}/usr/lib/locale ends up with the wrong owner, I'm all ears. It would also be interesting to hear if the result is the same for anyone else with the patch I provided in my previous mail applied.

//Peter

#11 lore raw
Quoted 217 lines

-----Original Message-----
From: [email protected] <openembedded- [email protected]> On Behalf Of Peter Kjellerstedt
Sent: den 10 februari 2019 07:25
To: Richard Purdie <[email protected]>; Khem Raj <[email protected]>; [email protected]
Subject: Re: [OE-core] [PATCH] glibc-locale: Rewrite do_install using install utility instead of cp

Quoted 11 lines

-----Original Message-----
From: [email protected] <openembedded- [email protected]> On Behalf Of Peter Kjellerstedt
Sent: den 10 februari 2019 02:29
To: Richard Purdie <[email protected]>; Khem Raj <[email protected]>; [email protected]
Subject: Re: [OE-core] [PATCH] glibc-locale: Rewrite do_install using install utility instead of cp

Quoted 2 lines

-----Original Message-----
From: [email protected]

<openembedded-

Quoted 5 lines
Quoted 5 lines

[email protected]> On Behalf Of Richard Purdie
Sent: den 7 februari 2019 10:01
To: Khem Raj <[email protected]>; openembedded- [email protected]
Subject: Re: [OE-core] [PATCH] glibc-locale: Rewrite do_install

using

Quoted 10 lines
Quoted 4 lines

install utility instead of cp

Quoted 1 line · Khem Raj

This has been a constant source of trouble for build failures due

to

Quoted 5 lines

host-user-contaminated QA

Quoted 3 lines

errors of sort

ERROR: QA Issue: glibc-locale: /glibc-binary-localedata-ca-

es+valencia/usr/lib/locale/ca_ES@valencia/LC_MONETARY is owned by

uid

Quoted 1 line
Quoted 1 line

3004, which is the same as the user running bitbake. This may be

due

Quoted 16 lines

to

Quoted 3 lines

host contamination [host-user-contaminated]

Quoted 2 lines

So far we have tried to mould cp command into not carrying the

build

Quoted 11 lines
Quoted 1 line

user permissions into install area but it is never entirely fixed

since

Quoted 3 lines

the issue keeps popping up in various scenes

This patch replaces use of cp with install utility and specifies

install

Quoted 5 lines

mode for files explcitly

---
 meta/recipes-core/glibc/glibc-locale.inc | 44 ++++++++++++++----

--

Quoted 24 lines

--

Quoted 4 lines

--

Review

Quoted 3 lines
 1 file changed, 25 insertions(+), 19 deletions(-)
(quoted diff) +0 -0

b/meta/recipes-

Quoted 18 lines

core/glibc/glibc-locale.inc

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef" · line 72

Quoted 5 lines

index 6384f9cbf1..9b256a5108 100644

meta/recipes-core/glibc/glibc-locale.inc +0 -0
@@ -72,27 +72,33 @@ FILES_localedef = "${bindir}/localedef"
 LOCALETREESRC = "${COMPONENTS_DIR}/${PACKAGE_ARCH}/glibc-stash-

locale"

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef" · line 76

Quoted 5 lines
meta/recipes-core/glibc/glibc-locale.inc +0 -3
 do_install () {
-	mkdir -p ${D}${bindir} ${D}${datadir}
-	if [ -n "$(ls ${LOCALETREESRC}/${bindir})" ]; then
-		cp -R --no-dereference --preserve=mode,links

${LOCALETREESRC}/${bindir}/* ${D}${bindir}

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef" · line 80

Quoted 4 lines
meta/recipes-core/glibc/glibc-locale.inc +0 -4
-	fi
-	if [ -n "$(ls ${LOCALETREESRC}/${localedir})" ]; then
-		mkdir -p ${D}${localedir}
-		cp -R --no-dereference --preserve=mode,links

${LOCALETREESRC}/${localedir}/* ${D}${localedir}

Quoted 6 lines
Quoted 6 lines

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef" · line 78

Quoted 6 lines
meta/recipes-core/glibc/glibc-locale.inc +5 -1
-	fi
+        install -d ${D}${bindir}
+        find "${LOCALETREESRC}/${bindir}" -maxdepth 1 -type f \
+        -exec install -m 0755 -t "${D}${bindir}" {} \;
+
+        for d in . $(find "${LOCALETREESRC}/${localedir}" -type

d

Quoted 4 lines

-

Quoted 3 lines

printf '%P ') ; do

Quoted 2 lines
meta/recipes-core/glibc/glibc-locale.inc +2 -0
+                install -d "${D}${localedir}/$d"
+                find "${LOCALETREESRC}/${localedir}/$d" -

maxdepth

Quoted 3 lines

1

Quoted 2 lines

-type f \

Quoted 1 line
meta/recipes-core/glibc/glibc-locale.inc +1 -0
+                -exec install -m 0644 -t "${D}${localedir}/$d"

{}

Quoted 11 lines

\;

Quoted 10 lines

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef" · line 85

Quoted 5 lines
meta/recipes-core/glibc/glibc-locale.inc +1 -3
+        done
 	if [ ${@d.getVar('PACKAGE_NO_GCONV')} -eq 0 ]; then
-		mkdir -p ${D}${libdir}
-		if [ -e ${LOCALETREESRC}/${libdir}/gconv ]; then
-			cp -R --no-dereference --

preserve=mode,links ${LOCALETREESRC}/${libdir}/gconv ${D}${libdir}

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef" · line 88

Quoted 3 lines
meta/recipes-core/glibc/glibc-locale.inc +0 -3
-		fi
-		if [ -e ${LOCALETREESRC}/${datadir}/i18n ]; then
-			cp -R --no-dereference --

preserve=mode,links ${LOCALETREESRC}/${datadir}/i18n ${D}${datadir}

Quoted 10 lines
Quoted 6 lines

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef" · line 92

Quoted 4 lines
meta/recipes-core/glibc/glibc-locale.inc +0 -4
-		fi
-	fi
-	if [ -e ${LOCALETREESRC}/${datadir}/locale ]; then
-		cp -R --no-dereference --preserve=mode,links

${LOCALETREESRC}/${datadir}/locale ${D}${datadir}

Quoted 1 line
meta/recipes-core/glibc/glibc-locale.inc +1 -0
+                for d in . $(find

"${LOCALETREESRC}/${libdir}/gconv"

Quoted 3 lines

-type d -printf '%P ') ; do

Quoted 2 lines
meta/recipes-core/glibc/glibc-locale.inc +2 -0
+                        install -d "${D}${libdir}/gconv/$d"
+                        find

"${LOCALETREESRC}/${libdir}/gconv/$d"

Quoted 10 lines

-

Quoted 5 lines

maxdepth 1 -type f \

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef" · line 87

Quoted 1 line
meta/recipes-core/glibc/glibc-locale.inc +1 -0
+                        -exec install -m 0755 -t

"${D}${libdir}/gconv/$d" {} \;

Quoted 2 lines
meta/recipes-core/glibc/glibc-locale.inc +2 -0
+                done
+                for d in . $(find

"${LOCALETREESRC}/${datadir}/i18n"

Quoted 3 lines

-type d -printf '%P ') ; do

Quoted 2 lines
meta/recipes-core/glibc/glibc-locale.inc +2 -0
+                        install -d "${D}${datadir}/i18n/$d"
+                        find

"${LOCALETREESRC}/${datadir}/i18n/$d"

Quoted 8 lines

-

Quoted 7 lines

maxdepth 1 -type f \

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef" · line 92

Quoted 1 line
meta/recipes-core/glibc/glibc-locale.inc +1 -0
+                        -exec install -m 0644 -t

"${D}${datadir}/i18n/$d" {} \;

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef" · line 94

Quoted 3 lines
meta/recipes-core/glibc/glibc-locale.inc +1 -1
+                done
 	fi
-	cp -R --no-dereference --preserve=mode,links

${LOCALETREESRC}/SUPPORTED ${WORKDIR}

Quoted 17 lines
Quoted 1 line

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef" · line 95

Quoted 1 line
meta/recipes-core/glibc/glibc-locale.inc +1 -0
+        for d in . $(find "${LOCALETREESRC}/${datadir}/locale" -

type

Quoted 5 lines

d -printf '%P ') ; do

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef" · line 97

Quoted 2 lines
meta/recipes-core/glibc/glibc-locale.inc +2 -0
+                install -d "${D}${datadir}/locale/$d"
+                find "${LOCALETREESRC}/${datadir}/locale/$d" -

maxdepth 1 -type f \

Quoted 1 line
meta/recipes-core/glibc/glibc-locale.inc +1 -0
+                -exec install -m 0644 -t

"${D}${datadir}/locale/$d"

Quoted 9 lines

{} \;

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef" · line 100

Quoted 2 lines
meta/recipes-core/glibc/glibc-locale.inc +2 -0
+        done
+	install -m 0644 ${LOCALETREESRC}/SUPPORTED

${WORKDIR}/SUPPORTED

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef" · line 103

Quoted 3 lines
meta/recipes-core/glibc/glibc-locale.inc +0 -0
 }
 
 inherit libc-package

The trouble is this is a workaround. The cp commands should work

and

Quoted 1 line
Quoted 1 line

there is some underlying issue in pseudo causing this. We really

need

Quoted 10 lines
Quoted 1 line

to figure out what that is since this will likely just mean we see

the

Quoted 3 lines

problem somewhere else :(

I still suspect some kind of inode number reuse problem which these

cp

Quoted 4 lines

commands trigger...

Cheers,

Quoted 8 lines
Quoted 1 line

Richard

For the record, even if I think the patch was the right thing to do, it did not help the situation. The first build I did after it was integrated, I was bit by the following:

Failed to determine the user name of UID 323 for tmp/work/core2-64-poky-linux/glibc-locale/2.29-

r0/package/usr/lib/locale

Quoted 4 lines

where UID 323 is my UID. If you do not recognize the error message, it is because it comes from a local patch we have for rpm to protect us from any incorrect UIDs/GIDs causing incorrect RPMs to be

generated

Quoted 21 lines

(see below). I checked the build directory and the /usr/lib/locale directory was the only file or directory with an incorrect owner, which is typical of these pseudo related problems with incorrect owners.

[rpm will by default silently fall back to use root for any files where it cannot determine the name of the user or group based on its UID/GID. This can be due to missing information in the /etc/passwd or /etc/groups files, typically due to relying on another recipe in DEPENDS to create the user without also having an RDEPENDS on the package that creates the user, or because of pseudo messing up. After this bit us once where a device in /dev ended up in an rpm in the sstate cache with root as group instead of the intended video group, which in turn caused the video application to fail as it was no longer allowed to open its device, I created the patch. It is causing a fair bit of grief as it causes builds to fail randomly, but at least we don't end up with an incorrect sstate anymore, which is worse. I am not sure this patch is suitable for integration to OE-Core, but I have attached it if anyone is interested.]

Quoted 1 line

//Peter

Ok, this just got a lot more weird. At the time I wrote the mail above, I had only tried to rebuild once. Now I have done it a number of more times, and the result is not random any more. Every build fails the same way. I've done bitbake glibc-locale -c cleansstate followed by bitbake glibc-locale and the result is consistent. What I have noted now, is that it is _not_ do_install that causes the problem. The /usr/lib/locale directory created in ${D} has the correct owner. It is when the data is copied to ${PKGD} that it somehow ends up with the wrong owner. I cannot tell from a quick glance what differs /usr/lib/locale from, e.g., /usr/lib/gconv, where the latter does get the correct owner.

Quoted 8 lines

Unfortunately, I do not have more time to look at this right now, but I thought I should share this information with you. If anyone has any ideas of what to look at to determine why ${PKGD}/usr/lib/locale ends up with the wrong owner, I'm all ears. It would also be interesting to hear if the result is the same for anyone else with the patch I provided in my previous mail applied.

//Peter

Further investigation indicates that the problem I'm seeing is not related to pseudo, but an actual problem in the code. I have not dug too far into it, but I'm seeing the problem in the directories used in do_prep_locale_tree() and do_collect_bins_from_locale_tree() in libc-package.bbclass where some of them seems to have been created without being run under pseudo. The following patch works around the problem, though it would probably be better to correct the problem at the source by running whatever part of the code under pseudo that is currently missing it:

meta/classes/libc-package.bbclass +1 -0
index 0b4c666a74..174465a891 100644
@@ -72,6 +72,7 @@ do_prep_locale_tree() {
                tar -cf - -C ${STAGING_DIR_NATIVE}/${prefix_native}/${base_libdir} -p libgcc_s.* | tar -xf - -C $treedir/${base_libdir}
        fi
        install -m 0755 ${LOCALETREESRC}${bindir}/localedef $treedir/${base_bindir}
+       chown -R root:root $treedir
 }
 
 do_collect_bins_from_locale_tree() {

//Peter

author
#12 lore raw
Quoted 243 lines · Peter Kjellerstedt
Quoted 218 lines

-----Original Message-----
From: [email protected] <openembedded- [email protected]> On Behalf Of Peter Kjellerstedt
Sent: den 10 februari 2019 07:25
To: Richard Purdie <[email protected]>; Khem Raj <[email protected]>; [email protected]
Subject: Re: [OE-core] [PATCH] glibc-locale: Rewrite do_install using install utility instead of cp

Quoted 11 lines

-----Original Message-----
From: [email protected] <openembedded- [email protected]> On Behalf Of Peter Kjellerstedt
Sent: den 10 februari 2019 02:29
To: Richard Purdie <[email protected]>; Khem Raj <[email protected]>; [email protected]
Subject: Re: [OE-core] [PATCH] glibc-locale: Rewrite do_install using install utility instead of cp

Quoted 2 lines

-----Original Message-----
From: [email protected]

<openembedded-

Quoted 5 lines
Quoted 5 lines

[email protected]> On Behalf Of Richard Purdie
Sent: den 7 februari 2019 10:01
To: Khem Raj <[email protected]>; openembedded- [email protected]
Subject: Re: [OE-core] [PATCH] glibc-locale: Rewrite do_install

using

Quoted 10 lines
Quoted 4 lines

install utility instead of cp

Quoted 1 line · Khem Raj

This has been a constant source of trouble for build failures due

to

Quoted 5 lines

host-user-contaminated QA

Quoted 3 lines

errors of sort

ERROR: QA Issue: glibc-locale: /glibc-binary-localedata-ca-

es+valencia/usr/lib/locale/ca_ES@valencia/LC_MONETARY is owned by

uid

Quoted 1 line
Quoted 1 line

3004, which is the same as the user running bitbake. This may be

due

Quoted 16 lines

to

Quoted 3 lines

host contamination [host-user-contaminated]

Quoted 2 lines

So far we have tried to mould cp command into not carrying the

build

Quoted 11 lines
Quoted 1 line

user permissions into install area but it is never entirely fixed

since

Quoted 3 lines

the issue keeps popping up in various scenes

This patch replaces use of cp with install utility and specifies

install

Quoted 5 lines

mode for files explcitly

---
 meta/recipes-core/glibc/glibc-locale.inc | 44 ++++++++++++++----

--

Quoted 30 lines

--

Quoted 4 lines

--

Review

Quoted 3 lines
 1 file changed, 25 insertions(+), 19 deletions(-)
(quoted diff) +0 -0

b/meta/recipes-

Quoted 24 lines

core/glibc/glibc-locale.inc

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef" · line 72

Quoted 5 lines

index 6384f9cbf1..9b256a5108 100644

meta/recipes-core/glibc/glibc-locale.inc +0 -0
@@ -72,27 +72,33 @@ FILES_localedef = "${bindir}/localedef"
 LOCALETREESRC = "${COMPONENTS_DIR}/${PACKAGE_ARCH}/glibc-stash-

locale"

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef" · line 76

Quoted 5 lines
meta/recipes-core/glibc/glibc-locale.inc +0 -3
 do_install () {
-       mkdir -p ${D}${bindir} ${D}${datadir}
-       if [ -n "$(ls ${LOCALETREESRC}/${bindir})" ]; then
-               cp -R --no-dereference --preserve=mode,links

${LOCALETREESRC}/${bindir}/* ${D}${bindir}

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef" · line 80

Quoted 4 lines
meta/recipes-core/glibc/glibc-locale.inc +0 -4
-       fi
-       if [ -n "$(ls ${LOCALETREESRC}/${localedir})" ]; then
-               mkdir -p ${D}${localedir}
-               cp -R --no-dereference --preserve=mode,links

${LOCALETREESRC}/${localedir}/* ${D}${localedir}

Quoted 6 lines
meta/recipes-core/glibc/glibc-locale.inc +5 -1
-       fi
+        install -d ${D}${bindir}
+        find "${LOCALETREESRC}/${bindir}" -maxdepth 1 -type f \
+        -exec install -m 0755 -t "${D}${bindir}" {} \;
+
+        for d in . $(find "${LOCALETREESRC}/${localedir}" -type

d

Quoted 4 lines

-

Quoted 3 lines

printf '%P ') ; do

Quoted 2 lines
meta/recipes-core/glibc/glibc-locale.inc +2 -0
+                install -d "${D}${localedir}/$d"
+                find "${LOCALETREESRC}/${localedir}/$d" -

maxdepth

Quoted 3 lines

1

Quoted 2 lines

-type f \

Quoted 1 line
meta/recipes-core/glibc/glibc-locale.inc +1 -0
+                -exec install -m 0644 -t "${D}${localedir}/$d"

{}

Quoted 10 lines

\;

Quoted 9 lines

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef" · line 85

Quoted 5 lines
meta/recipes-core/glibc/glibc-locale.inc +1 -3
+        done
        if [ ${@d.getVar('PACKAGE_NO_GCONV')} -eq 0 ]; then
-               mkdir -p ${D}${libdir}
-               if [ -e ${LOCALETREESRC}/${libdir}/gconv ]; then
-                       cp -R --no-dereference --

preserve=mode,links ${LOCALETREESRC}/${libdir}/gconv ${D}${libdir}

Quoted 3 lines
meta/recipes-core/glibc/glibc-locale.inc +0 -3
-               fi
-               if [ -e ${LOCALETREESRC}/${datadir}/i18n ]; then
-                       cp -R --no-dereference --
Quoted 11 lines
Quoted 7 lines

preserve=mode,links ${LOCALETREESRC}/${datadir}/i18n ${D}${datadir}

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef" · line 92

Quoted 4 lines
meta/recipes-core/glibc/glibc-locale.inc +0 -4
-               fi
-       fi
-       if [ -e ${LOCALETREESRC}/${datadir}/locale ]; then
-               cp -R --no-dereference --preserve=mode,links

${LOCALETREESRC}/${datadir}/locale ${D}${datadir}

Quoted 1 line
meta/recipes-core/glibc/glibc-locale.inc +1 -0
+                for d in . $(find

"${LOCALETREESRC}/${libdir}/gconv"

Quoted 3 lines

-type d -printf '%P ') ; do

Quoted 2 lines
meta/recipes-core/glibc/glibc-locale.inc +2 -0
+                        install -d "${D}${libdir}/gconv/$d"
+                        find

"${LOCALETREESRC}/${libdir}/gconv/$d"

Quoted 10 lines

-

Quoted 5 lines

maxdepth 1 -type f \

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef" · line 87

Quoted 1 line
meta/recipes-core/glibc/glibc-locale.inc +1 -0
+                        -exec install -m 0755 -t

"${D}${libdir}/gconv/$d" {} \;

Quoted 2 lines
meta/recipes-core/glibc/glibc-locale.inc +2 -0
+                done
+                for d in . $(find

"${LOCALETREESRC}/${datadir}/i18n"

Quoted 3 lines

-type d -printf '%P ') ; do

Quoted 2 lines
meta/recipes-core/glibc/glibc-locale.inc +2 -0
+                        install -d "${D}${datadir}/i18n/$d"
+                        find

"${LOCALETREESRC}/${datadir}/i18n/$d"

Quoted 8 lines

-

Quoted 7 lines

maxdepth 1 -type f \

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef" · line 92

Quoted 1 line
meta/recipes-core/glibc/glibc-locale.inc +1 -0
+                        -exec install -m 0644 -t

"${D}${datadir}/i18n/$d" {} \;

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef" · line 94

Quoted 3 lines
meta/recipes-core/glibc/glibc-locale.inc +1 -1
+                done
        fi
-       cp -R --no-dereference --preserve=mode,links

${LOCALETREESRC}/SUPPORTED ${WORKDIR}

Quoted 17 lines
Quoted 1 line

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef" · line 95

Quoted 1 line
meta/recipes-core/glibc/glibc-locale.inc +1 -0
+        for d in . $(find "${LOCALETREESRC}/${datadir}/locale" -

type

Quoted 5 lines

d -printf '%P ') ; do

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef" · line 97

Quoted 2 lines
meta/recipes-core/glibc/glibc-locale.inc +2 -0
+                install -d "${D}${datadir}/locale/$d"
+                find "${LOCALETREESRC}/${datadir}/locale/$d" -

maxdepth 1 -type f \

Quoted 1 line
meta/recipes-core/glibc/glibc-locale.inc +1 -0
+                -exec install -m 0644 -t

"${D}${datadir}/locale/$d"

Quoted 9 lines

{} \;

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef" · line 100

Quoted 2 lines
meta/recipes-core/glibc/glibc-locale.inc +2 -0
+        done
+       install -m 0644 ${LOCALETREESRC}/SUPPORTED

${WORKDIR}/SUPPORTED

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef" · line 103

Quoted 3 lines
meta/recipes-core/glibc/glibc-locale.inc +0 -0
 }
 
 inherit libc-package

The trouble is this is a workaround. The cp commands should work

and

Quoted 1 line
Quoted 1 line

there is some underlying issue in pseudo causing this. We really

need

Quoted 10 lines
Quoted 1 line

to figure out what that is since this will likely just mean we see

the

Quoted 3 lines

problem somewhere else :(

I still suspect some kind of inode number reuse problem which these

cp

Quoted 4 lines

commands trigger...

Cheers,

Quoted 8 lines
Quoted 1 line

Richard

For the record, even if I think the patch was the right thing to do, it did not help the situation. The first build I did after it was integrated, I was bit by the following:

Failed to determine the user name of UID 323 for tmp/work/core2-64-poky-linux/glibc-locale/2.29-

r0/package/usr/lib/locale

Quoted 4 lines

where UID 323 is my UID. If you do not recognize the error message, it is because it comes from a local patch we have for rpm to protect us from any incorrect UIDs/GIDs causing incorrect RPMs to be

generated

Quoted 21 lines

(see below). I checked the build directory and the /usr/lib/locale directory was the only file or directory with an incorrect owner, which is typical of these pseudo related problems with incorrect owners.

[rpm will by default silently fall back to use root for any files where it cannot determine the name of the user or group based on its UID/GID. This can be due to missing information in the /etc/passwd or /etc/groups files, typically due to relying on another recipe in DEPENDS to create the user without also having an RDEPENDS on the package that creates the user, or because of pseudo messing up. After this bit us once where a device in /dev ended up in an rpm in the sstate cache with root as group instead of the intended video group, which in turn caused the video application to fail as it was no longer allowed to open its device, I created the patch. It is causing a fair bit of grief as it causes builds to fail randomly, but at least we don't end up with an incorrect sstate anymore, which is worse. I am not sure this patch is suitable for integration to OE-Core, but I have attached it if anyone is interested.]

Quoted 1 line

//Peter

Ok, this just got a lot more weird. At the time I wrote the mail above, I had only tried to rebuild once. Now I have done it a number of more times, and the result is not random any more. Every build fails the same way. I've done bitbake glibc-locale -c cleansstate followed by bitbake glibc-locale and the result is consistent. What I have noted now, is that it is _not_ do_install that causes the problem. The /usr/lib/locale directory created in ${D} has the correct owner. It is when the data is copied to ${PKGD} that it somehow ends up with the wrong owner. I cannot tell from a quick glance what differs /usr/lib/locale from, e.g., /usr/lib/gconv, where the latter does get the correct owner.

Quoted 8 lines

Unfortunately, I do not have more time to look at this right now, but I thought I should share this information with you. If anyone has any ideas of what to look at to determine why ${PKGD}/usr/lib/locale ends up with the wrong owner, I'm all ears. It would also be interesting to hear if the result is the same for anyone else with the patch I provided in my previous mail applied.

//Peter

Further investigation indicates that the problem I'm seeing is not related to pseudo, but an actual problem in the code. I have not dug too far into it, but I'm seeing the problem in the directories used in do_prep_locale_tree() and do_collect_bins_from_locale_tree() in libc-package.bbclass where some of them seems to have been created without being run under pseudo. The following patch works around the problem, though it would probably be better to correct the problem at the source by running whatever part of the code under pseudo that is currently missing it:

meta/classes/libc-package.bbclass +0 -0
index 0b4c666a74..174465a891 100644

meta/classes/libc-package.bbclass do_prep_locale_tree() { · line 78

Quoted 7 lines
meta/classes/libc-package.bbclass +1 -0
@@ -72,6 +72,7 @@ do_prep_locale_tree() {
                tar -cf - -C ${STAGING_DIR_NATIVE}/${prefix_native}/${base_libdir} -p libgcc_s.* | tar -xf - -C $treedir/${base_libdir}
        fi
        install -m 0755 ${LOCALETREESRC}${bindir}/localedef $treedir/${base_bindir}
+       chown -R root:root $treedir
 }
 
 do_collect_bins_from_locale_tree() {

Can you try something on the lines

(quoted diff) +0 -0

b/meta/classes/libc-package.bbclass
index 0b4c666a74..34025635ce 100644

meta/classes/libc-package.bbclass +0 -1
@@ -61,7 +61,7 @@ LOCALETREESRC ?= "${PKGD}"
 do_prep_locale_tree() {
        treedir=${WORKDIR}/locale-tree
        rm -rf $treedir
-       mkdir -p $treedir/${base_bindir} $treedir/${base_libdir}

$treedir/${datadir} $treedir/${localedir}
+ install -d $treedir/${base_bindir} $treedir/${base_libdir}
$treedir/${datadir} $treedir/${localedir}

        tar -cf - -C ${LOCALETREESRC}${datadir} -p i18n | tar -xf - -C
$treedir/${datadir}
        # unzip to avoid parsing errors
        for i in $treedir/${datadir}/i18n/charmaps/*gz; do
Quoted 1 line

//Peter

author
#13 lore raw

Peter did you have a chance to try
https://patchwork.openembedded.org/patch/158661/

Quoted 278 lines · Khem Raj
Quoted 243 lines · Peter Kjellerstedt
Quoted 218 lines

-----Original Message-----
From: [email protected] <openembedded- [email protected]> On Behalf Of Peter Kjellerstedt
Sent: den 10 februari 2019 07:25
To: Richard Purdie <[email protected]>; Khem Raj <[email protected]>; [email protected]
Subject: Re: [OE-core] [PATCH] glibc-locale: Rewrite do_install using install utility instead of cp

Quoted 11 lines

-----Original Message-----
From: [email protected] <openembedded- [email protected]> On Behalf Of Peter Kjellerstedt
Sent: den 10 februari 2019 02:29
To: Richard Purdie <[email protected]>; Khem Raj <[email protected]>; [email protected]
Subject: Re: [OE-core] [PATCH] glibc-locale: Rewrite do_install using install utility instead of cp

Quoted 2 lines

-----Original Message-----
From: [email protected]

<openembedded-

Quoted 5 lines
Quoted 5 lines

[email protected]> On Behalf Of Richard Purdie
Sent: den 7 februari 2019 10:01
To: Khem Raj <[email protected]>; openembedded- [email protected]
Subject: Re: [OE-core] [PATCH] glibc-locale: Rewrite do_install

using

Quoted 10 lines
Quoted 4 lines

install utility instead of cp

Quoted 1 line · Khem Raj

This has been a constant source of trouble for build failures due

to

Quoted 5 lines

host-user-contaminated QA

Quoted 3 lines

errors of sort

ERROR: QA Issue: glibc-locale: /glibc-binary-localedata-ca-

es+valencia/usr/lib/locale/ca_ES@valencia/LC_MONETARY is owned by

uid

Quoted 1 line
Quoted 1 line

3004, which is the same as the user running bitbake. This may be

due

Quoted 16 lines

to

Quoted 3 lines

host contamination [host-user-contaminated]

Quoted 2 lines

So far we have tried to mould cp command into not carrying the

build

Quoted 11 lines
Quoted 1 line

user permissions into install area but it is never entirely fixed

since

Quoted 3 lines

the issue keeps popping up in various scenes

This patch replaces use of cp with install utility and specifies

install

Quoted 5 lines

mode for files explcitly

---
 meta/recipes-core/glibc/glibc-locale.inc | 44 ++++++++++++++----

--

Quoted 30 lines

--

Quoted 4 lines

--

Review

Quoted 3 lines
 1 file changed, 25 insertions(+), 19 deletions(-)
(quoted diff) +0 -0

b/meta/recipes-

Quoted 24 lines

core/glibc/glibc-locale.inc

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef" · line 72

Quoted 5 lines

index 6384f9cbf1..9b256a5108 100644

meta/recipes-core/glibc/glibc-locale.inc +0 -0
@@ -72,27 +72,33 @@ FILES_localedef = "${bindir}/localedef"
 LOCALETREESRC = "${COMPONENTS_DIR}/${PACKAGE_ARCH}/glibc-stash-

locale"

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef" · line 76

Quoted 5 lines
meta/recipes-core/glibc/glibc-locale.inc +0 -3
 do_install () {
-       mkdir -p ${D}${bindir} ${D}${datadir}
-       if [ -n "$(ls ${LOCALETREESRC}/${bindir})" ]; then
-               cp -R --no-dereference --preserve=mode,links

${LOCALETREESRC}/${bindir}/* ${D}${bindir}

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef" · line 80

Quoted 4 lines
meta/recipes-core/glibc/glibc-locale.inc +0 -4
-       fi
-       if [ -n "$(ls ${LOCALETREESRC}/${localedir})" ]; then
-               mkdir -p ${D}${localedir}
-               cp -R --no-dereference --preserve=mode,links

${LOCALETREESRC}/${localedir}/* ${D}${localedir}

Quoted 6 lines
meta/recipes-core/glibc/glibc-locale.inc +5 -1
-       fi
+        install -d ${D}${bindir}
+        find "${LOCALETREESRC}/${bindir}" -maxdepth 1 -type f \
+        -exec install -m 0755 -t "${D}${bindir}" {} \;
+
+        for d in . $(find "${LOCALETREESRC}/${localedir}" -type

d

Quoted 4 lines

-

Quoted 3 lines

printf '%P ') ; do

Quoted 2 lines
meta/recipes-core/glibc/glibc-locale.inc +2 -0
+                install -d "${D}${localedir}/$d"
+                find "${LOCALETREESRC}/${localedir}/$d" -

maxdepth

Quoted 3 lines

1

Quoted 2 lines

-type f \

Quoted 1 line
meta/recipes-core/glibc/glibc-locale.inc +1 -0
+                -exec install -m 0644 -t "${D}${localedir}/$d"

{}

Quoted 10 lines

\;

Quoted 9 lines

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef" · line 85

Quoted 5 lines
meta/recipes-core/glibc/glibc-locale.inc +1 -3
+        done
        if [ ${@d.getVar('PACKAGE_NO_GCONV')} -eq 0 ]; then
-               mkdir -p ${D}${libdir}
-               if [ -e ${LOCALETREESRC}/${libdir}/gconv ]; then
-                       cp -R --no-dereference --

preserve=mode,links ${LOCALETREESRC}/${libdir}/gconv ${D}${libdir}

Quoted 3 lines
meta/recipes-core/glibc/glibc-locale.inc +0 -3
-               fi
-               if [ -e ${LOCALETREESRC}/${datadir}/i18n ]; then
-                       cp -R --no-dereference --
Quoted 11 lines
Quoted 7 lines

preserve=mode,links ${LOCALETREESRC}/${datadir}/i18n ${D}${datadir}

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef" · line 92

Quoted 4 lines
meta/recipes-core/glibc/glibc-locale.inc +0 -4
-               fi
-       fi
-       if [ -e ${LOCALETREESRC}/${datadir}/locale ]; then
-               cp -R --no-dereference --preserve=mode,links

${LOCALETREESRC}/${datadir}/locale ${D}${datadir}

Quoted 1 line
meta/recipes-core/glibc/glibc-locale.inc +1 -0
+                for d in . $(find

"${LOCALETREESRC}/${libdir}/gconv"

Quoted 3 lines

-type d -printf '%P ') ; do

Quoted 2 lines
meta/recipes-core/glibc/glibc-locale.inc +2 -0
+                        install -d "${D}${libdir}/gconv/$d"
+                        find

"${LOCALETREESRC}/${libdir}/gconv/$d"

Quoted 10 lines

-

Quoted 5 lines

maxdepth 1 -type f \

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef" · line 87

Quoted 1 line
meta/recipes-core/glibc/glibc-locale.inc +1 -0
+                        -exec install -m 0755 -t

"${D}${libdir}/gconv/$d" {} \;

Quoted 2 lines
meta/recipes-core/glibc/glibc-locale.inc +2 -0
+                done
+                for d in . $(find

"${LOCALETREESRC}/${datadir}/i18n"

Quoted 3 lines

-type d -printf '%P ') ; do

Quoted 2 lines
meta/recipes-core/glibc/glibc-locale.inc +2 -0
+                        install -d "${D}${datadir}/i18n/$d"
+                        find

"${LOCALETREESRC}/${datadir}/i18n/$d"

Quoted 8 lines

-

Quoted 7 lines

maxdepth 1 -type f \

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef" · line 92

Quoted 1 line
meta/recipes-core/glibc/glibc-locale.inc +1 -0
+                        -exec install -m 0644 -t

"${D}${datadir}/i18n/$d" {} \;

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef" · line 94

Quoted 3 lines
meta/recipes-core/glibc/glibc-locale.inc +1 -1
+                done
        fi
-       cp -R --no-dereference --preserve=mode,links

${LOCALETREESRC}/SUPPORTED ${WORKDIR}

Quoted 17 lines
Quoted 1 line

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef" · line 95

Quoted 1 line
meta/recipes-core/glibc/glibc-locale.inc +1 -0
+        for d in . $(find "${LOCALETREESRC}/${datadir}/locale" -

type

Quoted 5 lines

d -printf '%P ') ; do

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef" · line 97

Quoted 2 lines
meta/recipes-core/glibc/glibc-locale.inc +2 -0
+                install -d "${D}${datadir}/locale/$d"
+                find "${LOCALETREESRC}/${datadir}/locale/$d" -

maxdepth 1 -type f \

Quoted 1 line
meta/recipes-core/glibc/glibc-locale.inc +1 -0
+                -exec install -m 0644 -t

"${D}${datadir}/locale/$d"

Quoted 9 lines

{} \;

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef" · line 100

Quoted 2 lines
meta/recipes-core/glibc/glibc-locale.inc +2 -0
+        done
+       install -m 0644 ${LOCALETREESRC}/SUPPORTED

${WORKDIR}/SUPPORTED

meta/recipes-core/glibc/glibc-locale.inc FILES_localedef = "${bindir}/localedef" · line 103

Quoted 3 lines
meta/recipes-core/glibc/glibc-locale.inc +0 -0
 }
 
 inherit libc-package

The trouble is this is a workaround. The cp commands should work

and

Quoted 1 line
Quoted 1 line

there is some underlying issue in pseudo causing this. We really

need

Quoted 10 lines
Quoted 1 line

to figure out what that is since this will likely just mean we see

the

Quoted 3 lines

problem somewhere else :(

I still suspect some kind of inode number reuse problem which these

cp

Quoted 4 lines

commands trigger...

Cheers,

Quoted 8 lines
Quoted 1 line

Richard

For the record, even if I think the patch was the right thing to do, it did not help the situation. The first build I did after it was integrated, I was bit by the following:

Failed to determine the user name of UID 323 for tmp/work/core2-64-poky-linux/glibc-locale/2.29-

r0/package/usr/lib/locale

Quoted 4 lines

where UID 323 is my UID. If you do not recognize the error message, it is because it comes from a local patch we have for rpm to protect us from any incorrect UIDs/GIDs causing incorrect RPMs to be

generated

Quoted 21 lines

(see below). I checked the build directory and the /usr/lib/locale directory was the only file or directory with an incorrect owner, which is typical of these pseudo related problems with incorrect owners.

[rpm will by default silently fall back to use root for any files where it cannot determine the name of the user or group based on its UID/GID. This can be due to missing information in the /etc/passwd or /etc/groups files, typically due to relying on another recipe in DEPENDS to create the user without also having an RDEPENDS on the package that creates the user, or because of pseudo messing up. After this bit us once where a device in /dev ended up in an rpm in the sstate cache with root as group instead of the intended video group, which in turn caused the video application to fail as it was no longer allowed to open its device, I created the patch. It is causing a fair bit of grief as it causes builds to fail randomly, but at least we don't end up with an incorrect sstate anymore, which is worse. I am not sure this patch is suitable for integration to OE-Core, but I have attached it if anyone is interested.]

Quoted 1 line

//Peter

Ok, this just got a lot more weird. At the time I wrote the mail above, I had only tried to rebuild once. Now I have done it a number of more times, and the result is not random any more. Every build fails the same way. I've done bitbake glibc-locale -c cleansstate followed by bitbake glibc-locale and the result is consistent. What I have noted now, is that it is _not_ do_install that causes the problem. The /usr/lib/locale directory created in ${D} has the correct owner. It is when the data is copied to ${PKGD} that it somehow ends up with the wrong owner. I cannot tell from a quick glance what differs /usr/lib/locale from, e.g., /usr/lib/gconv, where the latter does get the correct owner.

Quoted 8 lines

Unfortunately, I do not have more time to look at this right now, but I thought I should share this information with you. If anyone has any ideas of what to look at to determine why ${PKGD}/usr/lib/locale ends up with the wrong owner, I'm all ears. It would also be interesting to hear if the result is the same for anyone else with the patch I provided in my previous mail applied.

//Peter

Further investigation indicates that the problem I'm seeing is not related to pseudo, but an actual problem in the code. I have not dug too far into it, but I'm seeing the problem in the directories used in do_prep_locale_tree() and do_collect_bins_from_locale_tree() in libc-package.bbclass where some of them seems to have been created without being run under pseudo. The following patch works around the problem, though it would probably be better to correct the problem at the source by running whatever part of the code under pseudo that is currently missing it:

meta/classes/libc-package.bbclass +0 -0
index 0b4c666a74..174465a891 100644

meta/classes/libc-package.bbclass do_prep_locale_tree() { · line 78

Quoted 7 lines
meta/classes/libc-package.bbclass +1 -0
@@ -72,6 +72,7 @@ do_prep_locale_tree() {
                tar -cf - -C ${STAGING_DIR_NATIVE}/${prefix_native}/${base_libdir} -p libgcc_s.* | tar -xf - -C $treedir/${base_libdir}
        fi
        install -m 0755 ${LOCALETREESRC}${bindir}/localedef $treedir/${base_bindir}
+       chown -R root:root $treedir
 }
 
 do_collect_bins_from_locale_tree() {

Can you try something on the lines

meta/classes/libc-package.bbclass +1 -1
index 0b4c666a74..34025635ce 100644
@@ -61,7 +61,7 @@ LOCALETREESRC ?= "${PKGD}"
 do_prep_locale_tree() {
        treedir=${WORKDIR}/locale-tree
        rm -rf $treedir
-       mkdir -p $treedir/${base_bindir} $treedir/${base_libdir}
 $treedir/${datadir} $treedir/${localedir}
+       install -d $treedir/${base_bindir} $treedir/${base_libdir}
 $treedir/${datadir} $treedir/${localedir}
        tar -cf - -C ${LOCALETREESRC}${datadir} -p i18n | tar -xf - -C

$treedir/${datadir}

        # unzip to avoid parsing errors
        for i in $treedir/${datadir}/i18n/charmaps/*gz; do
Quoted 1 line

//Peter

#14 lore raw
In reply to Khem Raj
Quoted 86 lines

-----Original Message-----
From: [email protected] <openembedded- [email protected]> On Behalf Of Khem Raj
Sent: den 7 februari 2019 01:36
To: [email protected]
Subject: [OE-core] [PATCH] glibc-locale: Rewrite do_install using install utility instead of cp

This has been a constant source of trouble for build failures due to host-user-contaminated QA errors of sort

ERROR: QA Issue: glibc-locale: /glibc-binary-localedata-ca- es+valencia/usr/lib/locale/ca_ES@valencia/LC_MONETARY is owned by uid 3004, which is the same as the user running bitbake. This may be due to host contamination [host-user-contaminated]

So far we have tried to mould cp command into not carrying the build user permissions into install area but it is never entirely fixed since the issue keeps popping up in various scenes

This patch replaces use of cp with install utility and specifies install mode for files explcitly

---
 meta/recipes-core/glibc/glibc-locale.inc | 44 ++++++++++++++----------
 1 file changed, 25 insertions(+), 19 deletions(-)
meta/recipes-core/glibc/glibc-locale.inc +25 -20
index 6384f9cbf1..9b256a5108 100644
@@ -72,27 +72,33 @@ FILES_localedef = "${bindir}/localedef"
 LOCALETREESRC = "${COMPONENTS_DIR}/${PACKAGE_ARCH}/glibc-stash-locale"
 
 do_install () {
-	mkdir -p ${D}${bindir} ${D}${datadir}
-	if [ -n "$(ls ${LOCALETREESRC}/${bindir})" ]; then
-		cp -R --no-dereference --preserve=mode,links ${LOCALETREESRC}/${bindir}/* ${D}${bindir}
-	fi
-	if [ -n "$(ls ${LOCALETREESRC}/${localedir})" ]; then
-		mkdir -p ${D}${localedir}
-		cp -R --no-dereference --preserve=mode,links ${LOCALETREESRC}/${localedir}/* ${D}${localedir}
-	fi
+        install -d ${D}${bindir}
+        find "${LOCALETREESRC}/${bindir}" -maxdepth 1 -type f \
+        -exec install -m 0755 -t "${D}${bindir}" {} \;
+
+        for d in . $(find "${LOCALETREESRC}/${localedir}" -type d -printf '%P ') ; do
+                install -d "${D}${localedir}/$d"
+                find "${LOCALETREESRC}/${localedir}/$d" -maxdepth 1 -type f \
+                -exec install -m 0644 -t "${D}${localedir}/$d" {} \;
+        done
 	if [ ${@d.getVar('PACKAGE_NO_GCONV')} -eq 0 ]; then
-		mkdir -p ${D}${libdir}
-		if [ -e ${LOCALETREESRC}/${libdir}/gconv ]; then
-			cp -R --no-dereference --preserve=mode,links ${LOCALETREESRC}/${libdir}/gconv ${D}${libdir}
-		fi
-		if [ -e ${LOCALETREESRC}/${datadir}/i18n ]; then
-			cp -R --no-dereference --preserve=mode,links ${LOCALETREESRC}/${datadir}/i18n ${D}${datadir}
-		fi
-	fi
-	if [ -e ${LOCALETREESRC}/${datadir}/locale ]; then
-		cp -R --no-dereference --preserve=mode,links ${LOCALETREESRC}/${datadir}/locale ${D}${datadir}
+                for d in . $(find "${LOCALETREESRC}/${libdir}/gconv" -type d -printf '%P ') ; do
+                        install -d "${D}${libdir}/gconv/$d"
+                        find "${LOCALETREESRC}/${libdir}/gconv/$d" -maxdepth 1 -type f \
+                        -exec install -m 0755 -t "${D}${libdir}/gconv/$d" {} \;
+                done
+                for d in . $(find "${LOCALETREESRC}/${datadir}/i18n" -type d -printf '%P ') ; do
+                        install -d "${D}${datadir}/i18n/$d"
+                        find "${LOCALETREESRC}/${datadir}/i18n/$d" -maxdepth 1 -type f \
+                        -exec install -m 0644 -t "${D}${datadir}/i18n/$d" {} \;
+                done
 	fi
-	cp -R --no-dereference --preserve=mode,links ${LOCALETREESRC}/SUPPORTED ${WORKDIR}
+        for d in . $(find "${LOCALETREESRC}/${datadir}/locale" -type d -printf '%P ') ; do
+                install -d "${D}${datadir}/locale/$d"
+                find "${LOCALETREESRC}/${datadir}/locale/$d" -maxdepth 1 -type f \
+                -exec install -m 0644 -t "${D}${datadir}/locale/$d" {} \;
+        done
+	install -m 0644 ${LOCALETREESRC}/SUPPORTED ${WORKDIR}/SUPPORTED
 }
 
 inherit libc-package
--
Quoted 1 line

2.20.1

May I suggest using a help function to simplify the code a lot:

copy_locale_files() {
	local dir=$1 mode=$2

	[ -e "${LOCALETREESRC}$dir" ] || return 0

	for d in . $(find "${LOCALETREESRC}$dir" -type d -printf '%P '); do
		install -d ${D}$dir/$d
		find "${LOCALETREESRC}$dir/$d" -maxdepth 1 -type f \
		     -exec install -m $mode -t "${D}$dir/$d" {} \;
	done
}
do_install() {
	copy_locale_files ${bindir} 0755
	copy_locale_files ${localedir} 0644
	if [ ${PACKAGE_NO_GCONV} -eq 0 ]; then
		copy_locale_files ${libdir}/gconv 0755
		copy_locale_files ${datadir}/i18n 0644
	fi
	copy_locale_files ${datadir}/locale 0644
	install -m 0644 ${LOCALETREESRC}/SUPPORTED ${WORKDIR}/SUPPORTED
}

The code above is untested, but I think I got it reasonably correct. Also note that I have restored the indentation to use tabs, and turned the access to the ${PACKAGE_NO_GCONV} variable into a simple variable instead of using d.getVar().

//Peter

author
#15 lore raw
Quoted 114 lines · Peter Kjellerstedt
Quoted 87 lines

-----Original Message-----
From: [email protected] <openembedded- [email protected]> On Behalf Of Khem Raj
Sent: den 7 februari 2019 01:36
To: [email protected]
Subject: [OE-core] [PATCH] glibc-locale: Rewrite do_install using install utility instead of cp

This has been a constant source of trouble for build failures due to host-user-contaminated QA errors of sort

ERROR: QA Issue: glibc-locale: /glibc-binary-localedata-ca- es+valencia/usr/lib/locale/ca_ES@valencia/LC_MONETARY is owned by uid 3004, which is the same as the user running bitbake. This may be due to host contamination [host-user-contaminated]

So far we have tried to mould cp command into not carrying the build user permissions into install area but it is never entirely fixed since the issue keeps popping up in various scenes

This patch replaces use of cp with install utility and specifies install mode for files explcitly

---
 meta/recipes-core/glibc/glibc-locale.inc | 44 ++++++++++++++----------
 1 file changed, 25 insertions(+), 19 deletions(-)
meta/recipes-core/glibc/glibc-locale.inc +25 -20
index 6384f9cbf1..9b256a5108 100644
@@ -72,27 +72,33 @@ FILES_localedef = "${bindir}/localedef"
 LOCALETREESRC = "${COMPONENTS_DIR}/${PACKAGE_ARCH}/glibc-stash-locale"
 
 do_install () {
-     mkdir -p ${D}${bindir} ${D}${datadir}
-     if [ -n "$(ls ${LOCALETREESRC}/${bindir})" ]; then
-             cp -R --no-dereference --preserve=mode,links ${LOCALETREESRC}/${bindir}/* ${D}${bindir}
-     fi
-     if [ -n "$(ls ${LOCALETREESRC}/${localedir})" ]; then
-             mkdir -p ${D}${localedir}
-             cp -R --no-dereference --preserve=mode,links ${LOCALETREESRC}/${localedir}/* ${D}${localedir}
-     fi
+        install -d ${D}${bindir}
+        find "${LOCALETREESRC}/${bindir}" -maxdepth 1 -type f \
+        -exec install -m 0755 -t "${D}${bindir}" {} \;
+
+        for d in . $(find "${LOCALETREESRC}/${localedir}" -type d -printf '%P ') ; do
+                install -d "${D}${localedir}/$d"
+                find "${LOCALETREESRC}/${localedir}/$d" -maxdepth 1 -type f \
+                -exec install -m 0644 -t "${D}${localedir}/$d" {} \;
+        done
      if [ ${@d.getVar('PACKAGE_NO_GCONV')} -eq 0 ]; then
-             mkdir -p ${D}${libdir}
-             if [ -e ${LOCALETREESRC}/${libdir}/gconv ]; then
-                     cp -R --no-dereference --preserve=mode,links ${LOCALETREESRC}/${libdir}/gconv ${D}${libdir}
-             fi
-             if [ -e ${LOCALETREESRC}/${datadir}/i18n ]; then
-                     cp -R --no-dereference --preserve=mode,links ${LOCALETREESRC}/${datadir}/i18n ${D}${datadir}
-             fi
-     fi
-     if [ -e ${LOCALETREESRC}/${datadir}/locale ]; then
-             cp -R --no-dereference --preserve=mode,links ${LOCALETREESRC}/${datadir}/locale ${D}${datadir}
+                for d in . $(find "${LOCALETREESRC}/${libdir}/gconv" -type d -printf '%P ') ; do
+                        install -d "${D}${libdir}/gconv/$d"
+                        find "${LOCALETREESRC}/${libdir}/gconv/$d" -maxdepth 1 -type f \
+                        -exec install -m 0755 -t "${D}${libdir}/gconv/$d" {} \;
+                done
+                for d in . $(find "${LOCALETREESRC}/${datadir}/i18n" -type d -printf '%P ') ; do
+                        install -d "${D}${datadir}/i18n/$d"
+                        find "${LOCALETREESRC}/${datadir}/i18n/$d" -maxdepth 1 -type f \
+                        -exec install -m 0644 -t "${D}${datadir}/i18n/$d" {} \;
+                done
      fi
-     cp -R --no-dereference --preserve=mode,links ${LOCALETREESRC}/SUPPORTED ${WORKDIR}
+        for d in . $(find "${LOCALETREESRC}/${datadir}/locale" -type d -printf '%P ') ; do
+                install -d "${D}${datadir}/locale/$d"
+                find "${LOCALETREESRC}/${datadir}/locale/$d" -maxdepth 1 -type f \
+                -exec install -m 0644 -t "${D}${datadir}/locale/$d" {} \;
+        done
+     install -m 0644 ${LOCALETREESRC}/SUPPORTED ${WORKDIR}/SUPPORTED
 }
 
 inherit libc-package
--
Quoted 1 line

2.20.1

May I suggest using a help function to simplify the code a lot:

copy_locale_files() {
        local dir=$1 mode=$2

        [ -e "${LOCALETREESRC}$dir" ] || return 0

        for d in . $(find "${LOCALETREESRC}$dir" -type d -printf '%P '); do
                install -d ${D}$dir/$d
                find "${LOCALETREESRC}$dir/$d" -maxdepth 1 -type f \
                     -exec install -m $mode -t "${D}$dir/$d" {} \;
        done
}
do_install() {
        copy_locale_files ${bindir} 0755
        copy_locale_files ${localedir} 0644
        if [ ${PACKAGE_NO_GCONV} -eq 0 ]; then
                copy_locale_files ${libdir}/gconv 0755
                copy_locale_files ${datadir}/i18n 0644
        fi
        copy_locale_files ${datadir}/locale 0644
        install -m 0644 ${LOCALETREESRC}/SUPPORTED ${WORKDIR}/SUPPORTED
}
Quoted 5 lines

The code above is untested, but I think I got it reasonably correct. Also note that I have restored the indentation to use tabs, and turned the access to the ${PACKAGE_NO_GCONV} variable into a simple variable instead of using d.getVar().

thats a neat idea. I will send a v2 with this

Quoted 2 lines

//Peter

#16 lore raw
In reply to Khem Raj

Just to provide some feedback.
Even with this patch, this annoying QA issue is still there.
WARNING: glibc-locale-2.29-r0 do_package_qa: QA Issue: glibc-locale: /glibc-binary-localedata-wo-sn/usr/lib/locale/wo_SN/LC_CTYPE is owned by uid 1001, which is the same as the user running bitbake. This may be due to host contamination [host-user-contaminated]

Best Regards,
Chen Qi

Quoted 74 lines · Khem Raj

This has been a constant source of trouble for build failures due to host-user-contaminated QA errors of sort

ERROR: QA Issue: glibc-locale: /glibc-binary-localedata-ca-es+valencia/usr/lib/locale/ca_ES@valencia/LC_MONETARY is owned by uid 3004, which is the same as the user running bitbake. This may be due to host contamination [host-user-contaminated]

So far we have tried to mould cp command into not carrying the build user permissions into install area but it is never entirely fixed since the issue keeps popping up in various scenes

This patch replaces use of cp with install utility and specifies install mode for files explcitly

---
  meta/recipes-core/glibc/glibc-locale.inc | 44 ++++++++++++++----------
  1 file changed, 25 insertions(+), 19 deletions(-)
meta/recipes-core/glibc/glibc-locale.inc +25 -19
index 6384f9cbf1..9b256a5108 100644
@@ -72,27 +72,33 @@ FILES_localedef = "${bindir}/localedef"
  LOCALETREESRC = "${COMPONENTS_DIR}/${PACKAGE_ARCH}/glibc-stash-locale"
 
  do_install () {
-	mkdir -p ${D}${bindir} ${D}${datadir}
-	if [ -n "$(ls ${LOCALETREESRC}/${bindir})" ]; then
-		cp -R --no-dereference --preserve=mode,links ${LOCALETREESRC}/${bindir}/* ${D}${bindir}
-	fi
-	if [ -n "$(ls ${LOCALETREESRC}/${localedir})" ]; then
-		mkdir -p ${D}${localedir}
-		cp -R --no-dereference --preserve=mode,links ${LOCALETREESRC}/${localedir}/* ${D}${localedir}
-	fi
+        install -d ${D}${bindir}
+        find "${LOCALETREESRC}/${bindir}" -maxdepth 1 -type f \
+        -exec install -m 0755 -t "${D}${bindir}" {} \;
+
+        for d in . $(find "${LOCALETREESRC}/${localedir}" -type d -printf '%P ') ; do
+                install -d "${D}${localedir}/$d"
+                find "${LOCALETREESRC}/${localedir}/$d" -maxdepth 1 -type f \
+                -exec install -m 0644 -t "${D}${localedir}/$d" {} \;
+        done
  	if [ ${@d.getVar('PACKAGE_NO_GCONV')} -eq 0 ]; then
-		mkdir -p ${D}${libdir}
-		if [ -e ${LOCALETREESRC}/${libdir}/gconv ]; then
-			cp -R --no-dereference --preserve=mode,links ${LOCALETREESRC}/${libdir}/gconv ${D}${libdir}
-		fi
-		if [ -e ${LOCALETREESRC}/${datadir}/i18n ]; then
-			cp -R --no-dereference --preserve=mode,links ${LOCALETREESRC}/${datadir}/i18n ${D}${datadir}
-		fi
-	fi
-	if [ -e ${LOCALETREESRC}/${datadir}/locale ]; then
-		cp -R --no-dereference --preserve=mode,links ${LOCALETREESRC}/${datadir}/locale ${D}${datadir}
+                for d in . $(find "${LOCALETREESRC}/${libdir}/gconv" -type d -printf '%P ') ; do
+                        install -d "${D}${libdir}/gconv/$d"
+                        find "${LOCALETREESRC}/${libdir}/gconv/$d" -maxdepth 1 -type f \
+                        -exec install -m 0755 -t "${D}${libdir}/gconv/$d" {} \;
+                done
+                for d in . $(find "${LOCALETREESRC}/${datadir}/i18n" -type d -printf '%P ') ; do
+                        install -d "${D}${datadir}/i18n/$d"
+                        find "${LOCALETREESRC}/${datadir}/i18n/$d" -maxdepth 1 -type f \
+                        -exec install -m 0644 -t "${D}${datadir}/i18n/$d" {} \;
+                done
  	fi
-	cp -R --no-dereference --preserve=mode,links ${LOCALETREESRC}/SUPPORTED ${WORKDIR}
+        for d in . $(find "${LOCALETREESRC}/${datadir}/locale" -type d -printf '%P ') ; do
+                install -d "${D}${datadir}/locale/$d"
+                find "${LOCALETREESRC}/${datadir}/locale/$d" -maxdepth 1 -type f \
+                -exec install -m 0644 -t "${D}${datadir}/locale/$d" {} \;
+        done
+	install -m 0644 ${LOCALETREESRC}/SUPPORTED ${WORKDIR}/SUPPORTED
  }
 
  inherit libc-package
#17 lore raw
Quoted 8 lines · ChenQi

Just to provide some feedback.
Even with this patch, this annoying QA issue is still there.
WARNING: glibc-locale-2.29-r0 do_package_qa: QA Issue: glibc-locale:
/glibc-binary-localedata-wo-sn/usr/lib/locale/wo_SN/LC_CTYPE is owned by
uid 1001, which is the same as the user running bitbake. This may be due
to host contamination [host-user-contaminated]

Just seen on our autobuilder too:

WARNING: glibc-locale-2.29-r0 do_package_qa: QA Issue: glibc-locale: /glibc-binary-localedata-gez-et+abegede/usr/lib/locale/gez_ET@abegede/LC_MESSAGES/SYS_LC_MESSAGES is owned by uid 6000, which is the same as the user running bitbake. This may be due to host contamination [host-user-contaminated]

(https://autobuilder.yoctoproject.org/typhoon/#/builders/70/builds/346)

Cheers,

Richard