Age | Commit message (Collapse) | Author |
|
Convert the few remaining coreutils-specific files in lib/ to
gnulib-style modules under gl/, removing their corresponding .m4
files, since the information recorded in those files is better
stored in module-description file in gl/modules/.
* bootstrap.conf (gnulib_modules): Add new modules:
fd-reopen, buffer-lcm, xfts, strnumcmp.
* gl/lib/buffer-lcm.c: Renamed from the file in lib/.
* gl/lib/buffer-lcm.h: Likewise.
* gl/lib/fd-reopen.c: Likewise.
* gl/lib/fd-reopen.h: Likewise.
* gl/lib/strintcmp.c: Likewise.
* gl/lib/strnumcmp-in.h: Likewise.
* gl/lib/strnumcmp.c: Likewise.
* gl/lib/strnumcmp.h: Likewise.
* gl/lib/xfts.c: Likewise.
* gl/lib/xfts.h: Likewise.
* gl/modules/buffer-lcm: New module-description file.
* gl/modules/fd-reopen: Likewise.
* gl/modules/strnumcmp: Likewise.
* gl/modules/xfts: Likewise.
* m4/fd-reopen.m4: Remove, no longer needed.
* m4/strnumcmp.m4: Likewise.
* m4/xfts.m4: Likewise.
* m4/prereq.m4: Do not AC_REQUIRE the m4 functions from
our just-removed m4/*.m4 files.
|
|
We can get the same effect using the modules file.
* gl/m4/root-dev-ino.m4: Remove file.
* gl/modules/root-dev-ino (Depends-on): Add lstat.
(Files): Remove m4/root-dev-ino.m4.
(Makefile.am) [lib_SOURCES]: Add root-dev-ino.c and root-dev-ino.h.
(configure.ac): Remove reference to gl_ROOT_DEV_INO.
|
|
We carry local adjustments for a few gnulib modules via the
patches in gl/. Nearly all of those patches had become stale
due to evolution of the originals in gnulib.
To refresh them, first make sure you have no local changes in gl/
or in the gnulib submodule, then run "make refresh-gnulib-patches".
|
|
* tests/misc/help-version: Fix comment grammar:
s/all these/all of these/
* gl/lib/tempname.c.diff: Likewise.
|
|
* gl/lib/regcomp.c.diff: Correct invalid hunk lengths (s/1/7/g)
in the last hunk's @@-line.
|
|
* gnulib: Update submodule to latest.
* bootstrap: Update from gnulib.
* gl/lib/regcomp.c.diff: Adapt to gnulib changes.
|
|
Run "make update-copyright".
|
|
The preceding commands ignored .[ch] files in lib/ and gl/.
This is what I should have been doing from the start:
git grep -l '`.*'\' $(g ls-files |grep '\.[ch]$') \
| xargs perl -pi -e 's/`(.+?'\'')/'\''$1/'
|
|
Run "make update-copyright".
|
|
This avoids spurious diagnostics when running our "bootstrap" script.
* gl/modules/heap: Append colon after "License".
* gl/modules/randint: Likewise.
* gl/modules/randperm: Likewise.
* gl/modules/randread: Likewise.
Reported by Stefano Lattarini. Diagnosed by Bruno Haible.
|
|
* gl/modules/randread (Depends-on): Add stdalign.
* gl/lib/randread.c: Include <stdalign.h>, so we can ...
[!_STRING_ARCH_unaligned]: remove definition of stdalign.
|
|
* gl/modules/tempname.diff: Regenerate to correct bogus offsets
and adjust for 1-line offset. Eric Blake reported that this
patch failed to apply when using patch-2.5.8.
Note that it applies fine using patch-2.6.1.
|
|
* gl/lib/randread.c: Add a FIXME comment suggesting how to improve
performance by using the RDRAND hardware instruction.
|
|
* gl/lib/heap.c: Move declaration to the top of scope.
Reported by Rob McMahon and Wolfgang Steinwender
in relation to "Sun WorkShop 6 update 2 C 5.3 Patch 111679-12
2003/05/18" and "GCC 2.95.3" respectively.
|
|
* gl/lib/tempname.c.diff (gen_tempname_len):
Use x_suffix_len bytes' worth of entropy, not 8 bytes.
|
|
* configure.ac (WARN_CFLAGS): Add -Wsuggest-attribute=const,
-Wsuggest-attribute=pure and -Wsuggest-attribute=noreturn.
(GNULIB_WARN_CFLAGS): But do not add them here... yet.
* src/chown-core.h (chopt_free, uid_to_name): Add function attribute(s).
* src/copy.c (is_ancestor, valid_options): Likewise.
* src/copy.h (chown_failure_ok): Likewise.
* src/dd.c (operand_matches, operand_is): Likewise.
* src/df.c (selected_fstype, excluded_fstype): Likewise.
* src/expr.c (null looks_like_integer): Likewise.
* src/md5sum.c (hex_digits): Likewise.
* src/od.c (get_lcm): Likewise.
* src/pathchk.c (component_start, component_len): Likewise.
* src/pinky.c (count_ampersands): Likewise.
* src/pr.c (cols_ready_to_print): Likewise.
* src/ptx.c (search_table): Likewise.
* src/sort.c (find_unit_order): Likewise.
* src/stty.c (mode_type_flag, string_to_baud, baud_to_value): Likewise.
* src/system.h (gcd, lcm): Likewise.
* src/tr.c (is_char_class_member, look_up_char_class): Likewise.
(star_digits_closebracket): Likewise.
* src/uniq.c (find_field): Likewise.
* src/wc.c (compute_number_width): Likewise.
* lib/xfts.h (cycle_warning_required): Likewise.
* gl/lib/randint.h (randint_get_source): Likewise.
* gl/lib/randperm.c (ceil_lg): Likewise.
* gl/lib/randperm.h (randperm_bound): Likewise.
* lib/strnumcmp.h (strintcmp): Likewise.
|
|
Using a .diff is much more maintainable. Otherwise, changes in
the gnulib module description file may not be noticed and merged
promptly and may even result in subtle errors. Luckily, this time,
the failure to propagate gnulib's changes to modules/tempname resulted
only in an obvious link failure.
* gl/modules/tempname: Remove file.
* gl/modules/tempname.diff: Use a .diff file instead.
* gnulib: Update submodule to latest.
|
|
* gl/modules/getloadavg.diff: Remove file. It stopped being
useful back in February.
* Makefile.am (EXTRA_DIST): Remove it.
|
|
* cfg.mk (sc_preprocessor_indentation): New test, from libvirt.
Exempt 3 files from new cppi test.
* gl/lib/randread.c: Adjust cpp indentation to comply.
* src/extent-scan.c (extent_need_sync): Likewise.
|
|
* gl/lib/randperm.c (randperm_new): When the number of items
to return H, is much smaller than the total number of items N,
use a hash to represent the sparse permutations of the set N.
This is currently enabled for N > 128K and N/H > 32.
* tests/misc/shuf: Ensure shuf can quickly return 2 numbers
from a large range.
* gl/modules/randperm: Depend on hash.
* NEWS: Mention the change.
|
|
* tests/ls/color-norm: s/to to/to/
* gl/lib/mbsalign.h (mbs_align_t): s/or or/or/
* src/extent-scan.c (extent_scan_read): s/the the/the/
* src/libstdbuf.c: s/the the/the/
* tests/misc/stdbuf: s/on on/on/
* ChangeLog-2005: s/for\n\tfor /for\n\t/
|
|
* gl/lib/mbsalign.c (rpl_wcswidth): Remove this in favor
of the equivalent wcswidth replacement in gnulib.
* bootstrap.conf: Depend on the wcswidth module.
Suggested by Bruno Haible.
|
|
* gl/modules/randread-tests (Files): Add tests/macros.h
* gl/tests/test-rand-isaac.c: Remove now-unneeded #include directives.
(ASSERT): Remove definition.
Instead, include "macros.h".
Prompted by suggestions from Bruno Haible.
|
|
* gl/lib/di-set.c: Remove file.
* gl/lib/di-set.h: Likewise.
* gl/lib/ino-map.c: Likewise.
* gl/lib/ino-map.h: Likewise.
* gl/modules/di-set: Likewise.
* gl/modules/di-set-tests: Likewise.
* gl/modules/ino-map: Likewise.
* gl/modules/ino-map-tests: Likewise.
* gl/tests/test-di-set.c: Likewise.
* gl/tests/test-ino-map.c: Likewise.
* gnulib: Update to latest, now that these two modules are there.
|
|
This is required for patch, and hence is about to move to gnulib.
* gl/lib/di-set.c (di_set_lookup): New function.
* gl/lib/di-set.h: Declare it.
* gl/tests/test-di-set.c (main): Exercise it.
The bug was introduced on 2004-12-04 via commit 7380cf79.
|
|
Run "make update-copyright".
|
|
* gl/modules/fadvise-tests: Add the module previously missed
in commit 63b5e816, 2010-07-14, "fadvise: new module ...".
* gl/tests/test-fadvise.c: Add a comment as to why we don't
check return values.
|
|
The implementation of variable-precision time stamps relied
on heuristics that made the output subtly nondeterministic,
or at least hard to reproduce:
http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/21531/focus=21538
So, for now at least, we're removing that feature.
* bootstrap.conf (gnulib_modules): Remove fstimeprec.
* gl/lib/fstimeprec.c, gl/lib/fstimeprec.h: Remove files.
* gl/modules/fstimeprec, gl/modules/fstimeprec-tests: Likewise.
* gl/tests/test-fstimeprec.c: Remove file.
|
|
* NEWS: Document this.
* doc/coreutils.texi (stat invocation): Likewise.
* gl/lib/fstimeprec.c, gl/lib/fstimeprec.h, gl/modules/fstimeprec:
* gl/modules/fstimeprec-tests, gl/tests/test-fstimeprec.c:
New files.
* bootstrap.conf (gnulib_modules): Add fstimeprec.
* src/stat.c: Include fstimeprec.h. Don't include xstrtol.h.
(decimal_point, decimal_point_len): New static vars.
(main): Initialize them.
(epoch_sec, out_ns): Remove.
(out_int, out_uint): Now returns whatever printf returned.
(out_minus_zero, out_epoch_secs): New functions.
(print_stat): Use out_epoch_sec instead of out_ns and epoch_sec.
(print_stat, print_it, usage): Remove the %:X-style formats.
* tests/misc/stat-nanoseconds: Set TZ=UTC0 to avoid problems
with weird time zones. Use a time stamp near the Epoch so that we
don't have to worry about leap seconds. Redo test cases to match
new behavior.
* tests/touch/60-seconds: Change %Y.%:Y to %.9Y, to adjust to
new behavior.
|
|
* gl/lib/mbsalign.c: Include <stdint.h> for SIZE_MAX.
Use SIZE_MAX rather than (size_t) -1, to avoid warning for
"size_t x = -1" on Solaris 10 cc.
* gl/modules/mbsalign (Depends-on): Add stdint.
|
|
* gl/tests/test-rand-isaac.c (main): Fix swapped arguments to strtol.
|
|
This module may be moved to gnulib at some stage,
so keep it C89 compatible.
* gl/lib/mbsalign.c (mbsalign): Declare variables at start of scope
(ambsalign): Likewise
* gl/lib/mbsalign.h: Remove trailing comma from enum
Reported by Andrei Suhan
|
|
* .x-sc_program_name: Exclude all current and future
c files in gl/tests from this check
* gl/tests/test-di-set.c: Remove the hack to work around
the set_program_name syntax-check
* gl/tests/test-ino-map.c: Likewise
* gl/tests/test-rand-isaac.c: Likewise
|
|
* gl/tests/test-rand-isaac.c (main): Avoid warnings from
syntax-check.
|
|
* gl/lib/heap.c (struct heap): Move this here...
* gl/lib/heap.h (struct heap): ... from here, as outside code no
longer needs to access any of these members.
|
|
* src/sort.c (proctab_hasher, proctab_comparator, stream_open, xfopen):
(open_temp, zaptemp, struct_month_cmp, begfield, limfield):
(find_unit_order, human_numcompare, numcompare, general_numcompare):
(count_tabs, keycompare, compare, compare_nodes, lock_node):
(unlock_node, queue_destroy, queue_init, queue_insert, queue_pop):
(write_unique, mergelines_node, check_insert, update_parent):
(merge_loop, sortlines, struct thread_args, set_ordering):
Prefer the style "T const" to "const T".
* gl/lib/heap.h (struct heap, heap_alloc): Likewise.
* gl/lib/heap.c (heap_default_compare, heapify_down, heapify_up):
(heap_alloc): Likewise.
|
|
* gl/lib/rand-isaac.c: Remove the I/O; this belongs elsewhere.
Add support for ISAAC64. Port to hosts with padding bits.
Add self to author list. Include <limits.h>, for CHAR_BIT.
Don't include string.h, sys/time.h, unistd.h.
(min, just): New functions.
(IF32): New macros.
(ind, ISAAC_STEP, isaac_refill, mix, isaac_init, isaac_seed):
Add support for ISAAC64. Port to hosts with padding bits.
(ind): Now an inline function rather than a macro; no need for it
to be a macro with modern compilers.
(ISAAC_STEP): Renamed from isaac_step, since it's not function-like.
Don't bother to pass args that are always the same. All uses changed.
(ISAAC_STEP, ISAAC_SEED): Move to inside the only function body
that can use it.
(ISAAC_MIX): Renamed from isaac_mix, since it's now a macro and is
no longer function-like. Don't bother saving and restoring state;
no longer needed now that we're not a function. All uses changed.
(isaac_seed_start, isaac_seed_data, isaac_seed_finish): Remove.
(isaac_seed): Take just the one arg; the caller now sets s->m.
* gl/lib/rand-isaac.h: Use _GL_RAND_ISAAC_H to protect, instead
of RAND_ISAAC_H. Try out " #" rather than "# " for indenting.
(ISAAC_BITS_LOG, ISAAC_BITS): New macros.
(ISAAC_WORDS_LOG): Renamed from ISAAC_LOG.
(isaac_word): New type. All uses of uint32_t changed to isaac_word,
to support ISAAC64.
(struct isaac_state): Rename member MM to M, and make it public.
(isaac_seed, isaac_refill): Adjust to new API.
* gl/lib/randread.c: Include sys/time.h.
(get_nonce): New function, containing the nonce stuff that used
to be in rand-isaac.c but better belongs here.
(randread_new): Use it.
* gl/modules/randread (Depends-on): Add inline.
* gl/modules/randread-tests: New file.
* gl/tests/test-rand-isaac.c: New file.
|
|
* bootstrap.conf: Include the new module
* gl/lib/fadvise.c: Provide a simpler interface to posix_fadvise.
(fadvise): Provide hint to the whole file associated with a stream.
(fdadvise): Provide hint to the specific portion of a file
associated with a file descriptor.
* gl/lib/fadvise.h: Redefine POSIX_FADV_* to FADVISE_* enums.
* gl/modules/fadvise: New file.
* m4/jm-macros.m4: Remove the no longer needed posix_fadvise check.
* .x-sc_program_name: Exclude test-fadvise.c from this check.
* gl/tests/test-fadvise (main): New test program.
* gl/modules/fadvise-testss: A new index to reference the tests.
* src/sort.c (stream_open): Use the new interface.
* src/dd.c (iwrite): Likewise.
|
|
* gl/lib/rand-isaac.c (isaac_seed_start): New arg SEEDED.
(isaac_seed): New args FD and BYTES_BOUND. Read from FD if possible.
Don't bother with low-quality sources if FD has enough bytes.
* gl/lib/rand-isaac.h: New size_t arg for isaac_seed.
* gl/lib/randread.c: Include fcntl.h, unistd.h.
(NAME_OF_NONCE_DEVICE): New #define.
(nonce_device): New static var.
(randread_new): Use nonce device if available.
|
|
Programs like 'sort' were linking to -lrt in order to get
clock_gettime, but this was misguided: it wasted considerable
resources while gaining at most 10 bits of entropy. Almost nobody
needs the entropy, and there are better ways to get much better
entropy for people who do need it.
* gl/lib/rand-isaac.c (isaac_seed): Include <sys/time.h> not
"gethrxtime.h".
(isaac_seed): Use gettimeofday rather than gethrxtime.
* gl/modules/randread (Depends-on): Depend on gettimeofday
and not gethrxtime.
* src/Makefile.am (mktemp_LDADD, shred_LDADD, shuf_LDADD, sort_LDADD):
(tac_LDADD): Omit $(LIB_GETHRXTIME); no longer needed.
|
|
* gl/lib/heap.c (heap_alloc): Use xnmalloc rather than xmalloc,
to avoid pathological overflow.
|
|
* gl/lib/heap.c (heap_alloc): Use the fact that the xalloc
routines will not return NULL. Also remove the redundant
temporary variables.
(heap_insert): From Jim Meyering, use x2nrealloc() which
is simpler while handling overflow and increasing the
size more efficiently. This reallocation is currently
unused by coreutils in any case as it preallocates enough.
|
|
This patch is by Gene Auyeung, Chris Dickens, Chen Guo, and Mike
Nichols, based off of a patch by Paul Eggert, Glen Lenker, et. al.,
with a basic heap implementation based off of the GDSL heap,
originally by Nicolas Darnis.
The number of sorts done in parallel is limited to the number
of available processors by default, or can be further restricted
with the --parallel option.
On a dual-die, 8 core Intel Xeon, results show sorting with
8 threads is almost 4 times faster than using a single thread.
Timings when sorting a 96MB file:
THREADS TIME (s)
1 5.10
2 2.87
4 1.75
8 1.31
Single threaded sorting has also been improved,
especially for cheaper comparison operations:
COMMAND BEFORE (s) AFTER (s)
sort 8.822 8.716
sort -g 10.336 10.222
sort -n 3.077 2.961
LANG=C sort 2.169 2.066
* bootstrap.conf: Add heap, pthread.
* coreutils.texi (sort): Describe the new --parallel option.
* gl/lib/heap.c: New file. Very basic heap implementation.
* gl/lib/heap.h: New file.
* gl/modules/heap: New file.
* src/Makefile.am: Add LIB_PTHREAD.
* src/sort.c: Include heap.h, nproc.h, pthread.h.
(MAX_MERGE): New macro.
(SUBTHREAD_LINES_HEURISTIC, PARALLEL_OPTION): New constants.
(MERGE_END, MERGE_ROOT): New constants.
(struct merge_node): New struct.
(struct merge_node_queue): New struct.
(sortlines temp): Remove declaration.
(usage, long_options, main): New option, --parallel.
(specify_nthreads): New function.
(mergelines): New signature, to emphasize the fact that the HI area
must be part of the destination. All callers changed.
(sequential_sort): New function, renamed from sortlines. Merge in
the functionality of sortlines_temp.
(compare_nodes): New function.
(lock_node, unlock_node): New functions.
(queue_destroy): New function.
(queue_init): New function.
(queue_insert): New function.
(queue_pop): New function.
(write_unique): New function.
(mergelines_node): New function.
(check_insert): New function.
(update_parent): New function.
(merge_loop): New function.
(sortlines): Rewrite to support and use parallelism, with a new
signature. All callers changed.
(struct thread_args): New struct.
(sortlines_thread): New function.
(sortlines_temp): Remove.
(sort): New argument NTHREADS. All uses changed. Output moved to
mergelines_node.
(main): disable threading if we are sorting at random.
* tests/Makefile.am (TESTS): Add misc/sort-benchmark-random.
* tests/misc/sort-benchmark-random: New file.
Signed-off-by: Pádraig Brady <P@draigBrady.com>
|
|
* gl/lib/ino-map.c (ino_hash): Declare "i" as unsigned int.
Use an intermediate variable for the for-loop upper bound,
so it's a little more readable. Adjust comment.
* gl/lib/di-set.c (di_ent_hash): Likewise.
|
|
Problem reported by Jim Meyering in:
http://debbugs.gnu.org/cgi/bugreport.cgi?bug=6524#74
* gl/lib/di-set.c (di_ent_hash): Rework so that the compiler does
not incorrectly warn about shifting by 64-bits in unreachable code.
* gl/lib/ino-map.c (ino_hash): Likewise.
|
|
* gl/lib/dev-map.c, gl/lib/dev-map.h, gl/modules/dev-map: Remove.
* gl/lib/ino-map.c, gl/lib/ino-map.h, gl/modules/ino-map: New files.
* gl/modules/dev-map-tests, gl/tests/test-dev-map.c: Remove.
* gl/modules/ino-map-tests, gl/tests/test-ino-map.c: New files.
* gl/lib/di-set.h (struct di_set): Renamed from struct di_set_state,
and now private. All uses changed.
(_ATTRIBUTE_NONNULL_): Don't assume C99.
(di_set_alloc): Renamed from di_set_init, with no size arg.
Now allocates the object rather than initializing it.
For now, this no longer takes an initial size; we can put this
back later if it is needed.
* gl/lib/di-set.c: Include hash.h, ino-map.h, and limits.h instead of
stdio.h, assert.h, stdint.h, sys/types.h (di-set.h includes that
now), sys/stat.h, and verify.h.
(N_DEV_BITS_4, N_INO_BITS_4, N_DEV_BITS_8, N_INO_BITS_8): Remove.
(struct dev_ino_4, struct dev_ino_8, struct dev_ino_full): Remove.
(enum di_mode): Remove.
(hashint): New typedef.
(HASHINT_MAX, LARGE_INO_MIN): New macros.
(struct di_ent): Now maps a dev_t to a inode set, instead of
containing a union.
(struct dev_map_ent): Remove.
(struct di_set): New type.
(is_encoded_ptr, decode_ptr, di_ent_create): Remove.
(di_ent_hash, di_ent_compare, di_ent_free, di_set_alloc, di_set_free):
(di_set_insert): Adjust to new representation.
(di_ino_hash, map_device, map_inode_number): New functions.
* gl/modules/di-set (Depends-on): Replace dev-map with ino-map.
Remove 'verify'.
* gl/tests/test-di-set.c: Adjust to the above changes to API.
* src/du.c (INITIAL_DI_SET_SIZE): Remove.
(hash_ins, main): Adjust to new di-set API.
|
|
* gl/lib/di-set.c: Implementation.
* gl/lib/di-set.h: Declarations.
* gl/modules/di-set: Define module.
* gl/modules/di-set-tests: Define test module.
* gl/tests/test-di-set.c: Likewise.
|
|
* gl/lib/dev-map.c: New file.
* gl/lib/dev-map.h: Declarations.
* gl/modules/dev-map: Define primary modules.
* gl/modules/dev-map-tests: Define test module.
* gl/tests/test-dev-map.c: Test it.
|
|
Run this command:
git ls-files | grep '\.[ch]$' \
| xargs perl -pi -e 's/for \(;;\)/while (true)/g'
...except for randint.c, which does not include stdbool.h.
In that case, use "while (1)".
* gl/lib/randint.c (randint_genmax): Use "while (1)" for infloops.
* src/cat.c (simple_cat, cat): Use "while (true)" for infloops.
* gl/lib/randread.c (readsource, readisaac): Likewise.
* src/copy.c (copy_reg): Likewise.
* src/csplit.c (record_line_starts, process_regexp): Likewise.
* src/cut.c (set_fields): Likewise.
* src/dd.c (iread, parse_symbols): Likewise.
* src/df.c (find_mount_point, main): Likewise.
* src/du.c (main): Likewise.
* src/expand.c (expand): Likewise.
* src/factor.c (factor_using_division, do_stdin): Likewise.
* src/fmt.c (get_space): Likewise.
* src/ls.c (decode_switches): Likewise.
* src/od.c (main): Likewise.
* src/pr.c (main, read_line): Likewise.
* src/shred.c (dopass, genpattern): Likewise.
* src/sort.c (initbuf, fillbuf, getmonth, keycompare): Likewise.
* src/split.c (bytes_split, lines_split): Likewise.
* src/tac.c (tac_seekable): Likewise.
* src/test.c (and, or): Likewise.
* src/tr.c (squeeze_filter, main): Likewise.
* src/tsort.c (search_item): Likewise.
* src/unexpand.c (unexpand): Likewise.
* src/uniq.c (main): Likewise.
* src/yes.c (main): Likewise.
|
|
* gl/lib/mbsalign.c (mbsalign): Ensure the temporary destination buffer
is big enough, as it may need to be bigger than the source buffer
in the presence of single byte non printable chars.
* gl/tests/test-mbsalign.c (main): Add a test to trigger the issue.
|