Skip to contentSkip to conversation

postinst-intercepts: check tool presence in intercept hooks

PATCH In review Sinan Kaya 4 participants 12 messages Jun 25, 2019 – Jul 1, 2019

lore
Share & tools
lore

Sinan Kaya

author
#0 lore raw

PATCH 1/1 postinst-intercepts: check tool presence in intercept hooks

do_rootfs: The postinstall intercept hook 'update_udev_hwdb'
do_rootfs: The postinstall intercept hook 'update_gio_module_cache' failed
do_rootfs: The postinstall intercept hook 'update_icon_cache' failed
do_rootfs: The postinstall intercept hook 'update_icon_cache' failed

---
 scripts/postinst-intercepts/update_font_cache    |  6 ++++--
 .../postinst-intercepts/update_gio_module_cache  | 10 +++++++---
 scripts/postinst-intercepts/update_icon_cache    | 16 +++++++++-------
 scripts/postinst-intercepts/update_pixbuf_cache  |  5 ++++-
 scripts/postinst-intercepts/update_udev_hwdb     |  6 ++++--
 5 files changed, 28 insertions(+), 15 deletions(-)
scripts/postinst-intercepts/update_font_cache +4 -2
index 3053c7065f4..954acbb41b2 100644
@@ -5,5 +5,7 @@
 
 set -e
 
-PSEUDO_UNLOAD=1 ${binprefix}qemuwrapper -L $D -E ${fontconfigcacheenv} $D${libexecdir}/${binprefix}fc-cache --sysroot=$D --system-only ${fontconfigcacheparams}
-chown -R root:root $D${fontconfigcachedir}
+if [ -f $D${libexecdir}/${binprefix}fc-cache ]; then
+	PSEUDO_UNLOAD=1 ${binprefix}qemuwrapper -L $D -E ${fontconfigcacheenv} $D${libexecdir}/${binprefix}fc-cache --sysroot=$D --system-only ${fontconfigcacheparams}
+	chown -R root:root $D${fontconfigcachedir}
+fi
scripts/postinst-intercepts/update_gio_module_cache +7 -3
index c87fa85db9e..e8483cb0bf5 100644
@@ -5,7 +5,11 @@
 
 set -e
 
-PSEUDO_UNLOAD=1 ${binprefix}qemuwrapper -L $D $D${libexecdir}/${binprefix}gio-querymodules $D${libdir}/gio/modules/
+if [ -f $D${libexecdir}/${binprefix}gio-querymodules ]; then
+
+	PSEUDO_UNLOAD=1 ${binprefix}qemuwrapper -L $D $D${libexecdir}/${binprefix}gio-querymodules $D${libdir}/gio/modules/
+
+	[ ! -e $D${libdir}/gio/modules/giomodule.cache ] ||
+		chown root:root $D${libdir}/gio/modules/giomodule.cache
+fi
 
-[ ! -e $D${libdir}/gio/modules/giomodule.cache ] ||
-	chown root:root $D${libdir}/gio/modules/giomodule.cache
scripts/postinst-intercepts/update_icon_cache +9 -7
index 212209a9daf..a67ff7ef970 100644
@@ -5,12 +5,14 @@
 
 set -e
 
-# update native pixbuf loaders
-$STAGING_DIR_NATIVE/${libdir_native}/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders --update-cache
+if [ -d $STAGING_DIR_NATIVE/${libdir_native}/gdk-pixbuf-2.0 ]; then
+	# update native pixbuf loaders
+	$STAGING_DIR_NATIVE/${libdir_native}/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders --update-cache
 
-for icondir in $D/usr/share/icons/*/ ; do
-    if [ -d $icondir ] ; then
-        gtk-update-icon-cache -fqt  $icondir
-    fi
-done
+	for icondir in $D/usr/share/icons/*/ ; do
+	    if [ -d $icondir ] ; then
+	        gtk-update-icon-cache -fqt  $icondir
+	    fi
+	done
+fi
 
scripts/postinst-intercepts/update_pixbuf_cache +4 -1
index ea12814474e..166422e5c37 100644
@@ -8,6 +8,9 @@ set -e
 export GDK_PIXBUF_MODULEDIR=$D${libdir}/gdk-pixbuf-2.0/2.10.0/loaders
 export GDK_PIXBUF_FATAL_LOADER=1
 
-PSEUDO_UNLOAD=1 ${binprefix}qemuwrapper -L $D $D${libdir}/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders \
+if [ -d $D${libdir}/gdk-pixbuf-2.0 ]; then
+	PSEUDO_UNLOAD=1 ${binprefix}qemuwrapper -L $D $D${libdir}/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders \
     >$GDK_PIXBUF_MODULEDIR/../loaders.cache && \
     sed -i -e "s:$D::g" $GDK_PIXBUF_MODULEDIR/../loaders.cache
+fi
+
scripts/postinst-intercepts/update_udev_hwdb +4 -2
index c4fb2bffcbf..7b6e38338f3 100644
@@ -5,5 +5,7 @@
 
 set -e
 
-PSEUDO_UNLOAD=1 ${binprefix}qemuwrapper -L $D $D${libexecdir}/${binprefix}udevadm hwdb --update --root $D
-chown root:root $D${sysconfdir}/udev/hwdb.bin
+if [ -d $D/lib/udev/hwdb.d ]; then
+	PSEUDO_UNLOAD=1 ${binprefix}qemuwrapper -L $D $D${libexecdir}/${binprefix}udevadm hwdb --update --root $D
+	chown root:root $D${sysconfdir}/udev/hwdb.bin
+fi
Signature · 1 line
2.21.0
#1 lore raw

Under which circumstances will the tools be absent?
And why do you check the existence of files for some the the existence of directories for others?

Best Regards,
Chen Qi

Quoted 102 lines · Sinan Kaya

do_rootfs: The postinstall intercept hook 'update_udev_hwdb'
do_rootfs: The postinstall intercept hook 'update_gio_module_cache' failed
do_rootfs: The postinstall intercept hook 'update_icon_cache' failed
do_rootfs: The postinstall intercept hook 'update_icon_cache' failed

---
  scripts/postinst-intercepts/update_font_cache    |  6 ++++--
  .../postinst-intercepts/update_gio_module_cache  | 10 +++++++---
  scripts/postinst-intercepts/update_icon_cache    | 16 +++++++++-------
  scripts/postinst-intercepts/update_pixbuf_cache  |  5 ++++-
  scripts/postinst-intercepts/update_udev_hwdb     |  6 ++++--
  5 files changed, 28 insertions(+), 15 deletions(-)
scripts/postinst-intercepts/update_font_cache +4 -2
index 3053c7065f4..954acbb41b2 100644
@@ -5,5 +5,7 @@
 
  set -e
 
-PSEUDO_UNLOAD=1 ${binprefix}qemuwrapper -L $D -E ${fontconfigcacheenv} $D${libexecdir}/${binprefix}fc-cache --sysroot=$D --system-only ${fontconfigcacheparams}
-chown -R root:root $D${fontconfigcachedir}
+if [ -f $D${libexecdir}/${binprefix}fc-cache ]; then
+	PSEUDO_UNLOAD=1 ${binprefix}qemuwrapper -L $D -E ${fontconfigcacheenv} $D${libexecdir}/${binprefix}fc-cache --sysroot=$D --system-only ${fontconfigcacheparams}
+	chown -R root:root $D${fontconfigcachedir}
+fi
scripts/postinst-intercepts/update_gio_module_cache +7 -3
index c87fa85db9e..e8483cb0bf5 100644
@@ -5,7 +5,11 @@
 
  set -e
 
-PSEUDO_UNLOAD=1 ${binprefix}qemuwrapper -L $D $D${libexecdir}/${binprefix}gio-querymodules $D${libdir}/gio/modules/
+if [ -f $D${libexecdir}/${binprefix}gio-querymodules ]; then
+
+	PSEUDO_UNLOAD=1 ${binprefix}qemuwrapper -L $D $D${libexecdir}/${binprefix}gio-querymodules $D${libdir}/gio/modules/
+
+	[ ! -e $D${libdir}/gio/modules/giomodule.cache ] ||
+		chown root:root $D${libdir}/gio/modules/giomodule.cache
+fi
 
-[ ! -e $D${libdir}/gio/modules/giomodule.cache ] ||
-	chown root:root $D${libdir}/gio/modules/giomodule.cache
scripts/postinst-intercepts/update_icon_cache +9 -7
index 212209a9daf..a67ff7ef970 100644
@@ -5,12 +5,14 @@
 
  set -e
 
-# update native pixbuf loaders
-$STAGING_DIR_NATIVE/${libdir_native}/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders --update-cache
+if [ -d $STAGING_DIR_NATIVE/${libdir_native}/gdk-pixbuf-2.0 ]; then
+	# update native pixbuf loaders
+	$STAGING_DIR_NATIVE/${libdir_native}/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders --update-cache
 
-for icondir in $D/usr/share/icons/*/ ; do
-    if [ -d $icondir ] ; then
-        gtk-update-icon-cache -fqt  $icondir
-    fi
-done
+	for icondir in $D/usr/share/icons/*/ ; do
+	    if [ -d $icondir ] ; then
+	        gtk-update-icon-cache -fqt  $icondir
+	    fi
+	done
+fi
 
scripts/postinst-intercepts/update_pixbuf_cache +4 -1
index ea12814474e..166422e5c37 100644
@@ -8,6 +8,9 @@ set -e
  export GDK_PIXBUF_MODULEDIR=$D${libdir}/gdk-pixbuf-2.0/2.10.0/loaders
  export GDK_PIXBUF_FATAL_LOADER=1
 
-PSEUDO_UNLOAD=1 ${binprefix}qemuwrapper -L $D $D${libdir}/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders \
+if [ -d $D${libdir}/gdk-pixbuf-2.0 ]; then
+	PSEUDO_UNLOAD=1 ${binprefix}qemuwrapper -L $D $D${libdir}/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders \
      >$GDK_PIXBUF_MODULEDIR/../loaders.cache && \
      sed -i -e "s:$D::g" $GDK_PIXBUF_MODULEDIR/../loaders.cache
+fi
+
scripts/postinst-intercepts/update_udev_hwdb +4 -2
index c4fb2bffcbf..7b6e38338f3 100644
@@ -5,5 +5,7 @@
 
  set -e
 
-PSEUDO_UNLOAD=1 ${binprefix}qemuwrapper -L $D $D${libexecdir}/${binprefix}udevadm hwdb --update --root $D
-chown root:root $D${sysconfdir}/udev/hwdb.bin
+if [ -d $D/lib/udev/hwdb.d ]; then
+	PSEUDO_UNLOAD=1 ${binprefix}qemuwrapper -L $D $D${libexecdir}/${binprefix}udevadm hwdb --update --root $D
+	chown root:root $D${sysconfdir}/udev/hwdb.bin
+fi
#2 lore raw

Yes, this looks suspicious to me as well. If the tools are absent you need to investigate why they are absent; skipping the tools execution is just sweeping the problem under the carpet, not fixing it.

Alex

Quoted 138 lines · ChenQi

Under which circumstances will the tools be absent?
And why do you check the existence of files for some the the existence of directories for others?

