diff mbox

gnome-tweak-tool tweaks

Message ID 871t42kxcb.fsf@gnu.org
State New
Headers show

Commit Message

Ludovic Courtès June 12, 2016, 7:42 p.m. UTC
iyzsong@member.fsf.org (宋文武) skribis:

> ludo@gnu.org (Ludovic Courtès) writes:
>> [...]
>>> I/O error : Permission denied
>>> I/O error : Permission denied
>>> Failed to write XML file; For permission problems, try rerunning as root
>> I found that string comes from ‘shared-mime-info’, which is itself used
>> by the ‘xdg-mime-database’ hook in (guix profiles) (a hook that runs
>> when the profile is created to update the MIME database):
>> static gboolean save_xml_file(xmlDocPtr doc, const gchar *filename, GError **error)
>> {
>> #if LIBXML_VERSION > 20400
>> 	if (xmlSaveFormatFileEnc(filename, doc, "utf-8", 1) < 0)
>> 	{
>> 		g_set_error(error, G_FILE_ERROR, G_FILE_ERROR_FAILED,
>> 			    "Failed to write XML file; For permission problems, try rerunning as root");
>> 		return FALSE;
>> 	}
>> #else
>> 宋文武: any idea what the problem might be?  Perhaps
>> ‘update-mime-database’ is trying to write to /gnu/store/…-something?
> Yep, it happends when '$out/share/mime/application' is not writable.
> The xml files under 'application' are going to be generated by
> update-mime-database, and the shared-mime-info package has it
> pre-generated, so after union "share/mime", an un-writable 'application'
> directory point to the store will cause the problem.
> Commit 359f06aa fix this by union the "share/mime/packages" directory.

OK, thanks for the quick (brown?) fix!

>> Also, it’s a problem that ‘update-mime-database’ returns 0 here, as
>> seems to be the case.
> It returns 256 here for the problem, but the derivation still built and
> profile got updated, I have no idea about this :-
> Does a failing hook (returns #f) supposed to top the profile update?

I thought it did, but it doesn’t:

  (gexp->derivation "foo" #~(begin (mkdir #$output) #f))

leads a derivation that succeeds, contrary to

To avoid that, we need an explicit (exit #f).

For now I prefer to address it at every call site (patch below) instead
of adding some magic to ‘gexp->derivation’, which would be hard to do in
a hygienic way.

diff mbox


--- a/guix/profiles.scm
+++ b/guix/profiles.scm
@@ -510,9 +510,9 @@  MANIFEST."
                     info (string-append #$output "/share/info/dir"))))
         (mkdir-p (string-append #$output "/share/info"))
-        (every install-info
+        (exit (every install-info
                      (append-map info-files
-                           '#$(manifest-inputs manifest)))))
+                                 '#$(manifest-inputs manifest))))))
   (gexp->derivation "info-dir" build
                     #:modules '((guix build utils))
@@ -562,7 +562,7 @@  entries of MANIFEST, or #f if MANIFEST does not have any GHC packages."
                 (system* (string-append #+ghc "/bin/ghc-pkg") "recache"
                          (string-append "--package-db=" db-dir)))))
           (for-each delete-file (find-files db-dir "\\.conf$"))
-          success)))
+          (exit success))))
   (with-monad %store-monad
     ;; Don't depend on GHC when there's nothing to do.
@@ -710,7 +710,7 @@  MIME type."
             (mkdir-p (string-append #$output "/share"))
             (union-build destdir appdirs
                          #:log-port (%make-void-port "w"))
-            (zero? (system* update-desktop-database destdir)))))
+            (exit (zero? (system* update-desktop-database destdir))))))
     ;; Don't run the hook when 'desktop-file-utils' is not referenced.
     (if desktop-file-utils
@@ -745,7 +745,7 @@  entries.  It's used to query the MIME type of a given file."
             (union-build (string-append destdir "/packages") pkgdirs
                          #:log-port (%make-void-port "w"))
             (setenv "XDG_DATA_HOME" datadir)
-            (zero? (system* update-mime-database destdir)))))
+            (exit (zero? (system* update-mime-database destdir))))))
     ;; Don't run the hook when 'shared-mime-info' is referenced.
     (if shared-mime-info