Re: Fixed RC bug in frozen parted : #392767: [mac] parted is unable to reread partition tables created by d-i/partman.
On Wed, Nov 08, 2006 at 09:08:50AM -0200, Otavio Salvador wrote:
> Frans Pop <elendil@planet.nl> writes:
>
> > On Tuesday 07 November 2006 18:07, Sven Luther wrote:
> >> I remember (but am not anymore 100% sure, so a reply from frans/joeyh
> >> would be nice), that frans told me last week or so, that an upload of
> >> parted was ok with regard to d-i RC1, since parted is not in the image,
> >> and not migrated to testing, but i would like confirmation on this, and
> >> also advice from the debian-release folk, thus posting here.
> >
> > No objection to an upload to unstable if it does not change the ABI. If it
> > does change the ABI it needs more coordination.
> >
> > The new version is too late for RC1 though, but can of course be tested
> > using daily images.
> >
> > Glad to see that this has been tracked down.
>
> I haven't checked yet but I think it'll change the ABI of
> library... Sven, have you checked it?
The patch only removes a memcpy, and other stuff internal to a function.
There is some changes in an include file, regarding wchat stuff and
ENABLE_NLS, but since all that is fully included in the parted subdir, and
doesn't touch the libparted library, there should be no ABI related problem.
I attach both affected patches here for further review, in case i missed
something obvious and stupid.
Friendly,
Sven Luther
#! /bin/sh /usr/share/dpatch/dpatch-run
## parted-print-name.dpatch by Sven Luther <luther@debian.org>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Fix bug in parted print, when there are no extended partitions, but partition names.
@DPATCH@
diff -Nur parted-1.7.1-orig/parted/parted.c parted-1.7.1/parted/parted.c
--- parted-1.7.1-orig/parted/parted.c 2006-05-25 19:28:42.000000000 +0200
+++ parted-1.7.1/parted/parted.c 2006-11-01 18:46:38.000000000 +0100
@@ -1196,7 +1196,7 @@
char* start;
char* end;
char* size;
- const char* name;
+ const char* name = "";
char* tmp;
wchar_t* table_rendered;
@@ -1334,16 +1334,18 @@
}
if (!(part->type & PED_PARTITION_FREESPACE)) {
- name = _(ped_partition_type_get_name (part->type));
-
- if (has_extended)
+ if (has_extended) {
+ name = _(ped_partition_type_get_name (part->type));
str_list_append (row, name);
+ }
str_list_append (row, part->fs_type ?
part->fs_type->name : "");
- if (has_name)
+ if (has_name) {
+ name = _(ped_partition_get_name (part));
str_list_append (row, name);
+ }
str_list_append (row, partition_print_flags (part));
} else {
#! /bin/sh /usr/share/dpatch/dpatch-run
## kfreebsd-gnu.dpatch by Otavio Salvador <otavio@debian.org>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: This dpatch was make to include the patch built by Robert Millan.
## DP: Closes: #363381
## DP: Upstream: not merged
## DP: Status: broken part of kfreebsd-gnu.dpatch, separated for reference, but not applied.
@DPATCH@
diff -urNad parted-1.7.0~/parted/strlist.h parted-1.7.0/parted/strlist.h
--- parted-1.7.0~/parted/strlist.h 2004-02-23 22:02:20.000000000 -0300
+++ parted-1.7.0/parted/strlist.h 2006-05-19 03:54:02.000000000 -0300
@@ -20,7 +20,18 @@
#ifndef STRLIST_H_INCLUDED
#define STRLIST_H_INCLUDED
-#include <wchar.h>
+
+#ifdef ENABLE_NLS
+# define _GNU_SOURCE
+# include <wchar.h>
+#else
+# ifdef wchar_t
+# undef wchar_t
+# endif
+# define _GNU_SOURCE
+# include <string.h>
+# define wchar_t char
+#endif
typedef struct _StrList StrList;
struct _StrList {
diff -urNad parted-1.7.0~/parted/table.c parted-1.7.0/parted/table.c
--- parted-1.7.0~/parted/table.c 2006-05-19 03:54:01.000000000 -0300
+++ parted-1.7.0/parted/table.c 2006-05-19 03:54:36.000000000 -0300
@@ -25,6 +25,7 @@
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include <assert.h>
@@ -48,8 +49,24 @@
size_t strnlen (const char *, size_t);
#endif
-#include "strlist.h"
+size_t strnlen (const char *s, size_t maxlen)
+{
+ size_t len = 0;
+ const char *tp = s;
+
+ if(s == NULL)
+ return 0;
+
+ while(*tp && len < maxlen)
+ {
+ len++;
+ tp++;
+ }
+ return len;
+}
+
+#include "strlist.h"
static const unsigned int MAX_WIDTH = 512;
#ifdef ENABLE_NLS
@@ -186,7 +203,8 @@
{
wchar_t** row = t->rows[rownum];
int len = 1, i;
- size_t newsize;
+ size_t newsize, oldsize;
+ wchar_t *temps;
assert(t);
assert(s != NULL);
@@ -197,7 +215,11 @@
len += wcslen(COLSUFFIX);
newsize = (wcslen(*s) + len + 1) * sizeof(wchar_t);
+ oldsize = (wcslen(*s) + 1) * sizeof(wchar_t);
+
+ temps = *s;
*s = realloc (*s, newsize);
+ memcpy(*s, temps, oldsize);
for (i = 0; i < ncols; ++i)
{
Reply to: