From 0b290425324619e3c4b4b94e05deb03c974b8da2 Mon Sep 17 00:00:00 2001 From: Alexey Pavlov Date: Mon, 27 Feb 2017 18:30:35 +0300 Subject: [PATCH] grep: Update to 3.0 --- grep/PKGBUILD | 12 +++++--- grep/grep-3.0-2.src.patch | 60 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+), 4 deletions(-) create mode 100644 grep/grep-3.0-2.src.patch diff --git a/grep/PKGBUILD b/grep/PKGBUILD index 57ec5368..9f60f6de 100644 --- a/grep/PKGBUILD +++ b/grep/PKGBUILD @@ -1,7 +1,7 @@ # Maintainer: Alexey Pavlov pkgname=grep -pkgver=2.27 +pkgver=3.0 pkgrel=1 pkgdesc="A string search utility" arch=('i686' 'x86_64') @@ -12,16 +12,20 @@ depends=('libiconv' 'libintl' 'libpcre' 'sh') makedepends=('texinfo' 'gettext-devel' 'libiconv-devel' 'pcre-devel') install=${pkgname}.install source=(https://ftp.gnu.org/gnu/${pkgname}/${pkgname}-${pkgver}.tar.xz{,.sig} - grep-2.23-msys2.patch) -sha256sums=('ad4cc44d23074a1c3a8baae8fbafff2a8c60f38a9a6108f985eef6fbee6dcaeb' + grep-2.23-msys2.patch + grep-3.0-2.src.patch) +sha256sums=('e2c81db5056e3e8c5995f0bb5d0d0e1cad1f6f45c3b2fc77b6e81435aed48ab5' 'SKIP' - '9b9b87f5aa12c49e4e4403d27b85fef3f1de252dfe4eed1a7a4f982ef515a95a') + '9b9b87f5aa12c49e4e4403d27b85fef3f1de252dfe4eed1a7a4f982ef515a95a' + '0b2e7e54eb4d5b13257c1b4b43bcb234be02ded8fd04dfbbb73a92346e8b2db2') validpgpkeys=('155D3FC500C834486D1EEA677FD9FCCB000BEEEE') # Jim Meyering prepare() { cd ${srcdir}/${pkgname}-${pkgver} patch -p1 -i ${srcdir}/grep-2.23-msys2.patch + # Once this will be commit upstream we need revert it + # patch -p2 -R -i ${srcdir}/grep-3.0-2.src.patch autoreconf -fi } diff --git a/grep/grep-3.0-2.src.patch b/grep/grep-3.0-2.src.patch new file mode 100644 index 00000000..7cd7a087 --- /dev/null +++ b/grep/grep-3.0-2.src.patch @@ -0,0 +1,60 @@ +--- origsrc/grep-3.0/src/dosbuf.c 2017-01-01 05:34:33.000000000 -0600 ++++ src/grep-3.0/src/dosbuf.c 2017-02-14 10:04:20.155290800 -0600 +@@ -48,6 +48,7 @@ static struct dos_map *dos_pos_map; + static int dos_pos_map_size = 0; + static int dos_pos_map_used = 0; + static int inp_map_idx = 0, out_map_idx = 1; ++static int mode_forced; + + /* Set default DOS file type to binary. */ + static void +@@ -95,7 +96,7 @@ guess_type (char *buf, size_t buflen) + static size_t + undossify_input (char *buf, size_t buflen) + { +- if (! O_BINARY) ++ if (! O_BINARY || ! mode_forced) + return buflen; + + size_t bytes_left = 0; +@@ -186,7 +187,7 @@ undossify_input (char *buf, size_t bufle + static off_t + dossified_pos (off_t byteno) + { +- if (! O_BINARY) ++ if (! O_BINARY || ! mode_forced) + return byteno; + + off_t pos_lo; +--- origsrc/grep-3.0/src/grep.c 2017-02-08 19:37:33.000000000 -0600 ++++ src/grep-3.0/src/grep.c 2017-02-14 10:04:20.170826400 -0600 +@@ -1860,10 +1860,17 @@ grepdesc (int desc, bool command_line) + goto closeout; + } + +- /* Set input to binary mode. Pipes are simulated with files +- on DOS, so this includes the case of "foo | grep bar". */ ++ /* Force input to binary mode, while remembering if it was originally ++ text. Options -u and -U only matter on text mounts. */ ++ mode_forced = 0; + if (O_BINARY && !isatty (desc)) +- set_binary_mode (desc, O_BINARY); ++ { ++ if (fcntl (desc, F_GETFL) & O_TEXT) ++ { ++ set_binary_mode (desc, O_BINARY); ++ mode_forced = 1; ++ } ++ } + + count = grep (desc, &st, &ineof); + if (count_matches) +@@ -2586,7 +2593,7 @@ main (int argc, char **argv) + break; + + case 'f': +- fp = STREQ (optarg, "-") ? stdin : fopen (optarg, O_TEXT ? "rt" : "r"); ++ fp = STREQ (optarg, "-") ? stdin : fopen (optarg, "r"); + if (!fp) + die (EXIT_TROUBLE, errno, "%s", optarg); + oldcc = keycc;