util-linux: update to 2.25.2
authorLuka Perkov <luka@openwrt.org>
Sun, 30 Nov 2014 22:11:09 +0000 (22:11 +0000)
committerLuka Perkov <luka@openwrt.org>
Sun, 30 Nov 2014 22:11:09 +0000 (22:11 +0000)
Signed-off-by: Luka Perkov <luka@openwrt.org>
SVN-Revision: 43443

package/utils/util-linux/Makefile
package/utils/util-linux/patches/0001-switch_root-improve-statfs-f_type-portability.patch [new file with mode: 0644]
package/utils/util-linux/patches/0002-lib-colors-use-static-buffers-when-parse-scheme.patch [new file with mode: 0644]
package/utils/util-linux/patches/001-no-printf-alloc.patch
package/utils/util-linux/patches/002-mkostemp.patch
package/utils/util-linux/patches/003-unshare-include-libmount.h-to-provide-missing-MS_-de.patch [deleted file]
package/utils/util-linux/patches/100-fdisk_use_qsort.patch [deleted file]

index 877ccc500abc9741bb443c5eb90df72f4753dd30..421b881afc3af4fd61ad3592b077ca7a269e4de6 100644 (file)
@@ -8,12 +8,12 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=util-linux
-PKG_VERSION:=2.24.1
+PKG_VERSION:=2.25.2
 PKG_RELEASE:=1
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
-PKG_SOURCE_URL:=@KERNEL/linux/utils/$(PKG_NAME)/v2.24
-PKG_MD5SUM:=88d46ae23ca599ac5af9cf96b531590f
+PKG_SOURCE_URL:=@KERNEL/linux/utils/$(PKG_NAME)/v2.25
+PKG_MD5SUM:=cab3d7be354000f629bc601238b629b3
 
 PKG_LICENSE:=GPL-2.0
 PKG_LICENSE_FILES:=COPYING getopt/COPYING libblkid/COPYING libmount/COPYING Documentation/licenses/COPYING.GPLv2 Documentation/licenses/COPYING.LGPLv2.1 libuuid/COPYING Documentation/licenses/COPYING.BSD-3
@@ -35,9 +35,10 @@ CONFIGURE_ARGS += \
        --with-ncurses          \
        --disable-tls           \
        --disable-sulogin       \
+       --without-python        \
        --without-udev
 
-TARGET_CFLAGS += $(FPIC)
+TARGET_CFLAGS += $(FPIC) -std=gnu99
 
 define Build/InstallDev
        $(MAKE) -C $(PKG_BUILD_DIR) \
