Commit Graph

868 Commits

Author SHA1 Message Date
Cliff Miller
24c727d3c2 sort: Ignore fields where end position is before the start position
* NEWS: Mention the fix
* THANKS: Add Cliff Miller
* src/sort.c (keycompare): Ensure lima >= texta
* tests/misc/sort: Add 3 corresponding tests

Signed-off-by: Pádraig Brady <P@draigBrady.com>
2009-06-13 01:25:06 +01:00
Kamil Dudka
0df338f671 ls --color: do not colorize files with multiple hard links by default
* src/ls.c: Rename hl->mh, do not colorize files with multiple
hard links by default.
* src/dircolors.c: Rename HARDLINK -> MULTIHARDLINK, hl -> mh.
* src/dircolors.hin: Do not colorize files with multiple hard links by
default.
* tests/Makefile.am: Rename the test case accordingly.
* tests/ls/multihardlink: Additionally test ls' default behavior
and factor out some duplication.
* NEWS: Mention the change in behavior.
2009-06-11 09:53:50 +02:00
Michael Speer
159faba137 sort: new --human-numeric-sort option to sort KiB MB etc.
* NEWS: Document the new option
* doc/coreutils.texi (sort invocation): ditto
* src/sort.c (main): handle the new --human-numeric-sort option (-h).
(human_numcompare): A new function to compare SI and IEC suffixes
before falling back to the standard --numeric comparison.
(find_unit_order): A new helper function to find the order
of magnitude of a number string as determined by its suffix.
(check_mixed_SI_IEC): A new helper function to exit with error
if both SI and IEC suffixes are presented.
* tests/misc/sort: Add 8 tests to test the new functionality.
* THANKS: Update
2009-05-26 14:49:17 +01:00
Giuseppe Scrivano
c45c51fe97 chroot: accept new options --userspec=U:G and --groups=G1,G2,G3
* NEWS: Note chroot's new options.
* doc/coreutils.texi: Document them.
* src/chroot.c (main): Add support for --userspec and --groups.
* tests/Makefile.am (root-tests): Add chroot/credentials.
* tests/chroot/credentials: New file.
* tests/test-lib.sh: Define NON_ROOT_GROUP to a default value.
2009-05-26 15:10:22 +02:00
Eric Blake
60e7332dc0 truncate: fix bug in use of isspace
* src/truncate.c (main): Pass unsigned characters to isspace.
* NEWS: Mention this.
2009-05-11 05:52:50 -06:00
Jim Meyering
034cbb3923 post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2009-05-07 15:52:50 +02:00
Jim Meyering
4e54ea0480 version 7.4
* NEWS (Build-related): Mention make check fixes.
2009-05-07 15:35:19 +02:00
Jim Meyering
5aa7858385 admin: update NEWS
* NEWS (Bug fixes): Mention the date-related fixes.
(Portability): Mention the ACL-related fixes on *BSD.
2009-05-07 15:20:56 +02:00
Jim Meyering
40d50b821f post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2009-05-01 18:19:19 +02:00
Jim Meyering
0ae4336f4f version 7.3
* NEWS: Record release date.
2009-05-01 18:03:50 +02:00
Pádraig Brady
0a28715b10 misc: correct NEWS entry about id -G portability
* NEWS (Portability): getgrouplist has the portability issues,
not getgroups.
2009-04-28 15:52:29 +01:00
Jim Meyering
c4dfd3138e misc: mention the df vs. automount change
* NEWS (Portability): Mention that df now accommodates the new
behavior of some automounters.
2009-04-28 14:32:26 +02:00
Jim Meyering
d76a1c2a2d misc: alphabetize NEWS entries 2009-04-28 14:32:26 +02:00
Ondřej Vašík
1fa226772c cp -a: diagnose failure when preserving xattr/context required
* src/copy.c (copy_attr_by_fs): Always print diagnostics when preserving
xattrs is required.
(copy_attr_by_name): Likewise.
(copy_reg): Always print diagnostics when preserving SELinux
context is required.
(copy_internal): Likewise.  Also, do not ignore ENOTSUP and ENODATA
errors when preserving SELinux context is required.
* NEWS (Bug fixes): Mention it.
2009-04-27 13:33:42 +02:00
Ondřej Vašík
941bd48235 mv: ignore xattr-preservation failure when not supported by filesystem
*src/copy.c: Do not warn about xattr-preservation failure when xattrs
are not supported and preservation of xattrs is not explicitly required.
Reported by Eric Sandeen in http://bugzilla.redhat.com/496142
2009-04-27 13:26:03 +02:00
Jim Meyering
25eb4c6909 sort -m: don't segfault when output file is also an input file
* src/sort.c (avoid_trashing_input): Fix an off-by-one error and
guard the use of memmove.
* NEWS (Bug fixes): Mention it.
* tests/misc/sort: Add tests to exercise the offending code.
* THANKS: Update.
Reported by Otavio Salvador in http://bugs.debian.org/525048.
2009-04-23 21:03:14 +02:00
Jim Meyering
c74fbaefeb cp: work around linux kernel bug: short-read != EOF on /proc
Remove the optimization that avoided up to 50% of cp's read syscalls.
Do not assume that a short read on a regular file indicates EOF.
When reading from a file in /proc on linux [at least 2.6.9 - 2.6.29]
into a 4k-byte buffer or larger, a short read does not
always indicate EOF.  For example, "cp /proc/slabinfo /tmp"
copies only 4068 of the total 7493 bytes.  This optimization
(25719a3315, Improve performance a bit
by optimizing away; 2005-11-24) appears to have been worth less than
a 2% speed-up (and usually much less), so the impact of removing it
is negligible.

* src/copy.c (copy_reg): Don't exit the loop early.
* tests/cp/proc-short-read: New test, lightly based on a suggestion
from Mike Frysinger, to exercise this fix.
* tests/Makefile.am (TESTS): Add cp/proc-short-read.
* NEWS (Improve robustness): Mention this change.
2009-04-22 21:52:11 +02:00
Jim Meyering
03490e3565 gnulib: update to latest: fix ls -v & sort -V
* NEWS (Bug fixes): Mention it.
2009-04-10 10:15:24 +02:00
Pádraig Brady
bf87a2c8ea id: fix infinite loop on some systems
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-09 14:07:29 +01:00
Pádraig Brady
af5723c71e shred,sort,shuf: don't use /dev/urandom by default
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-07 19:01:46 +01:00
Jim Meyering
e1e5963a9d doc: adjust 7.2 "cat,cp,install,mv,split speed-up" NEWS item
* NEWS: Reword an entry from 7.2 and change "linux" to "GNU/Linux".
The latter was requested by Richard Stallman.
* cfg.mk (old_NEWS_hash): Regenerate.
2009-04-03 21:53:50 +02:00
Pádraig Brady
612b647dd1 ls: fix alignment when month names have varying widths
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-04-03 00:34:11 +01:00
Jim Meyering
278ae924be post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2009-03-31 14:48:50 +02:00
Jim Meyering
3dcf7a4d23 version 7.2
* NEWS: Record release date.
2009-03-31 14:11:57 +02:00
Eric Blake
9b4aa5e268 pwd: support -L and -P
* 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-25 06:33:32 -06:00
Kamil Dudka
2827bb5704 ls: make it possible to disable coloring of hard links
* 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-24 16:11:00 +00:00
Ondřej Vašík
c160afe902 cp: make -a option preserve xattrs, but with reduced diagnostics
* 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-11 17:32:44 +01:00
Pádraig Brady
1644e58905 cat: Fix immediate output of processed data
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-11 14:27:39 +00:00
Pádraig Brady
55efc5f3ee cat,cp,mv,install,split: Set the minimum IO block size used to 32KiB
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-11 14:19:08 +00:00
Jim Meyering
93f6771e82 tests: add a test for newly-fixed bug in comm --check-order
* tests/misc/comm (ooo-prefix): Add a test for today's fix.
* NEWS (Bug fixes): Mention it.
2009-03-08 21:34:08 +01:00
Jim Meyering
df2e983677 tests: ls -v: exercise the bug fixed by gnulib's new filevercmp
* tests/misc/ls-misc (version-sort): New test.
(mk_file): New function.
Reported by Josh Triplett in <http://bugs.debian.org/517558>.
Details in http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/16902
* NEWS (Bug fixes): Mention it.
2009-03-08 21:18:47 +01:00
Jim Meyering
a4053c5291 pr: fix a bug whereby --indent=N (-o) did not indent header lines
* 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-07 23:52:08 +01:00
Jim Meyering
b50a4ae557 cp: diagnose invalid "cp -rl dir dir" right away, once again
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-27 11:44:26 +01:00
Pádraig Brady
224a69b56b sort: Fix two bugs with determining the end of field
* 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-26 14:40:28 +00:00
Jim Meyering
359c48d5c6 post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2009-02-21 22:49:24 +01:00
Jim Meyering
74ba433a14 version 7.1
* NEWS: Record release date.
2009-02-21 22:35:33 +01:00
Ondřej Vašík
8c243ff965 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.
2009-02-18 15:27:10 +01:00
Eric Blake
86cef85b36 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.
2009-02-18 06:07:30 -07:00
Kamil Dudka
dac5f12c6e 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.
2009-02-17 14:12:44 +01:00
Pádraig Brady
5d0b158f4c 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.
2009-02-14 23:47:14 +00:00
Kamil Dudka
0889381cbf 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.
2009-01-29 13:26:07 +01:00
Pádraig Brady
460ebb078e 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.
2009-01-28 15:14:57 +00:00
Pádraig Brady
10f3e12a0d 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.
2009-01-22 23:42:51 +00:00
Kamil Dudka
d01338eb3d 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.
2009-01-14 09:09:22 +01:00
Matt Harden
5c065bb0cb 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.
2008-12-26 10:57:05 +01:00
Jim Meyering
9965d234e5 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.
2008-12-16 08:04:01 +01:00
Jim Meyering
9b8023e69c tests: ensure that chmod, chgrp and chown honor --silent
* tests/chmod/silent: New file, to test all three programs.
* tests/Makefile.am (TESTS): Add chmod/silent.
* NEWS (Bug fixes): Mention this.
The bug was introduced in 96a5d2ce6a.
2008-12-03 11:02:57 +01:00
Jim Meyering
c2e56e0de7 wc: read and process --files0-from= input a name at a time,
when the file name list is not too large.  Before, wc would always read
the entire file name list into memory and *then* process each file name.
wc does read the list into memory when the list is known not to be too
large; this is done in order to be able to align the output numbers,
as it does with arguments specified on the command-line
* src/wc.c: Include "argv-iter.h".
(main): Rewrite to use argv-iter when the input file name list
is known to be too large.
* NEWS (Bug fixes): Mention it.
2008-12-02 13:12:22 +01:00
Jim Meyering
031e2fb5e9 du: read and process --files0-from= input a name at a time,
rather than by reading the entire input into memory and *then*
processing each file name.
* src/du.c: Include "argv-iter.h", not "readtokens0.h".
(main): Rewrite to use argv-iter.
Call xfts_open on each argument, rather than on the entire
argv list at once.
Call print_size here, not from du_files.
Diagnose read failure.
* NEWS (Bug fixes): Mention it.
* THANKS: update.
Reported by Barry Kelly.  More details in
http://article.gmane.org/gmane.comp.gnu.core-utils.bugs/15159/
2008-12-02 13:12:13 +01:00
Jim Meyering
7ef56a26fd cp, mv: remove 3-year-deprecated+warned-about --reply option
* src/cp.c (reply_args, reply_vals): Remove globals.
[REPLY_OPTION]: Remove enum.
(long_opts) ["reply"]: Remove initializer.
(main): Remove case stmt.
* src/mv.c: Likewise.
Don't include "argmatch.h".  No longer used.
* NEWS (Changes in behavior): Mention this.
* tests/Makefile.am (TESTS): Remove mv/reply-no.
* tests/mv/reply-no: Remove file.
* tests/mv/i-link-no: Update, now that --reply= is gone.
2008-12-01 17:03:37 +01:00
Jim Meyering
3ece0355d5 cp: use far less memory in some cases
cp --link was "remembering" many name,dev,inode triples unnecessarily.
cp was doing the same, even without --link, for every directory in the
source hierarchy, while it can do its job with entries merely for the
command-line arguments.  Prompted by a report from Patrick Shoenfeld.
Details <http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/15081>.
* src/copy.c (copy_internal): Refrain from remembering
name,dev,inode for most files, when invoked via cp --link.
Record an infloop-avoidance triple for each directory specified
on the command line, not for each directory in the source tree.
Don't record a dir-triple when x->hard_link is set.
* NEWS (Buf fixes): Mention it.
* tests/cp/link-heap: New file.  Test for cp's lowered memory usage.
* tests/Makefile.am (TESTS): Add link-heap.
2008-11-20 10:21:52 +01:00
Kamil Dudka
1e48b1fee5 ls: --color now highlights hard linked files, too
* src/ls.c (print_color_indicator): Colorize hard linked files.
* src/dircolors.c: Add color for hard link.
* src/dircolors.hin: Add color for hard link.
* tests/ls/hardlink: Test for ls - colorize hard linked files.
* tests/Makefile.am (TESTS): Add ls/hardlink.
* NEWS: Mention the change.
2008-10-28 21:08:30 +01:00
Jim Meyering
b4ec994b26 tests: seq: check for today's extended long double fix
* tests/misc/seq-long-double: New file.  Test for today's bug fix.
* tests/check.mk (TESTS_ENVIRONMENT): Export CC definition.
* tests/Makefile.am (TESTS): Add misc/seq-long-double.
* NEWS (Bug fixes): Mention it.
2008-10-26 10:45:34 +01:00
Jim Meyering
b3677e5e38 ls: use '.' (not +) as SELinux-only alt. access flag in ls -l output
* src/ls.c (gobble_file) [long_format]: Map SELinux-only to '.',
any other nonempty combination of MAC and ACL to '+', and all else
to the usual ' '.  Suggested by Michael Stone.
* tests/misc/selinux: Adapt: expect '.', not '+'.
* doc/coreutils.texi (What information is listed): Document this.
* NEWS (Changes in behavior): Mention it.
2008-10-23 14:18:25 +02:00
Andreas Dilger
a36f4cb451 stat: add lustre filesystem type
* src/stat.c (human_fstype) [S_MAGIC_LUSTRE]: Add case.
Make "stat -f" recognize the "Lustre" filesystem type.
<http://en.wikipedia.org/wiki/Lustre_(file_system)>
* NEWS: Mention this feature.
2008-10-06 22:35:57 +02:00
Jim Meyering
f9da2d0e87 post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2008-10-05 21:27:05 +02:00
Jim Meyering
42285406aa version 7.0
* NEWS: Record release date.
2008-10-05 20:40:19 +02:00
Kamil Dudka
e505736f82 ls and sort: use filevercmp instead of strverscmp
* src/ls.c (cmp_version): Use filevercmp instead of strverscmp.
* src/sort.c (usage): Remove mna reference to strverscmp(3).
(compare_version): Use filevercmp instead of strverscmp.
* bootstrap.conf: Add filevercmp to list of gnulib modules.
* tests/misc/sort-version: Remove conflicting string and enhance test.
* NEWS: Mention the change.
2008-10-03 11:59:17 +02:00
Jim Meyering
24412edeaf rm -r: avoid O(n^2) performance for a directory with very many entries
This enhancement works around a problem that is specific to at least
ext3 and ext4 file systems.  With them, it would take hours to remove
a two-million-entry directory.  RAM-backed file systems (tmpfs) are
not affected, since there is no seek penalty.
* remove.c (rm_malloc, rm_free, compare_ino): New functions.
(dirent_count, preprocess_dir): New function.
[struct readdir_data]: New struct.
(remove_cwd_entries): Call preprocess_dir.
* tests/rm/ext3-perf: New file.  Test for the performance fix.
* NEWS: mention the new feature
2008-09-27 00:10:08 +02:00
Jim Meyering
e13188e7ef seq -0.1 0.1 2: print final number when locale's decimal point is ","
* src/seq.c (print_numbers): Use strtold, not c_strtold to convert
from just-formatted-using-asprintf string back to double, since
asprintf may have used something other than "." as the decimal point.
Reported by lsof@nodata.co.uk as <http://bugzilla.redhat.com/463556>.
Thanks to Ondřej Vašík for discovering that the bug was locale-related.

    $ LC_ALL=cs_CZ.UTF-8 seq -0.1 0.1 2|grep 2.0
    [Exit 1]
    $ seq -0.1 0.1 2|grep 2.0
    2.0

