Public bug reported:

This bug is related to https://bugs.launchpad.net/ubuntu/+source/gnome-
desktop3/+bug/1795668 and to the question in Ubuntu Stackexchange
https://askubuntu.com/questions/1088539/custom-thumbnailers-don-t-work-
on-ubuntu-18-10-and-18-04

The recent hardening on thumbnailers by using bubblewrap is causing a
problem with user-installed thumbnailers. Consider this (for example)
thumbnailer to add a small Dilbert icon to the GIMP .xcf files:


#!/bin/bash

tmpfile1=$(tempfile --directory /tmp --prefix xcft --suffix .png)
trap 'rm -rf $tmpfile1' INT EXIT TERM

die() {
  echo >&2 "$@"
  rm -rf $tmpfile1
  exit 1
}
 
# The script will be called with parameters : -s %s %u %o
# -s %s: vertical size,  %u: input url, %o: output file

if [ $1 = "-s" ]; then 
   size=$2
   uin=$3
   fout=$4
else
   size=32 #default size
   uin=$1
   fout=$2
fi

# uin es una url, eliminar "file://"
fin="${uin#file://*}"

/usr/bin/gnome-xcf-thumbnailer -s $size "$fin" $tmpfile1 || die 
"gnome-xcf-thumbnailer failed"
/usr/bin/composite-im6.q16  -gravity southeast  \
   \(  -resize $((size/2))x$((size/2)) /usr/share/gimp/2.0/images/wilber.png \) 
\
   \( -resize $sizex$size $tmpfile1 \)  "$fout" || die "convert failed"

rm -rf $tmpfile1
exit 0

It used to work before the last update to use bubblewrap, and now
doesn't work anymore. I tried to dig into https://github.com/GNOME
/gnome-desktop/blob/master/libgnome-desktop/gnome-desktop-thumbnail-
script.c to see what happens, and I concluded that the "reinforced"
thumbnail generator do this:

mkdir /tmp/temporary

bwrap --ro-bind /usr /usr \
    --ro-bind /etc/ld.so.cache /etc/ld.so.cache \
    --ro-bind /bin /bin \
    --ro-bind /lib64 /lib64 \
    --ro-bind /lib /lib \
    --ro-bind /sbin /sbin \
    --proc /proc  \
    --dev   /dev  \
    --chdir   /  \
    --setenv   GIO_USE_VFS   local  \
    --unshare-all  \
    --die-with-parent  \
    --bind /tmp/temporary /tmp \
    --ro-bind /home/romano/software/thumbnailers/test/rgttiwm.xcf  
/tmp/gnome-desktop-file-to-thumbnail.xcf  \
    /usr/bin/xcf-thumb -s 128 file:///tmp/gnome-desktop-file-to-thumbnail.xcf 
/tmp/gnome-desktop-thumbnailer.png
    #
cp /tmp/temporary/gnome-desktop-thumbnailer.png test.png

...and this way, my thumbnailer did succeed in creating the PNG with the
correct preview. But when called internally by gnome, it fails, and
creates a strange "~/.cache/thumbnailer/fail" file containing the
following:

�PNG

IHDRĉd�EtEXtThumb::URIfile:///home/romano/software/thumbnailers/test/rgttiwm.xcf����tEXtThumb::MTime1380735765�y�O
 tEXtSoftwareGNOME::ThumbnailFactoryo 
[...]

** Affects: gnome-desktop3 (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: bubblewrap thumbnails

-- 
You received this bug notification because you are a member of Ubuntu
Desktop Bugs, which is subscribed to gnome-desktop3 in Ubuntu.
https://bugs.launchpad.net/bugs/1808702

Title:
  Bubblewrap integration broke user thumbnailers

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/gnome-desktop3/+bug/1808702/+subscriptions

-- 
desktop-bugs mailing list
desktop-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/desktop-bugs

Reply via email to