summaryrefslogtreecommitdiff
path: root/gl/modules
AgeCommit message (Collapse)Author
2014-12-19diagnose too-large numbers betterPádraig Brady
Following on from commit v8.23-82-gaddae94, consistently diagnose numbers that are too large, so as to distinguish from other errors, and make the limits obvious. * gl/modules/xdectoint: A new module implementing xdecto[iu]max(), which handles the common case of parsing a bounded integer and exiting with a diagnostic on error. * gl/lib/xdectoimax.c: The signed variant. * gl/lib/xdectoint.c: The parameterized implementation. * gl/lib/xdectoint.h: The interface. * gl/lib/xdectoumax.c: The unsigned variant. * bootstrap.conf: Reference the new module. * cfg.mk (exclude_file_name_regexp--sc_require_config_h_first): Exclude the parameterized templates. * src/csplit.c: Output EOVERFLOW or ERANGE errors if appropriate. * src/fmt.c: Likewise. * src/fold.c: Likewise. * src/head.c: Likewise. * src/ls.c: Likewise. * src/nl.c: Likewise. * src/nproc.c: Likewise. * src/shred.c: Likewise. * src/shuf.c: Likewise. * src/stdbuf.c: Likewise. * src/stty.c: Likewise. * src/tail.c: Likewise. * src/truncate.c: Likewise. * src/split.c: Likewise. * src/pr.c: Likewise. * tests/pr/pr-tests.pl: Adjust to avoid matching errno diagnostic. * tests/fmt/base.pl: Likewise. * tests/split/l-chunk.sh: Likewise. * tests/misc/shred-negative.sh: Likewise. * tests/misc/tail.pl: Likewise. Also remove the redundant existing ERR_SUBST from test err-6. * tests/ls/hex-option.sh: Check HEX/OCT options. * tests/misc/shred-size.sh: Likewise. * tests/misc/stty-row-col.sh: Likewise.
2013-09-10build: fix corrupted patch causing bootstrap failuresPádraig Brady
The patch was corrupted in commit v8.21-50-g7b65f8e * gl/modules/tempname.diff: Fix the offsets so that the patch applies cleanly. Note that this was only apparent with patch < 2.6. With patch >= 2.6, patch will not indicate an error applying the second hunk of the patch and silently ignore it. I double checked that all patches now apply cleanly by adjusting gnulib-tool to run patch with --fuzz=0 which might be advisable going forward, even on a per project basis. The silent ignoring of hunks by newer patch(1) has been reported. Fixes http://bugs.gnu.org/15255
2013-07-02maint: refactor SMACK interface to a separate modulePádraig Brady
Consolidate all smack routines and checks in a module. We replace and wrap the most commonly used smack routines, which allows removing ifdefs throughout the code. * gl/lib/smack.h: A new header containing the implementation of the wrapped and replacement routines. Note the is_smack_enabled() routine should be optimized out at compile time when compiled on a system without libsmack. * gl/modules/smack: Describe the new module and move the configure time code here from ... * m4/jm-macros.m4: ... here. * bootstrap.conf: Reference the new module. * src/id.c: Use the routines without ifdefs where possible. * src/ls.c: Likewise. * src/mkdir.c: Likewise. * src/mkfifo.c: Likewise. * src/mknod.c: Likewise.
2013-05-11build: update gnulib submodule to latestPaul Eggert
2012-09-20build: move non-recursive-gnulib-prefix-hack to gnulib; updateJim Meyering
I've moved the non-recursive-gnulib-prefix-hack module to gnulib, with two small improvements, so remove it from here and update gnulib to the latest. * gl/build-aux/prefix-gnulib-mk: Remove file. * gl/m4/non-recursive-gnulib-prefix-hack.m4: Remove file. * gl/modules/non-recursive-gnulib-prefix-hack: Remove file. * gnulib: Update to latest.
2012-09-11build: new module to convert lib/ to non-recursive makeJim Meyering
* gl/modules/non-recursive-gnulib-prefix-hack: New module. * gl/m4/non-recursive-gnulib-prefix-hack.m4: (gl_NON_RECURSIVE_GNULIB_PREFIX_HACK): This is the snippet that this module inserts near the end of configure. * gl/build-aux/prefix-gnulib-mk: New script, from bison. Changes from the code in bison: (prefix_assignment): Split a long line. (prefix): Add trailing slashes to avoid a single false match. Prefix imaxtostr.c and the other *tostr.c file names manually. Also, use $prefix in place of hard-coded "lib/".
2012-09-10maint: move the last coreutils-specific files from lib/ to gl/Jim Meyering
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.
2012-09-10maint: move gl/m4/root-dev-ino.m4 contents into its module definitionJim Meyering
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.
2012-07-27maint: refresh stale local gnulib patch filesJim Meyering
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".
2011-12-03maint: add missing ":" after "License" in local gnulib module filesJim Meyering
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.
2011-10-30maint: avoid new "make syntax-check" failure due to stdalign definitionJim Meyering
* gl/modules/randread (Depends-on): Add stdalign. * gl/lib/randread.c: Include <stdalign.h>, so we can ... [!_STRING_ARCH_unaligned]: remove definition of stdalign.
2011-10-27build: avoid bootstrap failure when using patch-2.5.8Jim Meyering
* 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.
2011-06-17maint: use modules/tempname.diff file, not a replacement; update gnulibJim Meyering
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.
2011-05-29maint: remove unnecessary gnulib .diff fileJim Meyering
* gl/modules/getloadavg.diff: Remove file. It stopped being useful back in February. * Makefile.am (EXTRA_DIST): Remove it.
2011-05-14shuf: use memory more efficiently when returning a subsetPádraig Brady
* 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.
2011-02-08tests: randread-tests: use macro.h not "#define ASSERT..."Jim Meyering
* 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.
2011-02-07maint: move di-set and ino-map modules from ./gl to gnulibJim Meyering
* 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.
2010-11-15maint: add a missed fadvise-tests modulePádraig Brady
* 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.
2010-11-13maint: remove fstimeprec (variable precision time stamp) supportJim Meyering
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.
2010-11-06stat: use e.g. %.3X instead of %X.%3:X for sub-second precisionPaul Eggert
* 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.
2010-10-13mbsalign: avoid warning with Solaris 10 ccPaul Eggert
* 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.
2010-07-23randread: run 2x faster on 64-bit hosts, don't assume no padding bitsPaul R. Eggert
* 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.
2010-07-22fadvise: new module providing a simpler interface to posix_fadvisePádraig Brady
* 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.
2010-07-16randread: don't require -lrtPaul R. Eggert
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.
2010-07-13sort: parallelize internal sortChen Guo
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>
2010-07-06du: Hash with a mechanism that's simpler and takes less memory.Paul Eggert
* 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.
2010-07-04di-set: manipulate sets of dev/inode pairs efficientlyJim Meyering
* 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.
2010-07-04dev-map: map device number to small non-negativeJim Meyering
* 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.
2010-03-19maint: update the mbsalign modulePádraig Brady
* gl/lib/mbsalign.c (mbsalign): Support the MBA_UNIBYTE_FALLBACK flag which reverts to unibyte mode if one can't allocate memory or if there are invalid multibyte characters present. Note memory is no longer dynamically allocated in unibyte mode so one can assume that mbsalign() will not return an error if this flag is present. Don't calculate twice, the number of spaces, when centering. Suppress a signed/unsigned comparison warning. (ambsalign): A new wrapper function to dynamically allocate the minimum memory required to hold the aligned string. * gl/lib/mbsalign.h: Add the MBA_UNIBYTE_FALLBACK flag and also document others that may be implemented in future. (ambsalign): A prototype for the new wrapper. * gl/tests/test-mbsalign.c (main): New test program. * gl/modules/mbsalign-tests: A new index to reference the tests. * .x-sc_program_name: Exclude test-mbsalign.c from this check.
2009-11-24tests: fix link failure on cygwinEric Blake
Counterpart to commit 8fe40b84bd8, since test-link.c uses rename, and we override gnulib with a rename() replacement that can xalloc_die. * gl/modules/link-tests.diff: New file.
2009-11-20maint: move xfreopen module to gnulibJim Meyering
* gl/lib/xfreopen.c: Remove file. * gl/lib/xfreopen.h: Likewise. * gl/modules/xfreopen: Likewise.
2009-11-13build: update gnulib, for getgroups improvementsEric Blake
A replacement getgroups is now guaranteed to exist, but it may fail with ENOSYS. mgetgroups is moved to gnulib, and now takes gid_t instead of GETGROUPS_T (but setgroups still needs GETGROUPS_T). * gnulib: Update to latest. * gl/modules/mgetgroups: Delete, moved to gnulib. * gl/m4/mgetgroups.m4: Likewise. * gl/lib/mgetgroups.h: Likewise. * gl/lib/mgetgroups.c: Likewise. * src/group-list.c (print_group_list): Adjust callers. * src/id.c (print_full_info): Likewise.
2009-11-07build: consistently use freopen-saferEric Blake
cat, head, ptx, shuf, tac, tail, tee, tr, and uniq used freopen on stdout, and were potentially vulnerable. dircolors, du, and tsort only used it on stdin, which is unaffected by freopen_safer, but this covers all uses for consistency. * cfg.mk (sc_require_stdio_safer): New rule. * gl/modules/xfreopen (Depends-on): Add freopen-safer. * gl/lib/xfreopen.c (includes): Use stdio--.h. * src/ptx.c (includes): Likewise. * src/shuf.c (includes): Likewise. * src/uniq.c (includes): Likewise. * src/dircolors.c (includes): Likewise. * src/du.c (includes): Likewise. * src/tsort.c (includes): Likewise.
2009-11-02build: avoid some warningsEric Blake
* gl/lib/mbsalign.c (mbsalign): Mark unused parameter. * bootstrap.conf (gnulib_modules): Remove obsolete rename-dest-slash. * gnulib-tests/Makefile.am (AM_CFLAGS): Reduce set of warnings for gnulib tests. * gl/modules/rename-tests.diff (Makefile.am): New file, to add LIBINTL to LDADD, since we avoid canonicalize-lgpl module. * gl/lib/regcomp.c.diff (regerror, calc_next) (build_collating_symbol, parse_bracket_element, build_equiv_class) (free_tree): Mark unused parameters. * gl/lib/regex_internal.h.diff (re_string_elem_size_at): New file, to mark unused parameters. * gl/lib/printf-args.c.diff (PRINTF_FETCHARGS): New file, to avoid type mismatch. * gl/lib/vasnprintf.c (VASNPRINTF): New file, to avoid shadowing local variable name. * .gitignore: Ignore temporary build artifacts.
2009-08-06maint: move selinux-at module from gl/ to gnulibJim Meyering
* gl/lib/selinux-at.c: Remove file. * gl/lib/selinux-at.h: Likewise. * gl/modules/selinux-at: Likewise. * gnulib: update to latest, to get the new module.
2009-07-04move argv-iter module to gnulibJim Meyering
* gl/lib/argv-iter.c: Remove file. * gl/lib/argv-iter.h: Remove file. * gl/modules/argv-iter: Remove file. * gl/modules/argv-iter-tests: Remove file. * gl/tests/test-argv-iter.c: Remove file. * gnulib: Update submodule, to get argv-iter
2009-04-03ls: fix alignment when month names have varying widthsPádraig Brady
Reported by Samuel Thibault and Stéphane Raimbault, as the glibc fr_FR locale has recently changed to use the official but variable width abbreviated month names. Other glibc locales also have variable widths. http://sourceware.org/ml/libc-locales/2008-q1/msg00035.html http://sourceware.org/bugzilla/show_bug.cgi?id=9859 * NEWS: Mention the fix * gl/lib/mbsalign.c: A new module to align and truncate a string in a specified number of screen cells, while handling multi-byte characters appropriately. * gl/lib/mbsalign.h: Ditto * gl/modules/mbsalign: Ditto * bootstrap.conf: Reference the new module * src/ls.c (abmon_init): New function, precompute the abbreviated months aligned left in a minimum width column <= 5 screen cells. (align_nstrftime): New function, replace the first %b in the format specification to strftime with the precomputed month string. Note using the cached month strings speeds up `ls -lU` by around 17% on glibc-2.7-2 on linux at least. Also if we implement this function using heap storage rather than automatic storage, and use snprintf instead of strcpy, ls will slow down by 2% and 1% respectively (i.e. a net gain of 14% rather than 17%). * tests/ls/abmon-align: A new test to test ls alignment for various formats and locales * tests/Makefile.am: Reference the new test
2008-12-01argv-iter: add testsJim Meyering
* gl/modules/argv-iter-tests: New module. * gl/tests/test-argv-iter.c: New file.
2008-12-01argv-iter: new moduleJim Meyering
* gl/lib/argv-iter.h: New file. * gl/lib/argv-iter.c: New file. * gl/modules/argv-iter: New file. With a suggestion for improved memory management by Pádraig Brady.
2008-11-10xfreopen: new moduleJim Meyering
* gl/lib/xfreopen.c: New file. * gl/lib/xfreopen.h: New file. * gl/modules/xfreopen: New file.
2008-10-22clean up gl/modules/selinux-atJim Meyering
* gl/modules/selinux-at: Ensure that LIB_SELINUX is cleared, in case it's set in the environment. m4-quote the first two args to AC_SEARCH_LIBS. Don't violate autoconf's ac_ namespace: s/ac_save/gl_save/ Drop the useless double quotes around a simple assignment RHS.
2008-10-21move selinux-h module from gl/ to gnulibJim Meyering
* gl/lib/se-context.in.h: Remove file. * gl/lib/se-selinux.in.h: Likewise. * gl/m4/selinux-context-h.m4: Likewise. * gl/m4/selinux-selinux-h.m4: Likewise. * gl/modules/selinux-h: Likewise.
2008-10-21prepare to move selinux-h module to gnulibJim Meyering
* gl/modules/selinux-h (Makefile.am) [selinux/selinux.h, selinux/context.h]: Remove temporary file and target, in case they're read-only. Use $(MKDIR_P), not mkdir -p. (License): Relax to LGPLv2+. Remove vestigial comments.
2008-10-19accommodate gnulib header removalsJim Meyering
* src/copy.c: Don't include "euidaccess.h" or "lchmod.h". * src/cp.c: Don't include "lchmod.h". * src/ls.c: Don't include "dirfd.h". * src/mkdir.c: Don't include "lchmod.h". * src/pwd.c: Don't include "dirfd.h". * src/remove.c: Don't include "dirfd.h" or "euidaccess.h". * src/test.c: Don't include "euidaccess.h". * gl/modules/getloadavg.diff: Adjust diff for changed context. * src/uptime.c (uptime): Remove declaration.
2008-05-11move sha256 and sha512 modules to gnulibJim Meyering
* bootstrap.conf (gnulib_modules) [sha256, sha512]: Add "crypto/" prefix to module name, now that they come from gnulib. * gl/lib/sha256.c: Remove file. * gl/lib/sha256.h: Likewise. * gl/lib/sha512.c: Likewise. * gl/lib/sha512.h: Likewise. * gl/lib/u64.h: Likewise. * gl/m4/sha256.m4: Likewise. * gl/m4/sha512.m4: Likewise. * gl/modules/sha256: Likewise. * gl/modules/sha512: Likewise.
2008-03-02Create sha256 and sha512 modules and move files into gl/.Jim Meyering
* bootstrap.conf (gnulib_modules): Add sha256 and sha512. * m4/prereq.m4: Don't require gl_SHA256 or gl_SHA512. * gl/modules/sha512: New file. * gl/modules/sha256: New file. * m4/sha256.m4: Move to ... * gl/m4/sha256.m4: ...here, removing use of AC_SOURCES. * m4/sha512.m4: Move to ... * gl/m4/sha512.m4: ...here, removing use of AC_SOURCES. * lib/sha256.c, lib/sha256.h: Move to ... * gl/lib/sha256.c, gl/lib/sha256.h: ...here. * lib/sha512.c, lib/sha512.h: Move to ... * gl/lib/sha512.c, gl/lib/sha512.h: ...here. * lib/u64.h: Move to ... * gl/lib/u64.h: ...here.
2008-03-01Don't depend on gnulib's deprecated "free" module.Jim Meyering
* bootstrap.conf (obsolete_gnulib_modules): Remove free. * gl/modules/mgetgroups (Depends-on): Remove free.
2007-11-28* gl/modules/randread (Depends-on): Remove nonexistent rand-isaac.Paul Eggert
2007-10-07Make tempname more random, via the randint module.Jim Meyering
* gl/modules/tempname (Depends-on): Add randint and stdbool. * gl/lib/tempname.c: Include randint.h and stdbool.h. (uint64_t): Remove definition. Not needed. [_LIBC] (RANDOM_BITS): Remove this block, now that we have proper random bits. (check_x_suffix): New function. (gen_tempname_len): Rename from __gen_tempname. Add a parameter, x_suffix_len, telling how many X's there must be at the end of the template. Use pseudo-random numbers all the way, rather than adding 7777 from one iteration to the next. (__gen_tempname): New function, to call gen_tempname_len, requiring a suffix length of 6. * gl/lib/tempname.h: Add prototype for gen_tempname_len. Signed-off-by: Jim Meyering <meyering@redhat.com>
2007-10-07Convert coreutils' rand*.{c,h,m4} into modules.Jim Meyering
First step: move these files to gl/lib: * lib/rand-isaac.c, lib/rand-isaac.h * lib/randint.c, lib/randint.h * lib/randperm.c, lib/randperm.h * lib/randread.c, lib/randread.h Step 2: add modules/rand* and remove now-unneeded .m4 files. * gl/modules/randint: New file. * gl/modules/randperm: New file. * gl/modules/randread: New file. * m4/randint.m4: Remove file. * m4/randperm.m4: Remove file. * m4/randread.m4: Remove file. Step 3: use the new modules * bootstrap.conf (gnulib_modules): Add randint and randperm. * m4/prereq.m4 (gl_RANDINT, gl_RANDREAD, gl_RANDPERM): Don't require; These have been removed. (gl_ROOT_DEV_INO): Don't require; already handled via bootstrap.conf.