Fix crash for --line-buffered with a .gz or .bz2 file in pcre2grep.
This commit is contained in:
parent
76814d92c7
commit
2543ba81f7
|
@ -51,6 +51,10 @@ subsequent lines. Behaviour was different with and without colouring, and
|
||||||
sometimes context lines were incorrectly printed and/or line endings were lost.
|
sometimes context lines were incorrectly printed and/or line endings were lost.
|
||||||
All these issues should now be fixed.
|
All these issues should now be fixed.
|
||||||
|
|
||||||
|
14. If --line-buffered was specified for pcre2grep when input was from a
|
||||||
|
compressed file (.gz or .bz2) a segfault occurred. (Line buffering should be
|
||||||
|
ignored for compressed files.)
|
||||||
|
|
||||||
|
|
||||||
Version 10.30 14-August-2017
|
Version 10.30 14-August-2017
|
||||||
----------------------------
|
----------------------------
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
.TH PCRE2GREP 1 "23 October 2017" "PCRE2 10.31"
|
.TH PCRE2GREP 1 "13 November 2017" "PCRE2 10.31"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
pcre2grep - a grep with Perl-compatible regular expressions.
|
pcre2grep - a grep with Perl-compatible regular expressions.
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
|
@ -101,11 +101,13 @@ The \fB--locale\fP option can be used to override this.
|
||||||
.rs
|
.rs
|
||||||
.sp
|
.sp
|
||||||
It is possible to compile \fBpcre2grep\fP so that it uses \fBlibz\fP or
|
It is possible to compile \fBpcre2grep\fP so that it uses \fBlibz\fP or
|
||||||
\fBlibbz2\fP to read files whose names end in \fB.gz\fP or \fB.bz2\fP,
|
\fBlibbz2\fP to read compressed files whose names end in \fB.gz\fP or
|
||||||
respectively. You can find out whether your binary has support for one or both
|
\fB.bz2\fP, respectively. You can find out whether your \fBpcre2grep\fP binary
|
||||||
of these file types by running it with the \fB--help\fP option. If the
|
has support for one or both of these file types by running it with the
|
||||||
appropriate support is not present, files are treated as plain text. The
|
\fB--help\fP option. If the appropriate support is not present, all files are
|
||||||
standard input is always so treated.
|
treated as plain text. The standard input is always so treated. When input is
|
||||||
|
from a compressed .gz or .bz2 file, the \fB--line-buffered\fP option is
|
||||||
|
ignored.
|
||||||
.
|
.
|
||||||
.
|
.
|
||||||
.SH "BINARY FILES"
|
.SH "BINARY FILES"
|
||||||
|
@ -417,14 +419,16 @@ are being output. If not supplied, "(standard input)" is used. There is no
|
||||||
short form for this option.
|
short form for this option.
|
||||||
.TP
|
.TP
|
||||||
\fB--line-buffered\fP
|
\fB--line-buffered\fP
|
||||||
When this option is given, input is read and processed line by line, and the
|
When this option is given, non-compressed input is read and processed line by
|
||||||
output is flushed after each write. By default, input is read in large chunks,
|
line, and the output is flushed after each write. By default, input is read in
|
||||||
unless \fBpcre2grep\fP can determine that it is reading from a terminal (which
|
large chunks, unless \fBpcre2grep\fP can determine that it is reading from a
|
||||||
is currently possible only in Unix-like environments). Output to terminal is
|
terminal (which is currently possible only in Unix-like environments). Output
|
||||||
normally automatically flushed by the operating system. This option can be
|
to terminal is normally automatically flushed by the operating system. This
|
||||||
useful when the input or output is attached to a pipe and you do not want
|
option can be useful when the input or output is attached to a pipe and you do
|
||||||
\fBpcre2grep\fP to buffer up large amounts of data. However, its use will
|
not want \fBpcre2grep\fP to buffer up large amounts of data. However, its use
|
||||||
affect performance, and the \fB-M\fP (multiline) option ceases to work.
|
will affect performance, and the \fB-M\fP (multiline) option ceases to work.
|
||||||
|
When input is from a compressed .gz or .bz2 file, \fB--line-buffered\fP is
|
||||||
|
ignored.
|
||||||
.TP
|
.TP
|
||||||
\fB--line-offsets\fP
|
\fB--line-offsets\fP
|
||||||
Instead of showing lines or parts of lines that match, show each match as a
|
Instead of showing lines or parts of lines that match, show each match as a
|
||||||
|
@ -858,6 +862,6 @@ Cambridge, England.
|
||||||
.rs
|
.rs
|
||||||
.sp
|
.sp
|
||||||
.nf
|
.nf
|
||||||
Last updated: 23 October 2017
|
Last updated: 13 November 2017
|
||||||
Copyright (c) 1997-2017 University of Cambridge.
|
Copyright (c) 1997-2017 University of Cambridge.
|
||||||
.fi
|
.fi
|
||||||
|
|
|
@ -2332,6 +2332,7 @@ if (frtype != FR_LIBZ && frtype != FR_LIBBZ2)
|
||||||
in = (FILE *)handle;
|
in = (FILE *)handle;
|
||||||
if (is_file_tty(in)) input_line_buffered = TRUE;
|
if (is_file_tty(in)) input_line_buffered = TRUE;
|
||||||
}
|
}
|
||||||
|
else input_line_buffered = FALSE;
|
||||||
|
|
||||||
bufflength = fill_buffer(handle, frtype, main_buffer, bufsize,
|
bufflength = fill_buffer(handle, frtype, main_buffer, bufsize,
|
||||||
input_line_buffered);
|
input_line_buffered);
|
||||||
|
|
Loading…
Reference in New Issue