Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
grep-configure.patch: Activating WINDOWS_STAT_INODES fixes recursion. grep-lock.patch: We still need to use SetConsoleCtrlHandler() to avoid leaking color. grep.patch: Everything here has either been fixed upstream or decomposed into smaller patches. The distro's batch file needs `set GREP_COLORS=mt=01;32:fn=36:ln=33:bn=31:se=35`. It also needs a Doskey macro for `--color=auto`. grep.sh: --disable-largefile was added in distro 11.0. It was still necessary for grep 2.10, but not for grep 3.1.
- Loading branch information
1 parent
d9ff15b
commit 0ad9e1b
Showing
4 changed files
with
75 additions
and
315 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
diff -aurN grep-3.1/configure grep-3.1-fixed/configure | ||
--- grep-3.1/configure 2017-07-02 13:21:11.000000000 -0700 | ||
+++ grep-3.1-fixed/configure 2017-07-23 18:54:07.438394700 -0700 | ||
@@ -14896,7 +14896,7 @@ | ||
|
||
|
||
|
||
- WINDOWS_STAT_INODES=0 | ||
+ WINDOWS_STAT_INODES=1 | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
diff -aurN grep-3.1/lib/colorize-w32.c grep-3.1-fixed/lib/colorize-w32.c | ||
--- grep-3.1/lib/colorize-w32.c 2017-01-01 03:34:33.000000000 -0800 | ||
+++ grep-3.1-fixed/lib/colorize-w32.c 2017-07-30 16:43:02.773225700 -0700 | ||
@@ -32,6 +32,27 @@ | ||
|
||
static HANDLE hstdout = INVALID_HANDLE_VALUE; | ||
static SHORT norm_attr; | ||
+static CRITICAL_SECTION color_lock; | ||
+static BOOL color_bool = TRUE; | ||
+ | ||
+/* After Ctrl+C or Ctrl+Break, | ||
+ restore the normal text attribute used by the console. */ | ||
+static BOOL WINAPI | ||
+w32_color_handler (DWORD ctrl_type) | ||
+{ | ||
+ if (ctrl_type == CTRL_C_EVENT | ||
+ || ctrl_type == CTRL_BREAK_EVENT) | ||
+ { | ||
+ EnterCriticalSection (&color_lock); | ||
+ if (hstdout != INVALID_HANDLE_VALUE) | ||
+ { | ||
+ SetConsoleTextAttribute (hstdout, norm_attr); | ||
+ } | ||
+ color_bool = FALSE; | ||
+ LeaveCriticalSection (&color_lock); | ||
+ } | ||
+ return FALSE; | ||
+} | ||
|
||
/* Initialize the normal text attribute used by the console. */ | ||
void | ||
@@ -45,6 +66,9 @@ | ||
norm_attr = csbi.wAttributes; | ||
else | ||
hstdout = INVALID_HANDLE_VALUE; | ||
+ | ||
+ InitializeCriticalSectionAndSpinCount (&color_lock, 4000); | ||
+ SetConsoleCtrlHandler (&w32_color_handler, TRUE); | ||
} | ||
|
||
/* Return non-zero if we should highlight matches in output. */ | ||
@@ -164,7 +188,12 @@ | ||
if (hstdout != INVALID_HANDLE_VALUE) | ||
{ | ||
SHORT attr = w32_sgr2attr (sgr_seq); | ||
- SetConsoleTextAttribute (hstdout, attr); | ||
+ EnterCriticalSection (&color_lock); | ||
+ if (color_bool) | ||
+ { | ||
+ SetConsoleTextAttribute (hstdout, attr); | ||
+ } | ||
+ LeaveCriticalSection (&color_lock); | ||
} | ||
else | ||
printf (sgr_start, sgr_seq); |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.