platform/upstream/coreutils.git
15 years agotruncate: fix typo in man page
Tobias Stoeckmann [Sun, 22 Feb 2009 15:30:48 +0000 (16:30 +0100)]
truncate: fix typo in man page

* man/truncate.x: Fix spelling.
* THANKS: Update.

15 years agodoc: describe dd's status=noxref option
Andrew Church [Sun, 22 Feb 2009 09:25:01 +0000 (10:25 +0100)]
doc: describe dd's status=noxref option

* doc/coreutils.texi (dd invocation): Describe status=noxref.

15 years agotests: reenable temporarily-disabled tests using e.g., trap '' TTOU
Jim Meyering [Sun, 22 Feb 2009 00:42:43 +0000 (01:42 +0100)]
tests: reenable temporarily-disabled tests using e.g., trap '' TTOU

Revert "tests: skip newly-modified tests unconditionally..."
This reverts commit 773a88d33f68e50a2919c8a8310c646a7e5fabc2.
* tests/misc/stty: Don't skip.
* tests/misc/stty-invalid: Likewise.
* tests/mv/i-3: Likewise.

15 years agoupdate James Youngman's email address
James Youngman [Sun, 22 Feb 2009 00:41:13 +0000 (00:41 +0000)]
update James Youngman's email address

* THANKS: Update James Youngman's email address

15 years agopost-release administrivia
Jim Meyering [Sat, 21 Feb 2009 21:49:24 +0000 (22:49 +0100)]
post-release administrivia

* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.

15 years agoversion 7.1 v7.1
Jim Meyering [Sat, 21 Feb 2009 21:35:33 +0000 (22:35 +0100)]
version 7.1

* NEWS: Record release date.

15 years ago* README: Mention that c99-to-c89.diff is no longer maintained.
Jim Meyering [Sat, 21 Feb 2009 20:31:34 +0000 (21:31 +0100)]
* README: Mention that c99-to-c89.diff is no longer maintained.

15 years agotests: skip new install-C test if working directory is set-gid
Jim Meyering [Sat, 21 Feb 2009 18:48:30 +0000 (19:48 +0100)]
tests: skip new install-C test if working directory is set-gid

* tests/install/install-C: Use setgid-check.

15 years agotests: skip newly-modified tests unconditionally, just to be safe
Jim Meyering [Sat, 21 Feb 2009 14:56:26 +0000 (15:56 +0100)]
tests: skip newly-modified tests unconditionally, just to be safe

* tests/misc/stty-invalid: Skip.
* tests/misc/stty: Likewise.
* tests/mv/i-3: Likewise.

15 years agotests: don't let SIGTTOU/TTIN hang a backgrounded "make check"
Jim Meyering [Sat, 21 Feb 2009 10:30:41 +0000 (11:30 +0100)]
tests: don't let SIGTTOU/TTIN hang a backgrounded "make check"

Running "make check &" would hang due to SIGTTOU and SIGTTIN signals.
* tests/misc/stty: Ignore SIGTTOU.
* tests/misc/stty-invalid: Likewise.
* tests/mv/i-3: Ignore SIGTTIN.

15 years agodoc: ls: clarify description of -s
Jim Meyering [Fri, 20 Feb 2009 18:31:31 +0000 (19:31 +0100)]
doc: ls: clarify description of -s

* 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.

15 years agodoc: dd: document that the default block size is 512 bytes
Jim Meyering [Thu, 19 Feb 2009 11:35:58 +0000 (12:35 +0100)]
doc: dd: document that the default block size is 512 bytes

* 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.

15 years agomaint: changing NEWS' copyright date must not invalidate checksum
Jim Meyering [Wed, 18 Feb 2009 15:09:45 +0000 (16:09 +0100)]
maint: changing NEWS' copyright date must not invalidate checksum

* maint.mk (NEWS_hash): Don't let the Copyright date line contribute
to the checksum.
* cfg.mk (old_NEWS_hash): Update to reflect the new policy.

15 years agodoc: explain how to recover from changes committed to master
Jim Meyering [Wed, 18 Feb 2009 13:50:04 +0000 (14:50 +0100)]
doc: explain how to recover from changes committed to master

* HACKING: A beginner's commit-to-master is so common,
and causes enough confusion, that we describe how to recover.

15 years agomaint: add copyright notices
Jim Meyering [Wed, 18 Feb 2009 13:34:23 +0000 (14:34 +0100)]
maint: add copyright notices

* HACKING: Add copyright notice.
* tests/test-lib.sh: Likewise.

15 years agocp: -a now preserves SELinux context, with reduced diagnostics
Ondřej Vašík [Tue, 17 Feb 2009 14:53:39 +0000 (15:53 +0100)]
cp: -a now preserves SELinux context, with reduced diagnostics

