In short, gtk-query-immodules-* can fail at runtime and its exit status should be checked before truncating immodules.cache. Please use something like this (this is the gtk-3.0 version!): gtk_query_immodules_3() { local gtk_conf="${1}" local gtk_conf_dir=$(dirname "${gtk_conf}") einfo "Generating Gtk3 immodules/gdk-pixbuf loaders listing:" einfo "-> ${gtk_conf}" mkdir -p "${gtk_conf_dir}" local tmp_file=$(mktemp -t tmp.XXXXXXXXXXgtk_query_immodules) if [ -z "${tmp_file}" ]; then ewarn "gtk_query_immodules: cannot create temporary file" return 1 fi if gtk-query-immodules-3.0 > "${tmp_file}"; then cat "${tmp_file}" > "${gtk_conf}" || \ ewarn "Failed to write to ${gtk_conf}" else ewarn "Cannot update gtk.immodules, file generation failed" fi rm "${tmp_file}" } Reproducible: Always
If we want to be 100% paranoid, we should also make "cat" atomic, but I think it's overkill.
Seems "/usr/bin/gtk-query-immodules-3.0 --update-cache" do this properly. It create /usr/lib64/gtk-3.0/3.0.0/immodules.cache.XXXXXX
Does this report still apply to current eclass ?
21 Jun 2012; Naohiro Aota <naota@gentoo.org> gnome2-utils.eclass: Add new function gnome2_query_immodules_gtk{2,3} to update immodules cache. #413529