Best Regards,
Chen Qi

Quoted 2 lines · Sinan Kaya

do_rootfs: The postinstall intercept hook 'update_udev_hwdb'
do_rootfs: The postinstall intercept hook 'update_gio_module_cache'

failed

Quoted 12 lines

do_rootfs: The postinstall intercept hook 'update_icon_cache' failed
do_rootfs: The postinstall intercept hook 'update_icon_cache' failed

---
  scripts/postinst-intercepts/update_font_cache    |  6 ++++--
  .../postinst-intercepts/update_gio_module_cache  | 10 +++++++---
  scripts/postinst-intercepts/update_icon_cache    | 16 +++++++++-------
  scripts/postinst-intercepts/update_pixbuf_cache  |  5 ++++-
  scripts/postinst-intercepts/update_udev_hwdb     |  6 ++++--
  5 files changed, 28 insertions(+), 15 deletions(-)

Review

Quoted 1 line
(quoted diff) +0 -0

b/scripts/postinst-intercepts/update_font_cache

scripts/postinst-intercepts/update_font_cache line 8

Quoted 8 lines

index 3053c7065f4..954acbb41b2 100644

scripts/postinst-intercepts/update_font_cache +0 -1
@@ -5,5 +5,7 @@
 
  set -e
 
-PSEUDO_UNLOAD=1 ${binprefix}qemuwrapper -L $D -E ${fontconfigcacheenv}

$D${libexecdir}/${binprefix}fc-cache --sysroot=$D --system-only ${fontconfigcacheparams}

scripts/postinst-intercepts/update_font_cache

Quoted 3 lines
scripts/postinst-intercepts/update_font_cache +2 -1
-chown -R root:root $D${fontconfigcachedir}
+if [ -f $D${libexecdir}/${binprefix}fc-cache ]; then
+     PSEUDO_UNLOAD=1 ${binprefix}qemuwrapper -L $D -E

${fontconfigcacheenv} $D${libexecdir}/${binprefix}fc-cache --sysroot=$D --system-only ${fontconfigcacheparams}

Review

Quoted 3 lines
scripts/postinst-intercepts/update_font_cache +2 -0
+     chown -R root:root $D${fontconfigcachedir}
+fi
(quoted diff) +0 -0

b/scripts/postinst-intercepts/update_gio_module_cache

scripts/postinst-intercepts/update_gio_module_cache line 8

Quoted 8 lines

index c87fa85db9e..e8483cb0bf5 100644

scripts/postinst-intercepts/update_gio_module_cache +0 -1
@@ -5,7 +5,11 @@
 
  set -e
 
-PSEUDO_UNLOAD=1 ${binprefix}qemuwrapper -L $D

$D${libexecdir}/${binprefix}gio-querymodules $D${libdir}/gio/modules/

scripts/postinst-intercepts/update_gio_module_cache

Quoted 3 lines
scripts/postinst-intercepts/update_gio_module_cache +3 -0
+if [ -f $D${libexecdir}/${binprefix}gio-querymodules ]; then
+
+     PSEUDO_UNLOAD=1 ${binprefix}qemuwrapper -L $D

$D${libexecdir}/${binprefix}gio-querymodules $D${libdir}/gio/modules/

Review

Quoted 8 lines
scripts/postinst-intercepts/update_gio_module_cache +4 -2
+
+     [ ! -e $D${libdir}/gio/modules/giomodule.cache ] ||
+             chown root:root $D${libdir}/gio/modules/giomodule.cache
+fi
 
-[ ! -e $D${libdir}/gio/modules/giomodule.cache ] ||
-     chown root:root $D${libdir}/gio/modules/giomodule.cache
(quoted diff) +0 -0

b/scripts/postinst-intercepts/update_icon_cache

scripts/postinst-intercepts/update_icon_cache line 8

Quoted 9 lines

index 212209a9daf..a67ff7ef970 100644

scripts/postinst-intercepts/update_icon_cache +0 -1
@@ -5,12 +5,14 @@
 
  set -e
 
-# update native pixbuf loaders
 

-$STAGING_DIR_NATIVE/${libdir_native}/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders --update-cache

scripts/postinst-intercepts/update_icon_cache

Quoted 3 lines
scripts/postinst-intercepts/update_icon_cache +3 -0
+if [ -d $STAGING_DIR_NATIVE/${libdir_native}/gdk-pixbuf-2.0 ]; then
+     # update native pixbuf loaders
+

$STAGING_DIR_NATIVE/${libdir_native}/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders
--update-cache

Review

Quoted 14 lines
scripts/postinst-intercepts/update_icon_cache +6 -5
-for icondir in $D/usr/share/icons/*/ ; do
-    if [ -d $icondir ] ; then
-        gtk-update-icon-cache -fqt  $icondir
-    fi
-done
+     for icondir in $D/usr/share/icons/*/ ; do
+         if [ -d $icondir ] ; then
+             gtk-update-icon-cache -fqt  $icondir
+         fi
+     done
+fi
 
(quoted diff) +0 -0

b/scripts/postinst-intercepts/update_pixbuf_cache

scripts/postinst-intercepts/update_pixbuf_cache set -e · line 11

Quoted 8 lines

index ea12814474e..166422e5c37 100644

scripts/postinst-intercepts/update_pixbuf_cache +0 -1
@@ -8,6 +8,9 @@ set -e
  export GDK_PIXBUF_MODULEDIR=$D${libdir}/gdk-pixbuf-2.0/2.10.0/loaders
  export GDK_PIXBUF_FATAL_LOADER=1
 
-PSEUDO_UNLOAD=1 ${binprefix}qemuwrapper -L $D

$D${libdir}/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders \

scripts/postinst-intercepts/update_pixbuf_cache set -e · line 12

Quoted 2 lines
scripts/postinst-intercepts/update_pixbuf_cache +2 -0
+if [ -d $D${libdir}/gdk-pixbuf-2.0 ]; then
+     PSEUDO_UNLOAD=1 ${binprefix}qemuwrapper -L $D

$D${libdir}/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders \

Review

Quoted 5 lines
scripts/postinst-intercepts/update_pixbuf_cache +2 -0
      >$GDK_PIXBUF_MODULEDIR/../loaders.cache && \
      sed -i -e "s:$D::g" $GDK_PIXBUF_MODULEDIR/../loaders.cache
+fi
+
(quoted diff) +0 -0

b/scripts/postinst-intercepts/update_udev_hwdb

scripts/postinst-intercepts/update_udev_hwdb line 8

Quoted 8 lines

index c4fb2bffcbf..7b6e38338f3 100644

scripts/postinst-intercepts/update_udev_hwdb +0 -1
@@ -5,5 +5,7 @@
 
  set -e
 
-PSEUDO_UNLOAD=1 ${binprefix}qemuwrapper -L $D

$D${libexecdir}/${binprefix}udevadm hwdb --update --root $D

scripts/postinst-intercepts/update_udev_hwdb

Quoted 3 lines
scripts/postinst-intercepts/update_udev_hwdb +2 -1
-chown root:root $D${sysconfdir}/udev/hwdb.bin
+if [ -d $D/lib/udev/hwdb.d ]; then
+     PSEUDO_UNLOAD=1 ${binprefix}qemuwrapper -L $D

$D${libexecdir}/${binprefix}udevadm hwdb --update --root $D

scripts/postinst-intercepts/update_udev_hwdb line 11

Quoted 2 lines
scripts/postinst-intercepts/update_udev_hwdb +2 -0
+     chown root:root $D${sysconfdir}/udev/hwdb.bin
+fi

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

author
#3 lore raw

Here is my investigation:

The intercepts are executed on QEMU during cross-compilation using qemu-wrapper.

I see that the tools were built for the native architecture but of course they do not exist on the target image and I have no interest in pulling fonts and such into my image to make bitbake happy.

DEBUG: Collected intercepts:
poky/scripts/postinst-intercepts/update_font_cache poky/scripts/postinst-intercepts/update_gio_module_cache poky/scripts/postinst-intercepts/update_gtk_immodules_cache poky/scripts/postinst-intercepts/update_icon_cache poky/scripts/postinst-intercepts/update_pixbuf_cache poky/scripts/postinst-intercepts/update_udev_hwdb

I also see that other intercepts are doing the same folder/executable checks.

What is so special about these?

Quoted 150 lines · Alexander Kanavin

Yes, this looks suspicious to me as well. If the tools are absent you need to investigate why they are absent; skipping the tools execution is just sweeping the problem under the carpet, not fixing it.

Alex

On Wed, 26 Jun 2019 at 04:15, ChenQi <[email protected] <mailto:[email protected]>> wrote:

    Under which circumstances will the tools be absent?
    And why do you check the existence of files for some the the existence
    of directories for others?

    Best Regards,
    Chen Qi

    On 06/26/2019 06:13 AM, Sinan Kaya wrote:
    > do_rootfs: The postinstall intercept hook 'update_udev_hwdb'
    > do_rootfs: The postinstall intercept hook
    'update_gio_module_cache' failed
    > do_rootfs: The postinstall intercept hook 'update_icon_cache' failed
    > do_rootfs: The postinstall intercept hook 'update_icon_cache' failed
    >
    > Signed-off-by: Sinan Kaya <[email protected] <mailto:[email protected]>>
    > ---
    >   scripts/postinst-intercepts/update_font_cache    |  6 ++++--
    >   .../postinst-intercepts/update_gio_module_cache  | 10 +++++++---
    >   scripts/postinst-intercepts/update_icon_cache    | 16
    +++++++++-------
    >   scripts/postinst-intercepts/update_pixbuf_cache  |  5 ++++-
    >   scripts/postinst-intercepts/update_udev_hwdb     |  6 ++++--
    >   5 files changed, 28 insertions(+), 15 deletions(-)
    >
    > diff --git a/scripts/postinst-intercepts/update_font_cache
    b/scripts/postinst-intercepts/update_font_cache
    > index 3053c7065f4..954acbb41b2 100644
    > --- a/scripts/postinst-intercepts/update_font_cache
    > +++ b/scripts/postinst-intercepts/update_font_cache
    > @@ -5,5 +5,7 @@
    >   
    >   set -e
    >   
    > -PSEUDO_UNLOAD=1 ${binprefix}qemuwrapper -L $D -E
    ${fontconfigcacheenv} $D${libexecdir}/${binprefix}fc-cache
    --sysroot=$D --system-only ${fontconfigcacheparams}
    > -chown -R root:root $D${fontconfigcachedir}
    > +if [ -f $D${libexecdir}/${binprefix}fc-cache ]; then
    > +     PSEUDO_UNLOAD=1 ${binprefix}qemuwrapper -L $D -E
    ${fontconfigcacheenv} $D${libexecdir}/${binprefix}fc-cache
    --sysroot=$D --system-only ${fontconfigcacheparams}
    > +     chown -R root:root $D${fontconfigcachedir}
    > +fi
    > diff --git a/scripts/postinst-intercepts/update_gio_module_cache
    b/scripts/postinst-intercepts/update_gio_module_cache
    > index c87fa85db9e..e8483cb0bf5 100644
    > --- a/scripts/postinst-intercepts/update_gio_module_cache
    > +++ b/scripts/postinst-intercepts/update_gio_module_cache
    > @@ -5,7 +5,11 @@
    >   
    >   set -e
    >   
    > -PSEUDO_UNLOAD=1 ${binprefix}qemuwrapper -L $D
    $D${libexecdir}/${binprefix}gio-querymodules $D${libdir}/gio/modules/
    > +if [ -f $D${libexecdir}/${binprefix}gio-querymodules ]; then
    > +
    > +     PSEUDO_UNLOAD=1 ${binprefix}qemuwrapper -L $D
    $D${libexecdir}/${binprefix}gio-querymodules $D${libdir}/gio/modules/
    > +
    > +     [ ! -e $D${libdir}/gio/modules/giomodule.cache ] ||
    > +             chown root:root $D${libdir}/gio/modules/giomodule.cache
    > +fi
    >   
    > -[ ! -e $D${libdir}/gio/modules/giomodule.cache ] ||
    > -     chown root:root $D${libdir}/gio/modules/giomodule.cache
    > diff --git a/scripts/postinst-intercepts/update_icon_cache
    b/scripts/postinst-intercepts/update_icon_cache
    > index 212209a9daf..a67ff7ef970 100644
    > --- a/scripts/postinst-intercepts/update_icon_cache
    > +++ b/scripts/postinst-intercepts/update_icon_cache
    > @@ -5,12 +5,14 @@
    >   
    >   set -e
    >   
    > -# update native pixbuf loaders
    >
    -$STAGING_DIR_NATIVE/${libdir_native}/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders
    --update-cache
    > +if [ -d $STAGING_DIR_NATIVE/${libdir_native}/gdk-pixbuf-2.0 ]; then
    > +     # update native pixbuf loaders
    > +   
     $STAGING_DIR_NATIVE/${libdir_native}/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders
    --update-cache
    >   
    > -for icondir in $D/usr/share/icons/*/ ; do
    > -    if [ -d $icondir ] ; then
    > -        gtk-update-icon-cache -fqt  $icondir
    > -    fi
    > -done
    > +     for icondir in $D/usr/share/icons/*/ ; do
    > +         if [ -d $icondir ] ; then
    > +             gtk-update-icon-cache -fqt  $icondir
    > +         fi
    > +     done
    > +fi
    >   
    > diff --git a/scripts/postinst-intercepts/update_pixbuf_cache
    b/scripts/postinst-intercepts/update_pixbuf_cache
    > index ea12814474e..166422e5c37 100644
    > --- a/scripts/postinst-intercepts/update_pixbuf_cache
    > +++ b/scripts/postinst-intercepts/update_pixbuf_cache
    > @@ -8,6 +8,9 @@ set -e
    >   export
    GDK_PIXBUF_MODULEDIR=$D${libdir}/gdk-pixbuf-2.0/2.10.0/loaders
    >   export GDK_PIXBUF_FATAL_LOADER=1
    >   
    > -PSEUDO_UNLOAD=1 ${binprefix}qemuwrapper -L $D
    $D${libdir}/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders \
    > +if [ -d $D${libdir}/gdk-pixbuf-2.0 ]; then
    > +     PSEUDO_UNLOAD=1 ${binprefix}qemuwrapper -L $D
    $D${libdir}/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders \
    >       >$GDK_PIXBUF_MODULEDIR/../loaders.cache && \
    >       sed -i -e "s:$D::g" $GDK_PIXBUF_MODULEDIR/../loaders.cache
    > +fi
    > +
    > diff --git a/scripts/postinst-intercepts/update_udev_hwdb
    b/scripts/postinst-intercepts/update_udev_hwdb
    > index c4fb2bffcbf..7b6e38338f3 100644
    > --- a/scripts/postinst-intercepts/update_udev_hwdb
    > +++ b/scripts/postinst-intercepts/update_udev_hwdb
    > @@ -5,5 +5,7 @@
    >   
    >   set -e
    >   
    > -PSEUDO_UNLOAD=1 ${binprefix}qemuwrapper -L $D
    $D${libexecdir}/${binprefix}udevadm hwdb --update --root $D
    > -chown root:root $D${sysconfdir}/udev/hwdb.bin
    > +if [ -d $D/lib/udev/hwdb.d ]; then
    > +     PSEUDO_UNLOAD=1 ${binprefix}qemuwrapper -L $D
    $D${libexecdir}/${binprefix}udevadm hwdb --update --root $D
    > +     chown root:root $D${sysconfdir}/udev/hwdb.bin
    > +fi


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

Basically they are executed only when you have something in your target image that requires their execution (usually to populate some database). If the execution fails for some reason, the correct way to handle that is to look into the failure instead of fixing the symptoms (missing files for instance).

Alex

Quoted 178 lines · Sinan Kaya

Here is my investigation:

The intercepts are executed on QEMU during cross-compilation using qemu-wrapper.

I see that the tools were built for the native architecture but of course they do not exist on the target image and I have no interest in pulling fonts and such into my image to make bitbake happy.

DEBUG: Collected intercepts:
poky/scripts/postinst-intercepts/update_font_cache poky/scripts/postinst-intercepts/update_gio_module_cache poky/scripts/postinst-intercepts/update_gtk_immodules_cache poky/scripts/postinst-intercepts/update_icon_cache poky/scripts/postinst-intercepts/update_pixbuf_cache poky/scripts/postinst-intercepts/update_udev_hwdb

I also see that other intercepts are doing the same folder/executable checks.

What is so special about these?

Quoted 151 lines · Alexander Kanavin

Yes, this looks suspicious to me as well. If the tools are absent you need to investigate why they are absent; skipping the tools execution is just sweeping the problem under the carpet, not fixing it.

Alex