* tests/check.mk (TESTS_ENVIRONMENT): Add LOCALE_FR_UTF8, for...
* tests/misc/seq [locale-dec-pt]: New test for the above.
* NEWS (bug fix): Mention it.
2008-09-26 23:31:30 +02:00
Kamil Dudka
54281e9c60 install: new option: --strip-program,
...to specify the program used to strip binaries
* src/install.c (main): Handle new option --strip-program.
(strip): Use strip program from global variable strip_program.
(usage): Mention new option --strip-program in --help.
* tests/tests/strip-program: Test case for new option --strip-program.
* tests/Makefile.am: Add new test case to test set.
* doc/coreutils.texi: Mention new option --strip-program.
* NEWS: Mention the change.
* TODO: Remove completed task.
2008-09-06 13:38:20 +02:00
Kamil Dudka
ea2887bbe4 df: new option: --total to print grand totals
* src/df.c (add_uint_with_neg_flag): New function to add two integral
values with separate negation flag.
(show_dev): New parameter force_fsu to display numbers directly. Collect
summary statistics on each printed device.
(usage): Mention new option --total in --help.
(main): Initialize summary on program start. Handle new option --total.
* tests/df/total: Dummy test case for new --total option.
* tests/df/total-awk: Better test case for new --total option (requires
awk).
* doc/coreutils.texi: Mention new parameter --total.
* NEWS: Mention the change.
* TODO: Removed completed task.
2008-09-03 15:39:28 +02:00
Jim Meyering
929479026b adjust 2008-08-15 10:18:51 +02:00
Bruce Korb
4c9fae4e97 sort: new option, --sort=version, for version number ordering
* src/sort.c [struct keyfield] (version): New member.
(usage): Describe --version-sort.
(sort_options): Add 'V'.
(long_options): Add "version-sort".
(CHECK_TABLE, _ct_, SORT_TABLE, _st_): Define new macros.
(check_args, sort_args, sort_types): Use these new macros in declarations.
(ARGMATCH_VERIFY): Remove use.  No longer needed.
(compare_version): New function.
(key_compare): Add a case.
(check_ordering_compatibility): Handle new type.
(main): Likewise.  Reformat two expressions for readability.
* tests/misc/sort-version: new test file
* tests/Makefile.am: add it to the list
* doc/coreutils.texi (sort invocation): Document it.
* NEWS: Mention the new feature.
2008-08-15 09:52:06 +02:00
James Youngman
f65cafd67b expr: support arbitrary-precision arithmetic
* src/Makefile.am (expr_LDADD): Link expr against GNU MP.
* doc/coreutils.texi (expr invocation): Describe --bignum,
--no-bignum.   Explain the new arbitrary-precision functionality.
* NEWS: Indicate that arbitrary-precision arithmetic is now
supported in expr.
* src/expr.c (enum valtype): Added mp_integer, signifying a GNU MP
number.
(usage): Document the new options --bignum and --no-bignum which
force and prohibit the use of arbitrary-precision arithmetic,
respectively.
(long_options): data structure for getopt_long, which we need to
use to parse the options mentioned above.
(main): parse these options with getopt_long instead of
parse_long_options.
(valinfo): Downgrade the numeric member of the union from
intmax_t to signed long, since MP lacks functions for promoting an
intmax_t to an arbitrary-precision quantity.
(enum arithmetic_mode): Represents the current choice between
--bignum, --no-bignum and the default (automatically switch from
one to the other if needed).
(integer_overflow): issue a more explicit error message indicating
that MP is not available.
(string_too_long): new function, emits a fatal error message for
the case where an argument to the 'index' expression is too long
for a string offset to be represented.
(int_value): With --bignum, create the value as mp_integer rather
than plain integer.
(substr_value): factored out of eval6; implements "substr".
(freev): also destroy mp_integer values.  Check that no mp_integer
values exist if --no-bignum was specified.
(printv, null, tostring): support mp_integer.
(toint): new funtion for converting from string or mp_integer to
integer.
(getsize): extracts a size_t value from a VALUE object; used to
implement substr.
(promote): promotes a value from integer to mp_integer.
(domult, dodivide): functions for multiplication and division,
factored out of eval4.
(doadd): addition/subraction function, factpred out of eval3.
(eval3): support mp_integer types; call doadd.
(eval4): support mp_integer types; call domult, dodivide.
(eval6): support mp_integer offsets and lengths for "substr" and
"index".
* TODO: Mention that expr supports arbitrary-precision arithmetic,
and suggest that this might also be a good idea for seq.
* AUTHORS (expr): Add James Youngman.
2008-08-06 08:47:55 +02:00
James Youngman
d9207b48a3 doc: mv,cp: undocument the --reply option
* doc/coreutils.texi (mv invocation): Remove documentation for mv --reply.
(cp invocation): Likewise.
* NEWS: mention this.
2008-08-06 08:36:46 +02:00
Kamil Dudka
84f6abfe00 ls: --color now highlights files with capabilities, too
* src/ls.c: [HAVE_CAP] Include <sys/capability.h>.
(has_capability): New function for capability detection.
(print_color_indicator): Colorize file with capability.
* m4/jm-macro.m4: New configure option: --disable-libcap.
Check for libcap usability.
* src/Makefile.am (dir_LDADD, ls_LDADD, ...): Append $(LIB_CAP).
* src/dircolors.c: Update color lists.
* src/dircolors.hin: Mention new CAPABILITY color attribute.
* tests/ls/capability: Test for ls - colorize file with capability.
* tests/Makefile.am (root_tests): Add ls/capability.
* NEWS: Mention the change.
2008-08-01 22:13:25 +02:00
James Youngman
00c6aacf31 factor arbitrarily large numbers
* m4/gmp.m4: New file; adds cu_GMP, which detects GNU MP.
* configure.ac: Use cu_GMP.
* src/Makefile.am: Link factor against libgmp if available.
* src/factor.c: Use GNU MP if it is available.
(emit_factor, emit_ul_factor, factor_using_division,
factor_using_pollard_rho, extract_factors_multi,
sort_and_print_factors, free_factors): new functions
for the arbitrary-precision implementation, taken from an example
in GNU MP.
(factor_wheel): Renamed; was called factor.
(print_factors_single): Renamed; was called print_factors.
(print_factors): New function, chooses between the single- and
arbitrary-precision algorithms according to availability of GNU MP
and the length of the number to be factored.
(usage, main): New options --bignum and --no-bignum.
* coreutils.texi (factor invocation): Document new command-line
options for the MP implementation and update the performance
numbers to take into account the asymptotically faster algorithm.
* TODO: Remove item about factoring large primes (it's done).
* m4/gmp.m4: Add support for --without-gmp.
* NEWS: Mention the new feature.
2008-08-01 11:15:05 +02:00
Kamil Dudka
8d974b00fb ls -U1 now uses constant memory
When printing one name per line and not sorting, ls now uses
constant memory per directory, no matter how many files are in
the directory.
* ls.c (print_dir): Print each file name immediately, when possible.
* NEWS: Mention the improvement.
2008-08-01 08:36:38 +02:00
Jim Meyering
0d75784da0 * NEWS: Move shuf --zero-terminated item into bug-fixes section. 2008-07-27 22:21:14 +02:00
Mikael Magnusson
cbdcc9fb4e shuf: correctly document --head-count
* src/shuf.c (usage): Correct --help output.
* doc/coreutils.texi: Correct option listing.
* NEWS: Mention correction.
2008-07-27 22:18:06 +02:00
Jim Meyering
bee58d8a04 shuf: honor --zero-terminated option even with --input-range=LO-HI
* src/shuf.c (write_permuted_output): Add EOLBYTE parameter and use
it rather than hard-coding "\n".
(main): Adjust sole caller.
* tests/misc/shuf: Add a test to exercise this bug fix.
* NEWS: Mention it.
2008-07-27 15:25:27 +02:00
Jim Meyering
e535754fdb dd: minor fullblock changes
* src/dd.c (O_FULLBLOCK): Define using an enum, not #define.
Derive the value, rather than hard-coding to one that might conflict.
(usage): Mention iflag=fullblock in --help output.
(scanargs): Reset the O_FULLBLOCK bit, so that we don't try to set
an undefined attribute via fcntl (fd, F_SETFL, ...
* tests/dd/misc: Signal framework_failure when necessary.
Use "compare actual expected", so any diffs look "right".
* NEWS (dd): Alphabetize and reword.
* coreutils.texi (dd invocation): Adjust wording.
2008-07-23 15:55:45 +02:00
Kamil Dudka
f674a10f7e dd: new option: iflag=fullblock to accumulate full input blocks
* src/dd.c (iread_fullblock): New function for reading full blocks.
(scanargs): Check for new parameter iflag=fullblock.
(skip): Use iread_fnc pointer instead of iread function.
(dd_copy): Use iread_fnc pointer instead of iread function.
* tests/dd/misc: Add test for dd - read full blocks.
* doc/coretuils.texi: Mention new parameter iflag=fullblock.
* NEWS: Mentioned the change.
2008-07-23 15:55:45 +02:00
Jim Meyering
574f761403 stat: warn that the --context (-Z) option (a no-op) is obsolete
* src/stat.c (main): It will be removed in a couple years.
* NEWS (Change in behavior): Mention this.
2008-06-22 12:27:49 +02:00
Bo Borgerson
20905b0cdc sort: accept new option --batch-size=NMERGE
* src/sort.c: (static unsigned int nmerge) Replace constant NMERGE.
(specify_nmerge) Validate and apply new option.
(mergefps) Replace some arrays with pointers to xnmalloc'd storage.
* tests/misc/sort-merge: Test new option.
* doc/coreutils.texi: Describe new option.
* NEWS: Advertise new option.
2008-06-17 22:36:51 +02:00
Bo Borgerson
322c6f2e5c sort: add new option --files0-from=F
* src/sort.c: Support new option.
* tests/misc/sort-files0-from: Test new option.
* tests/misc/Makefile.am: Indicate new test.
* docs/coreutils.texi: Explain new option.
* NEWS: Advertise new option.

Signed-off-by: Bo Borgerson <gigabo@gmail.com>
2008-06-17 08:50:41 +02:00
Bo Borgerson
94cecb5cf6 join: improve memory management
* src/join.c (struct seq): Use a (struct line **) for `lines' rather than
one long (struct line *).  This allows individual lines to be swapped out
if necessary.
(reset_line): Get a line ready for new input.
(init_linep): Create a new line and assign it to the the pointer passed in.
(spareline[2]): Hold a spare line for each input file.
(free_spareline): Clean up.
(get_line): Take a (struct line **) instead of a (struct line *).  If the
line to be overwritten is the previous line for the current file then swap
it out for the spare.
(join): Accomodate new structure of SEQs and new parameters to get_line;
Don't free stale lines until the end -- they're re-usable now.
(dup_line): Remove function.
* NEWS: Mention the performance improvement.
2008-06-17 00:52:30 +02:00
Jim Meyering
3de1559830 chcon: correct --verbose output to include newlines
* src/chcon.c (process_file): Append "\n" to --verbose diagnostic.
* tests/misc/chcon: Add a test for the above.
* NEWS: mention the bug fix
Reported by Carl D. Roth in http://bugzilla.redhat.com/451478.
2008-06-16 13:42:01 +02:00
Eric Blake
46a811b9e7 od: align multiple -t specs
* src/od.c (struct tspec): Add pad_width field, and adjust
print_function prototype.
(decode_one_format): Rewrite all fmt_string values to account for
pad width.
(FMT_BYTES_ALLOCATED): Adjust to new format style.
(main): Compute pad width per spec.
(write_block): Account for pad width.
(dump): Don't print padding-only fields.
(PRINT_TYPE, print_named_ascii, print_ascii): All print functions
adjusted to use variable pad width.
* tests/Makefile.am (TESTS): Add test.
* tests/misc/od-multiple-t: New file.
* THANKS: Update.
* NEWS: Mention the improvement.
Reported by Gary Johnson.
2008-06-13 23:06:03 +02:00
Eric Blake
bbbc35c9ed od: use gnulib printf replacement as necessary
* src/od.c (includes): Add xprintf.h.
(PRINT_TYPE): New macro, using xprintf instead of printf.
(print_s_char, print_char, print_s_short, print_short, print_int)
(print_long, print_long_long, print_float, print_double)
(print_long_double): Factor into PRINT_TYPE macro.
(print_named_ascii, print_ascii): Use xprintf.
* NEWS: Mention this as a bug fix.
2008-06-13 23:00:04 +02:00
Bo Borgerson
81d0c8f367 comm: accept new option: --output-delimiter=STR
* src/comm.c (delimiter): New global.
(writeline): Use delimiter string instead of single TAB character.
(main): Initialize delimiter.
* tests/misc/comm: Add tests for comm output delimiter specification.
* doc/coreutils.texi: Document new option.
* NEWS: Advertise new option.
* TODO: Remove associated item.
2008-06-12 21:03:05 +02:00
Bo Borgerson
98a96822d9 comm: ensure that input files are sorted
* NEWS: List new behavior.
* doc/coreutils.texi (checkOrderOption) New macro for
describing `--check-order' and `--nocheck-order', used in
both join and comm.
* src/comm.c (main): Initialize new options.
(usage): Describe new options.
(compare_files): Keep an extra pair of buffers for the previous
line from each file to check the internal order.
(check_order): If an order-check is required, compare and handle
the result appropriately.
(copylinebuffer): Copy a linebuffer; used for copy before read.
* tests/misc/Makefile.am: List new test.
* tests/misc/comm: Tests for the comm program, including the
new order-checking functionality and attendant command-line options.
2008-06-12 19:38:43 +02:00
Bruno Haible
23c2a0cbac * NEWS (Improvements): Mention improved (via gnulib) ACL support. 2008-06-09 09:11:04 +02:00
Pádraig Brady
75e0047c4b Add new program: truncate
* AUTHORS: Register as the author
* NEWS: Mention this change
* README: Add truncate command to list
* src/truncate.c: New command
* src/Makefile.am: Add truncate command to list to build
* src/.gitignore: Add truncate binary to list to ignore
* doc/coreutils.texi (truncate invocation): Add truncate info
* man/Makefile.am: Add truncate man page to list to build
* man/truncate.x: Add truncate man page template
* po/POTFILES.in: Add truncate to list to translate
* tests/Makefile.am: Add truncate tests
* tests/misc/help-version: Add support for new truncate command
* tests/misc/truncate-dangling-symlink: check dangling link ok
* tests/misc/truncate-dir-fail: ensure dirs fail
* tests/misc/truncate-fail-diag: validate messages for missing paths
* tests/misc/truncate-fifo: ensure fifos ignored
* tests/misc/truncate-no-create-missing: ensure -c option honoured
* tests/misc/truncate-overflow: check signed integer overflows
* tests/misc/truncate-owned-by-other: root permissions check
* tests/misc/truncate-parameters: check invalid parameter combinations
* tests/misc/truncate-relative: check invalid relative sizes
2008-06-06 14:16:45 +02:00
Pádraig Brady
265c4b83a8 new program: timeout
* AUTHORS: Register as the author.
* NEWS: Mention this change.
* README: Add timeout command to list.
* src/timeout.c: New file.
* src/kill.c (operand2sig): Move function to its own file,
now that timeout.c will also use it.
* src/operand2sig.c (operand2sig): New file, extracted from kill.c.
* src/operand2sig.h (operand2sig): Declare.
* src/Makefile.am (EXTRA_PROGRAMS): Add timeout.
* src/.gitignore: Add timeout binary to list to ignore.
* doc/coreutils.texi (timeout invocation): Add timeout info.
(Signal specifications): New section, also referenced by kill.
* man/Makefile.am (timeout.1): Add dependency.
* man/timeout.x: New file.
* po/POTFILES.in: Add timeout.c and operand2sig.c to list to translate.
* tests/Makefile.am (TESTS): Add the two new tests.
* tests/misc/help-version: Add support for new timeout command.
* tests/misc/invalid-opt: Add support for new timeout command.
* tests/misc/timeout: New file: check basic timeout operation.
* tests/misc/timeout-parameters: New file: check invalid parameter
combinations.
2008-06-02 14:40:26 +02:00
Erik Auerswald
86535835fe md5sum: new option, --quiet, to suppress OK messages
sha1sum, sha224sum, sha384sum, and sha512sum accept it, too.
* src/md5sum.c: add option --quiet to suppress OK messages
* doc/coreutils.texi: document option --quiet
* tests/misc/md5sum: add test for option --quiet
* NEWS: mention new option --quiet for md5sum+sha*sum in "New
  features" section
2008-06-01 16:55:11 +02:00
Jim Meyering
dd3612a12b * NEWS: add header line for next release 2008-06-01 11:00:51 +02:00
Jim Meyering
d81d2e0ba6 Version 6.12.
* NEWS: Record release date.
2008-05-31 23:20:56 +02:00
Jim Meyering
eba365275b install: reenable matchpathcon-related code
The underlying performance problem is being dealt with in Automake
by limiting the number of install invocations, and in SELinux with
incremental changes as well as a potential new implementation.
* src/Makefile.am (ginstall_CPPFLAGS) [ENABLE_MATCHPATHCON]: Define.
* src/install.c [ENABLE_WHEN_MATCHPATHCON_IS_MORE_EFFICIENT]:
Rename to ENABLE_MATCHPATHCON.
* NEWS: mention this change
2008-05-31 22:42:20 +02:00
Jim Meyering
6c9b505329 NEWS: mention that cp -p copies permissions more portably
Based on wording suggested by Bruno Haible.
2008-05-30 09:08:51 +02:00
Jim Meyering
209850fd7e avoid problems with sign-extended "char" operand to is* functions
* src/cut.c (set_fields): Apply to_uchar to isblank operands.
* src/uniq.c (find_field): Likewise.
* src/seq.c (scan_arg): Likewise, for isspace.
* tests/misc/uniq: New file.  Test for the above, but only
when isspace(0240).
* tests/Makefile.am (TESTS): Add misc/uniq.
* configure.ac: Use gt_LOCALE_FR.
* tests/check.mk (TESTS_ENVIRONMENT): Propagate LOCALE_FR to scripts.
* NEWS: Mention the bug fixes.

Before this patch, on FreeBSD 6:

  $ printf 'x y z\nx \xa0 y z\n' > in
  $ LC_ALL=fr_FR.UTF-8 uniq -f2 in|tr ' ' .
  x.y.z
  x. .y.z

With the patch:

  $ LC_ALL=fr_FR.UTF-8 uniq -f2 in|tr ' ' .
  x.y.z

This also affected many other locales:
for i in $(locale -a); do test $(LC_ALL=$i ./uniq -f1 in|wc -l)
  = $(LC_ALL=$i uniq -f1 in|wc -l) || echo $i ; done
...
en_GB.ISO8859-1
en_GB.ISO8859-15
en_GB.UTF-8
en_IE.UTF-8
en_NZ.ISO8859-1
en_NZ.ISO8859-15
en_NZ.UTF-8
en_US.ISO8859-1
en_US.ISO8859-15
en_US.UTF-8
...
2008-05-06 08:21:28 +02:00
Jim Meyering
d701f6abb7 tac: avoid segfault for e.g., "echo > x; tac -r x x"
* src/tac.c (tac_seekable): Move local "regs" declaration out
to file scope, so its values aren't clobbered between calls.
Discovered by Cristian Cadar, Daniel Dunbar and Dawson Engler,
reported in http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/13501
* NEWS: Mention the bug fix.
* tests/Makefile.am (TESTS): Add misc/tac.
* tests/misc/tac: New file.  Test for the above.
2008-05-05 13:15:32 +02:00
Jim Meyering
bbc0cb0f37 chcon, runcon: make --help print the bug-reporting address
* src/chcon.c (usage): Use emit_bug_reporting_address.
* src/runcon.c (usage): Likewise.
* tests/misc/help-version: Don't exempt chcon and runcon.
* NEWS: Mention this.
2008-04-29 14:55:38 +02:00
Ondřej Vašík
1a5b6e3a50 id: do not print SELinux context when invoked with a USERNAME argument
* NEWS: Mention new behaviour.
* src/id.c (main): Do not print SELinux context when user is specified.
* tests/Makefile.am: Add the new test.
* tests/misc/id-context: New file.  Test for the fix.
Problem reported by Ronny Buchmann in http://bugzilla.redhat.com/443485.
2008-04-23 17:51:44 +02:00
Jim Meyering
0a4a938b6b id: do print the AFS-specific nameless group ID (called a PAG)
In 6.11, we mistakenly suppressed the printing of certain group IDs,
thinking they were useless AFS-specific artifacts.
This change reverts that, so now they are printed once again.
http://thread.gmane.org/gmane.org.fsf.announce/867/focus=13345
This also reverts the bug-fix that applied solely to the new code
used to avoid printing those IDs

Revert "id bug fix: don't point to potentially clobbered static storage"
This reverts commit f7d1c59c22.
Revert "Work around AFS bug: id and groups would print invalid group number."
This reverts commit b7a836c0a3.
Revert "* src/c99-to-c89.diff: Accommodate a C99-ism in id.c."
This reverts commit d44893c5db.
2008-04-23 15:29:11 +02:00
Jim Meyering
e347e9d722 Version 6.11.
* NEWS: Record release date.

Signed-off-by: Jim Meyering <meyering@redhat.com>
2008-04-19 23:26:54 +02:00
Jim Meyering
6856089f7b pr -e, with a mix of backspaces and TABs, could corrupt the heap
* tests/pr/Test.pm: New tests for the above.
* src/pr.c (char_to_clump): Ensure that "input_position" never
goes below 0.
Also, elide any backspace encountered when input_position is 0,
to be compatible at least with /bin/pr from Solaris 10.
This bug is present in the original version:
b25038ce9a
* NEWS [Bug fixes]: Mention this.
Report and diagnosis by Cristian Cadar, Daniel Dunbar and Dawson Engler
in http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/13272
2008-04-19 13:34:38 +02:00
Jim Meyering
a85752ff4b md5sum -c: ignore a line with a NUL byte among checksum hex digits
* src/md5sum.c (hex_digits): Require that all "digest_hex_bytes"
be hexadecimal digits, not just those before the first NUL byte.
This bug dates back to the original version:
3763a4f24e
* tests/misc/md5sum (nul-in-cksum): Test for the above.
* NEWS [Bug fixes]: Mention this.
Prompted by a report from Flóki Pálsson in
http://bugzilla.redhat.com/439531
2008-04-19 00:24:55 +02:00
Jim Meyering
7cb24684cc md5sum, sha1sum, etc: handle invalid input (i.e., don't segfault)
* src/md5sum.c (bsd_split_3): Return right away if s_len == 0.
* tests/misc/md5sum (bsd-segv): New test for the above.
* tests/misc/sha1sum (bsd-segv): Likewise.
* NEWS: Mention the bug fix.
Reported by Cristian Cadar, Daniel Dunbar and Dawson Engler.
2008-04-15 08:46:48 +02:00
Jim Meyering
c1b6f9458a "touch E; mkfifo F; cp -fR F E" no longer fails due to existing E
* src/copy.c (copy_internal): Revert change of 2005-03-01,
4303f04545
Prompted by Michael Stone, who pointed me to an old bug report from
Ian Jackson: http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/7504
* tests/cp/special-f: New file.  Test for the above.
* tests/cp/Makefile.am (TESTS): Add special-f.
* NEWS: mention this bug fix.
2008-04-02 18:23:04 +02:00
Jim Meyering
f433c3835f "rm -r DIR" would mistakenly prompt about very long names
* src/remove.c (write_protected_non_symlink): Return 0(-1) when
euidaccess_stat pronounces a writable(not-writable) file, not -1(0).
* tests/rm/deep-2: New file.  Test for the above-fixed bug.
* tests/rm/Makefile.am (TESTS): Add deep-2.
Discovered while reviewing this change:
http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/13071
2008-03-31 13:46:34 +02:00
Jim Meyering
0d34887fe9 * NEWS: Note the dd bug fix. The bug was introduced over 8 years ago:
9fca49f67c
2008-03-31 09:11:15 +02:00
Jim Meyering
eb8fa94f2c mknod, mkfifo: don't segfault when diagnosing invalid SELinux context
Identical to the bug fixed by 72d052896a.
* src/mkfifo.c (main): Use "scontext", not NULL optarg in diagnostic.
* src/mknod.c (main): Likewise.
Reported by Cristian Cadar, Daniel Dunbar and Dawson Engler.
* tests/mkdir/selinux: Test for the above fixes.
* NEWS: Mention the fixes.
2008-03-28 23:03:27 +01:00
Jim Meyering
cdb16829a6 Fix typo in old NEWS and ChangeLog: s/commmand/command/.
* ChangeLog-2007: Likewise.
* NEWS: Likewise.
Prompted by http://bugzilla.redhat.com/439410
2008-03-28 20:20:49 +01:00
Jim Meyering
b58a8b4ef5 paste -d\\: avoid heap overrun for backslash at end of delim list
* src/paste.c: Include "quotearg.h".
(collapse_escapes): Handle backslash-escaped backslash explicitly.
Handle unescaped backslash at end of string by returning nonzero,
rather than by overrunning memory.
(main): Diagnose an invalid delimiter list -- carefully.
Reported by Cristian Cadar, Daniel Dunbar and Dawson Engler.
* tests/misc/paste-no-nl (delim-bs): Add a test to demonstrate the
heap-smashing capability.
(delim-bs2): Prior to coreutils-5.1.2, this bug was a little harder
to demonstrate: it would corrupt a first-argument containing e.g., \b
* NEWS: Mention the bug fix.
* tests/misc/Makefile.am (TESTS): Reflect renaming.
* tests/misc/paste: Rename from paste-no-nl.

Signed-off-by: Jim Meyering <meyering@redhat.com>
2008-03-27 13:32:38 +01:00
Daniel Dunbar
72d052896a mkdir -Z x d: don't segfault when diagnosing invalid context "x" (tiny change)
* src/mkdir.c (main): Use "scontext", not NULL optarg in diagnostic.
Reported by Cristian Cadar, Daniel Dunbar and Dawson Engler.
* NEWS: Mention the bug fix.
2008-03-26 00:57:29 +01:00
Jim Meyering
a0851554bd ptx: avoid heap overrun for backslash at end of optarg string
* src/ptx.c (copy_unescaped_string): Ignore a lone backslash
at end of string.  Reported by Cristian Cadar, Daniel Dunbar
and Dawson Engler.  Details here:
<http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/13005>.
* tests/misc/Makefile.am (TESTS): Add ptx-overrun.
* tests/misc/ptx-overrun: New file.  Test for the above fix.
* NEWS: Mention the fix.

Signed-off-by: Jim Meyering <meyering@redhat.com>
2008-03-21 20:58:15 +01:00
Jim Meyering
6e5bbc267a Write NEWS and update c99-to-c89 patch for today's rm improvement.
* NEWS: call this a "portability improvement" ;-)
* src/c99-to-c89.diff: Adjust remove.c offsets.
2008-03-21 16:01:29 +01:00
Jim Meyering
63feb84a2d mv: never unlink a destination file before calling rename
While cp --preserve=links must unlink certain destination files,
mv must never do that.
* src/copy.c (copy_internal): Pull the '! x->move_mode' test "up",
so it affects the entire condition, and not just DEREF_NEVER mode.
Reported by James Ralston in <http://bugzilla.redhat.com/438076>.
* tests/mv/atomic2: New file.  Test for the above fix.
* tests/mv/Makefile.am (TESTS): Add atomic2.
* NEWS: Mention the bug-fix.
[Bug introduced in 367719ba5f]
2008-03-19 13:38:27 +01:00
Ondřej Vašík
9c393fa194 install, rmdir: write --verbose output to stdout, not to stderr.
* src/install.c (announce_mkdir): Write verbose output to stdout,
not to stderr.
* src/mkdir.c (announce mkdir): Use prog_fprintf for verbose output.
* src/prog-fprintf.c (prog_fprintf): New function and file.
* src/prog-fprintf.h: New file.
* src/rmdir.c (main): Write verbose output to stdout, not to stderr.
Quote directory name in a diagnostic.
* src/rmdir.c (remove_parents): Write verbose output to stdout,
not to stderr.
* doc/coreutils.texi: Mention that shred verbose output is to stderr.
* NEWS: Mention the changes.

Signed-off-by: Ondřej Vašík <ovasik@redhat.com>
2008-03-10 19:47:15 +01:00
ribalba
b7a836c0a3 Work around AFS bug: id and groups would print invalid group number.
* src/id.c (main): Call print_group_list with a user name, if possible.
* src/groups.c (main): Likewise.
* NEWS: Mention this.
For details, see
http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/12852
http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/12875

Signed-off-by: ribalba <geerd.dietger.hoffmann@gmail.com>
2008-03-05 11:38:26 +01:00
James Youngman
49f7ebaac4 id: use getgrouplist when possible
* 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-02-21 15:02:07 +01:00
Andreas Schwab
cb3147d298 sort: add --sort=... option.
* src/sort.c (SORT_OPTION): New enum.
(sort_args, sort_types): Define.
(usage, long_options, main): New option --sort.
* tests/sort/Test.pm: Test it.
* doc/coreutils.texi (sort invocation): Document --sort option.
* NEWS: Mention this.
2008-02-20 08:41:29 +01:00
Steven Schubiger
4f3ff2e700 seq: give better diagnostics for invalid formats.
* src/seq.c: (validate_format): New function.
(main): Use it.
* tests/misc/seq (fmt-d, fmt-e): Test for expected diagnostics with
invalid formats.
* NEWS: Mention this change.
* TODO: Remove this item.
[jm: src/seq.c: make diagnostics more consistent
 tests/misc/seq (fmt-eos1): adjust the expected diagnostic ]
2008-02-19 15:41:16 +01:00
James Youngman
a1e715698a join: new options: --check-order and --nocheck-order.
* src/join.c: Support --check-order and --nocheck-order.
New variables check_input_order, seen_unpairable and
issued_disorder_warning[]. For --check-order, verify that the
input files are in sorted order.  For the default case, check the
order only if there are unpairable lines.
(join): Perform ordering checks after reaching EOF on either
input.
(usage): Mention --check-order and --nocheck-order.
(dupline): Save a copy of the previously-read input line so that
we can detect disorder on the input.
(get_line): Temporarily save a copy of the previous line (by
calling dupline) and check relative ordering (by calling
checkorder) before returning the newly-read line.
(getseq, join): Tell get_line which file we are reading from.
(advance_seq): New function, factoring out some of the code
commonly surrounding calls to getseq.
(checkorder): New function.  Verifies that a pair of consecutive
input lines are in sorted order.
* doc/coreutils.texi (join invocation): Document the new options
--check-order and --nocheck-order.
* tests/join/Test.pm (tv): Added tests for --check-order and
--nocheck-order.
* NEWS: Mention this new feature.
2008-02-19 15:17:39 +01:00
Jim Meyering
b8108fd2dd seq: give a proper diagnostic for an invalid --format=% option
* src/seq.c (long_double_format): Handle '%' at end of string.
* tests/misc/seq [fmt-eos1, fmt-eos2]: New tests for the bug.
* NEWS: Mention this.
Reported by Pádraig Brady.
2008-02-18 18:38:52 +01:00
Ed Avis
483297d5dd ls --color no longer outputs unnecessary escape sequences
In --color mode, plain files do not get any color, not even white.
When no highlighting is required, ls outputs no escape sequence at all.
* src/ls.c (print_with_color):
(used_color): New global.
(indicator_no) [C_RESET]: New enum value.
(indicator_name) ["rs"]: Corresponding new string.
(color_indicator): Make the 'normal' and 'file' markers be NULL.
Use "rs" (C_RESET) to reset to ordinary colors.
(process_signals): Restore default colors only if necessary.
(main): Don't call prep_non_filename_text here.
(print_name_with_quoting): Call it here, instead.
(prep_non_filename_text): Use C_RESET, not C_NORM.
(print_color_indicator): Return bool, not void.
Print nothing, when possible.
(put_indicator): Call prep_non_filename_text the first time.
* tests/misc/ls-misc: Test for above.
* tests/ls/color-dtype-dir: Adapt: no escapes around regular file name.
* TODO: Remove item.
* NEWS: Mention this.
2008-02-17 11:16:08 +01:00
James Youngman
167b8025ac Replace groups.sh with groups.c.
* src/groups.c (main): New file, replacing groups.sh.
* src/group-list.c, src/group-list.h: New files, factored out of id.c,
implementing the functionality that "id" and "groups" have in common.
* src/id.c (print_full_info): Avoid a segfault when trying to print
an error message if getgroups fails.
(print_group_list): Move to group-list.c.
(print_group): Likewise.
* man/Makefile.am: When building groups.1, obtain the help text
from src/groups.c, not src/groups.sh.
(noinst_HEADERS): Add group-list.h.
(group): Remove rule.
(dist_man_MANS): Remove groups.1.
* doc/coreutils.texi (groups: Print group names a user is in):
Explain why "groups" and "groups $(id -un)" give different results
in existing login sessions after you change the group database.
(id: Print user identity): Likewise for "id".
* po/POTFILES.in: Add src/group-list.c and src/groups.c.
* NEWS: mention this.
* AUTHORS: Update.
2008-02-13 14:37:22 +01:00
Jim Meyering
dcc6638e46 NEWS [6.9.90]: head, od, split and tail accept the standard size suffixes 2008-02-07 22:58:38 +01:00
Steven Schubiger
a09dadf100 mkdir, split: write --verbose output to stdout, not stderr.
* src/mkdir.c (verbose_output): New function.
(announce_mkdir): Use it.
* src/split.c (usage): Update.
* src/split.c (cwrite): Write to stdout, not stderr.
* doc/coreutils.texi (split invocation): Remove the mention
of --verbose output being printed to stderr.
* tests/mkdir/p-v: Redirect stdout, not stderr.
* tests/misc/split-a: Likewise.
* NEWS: Mention this change.
* TODO: Remove this item.
2008-02-07 08:26:48 +01:00
Jim Meyering
ed5c4e770a Improve "rmdir --ignore-fail-on-non-empty"
* src/rmdir.c (remove_parents, main): With --ignore-fail-on-non-empty,
suppress a diagnostic also for other errno values, which can arise
with read-only media or when the parent directory has the immutable
attribute (set via chattr +i).
(errno_may_be_empty, ignorable_failure): New functions.
* src/remove.c (is_empty_dir): Move function to ...
* src/system.h (is_empty_dir): ...here, and make it inline.
Suggested by Josselin Mouette in <http://bugs.debian.org/363011>
via Bob Proulx.
* NEWS: Mention the improvement.
2008-01-30 13:51:38 +01:00
Jim Meyering
533391a2a7 ls: don't segfault on files in /proc with an old libselinux
* src/ls.c (gobble_file): Work around a bug in libselinux1-2.0.15
whereby getfilecon returns 0 yet sets the context to NULL.
Reported by Jan Moringen via Michael Stone in
http://bugs.debian.org/463043
* tests/ls/Makefile.am (TESTS): Add proc-selinux-segfault.
* tests/ls/proc-selinux-segfault: Test for the above fix.
* NEWS: Mention the fix.
2008-01-29 09:23:51 +01:00
Jim Meyering
9675ed627d * NEWS: Record release date. 2008-01-22 00:30:14 +01:00
Jim Meyering
0702758ca4 NEWS: Mention the configure.ac fix. 2008-01-16 21:20:36 +01:00
Jim Meyering
8ad8aa5322 Version 6.9.92 2008-01-12 00:34:31 +01:00
Jim Meyering
e52a7c28ac tests/tr/Test.pm: Prefer en_US.ISO-8859-1 to en_US.iso88591.
Suggestions from James Youngman and Pádraig Brady in
http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/12218/focus=12227
2008-01-11 10:07:01 +01:00
Jim Meyering
ab1c9b54b1 NEWS: Mention the cp bug fix. 2008-01-07 12:18:00 +01:00
Jim Meyering
9b76bc2b54 touch: add a test for today's change.
* tests/touch/now-owned-by-other: New script.  Test today's change.
* tests/touch/Makefile.am (TESTS): Add now-owned-by-other.
* tests/Makefile.am (all_t): Add td, a new root-only test.
(td): New target.
* NEWS: Mention the improvement.
2008-01-06 12:50:54 +01:00
Jim Meyering
6efd10462d Avoid tr case-conversion failure in some locales.
* src/tr.c (skip_construct): New function.
(main): When processing a pair of case-converting classes, don't
iterate through the elements of each [:upper:] or [:lower:] class.
Reported by Gerald Pfeifer in
<http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/12218>.
* tests/tr/Test.pm [tolower-F]: New test for the above fix.
[upcase-xtra, dncase-xtra]: New tests, for a related code path.
* NEWS: Mention the tr bug fix.
2008-01-06 00:09:29 +01:00
Jim Meyering
e19a5aa428 Note that sorting uniq's input is often useful.
Suggested by Eric Blake.
2007-12-18 11:20:45 +01:00
Jim Meyering
7477cd1662 Version 6.9.91. 2007-12-15 09:44:40 +01:00
Jim Meyering
7407dc042a Add a test to exercise today's bug fix.
* tests/misc/selinux: Test for today's bug fix.
* NEWS: Mention the SELinux "ls -l" fix.
2007-12-11 21:41:52 +01:00
Jim Meyering
291eb90a0a * NEWS: Add the "Bug fixes" heading. 2007-12-11 19:08:03 +01:00
Jim Meyering
de5b055bbf "rm" as root would fail to unlink a non-directory on OS X 10.4.x
* src/remove.c (remove_entry) ["can unlink directories"]: Fix a
mistakenly reversed condition.
* NEWS: Mention this bug fix.
Reported by Pieter Bowman.
2007-12-09 00:57:00 +01:00
Jim Meyering
b1a1db5900 * NEWS: Add the usual "Noteworthy changes in release 6.9.91..." line. 2007-12-02 18:39:40 +01:00
Jim Meyering
bb5c20212f NEWS: Remove the now-untrue statement about cp vs. dangling symlinks 2007-12-01 22:46:05 +01:00
Jim Meyering
ab73462d4b * NEWS: Mention some of the SELinux changes.
Record release date and new version number.
* src/stat.c (main): Adjust a comment.
2007-12-01 18:48:43 +01:00
Lasse Collin
cbc06bb639 "cp -p" tries to preserve GID even if preserving the UID fails.
* NEWS: Mention this new feature.
* src/copy.c (set_owner): Try to preserve just the GID,
when initial fchown/lchown fails.
* src/cp.c (re_protect): Likewise.
2007-11-24 15:06:43 +01:00
Jim Meyering
0e9b06482e Add tests to show new class of strings accepted by date -d.
* tests/misc/date (rel-1day, rel-plus1): New tests for the recent
change in gnulib's getdate.y.
* NEWS: Mention the fix.
2007-11-23 08:27:16 +01:00
Jim Meyering
2bdc481219 cp: by default, refuse to copy through a dangling destination symlink
* NEWS: Mention this change.
* doc/coreutils.texi (cp invocation): Describe the new behavior.
* src/copy.c: No longer include "canonicalize.h".
(copy_reg): Upon failure to open a dangling destination symlink, don't
canonicalize the name, but rather fail (default) or, with POSIXLY_CORRECT,
repeat the open call without O_EXCL (potentially dangerous).
* src/copy.h (struct cp_options) [open_dangling_dest_symlink]:
New member.  Reorder the others, grouping "bool" and "enum"
members together.
* tests/cp/thru-dangling: Test for changed and new behavior.
* src/cp.c (cp_option_init): Initialize new member.
* src/install.c (cp_option_init): Likewise.
* src/mv.c (cp_option_init): Likewise.

Signed-off-by: Jim Meyering <meyering@redhat.com>
2007-11-22 00:19:06 +01:00
Jim Meyering
a03811f519 "seq .1 .1" would mistakenly generate no output on some systems
* NEWS: Say this.
* src/seq.c (print_numbers): Handle another floating point corner case.
This avoids failure of seq's eq-wid-7 test on FreeBSD 6.1.
2007-11-17 09:39:42 +01:00
Paul Eggert
a860ca32b0 Fix bug with "seq 10.8 0.1 10.95", plus another bug with %% in format.
* NEWS: Mention the %%-in-format bug fix.
* src/seq.c (struct layout): New type.
(long_double_format): New arg LAYOUT.  Fill it in.  Fix mishandling
of %% in formats.
(print_numbers): New arg LAYOUT.  Don't convert LAST to output format
when deciding whether to go slightly past LAST.  Instead, convert
X to output format and back.  This fixes a bug reported by
Andreas Schwab in
<http://lists.gnu.org/archive/html/bug-coreutils/2007-10/msg00237.html>
where "seq 10.8 0.1 10.95" would output 11.0 on platforms where
10.95 rounds to a value that prints as 11.0 when only one digit
past the decimal point is asked for.
(main): Compute layout, for benefit of print_numbers.
* tests/misc/seq (float-3): Undo previous change, since the bug
should be fixed now.
(fmt-b): New test, for the %% bug.
2007-11-03 10:00:26 +01:00
Jim Meyering
ffa639900b * NEWS: Mention the printf fix. 2007-10-21 18:17:30 +02:00
Jim Meyering
af5d0c363a tr: do not reject an unmatched [:lower:] or [:upper:] in SET1.
* NEWS: Mention this.
* src/tr.c (get_next) [RE_CHAR_CLASS]: Don't skip the loop when
processing [:lower:] and [:upper:].
(main): Require [:lower:] or [:upper:] in SET1 only when
when one of those is specified in SET2.
* tests/tr/Test.pm: Add tests for this fix.
Reported by Per Starbäck.

Signed-off-by: Jim Meyering <meyering@redhat.com>
2007-10-21 14:01:28 +02:00
Jim Meyering
689186b88c rm could malfunction under unusual circumstances:
When operating on a relative name longer than 511 bytes,
and (when either processing a directory that is neither writable
nor readable (but still searchable) or when determining whether
to prompt), and encountering an ENOMEM error while forming the
file name, rm would operate on a truncated-to-511-byte name
starting with "[...]" rather than the intended one.
* NEWS: Describe the bugs.
* src/remove.c: Correct two misuses of full_filename:
(full_filename0, xfull_filename): New functions.
(full_filename_): Rewrite to use full_filename0.
(AD_pop_and_chdir): Use xfull_filename, not full_filename.
(write_protected_non_symlink): Likewise.
2007-10-08 10:26:05 +02:00
Jim Meyering
99b039fead New program: mktemp.
* NEWS: Mention this.
* README: Add mktemp to the list.
* AUTHORS: Add this: mktemp: Jim Meyering
* src/mktemp.c: New file.
* src/Makefile.am (bin_PROGRAMS): Add mktemp.
(mktemp_LDADD): Add $(LIB_GETHRXTIME).
* man/mktemp.x: New file.
* man/Makefile.am (dist_man_MANS): Add mktemp.1.
(mktemp.1): New dependency.
* man/.cvsignore: Add mktemp.1.
* man/.gitignore: New file.
* src/.cvsignore, src/.gitignore: Add mktemp.
* tests/misc/mktemp: New file.
* tests/misc/Makefile.am (TESTS): Add mktemp.
* tests/Coreutils.pm (run_tests): Give the POST-test function
access to stdout and stderr contents, so it can verify that
the named-on-stdout file/dir does indeed exist and has proper
permissions, etc.
[po/ChangeLog]
* POTFILES.in: Add src/mktemp.c.
2007-10-07 19:44:38 +02:00
Jim Meyering
e2a6cbca3b * NEWS: The recent rm-diagnostic fix also affects cross-partition "mv". 2007-09-24 16:33:35 +02:00
Jim Meyering
a7ec8caffe rm: give a sensible diagnostic when failing to remove a symlink
On some systems (those with openat et al), when rm would fail to
remove a symlink, it would fail with the misleading diagnostic,
"Too many levels of symbolic links".
* NEWS: Mention the bug fix.
* src/remove.c (is_nondir_lstat): New function.
(remove_entry): Use it to catch failed-to-remove symlink (and any
other non-dir) here so that we don't fall through and try to treat
it as directory, which -- with a symlink -- would provoke the bogus
ELOOP failure.
* tests/rm/fail-eacces: Add a test for the above.
* src/c99-to-c89.diff: Adjust offsets.
2007-09-22 13:27:57 +02:00
Jim Meyering
500eccdbe4 chmod: don't ignore a dangling symlink
* NEWS: Mention the bug fix.
* src/chmod.c (process_file): Handle the case of FTS_SLNONE,
i.e., give a diagnostic saying we cannot operate on such a file.
* tests/chmod/thru-dangling: Compare new stderr output with expected.
2007-09-07 10:45:22 +02:00
Jim Meyering
d02e4e7775 Don't let ln be a party to destroying user data.
* src/ln.c: Include "file-set.h", "hash.h" and "hash-triple.h".
(dest_set, DEST_INFO_INITIAL_CAPACITY): New globals.
(do_link): Refuse to remove a just-created link.
Record a name,dev,ino triple for each link we create.
(main): Initialize dest_set, if needed.
* tests/mv/childproof: Test for the above fix.
* NEWS: Document this.
Reported by Eric Blake.

Signed-off-by: Jim Meyering <jim@meyering.net>
2007-08-23 14:00:35 +02:00
Jim Meyering
fba081f923 By default, do not install hostname anymore.
* configure.ac: Add "hostname" to the list of not-installed programs.
* src/Makefile.am (no_install__progs): Add "hostname" here, too.
* NEWS: Mention this.
2007-08-21 10:36:05 +02:00
Paul Eggert
6dfe8fc30d NEWS: note that a cp -p bug fixed in 6.7 affected releases before 6.0.
Problem reported by Soren Spies in
<http://lists.gnu.org/archive/html/bug-coreutils/2007-08/msg00106.html>.
To be conservative, just say the bug was in all versions through 6.6.
2007-08-20 17:29:27 +02:00
Eric Blake
feed02af9d Avoid consuming too much seekable input when yesno is used.
* bootstrap.conf (gnulib_modules): Grab closein.
* src/system.h (includes): Also include closein.h.
* src/mv.c (main): Use close_stdin, not close_stdout.
* src/cp.c (main): Likewise.
* src/ln.c (main): Likewise.
* src/rm.c (main): Likewise.
* src/install.c (main): Likewise.
* NEWS: Document the fix.
2007-08-20 17:03:45 +02:00
Jim Meyering
535a9fe512 od --skip (-j) works even on files in /proc, when the kernel lies
* src/od.c (skip): Don't let kernel misinformation (nonempty files
in /proc with stat.st_size == 0) make "od -j N" misbehave.
Patch by Paul Eggert.
* NEWS: Document this work-around.
* tests/misc/od-zero-len: New file, test for the above.
2007-08-15 22:45:55 +02:00
Jim Meyering
1490f2dbf3 od: fix a bug that arises when skipping exact length of file
* NEWS: Document the bug fix.
* src/od.c (skip): Call fseek even when n_skip is exactly the
same as the length of the current file.  Otherwise, the next
iteration would use unadjusted input stream pointer, thus ignoring
the desired "skip".  Report and patch by Paul GHALEB.
2007-08-14 09:47:05 +02:00
Jim Meyering
fd9a6e860b du: print size (probably incomplete) of each inaccessible directory
* src/du.c (process_file): Print what we know of the size of a
 directory even when it is inaccessible.  What we print is just the
 size of the directory itself, not counting any of its contents.
 * tests/du/inacc-dir: Test for this.
 * NEWS: Mention this change.

Signed-off-by: Jim Meyering <jim@meyering.net>
2007-07-31 12:10:11 +02:00
Jim Meyering
3b03442c54 Add a test for du not counting size of inaccessible directories.
* tests/du/inacc-dir: New file. Test for fts.c bug fixed yesterday.
 * tests/du/Makefile.am (TESTS): Add inacc-dir.
 * NEWS: Mention the bug fix.

Signed-off-by: Jim Meyering <jim@meyering.net>
2007-07-31 12:10:11 +02:00
Jim Meyering
288524b39b Attempt to copy a regular file, even if stat says it is empty.
* NEWS: Document this bug fix.
* src/copy.c (copy_reg): Read from a regular file, even if it
appears (stat.st_size == 0) to be empty.  This reverts an
optimization introduced on 2005-11-23 for coreutils-6.0.
Otherwise, "cp /proc/cpuinfo /tmp" creates an empty file,
on e.g., linux-2.6.20.
* tests/cp/proc-zero-len: New file.  Test for the above.
* tests/cp/Makefile.am (TESTS): Add proc-zero-len.
Reported by Dan Berrangé.
2007-07-29 12:03:15 +02:00
Jim Meyering
813d66cea7 NEWS: Move the other "sort" entry from the 6.9 section into 6.10 "Bug fixes". 2007-07-24 10:01:44 +02:00
Jim Meyering
c12bf5fb7f sort: add a test to exercise the affected code.
* tests/sort/Test.pm (realloc-buf): Exercise the code that changed
yesterday.  No other test in all of "make check" does this.
* NEWS: Mention the fix.
2007-07-24 09:59:14 +02:00
Jim Meyering
366aaf59dc Document and add a test for today's sort bug fix.
* NEWS: Describe the bug fix.
* tests/sort/Test.pm (obs-inval): Add a test for today's fix.
2007-07-20 18:42:23 +02:00
Jim Meyering
7465b002f9 "cp -i --update older newer" no longer prompts; same for mv
* src/copy.c (copy_internal): Perform "update" check before the
possible interactive prompt.  Reported by zeno_AT_biyg_DOT_org
in <http://bugzilla.redhat.com/248591>
* tests/mv/update: Add tests for the above.
* NEWS: Mention the bug fix.
2007-07-19 10:14:41 +02:00
Jim Meyering
1e07a21459 Remove long-deprecated options.
* NEWS: Mention this.
* src/df.c, src/ls.c: Remove --kilobytes option.
* src/du.c: Remove --kilobytes and --megabytes options.
* src/who.c: Remove -i and --idle options.
* src/ptx.c: Remove --copyright option.

Signed-off-by: Jim Meyering <jim@meyering.net>
2007-07-14 19:17:01 +02:00
Jim Meyering
916fcda554 Warn about non-portable use of unescaped backslash at end of string,
and treat it as if it were escaped.
* src/tr.c (unquote): Considering that such usage would make GNU tr
from coreutils-5.2.1 and earlier *fail*, the least we can do now is
to warn about it.  Solaris' tr ignores it.
* NEWS: Mention this.
2007-07-13 18:37:16 +02:00
Jim Meyering
89dc019451 Skip "arch" test if it's not built.
* tests/misc/Makefile.am (built_programs): Define.
(TESTS_ENVIRONMENT): Add $(built_programs), for...
* tests/misc/arch: ...this: skip the test if arch is not built.
* src/Makefile.am (built_programs.list): New rule.
* tests/Makefile.am (built_programs): Rename from all_programs.
(TESTS_ENVIRONMENT): Use built_programs, not all_programs.
* tests/help-version: Likewise.
* NEWS: Mention that using --enable-no-install-program=X may
cause "make check" to fail.

Signed-off-by: Jim Meyering <jim@meyering.net>
2007-07-10 23:39:05 +02:00
Jim Meyering
471d33582e Add support for enabling/disabling installation of specified programs.
* NEWS: Mention new configure-time options.
Mention that neither arch nor su is built/installed, by default.
* m4/include-exclude-prog.m4: New file.
* configure.ac: Use new macro, gl_ADD_PROG, rather than
manually appending to OPTIONAL_BIN_PROGS and MAN.
Move the code that adds "df" to the list of programs to build from
m4/jm-macros into this file.
Use gl_INCLUDE_EXCLUDE_PROG, then handle special cases: ginstall, [.
(NO_INSTALL_PROGS_DEFAULT): AC_SUBST it.  Used by man/Makefile.am.
* man/Makefile.am (dist_man_MANS): Remove from this list all man pages
corresponding to "bin" programs. Add $(MAN) instead.
(optional_mans): Remove all uses.
(check-x-vs-1): Adapt to work even though arch and su are typically
no longer built (and neither are their .1 files).
* src/Makefile.am (install_su): Rename from INSTALL_SU, now that
INSTALL_SU has a different meaning. Use the new $(INSTALL_SU) value.
2007-07-10 22:55:15 +02:00
Karel Zak
264021699c New program: arch
* NEWS: Mention arch.
* README: Add arch to the list of programs.
* AUTHORS: Add arch.
* src/uname.c: Include "uname.h".
(PROGRAM_NAME): Handle arch, too.
(ARCH_AUTHORS): Define.
(uname_long_options, arch_long_options): Renamed and new globals.
(usage): Handle arch-mode as well as uname-mode.
(decode_switches): New function, extracted from main,
to handle arch-mode as well as uname-mode.
(main): Handle both modes.
* src/uname-arch.c: New program, alias for "uname -m".
* src/uname-uname.c: New file, default uname mode.
* src/uname.h: New file, uname modes.
* src/Makefile.am (EXTRA_PROGRAMS): Add arch.
(uname_SOURCES, arch_SOURCES): Define.
* man/arch.x: New file.
* man/Makefile.am (dist_man_MANS): Add arch.1.
(arch.1): New dependency.
* tests/misc/arch: New test, compare "arch" with "uname -m"
* configure.ac (OPTIONAL_BIN_PROGS): Add arch.
(MAN): Add arch.1.
* .x-sc_require_config_h: Exempt uname-arch.c and uname-uname.c
from the always-include-<config.h> rule.

Signed-off-by: Karel Zak <kzak@redhat.com>
Signed-off-by: Jim Meyering <jim@meyering.net>
2007-07-10 19:00:00 +02:00
Paul Eggert
36ce675bb4 pr -F no longer suppresses the footer or the first two blank header lines
Here's a patch along the lines of
<http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/10849/focus=10857>.
It's a bit large since it changes the test cases to match the behavior,
and the test cases' file names depend on the behavior!

* NEWS: pr -F no longer suppresses the footer or the first two blank
lines in the header.
* doc/coreutils.texi (pr invocation): Likewise.  Also, a too-short
page length implies -t, not -T.
* src/pr.c (lines_per_header, lines_per_footer): Now constants.
(init_parameters): Don't try to change them.
(print_header): Use the same header and footer format regardless of
wither form feeds are being used.
(usage): Adjust to above change when describing too-short page length.
Too-short page length impliesy -t, not -T.
* tests/pr/2-S_f-t_notab: Adjust to the fact that -F now affects
only formfeed handling; it does not change the header.
* tests/pr/2-Sf-t_notab: Likewise.
...
* tests/pr/3-5l17f-t: Remove, since it's been renamed to another
file whose name has a line count 7 larger,
reflecting the new line count needed for this behavior.
* tests/pr/3a3l8f-t: Likewise.
...
* tests/pr/w72l24f-ll: Likewise.

Signed-off-by: Jim Meyering <jim@meyering.net>
2007-07-04 12:45:10 +02:00
Paul Eggert
a0304574e9 seq no longer mishandles cases like "seq 0 0.000001 0.000003",
where it would not print the desired last number.
* doc/coreutils.texi (seq invocation): Remove advice about workaround
for seq off-by-one problem, since the bug is fixed now.  Replace
it with more-generic advice about rounding errors.
* src/seq.c (long_double_format, print_numbers):
New arg NUMERIC_FORMAT.  All uses changed.
2007-06-23 09:43:59 +02:00
Paul Eggert
811901cb41 A few more symlink-related fixes. Fix a bug triggered by cp
--parents and symlinks.  Close some race conditions possible when
the destination replaces a newly-created file with a symlink.
* NEWS: Document that 'cp --parents' no longer mishandles
symlinks in file name components of source.
* src/copy.c (HAVE_LCHOWN): Default to false.
(lchown) [!defined HAVE_LCHOWN]: Define to chown, for convenience.
* src/cp.c (lchown) [!HAVE_LCHOWN]: Likewise.
* src/install.c (lchown [!HAVE_LCHOWN]: Likewise.
* src/copy.c (set_owner): Use lchown instead of chown, for safety
in case the file got replaced by a symlink in the meantime.
* src/cp.c (re_protect): Likewise.
* src/install.c (change_attributes): Likewise.
* src/copy.c (copy_internal): Use ordinary C rather than an #if.
* src/cp.c (lchown) [!HAVE_LCHOWN]: Define to chown, for convenience.
(struct dir_attr): Cache the entire struct stat of the directory,
rather than just its mode, so that we needn't stat the directory
twice (which can lead to races).
(re_protect): Don't use XSTAT as that's not appropriate in
this context (symlinks should be followed here).  Instead, use
the cached stat value.
(make_dir_parents_private): Save dir's entire struct stat, not
just its mode.
* tests/cp/cp-parents: Add test to check against bug with
cp --parents and symlinks.
2007-06-18 15:20:44 +02:00
Paul Eggert
cdec7e6e93 Correct cp's handling of destination symlinks in some cases.
* NEWS: "cp" no longer considers a destination symlink to be the
same as the referenced file when copying links or making backups.
* src/copy.c (copy_reg): When following a symlink, use the
followed name in later chown etc. requests, so that the created
file is affected, rather than the symlink.  Use O_NOFOLLOW on
source when not dereferencing symlinks; this avoids a race.
Preserve errno correctly when doing multiple open attempts on the
destination.
(copy_internal): Follow destination symlinks only when copying a
regular file and only when we don't intend to remove or rename the
destination first, regardless of whether following source
symlinks; this is because since POSIX and tradition (e.g.,
FreeBSD) say we should ordinarily follow destination symlinks if
the system calls would ordinarily do so.
* src/copy.h (struct cp_options): Add comment that 'dereference'
is only for source files.
* src/cp.c (usage): Note that --derereference etc. are only for
source files.
(make_dir_parents_private): Follow symlinks, regardless of whether
--dereference is specified, because these are destination symlinks.
* tests/cp/same-file: Adjust tests to match revised behavior.
Filter out perror output since it might vary from host to host.
Use sed alone instead of also using echo.

* doc/coreutils.texi (cp invocation): Document the behavior better when
the destination is a symlink.  Clarify source versus destination
symlinks.  Describe the new behavior for destination symlinks.

2007-06-15  Jim Meyering  <jim@meyering.net>

* src/copy.c: Include "canonicalize.h".
(copy_reg): Use canonicalize_filename_mode to follow the symlink,
so that we can always open with O_EXCL and avoid a race.
2007-06-15 22:47:16 +02:00
Jim Meyering
b1b0f5c556 bug-fix: cp would fail to write through a dangling symlink
* NEWS: Mention the bug fix.
* src/copy.c (copy_reg): When open fails with EEXIST, the destination
is lstat'able, and a symlink, call open again, but now without O_EXCL.
* tests/cp/thru-dangling: New file, to test for the above fix.
* tests/cp/Makefile.am (TESTS): Add thru-dangling.
* THANKS: Add Michael McLagan.
Bug report from Michael McLagan in <http://bugzilla.redhat.com/243588>.
2007-06-10 15:01:18 +02:00
James Youngman
e82c7ddd47 wc: ignore multibyte-character decoding errors
* src/wc.c (wc): Don't issue an error message when mbrtowc
indicates that we have seen an invalid byte sequence.  This
makes "wc /bin/sh" bearable (though the word and line counts
are likely not to be useful).
* NEWS: Mention the change.
2007-05-26 07:13:50 +02:00
Jim Meyering
a6a447fc58 cut: diagnose a range starting with 0 (-f 0-2) as invalid, and
give a better diagnostic for a field-number/offset of 0.
* NEWS: Mention the fix.
* src/cut.c (ADD_RANGE_PAIR): Add an explicit check for 0.
Based on a patch from James Youngman.
* tests/misc/cut: Add tests for the above.
2007-05-22 18:47:17 +02:00
Jim Meyering
ae5717158f "cut -f 2-0" now fails; before, it was equivalent to "cut -f 2-"
Also, diagnose the '-' in "cut -f -" as an invalid range, rather
than interpreting it as the unlimited range, "1-".
* NEWS: Mention these changes.
* src/cut.c (set_fields): Don't interpret an accumulator "value"
of 0 as an unspecified range endpoint.
Give better diagnostics.
Adjust a comment so that it is true also for 64-bit size_t.
* tests/cut/Test.pm: Add tests for the above.
2007-05-22 13:56:34 +02:00
Jim Meyering
02599650b1 stty: diagnose an invalid hex value in 35-colon commmand-line argument
* NEWS: Mention this.
* src/stty.c (strtoul_tcflag_t, strtoul_cc_t): New functions.
(recover_mode): Use those functions (not sscanf), to parse the
string robustly.
* tests/stty/invalid: New file.  Test for the above.
* tests/stty/Makefile.am (TESTS): Add invalid.
* .x-sc_prohibit_atoi_atof: Don't exempt stty.c from this check.
Add tests/stty/invalid so we don't have to obfuscate the comment
about sscanf therein.
* Makefile.maint (sc_prohibit_atoi_atof): Mention sscanf in the
diagnostic, too.
2007-05-22 07:55:40 +02:00
James Youngman
e06252480a Add -z option to uniq. Originally proposed by Egmont Koblinger.
* NEWS: Mention uniq's new option: --zero-terminated (-z).
* src/uniq.c: Add new option, --zero-terminated (-z), to make
uniq use the NUL byte as separator/delimiter rather than newline.
(check_file): Add a parameter: delimiter.  Update caller.
Use readlinebuffer_delim in place of readlinebuffer everywhere.
(main): Handle the new option.
(usage): Describe new option the same way sort does.
* doc/coreutils.texi (uniq invocation): Describe the new option.
2007-05-13 11:02:43 +02:00
Jim Meyering
cdd66362dc * NEWS: Mention that last week's tr bug dates back to 1992. 2007-05-07 21:56:27 +02:00
Jim Meyering
ab402c29f9 tr -c: don't abort when translating with S2 larger than complement of S1
* src/tr.c (main): Remove invalid assertion triggered by e.g.,
tr -c a '[b*256]'.  There's nothing wrong with having Set2 larger
than Set1.  Reported by Guntram Blohm.
* tests/tr/Test.pm (no-abort-1): Test for the above.
* NEWS: Mention this bug fix.
* THANKS: Add Guntram Blohm.
2007-05-04 10:03:01 +02:00
Jim Meyering
383713e030 * THANKS: Add Andreas Frische.
* NEWS: Mention today's ls --color fix.
* tests/ls-2/tests (sl-dangle): Add a test for today's fix.
2007-04-24 09:20:52 +02:00
Paul Eggert
395fcee97a split --line-bytes=N (-C N): don't create an empty file.
* src/split.c (line_bytes_split): Don't create an empty line
afterwards if the last buffer happens to be exactly full.
* tests/misc/split-fail: Add a test case for this.
* NEWS: mention this.
2007-04-12 00:21:25 +02:00
Jim Meyering
4d484fe09f Add a test for, and document, today's fix.
* NEWS: Mention today's ls --color fix.
* tests/ls-2/tests (sl-target): Add a test for today's fix.
* THANKS: Add Kirk Kelsey.
2007-04-07 20:51:13 +02:00
Paul Eggert
a3b65a63a0 * src/ls.c (print_horizontal): Fix bug reported by Mike Frysinger:
ls -x DIR would sometimes output the wrong string in place of the
first entry.
* NEWS: Mention the bug fix.
* tests/ls/x-option: New file.
* tests/ls/Makefile.am (TESTS): Add x-option.
2007-04-02 18:29:41 +02:00
Jim Meyering
a301ea6697 * NEWS: Mention these SELinux changes. 2007-03-30 16:02:54 +02:00
Jim Meyering
c3abd70c67 Post-release version change.
* NEWS: Add a line for 6.9+.
* configure.ac (AC_INIT): Set new version string.
2007-03-23 08:22:35 +01:00
Jim Meyering
804bdc3001 Version 6.9.
* NEWS: Record release date and new version number.
* configure.ac (AC_INIT): New version number.
2007-03-22 22:20:02 +01:00
Jim Meyering
553d347d3e Fix a bug in how pr -m -s works.
* NEWS: Describe how the fix affects pr.
* src/pr.c (init_parameters): The --merge (-m) option does
not imply --expand-tabs (-e), so don't set "untabify_input".
Reported by Wis Macomson.
* tests/misc/pr: New file.  Test for the above fix.
* tests/misc/Makefile.am (TESTS): Add pr.
* THANKS: Update.
2007-03-18 16:21:26 +01:00
Andrew Church
2871ad3b45 Fix a bug: cp -x would fail to set mount point permissions.
* NEWS: mention cp -x bug fix
* src/copy.c (copy_internal): Don't return immediately after
copying a mount point that we do not intend to recurse under.
Based on a patch by Andrew Church.
2007-03-03 23:00:18 +01:00
Paul Eggert
817d0261eb Make df -P immune to effects of e.g., the BLOCK_SIZE envvar.
* NEWS: With -P, the default block size and output format is not
affected by DF_BLOCK_SIZE, BLOCK_SIZE, or BLOCKSIZE.
* src/df.c (main): Implement this.
* doc/coreutils.texi (df invocation): With -P, the default block size
and output format is not affected by DF_BLOCK_SIZE, BLOCK_SIZE, or
BLOCKSIZE.
2007-02-27 19:33:03 +01:00
Jim Meyering
9317cccb8f Post-release version change.
* NEWS: Add a line for 6.8+.
* configure.ac (AC_INIT): Set new version string.
2007-02-25 01:10:07 +01:00
Jim Meyering
cc2d4f6c46 Version 6.8.
* NEWS: Record release date and new version number.
* configure.ac (AC_INIT): New version number.
2007-02-24 21:16:52 +01:00
Jim Meyering
f92a08e171 * NEWS: Use a simple "+" suffix to denote pre-release, not "-dirty".
Nicer connotations.
* configure.ac: Use 6.7+, not 6.7-dirty.
2007-02-24 13:13:45 +01:00
Paul Eggert
3ea177e3fa * NEWS: sort no longer compresses temporaries by default.
* bootstrap.conf: Remove findprog.
* doc/coreutils.texi (sort invocation): The default is to not
compress.  Don't treat "" specially.
* src/sort.c: Don't include findprog.h.
(create_temp): Compress only if the user specified --compress-program.
* tests/misc/sort-compress: Adjusts tests to match new behavior.
2007-02-24 12:24:27 +01:00
Paul Eggert
c363fcb9f0 * NEWS: sort now uses a --compress-program option rather than
an environment variable.
* doc/coreutils.texi (sort invocation): Document this.
* src/sort.c (usage): Likewise.
(COMPRESS_PROGRAM_OPTION): New const.
(long_options, create_temp, main): Support new option.
* tests/misc/sort-compress: Test it.
2007-02-19 22:11:18 +01:00
Jim Meyering
d282370566 Test for today's gnulib/lib/getcwd.c fix affecting pwd and readlink
* NEWS: Mention the bug fix.
* tests/misc/pwd-unreadable-parent: New file.
* tests/misc/Makefile.am (TESTS): Ad pwd-unreadable-parent.
2007-02-03 20:02:48 +01:00
Paul Eggert
b28a8851ed * NEWS: Document fix for cp --preserve=mode.
* src/copy.c (copy_internal): Omit the group- or other-writeable
permissions when creating a directory, to avoid a race condition
if the special mode bits aren't right just after the directory is
created.
* src/cp.c (make_dir_parents_private): Likewise.
* tests/cp/parent-perm-race: Test for the "cp --preserve=mode"
race fix in copy.c.
2007-02-03 18:45:46 +01:00
Paul Eggert
1c73876f5f * NEWS: Document fix for cp --parents.
* src/cp.c (make_dir_parents_private): Report the error sooner with
"cp --parents DIR/FILE DEST" when DIR is a non-directory, thus not
creating the directory, DEST/DIR.
* tests/cp/cp-parents: Test for the non-race-condition bug fixed
by the above change.
2007-02-03 18:12:11 +01:00
Paul Eggert
a0b2bc8de7 * NEWS: New option sort -C, proposed by XCU ERN 127, which looks
like it will be approved.  Also add --check=quiet, --check=silent
as long aliases, and --check=diagnose-first as an alias for -c.
* doc/coreutils.texi (sort invocation): Document this.
Also, mention that sort -c can take at most one file.
* src/sort.c: Implement this.
Include argmatch.h.
(usage): Document the change.
(CHECK_OPTION): New constant.
(long_options): --check now takes an optional argument, and is now
treated differently from 'c'.
(check_args, check_types): New constant arrays.
(check): New arg CHECKONLY, which suppresses diagnostic if -C.
(main): Parse the new options.
* tests/sort/Test.pm (02d, 02d, incompat5, incompat6):
New tests for -C.
2007-01-24 09:06:57 +01:00
Jim Meyering
1f7d56fda5 * NEWS: sort temp file compression: tweak wording.
* src/sort.c (struct sortfile) [name]: Declare member to be const.
2007-01-24 00:22:45 +01:00
Dan Hipschman
f33168da95 * src/sort.c (MAX_FORK_RETRIES_COMPRESS, MAX_FORK_RETRIES_DECOMPRESS):
In pipe_fork callers, use these named constants, not "2" and "8".
(proctab, nprocs): Declare to be "static".
(pipe_fork) [lint]: Initialize local, pid,
to avoid unwarranted may-be-used-uninitialized warning.
(create_temp): Use the active voice.  Describe parameters, too.

2007-01-21  James Youngman  <jay@gnu.org>

Centralize all the uses of sigprocmask().  Don't restore an invalid
saved mask.
* src/sort.c (enter_cs, leave_cs): New functions for protecting
code sequences against signal delivery.
* (exit_cleanup): Use enter_cs and leave_cs instead of
calling sigprocmask directly.
(create_temp_file, pipe_fork, zaptemp): Likewise

2007-01-21  Dan Hipschman  <dsh@linux.ucla.edu>

Add compression of temp files to sort.
* NEWS: Mention this.
* bootstrap.conf: Import findprog.
* configure.ac: Add AC_FUNC_FORK.
* doc/coreutils.texi: Document GNUSORT_COMPRESSOR environment
variable.
* src/sort.c (compress_program): New global, holds the name of the
external compression program.
(struct sortfile): New type used by mergepfs and friends instead
of filenames to hold PIDs of compressor processes.
(proctab): New global, holds compressor PIDs on which to wait.
(enum procstate, struct procnode): New types used by proctab.
(proctab_hasher, proctab_comparator): New functions for proctab.
(nprocs): New global, number of forked but unreaped children.
(reap, reap_some): New function, wait for/cleanup forked processes.
(register_proc, update_proc, wait_proc): New functions for adding,
modifying and removing proctab entries.
(create_temp_file): Change parameter type to pointer to file
descriptor, and return type to pointer to struct tempnode.
(dup2_or_die): New function used in create_temp and open_temp.
(pipe_fork): New function, creates a pipe and child process.
(create_temp): Creates a temp file and possibly a compression
program to which we filter output.
(open_temp): Opens a compressed temp file and creates a
decompression process through which to filter the input.
(mergefps): Change FILES parameter type to struct sortfile array
and update access accordingly.  Use open_temp and reap_some.
(avoid_trashing_input, merge): Change FILES parameter like
mergefps and call create_temp instead of create_temp_file.
(sort): Call create_temp instead of create_temp_file.
Use reap_some.
(avoid_trashing_input, merge, sort, main): Adapt to mergefps.
2007-01-24 00:00:21 +01:00
Jim Meyering
0928c2414a Make "rm --interactive=never ..." never prompt.
* NEWS: Mention this.
* src/remove.h (enum rm_interactive): New ternary type.
(struct rm_options) [interactive]: Use it, here -- rather than bool.
* src/remove.c (prompt): Reflect type change.
* src/mv.c (rm_option_init): Initialize to RMI_NEVER now.
* src/rm.c (main): Add a FIXME comment for '-d' option.
Adapt to type change of rm_options.interactive.

* tests/rm/i-never: New file.  Test for the above fix.
* tests/rm/Makefile.am (TESTS): Add i-never.
2007-01-17 17:15:20 +01:00
Paul Eggert
f0b5e513d9 Now, "ls -FRL" always follows symbolic links on Linux.
* NEWS: Mention this bug fix.
* src/ls.c (gobble_file): Fix bug reported by
Nobuyuki Tsuchimura in
http://lists.gnu.org/archive/html/bug-coreutils/2006-12/msg00152.html
where "ls -FRL" didn't follow a symbolic link in some cases on Linux.
* tests/ls/follow-slink: Add a test for this case.

Signed-off-by: Jim Meyering <jim@meyering.net>
2007-01-02 07:27:22 +01:00
Paul Eggert
f24ff8f42b * NEWS: dd bs= operands now silently override later ibs= and obs=,
as POSIX requires.
* src/dd.c (scanargs): Implement it.
* tests/dd/misc (outbytes): Test it.
* doc/coreutils.texi (dd invocation): Specify that bs=N
overrides later ibs and obs, undoing part of the
previous change.  (The behavior was wrong.)
2006-12-22 10:09:37 +01:00
Jim Meyering
c8ef95eaed "rm -rf /etc/motd" (run by non-root) now prints a diagnostic.
* src/remove.c (remove_entry): Handle EACCES for a non-directory, too.
Karl Berry reported that a cross-partition "mv /etc/issue ~"
failed with the um,... suboptimal diagnostic,
"mv: cannot remove `/etc/issue': Not a directory".
* tests/rm/Makefile.am (TESTS): Add fail-eacces.
* tests/rm/fail-eacces: New file.
* NEWS: Mention that both mv and rm are affected.
2006-12-21 08:58:11 +01:00
Jim Meyering
d69fc66d81 "cut -f 2- A B" no longer triggers a double-free bug
* src/cut.c (cut_fields): Set file-scoped global to NULL after
freeing it.  This avoids a double-free (and core dump on some systems)
for this usage: "echo 1>a; echo 2>b; cut -f2- a b".  Reported by
James Hunt in <http://bugzilla.redhat.com/220312>.
* NEWS: List this bug fix.
* THANKS: Mention him.
* tests/misc/cut: New file.
* tests/misc/Makefile.am (TESTS): Add cut.
2006-12-20 14:25:55 +01:00
Jim Meyering
24852bf5b5 * NEWS: --preserve-root now works with chgrp, chmod, and chown.
* src/chmod.c (process_file): Do honor the --preserve-root option.
* src/chown-core.c (change_file_owner): Likewise, but here, also
handle the case in which a traversal would go "through" a symlink
to root.  Reported by Matthew M. Boedicker
* tests/chown/preserve-root: Test for the above.
* tests/chown/Makefile.am (TESTS): Add preserve-root.
2006-12-14 11:14:25 +01:00
Jim Meyering
629214eaf8 * NEWS: Mention the chmod fix induced by the recent change to gnulib's openat.m4. 2006-12-14 00:22:50 +01:00
Jim Meyering
0473e718e6 * NEWS: With the change from "-pre" to "-dirty" suffix, also change
from NEXT_VER-pre to CUR_VER-dirty.  So, this is 6.7-dirty.
* configure.ac (AC_INIT): s/6.8-dirty/6.7-dirty/.
2006-12-09 15:57:06 +01:00
Jim Meyering
07af816554 Post-release version change.
* NEWS: Add a line for 6.8-dirty.
* configure.ac (AC_INIT): Set new version string.
2006-12-08 08:28:04 +01:00
Jim Meyering
f044d2d51c Version 6.7.
* NEWS: Record release date.  Remove '-pre' suffix.
* configure.ac (AC_INIT): Remove version string suffix.
2006-12-08 00:03:00 +01:00
Paul Eggert
fc92148eac cp -p now clears special bits if it fails to preserve owner or group
* NEWS: Document the cp -p fix for special bits.
* src/copy.c (set_owner): Now returns a three-way result, so
that the caller can clear the special bits.  All callers changed.
(copy_reg): Don't set the special bits if chown failed.
(copy_internal): Likewise.
* tests/cp/special-bits: Test this fix.
Signed-off-by: Jim Meyering <jim@meyering.net>
2006-12-07 08:10:35 +01:00
Paul Eggert
a4f7b723f0 * NEWS: Document the cp --preserve=ownership fix.
* m4/jm-macros.m4 (coreutils_MACROS): Check for fchmod.
* src/copy.c (fchmod_or_lchmod): New function.
(copy_reg): New arg OMITTED_PERMISSIONS.  All uses changed.
Omit confusing and unused ", dst_mode" arg to 'open' without O_CREAT.
When creating a file, use O_EXCL, so we're more likely to detect
funny business by other processes.  At the end, if permissions
were omitted, chmod them back in.
(copy_internal): If the ownership might change, omit some permissions
at first, then restore them after chowning the file.
* src/cp.c (make_dir_parents_private): Likewise.
* src/copy.c (cached_umask): New function.
* src/copy.h (cached_umask): New decl.
2006-12-06 20:44:08 +01:00
Jim Meyering
545df07893 NEWS: the du bug affects coreutils-6.4, 6.5 and 6.6. 2006-12-06 13:18:43 +01:00
Jim Meyering
ba45154d8e * NEWS: du --one-file-system (-x) would skip subdirectories of any
directory listed as second or subsequent command line argument.
* tests/du/one-file-system: New file.  Test for today's fts.c fix.
* tests/du/Makefile.am (TESTS): Add one-file-system.
2006-12-03 11:17:35 +01:00
Jim Meyering
e750c5cac8 Post-release version change.
* NEWS: Add a line for 6.7-pre.
* configure.ac (AC_INIT): Bump to 6.7 and add "-pre" suffix.
2006-11-22 16:15:02 +01:00
Jim Meyering
46710dd82a Version 6.6.
* NEWS: Record release date.  Remove "-pre" suffix.
* configure.ac (AC_INIT): Remove "-pre" suffix from version string.
2006-11-22 12:40:57 +01:00
Jim Meyering
b076de8551 * NEWS: Mention the three noteworthy changes, all fixed via gnulib. 2006-11-22 10:14:15 +01:00
Jim Meyering
318fb0502d Post-release version change.
* NEWS: Add a line for 6.6-pre.
* configure.ac (AC_INIT): Bump to 6.6 and add "-pre" suffix.
2006-11-19 19:44:23 +01:00
Jim Meyering
497a5cf465 Version 6.5.
* NEWS: Record release date.  Remove "-cvs" suffix.
* configure.ac (AC_INIT): Remove "-cvs" suffix from version string.
2006-11-19 10:58:55 +01:00
Jim Meyering
1efc5bda6c "ln --backup f f" now produces a sensible diagnostic 2006-11-18 20:19:16 +01:00
Jim Meyering
597bfeb851 * NEWS: Mention this bug fix. 2006-11-12 19:13:32 +01:00
Jim Meyering
5e42576c01 new feature: rm accepts new option: --one-file-system
Suggested by Steve McIntyre in <http://bugs.debian.org/392925>.
* src/remove.h (struct rm_options) [one_file_system]: New member.
* src/rm.c (rm_option_init): Initialize it.
(usage): Document the option.
* src/mv.c (rm_option_init): Likewise.
* src/remove.c (remove_dir): With --one-file-system and --recursive,
for each directory command line argument, do not affect a file system
different from that of the starting directory.  And give a diagnostic.
* src/rm.c (ONE_FILE_SYSTEM): New enum.
(main): Handle new option.
* tests/rm/one-file-system: Test the above.
* tests/rm/Makefile.am (TESTS): Add one-file-system.
* tests/Makefile.am (check-root): Add the rm/one-file-system
test to the list.
(EXTRA_DIST): Add other-fs-tmpdir.

* tests/mv/setup: Removed.  Renamed to...
* tests/other-fs-tmpdir: ...this new file.
* tests/mv/Makefile.am (EXTRA_DIST): Remove setup.
* tests/mv/acl: Reflect renaming: use ../other-fs-tmpdir.
* tests/mv/backup-is-src: Likewise.
* tests/mv/hard-link-1: Likewise.
* tests/mv/leak-fd: Likewise.
* tests/mv/mv-special-1: Likewise.
* tests/mv/part-fail: Likewise.
* tests/mv/part-hardlink: Likewise.
* tests/mv/part-rename: Likewise.
* tests/mv/part-symlink: Likewise.
* tests/mv/partition-perm: Likewise.
* tests/mv/to-symlink: Likewise.
* tests/mv/into-self-2: Likewise.

[doc/ChangeLog]
* coreutils.texi (rm invocation): Describe --one-file-system.
2006-10-25 00:01:33 +02:00
Jim Meyering
0fdbf2e8c7 * NEWS: Add a line for 6.5-cvs.
* configure.ac (AC_INIT): Bump to 6.5 and add "-cvs" suffix.
2006-10-23 07:59:04 +02:00
Jim Meyering
7054512f14 Remove -cvs suffix here, too. 2006-10-22 23:41:05 +02:00
Jim Meyering
0c0121ed20 Version 6.4.
* NEWS: Record the 6.4 release date.
* configure.ac (AC_INIT): Remove "-cvs" suffix from version string.
2006-10-22 22:21:26 +02:00
Jim Meyering
b1289b8716 * NEWS: (cp --backup fix): Fix a typo. 2006-10-22 18:59:58 +02:00
Jim Meyering
0dc7f78986 * NEWS: cp -r --backup dir1 dir2, would rename an existing dir1/dir2
to dir1/dir2~.
* src/copy.c (copy_internal): Although we do create a backup of each
destination directory when in move mode, don't do that when copying.
Reported by Peter Breitenlohner, in
<http://article.gmane.org/gmane.comp.gnu.core-utils.bugs/8616>.
* tests/cp/backup-dir: New file.  Test for the above.
2006-10-14 05:20:27 +00:00
Jim Meyering
f2c088fa10 * NEWS: Mention the above. 2006-10-13 19:05:07 +00:00
Paul Eggert
2983bf7c85 * NEWS: Fix typo: iso-8602 -> iso-8601. Problem reported by
Bob Proulx.
2006-10-09 20:38:56 +00:00
Jim Meyering
1d4ac49f9d * NEWS: Update here, too. 2006-10-03 22:07:36 +00:00
Jim Meyering
da9541f18e With --force (-f), rm no longer fails for ENOTDIR.
* src/remove.c (ignorable_missing): New function.
Use it everywhere, rather than open-coding the test.
Andreas Schwab reported the ENOTDIR problem.
(ignorable_missing): Similarly, don't fail for ENAMETOOLONG.
* NEWS: Mention the bug fix.
* tests/rm/ignorable: New file.  Test for the ENOTDIR case.
* tests/rm/ignore-name-too-long: New file. Test for ENAMETOOLONG.
* tests/rm/Makefile.am (TESTS): Add the new file names.
2006-10-03 13:13:09 +00:00
Jim Meyering
d2e7358a9b * NEWS: Add a line for 6.4-cvs.
* configure.ac (AC_INIT): Bump to 6.4 and add "-cvs" suffix.
2006-10-02 11:47:48 +00:00
Jim Meyering
10688306fa Version 6.3.
* NEWS: Record the 6.3 release date.
* configure.ac (AC_INIT): Remove "-cvs" suffix from version string.

* NEWS: Mention Paul's Solaris 8 vs. 10 work-around.
2006-09-30 07:43:21 +00:00
Jim Meyering
e245139e46 * NEWS: Mention Paul's fix (to gnulib's canon-host.c) for
the pinky segfault.
2006-09-29 21:37:18 +00:00
Jim Meyering
a38becce97 * src/shuf.c (read_input): Fix an off-by-one error that
would cause an infloop for piped input of 8KB or more.
* NEWS: Mention the fix.
* tests/misc/shuf: Test for the above fix.
2006-09-29 16:52:48 +00:00
Jim Meyering
a4d470409f Work around a readdir bug in Darwin 7.9.0 (MacOS X 10.3.9) on HFS+
and NFS, whereby rm would not remove all files in a directory.
* src/remove.c (CONSECUTIVE_READDIR_UNLINK_THRESHOLD): Reduce to 10.
(NEED_REWIND): New macro, so that we incur the cost of the work-around
rewinddir only on afflicted systems.
* NEWS: Clarify and correct.
* tests/rm/readdir-bug: New file.  Test for the above fix.
* tests/rm/Makefile.am (TESTS): Add it.
Prompted by testing and analysis from Bruno Haible:
http://lists.gnu.org/archive/html/bug-coreutils/2006-09/msg00326.html
2006-09-29 09:54:24 +00:00
Jim Meyering
a86a56f7d1 * NEWS: rm works around a bug in Darwin 8.6.1 w/NFS that kept
it from removing a directory containing 188 or more entries.
* src/remove.c (CONSECUTIVE_READDIR_UNLINK_THRESHOLD): Decrease by
20, go work around the buggy readdir on Darwin 8.6.1 with NFS.
Reported by Matthew Woehlke.
2006-09-26 20:42:43 +00:00
Paul Eggert
b7c315cdda [ChangeLog]
* NEWS: "groups user" no longer outputs "user :"; you need at least
two users.  "groups" now processes options like --help more compatibly.
* src/groups.sh: Implement the option-processing change.
Handle user and group names with special characters more robustly.
Report write errors instead of exiting silently with status 1.
[doc/ChangeLog]
* coreutils.texi (groups invocation): "groups" no longer prefixes
the output with "user :" unless more than one user is specified.
2006-09-26 19:11:25 +00:00
Jim Meyering
5f65d05616 * NEWS: Mention the bug fix.
* src/groups.sh: Don't hide a write failure.
Reported by Iain Calder <ic56@rogers.com>.
2006-09-26 09:28:17 +00:00
Jim Meyering
e05de760c2 * NEWS: Mention these fixes.
* src/copy.c (copy_reg): With --verbose (-v), print
"removed `file_name'" just after unlinking a file.
(copy_internal): Likewise, in three more places.
Marc Lehman reported that "touch x; ln x y; mv -v x y" was silent.
2006-09-24 19:28:25 +00:00
Jim Meyering
200aa48e15 * NEWS: Mention the improvement to sort. 2006-09-24 11:44:16 +00:00
Paul Eggert
2a01141018 * NEWS: Document fix for cp -i and mv -i.
* src/copy.c (copy_internal): With -i, prompt even if the source
is a directory and the destination is not.  This is required by
POSIX and gives the user a chance to bail out before failing.
* tests/cp/Makefile.am (TESTS): Add cp-i.
* tests/cp/cp-i: New file.
* tests/mv/Makefile.am (TESTS): Add i-5.
* tests/mv/i-5: New file.
2006-09-20 17:32:14 +00:00
Jim Meyering
fae30e1af9 * NEWS: Mention the chmod bug fix. 2006-09-20 13:30:55 +00:00
Jim Meyering
c9c0dc7bc6 * NEWS: Add a line for 6.3-cvs.
* configure.ac (AC_INIT): Bump to 6.3 and add "-cvs" suffix.
2006-09-18 13:01:09 +00:00
Jim Meyering
8cd9d29cfe duh 2006-09-18 07:51:48 +00:00
Jim Meyering
97f9240eaa *** empty log message *** 2006-09-18 07:51:33 +00:00
Jim Meyering
500fdd0af9 *** empty log message *** 2006-09-18 07:51:07 +00:00
Jim Meyering
7da3ac75c2 Version 6.2.
* NEWS: Record the 6.2 release date.
* configure.ac (AC_INIT): Remove "-cvs" suffix from version string.
2006-09-18 05:58:55 +00:00
Paul Eggert
b67faf329c * NEWS: Document that mkdir -p and install -d now fork on occasion.
* bootstrap.conf (gnulib_modules): Add savewd.
* src/install.c: Include savewd.h.
(process_dir): New function.
(main, install_file_in_file_parents): Use it, along with the new
savewd module, to avoid some race conditions.
* src/mkdir.c: Include savewd.h.
(struct mkdir_options): New members make_ancestor_function, mode,
mode_bits.
(make_ancestor): Return 1 if the resulting directory is not readable.
(process_dir): New function.
(main): Use it, along with new savewd module, to avoid some
race conditions.  Fill in new slots of struct mkdir_options, so
that callees get the values.
* tests/install/basic-1: Test for coreutils 5.97 bug that was
fixed in coreutils 6.0, and which should still be fixed with
this change.
* tests/mkdir/p-3: Likewise.
2006-09-16 20:03:56 +00:00