diff --git a/package/utils/util-linux/patches/0001-switch_root-improve-statfs-f_type-portability.patch b/package/utils/util-linux/patches/0001-switch_root-improve-statfs-f_type-portability.patch
new file mode 100644 (file)
index 0000000..761ace7
--- /dev/null
@@ -0,0 +1,49 @@
+From 8f806bb1ea30f15db7ca36d1cfa79349f8115302 Mon Sep 17 00:00:00 2001
+From: Karel Zak <kzak@redhat.com>
+Date: Thu, 6 Nov 2014 12:50:27 +0100
+Subject: [PATCH] switch_root: improve statfs->f_type portability
+
+__SWORD_TYPE is not available everywhere, for example it's not defined
+by musl libc. It also seems that __SWORD_TYPE is not used for f_type
+on some architectures (s390x).
+
+Reported-by: Natanael Copa <ncopa@alpinelinux.org>
+Signed-off-by: Karel Zak <kzak@redhat.com>
+---
+ include/statfs_magic.h  | 11 +++++++++++
+ sys-utils/switch_root.c |  4 ++--
+ 2 files changed, 13 insertions(+), 2 deletions(-)
+
+--- a/include/statfs_magic.h
++++ b/include/statfs_magic.h
+@@ -1,6 +1,17 @@
+ #ifndef UTIL_LINUX_STATFS_MAGIC_H
+ #define UTIL_LINUX_STATFS_MAGIC_H
++#include <sys/statfs.h>
++
++/*
++ * If possible then don't depend on internal libc __SWORD_TYPE type.
++ */
++#ifdef __GNUC__
++typedef __typeof__( ((struct statfs *)0)->f_type )    ul_statfs_ftype_t;
++#else
++typedef __SWORD_TYPE  ul_statfs_ftype_t;
++#endif
++
+ /*
+  *  Unfortunately, Linux kernel hedeader file <linux/magic.h> is incomplete
+  *  mess and kernel returns by statfs f_type many numbers that are nowhere
+--- a/sys-utils/switch_root.c
++++ b/sys-utils/switch_root.c
+@@ -181,8 +181,8 @@ static int switchroot(const char *newroo
+               if (pid <= 0) {
+                       struct statfs stfs;
+                       if (fstatfs(cfd, &stfs) == 0 &&
+-                          (stfs.f_type == (__SWORD_TYPE)STATFS_RAMFS_MAGIC ||
+-                           stfs.f_type == (__SWORD_TYPE)STATFS_TMPFS_MAGIC))
++                          (stfs.f_type == (ul_statfs_ftype_t) STATFS_RAMFS_MAGIC ||
++                           stfs.f_type == (ul_statfs_ftype_t) STATFS_TMPFS_MAGIC))
+                               recursiveRemove(cfd);
+                       else
+                               warn(_("old root filesystem is not an initramfs"));
diff --git a/package/utils/util-linux/patches/0002-lib-colors-use-static-buffers-when-parse-scheme.patch b/package/utils/util-linux/patches/0002-lib-colors-use-static-buffers-when-parse-scheme.patch
new file mode 100644 (file)
index 0000000..ccd82fd
--- /dev/null
@@ -0,0 +1,126 @@
+From 6508db29ded734ac4ff5e5e19486c143c9eb3d89 Mon Sep 17 00:00:00 2001
+From: Karel Zak <kzak@redhat.com>
+Date: Fri, 21 Nov 2014 12:23:47 +0100
+Subject: [PATCH] lib/colors: use static buffers when parse scheme
+
+* use static buffers when parse scheme colors
+* cleanup deallocation on error in sequence parser
+
+Signed-off-by: Karel Zak <kzak@redhat.com>
+---
+
+This is modified upstream patch.
+
+--- a/lib/colors.c
++++ b/lib/colors.c
+@@ -416,28 +416,31 @@ static int colors_add_scheme(struct ul_c
+                            char *name,
+                            char *seq0)
+ {
+-      struct ul_color_scheme *cs;
+-      char *seq;
++      struct ul_color_scheme *cs = NULL;
++      char *seq = NULL;
+       int rc;
+       if (!cc || !name || !*name || !seq0 || !*seq0)
+               return -EINVAL;
+       rc = cn_sequence(seq0, &seq);
+-      free(seq0);
+       if (rc)
+               return rc;
++      rc = -ENOMEM;
++
+       /* convert logical name (e.g. "red") to real ESC code */
+       if (isalpha(*seq)) {
+               const char *s = color_sequence_from_colorname(seq);
+               char *p;
+-              if (!s)
+-                      return -EINVAL;
++              if (!s) {
++                      rc = -EINVAL;
++                      goto err;
++              }
+               p = strdup(s);
+               if (!p)
+-                      return -ENOMEM;
++                      goto err;
+               free(seq);
+               seq = p;
+       }
+@@ -447,17 +450,28 @@ static int colors_add_scheme(struct ul_c
+               void *tmp = realloc(cc->schemes, (cc->nschemes + 10)
+                                       * sizeof(struct ul_color_scheme));
+               if (!tmp)
+-                      return -ENOMEM;
++                      goto err;
+               cc->schemes = tmp;
+               cc->schemes_sz = cc->nschemes + 10;
+       }
+       /* add a new item */
+-      cs = &cc->schemes[cc->nschemes++];
+-      cs->name = name;
++      cs = &cc->schemes[cc->nschemes];
+       cs->seq = seq;
++      cs->name = strdup(name);
++      if (!cs->name)
++              goto err;
++      cc->nschemes++;
+       return 0;
++err:
++      if (cs) {
++              free(cs->seq);
++              free(cs->name);
++              cs->seq = cs->name = NULL;
++      } else
++              free(seq);
++      return rc;
+ }
+ /*
+@@ -543,7 +557,8 @@ static int colors_read_schemes(struct ul
+ {
+       int rc = 0;
+       FILE *f = NULL;
+-      char buf[BUFSIZ];
++      char buf[BUFSIZ],
++           cn[129], seq[129];
+       if (!cc->configured)
+               rc = colors_read_configuration(cc);
+@@ -560,7 +575,6 @@ static int colors_read_schemes(struct ul
+       }
+       while (fgets(buf, sizeof(buf), f)) {
+-              char *cn = NULL, *seq = NULL;
+               char *p = strchr(buf, '\n');
+               if (!p) {
+@@ -576,17 +590,14 @@ static int colors_read_schemes(struct ul
+               if (*p == '\0' || *p == '#')
+                       continue;
+-              rc = sscanf(p,  UL_SCNsA" "     /* name */
+-                              UL_SCNsA,       /* color */
+-                              &cn, &seq);
+-              if (rc == 2 && cn && seq)
++              rc = sscanf(p, "%128[^ ] %128[^\n ]", cn, seq);
++              if (rc == 2 && *cn && *seq) {
+                       rc = colors_add_scheme(cc, cn, seq);    /* set rc=0 on success */
+-              if (rc) {
+-                      free(cn);
+-                      free(seq);
++                      if (rc)
++                              goto done;
+               }
+-              rc = 0;
+       }
++      rc = 0;
+ done:
+       if (f)
index 5acd2f06edbf53154d1d192b9b60bb234e32b0b6..ad9eef0959bf0c8ce269e8039d4d05ef58e1d527 100644 (file)
@@ -1,8 +1,8 @@
 --- a/configure.ac
 +++ b/configure.ac
