From 8f840e10dccc340b721f305ed19130852f75041e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Thu, 14 Nov 2013 21:38:27 +0100 Subject: [PATCH] vm-file-editor: add override for mimeinfo *.png entry (#753) MIME-info database contains multiple entries for *.png, namely image/png and image/x-apple-ios-png. The later one doesn't have associated handler program, but this one is selected by mimeopen tool. Not sure how this tool should behave in case of multiple matches (IOW is it a bug in File::MimeInfo perl module used by mimeopen). Instead of switching to different tool, which probably will break other files (check #423), add override for this particular file type. --- Makefile | 2 ++ misc/mime-globs | 1 + qubes-rpc/vm-file-editor.c | 8 ++++++-- rpm_spec/core-vm.spec | 2 ++ 4 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 misc/mime-globs diff --git a/Makefile b/Makefile index ac0d382..31a7b4b 100644 --- a/Makefile +++ b/Makefile @@ -76,6 +76,8 @@ install-vm: install -D -m 0644 misc/qubes-trigger-sync-appmenus.action $(DESTDIR)/etc/yum/post-actions/qubes-trigger-sync-appmenus.action install -D misc/polkit-1-qubes-allow-all.pkla $(DESTDIR)/etc/polkit-1/localauthority/50-local.d/qubes-allow-all.pkla install -D misc/polkit-1-qubes-allow-all.rules $(DESTDIR)/etc/polkit-1/rules.d/00-qubes-allow-all.rules + install -D -m 0644 misc/mime-globs $(DESTDIR)/usr/share/qubes/mime-override/globs + mkdir -p $(DESTDIR)/usr/lib/qubes if [ -r misc/dispvm-dotfiles.$(DIST).tbz ] ; \ diff --git a/misc/mime-globs b/misc/mime-globs new file mode 100644 index 0000000..2bc7b9d --- /dev/null +++ b/misc/mime-globs @@ -0,0 +1 @@ +image/png:*.png diff --git a/qubes-rpc/vm-file-editor.c b/qubes-rpc/vm-file-editor.c index a4e53df..657d87c 100644 --- a/qubes-rpc/vm-file-editor.c +++ b/qubes-rpc/vm-file-editor.c @@ -8,6 +8,9 @@ #include #include "dvm2.h" +#define USER_HOME "/home/user" +#define MIMEINFO_DATABASES "/usr/share/mime:/usr/local/share:" USER_HOME "/.local/share:/usr/share/qubes/mime-override" + char *gettime() { static char retbuf[60]; @@ -130,9 +133,10 @@ main() dup2(log_fd, 1); close(log_fd); - setenv("HOME", "/home/user", 1); + setenv("HOME", USER_HOME, 1); setenv("DISPLAY", ":0", 1); - execl("/usr/bin/mimeopen", "mimeopen", "-n", filename, (char*)NULL); + execl("/usr/bin/mimeopen", "mimeopen", "-n", + "--database", MIMEINFO_DATABASES, filename, (char*)NULL); perror("execl"); exit(1); default: diff --git a/rpm_spec/core-vm.spec b/rpm_spec/core-vm.spec index 1834f66..567f481 100644 --- a/rpm_spec/core-vm.spec +++ b/rpm_spec/core-vm.spec @@ -334,6 +334,8 @@ rm -f %{name}-%{version} /usr/share/glib-2.0/schemas/org.gnome.settings-daemon.plugins.updates.gschema.override /usr/share/file-manager/actions/qvm-copy-gnome.desktop /usr/share/file-manager/actions/qvm-dvm-gnome.desktop +%dir /usr/share/qubes +/usr/share/qubes/mime-override/globs %dir /home_volatile %attr(700,user,user) /home_volatile/user %dir /mnt/removable