grep: Update to 3.0

This commit is contained in:
Alexey Pavlov 2017-02-27 18:30:35 +03:00
parent 9f66c7602e
commit 0b29042532
2 changed files with 68 additions and 4 deletions

View File

@ -1,7 +1,7 @@
# Maintainer: Alexey Pavlov <alexpux@gmail.com>
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
}

60
grep/grep-3.0-2.src.patch Normal file
View File

@ -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;