On Wed, 26 Jun 2019 at 04:15, ChenQi <[email protected] <mailto:[email protected]>> wrote:

Under which circumstances will the tools be absent?
And why do you check the existence of files for some the the existence of directories for others?

Best Regards,
Chen Qi

Quoted 3 lines · Sinan Kaya

do_rootfs: The postinstall intercept hook 'update_udev_hwdb'
do_rootfs: The postinstall intercept hook

'update_gio_module_cache' failed

Quoted 8 lines

do_rootfs: The postinstall intercept hook 'update_icon_cache' failed
do_rootfs: The postinstall intercept hook 'update_icon_cache' failed

Signed-off-by Sinan Kaya <[email protected] <mailto:[email protected]>>
---
   scripts/postinst-intercepts/update_font_cache    |  6 ++++--
   .../postinst-intercepts/update_gio_module_cache  | 10 +++++++---
   scripts/postinst-intercepts/update_icon_cache    | 16

+++++++++-------

Review

Quoted 5 lines
   scripts/postinst-intercepts/update_pixbuf_cache  |  5 ++++-
   scripts/postinst-intercepts/update_udev_hwdb     |  6 ++++--
   5 files changed, 28 insertions(+), 15 deletions(-)
(quoted diff) +0 -0

b/scripts/postinst-intercepts/update_font_cache

scripts/postinst-intercepts/update_font_cache line 8

Quoted 8 lines

index 3053c7065f4..954acbb41b2 100644

scripts/postinst-intercepts/update_font_cache +0 -1
@@ -5,5 +5,7 @@
 
   set -e
 
-PSEUDO_UNLOAD=1 ${binprefix}qemuwrapper -L $D -E

${fontconfigcacheenv} $D${libexecdir}/${binprefix}fc-cache --sysroot=$D --system-only ${fontconfigcacheparams}

scripts/postinst-intercepts/update_font_cache

Quoted 3 lines
scripts/postinst-intercepts/update_font_cache +2 -1
-chown -R root:root $D${fontconfigcachedir}
+if [ -f $D${libexecdir}/${binprefix}fc-cache ]; then
+     PSEUDO_UNLOAD=1 ${binprefix}qemuwrapper -L $D -E

${fontconfigcacheenv} $D${libexecdir}/${binprefix}fc-cache --sysroot=$D --system-only ${fontconfigcacheparams}

Review

Quoted 3 lines
scripts/postinst-intercepts/update_font_cache +2 -0
+     chown -R root:root $D${fontconfigcachedir}
+fi
(quoted diff) +0 -0

b/scripts/postinst-intercepts/update_gio_module_cache

scripts/postinst-intercepts/update_gio_module_cache line 8

Quoted 8 lines

index c87fa85db9e..e8483cb0bf5 100644

scripts/postinst-intercepts/update_gio_module_cache +0 -1
@@ -5,7 +5,11 @@
 
   set -e
 
-PSEUDO_UNLOAD=1 ${binprefix}qemuwrapper -L $D

$D${libexecdir}/${binprefix}gio-querymodules $D${libdir}/gio/modules/

scripts/postinst-intercepts/update_gio_module_cache

Quoted 3 lines
scripts/postinst-intercepts/update_gio_module_cache +3 -0
+if [ -f $D${libexecdir}/${binprefix}gio-querymodules ]; then
+
+     PSEUDO_UNLOAD=1 ${binprefix}qemuwrapper -L $D

$D${libexecdir}/${binprefix}gio-querymodules $D${libdir}/gio/modules/

Review

Quoted 8 lines
scripts/postinst-intercepts/update_gio_module_cache +4 -2
+
+     [ ! -e $D${libdir}/gio/modules/giomodule.cache ] ||
+             chown root:root $D${libdir}/gio/modules/giomodule.cache
+fi
 
-[ ! -e $D${libdir}/gio/modules/giomodule.cache ] ||
-     chown root:root $D${libdir}/gio/modules/giomodule.cache
(quoted diff) +0 -0

b/scripts/postinst-intercepts/update_icon_cache

scripts/postinst-intercepts/update_icon_cache line 8

Quoted 9 lines

index 212209a9daf..a67ff7ef970 100644

scripts/postinst-intercepts/update_icon_cache +0 -1
@@ -5,12 +5,14 @@
 
   set -e
 
-# update native pixbuf loaders
 

-$STAGING_DIR_NATIVE/${libdir_native}/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders --update-cache

scripts/postinst-intercepts/update_icon_cache

Quoted 3 lines
scripts/postinst-intercepts/update_icon_cache +3 -0
+if [ -d $STAGING_DIR_NATIVE/${libdir_native}/gdk-pixbuf-2.0 ]; then
+     # update native pixbuf loaders
+   
    $STAGING_DIR_NATIVE/${libdir_native}/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders

--update-cache

Review

Quoted 14 lines
scripts/postinst-intercepts/update_icon_cache +6 -5
-for icondir in $D/usr/share/icons/*/ ; do
-    if [ -d $icondir ] ; then
-        gtk-update-icon-cache -fqt  $icondir
-    fi
-done
+     for icondir in $D/usr/share/icons/*/ ; do
+         if [ -d $icondir ] ; then
+             gtk-update-icon-cache -fqt  $icondir
+         fi
+     done
+fi
 
(quoted diff) +0 -0

b/scripts/postinst-intercepts/update_pixbuf_cache

scripts/postinst-intercepts/update_pixbuf_cache set -e · line 8

Quoted 5 lines

index ea12814474e..166422e5c37 100644

scripts/postinst-intercepts/update_pixbuf_cache +0 -0
@@ -8,6 +8,9 @@ set -e
   export

