Package: nvme-cli
Version: 0.8-1
Severity: serious
Tags: patch
Justification: FTBFS
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu yakkety ubuntu-patch

Hi Breno,

After syncing nvme-cli 0.8-1 into Ubuntu yakkety, I noticed that it has
failed to build on all of our 32-bit architectures, with a common error:

  cc -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -g -O2 -fPIE 
-fstack-protector-strong -Wformat -Werror=format-security -std=gnu99 -O2 -g 
-Wall -Werror -DLIBUDEV_EXISTS -DNVME_VERSION='"0.8"' -c intel-nvme.c
  intel-nvme.c: In function ‘get_internal_log’:
  intel-nvme.c:310:13: error: cast from pointer to integer of different size 
[-Werror=pointer-to-int-cast]
    cmd.addr = (__u64)(void *)buf;
               ^
  cc1: all warnings being treated as errors
  Makefile:44: recipe for target 'intel-nvme.o' failed

I've applied the attached patch in Ubuntu to address this.  Please consider
applying this patch in Debian as well, and forward upstream as necessary.

Thanks,
-- 
Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
Ubuntu Developer                                    http://www.debian.org/
slanga...@ubuntu.com                                     vor...@debian.org
diff -Nru nvme-cli-0.8/debian/patches/32-bit-compatibility.patch nvme-cli-0.8/debian/patches/32-bit-compatibility.patch
--- nvme-cli-0.8/debian/patches/32-bit-compatibility.patch	1969-12-31 16:00:00.000000000 -0800
+++ nvme-cli-0.8/debian/patches/32-bit-compatibility.patch	2016-07-08 14:34:09.000000000 -0700
@@ -0,0 +1,28 @@
+Author: Steve Langasek <steve.langa...@ubuntu.com>
+Description: Fix compatibility with 32-bit systems
+ nvme-cli is failing to build on 32-bit systems with this error:
+ cc -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -g -O2 -fPIE -fstack-protector-strong -Wformat -Werror=format-security -std=gnu99 -O2 -g -Wall -Werror -DLIBUDEV_EXISTS -DNVME_VERSION='"0.8"' -c intel-nvme.c
+ intel-nvme.c: In function ‘get_internal_log’:
+ intel-nvme.c:310:13: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
+  cmd.addr = (__u64)(void *)buf;
+             ^
+ cc1: all warnings being treated as errors
+ .
+ cmd.addr is defined as __u64 on all architectures, but a pointer is not
+ always 64-bit, making this an error.  Cast to 'unsigned long' instead,
+ which is safe on all supported architectures, and let the compiler take it
+ from there.
+
+Index: nvme-cli-0.8/intel-nvme.c
+===================================================================
+--- nvme-cli-0.8.orig/intel-nvme.c
++++ nvme-cli-0.8/intel-nvme.c
+@@ -307,7 +307,7 @@
+ 	cmd.cdw10 = 0x400;
+ 	cmd.cdw12 = cfg.log;
+ 	cmd.data_len = 0x1000;
+-	cmd.addr = (__u64)(void *)buf;
++	cmd.addr = (unsigned long)(void *)buf;
+ 
+ 	memset(buf, 0, sizeof(buf));
+ 	err = nvme_submit_passthru(fd, NVME_IOCTL_ADMIN_CMD, &cmd);
diff -Nru nvme-cli-0.8/debian/patches/series nvme-cli-0.8/debian/patches/series
--- nvme-cli-0.8/debian/patches/series	2016-07-03 07:44:08.000000000 -0700
+++ nvme-cli-0.8/debian/patches/series	2016-07-08 14:16:36.000000000 -0700
@@ -1,2 +1,3 @@
 0001-Making-cast-explict.patch
 0002-Fix-bash-completion-directory.patch
+32-bit-compatibility.patch

Reply via email to