* 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.

15 years agoadd missing copyright dates
Eric Blake [Wed, 18 Feb 2009 13:07:30 +0000 (06:07 -0700)]
add missing copyright dates

* 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.

15 years agoinstall: compare files in binary mode
Eric Blake [Tue, 17 Feb 2009 14:58:39 +0000 (07:58 -0700)]
install: compare files in binary mode

* src/install.c (need_copy): Use O_BINARY when it matters.

15 years agoinstall: add --compare (-C) option to install file only when necessary
Kamil Dudka [Tue, 17 Feb 2009 12:16:54 +0000 (13:16 +0100)]
install: add --compare (-C) option to install file only when necessary

* 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.

15 years agonl: correct long-option name for -v in usage
Ondřej Vašík [Tue, 17 Feb 2009 12:29:33 +0000 (13:29 +0100)]
nl: correct long-option name for -v in usage

* nl.c (usage): Use --starting-line-number, not --first-page for -v

15 years agodoc: id: make --help and .man more descriptive
Jim Meyering [Sat, 14 Feb 2009 08:09:17 +0000 (09:09 +0100)]
doc: id: make --help and .man more descriptive

* 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.

15 years agoseq: Fix equal width calculation when '.' added to last number
Pádraig Brady [Sat, 14 Feb 2009 17:20:37 +0000 (17:20 +0000)]
seq: Fix equal width calculation when '.' added to last number

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.

15 years agodu,chgrp,chmod,chown: use FTS_DEFER_STAT
Jim Meyering [Wed, 11 Feb 2009 11:26:14 +0000 (12:26 +0100)]
du,chgrp,chmod,chown: use FTS_DEFER_STAT

* 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.

15 years agomaint: mention how to run a single test in HACKING docs
Pádraig Brady [Thu, 12 Feb 2009 13:51:03 +0000 (13:51 +0000)]
maint: mention how to run a single test in HACKING docs

* HACKING: Give an example of how to run a test in isolation.
* README: Fix/simplify example for running a single test.
* README-hacking: Reference the HACKING file.

15 years agoln: add details to --help text
Eric Blake [Thu, 12 Feb 2009 04:09:09 +0000 (21:09 -0700)]
ln: add details to --help text

* 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>
15 years agols: clean up after wrapped+colored file names with clear-to-EOL
Jim Meyering [Wed, 31 Dec 2008 18:17:31 +0000 (19:17 +0100)]
ls: clean up after wrapped+colored file names with clear-to-EOL

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

15 years ago* tests/test-lib.sh: Use skip_test_... in place of echo...;exit 77.
Jim Meyering [Tue, 10 Feb 2009 13:30:06 +0000 (14:30 +0100)]
* tests/test-lib.sh: Use skip_test_... in place of echo...;exit 77.

15 years agotests: avoid skipping stty-* tests
Nix [Tue, 10 Feb 2009 08:04:23 +0000 (08:04 +0000)]
tests: avoid skipping stty-* tests

* tests/test-lib.sh (require_controlling_input_terminal_):
Check stdout, not stdin.

15 years agotouch: deprecate --file option: equivalent to --reference (-r)
Jim Meyering [Mon, 9 Feb 2009 10:44:17 +0000 (11:44 +0100)]
touch: deprecate --file option: equivalent to --reference (-r)

* src/touch.c: Mark long-undocumented --file for removal in 2010.
(main): Warn upon use of --file.

15 years agotests: fix dd skip=greater_max_file_size test on Solaris 10
Pádraig Brady [Fri, 6 Feb 2009 02:01:43 +0000 (02:01 +0000)]
tests: fix dd skip=greater_max_file_size test on Solaris 10

* tests/dd/skip-seek-past-file: I had previously commented that
on some systems lseek(> max file size) may succeed, but left
the possibility of failure in that case, so that I could determine
specific systems to put in the comments for both failure modes.

15 years agoavoid spurious parentheses/arith-op-related warnings from newer gcc
Jim Meyering [Thu, 5 Feb 2009 13:53:10 +0000 (14:53 +0100)]
avoid spurious parentheses/arith-op-related warnings from newer gcc

* src/copy.c (set_owner): Use && rather than &.
* src/stty.c (main): Likewise.
* src/wc.c (wc): Likewise.

15 years agomaint: tighten atoi/atof-prohibiting regexp, clean up .x-sc- file
Jim Meyering [Mon, 2 Feb 2009 08:37:08 +0000 (09:37 +0100)]
maint: tighten atoi/atof-prohibiting regexp, clean up .x-sc- file

* maint.mk (sc_prohibit_atoi_atof): Require "(" after token.
* .x-sc_prohibit_atoi_atof: Remove names that no longer contain a match.

15 years agodoc: preserve --help line breaks in 'REPORTING BUGS' man page section
Jim Meyering [Sun, 1 Feb 2009 19:29:14 +0000 (20:29 +0100)]
doc: preserve --help line breaks in 'REPORTING BUGS' man page section

* man/help2man: Insert .br between adjacent lines.

15 years ago* src/system.h (emit_bug_reporting_address): Remove periods.
Jim Meyering [Sun, 1 Feb 2009 19:23:06 +0000 (20:23 +0100)]
* src/system.h (emit_bug_reporting_address): Remove periods.

15 years agoupdate copyright dates from recent changes
Jim Meyering [Thu, 20 Nov 2008 10:28:31 +0000 (10:28 +0000)]
update copyright dates from recent changes

* 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.

15 years ago* maint.mk (sc_redundant_const): Use $(_prohibit_regexp).
Jim Meyering [Sun, 1 Feb 2009 19:19:03 +0000 (20:19 +0100)]
* maint.mk (sc_redundant_const): Use $(_prohibit_regexp).

15 years agodate doc: warn at -d about LC_TIME
jidanni@jidanni.org [Thu, 29 Jan 2009 15:04:46 +0000 (23:04 +0800)]
date doc: warn at -d about LC_TIME

We also warn here about LC_TIME, so the user will know even if he
doesn't look in the @xref{Date input formats}.

15 years agodocument sort --ignore-case --unique interaction
jidanni@jidanni.org [Thu, 29 Jan 2009 15:03:49 +0000 (23:03 +0800)]
document sort --ignore-case --unique interaction

15 years agomaint: detect useless inclusion of c-ctype.h
Jim Meyering [Sat, 31 Jan 2009 08:39:12 +0000 (09:39 +0100)]
maint: detect useless inclusion of c-ctype.h

* maint.mk (sc_prohibit_c_ctype_without_use): New rule.

15 years agomaint: teach "make syntax-check" to print each check name as it's run
Jim Meyering [Thu, 29 Jan 2009 09:46:39 +0000 (10:46 +0100)]
maint: teach "make syntax-check" to print each check name as it's run

* maint.mk (%.m): New rules to print each syntax-checking rule name,
just before running its commands.
($(syntax-check-rules)): Depend on it.

15 years agomaint: silence some syntax-check rules
Jim Meyering [Thu, 29 Jan 2009 09:44:25 +0000 (10:44 +0100)]
maint: silence some syntax-check rules

* cfg.mk (sc_strftime_check): Silence the rule.
(sc_tight_scope): Likewise.
* src/Makefile.am (check-AUTHORS): Likewise.

15 years agomaint: factor syntax-check rules
Jim Meyering [Thu, 29 Jan 2009 09:44:10 +0000 (10:44 +0100)]
maint: factor syntax-check rules

* maint.mk (_ignore_case): New macro.
(_prohibit_regexp): Use it.
Factor many existing syntax-check rules to use $(_prohibit_regexp).

15 years agocp/mv: add xattr support
Kamil Dudka [Fri, 23 Jan 2009 11:17:53 +0000 (12:17 +0100)]
cp/mv: add xattr support

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.

15 years agosystem.h: add a comment re autoconf's new AC_PACKAGE_URL
Jim Meyering [Wed, 28 Jan 2009 17:36:08 +0000 (18:36 +0100)]
system.h: add a comment re autoconf's new AC_PACKAGE_URL

* src/system.h (emit_bug_reporting_address): Add a comment
suggesting to use AC_PACKAGE_URL once we require autoconf-2.64.

15 years agotests: Fixup shred-passes test
Pádraig Brady [Wed, 28 Jan 2009 16:42:20 +0000 (16:42 +0000)]
tests: Fixup shred-passes test

* tests/misc/shred-passes: Set the $fail variable correctly.
The issue was noticed by Jim Meyering.

15 years agotests: Add a test to verify shred's default operations
Pádraig Brady [Mon, 26 Jan 2009 02:19:13 +0000 (02:19 +0000)]
tests: Add a test to verify shred's default operations

* tests/Makefile.am: add new test
* tests/misc/shred-passes: Verify the operations shred
does by default to overwrite and remove a zero length file.

15 years agodd: Better handle user specified offsets that are too big
Pádraig Brady [Thu, 20 Nov 2008 10:28:31 +0000 (10:28 +0000)]
dd: Better handle user specified offsets that are too big

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.

15 years agodoc: emit better bug-reporting info, to help help2man
Jim Meyering [Tue, 27 Jan 2009 18:43:45 +0000 (19:43 +0100)]
doc: emit better bug-reporting info, to help help2man

* 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.

15 years agodoc: ensure that emit_bug_reporting_address changes propagate to *.1
Jim Meyering [Tue, 27 Jan 2009 18:42:00 +0000 (19:42 +0100)]
doc: ensure that emit_bug_reporting_address changes propagate to *.1

* man/Makefile.am ($(MAN)): Depend on system.h.

15 years agodoc: restore "REPORTING BUGS" section to generated man pages
Jim Meyering [Tue, 27 Jan 2009 18:16:10 +0000 (19:16 +0100)]
doc: restore "REPORTING BUGS" section to generated man pages

* man/help2man ($PAT_BUGS): Update regexp to match the newer
"Report PROG bugs ..." --help output, as well as "Report bugs...".
Reported by Eric Blake.

15 years agotests: generalize install-transform-check
Jim Meyering [Mon, 26 Jan 2009 17:10:39 +0000 (18:10 +0100)]
tests: generalize install-transform-check

* maint.mk (install-transform-check): Generalize to work also
in a project that installs manuals in a section other than "1".

15 years agobuild: resolve conflict with new declaration from version-etc.h
Jim Meyering [Fri, 23 Jan 2009 17:27:36 +0000 (18:27 +0100)]
build: resolve conflict with new declaration from version-etc.h

* 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.

15 years agodoc: shred: Correct docs on default number of overwrites.
Pádraig Brady [Thu, 22 Jan 2009 19:34:11 +0000 (19:34 +0000)]
doc: shred: Correct docs on default number of overwrites.

* NEWS: Mention the change to the default number of passes.
* doc/Makefile.am: Update constants.texi with the default
number of passes shred uses, so that the documentation
will automatically reflect any future changes.
* doc/coreutils.texi (shred invocation): Update the description
of the --iterations option to have the correct default number,
while still conveying that there are 25 internal patterns
that may be useful.

15 years agoshred: change default number of overwrites from 25 to 3
Pádraig Brady [Thu, 22 Jan 2009 13:09:44 +0000 (13:09 +0000)]
shred: change default number of overwrites from 25 to 3

* 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.

15 years agom4: don't use AC_REQUIRE([AC_C_BIGENDIAN])
Jim Meyering [Wed, 21 Jan 2009 13:48:15 +0000 (14:48 +0100)]
m4: don't use AC_REQUIRE([AC_C_BIGENDIAN])

* m4/jm-macros.m4: Use AC_REQUIRE([gl_BIGENDIAN]) instead.
This avoids a subtle problem recently documented in autoconf:
http://git.sv.gnu.org/gitweb/?p=autoconf.git;a=commitdiff;h=34e2c8d5484

15 years agono longer define *_FILENO constants
Jim Meyering [Mon, 19 Jan 2009 20:27:40 +0000 (21:27 +0100)]
no longer define *_FILENO constants

* src/system.h (STDIN_FILENO, STDOUT_FILENO, STDERR_FILENO):
Remove definitions.  Now guaranteed by gnulib.

15 years agobuild: use dist-xz, not dist-lzma, cont'd
Jim Meyering [Sun, 30 Nov 2008 18:35:10 +0000 (19:35 +0100)]
build: use dist-xz, not dist-lzma, cont'd

* README-hacking: mention XZ utils
* README-prereq: Add a FIXME comment.

15 years agotests: tail-2/infloop-1 is racy
Jim Meyering [Mon, 19 Jan 2009 11:09:12 +0000 (12:09 +0100)]
tests: tail-2/infloop-1 is racy

* tests/tail-2/infloop-1: Add a comment to that effect.

15 years agobuild: use dist-xz, not dist-lzma
Jim Meyering [Sun, 30 Nov 2008 18:35:10 +0000 (19:35 +0100)]
build: use dist-xz, not dist-lzma

* configure.ac (AM_INIT_AUTOMAKE): s/dist-lzma/dist-xz/.
Requires recent "xz" from git://ctrl.tukaani.org/lzma-utils.git

15 years agomaint: remove obsolete sc_author_mark_check rule
Jim Meyering [Thu, 8 Jan 2009 12:31:01 +0000 (13:31 +0100)]
maint: remove obsolete sc_author_mark_check rule

* maint.mk (sc_author_mark_check): Remove rule.
"and" no longer appears in the definition of AUTHORS.

15 years agoMerge branch 'master' of git://git.sv.gnu.org/coreutils
Jim Meyering [Fri, 16 Jan 2009 22:30:27 +0000 (23:30 +0100)]
Merge branch 'master' of git://git.sv.gnu.org/coreutils

15 years agomaint: enforce existing prohibition: no cvs $keywords$
Jim Meyering [Sat, 13 Dec 2008 13:26:25 +0000 (14:26 +0100)]
maint: enforce existing prohibition: no cvs $keywords$

* maint.mk (sc_prohibit_cvs_keyword): New rule.

15 years agoecho, printf, test: remove unused #include directives
Jim Meyering [Fri, 16 Jan 2009 09:16:53 +0000 (10:16 +0100)]
echo, printf, test: remove unused #include directives

* src/echo.c: Don't include "long-options.h". No longer used.
* src/printf.c: Likewise.
* src/test.c: Likewise.

15 years agopathchk: avoid -Wsign-compare warnings
Pádraig Brady [Thu, 15 Jan 2009 17:36:27 +0000 (17:36 +0000)]
pathchk: avoid -Wsign-compare warnings

* src/pathchk.c: Compare pathconf limits to _signed_ MAX constants,
as pathconf returns signed values.

15 years agopr: avoid -Wsign-compare warnings
Pádraig Brady [Thu, 15 Jan 2009 17:32:31 +0000 (17:32 +0000)]
pr: avoid -Wsign-compare warnings

* src/pr.c: Use unsigned variables in unsigned comparisons.

15 years agoshred: avoid -Wsign-compare warnings
Pádraig Brady [Thu, 15 Jan 2009 17:26:59 +0000 (17:26 +0000)]
shred: avoid -Wsign-compare warnings

* src/shred.c: Use already assigned signed variable sizeof_r,
rather than the unsigned sizeof(r). Don't use signed integer
overflow check that contemporary compilers may remove anyway.

15 years agosimplify mgetgroups() and avoid -Wsign-compare warnings
Pádraig Brady [Wed, 14 Jan 2009 19:17:39 +0000 (19:17 +0000)]
simplify mgetgroups() and avoid -Wsign-compare warnings

* 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.

15 years agotest, echo, printf: don't accept option abbreviation
Eric Blake [Wed, 14 Jan 2009 04:59:35 +0000 (21:59 -0700)]
test, echo, printf: don't accept option abbreviation

* src/test.c (main): Directly parse accepted options, thus
avoiding abbreviations.
* src/echo.c (main): Likewise.
* src/printf.c (main): Likewise.

15 years agocp/mv: add --no-clobber (-n) option to not overwrite target
Kamil Dudka [Tue, 13 Jan 2009 17:35:00 +0000 (18:35 +0100)]
cp/mv: add --no-clobber (-n) option to not overwrite target

* src/cp.c (usage): Show new option -n in --help.
(main): Handle new option -n.
* src/mv.c (usage): Show new option -n in --help.
(main): Handle new option -n.
* doc/coreutils.texi: Document new cp/mv option -n.
* tests/cp/cp-i: Add tests for -f, -i and -n options.
* tests/mv/mv-n: New test for mv -n.
* tests/Makefile.am: Add test mv/mv-n to the list.
* NEWS: Mention the change.

15 years agooption handling: make exceptions more consistent
Eric Blake [Thu, 8 Jan 2009 13:33:16 +0000 (06:33 -0700)]
option handling: make exceptions more consistent

* doc/coreutils.texi (Common options): Not all utilities reject
option abbreviations.
* src/chroot.c (main): Report correct name on failure.
* src/echo.c (usage): Clarify long option usage.
* src/setuidgid.c (usage): Likewise.
* src/hostid.c (usage): Condense.

15 years ago* bootstrap.conf (avoided_gnulib_modules): Add dummy.
Jim Meyering [Fri, 2 Jan 2009 16:30:42 +0000 (17:30 +0100)]
* bootstrap.conf (avoided_gnulib_modules): Add dummy.

15 years ago* maint.mk: align some backslashes
Jim Meyering [Wed, 7 Jan 2009 21:54:11 +0000 (22:54 +0100)]
* maint.mk: align some backslashes

15 years agodoc: pathchk description enhancements
Pádraig Brady [Sun, 4 Jan 2009 01:06:10 +0000 (01:06 +0000)]
doc: pathchk description enhancements

* doc/coreutils.texi (pathchk invocation): Mention pathchk
checks validity (for current system) as well as portability.
Say messages go to stderr, and reorder description of checks
done for the -p option, to match what's done in code.
* src/pathchk.c (usage): Mention pathchk checks name validity.
Suggested clarifications were from Dan Jacobson.

15 years agosrc/.gitignore: Ignore getlimits utility
Pádraig Brady [Thu, 1 Jan 2009 01:44:57 +0000 (01:44 +0000)]
src/.gitignore: Ignore getlimits utility

* src/.gitignore: Ignore getlimits

15 years agotests: refactor to use the new getlimits utility
Pádraig Brady [Fri, 12 Dec 2008 10:25:34 +0000 (10:25 +0000)]
tests: refactor to use the new getlimits utility

* tests/Coreutils.pm: Add function to make limits available
* tests/test-lib.sh: ditto
* tests/misc/join: Check for both SIZE_OFLOW and UINTMAX_OFLOW
rather than using arbitrary 2^128
* tests/misc/sort: ditto
* tests/misc/uniq: ditto
* tests/misc/printf: Check for both INT_OFLOW and INT_UFLOW
rather than using arbitrary -2^31
* tests/misc/seq-long-double: Check for INTMAX_OFLOW
rather than using arbitrary 2^63
* tests/misc/split-fail: Check --lines --bytes and --line-bytes
options limits on all platforms. Note getlimits obviates the
need to use expr to check if 32 bit integers are supported,
which I think was invalid anyway as expr now supports bignum?
* tests/misc/test: Check for UINTMAX_OFLOW rather than
using arbitrary 2^64 and 2^128. Check for INTMAX_UFLOW
rather than using arbitrary -2^64
* tests/misc/timeout-parameters: Check for UINT_OFLOW
rather than using arbitrary 2^32
* tests/misc/truncate-overflow: Don't depend on truncate
to determine if we're on a 32 or 64 bit platform and
instead use the various OFF_T limits
* tests/misc/sort-merge: Check for UINTMAX_OFLOW
rather than using arbitrary 2^64+1
* tests/misc/unexpand: ditto

15 years agostat: print file-system total inode count (%c) as an unsigned number
Michael Meskes [Fri, 2 Jan 2009 15:40:52 +0000 (16:40 +0100)]
stat: print file-system total inode count (%c) as an unsigned number

* src/stat.c (print_statfs): Print statfs.f_files, the total inode
count of a file system, as an unsigned number.

15 years agotests: factor ls-misc (no semantic change)
Jim Meyering [Wed, 31 Dec 2008 19:11:18 +0000 (20:11 +0100)]
tests: factor ls-misc (no semantic change)

* tests/misc/ls-misc: Factor out uses of "\e[0m".

15 years agoupdate copyright year
Jim Meyering [Thu, 1 Jan 2009 01:05:25 +0000 (02:05 +0100)]
update copyright year

* doc/coreutils.texi: Likewise.
* tests/sample-test: Likewise.

15 years agoimprove M4 quoting
Jim Meyering [Tue, 30 Dec 2008 18:16:08 +0000 (19:16 +0100)]
improve M4 quoting

* 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.

15 years agobootstrap: don't use cmp's -s option when reading from a pipe
Jim Meyering [Mon, 29 Dec 2008 19:43:48 +0000 (20:43 +0100)]
bootstrap: don't use cmp's -s option when reading from a pipe

GNU cmp exits without reading all input when given the -s option,
and that can cause termination of the writing process via SIGPIPE.
Instead, when reading from a pipe, just redirect output to /dev/null
so that all input is read.

15 years agomaint: factor out common code; prohibit use of HAVE_MBRTOWC
Jim Meyering [Mon, 29 Dec 2008 15:34:45 +0000 (16:34 +0100)]
maint: factor out common code; prohibit use of HAVE_MBRTOWC

* maint.mk (_prohibit_regexp): New macro.
(sc_avoid_if_before_free, sc_cast_of_argument_to_free):
(sc_cast_of_x_alloc_return_value, sc_cast_of_alloca_return_value):
(sc_space_tab, sc_prohibit_atoi_atof, sc_prohibit_strcmp):
(sc_prohibit_stat_st_blocks, sc_prohibit_S_IS_definition): Use it.
(sc_prohibit_HAVE_MBRTOWC): New rule.

15 years agomaint: use more sc_-prefixed names
Jim Meyering [Fri, 26 Dec 2008 14:53:03 +0000 (15:53 +0100)]
maint: use more sc_-prefixed names

* maint.mk (sc_po_check): Renamed from po-check.
(sc_author_mark_check): Renamed from author_mark_check.
(sc_copyright_check): Renamed from copyright-check.
(sc_makefile_path_separator_check): Renamed from
makefile_path_separator_check.
(local-checks-available): Remove the old names.
* Makefile.am (EXTRA_DIST): Reflect the renaming: .x-sc_po_check
* .x-po-check: Rename to...
* .x-sc_po_check: ...new file.

15 years agomaint: tighten m4 AC_ quoting check
Jim Meyering [Fri, 26 Dec 2008 14:33:34 +0000 (15:33 +0100)]
maint: tighten m4 AC_ quoting check

* maint.mk (sc_m4_quote_check): Renamed from m4-check.
Also search for AC_DEFINE and AC_DEFINE_UNQUOTED.
Also search in configure.ac.
* configure.ac: Quote first argument of AC_DEFINE.
* jm-macros.m4 (coreutils_MACROS): Quote the first argument to AC_DEFINE.

15 years agomaint: move coreutils-specific syntax check rules into cfg.mk
Jim Meyering [Fri, 26 Dec 2008 14:39:41 +0000 (15:39 +0100)]
maint: move coreutils-specific syntax check rules into cfg.mk

* maint.mk (sc_dd_max_sym_length, sc_prohibit_jm_in_m4):
(sc_root_tests, sc_always_defined_macros, sc_system_h_headers):
(sc_sun_os_names, sc_tight_scope, sc_no_exec_perl_coreutils):
Move rules into cfg.mk.
(sc_strftime_check): Renamed from strftime-check, and moved, too.
* cfg.mk: Add the above rules.

15 years agoportability: accommodate gnulib's getaddrinfo change
Jim Meyering [Tue, 23 Dec 2008 19:00:27 +0000 (20:00 +0100)]
portability: accommodate gnulib's getaddrinfo change

* src/Makefile.am (pinky_LDADD, who_LDADD): Append $(GETADDRINFO_LIB)

15 years agocleanup/modernize: don't test HAVE_MBRTOWC; now gnulib provides it
Jim Meyering [Tue, 23 Dec 2008 18:06:31 +0000 (19:06 +0100)]
cleanup/modernize: don't test HAVE_MBRTOWC; now gnulib provides it

* bootstrap.conf (gnulib_modules): Include mbrtowc explicitly.
* src/ls.c (quote_name): Don't test HAVE_MBRTOWC, now that we're
guaranteed to have the function.
* src/wc.c (wc): Likewise.

15 years agodoc: mention long option abbreviation
Eric Blake [Sat, 27 Dec 2008 16:38:09 +0000 (09:38 -0700)]
doc: mention long option abbreviation

* doc/coreutils.texi (Common options): Give example of
abbreviating options.
* THANKS: Update.
Reported by Adam Jimerson.

15 years agomaint: ensure dd's computation of O_FULLBLOCK uses all O_ symbol names
Jim Meyering [Fri, 26 Dec 2008 11:00:18 +0000 (12:00 +0100)]
maint: ensure dd's computation of O_FULLBLOCK uses all O_ symbol names

* src/dd.c (O_FULLBLOCK): Use a more uniform initializer, that makes
it easier to extract all O_ symbol names.
* maint.mk (syntax-check-rules): Also search for sc_ rules in cfg.mk.
(sc_root_tests): Ensure that this rule sets $diff.
* cfg.mk (sc_dd_O_FLAGS): New rule.

15 years agodd: add support for opening files in Concurrent I/O (CIO) mode
Matt Harden [Mon, 22 Dec 2008 04:06:16 +0000 (22:06 -0600)]
dd: add support for opening files in Concurrent I/O (CIO) mode

* src/dd.c (O_CIO): New flag.
* src/dd.c (O_FULLBLOCK): Add O_CIO to the list of flags that
O_FULLBLOCK should be greater than.
* src/dd.c (flags): Give the name "cio" to the new O_CIO flag, mirroring
the treatment of O_DIRECT.
* src/dd.c (usage): Add a description of the new flag when it is available.
* doc/coreutils.text (dd invocation): Describe the new flag.
* NEWS: Mention the new feature.

15 years agobuild: do enable $(WERROR_CFLAGS) for src/ files.
Jim Meyering [Mon, 22 Dec 2008 17:21:59 +0000 (18:21 +0100)]
build: do enable $(WERROR_CFLAGS) for src/ files.

This reverts the more recent commit (of two) entitled "build:
add configure-time --enable-gcc-warnings option; avoid warnings".
Pádraig Brady spotted the contradiction between the log message
and actual change.

This reverts commit 292d68565a34b237cd2bf586ace545b7cd3dbfcf.

15 years agodoc: stty: Clarification of some input and output settings
Pádraig Brady [Tue, 23 Dec 2008 11:55:46 +0000 (11:55 +0000)]
doc: stty: Clarification of some input and output settings

* doc/coreutils.texi (stty invocation): Clarify any
ambiguity in regard to the direction of input and output settings.
Add some notes on the case changing settings.
Most of the text was supplied by Dan Jacobson.

15 years agotimeout: remove problematic casts
Pádraig Brady [Tue, 23 Dec 2008 09:36:22 +0000 (09:36 +0000)]
timeout: remove problematic casts

* src/timeout.c (apply_time_suffix): Change input parameter from
unsigned int to unsigned long, which is the type of the variable it's
actually manipulating.  This removes the need for the cast which was
giving a warning with the gcc options: -fstrict-aliasing
-Wstrict-aliasing.  Also add a check for overflow possible on 16-bit
platforms, and fix indents.
(main): Remove a redundant cast in the alarm() call.

15 years ago* .x-sc_require_config_h: Remove obsolete regexps.
Jim Meyering [Sun, 21 Dec 2008 16:38:08 +0000 (17:38 +0100)]
* .x-sc_require_config_h: Remove obsolete regexps.

15 years agomaint.mk: enforce the "include <config.h> first" rule
Jim Meyering [Sun, 21 Dec 2008 16:37:22 +0000 (17:37 +0100)]
maint.mk: enforce the "include <config.h> first" rule

* maint.mk (sc_require_config_h_first): New rule.
* .x-sc_require_config_h_first: New file.

15 years agobuild: add configure-time --enable-gcc-warnings option; avoid warnings
Jim Meyering [Wed, 12 Nov 2008 10:11:54 +0000 (11:11 +0100)]
build: add configure-time --enable-gcc-warnings option; avoid warnings

* bootstrap.conf (gnulib_modules): Add "warnings" module.
* configure.ac: Add --enable-gcc-warnings, derived from code in bison.
* src/Makefile.am (AM_CFLAGS): Set to $(WARN_CFLAGS) # $(WERROR_CFLAGS)
* lib/Makefile.am (AM_CFLAGS): Change spelling to $(WARN_CFLAGS)
Don't use $(WERROR_CFLAGS), yet.
* src/system.h (usage): Declare.
* src/base64.c (usage): Declare to be global, for consistency.
* src/timeout.c (usage): Likewise.
* src/truncate.c (usage): Likewise.
* src/getlimits.c (usage): Likewise.
* src/pinky.c (ttyname): Declare with prototype, rather than an
empty argument list.
* src/who.c (ttyname): Likewise.
* src/su.c (crypt, getusershell, setusershell, endusershell): Likewise.

15 years agobuild: turn on $(WERROR_CFLAGS) for src/
Jim Meyering [Sun, 30 Nov 2008 21:41:50 +0000 (22:41 +0100)]
build: turn on $(WERROR_CFLAGS) for src/

15 years agobuild: add configure-time --enable-gcc-warnings option; avoid warnings
Jim Meyering [Wed, 12 Nov 2008 10:11:54 +0000 (11:11 +0100)]
build: add configure-time --enable-gcc-warnings option; avoid warnings

* bootstrap.conf (gnulib_modules): Add "warnings" module.
* configure.ac: Add --enable-gcc-warnings, derived from code in bison.
* src/Makefile.am (AM_CFLAGS): Set to $(WARN_CFLAGS) # $(WERROR_CFLAGS)
* lib/Makefile.am (AM_CFLAGS): Change spelling to $(WARN_CFLAGS)
Don't use $(WERROR_CFLAGS), yet.
* src/system.h (usage): Declare.
* src/base64.c (usage): Declare to be global, for consistency.
* src/timeout.c (usage): Likewise.
* src/truncate.c (usage): Likewise.
* src/getlimits.c (usage): Likewise.
* src/pinky.c (ttyname): Declare with prototype, rather than an
empty argument list.
* src/who.c (ttyname): Likewise.
* src/su.c (crypt, getusershell, setusershell, endusershell): Likewise.

15 years agodoc: Remove curly quotes from shell examples in man pages
Pádraig Brady [Wed, 17 Dec 2008 10:41:34 +0000 (10:41 +0000)]
doc: Remove curly quotes from shell examples in man pages

Use \(aq rather than a literal ' as groff will convert apostrophe
to a right quote (\u2029) in utf8 locales for example.
Stepan Kasal details the issue and fix here:
http://lists.gnu.org/archive/html/bug-coreutils/2008-12/msg00124.html

15 years agoChangeLog-2008: say ChangeLog files are no longer manually maintained
Jim Meyering [Tue, 16 Dec 2008 07:15:18 +0000 (08:15 +0100)]
ChangeLog-2008: say ChangeLog files are no longer manually maintained

and point to HACKING's policy.  Suggestion from Dan Jacobson.

15 years agodu: -H now does what POSIX requires
Jim Meyering [Tue, 9 Dec 2008 07:22:21 +0000 (08:22 +0100)]
du: -H now does what POSIX requires

* src/du.c (usage): Update --help output.
(main): Move -H-handling code from the --si block to
the one for --dereference-args (-D).
* doc/coreutils.texi (du invocation): Update description.
* NEWS (Changes in behavior): Mention this.