GDK_PIXBUF_MODULEDIR=$D${libdir}/gdk-pixbuf-2.0/2.10.0/loaders

scripts/postinst-intercepts/update_pixbuf_cache set -e

Quoted 3 lines
scripts/postinst-intercepts/update_pixbuf_cache +0 -1
   export GDK_PIXBUF_FATAL_LOADER=1
 
-PSEUDO_UNLOAD=1 ${binprefix}qemuwrapper -L $D

$D${libdir}/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders \

scripts/postinst-intercepts/update_pixbuf_cache set -e · line 12

Quoted 2 lines
scripts/postinst-intercepts/update_pixbuf_cache +2 -0
+if [ -d $D${libdir}/gdk-pixbuf-2.0 ]; then
+     PSEUDO_UNLOAD=1 ${binprefix}qemuwrapper -L $D

$D${libdir}/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders \

Review

Quoted 5 lines
scripts/postinst-intercepts/update_pixbuf_cache +2 -0
       >$GDK_PIXBUF_MODULEDIR/../loaders.cache && \
       sed -i -e "s:$D::g" $GDK_PIXBUF_MODULEDIR/../loaders.cache
+fi
+
(quoted diff) +0 -0

b/scripts/postinst-intercepts/update_udev_hwdb

scripts/postinst-intercepts/update_udev_hwdb line 8

Quoted 8 lines

index c4fb2bffcbf..7b6e38338f3 100644

scripts/postinst-intercepts/update_udev_hwdb +0 -1
@@ -5,5 +5,7 @@
 
   set -e
 
-PSEUDO_UNLOAD=1 ${binprefix}qemuwrapper -L $D

$D${libexecdir}/${binprefix}udevadm hwdb --update --root $D

scripts/postinst-intercepts/update_udev_hwdb

Quoted 3 lines
scripts/postinst-intercepts/update_udev_hwdb +2 -1
-chown root:root $D${sysconfdir}/udev/hwdb.bin
+if [ -d $D/lib/udev/hwdb.d ]; then
+     PSEUDO_UNLOAD=1 ${binprefix}qemuwrapper -L $D

$D${libexecdir}/${binprefix}udevadm hwdb --update --root $D

scripts/postinst-intercepts/update_udev_hwdb line 11

Quoted 2 lines
scripts/postinst-intercepts/update_udev_hwdb +2 -0
+     chown root:root $D${sysconfdir}/udev/hwdb.bin
+fi
   -- 
   _______________________________________________
   Openembedded-core mailing list
   [email protected]
   <mailto:[email protected]>
   http://lists.openembedded.org/mailman/listinfo/openembedded-core
#5 lore raw
In reply to Sinan Kaya
Quoted 18 lines · Sinan Kaya

Here is my investigation:

The intercepts are executed on QEMU during cross-compilation using qemu-wrapper.

I see that the tools were built for the native architecture but of course they do not exist on the target image and I have no interest in pulling fonts and such into my image to make bitbake happy.

DEBUG: Collected intercepts:
poky/scripts/postinst-intercepts/update_font_cache poky/scripts/postinst-intercepts/update_gio_module_cache poky/scripts/postinst-intercepts/update_gtk_immodules_cache poky/scripts/postinst-intercepts/update_icon_cache poky/scripts/postinst-intercepts/update_pixbuf_cache poky/scripts/postinst-intercepts/update_udev_hwdb

Quoted 4 lines

I also see that other intercepts are doing the same folder/executable checks.

What is so special about these?

Put another way, why aren't lots of people seeing failures due to this?

You're obviously doing something differently to everyone else but we're having a hard time understanding what, or how we'd trigger the problem you're seeing.

We're nervous about fixing problems we don't understand, not least as it potentially means we have a huge hole in our test matrix. Your patches shouldn't be necessary as I understand the codebase either.

Cheers,

Richard

author
#6 lore raw
Quoted 10 lines · Richard Purdie
Quoted 1 line

What is so special about these?

Put another way, why aren't lots of people seeing failures due to this?

You're obviously doing something differently to everyone else but we're having a hard time understanding what, or how we'd trigger the problem you're seeing.

We're nervous about fixing problems we don't understand, not least as it potentially means we have a huge hole in our test matrix. Your patches shouldn't be necessary as I understand the codebase either.

Let's see if we can peel the onion.

Can you explain how it was designed to work for cross compilation use case where host machine architecture != target machine architecture ?

If I understand this right, all of these postinst intercepts create a native package dependency via inherit foobar.class.

AFAIK, Native packages are built against the host machine architecture not target architecture.

Where are the tools supposed to come from?

I can focus on details if my build actually follows the design.

As I said, I do not want these packages on my target machine but we want to run QEMU using the tools that were compiled against target machine in order to execute postinst intercepts.

This issue showed up in thud using core-image-minimal. It was not there on sumo.

#7 lore raw
Quoted 8 lines · Sinan Kaya

Let's see if we can peel the onion.

Can you explain how it was designed to work for cross compilation use case where host machine architecture != target machine architecture ?

If I understand this right, all of these postinst intercepts create a native package dependency via inherit foobar.class.

What makes you think so? Please point to the specific file and line where you think this happens.

Quoted 3 lines

This issue showed up in thud using core-image-minimal. It was not there on sumo.

If you can provide steps to reproduce, it could help. Please start with a git checkout of poky thud branch.

Alex

author
#8 lore raw
Quoted 7 lines · Alexander Kanavin

This issue showed up in thud using core-image-minimal. It was not there on sumo.

If you can provide steps to reproduce, it could help. Please start with a git checkout of poky thud branch.

Issue in only happening on the build machine with docker using ubuntu 16.04 as a baseline.

