From 102445f85bb8878dcd571ed86b51c718a0de73d9 Mon Sep 17 00:00:00 2001
From: Britney Fransen <brfransen@gmail.com>
Date: Sun, 21 Sep 2014 21:04:02 +0000
Subject: patch: update to 2.7.1

---
 abs/core/patch/PKGBUILD                            | 48 +++++++------
 ...1-initialize-data-structures-early-enough.patch | 81 ++++++++++++++++++++++
 2 files changed, 108 insertions(+), 21 deletions(-)
 create mode 100644 abs/core/patch/patch-2.7.1-initialize-data-structures-early-enough.patch

diff --git a/abs/core/patch/PKGBUILD b/abs/core/patch/PKGBUILD
index 8c0185f..8171a3a 100644
--- a/abs/core/patch/PKGBUILD
+++ b/abs/core/patch/PKGBUILD
@@ -1,40 +1,46 @@
-# $Id: PKGBUILD 142074 2011-11-04 23:36:08Z allan $
-# Maintainer: Allan McRae <allan@archlinux.org>
+# $Id$
+# Maintainer: Sébastien Luttringer <seblu@archlinux.org>
+# Contributor: Allan McRae <allan@archlinux.org>
 # Contributor: judd <jvinet@zeroflux.org>
 
 pkgname=patch
-pkgver=2.6.1
+pkgver=2.7.1
 pkgrel=3
-pkgdesc="A utility to apply patch files to original sources"
+pkgdesc='A utility to apply patch files to original sources'
 arch=('i686' 'x86_64')
-url="http://www.gnu.org/software/patch/patch.html"
+url='http://www.gnu.org/software/patch/patch.html'
 license=('GPL')
 groups=('base-devel')
-depends=('glibc')
+depends=('glibc' 'attr')
 makedepends=('ed')
-optdepends=('ed: Interpret the patch as an ed script; for patch -e functionality(deprecated)')
-source=(ftp://ftp.gnu.org/gnu/${pkgname}/${pkgname}-${pkgver}.tar.gz{,.sig}
-        patch-2.6.1-get-arg.patch)
-md5sums=('d758eb96d3f75047efc004a720d33daf'
-         'f7953f3e472fae5118815e6138372e22'
-         '45cd5709adbbcdcb3ab95dc43559c07c')
+optdepends=('ed: for patch -e functionality')
+source=("ftp://ftp.gnu.org/gnu/$pkgname/$pkgname-$pkgver.tar.xz"{,.sig}
+        'patch-2.7.1-initialize-data-structures-early-enough.patch')
+md5sums=('e9ae5393426d3ad783a300a338c09b72'
+         'SKIP'
+         'dc6367a7cd49933d4006c246789e98da')
 
-build() {
-  cd ${srcdir}/${pkgname}-${pkgver}
+prepare() {
+  # Fix segfault on non-numeric strip-count
+  # (also segfaults on nonexistent directory passed to -d)
+  # http://savannah.gnu.org/bugs/?37500
+  patch -Np1 -d $pkgname-$pkgver < patch-2.7.1-initialize-data-structures-early-enough.patch
+}
 
-  # Fixed argument type for --get
-  # see https://bugzilla.redhat.com/show_bug.cgi?id=553624
-  patch -Np1 -i $srcdir/patch-2.6.1-get-arg.patch
-  ./configure --prefix=/usr --mandir=/usr/share/man
+build() {
+  cd $pkgname-$pkgver
+  ./configure --prefix=/usr
   make
 }
 
 check() {
-  cd ${srcdir}/${pkgname}-${pkgver}
+  cd $pkgname-$pkgver
   make check
 }
 
 package() {
-  cd ${srcdir}/${pkgname}-${pkgver}
-  make prefix=${pkgdir}/usr mandir=${pkgdir}/usr/share/man install
+  cd $pkgname-$pkgver
+  make DESTDIR="$pkgdir" install
 }
+
+# vim:set ts=2 sw=2 et:
diff --git a/abs/core/patch/patch-2.7.1-initialize-data-structures-early-enough.patch b/abs/core/patch/patch-2.7.1-initialize-data-structures-early-enough.patch
new file mode 100644
index 0000000..046edc3
--- /dev/null
+++ b/abs/core/patch/patch-2.7.1-initialize-data-structures-early-enough.patch
@@ -0,0 +1,81 @@
+From 291ec175812b7ba291d124e4cf2fbf9efec590c8 Mon Sep 17 00:00:00 2001
+From: Andreas Gruenbacher <agruen@linbit.com>
+Date: Thu, 4 Oct 2012 12:33:09 +0200
+Subject: [PATCH] Initialize data structures early enough
+
+* src/patch.c (main): Initialize data structures early enough, before error
+paths can access them.
+* tests/bad-usage: Test bad command line usage.
+* tests/Makefile.am (TESTS): Add bad-usage here.
+---
+ src/patch.c       |  8 ++++----
+ tests/Makefile.am |  1 +
+ tests/bad-usage   | 18 ++++++++++++++++++
+ 3 files changed, 23 insertions(+), 4 deletions(-)
+ create mode 100644 tests/bad-usage
+
+diff --git a/src/patch.c b/src/patch.c
+index 828943b..0255fbb 100644
+--- a/src/patch.c
++++ b/src/patch.c
+@@ -150,6 +150,10 @@ main (int argc, char **argv)
+     else if ((version_control = getenv ("VERSION_CONTROL")))
+       version_control_context = "$VERSION_CONTROL";
+ 
++    init_backup_hash_table ();
++    init_files_to_delete ();
++    init_files_to_output ();
++
+     /* parse switches */
+     Argc = argc;
+     Argv = argv;
+@@ -162,10 +166,6 @@ main (int argc, char **argv)
+     if (make_backups | backup_if_mismatch)
+       backup_type = get_version (version_control_context, version_control);
+ 
+-    init_backup_hash_table ();
+-    init_files_to_delete ();
+-    init_files_to_output ();
+-
+     init_output (&outstate);
+     if (outfile)
+       outstate.ofp = open_outfile (outfile);
+diff --git a/tests/Makefile.am b/tests/Makefile.am
+index 02fc6de..5cea52d 100644
+--- a/tests/Makefile.am
++++ b/tests/Makefile.am
+@@ -20,6 +20,7 @@ TESTS = \
+ 	asymmetric-hunks \
+ 	backup-prefix-suffix \
+ 	bad-filenames \
++	bad-usage \
+ 	concat-git-diff \
+ 	copy-rename \
+ 	corrupt-reject-files \
+diff --git a/tests/bad-usage b/tests/bad-usage
+new file mode 100644
+index 0000000..022eeda
+--- /dev/null
++++ b/tests/bad-usage
+@@ -0,0 +1,18 @@
++# Copyright (C) 2009, 2011-2012 Free Software Foundation, Inc.
++#
++# Copying and distribution of this file, with or without modification,
++# in any medium, are permitted without royalty provided the copyright
++# notice and this notice are preserved.
++
++. $srcdir/test-lib.sh
++
++require_cat
++use_local_patch
++use_tmpdir
++
++# ==============================================================
++
++check 'patch -px || echo "status: $?"' <<EOF
++$PATCH: **** strip count x is not a number
++status: 2
++EOF
+-- 
+1.8.0.3
+
-- 
cgit v0.12

