Source: gnome-disk-utility
Version: 3.30.2-2
Tags: patch upstream
User: helm...@debian.org
Usertags: rebootstrap

gnome-disk-utility fails to cross build from source, because it fails
checking for fallocate. Now, a surprising journey begins. For checking
fallocate, it has a test program that lacks the required "#define
_GNU_SOURCE" and is missing a final "return 0". So the check result is
undefined. It proceeds storing the (undefined) return code in a C macro
HAVE_FALLOCATE and then in the source, it checks whether that macro is
defined. Given that the macro is always defined (with undefined
contents), gnome-disk-utility always compiles support for fallocate.
That's actually a good thing, because it correctly handles -ENOSYS and
-EOPNOTSUPP. I propose simply removing the broken check that never
worked and continuing to unconditionally compile fallocate support. The
attached patch (which only removes code) makes gnome-disk-utility cross
buildable.  Please consider applying it.

Helmut
--- gnome-disk-utility-3.30.2.orig/meson.build
+++ gnome-disk-utility-3.30.2/meson.build
@@ -23,24 +23,6 @@
 config_h.set_quoted('PACKAGE_VERSION', gdu_version)
 config_h.set_quoted('GETTEXT_PACKAGE', gdu_name)
 
-message('Checking for valid fallocate() function')
-
-fallocate_src = '''
-  #include <unistd.h>
-  #include <sys/types.h>
-  #include <linux/falloc.h>
-  #include <fcntl.h>
-  int main() {
-    long ret;
-
-    ret = fallocate(0, FALLOC_FL_KEEP_SIZE, 0xfffffffful, 0xfffffffful);
-    if (ret != 0) {
-      return 1;
-    }
-  };
-'''
-config_h.set('HAVE_FALLOCATE', cc.run(fallocate_src).returncode())
-
 # compiler flags
 compiler_flags = []
 
--- gnome-disk-utility-3.30.2.orig/src/disks/gducreatediskimagedialog.c
+++ gnome-disk-utility-3.30.2/src/disks/gducreatediskimagedialog.c
@@ -733,7 +733,6 @@
   /* If supported, allocate space at once to ensure blocks are laid
    * out contigously, see http://lwn.net/Articles/226710/
    */
-#ifdef HAVE_FALLOCATE
   if (G_IS_FILE_DESCRIPTOR_BASED (data->output_file_stream))
     {
       gint output_fd = g_file_descriptor_based_get_fd (G_FILE_DESCRIPTOR_BASED (data->output_file_stream));
@@ -770,7 +769,6 @@
       g_mutex_unlock (&data->copy_lock);
       g_idle_add (on_update_job, dialog_data_ref (data));
     }
-#endif
 
   page_size = sysconf (_SC_PAGESIZE);
   buffer_unaligned = g_new0 (guchar, buffer_size + page_size);

Reply via email to