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

Bug#737580: ufsutils-udeb: mkfs.ufs: DIOCGMEDIASIZE: Inappropriate ioctl for device



Robert Millan <rmh@debian.org> (2014-03-08):
> On 08/03/2014 12:06, Cyril Brulebois wrote:
> > That said, building ufsutils in sid led me to a FTBFS due to missing
> > <libutil.h>; two solutions: either add a build-dep on libutil-freebsd-dev
> > which ships it under /usr/include; or adjust 3 files to #include
> > <bsd/libutil.h> instead. I haven't seen a difference in dependencies for
> > both cases. Which one do you want?
> 
> B-D please. There's no reason not to use the real libutil directly
> now that we have it.

Alright, filed #741088 for reference, and attaching the new source
debdiff to both reports.

Mraw,
KiBi.
diff -Nru ufsutils-9.2/debian/changelog ufsutils-9.2/debian/changelog
--- ufsutils-9.2/debian/changelog	2013-11-30 12:56:40.000000000 +0100
+++ ufsutils-9.2/debian/changelog	2014-03-08 14:02:58.000000000 +0100
@@ -1,3 +1,14 @@
+ufsutils (9.2-3.1) unstable; urgency=high
+
+  * Non-maintainer upload.
+  * Steal the following patch from the 10 branch, fixing failures to run
+    mkfs.ufs, notably from d-i (Closes: #737580):
+    05_wipe_otherfs.patch: Handle DIOCGMEDIASIZE failure gracefully.
+  * Fix FTBFS due to missing <libutil.h> by adding a libutil-freebsd-dev
+    build-dep (Closes: #741088).
+
+ -- Cyril Brulebois <kibi@debian.org>  Sat, 08 Mar 2014 14:02:51 +0100
+
 ufsutils (9.2-3) unstable; urgency=low
 
   * Bump kfreebsd-kernel-headers B-D to 9.2~5.
diff -Nru ufsutils-9.2/debian/control ufsutils-9.2/debian/control
--- ufsutils-9.2/debian/control	2013-11-29 16:22:34.000000000 +0100
+++ ufsutils-9.2/debian/control	2014-03-08 13:56:49.000000000 +0100
@@ -9,6 +9,7 @@
  freebsd-glue (>= 0.1.12~),
  libbsd-dev (>= 0.3.0),
  libedit-dev,
+ libutil-freebsd-dev,
 Vcs-Browser: http://anonscm.debian.org/viewvc/glibc-bsd/trunk/ufsutils/
 Vcs-Svn: svn://anonscm.debian.org/glibc-bsd/trunk/ufsutils/
 Standards-Version: 3.9.2
diff -Nru ufsutils-9.2/debian/patches/05_wipe_otherfs.patch ufsutils-9.2/debian/patches/05_wipe_otherfs.patch
--- ufsutils-9.2/debian/patches/05_wipe_otherfs.patch	2013-10-26 16:17:34.000000000 +0200
+++ ufsutils-9.2/debian/patches/05_wipe_otherfs.patch	2014-03-08 12:55:47.000000000 +0100
@@ -8,27 +8,31 @@
  #include <sys/mman.h>
  #include <sys/resource.h>
  #include <sys/stat.h>
-@@ -531,6 +532,24 @@
+@@ -531,6 +532,28 @@
  			}
  		}
  	}
 +	/* Wipe out other file systems. For now we erase first and last 512 kiB
 +	 * (this works for at least UFS1 and ZFS). */
 +	if (!Eflag && !Nflag) {
-+		off_t mediasize;
-+		if (!ioctl(disk.d_fd, DIOCGMEDIASIZE, &mediasize))
-+			err(1, "DIOCGMEDIASIZE");
++		off_t mediasize = 0;
++
 +		printf("Erasing sectors [%jd...%jd]\n",
 +			sblock.fs_sblockloc / disk.d_bsize,
 +			fsbtodb(&sblock, sblock.fs_size) - 1);
 +		berase(&disk, sblock.fs_sblockloc / disk.d_bsize,
 +			1024 * disk.d_bsize - sblock.fs_sblockloc);
 +
-+		printf("Erasing sectors [%jd...%jd]\n",
-+			(mediasize - 1024 * 512) / disk.d_bsize,
-+			(mediasize / disk.d_bsize) - 1);
-+		berase(&disk, (mediasize - 1024 * 512) / disk.d_bsize,
-+			1024 * 512);
++		if (!ioctl(disk.d_fd, DIOCGMEDIASIZE, &mediasize))
++			warn("DIOCGMEDIASIZE");
++
++		if (mediasize) {
++			printf("Erasing sectors [%jd...%jd]\n",
++				(mediasize - 1024 * 512) / disk.d_bsize,
++				(mediasize / disk.d_bsize) - 1);
++			berase(&disk, (mediasize - 1024 * 512) / disk.d_bsize,
++				1024 * 512);
++		}
 +	}
  	if (!Nflag)
  		do_sbwrite(&disk);

Attachment: signature.asc
Description: Digital signature


Reply to: