summaryrefslogtreecommitdiff
path: root/src/sort.c
AgeCommit message (Collapse)Author
2007-01-25* src/sort.c (create_temp): Remove superfluous access-X_OKDan Hipschman
check. find_in_path does this for us.
2007-01-24Pass "make distcheck" again.Jim Meyering
* src/sort.c (usage): Split a diagnostic that had grown to be longer than the C89 maximum of 509 bytes. * .x-sc_cast_of_argument_to_free: New file. Allow a cast in sort.c. FIXME: this is just temporary, while we wait to remove the offending access-calling code. * Makefile.am (EXTRA_DIST): Add .x-sc_cast_of_argument_to_free. * Makefile.maint (sc_cast_of_argument_to_free): Use the canonical, $$($(CVS_LIST_EXCEPT)). * m4/.gitignore, m4/.cvsignore, lib/.gitignore, lib/.cvsignore: Update.
2007-01-24* NEWS: New option sort -C, proposed by XCU ERN 127, which looksPaul Eggert
like it will be approved. Also add --check=quiet, --check=silent as long aliases, and --check=diagnose-first as an alias for -c. * doc/coreutils.texi (sort invocation): Document this. Also, mention that sort -c can take at most one file. * src/sort.c: Implement this. Include argmatch.h. (usage): Document the change. (CHECK_OPTION): New constant. (long_options): --check now takes an optional argument, and is now treated differently from 'c'. (check_args, check_types): New constant arrays. (check): New arg CHECKONLY, which suppresses diagnostic if -C. (main): Parse the new options. * tests/sort/Test.pm (02d, 02d, incompat5, incompat6): New tests for -C.
2007-01-24* NEWS: sort temp file compression: tweak wording.Jim Meyering
* src/sort.c (struct sortfile) [name]: Declare member to be const.
2007-01-24* src/sort.c (MAX_FORK_RETRIES_COMPRESS, MAX_FORK_RETRIES_DECOMPRESS):Dan Hipschman
In pipe_fork callers, use these named constants, not "2" and "8". (proctab, nprocs): Declare to be "static". (pipe_fork) [lint]: Initialize local, pid, to avoid unwarranted may-be-used-uninitialized warning. (create_temp): Use the active voice. Describe parameters, too. 2007-01-21 James Youngman <jay@gnu.org> Centralize all the uses of sigprocmask(). Don't restore an invalid saved mask. * src/sort.c (enter_cs, leave_cs): New functions for protecting code sequences against signal delivery. * (exit_cleanup): Use enter_cs and leave_cs instead of calling sigprocmask directly. (create_temp_file, pipe_fork, zaptemp): Likewise 2007-01-21 Dan Hipschman <dsh@linux.ucla.edu> Add compression of temp files to sort. * NEWS: Mention this. * bootstrap.conf: Import findprog. * configure.ac: Add AC_FUNC_FORK. * doc/coreutils.texi: Document GNUSORT_COMPRESSOR environment variable. * src/sort.c (compress_program): New global, holds the name of the external compression program. (struct sortfile): New type used by mergepfs and friends instead of filenames to hold PIDs of compressor processes. (proctab): New global, holds compressor PIDs on which to wait. (enum procstate, struct procnode): New types used by proctab. (proctab_hasher, proctab_comparator): New functions for proctab. (nprocs): New global, number of forked but unreaped children. (reap, reap_some): New function, wait for/cleanup forked processes. (register_proc, update_proc, wait_proc): New functions for adding, modifying and removing proctab entries. (create_temp_file): Change parameter type to pointer to file descriptor, and return type to pointer to struct tempnode. (dup2_or_die): New function used in create_temp and open_temp. (pipe_fork): New function, creates a pipe and child process. (create_temp): Creates a temp file and possibly a compression program to which we filter output. (open_temp): Opens a compressed temp file and creates a decompression process through which to filter the input. (mergefps): Change FILES parameter type to struct sortfile array and update access accordingly. Use open_temp and reap_some. (avoid_trashing_input, merge): Change FILES parameter like mergefps and call create_temp instead of create_temp_file. (sort): Call create_temp instead of create_temp_file. Use reap_some. (avoid_trashing_input, merge, sort, main): Adapt to mergefps.
2007-01-20Standardize on list of signals when an app catches signals.Paul Eggert
* src/csplit.c (main): Also catch SIGALRM, SIGPIPE, SIGPOLL, SIGPROF, SIGVTALRM, SIGXCPU, SIGXFSZ. * src/ls.c (main): Likewise (except SIGPIPE was already caught). Note that ls.c is special, as it also catches SIGTSTP. * src/sort.c (main): Likewise. Also catch SIGQUIT. More details in <http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/9510>.
2007-01-19* src/sort.c (cleanup): Clear temphead at the end.Dan Hipschman
(exit_cleanup): New function. (main): Don't invoke atexit until we're ready. Invoke it with exit_cleanup, not with cleanup and close_stdout, to avoid a race condition with cleanup and signal handling. More details: http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/9508
2006-12-13Remove some arbitrary restrictions on size fields,Paul Eggert
so that commands like "sort -k 18446744073709551616" no longer fail merely because 18446744073709551616 doesn't fit in uintmax_t. The trick is that these fields can all be treated as effectively infinity; their exact values don't matter, since no internal buffer can be that long. * src/join.c (string_to_join_field): Verify that SIZE_MAX <= ULONG_MAX if the code assumes this. Silently truncate too-large values to SIZE_MAX, as the remaining code will do the right thing in this case. * src/sort.c (parse_field_count): Likewise. * src/uniq.c (size_opt, main): Likewise. * tests/join/Test.pm (bigfield): New test. * tests/sort/Test.pm (bigfield): New test. * tests/uniq/Test.pm (121): New test. Signed-off-by: Jim Meyering <jim@meyering.net>
2006-11-13* src/sort.c (insertkey): Use xmemdup, rather than xmalloc+assignment.Jim Meyering
From Paul Eggert.
2006-11-13Plug another technically-unimportant leak in sort.Jim Meyering
* src/sort.c (main): Don't allocate memory for each new key here. (insertkey): Allocate memory for each key here, instead. (key_init): Rename from new_key. Don't allocate.
2006-11-13* src/sort.c (main): Plug a tiny memory leak.Jim Meyering
Move declaration of local "minus" down to be nearer point of use.
2006-10-09* src/sort.c (usage): Mention again that sort fields are origin 1.Paul Eggert
2006-08-08Use new random-number interface rather than rand-isaac.c.Paul Eggert
Don't include rand-isaac.c; include randint.h and randread.h instead. (RANDOM_SOURCE_OPTION): New enum. (long_opts, usage, main): New option --random-source. Include md5.h, randread.h, xmemxfrm.h. (longopts, usage, main): Remove undocumented --seed option; it's now replaced by --random-source. (rand_state, get_hash): Remove. (randread_source): New static var. (random_state, cmp_hashes, compare_random): New functions; they guarantee no collisions in the random hash function. (keycompare): Use compare_random for -R; don't fall back on comparing via memcoll, since compare_random does the right thing.
2006-07-09(inittables): Use toupper rather thanPaul Eggert
islower followed by toupper; it's simpler and typically faster now that we assume at least C89 semantics. Similarly for tolower.
2006-06-28* src/sort.c (main): Support obsolete usages like "sort +1 -2" even whenPaul Eggert
conforming to POSIX 1003.1-2001, since this is a pure extension to POSIX.
2006-05-25(usage): Remove mention of --seed.Paul Eggert
2005-12-14(incompatible_options): New function.Paul Eggert
(check_ordering_compatibility, main): Use it. (main): Check for -c and -o. Don't bother with a usage message for "sort -c a b", for consistency with other error diagnostics.
2005-12-14(check_ordering_compatibility): New function.Paul Eggert
(main): Use it.
2005-12-12Include rand-isaac.c rather than rand-isaac.h.Paul Eggert
Don't include md5.h; it wasn't needed. (struct keyfield): Rename random_hash to random, for consistency with the other member names. All uses changed. (usage): Tweak wording to mention STRING for --seed option. (short_options): Rorder for consistency with other programs. (rand_state): Now a struct, not a pointer to one. All uses changed. (HASH_WORDS, HASH_SIZE): Remove. (get_hash): Remove comments around resbuf size, since we can assume C89. Use a "more-kosher" (but slower) approach of invoking isaac_refill. (keycompare): Adjust to the new get_hash. Add a FIXME. (badfieldspec): Omit recently-introduced comment; it isn't needed. (main): Don't set need_random simply because gkey has it set; that doesn't necessarily mean we'll need random numbers. Redo seeding to match new get_hash approach.
2005-12-10(get_hash): Change position of `*' in parameter type to conform with convention.Jim Meyering
(main): Split a long line so it fits in 80 columns.
2005-12-10(keycompare): Remove stray SPACE before TAB that wasJim Meyering
causing `make distcheck' to fail.
2005-12-10(short_options, long_options, WORDS, keycompare, main):Paul Eggert
(usage): Add options --random-sort and --seed to implement a random shuffle. Include md5.h and rand-isaac.h. (get_hash): New function. (rand_state): New var. (HASH_WORDS, HASH_SIZE): New macros.
2005-12-09(usage): Mention white space vs -b and -t options.Jim Meyering
From The Wanderer.
2005-10-07(sortlines_temp): Redo previous change, since I'm no longer confidentPaul Eggert
that the m4/stdbool.m4 patch suffices.
2005-10-06(sortlines_temp): Undo previous change, sincePaul Eggert
today's change to m4/stdbool.m4 should catch it.
2005-10-05Add a comment to go with the last change.Jim Meyering
2005-10-05(sortlines_temp): Declare temporary as `int' ratherJim Meyering
than `bool' to work around AIX 5.3 compiler bug in 64-bit mode.
2005-09-01Clarify comment about size bounds.Paul Eggert
2005-08-18(usage) [-b,-t]: Ensure that there are at least twoJim Meyering
spaces between each option and the corresponding description -- this lets help2man format entries properly. Reported by Edward Welbourne.
2005-08-17(usage): Fix typo s/POS 2/POS2/.Jim Meyering
2005-08-12Cosmetic: use X2NREALLOC (only two arguments) rather than x2nrealloc (with ↵Jim Meyering
three).
2005-07-09Don't include stdio.h; no longer needed.Paul Eggert
2005-07-03Include stdio--.h rather than stdio-safer.h.Paul Eggert
Include stdlib--.h. Do not include unistd-safer.h. (create_temp_file): Don't call fd_safer; no longer needed now that we include *--.h files. (xfopen): Don't call fopen_safer, for similar reasons.
2005-06-29(fillbuf): Use X2REALLOC rather than x2realloc.Jim Meyering
2005-06-28split long line in copyright commentJim Meyering
2005-06-28(fillbuf): Use x2realloc on 1-byte base types, not x2nrealloc.Jim Meyering
2005-06-16Don't embed `this'-style quotes in format strings.Jim Meyering
Rather than this: error (..., "...`%s'...", arg); do this: error (..., "...%s...", quote (arg));
2005-06-02(usage): Put `Ordering options:' line where it belongs.Jim Meyering
2005-06-02Don't use "path" or "filename".Paul Eggert
2005-05-27Refactor so that others can use large-integerPaul Eggert
comparison functions. Include "strnumcmp.h". (NEGATION_SIGN, NUMERIC_ZERO, fraccompare): Remove; moved to strnumcmp. (decimal_point): Now int, to simplify converison overhead with new API. All uses changed. (thousands_sep): Now -1 if there isn't one, as per new API. All uses changed. (numcompare): Move contents to strnumcmp module, except for skipping blanks.
2005-05-14Update FSF postal mail address.Jim Meyering
2005-05-14Update FSF postal mail address.Jim Meyering
2005-05-12Assume `free (NULL)' works.Jim Meyering
2005-04-26Remove posixver.h and its uses.Paul Eggert
(short_options): New constant, which always supports -y arg. (COMMON_SHORT_OPTIONS): Remove.
2005-04-11Include unistd-safer.h.Paul Eggert
(create_temp_file): Use fd_safer. (xfclose): Don't assume fileno (stdin) == STDIN_FILENO, etc.
2005-04-09(SA_NOCLDSTOP): Define to 0 if not defined.Paul Eggert
All uses changed. (siginterrupt) [! HAVE_SIGINTERRUPT]: New macro. (main) [! SA_NOCLDSTOP]: Use it.
2005-03-28(long_options, mergefps): Use NULL, not `0'.Jim Meyering
2005-03-06Remove `register' keyword.Jim Meyering
2005-02-14(mergefps): Use binary search rather than linear onePaul Eggert
when comparing new line to lines already in main memory.
2004-12-02(C_DECIMAL_POINT): Remove. Use changed to '.'.Paul Eggert
Assume setlocale exists. (thousands_sep): Renamed from th_sep. (IS_THOUSANDS_SEP): Remove. All uses replaced by comparisons. (NONZERO): Parenthesize use of arg. (numcompare): Avoid duplicate loads. Use ISDIGIT as boolean, for consistency. Avoid unnecessary negation by reversing fraccompare args. (main): Rewrite localeconv call to match seq.c.