AppImageCrafters / appimage-builder

GNU/Linux packaging solution using the AppImage format
MIT License
316 stars 58 forks source link

Host configuration leaks into gdk-pixbuf loaders.conf file #277

Closed goldstar611 closed 1 year ago

goldstar611 commented 1 year ago

I have a gtk2.0 app that I am trying to debug an issue where gdk-pixbuf loader support for png and jpeg files are missing in my app. This manifests itself as missing icons in the app.

I used auditd to track which process is creating the loaders.cache file and it appears to be appimagebuilder.

Here is what I know:

My theory is that AppImage Builder is using the host gdk-pixbuf-query-loaders utility and that binary is searching the available host loaders and writing that file into my AppImage instead of searching the available loaders from AppDir.

P.S. Is there a way to get the "arch triplet" during build time? i.e. "i386-linux-gnu"

I'll work on a minimal test case.

[Edit] Copying my own loaders.cache file as a after_bundle step doesn't work because the loaders.cache file is updated after the after_bundle step. So this is a blocker for my app

goldstar611 commented 1 year ago

Reproduction script, please run appimage-builder on Ubuntu 22.04 OS

version: 1

script:
  - rm -rf AppDir  | true

AppDir:
  path: ./AppDir

  app_info:
    id: com.github.appimage-builder
    name: issue-277
    icon: utilities-terminal
    version: "1"
    exec: bin/bash

  apt:
    arch: amd64
    sources:
      - sourceline: deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ bionic main
        key_url: http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3b4fe6acc0b21f32

    include:
      - bash
      - gnome-themes-extra

AppImage:
  sign-key: None
  arch: x86_64

You should see the following files (plus others)

Inside ./AppDir/usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/2.10.0/loaders.cache you will see that there is no reference to libpixbufloader-png.so or libpixbufloader-jpeg.so

goldstar611 commented 1 year ago

Found it, this is intentional and working as designed. I still think we should have a chance to override the output of this step. It runs very late in the build process

WARNING:root:gdk-pixbuf-query-loaders cannot generate cache from modules of a different version or architecture. Therefore it will be ran using thesystem modules and the output will be *adapted* to the AppDir.

https://github.com/AppImageCrafters/appimage-builder/blob/3d03fcff747af4fb70a3755d19a4e0ac9cf1c8c1/appimagebuilder/modules/setup/apprun_3/helpers/gdk_pixbuf.py#L39

https://github.com/AppImageCrafters/appimage-builder/blob/68b384420d729660438adc71674d0954ee535c47/appimagebuilder/modules/setup/helpers/gdk_pixbuf.py#L42