[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Run-time dynamic linking in grep

From: Jim Meyering
Subject: Re: Run-time dynamic linking in grep
Date: Fri, 21 Jan 2011 15:42:24 +0100

Reuben Thomas wrote:
> From 0fcaa65199a64239a3552ca4bbbdd7fb1edaca71 Mon Sep 17 00:00:00 2001
> From: Reuben Thomas <address@hidden>
> Date: Fri, 21 Jan 2011 13:21:32 +0000
> Subject: [PATCH] Add --decompress flag for transparent decompression using 
> zlib.
> ---
>  configure.ac |   14 ++++++++++++++
>  src/main.c   |   26 +++++++++++++++++++++++++-
>  2 files changed, 39 insertions(+), 1 deletions(-)

Thanks, but you must have left out some important pieces.
That didn't even compile, due to lack of gl_gzdopen declaration on F14.
Once compiled, the --decompress option did nothing, since do_decompress
was never set.

I made these changes:

diff --git a/src/main.c b/src/main.c
index 26fec76..d333040 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1264,7 +1264,7 @@ grepfile (char const *file, struct stats *stats)
 #if defined HAVE_LIBZ
       if (do_decompress)
-         bufgz = dl_gzdopen (fd, "rb");
+         bufgz = gzdopen (desc, "rb");
          if (bufgz == NULL)
              if (errno != 0)
@@ -2060,6 +2060,10 @@ main (int argc, char **argv)

+        do_decompress = 1;
+        break;
       case EXCLUDE_OPTION:
         if (!excluded_patterns)
           excluded_patterns = new_exclude ();

But --decompress still didn't work, because bufgz is set but never used.

With each patch, please ensure at the very least
that "make" (preferably "make distcheck") still passes.
Also, please include a more detailed log entry,
and it'd be nice to add a minimal test that exercises
the new code.
Last but not least, please include
  - a blurb in NEWS
  - description of the new option in doc/grep.texi

However, I am left wondering how useful this option would
be when it applies only to gzip'd data.
What about bzip2 and xz?
While gzip is still ubiquitous, it is obviously inferior to xz.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]