I'm having hard-time reproducing on my development machine.

My cursory web search says that I'm not the only one hitting this issue and people have mysteriously solved this issue.

https://github.com/riscv/meta-riscv/issues/26

The following matches what I see on the build machine.

"/update_pixbuf_cache: 8:
/home/riscv-yocto/build/tmp-glibc/work/qemuriscv64-oe-linux/core-image-full-cmdline/1.0-r0/intercept_scripts-2c03b46bc7941049a88b6c1719c35aade81b0ce5490421e7cca768bf8beb0d01

/update_pixbuf_cache: cannot create /home//riscv-yocto/build/tmp-glibc/work/qemuriscv64-oe-linux/core-image-full-cmdline/1.0-r0/rootfs/usr/lib/gdk-pixbuf-2.0/2.10.0/loaders/../loaders.cache:
Directory nonexistent"

#9 lore raw
Quoted 29 lines · Sinan Kaya
Quoted 9 lines · Alexander Kanavin

This issue showed up in thud using core-image-minimal. It was
not there
on sumo.

If you can provide steps to reproduce, it could help. Please start with
a git checkout of poky thud branch.

Issue in only happening on the build machine with docker using ubuntu 16.04 as a baseline.

I'm having hard-time reproducing on my development machine.

My cursory web search says that I'm not the only one hitting this issue
and people have mysteriously solved this issue.

https://github.com/riscv/meta-riscv/issues/26

The following matches what I see on the build machine.

"/update_pixbuf_cache: 8:
/home/riscv-yocto/build/tmp-glibc/work/qemuriscv64-oe-linux/core- image-full-cmdline/1.0-r0/intercept_scripts- 2c03b46bc7941049a88b6c1719c35aade81b0ce5490421e7cca768bf8beb0d01

Quoted 5 lines

/update_pixbuf_cache: cannot create /home//riscv-yocto/build/tmp-glibc/work/qemuriscv64-oe-linux/core- image-full-cmdline/1.0-r0/rootfs/usr/lib/gdk-pixbuf- 2.0/2.10.0/loaders/../loaders.cache:
Directory nonexistent"

Knowing which branches (sumo vs. thud) and which layers does help put a different perspective on this issue and helps us help you!

Is this a difference in dash shell vs bash shell (e.g. for /bin/sh) on these machines? (if I had to guess that is where I'd start)

Cheers,

Richard

Quoted 1 line
author
#10 lore raw
Quoted 8 lines · On 6/30/2019 5:54 PM, [email protected] wrote:
Quoted 5 lines

/update_pixbuf_cache: cannot create /home//riscv-yocto/build/tmp-glibc/work/qemuriscv64-oe-linux/core- image-full-cmdline/1.0-r0/rootfs/usr/lib/gdk-pixbuf- 2.0/2.10.0/loaders/../loaders.cache:
Directory nonexistent"

Knowing which branches (sumo vs. thud) and which layers does help put a different perspective on this issue and helps us help you!

Sorry, I thought I mentioned this before. Issue showed up in thud. It was not there on sumo.

Quoted 2 lines

Is this a difference in dash shell vs bash shell (e.g. for /bin/sh) on these machines? (if I had to guess that is where I'd start)

Dash vs. bash didn't make a difference. I changed build machine to have /bin/sh point to /bin/bash rather than /bin/dash.

The commit on github also says "it may help" with the postinst. Apparently, the issue has been solved mysteriously for them.

One thing that issue on github mentions is that these issues were being ignored in sumo but are marked as real failures starting from thud.

#11 lore raw
In reply to Sinan Kaya
Quoted 16 lines · Sinan Kaya
Quoted 10 lines · Richard Purdie
Quoted 1 line

What is so special about these?

Put another way, why aren't lots of people seeing failures due to this?

You're obviously doing something differently to everyone else but we're
having a hard time understanding what, or how we'd trigger the problem
you're seeing.

Quoted 4 lines

We're nervous about fixing problems we don't understand, not least as
it potentially means we have a huge hole in our test matrix. Your patches shouldn't be necessary as I understand the codebase either.

Quoted 4 lines

Let's see if we can peel the onion.

Can you explain how it was designed to work for cross compilation use case where host machine architecture != target machine architecture ?

postinst intercepts are there to collect up certain postinst commands and call them once rather than multiple times during rootfs generation.

There are three different cases:

a) Sometimes we can use a native tool. Here, we run the native tool with the knowledge that the output it generates is cross compatible.

b) Sometimes we run target binaries under usermode qemu. In this case the output is target architecture specific and we have no other way to generate the output other than with the target binary

c) We have a cross tool which can run natively but generate target output.

Quoted 7 lines

If I understand this right, all of these postinst intercepts create a native package dependency via inherit foobar.class.

AFAIK, Native packages are built against the host machine architecture not target architecture.

Where are the tools supposed to come from?

It depends which scenario above we're dealing with. Sometimes native recipes are used, sometimes not.

Quoted 8 lines

I can focus on details if my build actually follows the design.

As I said, I do not want these packages on my target machine but we want to run QEMU using the tools that were compiled against target machine in order to execute postinst intercepts.

This issue showed up in thud using core-image-minimal. It was not there on sumo.

The key thing is that these intercept scripts are only run if an image contains packages which use the postinst. If the image contains the postinst, the scripts should run correctly.

In that context your patch is concerning as for example you're saying you can have an image which needs the gio module cache yet it doesn't have ${libexecdir}/${binprefix}gio-querymodules (the target binary needed to be run under qemu to generate it). We'd define that as a bug and you're just hiding the problem with the added conditionals. So on that basis the patch is clearly incorrect and can't be merged as it will hide bugs.

Cheers,

Richard