bug-parted
[Top][All Lists]
Advanced

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

(no subject)


From: Peter Lorenzen
Subject: (no subject)
Date: Tue, 26 Oct 2004 18:02:51 +0200

Hi

I (an others) could not install Fedora FC3-test3, due to a bug in parted, it 
said

---
You found a bug in GNU Parted.  Please email a bug report to address@hidden 
containing the version (1.6.15), and the following message:

Assertion (heads > 0) at disk_dos.c:482 in function probe_partition_for_geom() 
failed.
---

I have made this fix to parted-1.6.15-5, which maked parted fallback and use
fdisk method of establishing what C/H/S should be, there is a few ekstra
printf's, so that some-one can figure out what actually was wrong.

I have included 3 parts,
 1) the patch
 2) output from fdisk
 3) output from the patched parted

I hope it will be of help to somebody

/address@hidden

address@hidden ~]# diff -Naur parted-1.6.15*/libparted/disk_dos.c
--- parted-1.6.15/libparted/disk_dos.c 2004-09-19 01:37:18.000000000 +0100
+++ parted-1.6.15-modified/libparted/disk_dos.c 2004-10-26 17:37:33.589363808 
+0100
@@ -472,17 +472,54 @@
return 0;

heads = (A_ * h - a_ * H) / (a_ * C - A_ * c);
+#define ALA_FDISK 1
+#ifdef ALA_FDISK
+/*
+ * I don't understand the meaning of the above statement
+ * But since parted is showstopper in installing FC3-test
+ * I have made this FIX - taht is we do behave like fdisk
+ * address@hidden 26/10-2004
+ */
+ printf("c = %d, ", c); printf("h = %d, ", h); printf("s = %d, ", s);
+ printf("a = %d, ", a); printf("a_ = %d\n", a_);
+
+ printf("C = %d, ", C); printf("H = %d, ", H); printf("S = %d, ", S);
+ printf("A = %d, ", A); printf("A_ = %d\n", A_);
+
+ if ((heads <= 0) || (heads >= 255)) {
+ /* fdisk:get_partition_table_geometry() h = p->end_head + 1 */
+ heads = H + 1;
+ /* fdisk:get_partition_table_geometry() s = p->end_end_sector
+ note that chs_get_sector() for some reason subtracts one */
+ sectors = S + 1;
+ }
+#endif
PED_ASSERT (heads > 0, return 0);
PED_ASSERT (heads < 256, return 0);

sectors = A_ / (C * heads + H);
+#ifdef ALA_FDISK
+ if ((sectors <= 0) || (sectors > 63)) {
+ /* fdisk:get_partition_table_geometry() h = p->end_head + 1 */
+ heads = H + 1;
+ /* fdisk:get_partition_table_geometry() s = p->end_end_sector
+ note that chs_get_sector() for some reason subtracts one */
+ sectors = S + 1;
+ }
+#endif
PED_ASSERT (sectors > 0, return 0);
PED_ASSERT (sectors <= 63, return 0);

cylinders = part->disk->dev->length / (heads * sectors);

+#ifdef ALA_FDISK
+ printf("cylinders = %d\n", cylinders);
+ printf("heads = %d\n", heads);
+ printf("sectors = %d\n", sectors);
+#else
PED_ASSERT ((c * heads + h) * sectors + s == a, return 0);
PED_ASSERT ((C * heads + H) * sectors + S == A, return 0);
+#endif

bios_geom->cylinders = cylinders;
bios_geom->heads = heads;
address@hidden ~]#
/sbin/fdisk -lu /dev/hde

Disk /dev/hde: 46.1 GB, 46115758080 bytes
255 heads, 63 sectors/track, 5606 cylinders, total 90069840 sectors
Units = sectors of 1 * 512 = 512 bytes

Device Boot Start End Blocks Id System
/dev/hde1 63 16064 8001 83 Linux
/dev/hde2 * 16065 90060389 45022162+ 83 Linux
address@hidden ~]# ./parted-1.6.15-modified/parted/parted /dev/hde print
c = 1, h = 0, s = 0, a = 16065, a_ = 16065
C = 485, H = 254, S = 62, A = 90060389, A_ = 90060327
cylinders = 5606
heads = 255
sectors = 63
c = 1, h = 0, s = 0, a = 16065, a_ = 16065
C = 485, H = 254, S = 62, A = 90060389, A_ = 90060327
cylinders = 5606
heads = 255
sectors = 63
Error: Unable to satisfy all constraints on the partition.
Error: Can't have the end before the start!
Disk geometry for /dev/hde: 0.000-43979.414 megabytes
Disk label type: msdos
Minor Start End Type Filesystem Flags
1 0.031 7.844 primary ext2
2 7.844 43974.799 primary ext3 boot
Information: Don't forget to update /etc/fstab, if necessary.

address@hidden ~]#

--
Peter Lorenzen                       / 
24 Sylvan way                       / 
Redhill RH1 4DE                    /"\o=#_____ 
Surrey,ENGLAND                    |   \  o   \\_____,---| 
cell-uk: +44 798-6088-761      ___//\__\      \ ________|=== 
Home:    +44 1737-769-416     '__// \ `------' \_//____\\D 
                              / // \ \ | (_)  |__ /    \ 
mailto:address@hidden     | (  ) |  \______'--| (  ) | 
http://www.lorenzen.us/peter  \____/              \____/ 




--




reply via email to

[Prev in Thread] Current Thread [Next in Thread]