[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#909436: marked as done (libdrm: FTBFS on hurd-i386)



Your message dated Tue, 10 Nov 2020 18:03:58 +0000
with message-id <E1kcXzq-0002yk-KB@fasolo.debian.org>
and subject line Bug#909436: fixed in libdrm 2.4.103-1
has caused the Debian Bug report #909436,
regarding libdrm: FTBFS on hurd-i386
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
909436: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=909436
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Source: libdrm
Version: 2.4.94-1
Severity: important
Tags: ftbfs, patch
User: debian-hurd@lists.debian.org
Usertags: hurd

Hello,

Currently libdrm FTBFS on GNU/Hurd due to a missing case in
include/drm/drm.h. Attached is a patch, hurd-port.diff, to fix this and
fixes for PATH_MAX issues in in xf86dri.c and include+defines for GNU
in xf86dri.h.

Additionally the patches debian_rules.diff and debian_control.diff adds
Hurd to the architecture list.

Thanks!
--- a/debian/control	2018-09-16 23:01:56.000000000 +0200
+++ b/debian/control	2018-09-16 23:03:11.000000000 +0200
@@ -13,7 +13,7 @@
  libudev-dev [linux-any],
  libpciaccess-dev,
  valgrind [amd64 armhf i386 mips mipsel powerpc s390x],
- libbsd-dev [kfreebsd-any],
+ libbsd-dev [kfreebsd-any hurd-any],
 Standards-Version: 4.1.4
 Section: libs
 Vcs-Git: https://salsa.debian.org/xorg-team/lib/libdrm
@@ -22,10 +22,10 @@
 
 Package: libdrm-dev
 Section: libdevel
-Architecture: linux-any kfreebsd-any
+Architecture: linux-any kfreebsd-any hurd-any
 Depends:
  libdrm2 (= ${binary:Version}),
- libdrm-intel1 (= ${binary:Version}) [amd64 i386 kfreebsd-amd64 kfreebsd-i386 x32],
+ libdrm-intel1 (= ${binary:Version}) [amd64 i386 kfreebsd-amd64 kfreebsd-i386 hurd-i386 x32],
  libdrm-radeon1 (= ${binary:Version}),
  libdrm-nouveau2 (= ${binary:Version}) [linux-any],
  libdrm-amdgpu1 (= ${binary:Version}),
@@ -46,7 +46,7 @@
  This package provides the development environment for libdrm.
 
 Package: libdrm2
-Architecture: linux-any kfreebsd-any
+Architecture: linux-any kfreebsd-any hurd-any
 Depends:
  libdrm-common (>= ${source:Version}),
  ${shlibs:Depends},
@@ -80,7 +80,7 @@
 Package: libdrm2-udeb
 Package-Type: udeb
 Section: debian-installer
-Architecture: linux-any kfreebsd-any
+Architecture: linux-any kfreebsd-any hurd-any
 Depends:
  ${shlibs:Depends},
  ${misc:Depends},
@@ -88,7 +88,7 @@
  This is a udeb, or a microdeb, for the debian-installer.
 
 Package: libdrm-intel1
-Architecture: amd64 i386 kfreebsd-amd64 kfreebsd-i386 x32
+Architecture: amd64 i386 kfreebsd-amd64 kfreebsd-i386 hurd-i386 x32
 Depends:
  ${shlibs:Depends},
  ${misc:Depends},
@@ -115,7 +115,7 @@
  OpenGL drivers.
 
 Package: libdrm-radeon1
-Architecture: linux-any kfreebsd-any
+Architecture: linux-any kfreebsd-any hurd-any
 Depends:
  ${shlibs:Depends},
  ${misc:Depends},
@@ -185,7 +185,7 @@
  OpenGL drivers.
 
 Package: libdrm-amdgpu1
-Architecture: linux-any kfreebsd-any
+Architecture: linux-any kfreebsd-any hurd-any
 Depends:
  ${shlibs:Depends},
  ${misc:Depends},
--- a/debian/rules	2018-08-31 15:01:29.000000000 +0200
+++ b/debian/rules	2018-09-01 00:16:08.000000000 +0200
@@ -33,7 +33,7 @@
 
 # Intel is only on x86:
 ifneq (,$(filter amd64 i386,$(DEB_HOST_ARCH_CPU)))
-ifneq (,$(filter linux kfreebsd,$(DEB_HOST_ARCH_OS)))
+ifneq (,$(filter linux kfreebsd hurd,$(DEB_HOST_ARCH_OS)))
 	INTEL = yes
 endif
 endif
Index: libdrm-2.4.94/include/drm/drm.h
===================================================================
--- libdrm-2.4.94.orig/include/drm/drm.h
+++ libdrm-2.4.94/include/drm/drm.h
@@ -57,6 +57,22 @@ typedef __uint64_t __u64;
 typedef size_t   __kernel_size_t;
 typedef unsigned long drm_handle_t;
 
+#elif defined(__GNU__)
+
+#include <sys/types.h>
+#include <sys/ioctl.h>
+#include <mach/i386/ioccom.h>
+typedef __int8_t   __s8;
+typedef __uint8_t  __u8;
+typedef __int16_t  __s16;
+typedef __uint16_t __u16;
+typedef __int32_t  __s32;
+typedef __uint32_t __u32;
+typedef __int64_t  __s64;
+typedef __uint64_t __u64;
+typedef size_t   __kernel_size_t;
+typedef unsigned int drm_handle_t;
+
 #else /* One of the BSDs */
 
 #include <sys/ioccom.h>
Index: libdrm-2.4.94/xf86drm.h
===================================================================
--- libdrm-2.4.94.orig/xf86drm.h
+++ libdrm-2.4.94/xf86drm.h
@@ -56,6 +56,16 @@ extern "C" {
 #define DRM_IOC_READWRITE	_IOC_READ|_IOC_WRITE
 #define DRM_IOC(dir, group, nr, size) _IOC(dir, group, nr, size)
 
+#elif defined(__GNU__)
+#include <mach/port.h>
+#include <hurd/ioctl.h>
+#define DRM_IOCTL_NR(n)         ((n) & 0xff)
+#define DRM_IOC_VOID            IOC_VOID
+#define DRM_IOC_READ            IOC_OUT
+#define DRM_IOC_WRITE           IOC_IN
+#define DRM_IOC_READWRITE       IOC_INOUT
+#define DRM_IOC(dir, group, nr, size) _IOC(dir, group, nr, size)
+
 #else /* One of the *BSDs */
 
 #include <sys/ioccom.h>
Index: libdrm-2.4.94/xf86drm.c
===================================================================
--- libdrm-2.4.94.orig/xf86drm.c
+++ libdrm-2.4.94/xf86drm.c
@@ -2860,7 +2860,8 @@ static char *drmGetMinorNameForFD(int fd
     return NULL;
 #else
     struct stat sbuf;
-    char buf[PATH_MAX + 1];
+    char *buf = NULL;
+    int len = 0;
     const char *dev_name;
     unsigned int maj, min;
     int n, base;
@@ -2892,11 +2893,18 @@ static char *drmGetMinorNameForFD(int fd
     if (base < 0)
         return NULL;
 
-    n = snprintf(buf, sizeof(buf), dev_name, DRM_DIR_NAME, min - base);
-    if (n == -1 || n >= sizeof(buf))
+    len = snprintf(NULL, 0, dev_name, DRM_DIR_NAME, min - base);
+    if (len < 0)
         return NULL;
+    len++;
+    buf = malloc(len);
+    n = snprintf(buf, len, dev_name, DRM_DIR_NAME, min - base);
+    if (n == -1 || n >= len) {
+        free(buf);
+        return NULL;
+    }
 
-    return strdup(buf);
+    return buf;
 #endif
 }
 
@@ -3001,16 +3009,29 @@ static int drmParseSubsystemType(int maj
 static char *
 get_real_pci_path(int maj, int min, char *real_path)
 {
-    char path[PATH_MAX + 1], *term;
+    char *path = NULL, *term;
+    int len = 0, n;
 
-    snprintf(path, sizeof(path), "/sys/dev/char/%d:%d/device", maj, min);
-    if (!realpath(path, real_path))
+    len = snprintf(NULL, 0, "/sys/dev/char/%d:%d/device", maj, min);
+    if (len < 0)
+        return NULL;
+    len++;
+    path = malloc(len);
+    n = snprintf(path, len, "/sys/dev/char/%d:%d/device", maj, min);
+    if (n == -1 || n >= len) {
+        free(path);
         return NULL;
+    }
+    if (!realpath(path, real_path)) {
+        free(path);
+        return NULL;
+    }
 
     term = strrchr(real_path, '/');
     if (term && strncmp(term, "/virtio", 7) == 0)
         *term = 0;
 
+    free(path);
     return real_path;
 }
 
@@ -3710,17 +3731,30 @@ process_device(drmDevicePtr *device, con
                bool fetch_deviceinfo, uint32_t flags)
 {
     struct stat sbuf;
-    char node[PATH_MAX + 1];
+    char *node = NULL;
     int node_type, subsystem_type;
+    int len = 0, n, ret = 0;
     unsigned int maj, min;
 
     node_type = drmGetNodeType(d_name);
     if (node_type < 0)
         return -1;
 
-    snprintf(node, PATH_MAX, "%s/%s", DRM_DIR_NAME, d_name);
-    if (stat(node, &sbuf))
+    len = snprintf(NULL, 0, "%s/%s", DRM_DIR_NAME, d_name);
+    if (len < 0)
+      return -1;
+    len++;
+    node = malloc(len);
+    n = snprintf(node, len, "%s/%s", DRM_DIR_NAME, d_name);
+    if (n == -1 || n >= len) {
+        free(node);
         return -1;
+    }
+
+    if (stat(node, &sbuf)) {
+        free(node);
+        return -1;
+    }
 
     maj = major(sbuf.st_rdev);
     min = minor(sbuf.st_rdev);
@@ -3735,18 +3769,27 @@ process_device(drmDevicePtr *device, con
     switch (subsystem_type) {
     case DRM_BUS_PCI:
     case DRM_BUS_VIRTIO:
-        return drmProcessPciDevice(device, node, node_type, maj, min,
+        ret = drmProcessPciDevice(device, node, node_type, maj, min,
                                    fetch_deviceinfo, flags);
+	free(node);
+	return ret;
     case DRM_BUS_USB:
-        return drmProcessUsbDevice(device, node, node_type, maj, min,
+        ret = drmProcessUsbDevice(device, node, node_type, maj, min,
                                    fetch_deviceinfo, flags);
+	free(node);
+	return ret;
     case DRM_BUS_PLATFORM:
-        return drmProcessPlatformDevice(device, node, node_type, maj, min,
+        ret = drmProcessPlatformDevice(device, node, node_type, maj, min,
                                         fetch_deviceinfo, flags);
+	free(node);
+	return ret;
     case DRM_BUS_HOST1X:
-        return drmProcessHost1xDevice(device, node, node_type, maj, min,
+        ret = drmProcessHost1xDevice(device, node, node_type, maj, min,
                                       fetch_deviceinfo, flags);
+	free(node);
+	return ret;
     default:
+        free(node);
         return -1;
    }
 }
@@ -4080,10 +4123,10 @@ char *drmGetDeviceNameFromFd2(int fd)
     return strdup(path);
 #else
     struct stat      sbuf;
-    char             node[PATH_MAX + 1];
+    char            *node = NULL;
     const char      *dev_name;
     int              node_type;
-    int              maj, min, n, base;
+    int              maj, min, n, base, len = 0;
 
     if (fstat(fd, &sbuf))
         return NULL;
@@ -4116,11 +4159,16 @@ char *drmGetDeviceNameFromFd2(int fd)
     if (base < 0)
         return NULL;
 
-    n = snprintf(node, PATH_MAX, dev_name, DRM_DIR_NAME, min - base);
-    if (n == -1 || n >= PATH_MAX)
+    len = snprintf(NULL, 0, dev_name, DRM_DIR_NAME, min - base);
+    if (len < 0)
+      return NULL;
+    len++;
+    node = malloc(len);
+    n = snprintf(node, len, dev_name, DRM_DIR_NAME, min - base);
+    if (n == -1 || n >= len)
       return NULL;
 
-    return strdup(node);
+    return node;
 #endif
 }
 

--- End Message ---
--- Begin Message ---
Source: libdrm
Source-Version: 2.4.103-1
Done: Timo Aaltonen <tjaalton@debian.org>

We believe that the bug you reported is fixed in the latest version of
libdrm, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 909436@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Timo Aaltonen <tjaalton@debian.org> (supplier of updated libdrm package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@ftp-master.debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Format: 1.8
Date: Tue, 10 Nov 2020 19:51:20 +0200
Source: libdrm
Architecture: source
Version: 2.4.103-1
Distribution: unstable
Urgency: medium
Maintainer: Debian X Strike Force <debian-x@lists.debian.org>
Changed-By: Timo Aaltonen <tjaalton@debian.org>
Closes: 909436 970304
Changes:
 libdrm (2.4.103-1) unstable; urgency=medium
 .
   * New upstream release. (Closes: #970304)
   * control, rules, hurd-port.diff: Add support for Hurd. (Closes:
     #909436)
Checksums-Sha1:
 49f95a424ad26daeb60293cbca386cb174f71059 3326 libdrm_2.4.103-1.dsc
 7583f6c48fca590cbf813e6d92bc4d26f7f4e0ee 412796 libdrm_2.4.103.orig.tar.xz
 b072ee945f648eb9462c927bbded31291fe6e855 833 libdrm_2.4.103.orig.tar.xz.asc
 5e6d56ee7baf0b7fc51ebb077b93cb9811cc4c7c 54832 libdrm_2.4.103-1.debian.tar.xz
 ecb02b98684c3fded6c642d498d9a45fa73d30b9 8219 libdrm_2.4.103-1_source.buildinfo
Checksums-Sha256:
 7580d383c04f83ee1f03e4dc1e9de7331517b2d195bce62186d1c0d7a44c02b4 3326 libdrm_2.4.103-1.dsc
 3fe0affdba6460166a7323290c18cf68e9b59edcb520722826cb244e9cb50222 412796 libdrm_2.4.103.orig.tar.xz
 b15719eb4943fed298dfe94eb8192c183ca4771d07c3eb55be494b73d47a9178 833 libdrm_2.4.103.orig.tar.xz.asc
 057cce20c8d9227a3c0b69b8af156046261bf126eae5e89db3b78790e3d866e2 54832 libdrm_2.4.103-1.debian.tar.xz
 c14c7842399c284f22eb7d766a93a760cf02a457f7d0734143f201b435eac357 8219 libdrm_2.4.103-1_source.buildinfo
Files:
 a1e06e9101d14e09c08bb9b9c342a45e 3326 libs optional libdrm_2.4.103-1.dsc
 002e4e06e7f23fadc2ec6dbd03f3d1ee 412796 libs optional libdrm_2.4.103.orig.tar.xz
 7cef30fe10e154268b54552bc984a15a 833 libs optional libdrm_2.4.103.orig.tar.xz.asc
 d2e48b6b0aa32eacb0f1f3b33bdebebe 54832 libs optional libdrm_2.4.103-1.debian.tar.xz
 f81b95bca19c96571374529b8e4d6c17 8219 libs optional libdrm_2.4.103-1_source.buildinfo

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEdS3ifE3rFwGbS2Yjy3AxZaiJhNwFAl+q02EACgkQy3AxZaiJ
hNxW/w//VIE4gR9c8Nci0aYsDqACXPMpNiong2bMjTvNJ4Hlm/Pp1hZqhntPNK90
opYEAN5KpgzhMDwy44Ea6rnPb3wJqMvr+wXBQxa4hykgX/2CofzVwtJ/qiSP5B3j
1vZs8UhHGZOrrrHu4VYat9V6AOqBwq5EKjd0gIvIWh9LLfD3Z4e7k4VZsb5M9MU0
T0qqTpesu4/c0OW6yRAkqLO5jWEePuiKsSP84LzjclGyChivBHYCHi14Q4IGByzB
tkgYGgn8CycvYuzz434UN/JEQn4b/6WMs+/3OWwGSYZ0ZbVzL0ofUijUE/8mcZY1
zz22x3gzFIHjLcOj0K7cUCQxWhT2Uw7TmWYmb0yNAkUOWTBLgjtUp73RfCFKHGvj
KlWKXLa9Sq7NEx6pPNYbO24kPrJSS38inPwzPx6YOPDsprPGvJBL3Iqv0ebIZZQJ
lFL/pXK2yGvNV9wrfGIrSS+PenH1jOg1uhm4ESud/MvWPML0V0va0jUXRZp8KzIY
90GvGShwofTWchhr1THWvuXc/ORXV2wIPj7HzSZx5WioWEJ1DRp5kz68ya1l/+/c
ak/dStVtwP4ai+ETXDobKlEOfxSvHro2vspuopaxTb6jiB8L7KZbr9LplRdbJ9aK
ZtX+eZxA3j2LZ8HWAT5iHeJ/n2zpRtdBDXPwlDdVUALvbwum63Y=
=+b/X
-----END PGP SIGNATURE-----

--- End Message ---

Reply to: