summaryrefslogtreecommitdiff
path: root/gl
AgeCommit message (Collapse)Author
2009-04-09id: fix infinite loop on some systemsPádraig Brady
Steven Parkes reported that `id -G $USER` went into an infinite loop on Darwin systems for users in more than 10 groups: http://bugs.gentoo.org/show_bug.cgi?id=264007 * gl/lib/mgetgroups.c (mgetgroups): Work around buggy getgrouplist implementations that don't update the required size correctly, by doubling the result buffer and retrying. Also return the parameter updated by getgrouplist rather than its return value, as the documentation doesn't actually state the number of groups stored is returned by getgrouplist. * tests/misc/id-groups: Add test to exercise this logic * tests/Makefile.am: Reference new test * NEWS: Mention the fix * THANKS: Update
2009-04-07maint: remove compiler warnings from randint and randread modulesPádraig Brady
* gl/lib/randint.c: Remove unused MAX macro * gl/lib/randread.c (randread_error): Add __attribute__((__noreturn__))
2009-04-07shred,sort,shuf: don't use /dev/urandom by defaultPádraig Brady
Suggestion from Steven Schveighoffer at: http://savannah.gnu.org/patch/?6797 to greatly speed up the random passes done by shred. * gl/lib/randread.c: Default to using the internal pseudorandom generator, rather than reading /dev/urandom * src/shred.c (usage): remove mention of /dev/urandom * src/shuf.c (usage); ditto * src/sort.c (usage): ditto * doc/coreutils.text: Document the new behaviour for aquiring random data.
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
2009-03-27tests: test-argv-iter.c: avoid declaration-after-stmtJim Meyering
* gl/tests/test-argv-iter.c: Move declaration "up", so as not to ruffle feathers of crufty compilers. We accommodate such compilers here solely because this module may migrate to gnulib. Tiny patch by Matthew Woehlke.
2009-03-15maint: remove unused include and definitionsJim Meyering
* gl/lib/randread.c (__attribute__): Remove unused definition. (ATTRIBUTE_UNUSED): Likewise. * gl/lib/selinux-at.c (_): Remove unused definition. Don't include <gettext.h>. No longer needed.
2009-02-26argv-iter: avoid variadic macroEric Blake
* gl/lib/argv-iter.h (_ATTRIBUTE_NONNULL_): Don't assume C99 variadic macros are portable yet; needed for at least IRIX/MIPSpro. * THANKS: Update. Reported by Stuart Shelton.
2009-01-16simplify mgetgroups() and avoid -Wsign-compare warningsPádraig Brady
* gl/lib/mgetgroups.c: Avoid -Wsign-compare warning by using unsigned types for the parameters of the new function realloc_groupbuf(). mgetgroups() was refactored to use this function rather than explicitly allocating and copying from automatic storage itself. * src/group-list.c: Use int rather than size_t as variable is used in signed comparisons. * src/id.c: ditto.
2009-01-01improve M4 quotingJim Meyering
* configure.ac: Add quotes. * gl/m4/mgetgroups.m4 (gl_MGETGROUPS): Likewise. * m4/boottime.m4 (GNULIB_BOOT_TIME): Likewise. * m4/check-decl.m4 (gl_CHECK_DECLS): Likewise. * m4/gmp.m4 (cu_GMP): Likewise. * m4/jm-macros.m4 (coreutils_MACROS, gl_CHECK_ALL_HEADERS): Likewise. (gl_CHECK_ALL_TYPES): Likewise. * m4/lib-check.m4 (cu_LIB_CHECK): Likewise. * m4/stat-prog.m4 (cu_PREREQ_STAT_PROG): Likewise. FYI, I first ran this command: git ls-files | grep -E '\.(m4|ac)$' | xargs perl -pi \ -e 's/(AC_[A-Z_]+\()([^[()]+?)([,)])/$1\[$2]$3/g;' \ -e 's/(AC_[A-Z_]+\(\[[^,]+?\], )([^,[()]+?)([,)])/$1\[$2]$3/g;' \ -e 's/(AC_[A-Z_]+\((?:\[[^,]+?\], ){2})([^,[()]+?)([,)])/$1\[$2]$3/g' Then I updated serial numbers and copyright dates manually. Also, I manually added two pairs of quotes in boottime.m4.
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-06-03remove duplicate definition of matchpathcon_init_prefixJim Meyering
* gl/lib/se-selinux.in.h (matchpathcon_init_prefix): Remove definition. It is already defined there. Reported by Eric Blake.
2008-06-02accommodate older SELinux which lacks matchpathcon_init_prefixJim Meyering
* m4/jm-macros.m4: Check for matchpathcon_init_prefix. * src/install.c [!HAVE_MATCHPATHCON_INIT_PREFIX] (matchpathcon_init_prefix): Define away. * gl/lib/se-selinux.in.h (matchpathcon_init_prefix): Define. Reported by Ilya N. Golubev in <http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/13686>.
2008-05-19use gnulib's base64 module, now that it's sync'd to match this oneJim Meyering
* gl/lib/base64.c: Remove file. * gl/lib/base64.h: Remove file.
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-05-05base64 module: adjust API so it's compatible with gnulib'sBo Borgerson
* gl/lib/base64.c (base64_decode_ctx): If no context structure was passed in, treat newlines as garbage (this is the historical behavior). Formerly base64_decode. (base64_decode_alloc_ctx): Formerly base64_decode_alloc. * gl/lib/base64.h (base64_decode): Macro for four-argument calls. (base64_decode_alloc): Likewise. * src/base64.c (do_decode): Call base64_decode_ctx instead of base64_decode. Signed-off-by: Bo Borgerson <gigabo@gmail.com>
2008-03-16sha512_process_bytes: fix a bug in processing a buffer where length&64 != 0J. Scott Edwards
* gl/lib/sha512.c (sha512_process_bytes): s/63/127/.
2008-03-03Define SHA*_DIGEST_SIZE symbols.Simon Josefsson
* gl/lib/sha256.h (SHA224_DIGEST_SIZE, SHA256_DIGEST_SIZE): Define. * gl/lib/sha512.h (SHA384_DIGEST_SIZE, SHA512_DIGEST_SIZE): Define.
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.
2008-02-24* gl/lib/mgetgroups.c (mgetgroups): Parenthesize correctly.Jim Meyering
2008-02-24* gl/lib/mgetgroups.c: Include <stdlib.h>.Jim Meyering
2008-02-22id: avoid race when a group is added between getgrouplist callsJim Meyering
* gl/lib/mgetgroups.c (mgetgroups) [N_GROUPS_INIT]: Rename enum. Use a larger value. Update *groups only upon success. Iterate upon failed getgrouplist.
2008-02-21id: use getgrouplist when possibleJames Youngman
* gl/m4/mgetgroups.m4: Check for getgrouplist. * gl/lib/mgetgroups.c (mgetgroups): Use getgrouplist, if available. * TODO: Remove the item about switching to getgrouplist. * NEWS: mention this
2008-01-17Do not define-away __attribute__ when __STRICT_ANSI__ is set.Jim Meyering
* src/system.h (__attribute__): Remove the __STRICT_ANSI__ disjunct. It has been unnecessary since approximately gcc-2.6, and now, leaving it would cause gcc -Werror -ansi to fail to compile csplit.c. * gl/lib/randread.c (__attribute__): Likewise.
2007-11-28* gl/modules/randread (Depends-on): Remove nonexistent rand-isaac.Paul Eggert
2007-11-10install+SELinux: reduce a 12x performance hit to ~1.5xJim Meyering
* src/install.c (setdefaultfilecon): Call matchpathcon_init_prefix, to mitigate what would otherwise be a large performance hit due to the use of matchpathcon. Dan Walsh suggested the use of matchpathcon_init_prefix. * gl/lib/se-selinux.in.h (matchpathcon_init_prefix): Define. Signed-off-by: Jim Meyering <meyering@redhat.com>
2007-10-28Define ENOTSUP, not ENOSYS. Needed on OpenBSD 3.9.Jim Meyering
* gl/lib/se-context.in.h (ENOTSUP): Define if missing. * gl/lib/se-selinux.in.h: Likewise.
2007-10-07Reflect 2->3 GPL copyright version update in gnulib.Jim Meyering
* gl/lib/tempname.h: Update copyright from gnulib. * gl/lib/tempname.c: Likewise. * .x-sc_GPL_version: Don't make an exception for those two files.
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.
2007-10-07Copy from gnulib the parts of tempname that we'll modify.Jim Meyering
* gl/lib/tempname.c: Copy from gnulib. * gl/lib/tempname.h: Likewise. * gl/modules/tempname: Likewise. Allow GPLv2 on temporarily(?)-imported file from gnulib/libc. * .x-sc_GPL_version: New file. * Makefile.am (EXTRA_DIST): Add .x-sc_GPL_version
2007-10-04Adapt to new gnulib naming scheme.Jim Meyering
* gl/lib/se-context.in.h: Rename from gl/lib/se-context_.h. * gl/lib/se-selinux.in.h: Rename from gl/lib/se-selinux_.h. * gl/m4/selinux-context-h.m4: Remove use of AC_LIBSOURCES. * gl/m4/selinux-selinux-h.m4: Likewise. * gl/modules/selinux-h (Files, Makefile.am): Reflect renaming. (Makefile.am) [lib_SOURCES]: Add se-context.in.h and se-selinux.in.h.
2007-09-27Move file-set and hash-triple modules to gnulib.Jim Meyering
* bootstrap.conf (gnulib_modules): Remove file-set, now that it's in gnulib, and the canonicalize module requires it there. * gl/lib/file-set.c, gl/lib/file-set.h, gl/modules/hash-triple: Remove. * gl/lib/hash-triple.c, gl/lib/hash-triple.h, gl/modules/file-set: Remove.
2007-09-25Use XOR, not OR to combine bits.Jim Meyering
* gl/lib/hash-triple.c (triple_hash): Use XOR (^), not OR (|), to combine the bits from hashing the name and those of the inode number. Add a few comments and remove out-of-context ones.
2007-08-23Move functions from copy.c into new modules, since ln needs them, too.Jim Meyering
* bootstrap.conf (gnulib_modules): Add file-set. * gl/lib/file-set.c (record_file, seen_file): Functions from copy.c. * gl/lib/file-set.h: Add prototypes. * gl/lib/hash-triple.c (triple_hash, triple_hash_no_name): (triple_compare, triple_free): Functions from copy.c. * gl/lib/hash-triple.h (struct F_triple): Define. From copy.c. Add prototypes. * gl/modules/file-set: New module. * gl/modules/hash-triple: New module. * src/Makefile.am (copy_sources): New variable. (ginstall_SOURCES, cp_SOURCES, mv_SOURCES): Use it. * src/copy.c: Include hash-triple.h. No longer include hash-pjw.h. (copy_internal): Don't pass a NULL third argument to record_file, since that function no longer accepts that. (record_file): Move this function to file-set.c. Along the way, remove the code to allow a NULL stat-buffer pointer. Adjust sole caller. (seen_file): Move this function to file-set.c. (struct F_triple): Move declaration to hash-triple.h. (triple_compare, triple_free, triple_hash, triple_hash_no_name): Move these functions to hash-triple.c. Signed-off-by: Jim Meyering <jim@meyering.net>
2007-07-23Update all copyright notices to use the newer form.Jim Meyering
2007-07-10Change "version 2" to "version 3" in all copyright notices.Jim Meyering
2007-07-07Fix typo in comment.Jim Meyering
2007-07-06setuidgid: set all groups, not just the primary one; mgetgroups: new moduleJim Meyering
I wanted to use the xgetgroups function from id.c, so factored it out and made it into a non-exiting function (hence the "m" prefix rather than "x"). * src/setuidgid.c (main): Use mgetgroups. Include "mgetgroups.h". * src/id.c (xgetgroups): Remove function. Include "mgetgroups.h". (print_group_list): Use mgetgroups, not xgetgroups. * gl/modules/mgetgroups: New module. * gl/lib/mgetgroups.c: New file. mgetgroups is derived from id.c's xgetgroups function. * bootstrap.conf (gnulib_modules): Add mgetgroups. * gl/m4/mgetgroups.m4: New file. * gl/lib/mgetgroups.h: New file.
2007-03-29* gl/lib/selinux-at.c: Remove a use of HAVE_CONFIG_H.Jim Meyering
2007-03-29New program: chconJim Meyering
* gl/modules/selinux-at: New module. Check for libselinux and set LIB_SELINUX here, unconditionally, rather than depending on the configure-time --enable-selinux option. * gl/modules/selinux-h: New module. * bootstrap.conf (gnulib_modules): Add selinux-at. * gl/lib/selinux-at.c, gl/lib/selinux-at.h: New files. * gl/lib/se-selinux_.h: New file. * gl/lib/se-context_.h: New file. * gl/m4/selinux-selinux-h.m4: New file. * gl/m4/selinux-context-h.m4: New file. * src/Makefile.am (bin_PROGRAMS): Add chcon. (chcon_LDADD): Define. * README: Add chcon to the list of programs. * src/chcon.c: Rewrite the original (Red Hat) chcon to use fts.
2007-03-21* gl/lib/savewd.c: Remove this file, since the savewd_save changeJim Meyering
is now in gnulib. The other wasn't useful.
2007-03-20* gl/lib/acl.c: Remove this file, now that gnulib's version subsumes it.Jim Meyering
2007-03-16Begin adding support for Solaris ZFS (4 entries per trivial ACL)Jim Meyering
* gl/lib/acl.c (ACL_NOT_WELL_SUPPORTED): New macro. (file_has_acl, copy_acl): Use it, rather than enumerating errno values. (is_trivial_acl): New function. Incomplete, for now. (file_has_acl, copy_acl): Use the new function, rather than counting the number of entries in an ACL.