Hello groups, freeman.

Thanks for your bug report.

On Wed, Feb 24, 2016 at 09:01:52PM -0500, groups, freeman wrote:
> Package: util-linux
> Version: 2.25.2-6
> Severity: normal
[...]
> 
> So now when I examine the attached MBR in fdisk via the cmds:
>     { printf "u \n x \n p \n r \n q \n" | fdisk Sample64h32sMBR.mbr; } |
> grep -E "^(Geometry|Device|Sample64h)"
> 
> the 3 lines output are:
>     Geometry: 64 heads, 32 sectors/track, 0 cylinders
>     Device               Boot Start   End Cylinders Id Type Start-C/H/S
> End-C/H/S Attrs
>     Sample64h32sMBR.mbr4 *        1   412       412  6 FAT16 1/1/0 411/32/63
> 80
> 
> The first and second lines are as expected, however the 3rd line SHOULD have
> the End geometry as:
>     411/63/32
> instead of the indicated:
>     411/32/63
[...]

Could you please check if the attached patch fixes the problem for you?

cd /tmp && apt-get source util-linux
apt-get build-depends util-linux
cd util-linux-*
[put attached patch in debian/patches/fixchs.patch]
echo "fixchs.patch" >> debian/patches/series
dpkg-buildpackage -uc -us
dpkg -i ../libfdisk1_*.deb

Regards,
Andreas Henriksson
>From 80f45d79e4e52f7b48250b11ea975141cc707327 Mon Sep 17 00:00:00 2001
From: Andreas Henriksson <andr...@fatal.se>
Date: Thu, 25 Feb 2016 10:11:07 +0100
Subject: [PATCH] libfdisk: Fix order of C/H/S numbers output

While the header says C/H/S the actual numbers where printed as
C/S/H.

Addresses: http://bugs.debian.org/815847
Reported-by: "groups, freeman" <freeman_gro...@reason.dyndns.org>
Signed-off-by: Andreas Henriksson <andr...@fatal.se>
---
 libfdisk/src/dos.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libfdisk/src/dos.c b/libfdisk/src/dos.c
index 2f3a37b..b199225 100644
--- a/libfdisk/src/dos.c
+++ b/libfdisk/src/dos.c
@@ -1903,15 +1903,15 @@ static int dos_get_partition(struct fdisk_context *cxt, size_t n,
 	/* start C/H/S */
 	if (asprintf(&pa->start_chs, "%d/%d/%d",
 				cylinder(p->bs, p->bc),
-				sector(p->bs),
-				p->bh) < 0)
+				p->bh,
+				sector(p->bs)) < 0)
 		return -ENOMEM;
 
 	/* end C/H/S */
 	if (asprintf(&pa->end_chs, "%d/%d/%d",
 				cylinder(p->es, p->ec),
-				sector(p->es),
-				p->eh) < 0)
+				p->eh,
+				sector(p->es)) < 0)
 		return -ENOMEM;
 
 	return 0;
-- 
2.7.0

Reply via email to