From fd4c285cd86a1c06acaa34c33cb898c057208ec5 Mon Sep 17 00:00:00 2001 From: "Heiko Schlittermann (HS12)" Date: Sun, 26 Apr 2015 23:20:29 +0200 Subject: [PATCH] exigrep: fallback to $PATH if zcat is missing. BUG 1575 --- doc/doc-docbook/spec.xfpt | 2 ++ doc/doc-txt/ChangeLog | 3 +++ src/src/EDITME | 8 +++++++- src/src/exigrep.src | 2 +- 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/doc/doc-docbook/spec.xfpt b/doc/doc-docbook/spec.xfpt index 9b7ada823..bc34d65b8 100644 --- a/doc/doc-docbook/spec.xfpt +++ b/doc/doc-docbook/spec.xfpt @@ -35713,6 +35713,8 @@ search term. If the location of a &'zcat'& command is known from the definition of ZCAT_COMMAND in &_Local/Makefile_&, &'exigrep'& automatically passes any file whose name ends in COMPRESS_SUFFIX through &'zcat'& as it searches it. +If the ZCAT_COMMAND is not executable, &'exigrep'& tries to use +autodetection of some well known compression extensions. .section "Selecting messages by various criteria (exipick)" "SECTexipick" diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog index 08fb50f3e..a75c10657 100644 --- a/doc/doc-txt/ChangeLog +++ b/doc/doc-txt/ChangeLog @@ -89,6 +89,9 @@ HS/01 DNSSEC options (dnssec_require_domains, dnssec_request_domains) JH/25 Bug 466: Add RFC2322 support for MIME attachment filenames. Original patch from Alexander Shikoff, worked over by JH. +HS/02 Bug 1575: exigrep falls back to autodetection of compressed + files if ZCAT_COMMAND is not executable. + Exim version 4.85 ----------------- diff --git a/src/src/EDITME b/src/src/EDITME index 41b929bdf..866987c25 100644 --- a/src/src/EDITME +++ b/src/src/EDITME @@ -876,9 +876,15 @@ COMPRESS_SUFFIX=gz # If the exigrep utility is fed compressed log files, it tries to uncompress # them using this command. +# Leave it empty to enforce autodetection at runtime: +# ZCAT_COMMAND= +# +# Omit the path if you want to use your system's PATH: +# ZCAT_COMMAND=zcat +# +# Or specify the full pathname: ZCAT_COMMAND=/usr/bin/zcat - #------------------------------------------------------------------------------ # Compiling in support for embedded Perl: If you want to be able to # use Perl code in Exim's string manipulation language and you have Perl diff --git a/src/src/exigrep.src b/src/src/exigrep.src index 419fcb54c..1b5bcf8ea 100644 --- a/src/src/exigrep.src +++ b/src/src/exigrep.src @@ -224,7 +224,7 @@ if (@ARGV) foreach (@ARGV) { my $filename = $_; - if ($filename =~ /\.(?:COMPRESS_SUFFIX)$/o) + if (-x 'ZCAT_COMMAND' && $filename =~ /\.(?:COMPRESS_SUFFIX)$/o) { open(LOG, "ZCAT_COMMAND $filename |") || die "Unable to zcat $filename: $!\n"; -- 2.25.1