-@@ -769,7 +769,6 @@ AC_ARG_ENABLE([libmount],
+@@ -798,7 +798,6 @@ AC_ARG_ENABLE([libmount],
+ )
  UL_BUILD_INIT([libmount])
- UL_REQUIRES_LINUX([libmount])
  UL_REQUIRES_BUILD([libmount], [libblkid])
 -UL_REQUIRES_HAVE([libmount], [scanf_alloc_modifier], [scanf string alloc modifier])
  AM_CONDITIONAL([BUILD_LIBMOUNT], [test "x$build_libmount" = xyes])
 +# define UL_SCNsA "%s"
 +#endif
 +
- static inline char *skip_spaces(char *s)
+ static int next_number(char **s, int *num)
  {
-       assert(s);
-@@ -61,16 +65,31 @@ static int mnt_parse_table_line(struct l
+       char *end = NULL;
+@@ -52,16 +56,31 @@ static int mnt_parse_table_line(struct l
        int rc, n = 0, xrc;
        char *src = NULL, *fstype = NULL, *optstr = NULL;
  
@@ -53,7 +53,7 @@
                        &n);
        xrc = rc;
  
-@@ -136,6 +155,16 @@ static int mnt_parse_mountinfo_line(stru
+@@ -127,6 +146,16 @@ static int mnt_parse_mountinfo_line(stru
        unsigned int maj, min;
        char *fstype = NULL, *src = NULL, *p;
  
 +      src = malloc(len);
 +#endif
 +
-       rc = sscanf(s,  "%u "           /* (1) id */
-                       "%u "           /* (2) parent */
+       rc = sscanf(s,  "%d "           /* (1) id */
+                       "%d "           /* (2) parent */
                        "%u:%u "        /* (3) maj:min */
-@@ -147,9 +176,15 @@ static int mnt_parse_mountinfo_line(stru
+@@ -138,9 +167,15 @@ static int mnt_parse_mountinfo_line(stru
                        &fs->id,
                        &fs->parent,
                        &maj, &min,
@@ -86,7 +86,7 @@
                        &end);
  
        if (rc >= 7 && end > 0)
-@@ -169,9 +204,15 @@ static int mnt_parse_mountinfo_line(stru
+@@ -160,9 +195,15 @@ static int mnt_parse_mountinfo_line(stru
                        UL_SCNsA" "     /* (9) source */
                        UL_SCNsA,       /* (10) fs options (fs specific) */
  
 +#endif
  
        if (rc >= 10) {
-               fs->flags |= MNT_FS_KERNEL;
+               size_t sz;
index 0ad84722d23ff5f50416445034b86d07fcd391d9..0281842300f27d1c6e603a5220c6866185a4c1d3 100644 (file)
@@ -16,20 +16,21 @@ Patches revert upstream changes in order to support older
 machines.
 
 Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
+---
 
 --- a/configure.ac
 +++ b/configure.ac
-@@ -299,6 +299,7 @@ AC_CHECK_FUNCS([ \
+@@ -315,6 +315,7 @@ AC_CHECK_FUNCS([ \
        llseek \
        lseek64 \
        mempcpy \
 +      mkostemp \
        nanosleep \
+       open_memstream \
        personality \
-       posix_fadvise \
 --- a/include/c.h
 +++ b/include/c.h
-@@ -236,6 +236,13 @@ static inline int dirfd(DIR *d)
+@@ -233,6 +233,13 @@ static inline int dirfd(DIR *d)
  #endif
  
  /*
@@ -43,23 +44,3 @@ Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
   * MAXHOSTNAMELEN replacement
   */
  static inline size_t get_hostname_max(void)
---- a/lib/randutils.c
-+++ b/lib/randutils.c
-@@ -16,6 +16,7 @@
- #include <sys/syscall.h>
- #include "randutils.h"
-+#include "c.h"
- #ifdef HAVE_TLS
- #define THREAD_LOCAL static __thread
---- a/lib/wholedisk.c
-+++ b/lib/wholedisk.c
-@@ -10,6 +10,7 @@
- #include "blkdev.h"
- #include "wholedisk.h"
-+#include "c.h"
- int is_whole_disk_fd(int fd, const char *name)
- {
diff --git a/package/utils/util-linux/patches/003-unshare-include-libmount.h-to-provide-missing-MS_-de.patch b/package/utils/util-linux/patches/003-unshare-include-libmount.h-to-provide-missing-MS_-de.patch
deleted file mode 100644 (file)
index 27a4838..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-From d754315c54af9cb8222e0a04ed5b2b4b927ed176 Mon Sep 17 00:00:00 2001
-From: Ruediger Meier <ruediger.meier@ga-group.nl>
-Date: Mon, 17 Mar 2014 11:48:47 +0100
-Subject: [PATCH 262/288] unshare: include libmount.h to provide missing MS_*
- defines
-
-Since 6728ca10 we are using MS_PRIVATE and MS_REC which are not defined
-in some systems's sys/mount.h.
-
-Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
----
- sys-utils/Makemodule.am |    1 +
- sys-utils/unshare.c     |    3 +++
- 2 files changed, 4 insertions(+)
-
-diff --git a/sys-utils/Makemodule.am b/sys-utils/Makemodule.am
-index 30b5d3e..93a2c8d 100644
---- a/sys-utils/Makemodule.am
-+++ b/sys-utils/Makemodule.am
-@@ -296,6 +296,7 @@ usrbin_exec_PROGRAMS += unshare
- dist_man_MANS += sys-utils/unshare.1
- unshare_SOURCES = sys-utils/unshare.c
- unshare_LDADD = $(LDADD) libcommon.la
-+unshare_CFLAGS = $(AM_CFLAGS) -I$(ul_libmount_incdir)
- endif
- if BUILD_NSENTER
-diff --git a/sys-utils/unshare.c b/sys-utils/unshare.c
-index 91e0ec7..1240293 100644
---- a/sys-utils/unshare.c
-+++ b/sys-utils/unshare.c
-@@ -27,6 +27,9 @@
- #include <sys/wait.h>
- #include <sys/mount.h>
-+/* we only need some defines missing in sys/mount.h, no libmount linkage */
-+#include <libmount.h>
-+
- #include "nls.h"
- #include "c.h"
- #include "closestream.h"
--- 
-1.7.9.5
-
diff --git a/package/utils/util-linux/patches/100-fdisk_use_qsort.patch b/package/utils/util-linux/patches/100-fdisk_use_qsort.patch
deleted file mode 100644 (file)
index 5ed4806..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
---- a/libfdisk/src/sun.c
-+++ b/libfdisk/src/sun.c
-@@ -361,10 +361,10 @@ static void fetch_sun(struct fdisk_conte
-       }
- }
--static int verify_sun_cmp(int *a, int *b, void *data)
--{
--    unsigned int *verify_sun_starts = (unsigned int *) data;
-+static unsigned int *verify_sun_starts;
-+static int verify_sun_cmp(int *a, int *b)
-+{
-     if (*a == -1)
-           return 1;
-     if (*b == -1)
-@@ -379,7 +379,6 @@ static int sun_verify_disklabel(struct f
-     uint32_t starts[SUN_MAXPARTITIONS], lens[SUN_MAXPARTITIONS], start, stop;
-     uint32_t i,j,k,starto,endo;
-     int array[SUN_MAXPARTITIONS];
--    unsigned int *verify_sun_starts;
-     assert(cxt);
-     assert(cxt->label);
-@@ -427,9 +426,8 @@ static int sun_verify_disklabel(struct f
-         else
-             array[i] = -1;
-     }
--    qsort_r(array,ARRAY_SIZE(array),sizeof(array[0]),
--        (int (*)(const void *,const void *,void *)) verify_sun_cmp,
--        verify_sun_starts);
-+    qsort(array,ARRAY_SIZE(array),sizeof(array[0]),
-+        (int (*)(const void *,const void *)) verify_sun_cmp);
-     if (array[0] == -1) {
-       fdisk_info(cxt, _("No partitions defined."));