Merge lp:~psusi/ubuntu/natty/parted/fix-dmraid into lp:ubuntu/natty/parted

Proposed by Phillip Susi
Status: Merged
Merged at revision: 89
Proposed branch: lp:~psusi/ubuntu/natty/parted/fix-dmraid
Merge into: lp:ubuntu/natty/parted
Diff against target: 256 lines (+134/-18)
9 files modified
debian/changelog (+17/-0)
debian/control (+1/-0)
debian/patches/dasd-sync.patch (+1/-1)
debian/patches/dm_p_separator.patch (+33/-0)
debian/patches/dmraid.patch (+3/-14)
debian/patches/fix-head-size-assertion.patch (+74/-0)
debian/patches/series (+2/-0)
debian/patches/tiny-disk-constraint.patch (+1/-1)
debian/patches/udevadm-settle.patch (+2/-2)
To merge this branch: bzr merge lp:~psusi/ubuntu/natty/parted/fix-dmraid
Reviewer Review Type Date Requested Status
Colin Watson Approve
Phillip Susi (community) Needs Resubmitting
Review via email: mp+52285@code.launchpad.net

Description of the change

  * Fix probe_partition_for_geom() to fail gracefully rather
    than abort with PED_ASSERT(). (LP: #545911)
  * Add dm_p_separator.patch: Device mapper type should not
    automatically mean add 'p' before the partition number.
    Fall back to adding it only if the previous character is
    a digit. This compilies with kpartx behavior.
  * Refresh dmraid.patch to apply with dm_p_separator.patch

To post a comment you must log in.
Revision history for this message
Colin Watson (cjwatson) wrote :

On Sat, Mar 05, 2011 at 05:44:10AM -0000, Phillip Susi wrote:
> + a digit. This compilies with kpartx behavior.

Typo: "complies".

> === added file 'debian/patches/dm_p_separator.patch'
> --- debian/patches/dm_p_separator.patch 1970-01-01 00:00:00 +0000
> +++ debian/patches/dm_p_separator.patch 2011-03-05 05:43:54 +0000
> @@ -0,0 +1,30 @@
> +Device mapper type should not automatically mean add 'p'
> +before the partition number. Fall back to adding it only
> +if the previous character is a digit. This compilies
> +with kpartx behavior.

The comments I made on your dmraid branch about DEP-3 patch headers
apply here too.

> +@@ -2735,7 +2734,11 @@
> +
> + dev_name = dm_task_get_name (task);
> +
> +- if (asprintf (&vol_name, "%sp%d", dev_name, part->num) == -1)
> ++ if (isdigit(dev_name[strlen(dev_name)-1]))
> ++ {

Please use consistent formatting within files/functions. The local
style is to put a space before open parentheses and around arithmetic
operators, and to cuddle open braces onto the same line as ifs, so:

  if (isdigit (dev_name[strlen (dev_name) - 1])) {

> === modified file 'debian/patches/dmraid.patch'
> --- debian/patches/dmraid.patch 2011-02-02 10:11:46 +0000
> +++ debian/patches/dmraid.patch 2011-03-05 05:43:54 +0000
> @@ -5,10 +5,10 @@
> nodes created needlessly, and make sure that partition nodes for DM-RAID
> devices are not probed.
>
> -Index: b/libparted/arch/linux.c
> +Index: parted/libparted/arch/linux.c
> ===================================================================
> ---- a/libparted/arch/linux.c
> -+++ b/libparted/arch/linux.c
> +--- parted.orig/libparted/arch/linux.c 2011-03-04 20:27:35.611473999 -0500
> ++++ parted/libparted/arch/linux.c 2011-03-04 20:28:46.431473991 -0500

Could you use 'quilt refresh -pab' here to avoid these deltas, since
that's how the previous patches were constructed?

> === modified file 'debian/patches/series'
> --- debian/patches/series 2010-12-24 17:00:39 +0000
> +++ debian/patches/series 2011-03-05 05:43:54 +0000
> @@ -26,3 +26,4 @@
>
> # Symbols for this ABI (amd64 as reference)
> update-abi-symbols.patch
> +dm_p_separator.patch

Please make sure that new patches go above the terminating
update-abi-symbols.patch. You should just be able to edit
debian/patches/series and move this line up to the end of the "Ubuntu
additions" section.

> === modified file 'libparted/labels/dos.c'
> --- libparted/labels/dos.c 2010-08-05 21:06:19 +0000
> +++ libparted/labels/dos.c 2011-03-05 05:43:54 +0000

Please put this in a quilt patch in the "Ubuntu additions" section
rather than applying it directly.

I don't see any substantive problems with this branch, so, like the
dmraid branch, it can be merged once you've fixed these cosmetic
problems. Thanks!

 review needs-fixing

review: Needs Fixing
89. By Phillip Susi

Add fix-head-size-assertion.patch:
Fix probe_partition_for_geom() to fail gracefully rather
than abort with PED_ASSERT(). (LP: #545911)

Revision history for this message
Phillip Susi (psusi) wrote :

How about dem apples?

review: Needs Resubmitting
90. By Phillip Susi

* Add dm_p_separator.patch: Device mapper type should not
  automatically mean add 'p' before the partition number.
  Fall back to adding it only if the previous character is
  a digit. This complies with kpartx behavior and linux
  behavior "since the dawn of time".
* Refresh dasd-sync.patch, dmraid.patch, tiny-disk-constraint.patch,
  udevadm-settle.patch.
* debian/control: Breaks versions of dmraid not
  patched to follow the same 'p' behavior.

Revision history for this message
Colin Watson (cjwatson) wrote :

Thanks, this looks much better now.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2011-02-02 10:21:15 +0000
3+++ debian/changelog 2011-03-09 00:47:14 +0000
4@@ -1,3 +1,20 @@
5+parted (2.3-5ubuntu4) maverick; urgency=low
6+
7+ * Add fix-head-size-assertion.patch:
8+ Fix probe_partition_for_geom() to fail gracefully rather
9+ than abort with PED_ASSERT(). (LP: #545911)
10+ * Add dm_p_separator.patch: Device mapper type should not
11+ automatically mean add 'p' before the partition number.
12+ Fall back to adding it only if the previous character is
13+ a digit. This complies with kpartx behavior and linux
14+ behavior "since the dawn of time".
15+ * Refresh dasd-sync.patch, dmraid.patch, tiny-disk-constraint.patch,
16+ udevadm-settle.patch.
17+ * debian/control: Breaks versions of dmraid not
18+ patched to follow the same 'p' behavior.
19+
20+ -- Phillip Susi <psusi@cfl.rr.com> Sat, 12 Feb 2011 16:37:05 -0500
21+
22 parted (2.3-5ubuntu3) natty; urgency=low
23
24 * Update dmraid.patch to add the 'p' before the partition
25
26=== modified file 'debian/control'
27--- debian/control 2010-10-22 11:24:41 +0000
28+++ debian/control 2011-03-09 00:47:14 +0000
29@@ -79,6 +79,7 @@
30 Depends: ${shlibs:Depends}, ${misc:Depends}
31 Suggests: parted | nparted, libparted0-dev, libparted0-i18n (= ${source:Version})
32 Conflicts: parted (<< 1.4.13+14pre1), libparted1 (<< 2.2), libparted2 (<< 2.2)
33+Breaks: dmraid (<< 1.0.0.rc16-4.1ubuntu2)
34 Replaces: libparted0 (<< 2.2-4), libparted1 (<< 2.2), libparted2 (<< 2.2), libparted1.4 (<< 1.4.24-2)
35 Provides: libparted
36 Description: The GNU Parted disk partitioning shared library
37
38=== modified file 'debian/patches/dasd-sync.patch'
39--- debian/patches/dasd-sync.patch 2010-12-19 12:57:43 +0000
40+++ debian/patches/dasd-sync.patch 2011-03-09 00:47:14 +0000
41@@ -18,7 +18,7 @@
42 #ifdef ENABLE_DEVICE_MAPPER
43 #include <libdevmapper.h>
44 #endif
45-@@ -2807,20 +2808,15 @@
46+@@ -2809,20 +2810,15 @@
47 return _dm_reread_part_table (disk);
48 #endif
49 if (disk->dev->type != PED_DEVICE_FILE) {
50
51=== added file 'debian/patches/dm_p_separator.patch'
52--- debian/patches/dm_p_separator.patch 1970-01-01 00:00:00 +0000
53+++ debian/patches/dm_p_separator.patch 2011-03-09 00:47:14 +0000
54@@ -0,0 +1,33 @@
55+From: Phillip Susi <psusi@cfl.rr.com>
56+Description: Device mapper type should not automatically
57+ mean add 'p' before the partition number. Fall back to
58+ adding it only if the previous character is a digit.
59+ This complies with kpartx behavior and linux behavior
60+ "since the dawn of time".
61+Forwarded: yes
62+Last-Update: 2011-03-08
63+
64+Index: b/libparted/arch/linux.c
65+===================================================================
66+--- a/libparted/arch/linux.c 2011-03-08 10:43:36.726632247 -0500
67++++ b/libparted/arch/linux.c 2011-03-08 10:46:30.274635151 -0500
68+@@ -2198,7 +2198,6 @@
69+ } else if (dev->type == PED_DEVICE_DAC960
70+ || dev->type == PED_DEVICE_CPQARRAY
71+ || dev->type == PED_DEVICE_ATARAID
72+- || dev->type == PED_DEVICE_DM
73+ || isdigit (dev->path[path_len - 1]))
74+ snprintf (result, result_len, "%sp%d", dev->path, num);
75+ else
76+@@ -2716,7 +2715,10 @@
77+
78+ dev_name = dm_task_get_name (task);
79+
80+- if (asprintf (&vol_name, "%sp%d", dev_name, part->num) == -1)
81++ if (isdigit (dev_name[strlen (dev_name) - 1])) {
82++ if (asprintf (&vol_name, "%sp%d", dev_name, part->num) == -1)
83++ goto err;
84++ } else if (asprintf (&vol_name, "%s%d", dev_name, part->num) == -1)
85+ goto err;
86+
87+ /* Caution: dm_task_destroy frees dev_name. */
88
89=== modified file 'debian/patches/dmraid.patch'
90--- debian/patches/dmraid.patch 2011-02-02 10:11:46 +0000
91+++ debian/patches/dmraid.patch 2011-03-09 00:47:14 +0000
92@@ -39,18 +39,7 @@
93 }
94 closedir (mapper_dir);
95
96-@@ -2200,6 +2212,10 @@
97- } else if (!strncmp (dev->path, "/dev/loop", 9)) {
98- /* Loop devices can only have one partition. */
99- strcpy (result, dev->path);
100-+#ifdef ENABLE_DEVICE_MAPPER
101-+ } else if (dev->type == PED_DEVICE_DM && _is_dmraid_device (dev->path)) {
102-+ snprintf (result, result_len, "%sp%d", dev->path, num);
103-+#endif
104- } else if (dev->type == PED_DEVICE_DAC960
105- || dev->type == PED_DEVICE_CPQARRAY
106- || dev->type == PED_DEVICE_ATARAID
107-@@ -2702,6 +2718,8 @@
108+@@ -2701,6 +2717,8 @@
109 char* vol_name = NULL;
110 const char* dev_name = NULL;
111 char* params = NULL;
112@@ -59,7 +48,7 @@
113 LinuxSpecific* arch_specific = LINUX_SPECIFIC (disk->dev);
114
115 if (!_has_partitions(disk))
116-@@ -2739,12 +2757,19 @@
117+@@ -2741,12 +2759,19 @@
118 dm_task_set_name (task, vol_name);
119 dm_task_add_target (task, 0, part->geom.length,
120 "linear", params);
121@@ -79,7 +68,7 @@
122 return 1;
123 } else {
124 _dm_remove_map_name(vol_name);
125-@@ -2785,6 +2810,85 @@
126+@@ -2787,6 +2812,85 @@
127 }
128 return rc;
129 }
130
131=== added file 'debian/patches/fix-head-size-assertion.patch'
132--- debian/patches/fix-head-size-assertion.patch 1970-01-01 00:00:00 +0000
133+++ debian/patches/fix-head-size-assertion.patch 2011-03-09 00:47:14 +0000
134@@ -0,0 +1,74 @@
135+From: Phillip Susi <psusi@cfl.rr.com>
136+Subject: Fix assertion failure: head_size <= 63
137+Description: probe_partition_for_geom() was originally written
138+ using PED_ASSERT() to test for failures in computing the disk
139+ geometry based on existing partition table entries. That
140+ macro has been modified to ignore the second argument ( which
141+ was a return statement ), and instead abort the program. This
142+ patch rewrites those tests to not use PED_ASSERT() so the
143+ function correctly returns when the computations fail, and the
144+ program can recover gracefully and operate normally.
145+Last-Update: 2011-03-08
146+Bug-Ubuntu: http://launchpad.net/bugs/545911
147+
148+Index: b/libparted/labels/dos.c
149+===================================================================
150+--- a/libparted/labels/dos.c 2011-03-08 10:25:21.558631186 -0500
151++++ b/libparted/labels/dos.c 2011-03-08 10:25:33.770633724 -0500
152+@@ -646,8 +645,10 @@
153+ if (cyl_size * denum != a_*H - A_*h)
154+ return 0;
155+
156+- PED_ASSERT (cyl_size > 0, return 0);
157+- PED_ASSERT (cyl_size <= 255 * 63, return 0);
158++ if (cyl_size <= 0)
159++ return 0;
160++ if (cyl_size > 255 * 63)
161++ return 0;
162+
163+ if (h > 0)
164+ head_size = ( a_ - c * cyl_size ) / h;
165+@@ -658,18 +659,24 @@
166+ PED_ASSERT (0, return 0);
167+ }
168+
169+- PED_ASSERT (head_size > 0, return 0);
170+- PED_ASSERT (head_size <= 63, return 0);
171++ if (head_size <= 0)
172++ return 0;
173++ if (head_size > 63)
174++ return 0;
175+
176+ cylinders = part->disk->dev->length / cyl_size;
177+ heads = cyl_size / head_size;
178+ sectors = head_size;
179+
180+- PED_ASSERT (heads > 0, return 0);
181+- PED_ASSERT (heads < 256, return 0);
182++ if (heads <= 0)
183++ return 0;
184++ if (heads > 255)
185++ return 0;
186+
187+- PED_ASSERT (sectors > 0, return 0);
188+- PED_ASSERT (sectors <= 63, return 0);
189++ if (sectors <= 0)
190++ return 0;
191++ if (sectors > 63)
192++ return 0;
193+
194+ /* Some broken OEM partitioning program(s) seem to have an out-by-one
195+ * error on the end of partitions. We should offer to fix the
196+@@ -678,8 +685,10 @@
197+ if (((C + 1) * heads + H) * sectors + S == A)
198+ C++;
199+
200+- PED_ASSERT ((c * heads + h) * sectors + s == a, return 0);
201+- PED_ASSERT ((C * heads + H) * sectors + S == A, return 0);
202++ if ((c * heads + h) * sectors + s != a)
203++ return 0;
204++ if ((C * heads + H) * sectors + S != A)
205++ return 0;
206+
207+ bios_geom->cylinders = cylinders;
208+ bios_geom->heads = heads;
209
210=== modified file 'debian/patches/series'
211--- debian/patches/series 2010-12-24 17:00:39 +0000
212+++ debian/patches/series 2011-03-09 00:47:14 +0000
213@@ -11,6 +11,8 @@
214 freebsd-ufs.patch
215 zfs.patch
216 zero-length-devices.patch
217+fix-head-size-assertion.patch
218+dm_p_separator.patch
219
220 # Backported
221 sun-revert-disk-flag.patch
222
223=== modified file 'debian/patches/tiny-disk-constraint.patch'
224--- debian/patches/tiny-disk-constraint.patch 2010-11-19 21:42:56 +0000
225+++ debian/patches/tiny-disk-constraint.patch 2011-03-09 00:47:14 +0000
226@@ -9,7 +9,7 @@
227 ===================================================================
228 --- a/libparted/labels/dos.c
229 +++ b/libparted/labels/dos.c
230-@@ -1646,13 +1646,13 @@
231+@@ -1656,13 +1656,13 @@
232 dev->length - min_geom->end))
233 return NULL;
234 } else {
235
236=== modified file 'debian/patches/udevadm-settle.patch'
237--- debian/patches/udevadm-settle.patch 2010-12-24 20:44:27 +0000
238+++ debian/patches/udevadm-settle.patch 2011-03-09 00:47:14 +0000
239@@ -19,7 +19,7 @@
240 #include <ctype.h>
241 #include <errno.h>
242 #include <fcntl.h>
243-@@ -2799,16 +2800,60 @@
244+@@ -2801,16 +2802,60 @@
245 return have_blkpg = kver >= KERNEL_VERSION (2,4,0) ? 1 : 0;
246 }
247
248@@ -82,7 +82,7 @@
249 #endif
250 if (disk->dev->type != PED_DEVICE_FILE) {
251
252-@@ -2819,10 +2864,20 @@
253+@@ -2821,10 +2866,20 @@
254 assert (_have_blkpg ());
255
256 if (!_disk_sync_part_table (disk))

Subscribers

People subscribed via source and target branches

to all changes: