From 268f8951c20fffc555242928f6e34e5563a68e67 Mon Sep 17 00:00:00 2001
From: Natanael Copa <ncopa@alpinelinux.org>
Date: Fri, 25 Apr 2014 08:01:29 +0000
Subject: [PATCH] main/util-linux: upgrade to 2.24.2

---
 main/util-linux/APKBUILD                 |  28 +----
 main/util-linux/gentoo-no-scanf.patch    | 136 -----------------------
 main/util-linux/program-invocation.patch |  11 --
 main/util-linux/util-linux-posix.patch   | 101 -----------------
 4 files changed, 6 insertions(+), 270 deletions(-)
 delete mode 100644 main/util-linux/gentoo-no-scanf.patch
 delete mode 100644 main/util-linux/program-invocation.patch
 delete mode 100644 main/util-linux/util-linux-posix.patch

diff --git a/main/util-linux/APKBUILD b/main/util-linux/APKBUILD
index 0fbc18794ad2..d3c3e4d14fc0 100644
--- a/main/util-linux/APKBUILD
+++ b/main/util-linux/APKBUILD
@@ -1,26 +1,23 @@
 # Contributor: Leonardo Arena <rnalrd@alpinelinux.org>
 # Maintainer: Natanael Copa <ncopa@alpinelinux.org>
 pkgname=util-linux
-pkgver=2.23.2
+pkgver=2.24.2
 
 case $pkgver in
 	*.*.*) _v=${pkgver%.*};;
 	*.*) _v=$pkgver;;
 esac
 
-pkgrel=5
+pkgrel=0
 pkgdesc="Random collection of Linux utilities"
 url="http://kernel.org/~kzak/util-linux/"
 arch="all"
 license="GPL2 GPL2+ LGPL2+ BSD Public Domain"
 depends=
 # use GNU sed til bb sed is fixed. Also GNU tar is needed
-makedepends="zlib-dev sed ncurses-dev tar autoconf automake libtool" 
+makedepends="zlib-dev sed ncurses-dev tar autoconf automake libtool"
 install=
 source="http://www.kernel.org/pub/linux/utils/util-linux/v${_v}/util-linux-$pkgver.tar.xz
-	program-invocation.patch
-	gentoo-no-scanf.patch
-	util-linux-posix.patch
 	fix-setenv-usage.patch
 	ttydefaults.h
 	"
@@ -31,7 +28,6 @@ _builddir="$srcdir/util-linux-$pkgver"
 prepare() {
 	local i
 	cd "$_builddir"
-	update_config_sub || return 1
 	for i in $source; do
 		case $i in
 		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
@@ -44,9 +40,6 @@ prepare() {
 
 build() {
 	cd "$_builddir"
-#	sed -e 's/versionsort/alphasort/g' \
-#		-e 's/strverscmp.h/dirent.h/g' \
-#		-i mount/lomount.c
 
 	# login utils are provided by shadow (with PAM) or busybox (no PAM) --nenolod
 	./configure \
@@ -123,21 +116,12 @@ mcookie() {
 	mv "$pkgdir"/usr/bin/mcookie "$subpkgdir"/usr/bin/
 }
 
-md5sums="b39fde897334a4858bb2098edcce5b3f  util-linux-2.23.2.tar.xz
-9682a6ddd5abe65434a145ebe512c123  program-invocation.patch
-da609e7f045bec81e10868fa66d649c6  gentoo-no-scanf.patch
-43a03270b6e49fdf4c7fb0ab3390c242  util-linux-posix.patch
+md5sums="3f191727a0d28f7204b755cf1b6ea0aa  util-linux-2.24.2.tar.xz
 7033d8ec10f6ff52c8120afbe9522490  fix-setenv-usage.patch
 6196f1ce853dfaf717569c1e35555d6d  ttydefaults.h"
-sha256sums="7c4042bd91f621250d7b3b2f34e3b11921a32c7f080c149dcc0c7ce62a8a7cac  util-linux-2.23.2.tar.xz
-2bfa27969effc77631e981bbbcd1bf261e61f3e51875db950883ddb2a90ea4fd  program-invocation.patch
-2843a637f8300720b0f0917496d7b814d210a8777c93cfac51fcd3e5777e21d5  gentoo-no-scanf.patch
-d099d398d5e6649276d0ccd3b276aa762f52efec8295706370fef44287a2386f  util-linux-posix.patch
+sha256sums="1243d6c07f1c5b38aa4c3814c81a71c24cba7dafe08942916bf216a90a460ff0  util-linux-2.24.2.tar.xz
 ff1625c8d479511b263c1beb86bf6c30c2e13142183647f4fa8c62ff1bc68910  fix-setenv-usage.patch
 46faf1198bd884d12c5d45019a5fec8dfdefeae6721d8c9f3da89921acdb2a6d  ttydefaults.h"
-sha512sums="dcccf8e3a3892a2ac98eea0a7e1c24c1b612ef10b466a8b34d8ebe6c2d49778bc9e8bfb1866ce0daa6db387396659120c290c5b36f47864c4d513b5ed15f9618  util-linux-2.23.2.tar.xz
-5a07e86fa84961f73e53677d202e7a2101704eacb698426e62da897af07c7f1227e841f79ff59deed50cfb0e9ef1816f7c3fd03382ae4aa46909b6cd41a95d4e  program-invocation.patch
-b505f828d64567cf28590de15200e89b4ca26c562134db4c1bb8adf829a903a703d92d3597a5d86d1053ff602c41f84d88cf16b45ef7d857a021c73a9b7d0ee7  gentoo-no-scanf.patch
-4a5052caad3a9fb176283d49c486256453ede2a10d99c5f0a4e78a25a03f09a69c6d840756e07aaee581003b018c8b8279e6f727712edf03ff755d162544b729  util-linux-posix.patch
+sha512sums="a0c03876ef19fa09e434e3e5362fb3f3e0a254b3b39a623ac7a9a207d06afce00366792244ed0fac86931f8340c046620660f33c3444a07a12037182fc191240  util-linux-2.24.2.tar.xz
 310acfe2f171010014d25b1788ea64bffc5a315f4fef8d3b8fc9b003bda8810111b12987052eb2d5856500bd6b742792c977608fe9459ce2efe7545ef0054588  fix-setenv-usage.patch
 876bb9041eca1b2cca1e9aac898f282db576f7860aba690a95c0ac629d7c5b2cdeccba504dda87ff55c2a10b67165985ce16ca41a0694a267507e1e0cafd46d9  ttydefaults.h"
diff --git a/main/util-linux/gentoo-no-scanf.patch b/main/util-linux/gentoo-no-scanf.patch
deleted file mode 100644
index c95b7553e041..000000000000
--- a/main/util-linux/gentoo-no-scanf.patch
+++ /dev/null
@@ -1,136 +0,0 @@
-Fix libmount build under uClibc
-
-See https://bugs.gentoo.org/show_bug.cgi?id=406303
-http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/sys-apps/util-linux/files/util-linux-2.21.1-no-printf-alloc.patch?revision=1.2
-ported to util-linux-2.23.2
-
---- a/configure.ac	2013-07-30 03:39:26.188738061 -0500
-+++ b/configure.ac	2013-09-05 15:31:11.460864363 -0500
-@@ -755,7 +755,6 @@
- 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)
- AM_CONDITIONAL(BUILD_LIBMOUNT_TESTS, test "x$build_libmount" = xyes -a "x$enable_static" = xyes)
- 
---- a/libmount/src/tab_parse.c	2013-07-30 03:39:26.218738358 -0500
-+++ b/libmount/src/tab_parse.c	2013-09-05 15:31:11.460864363 -0500
-@@ -22,6 +22,10 @@
- #include "pathnames.h"
- #include "strutils.h"
- 
-+#ifndef HAVE_SCANF_MS_MODIFIER
-+# define UL_SCNsA "%s"
-+#endif
-+
- static inline char *skip_spaces(char *s)
- {
- 	assert(s);
-@@ -61,16 +65,31 @@
- 	int rc, n = 0, xrc;
- 	char *src = NULL, *fstype = NULL, *optstr = NULL;
- 
-+#ifndef HAVE_SCANF_MS_MODIFIER
-+	size_t len = strlen(s) + 1;
-+	src = malloc(len);
-+	fstype = malloc(len);
-+	fs->target = malloc(len);
-+	optstr = malloc(len);
-+#endif
-+
- 	rc = sscanf(s,	UL_SCNsA" "	/* (1) source */
- 			UL_SCNsA" "	/* (2) target */
- 			UL_SCNsA" "	/* (3) FS type */
- 			UL_SCNsA" "	/* (4) options */
- 			"%n",		/* byte count */
- 
-+#ifdef HAVE_SCANF_MS_MODIFIER
- 			&src,
- 			&fs->target,
- 			&fstype,
- 			&optstr,
-+#else
-+			src,
-+			fs->target,
-+			fstype,
-+			optstr,
-+#endif
- 			&n);
- 	xrc = rc;
- 
-@@ -136,6 +155,16 @@
- 	unsigned int maj, min;
- 	char *fstype = NULL, *src = NULL, *p;
- 
-+#ifndef HAVE_SCANF_MS_MODIFIER
-+	size_t len = strlen(s) + 1;
-+	fs->root = malloc(len);
-+	fs->target = malloc(len);
-+	fs->vfs_optstr = malloc(len);
-+	fs->fs_optstr = malloc(len);
-+	fstype = malloc(len);
-+	src = malloc(len);
-+#endif
-+
- 	rc = sscanf(s,	"%u "		/* (1) id */
- 			"%u "		/* (2) parent */
- 			"%u:%u "	/* (3) maj:min */
-@@ -147,9 +176,15 @@
- 			&fs->id,
- 			&fs->parent,
- 			&maj, &min,
-+#ifdef HAVE_SCANF_MS_MODIFIER
- 			&fs->root,
- 			&fs->target,
- 			&fs->vfs_optstr,
-+#else
-+			fs->root,
-+			fs->target,
-+			fs->vfs_optstr,
-+#endif
- 			&end);
- 
- 	if (rc >= 7 && end > 0)
-@@ -169,9 +204,15 @@
- 			UL_SCNsA" "	/* (9) source */
- 			UL_SCNsA,	/* (10) fs options (fs specific) */
- 
-+#ifdef HAVE_SCANF_MS_MODIFIER
- 			&fstype,
- 			&src,
- 			&fs->fs_optstr);
-+#else
-+			fstype,
-+			src,
-+			fs->fs_optstr);
-+#endif
- 
- 	if (rc >= 10) {
- 		fs->flags |= MNT_FS_KERNEL;
-@@ -279,14 +320,25 @@
- 	int rc;
- 	char *src = NULL;
- 
-+#ifndef HAVE_SCANF_MS_MODIFIER
-+	size_t len = strlen(s) + 1;
-+	src = malloc(len);
-+	fs->swaptype = malloc(len);
-+#endif
-+
- 	rc = sscanf(s,	UL_SCNsA" "	/* (1) source */
- 			UL_SCNsA" "	/* (2) type */
- 			"%jd"		/* (3) size */
- 			"%jd"		/* (4) used */
- 			"%d",		/* priority */
- 
-+#ifdef HAVE_SCANF_MS_MODIFIER
- 			&src,
- 			&fs->swaptype,
-+#else
-+			src,
-+			fs->swaptype,
-+#endif
- 			&fsz,
- 			&usz,
- 			&fs->priority);
diff --git a/main/util-linux/program-invocation.patch b/main/util-linux/program-invocation.patch
deleted file mode 100644
index e3c266e5b428..000000000000
--- a/main/util-linux/program-invocation.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- util-linux-2.21.orig/include/c.h
-+++ util-linux-2.21.1/include/c.h
-@@ -115,7 +115,7 @@
- 
- #ifndef HAVE_PROGRAM_INVOCATION_SHORT_NAME
- # ifdef HAVE___PROGNAME
--extern char *__progname;
-+extern const char *__progname;
- #  define program_invocation_short_name __progname
- # else
- #  include <string.h>
diff --git a/main/util-linux/util-linux-posix.patch b/main/util-linux/util-linux-posix.patch
deleted file mode 100644
index 3fd93cd0a69d..000000000000
--- a/main/util-linux/util-linux-posix.patch
+++ /dev/null
@@ -1,101 +0,0 @@
-patch taken from sabotage linux -- https://github.com/rofl0r/sabotage
-diff -aur util-linux-2.23.1.org/fdisks/cfdisk.c util-linux-2.23.1/fdisks/cfdisk.c
---- util-linux-2.23.1.org/fdisks/cfdisk.c	2013-07-01 21:37:58.508000002 +0000
-+++ util-linux-2.23.1/fdisks/cfdisk.c	2013-07-01 22:00:23.042000002 +0000
-@@ -325,7 +325,7 @@
- int logical = 0;
- long long logical_sectors[MAXIMUM_PARTS];
- 
--__sighandler_t old_SIGINT, old_SIGTERM;
-+sighandler_t old_SIGINT, old_SIGTERM;
- 
- int arrow_cursor = FALSE;
- int display_units = MEGABYTES;
-diff -aur util-linux-2.23.1.org/fdisks/fdisksunlabel.c util-linux-2.23.1/fdisks/fdisksunlabel.c
---- util-linux-2.23.1.org/fdisks/fdisksunlabel.c	2013-07-01 21:37:58.508000002 +0000
-+++ util-linux-2.23.1/fdisks/fdisksunlabel.c	2013-07-01 21:59:43.721000002 +0000
-@@ -383,9 +383,11 @@
- 	}
- }
- 
--static int verify_sun_cmp(int *a, int *b, void *data)
-+static void* cmp_data;
-+static int verify_sun_cmp(const void *pa, const void *pb)
- {
--    unsigned int *verify_sun_starts = (unsigned int *) data;
-+    const int *a = pa, *b = pb;
-+    unsigned int *verify_sun_starts = (unsigned int *) cmp_data;
- 
-     if (*a == -1)
- 	    return 1;
-@@ -449,9 +451,8 @@
-         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);
-+    cmp_data = verify_sun_starts;
-+    qsort(array,ARRAY_SIZE(array),sizeof(array[0]), verify_sun_cmp);
- 
-     if (array[0] == -1) {
- 	fdisk_info(cxt, _("No partitions defined"));
-diff -aur util-linux-2.23.1.org/include/ttyutils.h util-linux-2.23.1/include/ttyutils.h
---- util-linux-2.23.1.org/include/ttyutils.h	2013-07-01 21:37:58.433000002 +0000
-+++ util-linux-2.23.1/include/ttyutils.h	2013-07-01 21:48:42.328000002 +0000
-@@ -10,6 +10,7 @@
- #include <stdlib.h>
- #include <termios.h>
- #include <limits.h>
-+#include "ttydefaults.h"
- #ifdef HAVE_SYS_IOCTL_H
- #include <sys/ioctl.h>
- #endif
-diff -aur util-linux-2.23.1.org/term-utils/setterm.c util-linux-2.23.1/term-utils/setterm.c
---- util-linux-2.23.1.org/term-utils/setterm.c	2013-07-01 21:37:58.442000002 +0000
-+++ util-linux-2.23.1/term-utils/setterm.c	2013-07-01 22:02:54.244000002 +0000
-@@ -123,7 +123,7 @@
- #include "nls.h"
- #include "closestream.h"
- 
--#if __GNU_LIBRARY__ < 5
-+#if defined(__GLIBC__) && __GNU_LIBRARY__ < 5
- #ifndef __alpha__
- # include <linux/unistd.h>
- #define __NR_klogctl __NR_syslog
-diff -aur util-linux-2.23.1.org/term-utils/ttymsg.c util-linux-2.23.1/term-utils/ttymsg.c
---- util-linux-2.23.1.org/term-utils/ttymsg.c	2013-07-01 21:37:58.442000002 +0000
-+++ util-linux-2.23.1/term-utils/ttymsg.c	2013-07-01 22:07:02.788000002 +0000
-@@ -41,6 +41,7 @@
-   */
- 
- #include <sys/types.h>
-+#include <sys/param.h>
- #include <sys/uio.h>
- #include <signal.h>
- #include <fcntl.h>
-diff -aur util-linux-2.23.1.org/text-utils/hexdump.h util-linux-2.23.1/text-utils/hexdump.h
---- util-linux-2.23.1.org/text-utils/hexdump.h	2013-07-01 21:37:58.437000002 +0000
-+++ util-linux-2.23.1/text-utils/hexdump.h	2013-07-01 22:01:27.005000002 +0000
-@@ -32,7 +32,7 @@
-  *
-  *	@(#)hexdump.h	5.4 (Berkeley) 6/1/90
-  */
--
-+#include <sys/types.h>
- typedef struct _pr {
- 	struct _pr *nextpr;		/* next print unit */
- #define	F_ADDRESS	0x001		/* print offset */
-diff -aur util-linux-2.23.1.org/text-utils/pg.c util-linux-2.23.1/text-utils/pg.c
---- util-linux-2.23.1.org/text-utils/pg.c	2013-07-01 21:37:58.437000002 +0000
-+++ util-linux-2.23.1/text-utils/pg.c	2013-07-01 22:01:55.831000002 +0000
-@@ -37,7 +37,7 @@
- #ifndef	TIOCGWINSZ
- # include <sys/ioctl.h>
- #endif
--#include <sys/termios.h>
-+#include <termios.h>
- #include <fcntl.h>
- #include <regex.h>
- #include <stdio.h>
-
-- 
GitLab