bug-coreutils
[Top][All Lists]
Advanced

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

Re: feature request: gzip/bzip support for sort


From: Dan Hipschman
Subject: Re: feature request: gzip/bzip support for sort
Date: Wed, 24 Jan 2007 20:54:07 -0800
User-agent: Mutt/1.5.9i

On Wed, Jan 24, 2007 at 08:08:18AM +0100, Jim Meyering wrote:
> I've checked in your changes, then changed NEWS a little:

Great!  Thanks :-)

> Additionally, I'm probably going to change the documentation so that
> people will be less likely to depend on being able to run a separate
> program.  To be precise, I'd like to document that the only valid values
> of GNUSORT_COMPRESSOR are the empty string, "gzip" and "bzip2"[*].
> Then we will have the liberty to remove the exec calls and use library
> code instead, thus making the code a little more efficient -- but mainly,
> more robust.

Why not add a special value 'libz' and document it as follows:

    The special value 'libz' is the default value.  This value is
    currently an alias for 'gzip', but in the future may be used to
    indicate internal compression using the libz library.

We could also have a special symbol 'libbz2', or reserve any symbol
beginning with 'lib'.  (Paul already mentioned doing something like this
with '-' instead).  I somewhat like the idea of being able to plug in
any compression program, just based on the principle of not restricting
the user.  On the other hand, we should probably warn of the system load
using an external program can incur.  Your call, of course :-)

By the way, I've got a little amendment to the patch.  I took a look at
gnulib's findprog module, and it turns out find_in_path does an access-
X_OK itself, so sort doesn't need to do it again.


2007-01-24  Dan Hipschman  <address@hidden>

        * src/sort.c (create_temp): Remove superfluous access-X_OK
        check.  find_in_path does this for us.

Index: sort.c
===================================================================
RCS file: /sources/coreutils/coreutils/src/sort.c,v
retrieving revision 1.350
diff -p -u -r1.350 sort.c
--- sort.c      24 Jan 2007 09:36:53 -0000      1.350
+++ sort.c      25 Jan 2007 04:35:07 -0000
@@ -853,12 +853,7 @@ create_temp (FILE **pfp, pid_t *ppid)
          const char *path_program = find_in_path (default_program);
 
          if (path_program != default_program)
-           {
-             if (access (path_program, X_OK) == 0)
-               compress_program = path_program;
-             else
-               free ((char *) path_program);
-           }
+           compress_program = path_program;
        }
       else if (*compress_program == '\0')
        compress_program = NULL;





reply via email to

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