📄 changelog
字号:
2001-02-25 Paul Eggert <eggert@twinsun.com> * src/sort.c: Tune allocation and comparison of nodes representing temp files. This improved CPU performance of 'sort -S 1 *.[ch]' by 17% on my host. (struct tempnode): name member now uses struct hack. (temphead): Now a pointer, not a structure. All uses changed. (create_temp_file): Allocate node using struct hack. (zaptemp): Free node using struct hack. Use pointer comparison, not string comparison.2001-02-25 Paul Eggert <eggert@twinsun.com> * src/sort.c (eolchar, trim_trailing_blanks): Now static.2001-02-25 Paul Eggert <eggert@twinsun.com> 'sort' race condition fixes. Defend against a DoS attack where someone else creates a temporary file with the same name as ours. Use mkstemp to do this, supplying our own mkstemp if the system doesn't have one. Also, fix a race condition during cleanup on hosts without sigaction. * src/sort.c (NAME_MAX_IN_DIR): Remove. (sigprocmask, sigset_t): New macros, defined only on older hosts. (caught_signals): New var. (xtmpfopen, tempname): Removed. (create_temp_file): New function, combining the functions of the old xtmpfopen and tempname. All callers changed. Use mkstemp to create the file. (sighandler): On hosts without sigaction, ignore signals while cleaning up, instead of letting them interrupt cleanup. (main): Initialize caught_signals. On hosts with sigaction, block all caught signals while handling one. Remove duplicate code.2001-02-22 Jim Meyering <meyering@lucent.com> * src/sort.c (keycompare): Move declarations of locals, lena and lenb, into the inner scope where they are used.2001-02-19 Jim Meyering <meyering@lucent.com> * src/sort.c (AUTHORS): Add Paul Eggert. * src/wc.c (wc): Rename innermost `buf' to avoid shadowing warning. (wc): Rename local `wc' to avoid shadowing function name.2001-02-18 Paul Eggert <eggert@twinsun.com> Fix a race condition: freed storage accessed during a signal handler. * src/sort.c (struct tempnode.next): Now volatile. (zaptemp): Free the file name after removing it from the temp list, not before, because a signal can arrive between the two actions and cleanup () traverses the list.2001-02-18 Paul Eggert <eggert@twinsun.com> Check for input size, and do not overallocate memory. Also check for memory quotas. Revamp storage management so that line tables and character data are taken from the same buffer. Line tables are now in reverse order, since they grow down while the character data grow up. * src/sort.c: (<sys/resource.h>): Include if HAVE_SYS_RESOURCE_H. (struct rlimit, getrlimit): Define a replacement if RLIMIT_DATA is not defined. (RLIMIT_AS): Define to RLIMIT_DATA if not defined. (struct lines): Remove. (struct buffer): New members nlines, line_bytes, eof. Remove member newline_free; no longer needed, since the code no longer runs out of line table space. (SORTALLOC_MIN, SORTALLOC_DEFAULT_MIN): Remove. (sort_size): Renamed from sortalloc; now applies to the sum of the character data and the line table, not just the character data. (MIN_SORT_SIZE, INPUT_FILE_SIZE_GUESS): New macros. (linelength): remove. (specify_sort_size): Don't worry about the distinction between the character data and the line table; that is now the caller's responsibility. (default_sort_size): Return the value, instead of being executed for side effect. Return half of available memory, or 1/16 of total memory, whichever is greater; except do not exceed 1/2 of quota. (sort_buffer_size): New function. (initbuf): New arg LINE_BYTES. Ensure that the line array is properly aligned. Initialize the new set of struct buffer members. (buffer_linelim): New function. (fillbuf): Return int, not size_t, since the callers merely care whether the result is nonzero. New arg FILE so that error messages can report the file name. Keep track of eof. Initialize the line table too, taking its memory from the input buffer's memory; this subsumes the old findlines function and removes the need for worrying about running out of line table entries. (checkfp, mergefps, sortlines, merge, sort): Adjust to the new storage management regime, in particular the fact that line tables are now filled in by fillbuf and are in reverse order. (checkfp): Now takes char *, not const char *, since subroutines require that now. Rewrite to avoid lint and duplicate code. If line length alloc calculation overflows, simply allocate enough memory to hold the line. (mergefps): New arg FILES, used for buffer size calculation and error messages. Rewrite to avoid lint. Do not loop if savealloc*2 overflows. (mergefps, merge): Zap temporary files eagerly rather than lazily; this is needed because we now pass FILES to mergefps. (sortlines): Args now point at end of arrays, not at beginnings. (sort): Do not allocate temporary line array for sortlines; instead, take the space from the same buffer. (main): Adjust to sort_size and default_sort_size changes.2001-02-18 Jim Meyering <meyering@lucent.com> Rename test input files to avoid conflicts on case-insensitive file systems. * tests/pr/2-Sf-t_notab: Rename from 2Sf-t_notab. * tests/pr/2-S_f-t_notab: Rename from 2S_f-t_notab. * tests/pr/W-72l17f-ll: Rename from W72l17f-ll. * tests/pr/Test.pm: Update file names to reflect renamings. Reported by Matthew Smith.2001-01-20 Jim Meyering <meyering@lucent.com> * configure.in: Remove jm_CHECK_ALL_TYPES. Now it's invoked by jm_MACROS.2001-01-17 Jim Meyering <meyering@lucent.com> * src/cksum.c (main): Use PACKAGE, not GNU_PACKAGE. * src/tsort.c (main): Likewise. * src/sort.c (main): Likewise. (usage): Convert each TAB in --help output to a sequence of 8 spaces.2001-01-07 Jim Meyering <meyering@lucent.com> * src/tail.c (usage): Split a string that was longer than 2048 bytes.2001-01-03 Jim Meyering <meyering@lucent.com> * src/sort.c (main): Remove embedded \n from diagnostic.2001-01-02 Jim Meyering <meyering@lucent.com> * src/od.c (ulonglong_t): Define place-holder type to avoid some #if directives. (LONGEST_INTEGRAL_TYPE): Remove definition. (MAX_INTEGRAL_TYPE_SIZE): Use ulonglong_t instead of LONGEST_INTEGRAL_TYPE. (print_long_long): Compile this function even on systems without long long support. (decode_one_format): Remove #if directive. * src/od.c (decode_one_format): Guard use of print_long_long with `#if HAVE_UNSIGNED_LONG_LONG'. From Darren Salt. Change all `#ifdef HAVE_UNSIGNED_LONG_LONG' to use `#if' instead.2000-12-23 Jim Meyering <meyering@lucent.com> * src/sys2.h [HAVE_INTTYPES_H]: Include <inttypes.h>.2000-12-19 Jim Meyering <meyering@lucent.com> * Version 2.0.11.2000-12-18 Paul Eggert <eggert@twinsun.com> * NEWS, doc/textutils.texi: New "sort" option -S SIZE. * src/sys2.h (UINTMAX_MAX): New macro, taken from C99. * src/sort.c: Include physmem.h. (SORTALLOC, mergealloc, LINEALLOC): Remove. (sortalloc): Default to zero at program startup. (SORTALLOC_MIN, SORTALLOC_DEFAULT_MIN): New macros. (usage, main): Add support for new -S SIZE option. (specify_sort_size, default_sort_size): New functions. (initlines): Do not let alloc exceed limit. (findlines): Likewise. (checkfp, mergefps, sort): Use sortalloc to size everything else, instead of relying on precomputed sizes.2000-12-17 Jim Meyering <meyering@lucent.com> * doc/texinfo.tex: Update from master repository. * config.sub: Likewise. * config.guess: Likewise.2000-12-11 Jim Meyering <meyering@lucent.com> * Version 2.0.10.2000-12-07 Jim Meyering <meyering@lucent.com> * src/od.c (address_base): Declare to be static.2000-12-06 Paul Eggert <eggert@twinsun.com> * src/od.c (address_base, address_pad_len): New var. (output_address_fmt_string, address_fmt_buffer, address_pad): Remove. (flag_pseudo_start): Now int, not long int. (pseudo_offset): Now off_t, not long int. (n_specs, n_specs_allocated): Now size_t, not unsigned int. (format_address, format_address_none, format_address_std, format_address_label): Now accepts an extra char argument (an extra char to print if nonzero), and prints instead of returning a string. All callers changed. (bytes_per_block): Now size_t, not int. (format_address_none): Do not even print the extra char argument. This simplifies the callers. (format_address_std, format_address_label): Print off_t ourself instead of trying to use autoconfigured format. This is faster and more portable. (format_address_paren): New function. (dump): Remove unnecessary cast. (expand_address_fmt): Remove. (main): Use size_t, off_t, etc. instead of builtin types where this is advisable. Adjust to above changes. Remove unnecessary cast.2000-12-03 Jim Meyering <meyering@lucent.com> * src/tail.c (tail_file): Initialize ignore, dev, and ino members, when tailing forever and the open failed. Otherwise, we could get uninitialized memory references of those fields in recheck. * tests/tail-2/Makefile.am (TESTS): Add assert-2. * tests/tail-2/assert-2: New file. * Version 2.0.9. Make od print valid addresses for offsets of 2^32 and larger, and allow byte offset (-j) and byte count (-N) to be 2^32 and larger. * src/od.c (MAX_ADDRESS_LENGTH): Don't hard-code as a literal. Rather, define in terms of the type, off_t. (string_min): Declare to be of type size_t. (flag_dump_strings): Declare to be of type int. (print_s_char): Declare the n_bytes parameter and the local, `i', to be of type off_t. (print_char): Likewise. (print_s_short): Likewise. (print_short): Likewise. (print_int): Likewise. (print_long): Likewise. (print_long_long): Likewise. (print_float): Likewise. (print_double): Likewise. (print_long_double): Likewise. (dump_hexl_mode_trailer): Likewise. (print_named_ascii): Likewise. (print_ascii): Likewise. (write_block): Likewise. (print_ascii): Declare local, `print_function' with a prototype. Change a few `>' comparisons to the equivalent `<' form. (parse_options): Declare `tmp' to be of type uintmax_t. Use xstrtoumax, not xstrtoul. Fail if the specified offset if larger than OFF_T_MAX. (dump_strings): Declare local `i' to be of type size_t. Remove the now-unnecessary cast-to-off_t. (main) [IF_LINT]: Initialize desired_width to avoid a warning. Declare `tmp' to be of type uintmax_t. Use xstrtoumax, not xstrtoul. Fail if minimum string length is larger than SIZE_MAX. Fail if specified width is larger than ULONG_MAX. * src/od.c (format_address): Use off_t, not long unsigned_int as the parameter type. (format_address_none): Likewise. Mark parameter as unused. (format_address_std): Likewise. (format_address_label): Likewise. (print_ascii): Mark format string parameter as unused. (write_block): Use off_t, not long unsigned_int as offset type. (expand_address_fmt): New function. (main): Use it to expand each address format string template. Reported by Mark Nudelman, via Andreas Jaeger. * src/sys2.h (OFF_T_MIN): Define here instead. (OFF_T_MAX): Likewise. (CHAR_BIT): Define. * src/tail.c (parse_options): Use xstrtoumax to parse the byte and line offset. Give a better diagnostic when the requested offset is still representable but larger than OFF_T_MAX. (OFF_T_MIN): Remove definition. (OFF_T_MAX): Likewise.2000-12-02 Jim Meyering <meyering@lucent.com> * src/sort.c (checkfp): Rename local `buf' to avoid shadowing previous declaration. * src/sort.c (NONZERO): Define and use it to make the code a tiny bit more readable. * doc/textutils.texi (sort invocation): Clarify how -t works when a sort key specifies a range of fields. From Karl O. Pinc.2000-11-26 Paul Eggert <eggert@twinsun.com> * src/od.c (skip): Use lseek instead of worrying about fseeko or fseek. This should be portable, as we seek before doing any I/O. (fseeko): Remove; no longer used.2000-11-30 Jim Meyering <meyering@lucent.com> * src/sort.c: s/SIZE_T_MAX/SIZE_MAX/.2000-11-30 Paul Eggert <eggert@twinsun.com> * src/sys2.h: Include <stdint.h> if HAVE_STDINT_H. (SIZE_MAX): Renamed from SIZE_T_MAX, as C99 uses SIZE_MAX. All uses changed.2000-11-30 Jim Meyering <meyering@lucent.com> * src/sort.c: SIZE_MAX is not defined, so s/SIZE_MAX/SIZE_T_MAX/, and... * src/sys2.h (SIZE_T_MAX): ... define.2000-11-29 Paul Eggert <eggert@twinsun.com> Port GNU "sort" to hosts where sizes don't fit in "int", e.g. 64-bit Solaris (sparc). * src/sort.c ("human.h", "xstrtol.h"): Include. (struct line): length member is now size_t, not int. (struct lines): Likewise for used, alloc, limit members. (struct buffer): Likewise for used, alloc, left, newline_free members. (struct keyfield): Likewise for sword, schar, eword, echar members. (sortalloc, mergealloc, linelength): Now size_t, not int. (initbuf, fillbuf, initlines, begfield, limfield, findlines, numcompare, getmonth, keycompare, compare, checkfp, mergefps, sortlines, sort): Accept, return, and use size_t for sizes, not int. (fillbuf, initlines, findlines, checkfp, sort): Check for overflow when computing buffer sizes. (begfield, limfield): Do not index past end of array. (checkfp): Return a boolean, not a line number, as the line number may not fit in int. All callers changed. Use uintmax_t for line numbers, not int. (sort): Don't allocate tmp until we need it (and know the right size). (parse_field_count): New function. (main): Use it to check for overflow in field counts. "outfile" is now a pointer to const.2000-11-27 Jim Meyering <meyering@lucent.com> * src/checksum.h: Don't include system.h here. * src/md5.c: Include config.h, stdio.h, sys/types.h. and system.h here instead. * src/sha1sum.c: Likewise.2000-11-18 Paul Egger
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -