GNU bug report logs - #75396
[PATCH] gnu: flatpak: Fix icon validation

Previous Next

Package: guix-patches;

Reported by: vasilii.smirnov <at> mailbox.org

Date: Mon, 6 Jan 2025 09:09:02 UTC

Severity: normal

Tags: patch

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 75396 in the body.
You can then email your comments to 75396 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#75396; Package guix-patches. (Mon, 06 Jan 2025 09:09:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to vasilii.smirnov <at> mailbox.org:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Mon, 06 Jan 2025 09:09:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: vasilii.smirnov <at> mailbox.org
To: guix-patches <at> gnu.org
Cc: Vasilii Smirnov <vasilii.smirnov <at> mailbox.org>
Subject: [PATCH] gnu: flatpak: Fix icon validation
Date: Sun,  5 Jan 2025 22:03:00 +0100
From: Vasilii Smirnov <vasilii.smirnov <at> mailbox.org>

* gnu/packages/package-management.scm (flatpak): Substitute a marker in
icon-validator/validate-icon.c for the store location.
* gnu/packages/patches/flatpak-fix-icon-validation.patch: Bind the guix
store during flatpak-validate-icon invocation in sandbox mode, along
with a few environment variables necessary for image format detection.

This fixes the "No such file or directory" error when invoking
flatpak-validate-icon with the --sandbox argument.

Change-Id: I15dfdd0ecadc57ed383e2985c1c3caa36be4a1de
---
 gnu/packages/package-management.scm           |  7 ++++
 .../patches/flatpak-fix-icon-validation.patch | 34 +++++++++++++++++++
 2 files changed, 41 insertions(+)
 create mode 100644 gnu/packages/patches/flatpak-fix-icon-validation.patch

diff --git a/gnu/packages/package-management.scm b/gnu/packages/package-management.scm
index a8b95f450a..663965367c 100644
--- a/gnu/packages/package-management.scm
+++ b/gnu/packages/package-management.scm
@@ -2032,6 +2032,7 @@ (define-public flatpak
        (patches
         (search-patches "flatpak-fix-fonts-icons.patch"
                         "flatpak-fix-path.patch"
+                        "flatpak-fix-icon-validation.patch"
                         "flatpak-unset-gdk-pixbuf-for-sandbox.patch"))))

     ;; Wrap 'flatpak' so that GIO_EXTRA_MODULES is set, thereby allowing GIO to
@@ -2078,6 +2079,12 @@ (define-public flatpak
                   (("if \\(g_find_program_in_path \\(\"p11-kit\"\\)\\)")
                    (string-append "if (g_find_program_in_path (\""
                                   p11-path "\"))"))))))
+          (add-after 'unpack 'fix-icon-validation
+            (lambda* (#:key outputs #:allow-other-keys)
+              (let* ((out (assoc-ref outputs "out"))
+                     (store (dirname out)))
+                (substitute* "icon-validator/validate-icon.c"
+                  (("@storeDir@") store)))))
           ;; Many tests fail for unknown reasons, so we just run a few basic
           ;; tests.
           (replace 'check
diff --git a/gnu/packages/patches/flatpak-fix-icon-validation.patch b/gnu/packages/patches/flatpak-fix-icon-validation.patch
new file mode 100644
index 0000000000..f55f43cf81
--- /dev/null
+++ b/gnu/packages/patches/flatpak-fix-icon-validation.patch
@@ -0,0 +1,34 @@
+diff --git a/icon-validator/validate-icon.c b/icon-validator/validate-icon.c
+index 6c3d152..0d70e55 100644
+--- a/icon-validator/validate-icon.c
++++ b/icon-validator/validate-icon.c
+@@ -163,7 +163,7 @@ rerun_in_sandbox (const char *arg_width,
+                   const char *arg_height,
+                   const char *filename)
+ {
+-  const char * const usrmerged_dirs[] = { "bin", "lib32", "lib64", "lib", "sbin" };
++  const char * const usrmerged_dirs[] = { };
+   int i;
+   g_autoptr(GPtrArray) args = g_ptr_array_new_with_free_func (g_free);
+   char validate_icon[PATH_MAX + 1];
+@@ -183,8 +183,7 @@ rerun_in_sandbox (const char *arg_width,
+             "--unshare-ipc",
+             "--unshare-net",
+             "--unshare-pid",
+-            "--ro-bind", "/usr", "/usr",
+-            "--ro-bind-try", "/etc/ld.so.cache", "/etc/ld.so.cache",
++            "--ro-bind", "@storeDir@", "@storeDir@",
+             "--ro-bind", validate_icon, validate_icon,
+             NULL);
+
+@@ -227,6 +226,10 @@ rerun_in_sandbox (const char *arg_width,
+     add_args (args, "--setenv", "G_MESSAGES_DEBUG", g_getenv ("G_MESSAGES_DEBUG"), NULL);
+   if (g_getenv ("G_MESSAGES_PREFIXED"))
+     add_args (args, "--setenv", "G_MESSAGES_PREFIXED", g_getenv ("G_MESSAGES_PREFIXED"), NULL);
++  if (g_getenv ("GDK_PIXBUF_MODULE_FILE"))
++    add_args (args, "--setenv", "GDK_PIXBUF_MODULE_FILE", g_getenv ("GDK_PIXBUF_MODULE_FILE"), NULL);
++  if (g_getenv ("XDG_DATA_DIRS"))
++    add_args (args, "--setenv", "XDG_DATA_DIRS", g_getenv ("XDG_DATA_DIRS"), NULL);
+
+   add_args (args, validate_icon, arg_width, arg_height, filename, NULL);
+   g_ptr_array_add (args, NULL);

base-commit: b8858d8b1344525d0d7ac78d8fb9dc1a577b85d3
--
2.46.0





Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Sun, 12 Jan 2025 17:53:02 GMT) Full text and rfc822 format available.

Notification sent to vasilii.smirnov <at> mailbox.org:
bug acknowledged by developer. (Sun, 12 Jan 2025 17:53:03 GMT) Full text and rfc822 format available.

Message #10 received at 75396-done <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: vasilii.smirnov <at> mailbox.org
Cc: 75396-done <at> debbugs.gnu.org
Subject: Re: [bug#75396] [PATCH] gnu: flatpak: Fix icon validation
Date: Sun, 12 Jan 2025 18:51:46 +0100
vasilii.smirnov <at> mailbox.org skribis:

> From: Vasilii Smirnov <vasilii.smirnov <at> mailbox.org>
>
> * gnu/packages/package-management.scm (flatpak): Substitute a marker in
> icon-validator/validate-icon.c for the store location.
> * gnu/packages/patches/flatpak-fix-icon-validation.patch: Bind the guix
> store during flatpak-validate-icon invocation in sandbox mode, along
> with a few environment variables necessary for image format detection.
>
> This fixes the "No such file or directory" error when invoking
> flatpak-validate-icon with the --sandbox argument.
>
> Change-Id: I15dfdd0ecadc57ed383e2985c1c3caa36be4a1de

I moved the comment to the top of the patch, as suggested by ‘guix
lint’.

I also added the patch to ‘gnu/local.mk’.

Now applied, thanks!

Ludo’.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 10 Feb 2025 12:24:15 GMT) Full text and rfc822 format available.

This bug report was last modified 132 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.