summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2009-03-27tests: fix 'make sc_tight_scope' on cygwinEric Blake
* src/Makefile.am (sc_tight_scope): Ignore leading underscores in symbols.
2009-03-26df: port the known-value fix to AIX as wellPaul Eggert
* src/df.c (known_value): New function, which also works on AIX /proc file systems. (df_readable, show_dev): Use it instead of hardcoding comparison to UINTMAX_MAX. Suggested by Jim Meyering and Matthew Woehlke.
2009-03-26df: fix a bug when totaling unknown valuesPaul Eggert
* src/df.c (show_dev): Don't add UINTMAX_MAX to grand totals, as that value indicates that the true value is unknown; adding it effectively subtracts 1 from the total, whereas we want to leave the total alone.
2009-03-25pwd: support -L and -PEric Blake
* src/pwd.c (longopts): New variable. (logical_getcwd): New function. (main): Use it. (usage): Document new options. * doc/coreutils.texi (pwd invocation): Likewise. * NEWS: Likewise. * TODO (pwd): Mark it done. * tests/misc/pwd-option: New file. * tests/Makefile.am (TESTS): Add test. * THANKS: Update. Reported by Paul D. Smith, in savannah bug 24949.
2009-03-24ls: make it possible to disable coloring of hard linksKamil Dudka
* src/ls.c (print_color_indicator): Don't color hard links if disabled (when there is an empty hl= in the LS_COLORS environment variable). * tests/ls/hardlink: Add test case for disabled hard link highlighting. * NEWS: Mention the change.
2009-03-20dd: use a more portable definition of O_FULLBLOCKEric Blake
* src/dd.c (O_FULLBLOCK): Compute its value without using a 180KB macro. This avoids triggering a compilation failure with HP-UX's cc. Reported by Matthew Woehlke.
2009-03-18sort: handle fd exhaustion better when mergingPaul Eggert
This is an alternative to my 9 March patch labeled "Silently lower nmerge; don't (sometimes incorrectly) range-check" <http://lists.gnu.org/archive/html/bug-coreutils/2009-03/msg00070.html>. It differs by not using 'dup' to probe for extra file descriptors; instead, it simply calls 'open' (and 'pipe') to open files and pipes, until one of these calls fails due to file descriptor exhaustion; it then backs off by 1, does a merge with the files that it has opened, and then retries with the (now-smaller) number of files. This patch requires quite a few more changes to the source code than the earlier patch, but it is in some sense "better" because it doesn't need to call "dup" ahead of time in order to decide whether "open" or "pipe" will fail. Also, it's more robust in the case where "open" or "pipe" fails with errno==EMFILE because some system-wide limit is exhausted. * src/sort.c (create_temp_file): New arg SURVIVE_FD_EXHAUSTION. (stream_open): New function, containing guts of xfopen. (xfopen): Use it. (pipe_fork): Set errno on failure. (maybe_create_temp): New function, containing guts of create_temp. (create_temp): Use it. (open_temp): Distinguish failures due to file descriptor exhaustion from other failures, and on fd exhaustion return a notice to caller rather than dying. Don't test execlp's return value; when it returns, it *always* returns -1. (open_input_files): New function. (mergefps): New arg FPS. It's now the caller's responsibility to open the input and output files. All callers changed. (mergefiles): New function. (avoid_trashing_input, merge): Handle the case where a single merge can't merge as much as we wanted due to file descriptor exhaustion, by merging as much as we can and then retrying. * tests/Makefile.am (TESTS): Add misc/sort-continue. * tests/misc/sort-continue: New file. * THANKS: Add Glen Lenker and Matt Pham who coauthored this patch.
2009-03-14system.h: correct compilation error: MAX not definedJim Meyering
* src/system.h (io_blksize): Move definition down, so it follows that of MAX -- to avoid compilation failure on OpenSolaris. Reported by David Bartley. Details in http://lists.gnu.org/archive/html/bug-coreutils/2009-03/msg00190.html
2009-03-11cp: make -a option preserve xattrs, but with reduced diagnosticsOndřej Vašík
* copy.c (copy_attr_by_fd): Reduce xattr diagnostics for 'cp -a'. (copy_attr_by_name): Likewise. * cp.c (main): Preserve xattrs with -a option, when possible. * doc/coreutils.texi: Document that xattrs are preserved with cp -a, with no added diagnostics. * NEWS: Mention the change. * tests/misc/xattr: Add tests for 'cp --preserve=all' and 'cp -a'.
2009-03-11maint: remove an obsolete FIXME commentJim Meyering
* src/Makefile.am (../AUTHORS): Remove obsolete FIXME comment. There are no longer any installed *.sh programs.
2009-03-11cat: Fix immediate output of processed dataPádraig Brady
Introduced by commit 790892db, 2006-06-08 "Ensure that cat works ...". * NEWS: Mention the bugfix. * src/cat.c (cat): Fix the typo which stopped the writing of processed data before a blocking read() is done. * tests/misc/cat-buf: Add to ensure processed data is not buffered. * tests/Makefile.am: Reference the new test.
2009-03-11cat,cp,mv,install,split: Set the minimum IO block size used to 32KiBPádraig Brady
This is following on from this change: [02c3dc9d 2008-03-06 cat: use larger buffer sizes ...] which increased the IO block size used by cat by 8 times, but also capped it at 32KiB. * NEWS: Mention the change in behavior. * src/system.h: Add a new io_blksize() function that returns the max of ST_BLKSIZE or 32KiB, as this was seen as a good value for a minimum block size to use to get good performance while minimizing system call overhead. * src/cat.c: Use it. * src/copy.c: ditto * src/split.c: ditto
2009-03-08comm: fix a bug in its new --check-order optionBruno Haible
* src/comm.c: Include memcmp2.h. (check_order): Use memcmp2 instead of memcmp. * bootstrap.conf (gnulib_modules): Add memcmp2.
2009-03-07pr: fix a bug whereby --indent=N (-o) did not indent header linesJim Meyering
* src/pr.c (print_header): Honor chars_per_margin also for the header. Inspired by a patch from C de-Avillez. This change also adjusts two other %*s directives to be %*.*s instead, (for the padding on either side of "file_text") to correct a bug that could make pr print one space of padding instead of none. * NEWS (Bug fixes): Mention it. * tests/pr/o3Jml24f-lm-lo: Adjust for new expected output. * tests/pr/o3a3Sl24f-tn: Likewise. * tests/pr/o3a3Snl24f-tn: Likewise. * tests/pr/o3a3l24f-tn: Likewise. * tests/pr/o3b3Sl24f-tn: Likewise. * tests/pr/o3b3Snl24f-tn: Likewise. * tests/pr/o3b3l24f-tn: Likewise. * tests/pr/o3mSl24f-bl-tn: Likewise. * tests/pr/o3mSnl24fbltn: Likewise. * tests/pr/o3ml24f-bl-tn: Likewise.
2009-03-06cat: use larger buffer sizes to reduce read/write-syscall overheadJim Meyering
* src/cat.c (max): Remove definition. Use MAX from system.h instead. (compute_buffer_size): New function to compute the input and output buffer sizes, which are now set at 8 times st_blksize with a maximum of 32KiB. Previously the typical block sizes used were 1KiB for pipes and 4KiB for files, and now will be 8KiB and 32KiB respectively. (main): Use it. This change can double throughput on modern systems. For timings, see http://article.gmane.org/gmane.comp.gnu.core-utils.bugs/16040 Suggestion from Tzvi Rotshtein.
2009-03-06maint: avoid new unused-macro warnings from gccJim Meyering
* src/ls.c (ASSERT_MATCHING_DEV_INO): Comment-out unused definition, to match commented-out use. * src/install.c (INITIAL_HASH_MODULE, INITIAL_ENTRY_TAB_SIZE): (READ_SIZE): Remove definitions of unused macros. * src/mv.c (INITIAL_HASH_MODULE, INITIAL_ENTRY_TAB_SIZE): Likewise. * src/dd.c (max): Likewise. * src/expand.c (OUTPUT_BLOCK): Likewise. * src/csplit.c (ALLOC_SIZE): Likewise. * src/pr.c (NULLCOL): Likewise. * src/ptx.c (Sword): Likewise. * src/unexpand.c (OUTPUT_BLOCK): Likewise. * src/factor.c (NDEBUG): Likewise.
2009-03-02maint: avoid gcc warning about missing attributesJim Meyering
* src/prog-fprintf.h (prog_fprintf): Declare with printf attribute. * src/system.h (usage): Declare with the "noreturn" attribute.
2009-03-02maint: avoid warnings about potentially-counterproductive "inline"Jim Meyering
* src/dd.c (quit): Remove "inline" attribute. * src/test.c (advance, unary_advance): Likewise.
2009-03-02maint: cp: avoid gcc warning about unused macro definitionsJim Meyering
* src/cp.c (INITIAL_HASH_MODULE, INITIAL_ENTRY_TAB_SIZE): Remove.
2009-02-28maint: remove an unnecessary inclusion of <signal.h>Jim Meyering
* src/operand2sig.c: Don't include <signal.h>.
2009-02-27cp: diagnose invalid "cp -rl dir dir" right away, once againJim Meyering
Running "mkdir dir; cp -rl dir dir" would create dir/dir/dir/... rather than diagnosing the "copy-into-self" failure. The easy fix would have been to revert this part of the change [3ece0355 2008-11-09 cp: use far less memory in some cases] that introduced the bug: - remember_copied (dst_name, dst_sb.st_ino, dst_sb.st_dev); + if (!x->hard_link) + remember_copied (dst_name, dst_sb.st_ino, dst_sb.st_dev); However, that would have induced the failure of the new cp/link-heap test, due to the added memory pressure of recording 10k dev/ino pairs. And besides, I liked that improvement and wanted to keep it. Now that it's obvious recording the just-created-directory dev/ino needn't depend on the setting of hard_link, I realized it is necessary to record the pair only for the first directory created for each source command-line argument. I made that change, then noticed the new test, cp -rl a d d, would pass when run once, yet output the into-self diagnostic twice. Also note the side effect: it creates d/a and d/d. However, running that same command a second time, now with the modified directory, would fail. That turned out to be due to the fact that although the first into-self failure was detected in copy_dir, that function would continue copying other entries regardless -- and that would make it fail (eventually) with the unwanted recursion. * src/copy.c (copy_internal): This function needed an indicator of whether, for a give command line argument, it had already created its first directory. If so, no more need to record dev/ino pairs. If this is the first, then do record its pair. Hence, the new parameter. (copy_dir, copy): Update callers. (copy_dir): Upon any into-self failure, break out of the loop. * tests/cp/into-self: Test for the above. Reported by Mikael Magnusson.
2009-02-26sort: Fix two bugs with determining the end of fieldPádraig Brady
* src/sort.c: When no specific number of chars to skip is specified for the end field, always skip the whole field. Also never include leading spaces from next field. * tests/misc/sort: Add 2 new tests for these cases. * NEWS: Mention this bug fix. * THANKS: Add bug reporter. Reported by Davide Canova.
2009-02-24Ensure comment for translators is included in po filePádraig Brady
Issue reported by Göran Uddeborg. * src/system.h: Move the translator comment adjacent to the translated string. * THANKS: Update Göran's email address.
2009-02-20doc: ls: clarify description of -sJim Meyering
* src/ls.c (usage): Make the description of -s mention "allocated size", so that it's less likely to be confused with an apparent byte-count. Suggested by Vito Caputo.
2009-02-19doc: dd: document that the default block size is 512 bytesJim Meyering
* src/dd.c (usage): Document the default block size. * doc/coreutils.texi (dd invocation): Document that the default block size (bs, ibs, obs) is 512 bytes. Reported by Petr Uzel.
2009-02-18cp: -a now preserves SELinux context, with reduced diagnosticsOndřej Vašík
* copy.c (copy_reg): Reduce SELinux context diagnostics for 'cp -a'. (copy_internal): Likewise * copy.h (cp_options): Add boolean reduce_diagnostics. * cp.c (usage): Say that --archive (-a) behaves like -dR --preserve=all. (cp_option_init): Initialize added reduce_diagnostics. (main): Add reduce_diagnostics for the -a option, and preserve SELinux context, if possible. * mv.c (cp_options_init): Initialize new cp_options booleans. * install.c (cp_option_init): Likewise. * NEWS: Mention those behaviour changes. * doc/coreutils.texi: Document --preserve=context, document that diagnostics are not shown for failures of non-mandatory attributes (just SELinux at the moment). * tests/cp/cp-a-selinux: Check not only failures, but succesful use of preserving SELinux context in cp.
2009-02-18add missing copyright datesEric Blake
* NEWS: Add 2009 to copyright. * README: Likewise. * README-hacking: Likewise. * TODO: Likewise. * doc/Makefile.am: Likewise. * m4/prereq.m4: Likewise. * src/nl.c: Likewise. * src/seq.c: Likewise. * tests/cp/cp-i: Likewise. * tests/install/install-C: Likewise. * tests/install/install-C-root: Likewise. * tests/install/install-C-selinux: Likewise. * tests/misc/seq: Likewise. * tests/mv/mv-n: Likewise.
2009-02-17install: compare files in binary modeEric Blake
* src/install.c (need_copy): Use O_BINARY when it matters.
2009-02-17install: add --compare (-C) option to install file only when necessaryKamil Dudka
* src/install.c (have_same_content): New function to compare files content. (extra_mode): New function checking for non-permission bits in mode. (need_copy): New function to check if copy is necessary. (main): Handle new option --compare (-C). (copy_file): Skip file copying if not necessary. (usage): Show new option --compare (-C) in --help. * tests/install/install-C: Basic tests for install --compare (-C). * tests/install/install-C-root: Tests requiring root privileges. * tests/install/install-C-selinux: Tests requiring SELinux. * tests/Makefile.am: Add new tests for install --compare (-C). * doc/coreutils.texi: Document new install option --compare (-C). * NEWS: Mention the change.
2009-02-17nl: correct long-option name for -v in usageOndřej Vašík
* nl.c (usage): Use --starting-line-number, not --first-page for -v
2009-02-15doc: id: make --help and .man more descriptiveJim Meyering
* src/id.c (usage): Improve description, based on a suggestion from Brian M. Carlson in http://bugs.debian.org/514675 * man/id.x: Use a better one-liner, based on the one at top of id.c.
2009-02-14seq: Fix equal width calculation when '.' added to last numberPádraig Brady
Issue reported by Samuel Hapák. <http://lists.gnu.org/archive/html/bug-coreutils/2009-02/msg00139.html> * src/seq.c: Account for '.' added to "last" number. * tests/misc/seq: Add corresponding test. * NEWS: Mention the fix.
2009-02-13du,chgrp,chmod,chown: use FTS_DEFER_STATJim Meyering
* src/du.c (main): Use FTS_DEFER_STAT, for better locality of inode reference. Important when traversing file systems with fake inodes. * src/chgrp.c (main): Likewise. * src/chmod.c (main): Likewise. * src/chown.c (main): Likewise. The only remaining fts client, chcon, doesn't need this, since it goes further and uses FTS_NOSTAT, which suppresses all non- directory stat calls.
2009-02-11ln: add details to --help textEric Blake
* src/ln.c (usage): Mention more about symlink properties. * doc/coreutils.texi (ln invocation): Likewise. * THANKS: Update. Reported by Vitali Lovich. Signed-off-by: Eric Blake <ebb9@byu.net>
2009-02-10ls: clean up after wrapped+colored file names with clear-to-EOLJim Meyering
This change addresses a relatively unusual case: ls --color, with a highlighted name being printed initially in the last row of a terminal emulator (possibly followed by other lines of output) such that it is wrapped onto the following line, as the terminal emulator scrolls the output. That would cause the entire following line to be highlighted, even if the name happened to use only one position. The least-invasive patch would have made colorized output larger for all uses. The approach taken below is more invasive, but limits the increase in overhead to only those lines that are expected to wrap. * src/ls.c (enum indicator_no): Add C_CLR_TO_EOL. (indicator_name): Add "cl". (color_indicator): Add default escape codes for "cl". (print_long_format): Propagate width to print_name_with_quoting. (print_name_with_quoting): Print new C_CLR_TO_EOL string if needed. Return the width of what we're printing. (print_file_name_and_frills): Propagate width. (print_type_indicator): Return bool (aka width). (print_many_per_line): Pass column position to print_* function. (print_current_files): Likewise. (print_horizontal): Likewise. (print_with_commas): Likewise. * src/dircolors.c (slack_codes): Add "CLRTOEOL". (ls_codes): Add "cl". * tests/ls/color-clear-to-eol: New file. Test for this fix. * tests/Makefile.am (TESTS): Add ls/color-clear-to-eol. * THANKS: Update. Reported by Alexander V. Lukyanov. See thread for details: http://thread.gmane.org/gmane.linux.kernel/740021/focus=14824 Thanks to Jan Engelhardt for helping me reproduce the problem. Demonstrate with this in an 80-column xterm: seq 200 # to start in the "bottom" row touch zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz.foo env LS_COLORS='*.foo=0;31;42' ls -og --color=always Before the fix, you'd see something like this: (where the file name is printed in red on a green background, and each "=" denotes a space on a green background) ... -rw-r--r-- 1 0 Feb 5 11:31 zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\ zzzzzzzzzzzzzz.foo=================================================== After the patch, the trailing green spaces are gone: -rw-r--r-- 1 0 Feb 5 11:31 zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\ zzzzzzzzzzzzzz.foo
2009-02-09touch: deprecate --file option: equivalent to --reference (-r)Jim Meyering
* src/touch.c: Mark long-undocumented --file for removal in 2010. (main): Warn upon use of --file.
2009-02-05avoid spurious parentheses/arith-op-related warnings from newer gccJim Meyering
* src/copy.c (set_owner): Use && rather than &. * src/stty.c (main): Likewise. * src/wc.c (wc): Likewise.
2009-02-02* src/system.h (emit_bug_reporting_address): Remove periods.Jim Meyering
2009-02-02update copyright dates from recent changesJim Meyering
* src/dd.c: Add 2009 to list of copyright years. * tests/dd/seek-skip-past-file: Likewise. * tests/dd/seek-skip-past-dev: Likewise. * m4/xattr.m4: Likewise. * src/copy.h: Likewise.
2009-01-29maint: silence some syntax-check rulesJim Meyering
* cfg.mk (sc_strftime_check): Silence the rule. (sc_tight_scope): Likewise. * src/Makefile.am (check-AUTHORS): Likewise.
2009-01-29cp/mv: add xattr supportKamil Dudka
This patch was originally written by Andreas Grünbacher, nowadays available at http://www.suse.de/~agruen/coreutils/5.91/coreutils-xattr.diff * bootstrap.conf: Add gnulib module verror. * po/POTFILES.in: Add lib/verror.c. * m4/xattr.m4: Check for libattr availability, new configure option --disable-xattr. * m4/prereq.m4: Require gl_FUNC_XATTR. * src/Makefile.am: Link cp, mv and ginstall with libattr. * src/copy.h: Add preserve_xattr and require_preserve_xattr to cp_options. * src/copy.c (copy_attr_error): New function to handle errors during xattr copying. (copy_attr_quote): New function to quote file name in error messages printed by libattr. (copy_attr_free): Empty function requested by libattr to free quoted string. (copy_attr_by_fd): New fd-oriented function to copy xattr. (copy_attr_by_name): New name-oriented function to copy xattr. (copy_reg, copy_internal): Call copy_extended_attributes function. * src/cp.c (usage): Mention new --preserve=xattr option. (decode_preserve_arg): Handle new --preserve=xattr option. * src/mv.c: Always attempt to preserve xattr. * src/install.c: Never attempt to preserve xattr. * tests/misc/xattr: New test for xattr support in cp, mv and install. * tests/Makefile.am: Add the new test to list. * doc/coreutils.texi: Mention xattr support, new --preserve=xattr option. * NEWS: Mention the change.
2009-01-28system.h: add a comment re autoconf's new AC_PACKAGE_URLJim Meyering
* src/system.h (emit_bug_reporting_address): Add a comment suggesting to use AC_PACKAGE_URL once we require autoconf-2.64.
2009-01-28dd: Better handle user specified offsets that are too bigPádraig Brady
Following are the before and after operations for seekable files, for the various erroneous offsets handled by this patch: skip beyond end of file before: immediately exit(0); after : immediately printf("cannot skip to specified offset"); exit(0); skip > max file size before: read whole file and exit(0); after : immediately printf("cannot skip: Invalid argument"); exit(1); seek > max file size before: immediately printf("truncate error: EFBIG"); exit(1); after : immediately printf("truncate error: EFBIG"); exit(1); skip > OFF_T_MAX before: read whole device/file and exit(0); after : immediately printf("cannot skip:"); exit(1); seek > OFF_T_MAX before: immediately printf("truncate error: offset too large"); exit(1); after : immediately printf("truncate error: offset too large"); exit(1); skip > device size before: read whole device and exit(0); after : immediately printf("cannot skip: Invalid argument"); exit(1); seek > device size before: read whole device and printf("write error: ENOSPC"); exit(1); after : immediately printf("cannot seek: Invalid argument"); exit(1); * NEWS: Summarize this change in behavior. * src/dd.c (skip): Add error checking for large seek/skip offsets on seekable files, rather than deferring to using read() to advance offset. (dd_copy): Print a warning if skip past EOF, as per FIXME comment. * test/Makefile.am: Add 2 new tests. * tests/dd/seek-skip-past-file: Add tests for first 3 cases above. * tests/dd/seek-skip-past-dev: Add root only test for last case above.
2009-01-27doc: emit better bug-reporting info, to help help2manJim Meyering
* src/system.h (emit_bug_reporting_address): End each "sentence" with period, mark URLs with <...>. Based on a suggestion from Eric Blake. Use fputs on a string without %s, not printf.
2009-01-23build: resolve conflict with new declaration from version-etc.hJim Meyering
* src/system.h (emit_bug_reporting_address): Define away, now, gnulib's version-etc.h also declares this function. In this package, we choose to include each program's name in the diagnostic. Define away the conflicting declaration. (emit_bug_reporting_address): Also emit home page and "General help..." links, like the new function does. Reported by Bob Proulx.
2009-01-22shred: change default number of overwrites from 25 to 3Pádraig Brady
* src/shred.c: The concensus is that a default of 3 passes is appropriate for current drive technologies. * src/TODO: Reference Paul Eggert's suggestion of enhancing shred to conform to DoD 5220 rules.
2009-01-19no longer define *_FILENO constantsJim Meyering
* src/system.h (STDIN_FILENO, STDOUT_FILENO, STDERR_FILENO): Remove definitions. Now guaranteed by gnulib.
2009-01-16echo, printf, test: remove unused #include directivesJim Meyering
* src/echo.c: Don't include "long-options.h". No longer used. * src/printf.c: Likewise. * src/test.c: Likewise.
2009-01-16pathchk: avoid -Wsign-compare warningsPádraig Brady
* src/pathchk.c: Compare pathconf limits to _signed_ MAX constants, as pathconf returns signed values.
2009-01-16pr: avoid -Wsign-compare warningsPádraig Brady
* src/pr.c: Use unsigned variables in unsigned comparisons.