Jon Ringle | 24 May 18:19 2011

[PATCH] util-linux: patches to fix compile w/ uclibc toolchain

Added these patches that fix problems when building with uclibc toolchain:
0002-__progname-redefinition-fix.patch
0003-_s-undeclared-fix.patch
0004-replace-index-with-strchr.patch
0005-libmount-replace-mkostmps-with-more-portable-mkstemp.patch
0006-partx-lsblk-fix-gettext-calls.patch

Signed-off-by: Jon Ringle <jon@...>
---
 ...d-fallbacks-for-old-systems-without-umoun.patch |    3 +-
 .../0002-__progname-redefinition-fix.patch         |   61 +++++++++++++++++++
 .../util-linux-2.19/0003-_s-undeclared-fix.patch   |   32 ++++++++++
 .../0004-replace-index-with-strchr.patch           |   36 +++++++++++
 ...place-mkostmps-with-more-portable-mkstemp.patch |   63 ++++++++++++++++++++
 .../0006-partx-lsblk-fix-gettext-calls.patch       |   40 ++++++++++++
 patches/util-linux-2.19/series                     |    7 ++
 7 files changed, 240 insertions(+), 2 deletions(-)
 create mode 100644 patches/util-linux-2.19/0002-__progname-redefinition-fix.patch
 create mode 100644 patches/util-linux-2.19/0003-_s-undeclared-fix.patch
 create mode 100644 patches/util-linux-2.19/0004-replace-index-with-strchr.patch
 create mode 100644 patches/util-linux-2.19/0005-libmount-replace-mkostmps-with-more-portable-mkstemp.patch
 create mode 100644 patches/util-linux-2.19/0006-partx-lsblk-fix-gettext-calls.patch

diff --git
a/patches/util-linux-2.19/0001-libmount-add-fallbacks-for-old-systems-without-umoun.patch b/patches/util-linux-2.19/0001-libmount-add-fallbacks-for-old-systems-without-umoun.patch
index c7299f3..90f6bf9 100644
--- a/patches/util-linux-2.19/0001-libmount-add-fallbacks-for-old-systems-without-umoun.patch
+++ b/patches/util-linux-2.19/0001-libmount-add-fallbacks-for-old-systems-without-umoun.patch
 <at>  <at>  -1,4 +1,3  <at>  <at> 
-From db9bd703a9a696bd73cb7d41e98c66854a604477 Mon Sep 17 00:00:00 2001
 From: Karel Zak <kzak@...>
 Date: Fri, 11 Feb 2011 10:45:09 +0100
 Subject: [PATCH] libmount: add fallbacks for old systems without umount2() syscall
 <at>  <at>  -49,5 +48,5  <at>  <at>  index bd9be69..1187a87 100644
  {
  	int rc;
 -- 
-1.7.2.3
+1.7.0.4

diff --git a/patches/util-linux-2.19/0002-__progname-redefinition-fix.patch b/patches/util-linux-2.19/0002-__progname-redefinition-fix.patch
new file mode 100644
index 0000000..111538e
--- /dev/null
+++ b/patches/util-linux-2.19/0002-__progname-redefinition-fix.patch
 <at>  <at>  -0,0 +1,61  <at>  <at> 
+From: Jon Ringle <jon@...>
+Date: Thu, 21 Apr 2011 17:08:15 -0400
+Subject: [PATCH] __progname redefinition fix
+
+Problem occurs with uclibc errno.h header
+
+In file included from ../include/writeall.h:7,
+                 from
swaplabel.c:35:
+/opt/crosstool-ng-1.9.0/arm-1136j-linux-uclibcgnueabi/gcc-4.4.5-uClibc-0.9.30.2-binutils-2.20.1-kernel-2.6.32.25-sanitized/arm-1136j-linux-uclibcgnueabi//sys-root/usr/include/errno.h:55:
error: conflicting types for '__progname'
+../include/c.h:118: note: previous declaration of '__progname' was here
+
+Signed-off-by: Jon Ringle <jon@...>
+---
+ disk-utils/swaplabel.c   |    2 +-
+ lib/tt.c                 |    1 +
+ shlibs/mount/src/cache.c |    2 +-
+ 3 files changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/disk-utils/swaplabel.c b/disk-utils/swaplabel.c
+index 9dc20b4..28990a7 100644
+--- a/disk-utils/swaplabel.c
++++ b/disk-utils/swaplabel.c
+ <at>  <at>  -30,8 +30,8  <at>  <at> 
+ # endif
+ #endif
+ 
+-#include "c.h"
+ #include "writeall.h"
++#include "c.h"
+ #include "swapheader.h"
+ #include "strutils.h"
+ #include "nls.h"
+diff --git a/lib/tt.c b/lib/tt.c
+index 3bcdea9..198210c 100644
+--- a/lib/tt.c
++++ b/lib/tt.c
+ <at>  <at>  -15,6 +15,7  <at>  <at> 
+ #include <unistd.h>
+ #include <string.h>
+ #include <termios.h>
++#include <errno.h>
+ #ifdef HAVE_SYS_IOCTL_H
+ #include <sys/ioctl.h>
+ #endif
+diff --git a/shlibs/mount/src/cache.c b/shlibs/mount/src/cache.c
+index e0641c1..40613e2 100644
+--- a/shlibs/mount/src/cache.c
++++ b/shlibs/mount/src/cache.c
+ <at>  <at>  -25,8 +25,8  <at>  <at> 
+ #include <fcntl.h>
+ #include <blkid.h>
+ 
+-#include "canonicalize.h"
+ #include "mountP.h"
++#include "canonicalize.h"
+ 
+ /*
+  * Canonicalized (resolved) paths & tags cache
+-- 
+1.7.0.4
+
diff --git a/patches/util-linux-2.19/0003-_s-undeclared-fix.patch b/patches/util-linux-2.19/0003-_s-undeclared-fix.patch
new file mode 100644
index 0000000..e89aab4
--- /dev/null
+++ b/patches/util-linux-2.19/0003-_s-undeclared-fix.patch
 <at>  <at>  -0,0 +1,32  <at>  <at> 
+From: Jon Ringle <jon@...>
+Date: Thu, 21 Apr 2011 17:44:28 -0400
+Subject: [PATCH] _s undeclared fix
+
+tt.c: In function 'recount_widths':
+tt.c:398: error: '_s' undeclared (first use in this function)
+tt.c:398: error: (Each undeclared identifier is reported only once
+tt.c:398: error: for each function it appears in.)
+tt.c: In function 'print_data':
+tt.c:508: error: '_s' undeclared (first use in this function)
+
+Signed-off-by: Jon Ringle <jon@...>
+---
+ lib/tt.c |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/lib/tt.c b/lib/tt.c
+index 198210c..328b9d7 100644
+--- a/lib/tt.c
++++ b/lib/tt.c
+ <at>  <at>  -52,7 +52,7  <at>  <at>  static const struct tt_symbols utf8_tt_symbols = {
+ };
+ 
+ #else /* !HAVE_WIDECHAR */
+-# define mbs_width       strlen(_s)
++# define mbs_width(_s)       strlen(_s)
+ #endif /* !HAVE_WIDECHAR */
+ 
+ #define is_last_column(_tb, _cl) \
+-- 
+1.7.0.4
+
diff --git a/patches/util-linux-2.19/0004-replace-index-with-strchr.patch b/patches/util-linux-2.19/0004-replace-index-with-strchr.patch
new file mode 100644
index 0000000..ed80c0e
--- /dev/null
+++ b/patches/util-linux-2.19/0004-replace-index-with-strchr.patch
 <at>  <at>  -0,0 +1,36  <at>  <at> 
+From: Jon Ringle <jon@...>
+Date: Tue, 24 May 2011 12:14:09 -0400
+Subject: [PATCH] replace index with strchr
+
+index is deprecated and not available in uclibc
+replace with strchr
+
+Signed-off-by: Jon Ringle <jon@...>
+---
+ shlibs/mount/src/tab_parse.c |    4 ++--
+ 1 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/shlibs/mount/src/tab_parse.c b/shlibs/mount/src/tab_parse.c
+index 4eb32eb..a2cd30f 100644
+--- a/shlibs/mount/src/tab_parse.c
++++ b/shlibs/mount/src/tab_parse.c
+ <at>  <at>  -272,14 +272,14  <at>  <at>  static int mnt_table_parse_next(struct libmnt_table *tb, FILE *f, struct libmnt_
+ 		if (fgets(buf, sizeof(buf), f) == NULL)
+ 			return -EINVAL;
+ 		++*nlines;
+-		s = index (buf, '\n');
++		s = strchr (buf, '\n');
+ 		if (!s) {
+ 			/* Missing final newline?  Otherwise extremely */
+ 			/* long line - assume file was corrupted */
+ 			if (feof(f)) {
+ 				DBG(TAB, mnt_debug_h(tb,
+ 					"%s: no final newline",	filename));
+-				s = index (buf, '\0');
++				s = strchr (buf, '\0');
+ 			} else {
+ 				DBG(TAB, mnt_debug_h(tb,
+ 					"%s:%d: missing newline at line",
+-- 
+1.7.0.4
+
diff --git
a/patches/util-linux-2.19/0005-libmount-replace-mkostmps-with-more-portable-mkstemp.patch b/patches/util-linux-2.19/0005-libmount-replace-mkostmps-with-more-portable-mkstemp.patch
new file mode 100644
index 0000000..7f350bc
--- /dev/null
+++ b/patches/util-linux-2.19/0005-libmount-replace-mkostmps-with-more-portable-mkstemp.patch
 <at>  <at>  -0,0 +1,63  <at>  <at> 
+From: Karel Zak <kzak@...>
+Date: Fri, 11 Feb 2011 10:18:00 +0100
+Subject: [PATCH] libmount: replace mkostmps() with more portable mkstemp()
+
+Reported-by: Peter Breitenlohner <peb@...>
+Signed-off-by: Karel Zak <kzak@...>
+---
+ shlibs/mount/src/mountP.h     |    2 +-
+ shlibs/mount/src/tab_update.c |    2 +-
+ shlibs/mount/src/utils.c      |    4 ++--
+ 3 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/shlibs/mount/src/mountP.h b/shlibs/mount/src/mountP.h
+index aeceb7f..71314a5 100644
+--- a/shlibs/mount/src/mountP.h
++++ b/shlibs/mount/src/mountP.h
+ <at>  <at>  -118,7 +118,7  <at>  <at>  extern int mnt_in_group(gid_t gid);
+ 
+ extern char *mnt_get_mountpoint(const char *path);
+ extern char *mnt_get_fs_root(const char *path, const char *mountpoint);
+-extern int mnt_open_uniq_filename(const char *filename, char **name, int flags);
++extern int mnt_open_uniq_filename(const char *filename, char **name);
+ extern int mnt_has_regular_utab(const char **utab, int *writable);
+ extern const char *mnt_get_utab_path(void);
+ 
+diff --git a/shlibs/mount/src/tab_update.c b/shlibs/mount/src/tab_update.c
+index a0f99f1..6b7b4be 100644
+--- a/shlibs/mount/src/tab_update.c
++++ b/shlibs/mount/src/tab_update.c
+ <at>  <at>  -561,7 +561,7  <at>  <at>  static int update_table(struct libmnt_update *upd, struct libmnt_table *tb)
+ 
+ 	DBG(UPDATE, mnt_debug_h(upd, "%s: updating", upd->filename));
+ 
+-	fd = mnt_open_uniq_filename(upd->filename, &uq, O_WRONLY);
++	fd = mnt_open_uniq_filename(upd->filename, &uq);
+ 	if (fd < 0)
+ 		return fd;	/* error */
+ 
+diff --git a/shlibs/mount/src/utils.c b/shlibs/mount/src/utils.c
+index cb0ed1c..b02b6fe 100644
+--- a/shlibs/mount/src/utils.c
++++ b/shlibs/mount/src/utils.c
+ <at>  <at>  -642,7 +642,7  <at>  <at>  const char *mnt_get_utab_path(void)
+ 
+ /* returns file descriptor or -errno,  <at> name returns uniques filename
+  */
+-int mnt_open_uniq_filename(const char *filename, char **name, int flags)
++int mnt_open_uniq_filename(const char *filename, char **name)
+ {
+ 	int rc, fd;
+ 	char *n;
+ <at>  <at>  -656,7 +656,7  <at>  <at>  int mnt_open_uniq_filename(const char *filename, char **name, int flags)
+ 	if (rc <= 0)
+ 		return -errno;
+ 
+-	fd = mkostemp(n, flags | O_EXCL);
++	fd = mkstemp(n);
+ 	if (fd >= 0 && name)
+ 		*name = n;
+ 	else
+-- 
+1.7.0.4
+
diff --git a/patches/util-linux-2.19/0006-partx-lsblk-fix-gettext-calls.patch b/patches/util-linux-2.19/0006-partx-lsblk-fix-gettext-calls.patch
new file mode 100644
index 0000000..ca16c3a
--- /dev/null
+++ b/patches/util-linux-2.19/0006-partx-lsblk-fix-gettext-calls.patch
 <at>  <at>  -0,0 +1,40  <at>  <at> 
+From: Karel Zak <kzak@...>
+Date: Fri, 11 Feb 2011 09:06:27 +0100
+Subject: [PATCH] partx, lsblk: fix gettext calls
+
+Reported-by: Peter Breitenlohner <peb@...>
+Signed-off-by: Karel Zak <kzak@...>
+---
+ misc-utils/lsblk.c |    2 +-
+ partx/partx.c      |    2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/misc-utils/lsblk.c b/misc-utils/lsblk.c
+index 44358fd..b07bfb4 100644
+--- a/misc-utils/lsblk.c
++++ b/misc-utils/lsblk.c
+ <at>  <at>  -871,7 +871,7  <at>  <at>  static void __attribute__((__noreturn__)) help(FILE *out)
+ 	fprintf(out, _("\nAvailable columns:\n"));
+ 
+ 	for (i = 0; i < __NCOLUMNS; i++)
+-		fprintf(out, " %10s  %s\n", infos[i].name, gettext(infos[i].help));
++		fprintf(out, " %10s  %s\n", infos[i].name, _(infos[i].help));
+ 
+ 	fprintf(out, _("\nFor more information see lsblk(8).\n"));
+ 
+diff --git a/partx/partx.c b/partx/partx.c
+index efb627f..a65586f 100644
+--- a/partx/partx.c
++++ b/partx/partx.c
+ <at>  <at>  -615,7 +615,7  <at>  <at>  static void __attribute__((__noreturn__)) usage(FILE *out)
+ 	fprintf(out, _("\nAvailable columns (for --show):\n"));
+ 
+ 	for (i = 0; i < __NCOLUMNS; i++)
+-		fprintf(out, " %10s  %s\n", infos[i].name, gettext(infos[i].help));
++		fprintf(out, " %10s  %s\n", infos[i].name, _(infos[i].help));
+ 
+ 	fprintf(out, _("\nFor more information see partx(8).\n"));
+ 
+-- 
+1.7.0.4
+
diff --git a/patches/util-linux-2.19/series b/patches/util-linux-2.19/series
index 7a6959d..5ba6e15 100644
--- a/patches/util-linux-2.19/series
+++ b/patches/util-linux-2.19/series
 <at>  <at>  -1 +1,8  <at>  <at> 
+# generated by git-ptx-patches
 0001-libmount-add-fallbacks-for-old-systems-without-umoun.patch
+0002-__progname-redefinition-fix.patch
+0003-_s-undeclared-fix.patch
+0004-replace-index-with-strchr.patch
+0005-libmount-replace-mkostmps-with-more-portable-mkstemp.patch
+0006-partx-lsblk-fix-gettext-calls.patch
+# 46107b4447bfd6ffdcda93e37657e575  - git-ptx-patches magic
--

-- 
1.7.0.4


Gmane