Commit Graph

1100 Commits

Author SHA1 Message Date
Pádraig Brady
4d90d29899 timeout: support cascaded timeouts
* src/timeout.c (cleanup): Send signals directly to the child
in case it has started its own process group (like a cascaded
timeout command would for example).
* test/misc/timeout-group: Add a test case.
* NEWS: Mention the fix.
2011-07-08 13:54:08 +01:00
Pádraig Brady
4496c94091 timeout: add --foreground to support interactive commands
Or more accurately, commands not started from the shell prompt,
that are interactive, or need to receive Ctrl-C etc. from the terminal.

* doc/coreutils.texi (timeout invocation): Document --foreground.
* src/timeout.c (main): Set the foreground flag and don't create
a separate group.
(cleanup): Only send a signal directly to the monitored command
when the foreground flag is set.
(usage): Describe --foreground.
* tests/misc/timeout-group: Add a new test.
* tests/Makefile.am: Reference new test.
NEWS: Mention the new option.

Reported by Shay Shimony
Analysis by Alan Curry
Fix suggested by Paul Eggert
2011-07-08 11:23:08 +01:00
Patrick Schoenfeld
33171d049a md5sum, sha1sum, etc: accept new option: --strict
Use this new option with --check when the input is expected to
consist solely of checksum lines.  With only --check, an invalid
line evokes a warning, but the program can still exit successfully.
With --strict, any invalid line makes the program exit non-zero.

* src/md5sum.c (strict, STRICT_OPTION): Declare/define.
(long_options): Add "strict".
(usage): Describe --strict.
(digest_check): Count improperly_formatted lines, too, and use
that number and the global "strict" to determine the return value.
(main): Handle STRICT_OPTION.
Reject --strict without --check.
* doc/coreutils.texi: Describe it.
* NEWS (New features): Mention it.
2011-07-07 16:42:47 +02:00
Jim Meyering
473b4fc1e8 stat: recognize GPFS as a file system type
* src/stat.c (human_fstype) [S_MAGIC_GPFS]: Add a case,
to handle GPFS_SUPER_MAGIC/0x47504653.  Prompted by this discussion:
http://thread.gmane.org/gmane.comp.sysutils.autoconf.general/14007
* NEWS (Improvements): Mention it.
2011-07-07 13:58:22 +02:00
Jim Meyering
18839ad9c1 doc: clarify an improvement from coreutils-7.0
* NEWS (7.0 Improvements): Mention the command: "ls -1U".
* cfg.mk (old_NEWS_hash): Update.
2011-06-25 07:59:13 +02:00
Jim Meyering
2f5c2a25ed doc: add NEWS items for recent gnulib fixes
* NEWS (Improvements): Mention the new HP-UX 11.11 ACL support.
(Build-related): Mention the cc/HP-UX 11.11 build fix.
2011-06-13 12:39:23 +02:00
Pádraig Brady
54a49f22ae chown,chgrp: output the original ownership in -v messages
* src/chown-core.c (describe_change): Output the
original owner if possible.
(user_group_str): Handle the case when neither
owner or group are passed.
* NEWS: Mention the change in behavior.
2011-05-27 23:21:46 +01:00
Pádraig Brady
6b282e7510 chown,chgrp: output the correct ownership in -v messages
* src/chown_core.c (describe_change): Accept the ownership of
the original file and output that when not changing.
This is significant when --from is specified as then
the original and specified ownership may be different.
(user_group_str): A new helper function refactored from
describe_change().
(change_file_owner): Pass the original user and group
strings to describe_change().
* test/chown/basic: Add a test case.
* NEWS: Mention the fix.
2011-05-27 22:37:46 +01:00
Bernhard Voelker
e89c998a9e chmod: output the original mode in verbose mode
* src/chmod.c (describe_change): Pass in the original mode,
and output this in the messages.
* tests/chmod/c-option: Adjust as per the new message.
* THANKS.in: Remove the now auto-generated name.
* NEWS: Mention the change in behavior.

Signed-off-by: Pádraig Brady <P@draigBrady.com>
2011-05-25 23:04:12 +01:00
Pádraig Brady
7d44751f0e split: fix cases where -n l/... creates extraneous files
* src/split.c (lines_chunk_split): Ensure that data is only
written to stdout when k specified.  Also ensure that
extra files are not created when there is more data available
than reported in the file size.
* tests/misc/split-lchunk: Verify that split -n l/k/n doesn't
generate any files, and that -n l/n always generates n files.
* NEWS: Mention the fix.
2011-05-24 16:29:48 +01:00
Jim Meyering
cb4a0e31e2 maint: correct typos involving misuse of "a" and "an"
* NEWS: "an misleading"
* src/expr.c: "a integer
* src/ptx.c (find_occurs_in_text): "a end"
* src/shred.c (do_wipefd): "a infinite"
* src/sort.c (SUBTHREAD_LINES_HEURISTIC): "an dual-core"
(compare_random): "an checksum"
* cfg.mk (old_NEWS_hash): Update, since the typo was in old news.
2011-05-19 21:36:33 +02:00
Pádraig Brady
beaa949313 printf: fix an out-of-bounds memory access
* src/printf.c (STRTOX): Don't access memory after a
string containing a single quote character.
* tests/misc/printf: Add tests for various combinations
of single quote characters combined with a numeric format.
* THANKS.in: Add bug reporter.
* NEWS: Mention the fix.

Reported-by: Paul Marinescu <paul.marinescu@imperial.ac.uk>
2011-05-18 07:33:04 +01:00
Pádraig Brady
27873f1deb shuf: use memory more efficiently when returning a subset
* gl/lib/randperm.c (randperm_new): When the number of items
to return H, is much smaller than the total number of items N,
use a hash to represent the sparse permutations of the set N.
This is currently enabled for N > 128K and N/H > 32.
* tests/misc/shuf: Ensure shuf can quickly return 2 numbers
from a large range.
* gl/modules/randperm: Depend on hash.
* NEWS: Mention the change.
2011-05-14 10:30:12 +01:00
Jim Meyering
09baf2287e doc: document split's new --filter=CMD option
* doc/coreutils.texi (split invocation): Describe --filter=CMD.
* NEWS (New feature): Mention it.
2011-05-06 22:54:51 +02:00
Jim Meyering
e3f814a773 post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2011-04-26 16:18:02 +02:00
Jim Meyering
8c6a1d1281 version 8.12
* NEWS: Record release date.
2011-04-26 16:00:50 +02:00
Jim Meyering
740516cd12 dd: work around compilation failure on AIX 5.1 and 5.2
* src/dd.c (O_NOCACHE): Undefine.  This symbol is defined
via AIX's <fcntl.h>, yet used as an enum name in dd.c.
Reported by Gary V. Vaughan in http://debbugs.gnu.org/8555
* NEWS (Portability): Mention this.
2011-04-26 09:27:44 +02:00
Jim Meyering
61de57cd23 tail --follow=name no longer implies --retry
* src/tail.c (tail_forever_inotify): Just as without inotify,
tail --follow=name now terminates when the last tailed-by-name file
is unlinked or moved aside.  This bug was introduced on 2009-06-15
via commit ae494d4b, "tail: use inotify if it is available".
Reported by Tim Underwood in
http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/22286
* NEWS (Bug fixes): Mention this.
* tests/tail-2/follow-name: Test for this.
* tests/Makefile.am (TESTS): Add it.
2011-04-25 10:59:15 +02:00
Jim Meyering
18a474d755 copy: use FIEMAP (extent_copy) only for apparently-sparse files,
to avoid the expense of extent_copy's unconditional use of
FIEMAP_FLAG_SYNC.
* src/copy.c (copy_reg): Do not attempt extent_copy on a file
that appears to have no holes.
* NEWS (Changes in behavior): Document this.  At first I labeled this
as a bug fix, but that would be inaccurate, considering there is no
documentation of FIEMAP semantics, nor even consensus among kernel
FS developers.  Here's hoping SEEK_HOLE/SEEK_DATA support will soon
make it into the linux kernel.
2011-04-20 18:48:48 +02:00
Jim Meyering
5995ed0b38 post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2011-04-13 21:32:49 +02:00
Jim Meyering
8dc5394183 version 8.11
* NEWS: Record release date.
2011-04-13 21:13:50 +02:00
Pádraig Brady
ace9ef2a94 maint: mention dd's new partial read warning in NEWS
* NEWS: Mention the new feature, from commits e1788d9e and 194c1e89
2011-04-13 15:38:36 +01:00
Jim Meyering
4db3c6b5ea doc: tweak NEWS
* NEWS: Slightly obfuscate a line to avoid a false-positive
doubled-word ("is-is") match.
Fix a grammar error in news for 8.2.
* cfg.mk (old_NEWS_hash): Resync.
2011-04-11 14:32:56 +02:00
Jim Meyering
b80e2c7c25 maint: install: remove support for --preserve_context ("_", not "-")
* src/install.c: Its use has elicited a warning for two years.
Use --preserve-context instead.
* NEWS (changes in behavior): Mention this.
2011-04-11 14:32:56 +02:00
Pádraig Brady
80be785c95 maint: misc typo fixes
* src/fiemap.h: s/can not/cannot/
* NEWS: s/in/is/
* doc/coreutils.texi: Remove spurious "and".
s/effect/affect/
Use matched ``...'' quotes.
2011-04-11 11:13:14 +02:00
Pádraig Brady
324571ea4a maint: correct kernel version in NEWS
* NEWS: Adjust to match commit 1c3654cb, 2011-04-02,
"copy: require fiemap sync also for 2.6.38 kernels"
2011-04-07 00:23:00 +01:00
Pádraig Brady
bfdb6b585b copy: process empty extents more efficiently
* src/copy.c (extent_copy): Treat an allocated but empty extent
much like a hole.  I.E. don't read data we know is going to be NUL.
Also we convert the empty extent to a hole only when SPARSE_ALWAYS
so that the source and dest have the same allocation.  This will
be improved soon, when we use fallocate() to do the allocation.
* tests/cp/fiemap-empty: A new test for efficiency and correctness
of copying empty extents.
* tests/Makefile.am: Reference the new test.
* NEWS: Mention the change in behavior.
2011-04-01 15:04:18 +01:00
Pádraig Brady
b56b53bd70 copy: protect against overlapping extents
* src/extent-scan.c (extent_scan_read): Add a more stringent check
for OFF_T overflow, to ensure subsequent code is immune.
Detect overlapping extents and adjust, so as files always copied.
Detection using a single scan with fallback to a standard copy
was thought too expensive in memory or time.
* NEWS: Mention the fix
2011-04-01 14:42:46 +01:00
Pádraig Brady
594292a1d8 copy: link rather than copy symlinks, when --link used
This bug was introduced in commit ca9e212c, 2009-09-24,
"cp, mv: use linkat to guarantee semantics", which
inadvertently disabled the creation of hardlinks to symlinks.
However rather than implementing the intention of that commit
and relying on gnulib linkat emulation, we'll revert to the
previous emulation as that maintains ownership and timestamps.

* src/copy.c (copy_internal): Use our existing hardlink to
symlink emulation when link() might dereference the symlink.
Also ensure that we copy the timestamps of the original symlink
when we use the emulation.
* tests/cp/link-symlink: Add a test to ensure timestamps copied.
* tests/Makefile.am: Reference the new test.
* NEWS: Mention the fix.
Reported by Ruediger Meier
2011-04-01 14:17:27 +01:00
Pádraig Brady
f69876e558 copy: with fiemap copy, only sync when needed
* src/extent-scan.h (struct extent_scan): Add the fm_flags member to
pass to the fiemap scan.
* src/extent-scan.c (extent_need_sync): A new function used to
detect Linux kernels before 2.6.38.
(extent_scan_init): Add FIEMAP_FLAG_SYNC when needed.
* tests/cp/sparse-fiemap: Adjust comment.
* NEWS: Mention the change in behavior.
Indirectly suggested by Mike Frysinger
2011-03-31 16:46:42 +01:00
Pádraig Brady
99679fff62 df: fix alignment of columns
* src/df.c (alloc_table_row): A new function to allocate storage
for a row of strings.
(print_table): A new function to interate over all stored strings in
the table, and apply alignment honoring the max width of each column.
(get_header): Renamed from print_header, and adjusted accordingly.
(get_dev): Renamed from show_dev.  Also we no longer wrap longer
device names over two lines, which can be an unexpected issue for
scripts parsing the output from df.
(get_disk): s/show_/get_/
(get_point): Likewise.
(get_entry): Likewise.
(get_all_entries): Likewise.
* NEWS: Mention the change.
2011-03-23 16:44:49 +00:00
Jim Meyering
b3f6b33e4b tests: exercise tests new "==" operator
* tests/misc/test: Exercise the new operator.
* NEWS (Changes in behavior): Mention it.
2011-03-22 07:13:59 +01:00
Jim Meyering
56e8714e2b touch: update to latest gnulib to fix Solaris 10 touch segfault
* gnulib: Update to latest, to address http://debbugs.gnu.org/8230.
When built on Solaris 9 and run on Solaris 10, touch would segfault.
Reported by Ben Walton.
* bootstrap: Update from gnulib.
* tests/init.sh: Likewise.
* NEWS (Bug fixes): Mention this.
2011-03-13 18:41:44 +01:00
Jim Meyering
e0245ae0ae sort: spawn fewer threads for small inputs
* src/sort.c (SUBTHREAD_LINES_HEURISTIC): Do not spawn a new thread
for every 4 lines.  Increase this from 4 to 128K.  128K lines seems
appropriate for a 5-year-old dual-core laptop, but it is too low for
some common combinations of short lines and/or newer systems.
* NEWS (Bug fixes): Mention it.
2011-03-13 18:13:17 +01:00
Pádraig Brady
5f3115535b dd: add a flag to discard cached data
* src/dd.c (FFS_MASK): A new macro (Find First Set) refactored
from the following enum as it's now used twice.
(usage): Mention the new 'nocache' flag.
(cache_round): A new function to help ignore requests
to drop cache, that are less than page_size.
(invalidate_cache): A new function to call posix_fadvise()
with the appropriate offset and length.  Note we don't
use fdadvise() so we can detect errors when count=0.
(dd_copy): Call invalidate_cache() for the portions read.
(iwrite): Likewise for the portions written.
(main): Call invalidate_cache for page_size slop or
for full file when count=0.
* cfg.mk (sc_dd_O_FLAGS): Adjust to pass.
* doc/coreutils.texi (dd invocation): Describe the 'nocache' flag,
and give some examples of how it can be used.
* tests/dd/nocache: A new test.
* tests/Makefile.am: Reference the new test.
* NEWS: Mention the new feature.
2011-03-05 02:33:53 +00:00
Jim Meyering
caaf2899f6 du: don't infloop for --files0-from=DIR
* src/du.c (main): Fail on AI_ERR_READ error, rather than merely
diagnosing and continuing.  Based on a patch by Stefan Vargyas.
Also move the handling of AI_ERR_EOF into the case stmt.
Do not report ferror/fclose(stdin) failure when we've
already diagnosed e.g., failure to read the DIR, above.
Bug introduced by 2008-11-24 commit 031e2fb5, "du: read and
process --files0-from= input a name at a time,".
* src/wc.c: Handle read failure as with du: do not exit
immediately, but rather go on to print any total and to clean-up.
As above, move the handling of AI_ERR_EOF into the case stmt.
* tests/du/files0-from-dir: New file, to test both du and wc.
* tests/Makefile.am (TESTS): Add it.
* NEWS (Bug fixes): Mention it.
2011-03-03 09:05:44 +01:00
Jim Meyering
7cfd12c78e wc: avoid NULL dereference on out-of-memory error
* src/wc.c (main): Diagnose failed argv_iter_init_* failure,
rather than falling through and dereferencing NULL.
Bug introduced by 2008-11-25 commit c2e56e0d,
"wc: read and process --files0-from= input a name at a time,".
* NEWS (Bug fixes): Mention it.
2011-03-03 09:01:17 +01:00
Jim Meyering
2e636af1ef cut: don't segfault for large unbounded range
* src/cut.c (set_fields): When computing the maximum range endpoint,
take into consideration the start of any unbounded range, like "999-".
* NEWS (Bug fixes): Mention it.
* tests/misc/cut (big-unbounded-b,c,f): Add tests.
Reported by Paul Marinescu in http://debbugs.gnu.org/7993
The bug was introduced on 2004-12-04 via commit 7380cf79.
2011-02-07 09:25:51 +01:00
Jim Meyering
661413d8c3 post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2011-02-04 18:19:36 +01:00
Jim Meyering
ca637bff0e version 8.10
* NEWS: Record release date.
2011-02-04 18:08:12 +01:00
Jim Meyering
5b11cd0179 doc: NEWS: mention cp's improvement
* NEWS (New Features): cp now copies sparse files efficiently.
2011-01-30 21:30:35 +01:00
Pádraig Brady
877ca5bf85 join: don't report disorder against an empty file
This allows one to use join as a field extractor like:
  join -a1 -o 1.3,1.1 - /dev/null

* src/join.c (join): Don't flag unpairable lines when
one of the files is empty.
* tests/misc/join: Add a new test for empty input, and adjust
a previous test that was only checking against empty input.
* doc/coreutils.texi (join invocation): Document the change.
* NEWS: Likewise.
2011-01-29 23:39:16 +00:00
Pádraig Brady
32626bde6d join: ensure --header skips the order check with empty files
* src/join.c: Skip the header even if one of the files is empty.
* tests/misc/join: Add a test case.
* NEWS: Mention the fix
2011-01-29 23:33:25 +00:00
Pádraig Brady
d4db0cb182 join: add -o 'auto' to output a constant number of fields per line
Lines with a different number of fields than the first line,
will be truncated or padded.

* src/join.c (prfields): A new function refactored from prjoin(),
to output all but the join field.
(prjoin): Don't swap line1 and line2 when line1 is blank
so that the padding is applied to the right place.
(main): Handle the -o 'auto' option.
* tests/misc/join: Add 6 new cases to test the auto format.
* NEWS: Mention the change in behavior.
Suggestion from Assaf Gordon
2011-01-29 23:08:31 +00:00
Jim Meyering
34ece0b0a1 doc: update NEWS
* NEWS: Note when the uniq bug was introduced.
It was mine, commit 1d9b3de9, "uniq: remove redundant test".
2011-01-18 09:45:00 +01:00
Sami Kerola
aa9f02bc30 uniq: don't continue field processing after end of line
* NEWS (Bug fixes): Mention it.
* src/uniq.c (find_field): Stop processing loop when end of line
is reached.  Before this fix, 'uniq -f 10000000000 /etc/passwd'
would run for a very long time.
2011-01-17 19:07:58 +01:00
Nadav Har'El
731f957965 rm: ignore errno related to invalid file names
* src/remove.c (nonexistent_file_errno): Also skip EINVAL and
EILSEQ, for at least smbfs rejection of '*' in file names.
* NEWS: Mention the fix.
2011-01-11 11:48:53 -07:00
Jim Meyering
1c5987d2ef du: don't abort when a subdir is renamed during traversal
* NEWS (Bug fixes): Mention it.
* src/du.c (prev_level): Move declaration "up" to file-scope global.
(du_files): Reset prev_level to 0 upon abnormal fts_read termination.
Reported by Johathan Nieder in http://bugs.debian.org/609049
Also, improve a diagnostic.
* tests/du/move-dir-while-traversing: Test for the above.
* tests/Makefile.am (TESTS): Add it.
2011-01-10 07:49:55 +01:00
Jim Meyering
d6df8901bc post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2011-01-04 12:56:30 +01:00
Jim Meyering
b44b8f2b7d version 8.9
* NEWS: Record release date.
2011-01-04 12:18:32 +01:00
Jim Meyering
9d6231ef2a maint: update all copyright year number ranges
Run "make update-copyright".
2011-01-01 22:16:47 +01:00
Pádraig Brady
44dbcae6b9 split: fix the suffix length calculation
* src/split.c (set_suffix_length): Only auto-calculate
the suffix length when the number of files is specified.
* tests/misc/split-a: Add a case to trigger the bug,
and exercise the suffix length auto-calculation.
* NEWS: Mention the fix.
Reported by Dmitry V. Levin and Sergey Vlasov at
https://bugzilla.altlinux.org/show_bug.cgi?id=24841
2010-12-30 16:26:20 +00:00
Jim Meyering
8f90efd006 post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2010-12-22 18:19:37 +01:00
Jim Meyering
518b92a5e3 version 8.8
* NEWS: Record release date.
2010-12-22 17:43:50 +01:00
Pádraig Brady
0e181024c0 sort: use at most 8 threads by default
* src/sort.c (main): If --parallel isn't specified,
restrict the number of threads to 8 by default.
If the --parallel option is specified, then
allow any number of threads to be set, independent
of the number of processors on the system.
* doc/coreutils.texi (sort invocation): Document the changes
to determining the number of threads to use.
Mention the memory overhead when using multiple threads.
* tests/misc/sort-spinlock-abuse: Allow single core
systems that support pthreads.
* tests/misc/sort-stale-thread-mem: Likewise.
* tests/misc/sort-unique-segv: Likewise.
* NEWS: Mention the change in behaviour.
2010-12-19 00:33:45 +00:00
Paul Eggert
8e81a99c26 sort: do not generate thousands of subprocesses for 16-way merge
Without this change, tests/misc/sort-compress-hang would consume
more than 10,000 process slots on my RHEL 5.5 x86-64 server,
making it likely for other applications to fail due to lack of
process slots.  With this change, the same benchmark causes 'sort'
to consume at most 19 process slots.  The change also improved
wall-clock time by 2% and user+system time by 14% on that benchmark.
* NEWS: Document this.
* src/sort.c (MAX_PROCS_BEFORE_REAP): Remove.
(reap_exited): Renamed from reap_some; this is a more accurate name,
since "some" incorrectly implies that it reaps at least one process.
All uses changed.
(reap_some): New function: it *does* reap at least one process.
(pipe_fork): Do not allow more than NMERGE + 2 subprocesses.
(mergefps, sort): Omit check for exited processes: no longer needed,
and anyway the code consumed too much CPU per line when 2 < nprocs.
2010-12-16 22:32:06 -08:00
Paul Eggert
1b31ce6982 sort: fix hang with sort --compress
* NEWS: Document this.
* src/sort.c (UNCOMPRESSED, UNREAPED, REAPED): New constants.
(struct tempnode): New member 'state', to hold these constants.
The pid member is now undefined if state == UNCOMPRESSED.
(struct sortfile): Replace member 'pid' with member 'temp'.
(uintptr): Remove.
(proctab_hasher, proctab_comparator, register_proc, delete_proc):
Proctab entries are now struct tempnode *, not pid_t, to handle
the case where multiple tempnode objects correspond to the same
pid.  This avoids a race condition that can cause a hang.
(register_proc): Arg is now struct tempnode *, not pid_t.  All
callers changed.
(delete_proc): Set tempnode state to REAPED.
(create_temp_file): No need to set pid member here; it's now
done when the pid is known.
(maybe_create_temp, create_temp): Remove PPID arg.  Return struct
tempnode *, not char *.  All callers changed.
(maybe_create_temp): Set node state to UNCOMPRESSED or UNREAPED.
No need to set node->pid to 0.
(open_temp): Replace NAME and PID args with a single TEMP arg.
All callers changed.  Wait only for unreaped children.
(zaptemp): Wait for decompressor to finish before removing its
temporary-file input.  This avoids .nfsXXXX hassles with NFS
and fixes a race (leading to a hang) regardless of NFS.
(open_input_files): Adjust to new way of dealing with temp files
and their subprocesses.
* tests/Makefile.am (TESTS): Add misc/sort-compress-hang.
* tests/misc/sort-compress-hang: New file.
2010-12-16 13:55:31 -08:00
Paul Eggert
f3c584d1e0 sort: don't dump core when merging from input twice
* NEWS: Document this.
* src/sort.c (avoid_trashing_input): The previous fix to this
function didn't fix all the problems with this code.  Replace it
with something simpler: just copy the input file.  This doesn't
change the number of files, so return void instead of the updated
file count.  Caller changed.
* tests/misc/sort-merge-fdlimit: Test for the bug.
2010-12-16 00:04:32 -08:00
Paul Eggert
8f40ed634c sort: document --compress reaper fixes
* NEWS: Document the --compress reaper fixes installed yesterday.
2010-12-14 10:22:04 -08:00
Jim Meyering
ad61335bf8 sort: avoid segfault when using two or more threads
This change does not fix the actual bug.  That was done by commit
c9db0ac6, "sort: preallocate merge tree nodes to heap".  The fix
was to store each "node" structure on the heap, not on the stack.
Otherwise, a node from one thread's stack could be used in another
thread after the first thread had expired (via pthread_join).
This bug was very hard to trigger when using spinlocks, but
easier once we began using mutexes.
* NEWS (Bug fixes): Mention it.
For details, see http://debbugs.gnu.org/7597.
2010-12-11 11:52:24 +01:00
Chen Guo
621876ff44 sort: use mutexes, not spinlocks (avoid busy loop on blocked output)
Running a command like this on a multi-core system
  sort < big-file | less
would peg all processors at near 100% utilization.
* src/sort.c: (struct merge_node) Change member lock to mutex.
All uses changed.
* tests/Makefile.am (XFAIL_TESTS): Remove definition, now that
this test passes once again.  I.e., the sort-spinlock-abuse test
no longer fails.
* NEWS (Bug reports): Mention this.
Reported by DJ Lucas in http://debbugs.gnu.org/7489.
2010-12-11 00:29:13 -08:00
Paul Eggert
b5a25a996d cp: fix bug with fine-grained src to nearby coarse-grained dest
The actual fix is in gnulib's lib/utimecmp.c.
* NEWS: Document fix.
2010-12-03 09:56:32 -08:00
Paul Eggert
3afda5f007 sort -u: fix a thread-race pointer corruption bug
* src/sort.c (write_unique): Save the entire "struct line", not
just a pointer to one.  Otherwise, with a multi-thread run,
sometimes, with some inputs, fillbuf would would win a race
and clobber a "saved->text" pointer in one thread just before
it was dereferenced in a comparison in another thread.
* NEWS (Bug fixes): Mention it.
2010-12-01 07:13:06 +01:00
Chen Guo
be107398e5 split: add --number to generate a particular number of files
* src/split.c (usage, long_options, main): New options --number,
--unbuffered, --elide-empty-files.
(set_suffix_length): New function to auto increase suffix length
to handle a specified number of files.
(create): New function.  Refactored from cwrite() and ofile_open().
(bytes_split): Add max_files argument to support byte chunking.
(lines_chunk_split): New function.  Split file into chunks of lines.
(bytes_chunk_extract): New function.  Extract a chunk of file.
(of_info): New struct.  Used by functions lines_rr and ofile_open
to keep track of file descriptors associated with output files.
(ofile_open): New function.  Shuffle file descriptors when there
are more output files than available file descriptors.
(lines_rr): New function to distribute lines round-robin to files.
(chunk_parse): New function.  Parses K/N syntax.
* tests/misc/split-bchunk: New test for byte chunking.
* tests/misc/split-lchunk: New test for line delimited chunking.
* tests/misc/split-rchunk: New test for round-robin chunking.
* tests/Makefile.am: Reference new tests.
* tests/misc/split-fail: Add failure scenarios for new options.
* tests/misc/split-l: Fix a typo. s/ln/split/.
* doc/coreutils.texi (split invocation): Document --number.
* NEWS: Mention the new feature.
* .mailmap: Map new email address for shortlog.

Signed-off-by: Pádraig Brady <P@draigBrady.com>
2010-11-22 01:45:15 +00:00
Jim Meyering
c2bdd17856 maint: avoid NEWS-related syntax-check failure
* NEWS: Add 2nd blank line to separate latest changes from
those of 8.7, to avoid syntax-check failure.
2010-11-18 21:16:27 +01:00
Paul Eggert
a71c22fdf0 od: fix bugs in displaying floating-point values
* NEWS: Describe patch.
* bootstrap.conf (gnulib_modules): Add ftoastr.
* src/od.c: Include ftoastr.h, not float.h.
(FLT_DIG, DBL_DIG): Remove.  No need to verify LDBL_DIG.
(FMT_BYTES_ALLOCATED): No need to worry about floating point now,
since this format is no longer used for floating point.
(PRINT_FIELDS): New macro, with most of the guts of the old PRINT_TYPE.
(PRINT_TYPE): Rewrite to use PRINT_FIELDS.
(PRINT_FLOATTYPE): New macro.  This uses the new functions from
ftoastr.
(print_float, print_double, print_long_double): Reimplement
using PRINT_FLOATTYPE.
(decode_one_format): Calculate field widths based on ftoastr-supplied
macros.
* tests/Makefile.am (TESTS): Add misc/od-float.
* tests/misc/od-float: New file.
2010-11-18 09:51:04 -08:00
Paul Eggert
f70c7b785b doc: tweak NEWS and coreutils.texi
* doc/coreutils.texi (stat invocation): Add sentence-ending period.
* NEWS: Correct stat change description: s/floating point //.
* cfg.mk (old_NEWS_hash): Update, to match this NEWS change.
2010-11-13 22:02:29 +01:00
Jim Meyering
ee6f187b18 post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2010-11-13 17:37:18 +01:00
Jim Meyering
e143ba52c4 version 8.7
* NEWS: Record release date.
2010-11-13 17:21:08 +01:00
Jim Meyering
4a8e9bf14c stat: do not provide variable precision time stamps
* src/stat.c: Don't include fstimeprec.c.
(out_epoch_sec): Don't call fstimeprec.
* NEWS: Update description.
* doc/coreutils.texi: Likewise.
2010-11-13 11:40:52 +01:00
Pádraig Brady
0339eb4598 csplit: fix a memory leak per input buffer
* src/csplit.c (free_buffer): Also free the line offsets buffers
(remove_line): Also free the containing structure
* tests/misc/csplit-heap: A new test to trigger with leaks of
this magnitude.
* tests/Makefile.am: Reference the new test
* NEWS: Mention the fix
Reported by David Hofstee
2010-11-11 01:40:12 +00:00
Jim Meyering
0cfd4f2161 csplit: avoid buffer overrun when writing more than 999 files
Without this fix, seq 1000 | csplit - /./ '{*}' would write
the NUL-terminated file name, xx1000, into a buffer of size 6.
* src/csplit.c (main): Use properly sized file name buffer.
* NEWS (Bug fixes): Mention it.
* tests/misc/csplit-1000: New test to trigger the bug.
* tests/Makefile.am (TESTS): Add misc/csplit-1000.
2010-11-10 14:28:03 +01:00
Paul Eggert
c7375c236c stat: use e.g. %.3X instead of %X.%3:X for sub-second precision
* NEWS: Document this.
* doc/coreutils.texi (stat invocation): Likewise.
* gl/lib/fstimeprec.c, gl/lib/fstimeprec.h, gl/modules/fstimeprec:
* gl/modules/fstimeprec-tests, gl/tests/test-fstimeprec.c:
New files.
* bootstrap.conf (gnulib_modules): Add fstimeprec.
* src/stat.c: Include fstimeprec.h.  Don't include xstrtol.h.
(decimal_point, decimal_point_len): New static vars.
(main): Initialize them.
(epoch_sec, out_ns): Remove.
(out_int, out_uint): Now returns whatever printf returned.
(out_minus_zero, out_epoch_secs): New functions.
(print_stat): Use out_epoch_sec instead of out_ns and epoch_sec.
(print_stat, print_it, usage): Remove the %:X-style formats.
* tests/misc/stat-nanoseconds: Set TZ=UTC0 to avoid problems
with weird time zones.  Use a time stamp near the Epoch so that we
don't have to worry about leap seconds.  Redo test cases to match
new behavior.
* tests/touch/60-seconds: Change %Y.%:Y to %.9Y, to adjust to
new behavior.
2010-11-06 15:24:49 +01:00
Eric Blake
312549b627 cp: NEWS entry for previous fix
Resolves bug#7324

* NEWS: Document the extent of the Solaris crash.
2010-11-04 10:51:01 -06:00
Jim Meyering
db42ae787d stat: revert %X-%Y-%Z change; use e.g., %:X to print fractional seconds
This reverts part of the recent commit 9069af45,
"stat: print timestamps to full resolution", which made %X, %Y, %Z
print floating point numbers.  We prefer to retain portability of
%X, %Y and %Z uses, while still providing access to full-resolution
time stamps via modified format strings.  Also make the new
%W consistent.
* src/stat.c: Include "xstrtol.h".
(print_it): Accept a new %...:[XYZ] format directive,
e.g., %:X, to print the nanoseconds portion of the corresponding time.
For example, %3.3:Y prints the zero-padded, truncated, milliseconds
part of the time of last modification.
(print_it): Update print_func signature to match.
(neg_to_zero): New helper function.
(epoch_time): Remove function; replace with...
(epoch_sec): New function; use timetostr.
(out_ns): New function.  Use "09" only when no other modifier
is specified.
(print_statfs): Change type of "m" to unsigned int,
now that it must accommodate values larger than 255.
(print_stat): Likewise.
Map :X to a code of 'X' + 256.  Likewise for Y, Z and W.
(usage): Update.
* tests/touch/60-seconds: Use %Y.%:Y in place of %Y.
* tests/misc/stat-nanoseconds: New file.
* tests/Makefile.am (TESTS): Add it.
* NEWS (Changes in behavior): Mention this.
With improvements by Pádraig Brady.
Thanks to Andreas Schwab for raising the issue.
2010-11-03 13:10:50 +01:00
Pádraig Brady
883ac22239 cp: make --attributes-only override --reflink completely
* doc/coreutils.texi (cp invocation): Change the description slightly
so as users might not immediately discount using this option.
Mention that --reflink is overridden by the other linking options and
--attributes-only, and give an example where this might be useful.
* src/copy.c (copy_internal): Bypass the reflink if
--attributes-only is specifed.
* tests/cp/reflink-perm: Ensure both --reflink modes are
overridden by --attributes-only.
* NEWS: Mention the change in behavior.
Reported by Jim Meyering.
2010-10-27 11:18:51 +01:00
Pádraig Brady
c84ddbaa33 tail: support rechecking currently missing remote dirs
src/tail.c (main): As an optimization, don't bother checking
for stdin or remote files, when ---disable-inotify is specified.
To improve the fix in commit 61b77891, set the disable_inotify
flag when we fall back to polling, so that we recheck remote files.
NEWS: Mention the fix
2010-10-25 15:41:53 +01:00
Jim Meyering
6728401351 post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2010-10-15 17:06:56 +02:00
Jim Meyering
7612e5c5c6 version 8.6
* NEWS: Record release date.
2010-10-15 16:50:15 +02:00
Pádraig Brady
61b77891c2 tail: fix checking of currently unavailable directories
* src/tail.c (tail_forever_inotify): Handle the case where
tail --follow=name with inotify, is not able to add a watch on
a specified directory.  This may happen due to inotify resource
limits or if the directory is currently missing or inaccessible.
In all these cases, revert to polling which will try to reopen
the file later.  Note inotify returns ENOSPC when it runs out
of resources, and instead we report a particular error message,
lest users think one of their file systems is full.
(main): Document another caveat with using inotify, where we
currently don't recheck directories recreated after the
initial watch is setup.
* tests/tail-2/F-vs-rename: Fix the endless loop triggered by
the above issue.
* tests/tail-2/inotify-hash-abuse: Likewise.
* tests/tail-2/wait: Don't fail in the resource exhaustion case.
* tests/tail-2/F-vs-missing: A new test for this failure mode
which was until now just triggered on older buggy linux kernels
which returned ENOSPC constantly from inotify_add_watch().
* NEWS: Mention the fix.
2010-10-12 11:41:17 +01:00
Pádraig Brady
758916b49e split: fix reporting of read errors
The bug was introduced with commit 23f6d41f, 19-02-2003.

* src/split.c (bytes_split, lines_split, line_bytes_split):
Correctly check the return from full_read().
* tests/misc/split-fail: Ensure split fails when
it can't read its input.
* NEWS: Mention the fix.
2010-10-07 20:08:16 +01:00
Eric Blake
b7459696dc stat: drop %C support when printing file system details
* src/stat.c (print_statfs, usage): Drop %C, since it applies to
files, not file systems.
(out_file_context): Match style of other out_* functions.
(print_stat): Update caller.
* doc/coreutils.texi (stat invocation): Document %C.
* NEWS: Document the change.
2010-10-05 09:07:58 -06:00
Eric Blake
7a5ecae996 stat: print SELinux context when available
* src/stat.c (default_format): Include context when present.
* NEWS: Update blurb explaining the replacement for -Z.
2010-10-01 15:27:27 -06:00
Eric Blake
2c14ec962a stat: optimize and translate default format strings
Yes, this patch intentionally leaks the results of default_format(),
since it is called only twice, and since the results are in scope
until main() exits.  Not worth the extra code to pacify valgrind.

* src/stat.c (main): Hoist default format computation out of loop.
(do_statfs, do_stat): Move default format generation...
(default_format): ...into new function.  Allocate the result in
pieces, rather than repeating mostly-similar chunks.  Allow
translation of verbose format.  Pass a second format to do_stat,
for the one aspect of the default format that is conditional on
file type.
* NEWS: Document the translation aspect.
2010-10-01 15:24:39 -06:00
Eric Blake
9069af45e6 stat: print timestamps to full resolution
* src/stat.c (epoch_time): New function.
(print_stat): Use it for %[WXYZ].
* NEWS: Document this.
* tests/touch/60-seconds: Adjust test to match.
* tests/misc/stat-birthtime: Likewise.
2010-10-01 10:43:41 -06:00
Eric Blake
abe5c1f9bc stat: support printing birthtime
* src/stat.c (print_stat): New %w and %W formats.
(do_stat): Include %w in default format.
(usage): Document new specifiers.
* doc/coreutils.texi (stat invocation): Likewise.
* NEWS: Likewise.
2010-10-01 10:43:25 -06:00
Jim Meyering
65b50c6cdd maint: mention the du-exclude--vs--cycle-dir fix
* NEWS (Bug fixes): Mention the du-exclude--vs--cycle-dir fix.
Reported by Graham Cobb in http://bugs.debian.org/598438,
that bug was fixed by the 2010-07-24 commit, 77428214f,
"du: tune, and fix some -L bugs with dangling or cyclic symlinks"
2010-09-30 14:24:42 +02:00
Pádraig Brady
3f48829c29 tr: fix various issues with case conversion
This valid translation spec aborted:
  LC_ALL=en_US.iso-8859-1 tr '[:upper:]- ' '[:lower:]_'
This invalid translation spec aborted:
  LC_ALL=en_US.iso-8859-1 tr '[:upper:] '  '[:lower:]'
This was caused by commit 6efd1046, 05-01-2008,
"Avoid tr case-conversion failure in some locales"

This misaligned conversion spec was allowed:
  LC_ALL=C tr 'A-Y[:lower:]' 'a-z[:upper:]'
This was caused by commit af5d0c36, 21-10-2007,
"tr: do not reject an unmatched [:lower:] or [:upper:] in SET1"

This misaligned spec was allowed by extending the class:
  LC_ALL=C tr '[:upper:] ' '[:lower:]'

* src/tr.c (validate_case_classes): A new function to check
alignment of case conversion classes.  Also it adjusts the
length of the sets so that locales with different numbers of
upper and lower case characters, don't cause issues.
(string2_extend): Disallow extending the case conversion
class as in the above example.  That is locale dependent
and most likely not what the user wants.
(validate): Do the simple test for "restricted" char classes
earlier, so we don't redundantly do more expensive validation.
(main): Remove the case class validation, and simplify.
* tests/misc/tr-case-class: A new test to test the various
alignment and locale issues, associated with case conversion.
* tests/misc/tr: Move case conversion tests to new tr-case-class.
* tests/Makefile.am: Reference the new test.
* NEWS: Mention the fixes.
2010-09-29 11:05:12 +01:00
Eric Blake
95732b834e rm: remove no-op -d option
* src/rm.c (long_opts, main): Resolve a fixme.
* NEWS: Document the change.
Based on a report by William Plusnick.
2010-09-17 08:44:31 -06:00
Jim Meyering
777024889c tac: avoid double free
* src/tac.c (main): Reading a line longer than 16KiB would cause
tac to realloc its primary buffer.  Then, just before exit, tac
would mistakenly free the original (now free'd) buffer.
This bug was introduced by commit be6c13e7, "maint: always free a
buffer, to avoid even semblance of a leak".
* NEWS (Bug fixes): Mention it.
* tests/misc/tac (double-free): New test, to exercise this.
Reported by Salvo Tomaselli in <http://bugs.debian.org/594666>.
2010-08-28 19:28:20 +02:00
Aaron Burgemeister
ddf6fb8686 stat: add %m to output the mount point for a file
* src/find-mount-point.c: A new file refactoring
find_mount_point() out from df.c
* src/find-mount-point.h: Likewise.
* src/df.c: Use the new find-mount-point module.
* src/stat.c (print_stat): Handle the new %m format.
(find_bind_mount): A new function to
return the bind mount for a file if any.
(out_mount_mount): Print the bind mount for a file, or else
the standard mount point given by the find-mount-point module.
(usage): Document the %m format directive.
* src/Makefile.am: Reference the refactored find-mount-point.c
* po/POTFILES.in: Add find_mount_point.c to the translation list
* doc/coreutils.texi (stat invocation): Document %m,
and how it may differ from the mount point that df outputs.
* test/misc/stat-mount: A new test to correlate mount points
output from df and stat.
* tests/Makefile.am: Reference the new test.
* NEWS: Mention the new feature
* THANKS: Add the author

Signed-off-by: Pádraig Brady <P@draigBrady.com>
2010-08-27 22:16:10 +01:00
Pádraig Brady
0380e4c98e df: always print the device name for bind mounted files
* src/df (show_point): Remove the optimization for comparing
the specified path with the device name, as this produces
inconsistent results in the presence of bind mounts.  For bind
mounts, the device name is populated with the bind mount target.
* NEWS: Mention the change in behavior.
2010-08-25 23:02:55 +01:00
Paul Eggert
b877ea4b3e sort: support all combinations of -d, -f, -i, -R, and -V
* NEWS: Document this.
* src/sort.c (getmonth): Omit LEN arg, as MONTH is now null-terminated.
(compare_random): Don't null-terminate keys, as caller now does that.
(compare_version): Remove.
(debug_key): Null-terminate string for getmonth.
(keycompare): Support combining -R with any of -d, -f, -i, -V.
Also, support combining -V with any of -d, -i.
(check_ordering_compatibility): Allow newly-supported combinations.
* tests/misc/sort (02q, 02r, 02s): New tests, for new combinations.
(incompat2): Now test -nR, since -fR are now compatible.
2010-08-06 21:30:50 -07:00
Paul Eggert
94615d2acf sort: revert recent -h changes and use a more-conservative approach
* NEWS: Document changes to sort -h, which are now minor with
respect to the pre-July-30th version.
* doc/coreutils.texi (sort invocation): Likewise.  The
documentation now describes how -h comparison is done rather than
being vague with border cases.
* src/sort.c (long_double, strtold): Move back to general_numcompare.
(LD, compute_human): Remove.
(find_unit_order): Remove THOU_SEP parameter, since thousands
separators are now allowed by all callers.  Revert to previous
behavior of sorting by suffix, and returning the order rather than
2 * order + binary, since we no longer care whether binary powers
are being used.  However, treat all zeros the same, instead of
sorting 0M before 0G; this is more consistent with the desired
behavior of sorting -1G before -1M.
* tests/misc/sort (h1, h3, h6): Adjust to match mostly-reverted
behavior.  However, check that all zeros sort together.
* tests/misc/sort-debug-keys: Omit a "_", since the trailing "i"
in "1234Gi" is no longer part of the key.
2010-08-02 19:21:02 -07:00
Paul Eggert
abd040180e sort: -h now handles comparisons such as 6000K vs 5M and 5MiB vs 5MB
* NEWS: Document changes to sort -h.
* doc/coreutils.texi (sort invocation): Likewise.
* src/sort.c (long_double, strtold): Move to prelude, since they're
now used by multiple functions.
(LD): New macro.
(struct keyfield.iec_present): Remove this member.  All uses removed.
(check_mixed_SI_IEC): Remove.  This code was busted in the presence
of multiple threads, as it had a race condition.
(find_unit_order): Remove arg KEY; add arg THOU_SEP; arg ENDPTR is
now char ** rather than char const **.  Return an integer that
distinguishes decimal from binary powers.  Parse the number
consistently with the intersection of strtold and strnumcmp.
Set *ENDPTR unconditionally.
(compute_human): New static function.
(human_numcompare): Remove arg KEY.  Remove 'const' from other args.
Use strnumcmp if possible, but fall back on floating point if not.
(numcompare, general_numcompare): Arg EA is now char ** rather
than char const **.
(numcompare): Adjust to new find_unit_order signature and behavior.
(keycompare): Adjus to new human_numcompare signature.
* tests/misc/sort (h1, h3, h4, h6): Adjust to new behavior.
* tests/misc/sort-debug-keys: Likewise.
2010-07-30 01:53:46 -06:00
Paul Eggert
01ca128807 du: add NEWS entry for recent du -L fixes 2010-07-25 10:53:42 -07:00
Pádraig Brady
4332538dbb maint: reorganize latest NEWS
* NEWS: Add another blank line before the previous version.
(Bug fixes): Move to the start.
(Changes in behavior): Add the item about the du mem usage change
from the "New features" section.
2010-07-13 19:05:31 +01:00
Chen Guo
9face836f3 sort: parallelize internal sort
This patch is by Gene Auyeung, Chris Dickens, Chen Guo, and Mike
Nichols, based off of a patch by Paul Eggert, Glen Lenker, et. al.,
with a basic heap implementation based off of the GDSL heap,
originally by Nicolas Darnis.

The number of sorts done in parallel is limited to the number
of available processors by default, or can be further restricted
with the --parallel option.

On a dual-die, 8 core Intel Xeon, results show sorting with
8 threads is almost 4 times faster than using a single thread.
Timings when sorting a 96MB file:
THREADS     TIME (s)
1            5.10
2            2.87
4            1.75
8            1.31

Single threaded sorting has also been improved,
especially for cheaper comparison operations:
COMMAND             BEFORE (s)  AFTER (s)
sort                 8.822       8.716
sort -g             10.336      10.222
sort -n              3.077       2.961
LANG=C sort          2.169       2.066

* bootstrap.conf: Add heap, pthread.
* coreutils.texi (sort): Describe the new --parallel option.
* gl/lib/heap.c: New file. Very basic heap implementation.
* gl/lib/heap.h: New file.
* gl/modules/heap: New file.
* src/Makefile.am: Add LIB_PTHREAD.
* src/sort.c: Include heap.h, nproc.h, pthread.h.
(MAX_MERGE): New macro.
(SUBTHREAD_LINES_HEURISTIC, PARALLEL_OPTION): New constants.
(MERGE_END, MERGE_ROOT): New constants.
(struct merge_node): New struct.
(struct merge_node_queue): New struct.
(sortlines temp): Remove declaration.
(usage, long_options, main): New option, --parallel.
(specify_nthreads): New function.
(mergelines): New signature, to emphasize the fact that the HI area
must be part of the destination.  All callers changed.
(sequential_sort): New function, renamed from sortlines. Merge in
the functionality of sortlines_temp.
(compare_nodes): New function.
(lock_node, unlock_node): New functions.
(queue_destroy): New function.
(queue_init): New function.
(queue_insert): New function.
(queue_pop): New function.
(write_unique): New function.
(mergelines_node): New function.
(check_insert): New function.
(update_parent): New function.
(merge_loop): New function.
(sortlines): Rewrite to support and use parallelism, with a new
signature. All callers changed.
(struct thread_args): New struct.
(sortlines_thread): New function.
(sortlines_temp): Remove.
(sort): New argument NTHREADS. All uses changed. Output moved to
mergelines_node.
(main): disable threading if we are sorting at random.
* tests/Makefile.am (TESTS): Add misc/sort-benchmark-random.
* tests/misc/sort-benchmark-random: New file.

Signed-off-by: Pádraig Brady <P@draigBrady.com>
2010-07-13 01:44:46 +01:00
Jim Meyering
4cb8268024 du: use less than half as much memory when tracking hard links
When processing a hard-linked file, du must keep track of the file's
device and inode numbers in order to avoid counting its storage
more than once.  When du would process many hard linked files --
as are created by some backup tools -- the amount of memory required
for the supporting data structure could become prohibitively large.
This patch takes advantage of the fact that the amount of information
in the numbers of the typical dev,inode pair is far less than even
32 bits, and hence usually fits in the space of a pointer, be it
32 or 64 bits wide.  A typical du traversal examines files on no
more than a handful of distinct devices, so the device number can
be encoded in just a few bits.  Similarly, few inode numbers use
all of the high bits in an ino_t.  Before, we would represent the
dev,inode pair using a naive struct, and allocate space for each.
Thus, an entry in the hash table consisted of a pointer (to that
struct) and a "next" pointer.  With this change, we encode the
dev,inode information and put those bits in place of the pointer,
and thus do away with the need to allocate additional space for
each dev,inode pair.

* src/du.c: Include "di-set.h".
Don't include "hash.h"; it's no longer used.
(INITIAL_DI_SET_SIZE): Define.
(di_set): New global, to replace "htab".
(entry_hash, entry_compare, hash_init): Remove functions.
(hash_ins): Use di-set functions, rather than ones from the hash module.
(main): Likewise.
* bootstrap.conf (gnulib_modules): Add the new di-set module.
* NEWS (New features): Mention it.
2010-07-04 08:40:40 +02:00
Paul Eggert
efe53cc72b du: don't miscount duplicate directories or link-count-1 files
* NEWS: Mention this.
* src/du.c (hash_all): New static var.
(process_file): Use it.
(main): Set it.
* tests/du/hard-link: Add a couple of test cases to help make
sure this bug stays squashed.
* tests/du/files0-from: Adjust existing tests to reflect
change in semantics with duplicate arguments.
2010-07-03 10:28:08 +02:00
Pádraig Brady
1af81dfb4d cp: add an option to only copy the file attributes
* src/copy.c (copy_attr): A new function which merges copy_attr_by_fd
and copy_attr_by_name.  Also display all errors when --attributes-only
* src/copy.c (copy_reg): Skip copying the file contents if specified.
Refactor the SELinux error handling code a little and display all
SELinux errors when only copying attributes.
* src/copy.h (struct cp_options): Add a data_copy_required boolean
* src/cp.c (main): Default to copying data but don't if specified
* src/install.c: Default to copying data
* src/mv.c: Likewise
tests/cp/reflink-perm: Add a test to check that --attributes-only
does not copy data
* tests/cp/acl: Likewise. Also refactor to remove redundant
acl manipulation
* doc/coreutils.texi (cp invocation): Describe the new option
* NEWS: Mention the new feature
2010-07-01 14:33:27 +01:00
Pádraig Brady
8aa15b2be2 ls: use the POSIX date style when the locale does not specify one
Previously we defaulted to "long-iso" format in locales without
specific format translations, like the en_* locales for example.
This reverts part of commit 6837183d, 08-11-2005, "ls ... acts like
--time-style='posix-long-iso' if the locale settings are messed up"
* src/ls.c (decode_switches): Only use the ISO format when specified.
* NEWS: Mention the change in behavior.
Reported by Daniel Qarras at http://bugzilla.redhat.com/525134
2010-07-01 13:12:52 +01:00
Jim Meyering
13f323786c stat: remove support for deprecated --context (-Z) option
* src/stat.c (main): Remove support for the --context (-Z) option.
In upstream releases this option has always been a no-op.  It was
first ignored for compatibility, and since the June 2008 commit,
574f7614 (coreutils-7.0), its use has evoked a warning.
* NEWS (Changes in behavior): Mention it.
2010-06-22 11:42:34 +02:00
Jim Meyering
d5a5d83094 touch: remove support for --file=REF_FILE option
* src/touch.c (main): Remove support for the deprecated, long-named
--file option, which is an alternate name for --reference (-r).
That option was undocumented with the arrival of --reference, in
the 1995-10-29 commit, 8b92864e1d.  Since the 2009-02-09 commit,
ed85df444a, use of --file has elicited a warning.  Not only was
this code due for removal, but the long-name-use-detecting code
was buggy in that it would use a stale or uninitialized "long_idx",
as reported by Robin H. Johnson in http://bugs.gentoo.org/322421.
* NEWS (Changes in behavior): Mention it.
2010-06-02 17:14:10 +02:00
Pádraig Brady
200501052e truncate: improve handling of non regular files
Previously we copied `dd` and suppressed error messages
when truncating neither regular files or shared mem objects.
This was valid for `dd`, as truncation is ancillary to copying
it may also do, but for `truncate` we should display all errors.
Also we used the st_size from non regular files which is undefined,
so we display an error when the user tries this.

* src/truncate (do_truncate):  Error when referencing the size
of non regular files or non shared memory objects.  Display all
errors returned by ftruncate().
(main): Error when referencing the size of non regular files or
non shared memory objects.  Don't suppress error messages for
any file types that can't be opened for writing.
* tests/misc/truncate-dir-fail: Check that referencing the
size of a directory is not supported.
* tests/misc/truncate-fifo: Ensure the test doesn't hang
by using the `timeout` command.  Don't test the return from
running ftruncate on the fifo as it's system dependent as
to whether this fails or not.
NEWS: Mention the change in behavior.
Reported by Jim Meyering.
2010-05-29 10:45:13 +01:00
Pádraig Brady
81b7585ad1 truncate: support sizes relative to an existing file
* doc/coreutils.texi (truncate invocation): Mention that --reference
bases the --size rather than just setting it.
* src/truncate.c (usage): Likewise. Also remove the clause
describing --size and --reference as being mutually exclusive.
(do_truncate): Add an extra parameter to hold the size
of a referenced file, and use it if positive.
(main): Pass the size of a referenced file to do_truncate().
* tests/misc/truncate-parameters: Adjust for the new combinations.
* NEWS: Mention the change
Suggested by Richard W.M. Jones
2010-05-28 14:23:04 +01:00
Jon Ringuette
2b8ecfa6f1 du: recognize -d N as equivalent to --max-depth=N
* NEWS (New features): Mention it.
* src/du.c (DEBUG_OPT): Remove.  Use long-named ---debug instead.
Commented out.
(MAX_DEPTH_OPTION): Remove.  Use 'd' instead.
(main): Insert literal "d:"; remove DEBUG_OPT.
* doc/coreutils.texi (du invocation): Add -d to indices.
* tests/du/max-depth: Exercise -d, too.
2010-05-19 07:28:16 +02:00
Pádraig Brady
03f6f32c41 sort: --debug: output data independent warnings and info
* src/sort.c (usage): Mention --debug can output warnings to stderr.
Also split the translatable string to aid translation.
(default_key_compare): A new function refactored from main(),
and now also called from the new key_warnings() function.
(key_to_opts): A new function refactored from incompatible_options(),
and now also called from the new key_warnings() function.
(key_numeric): A new function refactored to test if key is numeric.
(key_warnings): A new function to output warnings to stderr,
about questionable use of various options.  Currently it warns
about zero length keys and ineffective global options.
(incompatible_options): Refactor out key_to_opts()
(main): Use key_init() to initialize gkey.  Refactor out
default_key_compare().  Call key_warnings() in debug mode.
* doc/coreutils.texi (sort invocation): Mention that warnings
are output by --debug.
* tests/misc/sort-debug-warn: A new test for debug warnings.
* tests/Makefile.am: Reference the new test.
* NEWS: Mention the new feature
2010-05-16 01:08:33 +01:00
Pádraig Brady
4f5732e27a sort: add a --debug option to highlight key extents
* src/sort (usage): Add description for --debug.
(write_bytes): Pass a line structure so it can subsequently
be passed to compare to highlight the keys when in debug mode.
Also transform TAB and NUL characters written to stdout so
that the highlighting in debug mode aligns correctly.
(human_numcompare): Pass an "endptr" so we can record the extent
of the number matched.
(general_numcompare): Likewise.
(find_unit_order): Likewise.
(getmonth): Likewise.
(numcompare): Likewise.  Note we reuse find_unit_order() for this,
which is a good enough approximation, and means we don't need to
change the strnumcmp() interface.
(check_mixed_SI_IEC): Return whether iec_present, so that can be
used to set the "endptr" in find_unit_order.  Also make the key
parameter optional, which will be the case from numcompare().
(count_tabs): A new function to determine how much to adjust
the mbswidth() values by (TABs don't have a width).
(mark_key): A new function to output the key highlighting to stdout.
(debug_key): A new function to determine the offset and width
of the key highlighting.
(key_compare): Pass the show_debug parameter so the key highlighting
is only displayed when explicitly called.  For each key type, set
the length (lena) and whether leading blanks are auto skipped (skipb)
which are then used by debug_key() to highlight the portion of the
key used in the comparison.
(compare): Pass the show_debug parameter so the key highlighting
is only displayed when explicitly called.  Call debug_key() to
highlight the last resort comparison.
(check): Output highlighting for disorder line to stdout.
(main): Process the --debug option and make it mutually exlusive
with the -o option as I don't see it useful there, even potentially
harmful if someone left a --debug in by mistake when updating a file.
Also restricting debug output to stdout, simplifies the logic
for dealing with temporary files.
* doc/coreutils.texi (sort invocation): Describe the --debug option,
and reference it from the --key description.
* tests/misc/sort-debug-keys: A new test for highlighting keys.
* tests/Makefile.am: Reference the new test.
* NEWS: Mention the new feature.
2010-05-12 13:30:37 +01:00
Pádraig Brady
8b5087d4e6 sort: use long doubles for general numeric mode
* src/sort.c (general_numcompare): Use long doubles unconditionally,
and strtold when available, to convert numbers with greater range and
precision.  Performance was seen to be on par with standard doubles.
* doc/coreutils.texi (sort invocation): Amend the -g description to
mention long double rather than double, and strtold rather than strtod.
* src/getlimits.c (main): Output floating point limits for use in tests.
* tests/misc/sort-float: A new test to ensure sort is using long
doubles when possible, and that locale specific floats are handled.
* tests/Makefile.am: Reference the new test.
* tests/test-lib.sh (getlimits_): Normalize indenting.
* NEWS: Mention the new behaviour.
Reported by Nelson Beebe.
2010-04-29 18:55:57 +01:00
Jim Meyering
765d67410c post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2010-04-23 18:36:32 +02:00
Jim Meyering
1d10eb8b1e version 8.5
* NEWS: Record release date.
2010-04-23 17:18:16 +02:00
Pádraig Brady
7dc398a30f maint: update a couple of NEWS items for the pending release
* NEWS: Mention that cp and mv from the previous release did
not support preserving extended attributes (fixed in e489fd04).
Improve the grammar for the "cp capabilities" item.
2010-04-21 07:55:38 +01:00
Pádraig Brady
8fc12909f6 sort: fix parsing of end field in obsolescent key formats
This regression was introduced in commit 224a69b5, 2009-02-24,
"sort: Fix two bugs with determining the end of field".
The specific regression being that we include 1 field too many when
an end field is specified using obsolescent key syntax (+POS -POS).

* src/sort.c (struct keyfield): Clarify the description of the eword
member, as suggested by Alan Curry.
(main): When processing obsolescent format key specifications,
normalize eword to a zero based count when no specific end char is given
for an end field. This matches what's done when keys are specified with -k.
* tests/misc/sort: Add a few more tests for the obsolescent key formats,
with test 07i being the particular failure addressed by this change.
* THANKS: Add Alan Curry who precisely identified the issue.
* NEWS: Mention the fix.
Reported by Santiago Rodríguez
2010-04-20 22:37:18 +01:00
Pádraig Brady
1777d0dfe3 cp: preserve "capabilities" when also preserving file ownership
* src/copy.c (copy_reg): Copy xattrs _after_ setting file ownership
so that capabilities are not cleared when setting ownership.
* tests/cp/capability: A new root test.
* tests/Makefile.am (root_tests): Reference the new test.
* NEWS: Mention the fix.
2010-04-16 23:02:02 +01:00
Pádraig Brady
c403c31e88 timeout: add the --kill-after option
Based on a report from Kim Hansen who wanted to
send a KILL signal to the monitored command
when `timeout` itself received a termination signal.
Rather than changing such a signal into a KILL,
we provide the more general mechanism of sending
the KILL after the specified grace period.

* src/timeout.c (cleanup): If a non zero kill delay
is specified, (re)set the alarm to that delay, after
which a KILL signal will be sent to the process group.
(usage): Mention the new option.  Separate the description
of DURATION since it's now specified in 2 places.
Clarify that the duration is an integer.
(parse_duration): A new function refactored from main(),
since this logic is now called for two parameters.
(main): Parse the -k option.
* doc/coreutils.texi (timeout invocation): Describe the
new --kill-after option and use @display rather than
@table to show the duration suffixes.  Clarify that
a duration of 0 disables the associated timeout.
* tests/misc/timeout-parameters: Check invalid --kill-after.
* tests/misc/timeout: Check a valid --kill-after works.
* NEWS: Mention the new feature.
2010-03-16 23:10:15 +00:00
Pádraig Brady
59e2e55d0f sort: fix issues with month sorting in some locales
* src/sort.c (char fold_toupper[]): Change to unsigned
so as the correct comparisons are made in getmonth().
This fixes unibyte locales where abbreviated months
have characters that are > 0x7F, but it also works for
multibyte locales with the caveat that multibyte characters
are matched case sensitively.
With this change, the following example sorts correctly:
  $ echo -e "1 márta\n2 Feabhra" | LANG=ga_IE.utf8 sort -k2,2M
  2 Feabhra
  1 márta
* src/sort.c (inittables): Since we ignore blanks around months
in the input, don't include them when they're present in the locale.
With this change, the following example sorts correctly:
  $ echo -e "1 2月\n2 1月" | LANG=ja_JP.utf8 sort -k2,2M
  2 1月
  1 2月
* tests/misc/sort-month: A new test to exercise the above cases.
* tests/Makefile.am: Reference the new test.
* NEWS: Mention the fix.
2010-03-01 10:58:02 +00:00
Moritz Orbach
f5268e2749 ls: fix a regression by honoring NORMAL attributes again
Output the NORMAL attribute before non file name text.
This attribute will continue into file names that would
not otherwise be colored unless FILE is also set.
The regression was introduced with commit 483297d5, 28-02-2009,
"ls --color no longer outputs unnecessary escape sequences".

* src/ls.c (set_normal_color): A new function to output the
NORMAL attribute sequence if it's enabled.
(print_current_files): Output NORMAL before printing long format info.
(print_file_name_and_frills): Output NORMAL before printing file name.
(print_color_indicator): Reset the attributes before a file name with
attributes so that NORMAL attributes will not combine with them.
(print_name_with_quoting): Ensure attributes are reset after printing
the file name if NORMAL attributes were output.
* tests/ls/color-norm: A new test for NORMAL and FILE combinations.
* tests/Makefile.am: Reference the new test.
* NEWS: Mention the fix.
Reported in https://savannah.gnu.org/bugs/?26512
2010-02-17 23:25:12 +00:00
Pádraig Brady
628b1d5e7e maint: fix a typo in NEWS
* NEWS: s/contains/contain/
2010-02-01 15:40:44 +00:00
Pádraig Brady
f86bb6967d join: make -t '' operate on the whole line
Previously passing an empty parameter to -t would
raise an error, but now it means to treat each line
as a single field for matching.  This matches the
default operation of `sort` which is usually used
in conjunction with join.

* src/join.c (main): Set the field delimiter to '\n' if
an empty parameter is passed to -t.
(usage): Mention the operation of -t ''.
* tests/misc/join: Add 2 new tests, for the existing -t '\0'
and the new -t '' functionality.
* doc/coreutils.texi (join invocation): Mention that
join -t '' always operates on the whole line, while
join -t '\0' usually does.
* NEWS: Mention the change in behavior.
2010-02-01 15:36:56 +00:00
Assaf Gordon
819aa9eba7 join: add --header option to always output the first line
This essentially allows one to use --check-order with headings.
Note join without --check-order will already handle the common case
where headings do match in each file, however using --check-order will fail
often when the header sorts after the first line of data.

Note also that this will join header lines from each file even if
they don't match, with headings from the first file being used.

* NEWS: Mention the new option.
* doc/coreutils.texi (join invocation): Describe the new option.
* src/join.c (usage): Likewise.
(join): Join the header lines unconditionally.
* tests/misc/join: Add 5 new tests.
2010-02-01 13:57:42 +00:00
Jim Meyering
5d43617e8a ls --color: don't emit a final no-op escape sequence
* src/ls.c (main): With --color, avoid emitting the final color-
resetting escape sequence when it would be a no-op.
* tests/ls/color-clear-to-eol: Adjust expected output accordingly.
* tests/ls/color-dtype-dir: Likewise.
* tests/ls/multihardlink: Likewise.
* tests/ls/stat-free-symlinks: Likewise.
* tests/misc/ls-misc: Likewise.
* NEWS (Changes in behavior): Mention it.
C de-Avillez rebased and adapted four of the new sl-dangle*
tests in tests/misc/ls-misc.
Reported by Jim Avera in
http://bugs.launchpad.net/ubuntu/+source/coreutils/+bug/494663
2010-02-01 08:26:12 +01:00
Kamil Dudka
aad0bde0b5 who --mesg (-T) can use a more accurate test for TTY writability
Enabled when coreutils is configured with --with-tty-group.
Based on a patch written by Piotr Gackiewicz.  Details at
http://bugzilla.redhat.com/454261

* src/who.c (is_tty_writable): A new function returning true if a TTY
device is writable by the group.  Additionally it checks the group to be
the same as TTY_GROUP_NAME when compiled with --with-tty-group.
* m4/jm-macros.m4: Introduce a new configure option --with-tty-group.
* NEWS: Mention the change.
2010-01-25 11:43:49 +01:00
Jim Meyering
7ba0e90c55 post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2010-01-13 22:14:16 +01:00
Jim Meyering
954ef23ed9 version 8.4
* NEWS: Record release date.
2010-01-13 21:57:54 +01:00
Jim Meyering
6beca4248f build: fix build failure due to missing libxattr
Configure is supposed to detect insufficient XATTR support.
However, if a system has the required headers, but no library,
the configure script would mistakenly enable USE_XATTR.
* m4/xattr.m4 (gl_FUNC_XATTR): If the attr_copy_file function
is not found, don't set USE_XATTR.
Nelson Beebe reported a link failure on RHEL 5.3.
Also, do not let the combination of --disable-xattr and
a stray LIB_XATTR environment setting perturb the build.
* NEWS (Build-related): Mention it.
2010-01-12 08:06:47 +01:00
Jim Meyering
37b8bfda56 doc: mention the wchar.h vs. glibc build problem
* NEWS (Build-related): Mention the wchar.h issue.
2010-01-12 06:52:14 +01:00
Pádraig Brady
21a6a7f64c nproc: return a possibly more accurate total CPU count
* gnulib: Update, for num_processors() improvement.
* NEWS: Mention the fix.
2010-01-12 06:46:51 +01:00
Kamil Dudka
6454dd0f2f ls: reorder includes to work around broken <sys/capability.h>
* src/ls.c: Include <sys/capability.h> later, to avoid build
failure with a header from libcap-2.16-1 or earlier.
See http://bugzilla.redhat.com/483548 for details.
2010-01-12 06:31:20 +01:00
Jim Meyering
21f4da0fb9 post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2010-01-07 18:25:36 +01:00
Jim Meyering
201ba1a203 version 8.3
* NEWS: Record release date.
2010-01-07 18:13:26 +01:00
Eric Blake
67d3e26350 pr: ensure the page header line is of the required format
Before this change, with too long a file name, the name would
abut the date field on the left and possibly also the "Page N"
field on the right, rather than leaving a one-space separator
in each case.  Fixes a regression introduced on Mar 6 2009,
by commit a4053c5291

* src/pr.c (print_header): Ensure that there is at least one
space before and after the file name part of the header line.
* NEWS: Mention it.
* tests/pr/W20l24f-ll: s/xPage/ x Page/.
* THANKS: Update.
Reported by Denis McKeon, in https://savannah.gnu.org/bugs/?28492.
2010-01-06 21:07:23 -07:00
Eric Blake
72a0a8264d maint: apply correct license to auxiliary files
* gnulib: Update, for maint.mk improvements.
* HACKING: Use GFDL 1.3, not 1.2.
* NEWS: Likewise.
* README: Likewise.
* cfg.mk (old_NEWS_hash): Update accordingly.
* .gitignore: Ignore file created by 'make update-NEWS-hash'.
2010-01-06 21:05:52 -07:00
Eric Blake
7a1f69aae0 cp, touch: avoid problem with new glibc
* gnulib: Update, for utimens fix.
* NEWS: Mention the fix.
Reported by Guillaume Ayoub in http://bugs.debian.org/563726.
See also http://bugzilla.redhat.com/552320.

Signed-off-by: Eric Blake <ebb9@byu.net>
2010-01-06 06:42:16 -07:00
Philip Rowlands
bbdc929602 doc: fix typo in NEWS
* NEWS: Fix typo: s/repeated/repeatedly/
2010-01-05 14:11:56 +01:00
Eric Blake
b7f2b51c42 ls: fix color of broken symlinks colored as target
* src/ls.c (print_color_indicator): When using 'LINK target' in
dircolors, treat broken symlink as C_ORPHAN.
* tests/misc/ls-misc (sl-dangle2, sl-dangle3, sl-dangle4)
(sl-dangle5): Test for it, and add more coverage.
* NEWS: Document it.
* THANKS: Update.
Reported by Chris Jones.
2010-01-01 13:41:46 -07:00
Jim Meyering
1aa17dc89b maint: update all FSF copyright year lists to include 2010
Use this command:
git ls-files | grep -v COPYING \
  | xargs env UPDATE_COPYRIGHT_USE_INTERVALS=1 \
      build-aux/update-copyright
2010-01-01 14:06:47 +01:00
Eric Blake
7e0c2b9a59 touch: work around ntfs-3g bug
* gnulib: Update, for utimensat fix.
* NEWS: Improve wording about touch fixes.
* THANKS: Update.
Reported by Stuart Citrin.
2009-12-30 20:33:39 -07:00
Jim Meyering
d3a4bc86cd doc: mention two tail -F bug fixes in NEWS
* NEWS (Bug fixes): Two tail -F fixes.
2009-12-30 11:22:55 +01:00
Pádraig Brady
8d2ecd4a3e tail: fix --follow to not use inotify on remote files
* src/tail.c (struct File_spec): Add a flag to record if file is remote.
(recheck): If we're using inotify then check if the file has gone remote
and if so, drop it with a warning.
(any_remote_files): A new function to check for any open remote files.
(tailable_stdin): A new function to refactor the check for whether
a tailable file was specified through stdin.
(fremote): A new function to check if a file descriptor
refers to a remote file.
(tail_forever_inotify): Add some comments.
(tail_file): Record if a file is remote when initially opened.
(main): Disable inotify if any remote files specified.
Also document the caveat about remounted files not
being noticed by inotify.
* NEWS: Mention the fix.
2009-12-25 00:56:41 +00:00
Pádraig Brady
11dc0016bb wc: line-buffer the printed counts
* src/wc.c (main): Set stdout to line buffered mode
to ensure parallel running instances don't intersperse
their output.  This adds 6.5% to the run time in the worst case
of many zero length files, but has neglible impact for
standard sized files.
* tests/misc/wc-parallel: New test for atomic output.
* tests/Makefile.am: Reference it.
* NEWS: Mention the fix
This is similar to commit 710fe413, 20-10-2009,
"md5sum, sha*sum, sum: line-buffer the printed checksums"
2009-12-23 13:45:34 +00:00
Pádraig Brady
53db8d6479 stat: Recognize k-afs, gfs, ocfs2 file system types
* src/stat.c (human_fstype): Add k-afs, gfs/gfs2 and ocfs2.
* NEWS: Update the stat -f entry.
2009-12-22 16:55:04 +00:00
Pádraig Brady
4b449caf2d stat: add support for more file system types
* src/stat.c (human_fstype): Add the following FS types:
fuseblk, rpc_pipefs.  Also fix a typo of minux3 to minix3,
and mention the fs-magic-compare make target to help update the list.
* NEWS: Mention the fix.
2009-12-22 11:17:01 +00:00
Eric Blake
01e4f003a0 touch: fix ctime regression in 'touch -a'
Regression introduced in coreutils 8.1 due to a bug in the Linux
kernel implementation of utimensat with mtime of UTIME_OMIT.

* gnulib: Update to latest, to pick up utimensat fix.
* NEWS: Mention the change.
* THANKS: Update.
Reported by John Stanley.
2009-12-19 17:32:45 -07:00
Pádraig Brady
d64c186d8e rm: fix --one-file-system regression due to fts conversion
* src/remove.c (rm_fts): Fix incorrect comparison of
device and inode numbers.
* tests/rm/one-file-system2: Add a separate test so
that it can be run as a normal user (It doesn't need to mount).
* tests/Makefile.am: Reference it.
* NEWS: Mention the fix.
Reported by Jan Larres.
2009-12-19 01:14:07 +00:00
Jim Meyering
a0000ba4ae post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2009-12-11 14:43:13 +01:00
Jim Meyering
70d023b076 version 8.2
* NEWS: Record release date.
2009-12-11 14:00:40 +01:00
Jim Meyering
fc4d3f63b0 tail: don't call fstat on an uninitialized FD
This bug showed up via valgrind as a "Conditional jump or move
depends on uninitialized value(s)" error.
* src/tail.c (ignore_fifo_and_pipe): New function.
(main): Use it only when tailing forever.
The code to compute n_viable and mark some F[i] as ignored would call
isapipe on an uninitialized file descriptor.  But n_viable and those
.ignored marks are useful/used only when tailing forever.  This bug
was introduced via commit f0ff8c73 (7.6), "tail: make the new
piped-stdin test as portable as the old one".
* NEWS (Bug fixes): Mention it.
2009-12-11 12:15:13 +01:00
Jim Meyering
3df2108b0d doc: NEWS: mention that gnulib's mgetgroups fix affects id
* NEWS (Bug fixes): Mention the "id" bug fix inherited via this gnulib
change: "mgetgroups: do not write bytes beyond end of malloc'd buffer"
http://git.sv.gnu.org/cgit/gnulib.git/commit/?id=51d5e813e9ee6cf23
2009-12-11 08:51:28 +01:00
Jim Meyering
bb4cb10e89 doc: NEWS: the "make distcheck" vulnerability dates back to 5.0
* NEWS (Bug fixes): Correct the introduced-in version number.
This was introduced on 2003-04-02 by commit 722a49ea.
2009-12-09 13:58:12 +01:00
Jim Meyering
23c0cecaa8 doc: NEWS: mention the "make distcheck" vulnerability
* NEWS (Bug fixes): Mention implications of the "make distcheck" change.
This was introduced on 2008-07-22 by commit 9bb0d576, "tests: ensure
"make check" w/tainted build dir no longer impacts $HOME".
2009-12-09 13:09:33 +01:00
Pádraig Brady
f5a97b8269 sort: fix failure if sort's parent has ignored SIGCHLD
* src/sort.c (main): Reset the SIGCHLD handler to the default
as otherwise wait() could return an error.
* tests/misc/sort-compress: Set the CHLD handler in a subshell
to SIG_IGN to ensure the sort command resets it to SIG_DFL.
* NEWS: Mention the fix.
2009-12-08 15:29:27 +00:00
Pádraig Brady
73d4626134 timeout: fix failure if timeout's parent has ignored SIGCHLD
* src/timeout.c (main): Reset the SIGCHLD handler to the default
as otherwise wait() could return -1 and set errno to ECHILD.
This condition was ignored until commit 0b1dcf33, on 31-08-2009,
"timeout: defensive handling of all wait() errors"
but subsequently timeout would run the command correctly
but then fail with an error message.
* tests/misc/timeout: In a subshell set the CHLD handler to
SIG_IGN to ensure the timeout command resets it to SIG_DFL.
* NEWS: Mention the fix.
2009-12-08 15:17:01 +00:00
Eric Blake
9b4b38f56e id: handle systems without getgroups support
If getgroups failed with ENOSYS, mgetgroups would unnecessarily
fail, and that provoked id into freeing an uninitialized pointer.
Meanwhile, we were not using xalloc_die properly.  Both issues
are better solved in gnulib, by introducing xgetgroups; this
patch uses the new interface.

Regression introduced by commit 6a31fd8d7.

* gnulib: Update, for mgetgroups improvments.
* src/id.c (print_full_info): Adjust caller to die on allocation
failure, and no longer worry about ENOSYS.
* src/group-list.c (print_group_list): Likewise.
* src/setuidgid.c (main): Likewise.
* NEWS: Mention the fix.
* THANKS: Update.
Reported by Scott Harrison.
2009-12-04 19:18:06 -07:00
Jim Meyering
0dc1f4c6f3 rm: fix empty-name bug introduced with conversion to use fts
While "rm ''" would properly fail, "rm F1 '' F2" would fail
to remove F1 and F2, due to the empty string argument.
This bug was introduced on 2009-07-12, via commit 4f73ecaf,
"rm: rewrite to use fts".
* gnulib: Update to latest, for fixed fts.c.
* NEWS (Bug fixes): Describe it.
* tests/rm/empty-name: Adjust for changed diagnostic.
(mk_file): Define, copied from misc/ls-misc.
(empty-name-2): New test, for today's fix.
* lib/xfts.c (xfts_open): Reflect the change in fts_open, now that
it no longer fails immediately when one argument is the empty string.
Assert that the bit flags were not the cause of failure.
* po/POTFILES.in: Remove xfts.c.
* THANKS: Update.
Reported by Ladislav Hagara.
2009-12-01 14:38:39 +01:00
Jim Meyering
e246d654f3 post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2009-11-18 19:56:25 +01:00
Jim Meyering
447d245551 version 8.1
* NEWS: Record release date.
2009-11-18 19:38:50 +01:00
Jim Meyering
6609ccbf87 doc: mention the du/fts vs. NFSv4 mount-point work-around
* NEWS (Changes in behavior): Mention it.
2009-11-17 08:56:12 +01:00
Jim Meyering
3b997a9bcb tail -F can fail to track a file after it's been rotated
Tailing forever and by-name (--follow=name, -F), tail would
sometimes fail to follow a file that had been removed via rename.
If you can't apply this patch and have tail 7.6 or newer, you can
work around the bug via the undocumented --disable-inotify option.
* src/tail.c (tail_forever_inotify): When tailing by name (-F),
do not un-watch a file upon receipt of the IN_MOVE_SELF event.
Reported by Arjan Opmeer in http://bugs.debian.org/548439.
* NEWS (Bug fixes): Mention it.
Also see http://marc.info/?l=coreutils-bug&m=125829031916515
* tests/Makefile.am (TESTS): Add tail-2/inotify-rotate.
* tests/tail-2/inotify-rotate: New test.
2009-11-16 09:30:43 +01:00
Pádraig Brady
10d97b3191 ls: fix capability coloring
Capability checking was incorrectly done on just the base name
rather than on the whole path.  Consequently there could be both
false positives and negatives when coloring files with capabilities.
Also capability checking was not done at all in certain cases for
non executable files.  Note passing absolute rather than relative
names to cap_get_file() reduces the has_capability() overhead
from around 33% to 30%.  I.E. ls --color is now around 3% faster.

* src/ls.c (struct fileinfo): Add a has_capability member.
(print_color_indicator): Refactor to pass just a fileinfo pointer
and a flag to say if we're dealing with a symlink target.
(print_name_with_quoting): Likewise.
(gobble_file): Set has_capability in the fileinfo struct.  Also do
a capability check even if executable coloring is disabled.
Ditto for SETUID and SETUID coloring.
Comment on how expensive has_capability() is.
(print_long_format): Adjust to refactored print_name_with_quoting.
(quote_name): Likewise.
(print_file_name_and_frills): Likewise.
* tests/ls/capability: Test the various false positive and negatives.
* THANKS: Add reporter (Ivan Labath).
* NEWS: Mention the fix.
2009-11-09 08:16:20 +00:00
Jim Meyering
d9dbbb9a45 chcon, chgrp, chmod and chown now diagnose a directory cycle
* lib/xfts.c (cycle_warning_required): New function.
* lib/xfts.h: Declare it.
* src/chown-core.c (change_file_owner): Diagnose a cycle.
* src/chmod.c (process_file): Likewise.
* src/chcon.c (process_file): Likewise.
* NEWS (Bug fixes): Mention this.
2009-11-07 08:43:00 +01:00
Giuseppe Scrivano
74cf4cb26d nproc: A new program to count the available processors
* AUTHORS: Add my name.
* NEWS: Mention it.
* README: Likewise.
* bootstrap.conf (gnulib_modules): Add nproc.
* doc/coreutils.texi (nproc invocation): Add nproc info.
* man/Makefile.am (nproc.1): Add dependency.
* man/nproc.x: New template.
* man/.gitignore: Ignore generated man page.
* po/POTFILES.in: Add src/nproc.c.
* src/.gitignore: Exclude nproc.
* src/Makefile.am (EXTRA_PROGRAMS): Add nproc.
* src/nproc.c: New file.
* tests/Makefile.am (TESTS): Add misc/nproc-{avail,positive}.
* tests/misc/nproc-avail: New file.
* tests/misc/nproc-positive: New file.
2009-11-06 16:54:12 +00:00
Eric Blake
31a9937081 mktemp: add suffix handling
Now that mkstemps is supported, we might as well use it.

* src/mktemp.c (TMPDIR_OPTION): New enum value.
(longopts): Add new option.
(usage): Document it.
(count_trailing_X_s): Rename...
(count_consecutive_X_s): ...to this, and add parameter.
(mkstemp_len, mkdtemp_len): Add parameter.
(main): Implement new option.
(AUTHORS): Add myself.
* AUTHORS (mktemp): Likewise.
* tests/misc/mktemp: Test new option.
* doc/coreutils.texi (mktemp invocation): Document it.
* NEWS: Likewise.
Fixes http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=548316.
2009-11-05 07:10:40 -07:00
Eric Blake
41b3a8ed8b mktemp: don't leave file behind on write failure
* src/mktemp.c (main): Remove just-created file if stdout had
problems.
* bootstrap.conf (gnulib_modules): Add remove.
* tests/misc/close-stdout: Test it.
* NEWS: Document it.
2009-11-05 06:53:21 -07:00
Jim Meyering
8ba5d1a70c du now diagnoses cycles, rather than ignoring them
* src/du.c (symlink_deref_bits): New global, decl moved from ...
(main): ...here.
(process_file): When fts detects a directory cycle that can't
be due to symlinks, report it and arrange to exit nonzero.
* NEWS (Bug fixes): Mention it.
2009-11-05 08:32:31 +01:00
Jim Meyering
7bf2e3db23 rm -f: ignore EROFS when it's really ENOENT
rm -f must not print a diagnostic for a nonexistent file.  However,
most linux-based kernel unlinkat functions set errno to EROFS when
the named file (regardless of whether it exists) would lie on a
read-only file system.  remove.c now performs an extra fstatat call
in that case, to determine whether the file exists.
* src/remove.c (excise): Map EROFS to ENOENT, if a file is nonexistent.
Reported by Steven Drake in <http://savannah.gnu.org/bugs/?27923>.
* NEWS (Changes in behavior): Mention it.
2009-11-03 14:14:00 +01:00
Eric Blake
1c59bb3cef nice, nohup, su: detect write failure to stderr
These programs can print non-fatal diagnostics to stderr prior to
exec'ing a subsidiary program.  However, if we thought the situation
warranted a diagnostic, we insist that the diagnostic be printed
without error, rather than blindly exec, as it may be a security risk.

For an example, try 'nice -n -1 nice 2>/dev/full'.  Failure to raise
priority (by lowering niceness) is not fatal, but failure to inform
the user about failure to change priority is dangerous.

* src/nice.c (main): Declare failure if writing advisory message
to stderr fails.
* src/nohup.c (main): Likewise.
* src/su.c (main): Likewise.
* tests/misc/nice: Test this.
* tests/misc/nohup: Likewise.
* NEWS: Document this.
2009-10-28 21:12:41 -06:00
Pádraig Brady
2904d675a4 echo, printf: interpret \e as the Escape character
Match gcc, perl, bash, ksh, tcsh, ... in supporting \e.
* src/printf.c (print_escape_char): Output \x1B when \e encountered.
* src/echo.c (main): Likewise.
* src/stat.c (print_escape_char): Likewise.
* doc/coreutils.texi (echo invocation): Add \e to the list.
* tests/misc/printf: Verify that \e outputs \x1B.
* NEWS: Mention the change in behaviour.
2009-10-28 16:37:07 +00:00
Eric Blake
54491d2751 printenv: ignore bogus variable names
Exposed by env a=b=c printenv a=b.

* src/printenv.c (main): Silently reject = in names.
* tests/misc/printenv: Test for it.
* NEWS: Document this.
2009-10-28 06:24:52 -06:00
Eric Blake
d6de2f198e env, printenv: add -0/--null option
Allows for unambiguous processing when environment values (or even
non-portable names!) contain newline.

* src/env.c (longopts): Add new option.
(usage): Document it.
(main): Implement it.
* src/printenv.c (longopts): New variable.
(usage): Document new option.
(main): Implement it.
* doc/coreutils.texi (Common options): New macro optNull.
(du invocation, env invocation, printenv invocation): Use it.
* NEWS: Mention this.
* tests/misc/env-null: New test.
* tests/Makefile.am (TESTS): Run it.
2009-10-27 19:55:35 -06:00
Eric Blake
243f1b1c71 env: reject bogus -u arguments
* src/env.c (main): Use unsetenv rather than putenv to remove
items from environ, and check for failure.
* bootstrap.conf (gnulib_modules): Add unsetenv.
* tests/misc/env: Test this.
* NEWS: Document it.
2009-10-26 21:30:30 -06:00
Jim Meyering
501bf7b589 nice: execute program even when setpriority fails due to EACCES
* src/nice.c (perm_related_errno): New function.
(main): Use it, rather than testing only errno == EPERM.
* NEWS (Bug fixes): Mention it.
2009-10-26 08:25:34 +01:00
Pádraig Brady
69fbfd400c timeout: don't orphan monitored programs if they ignore specified signals
* src/timeout.c (install_signal_handlers): Handle any user
specified signal, so that if it does not cause the child
to exit then we don't exit and orphan the child. Previously this
for example, would leave an orphan dd process running:
timeout -sUSR1 1s dd if=/dev/zero of=/dev/null
* NEWS: Mention the fix.
2009-10-25 23:28:38 +00:00
Eric Blake
1ce9e1e5ca nohup: use EXIT_CANCELED if not POSIXLY_CORRECT
* src/nohup.c (NOHUP_FAILURE): Rename...
(POSIX_NOHUP_FAILURE): ...to this.
(main): Pay attention to POSIXLY_CORRECT, to determine whether to
use status 125 or 127.
* doc/coreutils.texi (nohup invocation): Document this.
* NEWS: Likewise.
* tests/misc/invalid-opt (exit_status): Adjust expected results.
* tests/misc/help-version (expected_failure_status): Likewise.
* tests/misc/nohup: Likewise.
2009-10-23 16:24:08 -06:00
Eric Blake
b6540b96ba chroot, env, nice, su: use EXIT_CANCELED for internal failure
* src/chroot.c (main): Use EXIT_CANCELED, not EXIT_FAILURE.
* src/env.c (main): Likewise.
* src/nice.c (main): Likewise.
* src/su.c (change_identity, main): Likewise.
* doc/coreutils.texi (chroot invocation, env invocation)
(nice invocation, su invocation): Document this.
* NEWS: Likewise.
* tests/misc/invalid-opt (exit_status): Adjust expected results.
* tests/misc/help-version (expected_failure_status): Likewise.
2009-10-23 16:24:05 -06:00
Giuseppe Scrivano
cd0f3036f6 tail -f: avoid a race condition
* NEWS (Bug fixes): Mention it.
* src/tail.c (check_fspec): New function.
(tail_forever_inotify): Ensure there is no new data before entering the
inotify events wait loop.
2009-10-22 09:11:24 +02:00
Pádraig Brady
710fe413fe md5sum, sha*sum, sum: line-buffer the printed checksums
* src/md5sum.c (main): Set stdout to line buffered mode
to ensure parallel running instances don't intersperse
their output.  This adds 5% to the run time in the worst case
of many zero length files, or 2% with standard file sizes.
* src/sum.c (main): Likewise.
* tests/misc/md5sum-parallel: New test for atomic output.
* tests/Makefile.am: Reference it.
* NEWS: Mention the fix
2009-10-21 16:56:00 +01:00
Eric Blake
9e13b6a0b4 touch: add -h to change symlink timestamps, where supported
* src/touch.c (no_dereference): New flag variable.
(longopts): Add -h/--no-dereference.
(touch): Add symlink handling.
(usage): Document new option.
(main): Accept new option.
* NEWS: Document it.
* doc/coreutils.texi (touch invocation): Likewise.  Also mention
birthtime.
* tests/touch/no-dereference: New test.
* tests/Makefile.am (TESTS): Run it.
2009-10-17 14:36:28 -06:00
Jim Meyering
0023f65fd7 chcon: don't disable just because SELinux is disabled
* src/chcon.c (main): Now that gnulib provides getfilecon wrappers,
we can revert most of the 2009-10-05 commit 3a97d664, "chcon: exit
immediately if SELinux is disabled", since chcon is still useful as
long as the file system provides handlers for the security.*
name space.  gnulib's getfilecon wrappers ensure that an offending
context now evokes a return value of -1.
Prompted by comments from Stephen Smalley in
http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/18378/focus=18394
* NEWS (Bug fixes): Mention it.
2009-10-09 14:33:10 +02:00
Jim Meyering
eb5f06f2a6 stat: add support for many more file system types
* src/stat.c (human_fstype): Add the following FS types,
from <linux/magic.h>: afs, anon-inode FS, btrfs, cgroupfs,
cramfs-wend, debugfs, futexfs, inotifyfs, minux3, securityfs,
selinux, xenfs.
Also add "nilfs".
* src/Makefile.am (fs-kernel-magic): New rule.
* NEWS (Bug fixes): Mention this.
2009-10-08 10:18:28 +02:00
Jim Meyering
8e32390716 stat: recognize CIFS and HFS file system types
* src/stat.c (human_fstype) [CIFS, HFS]: Add new file system types.
Prompted by a report from Stuart Kemp.
Normalize the form of a few hexadecimal magic numbers.
Alphabetize on S_MAGIC_ case names.
* src/Makefile.am (fs-magic-compare, fs-def, fs-magic): New rules, to
automate comparison of our list with that in the Linux statfs man page.
* NEWS (Bug fixes): Mention it.
2009-10-08 09:07:12 +02:00
Guenter Knauf
b95be30e3f md5sum, sha*sum: also accept openssl checksum syntax
* src/md5sum.c (split_3): Accept openssl checksum syntax, which
differs only by two spaces from that of the bsd checksum tools:
openssl: MD5(f)= d41d8cd98f00b204e9800998ecf8427e
bsd:     MD5 (f) = d41d8cd98f00b204e9800998ecf8427e
2009-10-07 09:31:27 +02:00
Jim Meyering
96829a9ff0 post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2009-10-06 13:20:18 +02:00
Jim Meyering
ca1e31f3c5 version 8.0
* NEWS: Record release date.
2009-10-06 13:04:16 +02:00
Pádraig Brady
f8726e05c4 tail: avoid a race where we could miss new data with --pid
* src/tail.c (tail_forever, tail_forever_inotify): Close a race in
tail_forever_inotify where new data written after the file check by
a now dead process, but before the pid check, is not output.  We use
the POSIX guarantee that read() and write() are serialized wrt each
other even in separate processes, to assume full file consistency
after exit() and so poll for new data _after_ the writer has exited.
This also allows us to not redundantly _wait_ for new data if the
process is dead.
* tests/tail-2/pid: Remove the now partially invalid sub second sleep
check as we now don't unconditionally wait, and replace it with a check
for the redundant sleep.  Also clarify some of the existing comments.
* NEWS: Mention the fix.
2009-10-02 14:00:06 +01:00
Pádraig Brady
d4c7114bce ls: always print "?" for allocated size of a dereferenced dangling symlink
Previously for `ls -Ls` (but not `ls -Lsl`), we referenced
the st_blocks returned from the previous failed stat() call.
This undefined value was seen to be 0 for dangling symlinks at least.
* src/ls.c (print_file_name_and_frills, length_of_file_name_and_frills):
Don't use st_blocks if the previous stat() failed
* tests/ls/dangle: Add a test case
* NEWS: Mention the fix, and roll up related items into a single entry.
2009-09-30 15:42:35 +01:00
Jim Meyering
a033e28737 stat: interpret "-" as standard input
* src/stat.c (do_stat): Interpret a command line argument of "-"
to mean "standard input", like many other tools do.
(do_statfs): Fail upon any attempt to use "-".
* NEWS (Changes in behavior): Mention it.
* tests/misc/stat-hyphen: New test, to exercise the above.
* tests/Makefile.am (TESTS): Add misc/stat-hyphen.
2009-09-29 16:04:12 +02:00
Jim Meyering
b7aaa0da8b ls: don't use an undefined struct stat after failed stat/lstat
* src/ls.c (format_inode): Access f->stat only if f->stat_ok is set.
* NEWS (Bug fixes): Mention it.
Improved-by: Pádraig Brady <P@draigBrady.com>
2009-09-29 14:12:30 +02:00
Jim Meyering
36edf7bad2 ls: print "?", not "0" as inode of dereferenced dangling symlink
ls prints inode numbers two ways: for long (-l) listings,
and for short ones, e.g., ls -li and ls -i.  The code to print
long listings properly printed "?" when the inode was unknown,
but the code for handling short listings would print 0 instead.
Factor out the formatting code into a new function so ls prints
the right string ("?") from both places:
* NEWS (Bug fixes): Mention it.
* src/ls.c (format_inode): New function.
(print_long_format): Use it here.
(print_file_name_and_frills): Use it here, too.
* tests/ls/dangle: Exercise this fix.
Reported by Yang Ren in http://bugzilla.redhat.com/525400
2009-09-29 11:42:45 +02:00
Jim Meyering
242689c7f9 ls: with -LR, exit with status 2 upon detecting a cycle
* src/ls.c (print_dir): Diagnosing the cycle is not enough.
Also set exit status to 2.  This is what Solaris' /bin/ls does, too.
* tests/ls/infloop: Rework test: match both expected stdout and stderr.
Require an exit status of 2 in this case.
* doc/coreutils.texi (ls invocation): Mention that a loop provokes
in an exit status of 2.
* NEWS (Bug fixes): Mention it.
Reported by Yang Ren in http://bugzilla.redhat.com/525402.
* THANKS: Correct ordering of Yang Ren's names.
2009-09-29 07:28:39 +02:00
Eric Blake
efcee783e4 ln: add -L/-P options
* src/ln.c (STAT_LIKE_LINK): Delete.
(logical): New flag.
(long_options): Add -L, -P.
(usage): Mention them.
(main): Choose between them.
(do_link): Perform correct action.
* tests/ln/misc: Move hard-to-sym portion of test...
* tests/ln/hard-to-sym: ...into new test, and add more.
* tests/Makefile.am (TESTS): Run new test.
* NEWS: Document this.
* doc/coreutils.texi (link invocation, ln invocation): Likewise.
* bootstrap.conf (gnulib_modules): Add linkat.
2009-09-25 07:03:03 -06:00
Eric Blake
82124c3c06 maint: summarize gnulib changes
* NEWS: Provide a blurb about recent gnulib improvements.  Fix typo
in readlink blurb.
2009-09-23 06:45:07 -06:00
Eric Blake
8a1edc971f readlink: pick up gnulib changes to readlink -f
* bootstrap.conf (obsolete_gnulib_modules): Move rename...
(gnulib_modules): ...here.  Add symlink.
* NEWS: Document the change in readlink.
* doc/coreutils.texi (readlink invocation): Likewise.
* tests/readlink/can-f: Update test to new semantics, and add test
of loop.
2009-09-23 08:45:08 +02:00
Pádraig Brady
3a169f4c5d ls: handle disabling of colors consistently for all tile types
* src/ls.c (print_color_indicator): Use consistent syntax for
all file and directory subtypes, and fall back to the color
of the base type if there is no enabled color for the subtype.
This allows turning off specific colors for o+w dirs for example.
* tests/ls/color-dtype-dir: Add a case to test that turning off
coloring for o+w directories, falls back to standard dir color.
* NEWS: Mention the fix
Introduced by commit ac467814, 2005-09-05,
"Colorize set-user-ID ... files and sticky ... directories."
2009-09-21 13:16:44 +01:00
Jim Meyering
a77fb35364 doc: NEWS: mention origin of touch -t ....60 bug
* NEWS: It is an old bug.
2009-09-14 15:57:13 +02:00
Jim Meyering
20761ce686 touch: don't reject "60" as number of seconds in a legacy time stamp
A valid command like "touch -t 197101010000.60 F" would fail due
to the suffix of ".60".  This bug is fixed via the latest change
to gnulib's posixtm module.
* tests/touch/60-seconds: New test.
* tests/Makefile.am (TESTS): Add it.
* NEWS (Bug fixes): Mention it.
2009-09-14 15:27:51 +02:00
Ondřej Vašík
cca83fafa6 cp,mv: preserve extended attributes even for read-only files
* src/copy.c (copy_reg): Temporarily set u+rw on the destination file
to allow GNU/Linux to set xattrs.
* tests/misc/xattr: Test that change.
* NEWS (Bug fixes): Mention it.
Reported by Ernest N. Mamikonyan.
2009-09-14 14:19:03 +01:00
Jim Meyering
f6f78f093b doc: NEWS: say quadratic and linear, rather than O(N^2) and O(N)
* NEWS: Use a slightly less technical description.
Suggested by Andreas Schwab.
2009-09-13 12:11:57 +02:00
Jim Meyering
21b617b78b doc: improve NEWS
* NEWS (rm -r, without -f): Mention that the N in "O(N)" represents
hierarchy depth.  Suggested by Ralf Wildenhues.
(rm -r, standards conformance): Make wording more accurate.
2009-09-13 11:58:48 +02:00
Jim Meyering
ebbf0a1f0f id: don't print context=... when POSIXLY_CORRECT is set
* src/id.c (print_full_info) [POSIXLY_CORRECT]: Don't print context.
Reported by Ulrich Drepper.
* NEWS (Changes in behavior): Mention it.
* doc/coreutils.texi (id invocation): Document that id also prints the
security context, when possible, and when POSIXLY_CORRECT is not set.
* tests/id/no-context: New file.  Test for this.
* tests/Makefile.am (TESTS): Add it.
2009-09-11 19:58:18 +02:00
Jim Meyering
722287e443 rm: improve efficiency of rm -r (without -f) from O(N^2) to O(N)
where N is the depth of the deepest hierarchy rm is processing.
* src/remove.c (write_protected_non_symlink): Use faccessat to
avoid O(N)-per-entry cost of calling euidaccess.
* m4/jm-macros.m4 (coreutils_MACROS): Check for faccessat.
* NEWS (Improvements): Mention it.
2009-09-11 14:08:58 +02:00
Jim Meyering
4f73ecaf7d rm: rewrite to use fts
* remove.c: Don't include "unlinkdir.h"; no longer used.
Do not include <setjmp.h> or "cycle-check.h".  Likewise.
Include "xfts.h".
(dir_name, dir_len): Remove definitions.
(CONSECUTIVE_READDIR_UNLINK_THRESHOLD): Likewise.
(INODE_SORT_DIR_ENTRIES_THRESHOLD, NEED_REWIND, D_TYPE): Likewise.
(struct dirstack_state, Dirstack_state): Likewise.
(g_buf, g_n_allocated): Remove declarations.
(hash_freer, hash_compare_strings, rm_malloc): Remove functions.
(rm_free, push_dir, top_dir, pop_dir, right_justify): Likewise.
(full_filename0, xfull_filename, full_filename_): Likewise.
(AD_stack_height, AD_stack_top, AD_stack_pop, AD_stack_clear): Likewise.
(obstack_init_minimal, ds_init, ds_clear, ds_free): Likewise.
(AD_pop_and_chdir, AD_ensure_initialized, AD_mark_helper): Likewise.
(AD_mark_as_unremovable, AD_mark_current_as_unremovable): Likewise.
(AD_push_initial, AD_push, AD_push, AD_is_removable): Likewise.
(write_protected_non_symlink): Change 3rd parameter from
dirstack_state "ds" to full_name.
(prompt): Adjust parameters.  Now, state comes from FTS/FTSENT pair.
Those replace fd_cwd and "ds".  Remove "filename".  Remove pdirent_type
in favor of new "is_dir" parameter.  Rename is_empty to is_empty_p.
(DO_RMDIR, DO_UNLINK): Remove definitions.
(remove_entry, fd_to_subdirp, compare_ino): Remove functions.
(dirent_count, dirent_inode_sort_may_be_useful): Likewise.
(preprocess_dir): Likewise.
(fts_skip_tree, mark_ancestor_dirs, excise, rm_fts): New functions.
(remove_cwd_entries, remove_dir, rm_1): Remove functions.
(rm): Rewrite as a simple loop calling fts_read and dispatching
each entry via rm_fts.
* src/rm.c (main): Adapt to new signature of rm().
* bootstrap.conf (gnulib_modules): Remove unlinkdir, no longer used.
* src/Makefile.am (sc_tight_scope): Also recognize an extern "enum"
declaration.
* tests/rm/empty-name: Adjust expected output to match new diagnostic.
* NEWS (Improvements): Mention it.
2009-09-11 14:08:51 +02:00
Jim Meyering
bd11475627 post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2009-09-11 08:16:18 +02:00
Jim Meyering
aa2f797c7d version 7.6
* NEWS: Record release date.
2009-09-11 07:53:16 +02:00
Jim Meyering
ebc7aacf7b link,ln: use gnulib's link module to work around Solaris 10 deficiency
Before this change, :>f; ln -T f no-such/ would succeed on Solaris 10.
After it, ln fails, as it should: ln: accessing `z/': Not a directory
The command, link f no-such/, had the same problem on that system.
* bootstrap.conf (gnulib_modules): Add "link".
* tests/ln/slash-decorated-nonexistent-dest: New test.
* tests/Makefile.am (TESTS): Add it.
* NEWS (Portability): Mention the improvement.
2009-09-10 18:52:12 +02:00
Jim Meyering
0bbb9d7785 dd conv=unblock: print final newline consistently
* src/dd.c (dd_copy) [C_UNBLOCK]: Always print the final newline for
non-empty output, not just when output size is a multiple of cbs.
* doc/coreutils.texi (dd invocation) [conv=unblock]: Mention that dd
prints a newline after each output record, not just when replacing
trailing spaces.
Reported by Ulrich Drepper.
* tests/dd/unblock: New file.  Test for this.
* tests/Makefile.am (TESTS): Add it.
* NEWS (Bug fixes): Mention it.
2009-09-10 12:25:04 +02:00
Jim Meyering
f0ff8c73fe tail: make the new piped-stdin test as portable as the old one
* src/tail.c (main): Adapt piped-stdin test to use the same isapipe,
test as was used in the preceding POSIXLY_CORRECT condition.
Remove the now-subsumed POSIXLY_CORRECT test.
Reported by Pádraig Brady.
* doc/coreutils.texi (tail invocation): Document this change.
* NEWS (Changes in behavior): Reclassify, clarify.
2009-09-08 13:30:38 +02:00
Jim Meyering
af6436559c tail: ignore -f for piped-stdin, as POSIX requires
* src/tail.c (main): Tailing a pipe "forever" is not useful,
and POSIX specifies that tail ignore the -f when there is no
file argument and stdin is a FIFO or pipe.  So we do that.
In addition, GNU tail excludes "-" arguments from the list of files
to tail forever, when the associated file descriptor is connected
to a FIFO or pipe.  Before this change, ":|tail -f" would hang.
Reported by Ren Yang and Ulrich Drepper.
* tests/tail-2/pipe-f: Test for this.
* tests/tail-2/pipe-f2: Ensure tail doesn't exit early for a fifo.
* tests/Makefile.am (TESTS): Add these tests.
* NEWS (POSIX conformance): Mention it.
2009-09-07 23:19:56 +02:00
Jim Meyering
f68f5f23c6 doc: tweak NEWS
* NEWS (dd): Tweak wording.
Two blank lines between sections.
2009-09-07 09:23:48 +02:00
Jim Meyering
cdfb703c5d tail -f: handle "-"/stdin once again
* src/tail.c (main) [HAVE_INOTIFY]: When stdin (i.e., "-", or no args,
but not /dev/stdin) is specified on the command line, don't use inotify.
Reported by Bill Brelsford in <http://bugs.debian.org/545422>.
* tests/tail-2/follow-stdin: New file.  Test for this.
* tests/Makefile.am (TESTS): Add the test.
* NEWS (Bug fixes): Mention it.
This bug was introduced in coreutils-7.5 via commit ae494d4b,
2009-06-02, "tail: use inotify if it is available".
2009-09-07 09:01:14 +02:00
Jim Meyering
d54376db68 tail: flush initial output before possibly blocking
* src/tail.c (main): Flush any output from tail_file,
before calling tail_forever_inotify, which can block.
* tests/tail-2/flush-initial: New file.  Test for the bug.
* tests/Makefile.am (TESTS): Add tail-2/flush-initial.
* NEWS (Bug fixes): Mention it.
This bug was introduced in coreutils-7.5 via commit ae494d4b,
2009-06-02, "tail: use inotify if it is available".
2009-09-06 09:40:43 +02:00
Jim Meyering
e0e8429c24 df: don't fail due to an unreadable argument
* src/df.c (main): If open or fstat fails when we're trying to ensure
that all arg-partitions are automounted, fall back on using stat.
Inspired by the report and patch from Olivier Fourdan in
http://bugzilla.redhat.com/520630.
* NEWS (Bug fixes): Mention it.
* tests/df/unreadable: New test for the above.
* tests/Makefile.am (TESTS): Add df/unreadable.
The bug was introduced in coreutils-7.3 via commit dbd17157,
2009-04-28, "df: use open(2), not stat, to trigger automounting".
2009-09-03 19:52:47 +02:00
Ondřej Vašík
1a94ac4a05 cp: don't leak resources for each xattr preservation failure
* src/copy.c (copy_reg): Don't return from the function after an
unsuccessful and required preservation of extended attributes.
This resulted in leaking the copy buffer and file descriptors.
* NEWS (Bug fixes): Mention the fix.
The bug was introduced in coreutils-7.1 via commit 0889381c, 2009-01-23,
"cp/mv: add xattr support".
2009-09-03 10:00:32 +01:00
Jim Meyering
a977dbbe78 ls -i: print consistent inode numbers also for mount points
On most unix- and linux-based kernels, ls -i DIR_CONTAINING_MOUNT_POINT
would print the wrong inode number for any entry that is a mount point.
It would do that by relying on readdir's dirent.d_ino values, while
most readdir implementations return the inode number of the underlying,
inaccessible directory.  Thus, it is not consistent with what you'd
get when applying stat to the same entry.  This bug led to surprising
results like "ls -i" and "ls -i --color" printing different numbers (ls
must usually "stat" a file to colorize its name).  This change makes it
so that on offending systems, ls must stat non-command-line-arguments
for which otherwise it would be able to use "for free" dirent.d_ino
values.  Regardless of this change, ls is already required to stat every
command-line argument.  Note: versions of GNU ls prior to coreutils-6.0
did not perform the invalid optimization, and hence always printed
correct inode numbers.  Thus, for the sake of correctness, ls -i is
forgoing the readdir optimization, for any kernel (including linux!)
with POSIX-nonconforming readdir.  Note that currently, only Cygwin has
been agile enough to conform.

* src/ls.c (RELIABLE_D_INO): Define.
(print_dir): Use it.
For plenty of discussion, see this long thread:
http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/14020
This bug was introduced by the 2006-02-26 commit, 33eb3efe:
"In ls, avoid calling stat for --inode (-i), when possible."
* tests/ls/readdir-mountpoint-inode: New test.
* tests/Makefile.am (TESTS): Add it.
* tests/ls/stat-vs-dirent: Don't suppress failure of this test,
now that ls -i is fixed.  Though note that it doesn't test well,
since it compares only the always-stat'd command-line arguments.
* NEWS (Bug fixes): Mention it.
2009-09-01 07:07:45 +02:00
Pádraig Brady
9e59f8c47c cp --reflink: preserve attributes on cloned files if asked
* src/copy.c (copy_reg): When cloning only skip the data copying
* tests/cp/reflink-perm: New test to check times and modes copied
* tests/Makefile.am: Reference the new test
* NEWS: Mention the fix
2009-08-29 01:37:05 +01:00
Pádraig Brady
72f98388c3 cp --reflink: add an "auto" parameter to fall back to a normal copy
* doc/coreutils.texi (cp invocation): Document the new
"auto" and "always" options to --reflink.
* src/copy.c (copy_reg): Fall back to a standard copy
when reflink() is not supported and --reflink=auto specified.
* src/copy.h [struct cp_options] (reflink): Change type s/bool/enum/.
* src/cp.c (usage): Describe the --reflink={always,auto} options
and expand a little on what --reflink does.
(main): parse the new parameters to --reflink and allow all
--sparse options with --reflink=auto.
* src/install.c (cp_option_init): Init the enum instead of bool.
* src/mv.c (cp_option_init): Likewise.
* tests/cp/reflink-auto: A new test for falling back to normal copy.
* tests/Makefile.am: Reference the new test.
* NEWS: Mention the new feature.
2009-08-29 00:24:49 +01:00
Eric Blake
31fa922e57 dd: detect closed stderr
* src/dd.c (maybe_close_stdout): Always flush stderr; regression
introduced in commit 381e69ea.
* tests/misc/close-stdout (p): Use consistent style.
* tests/dd/stderr: New test, borrowing from misc/close-stdout.
* tests/Makefile.am (TESTS): Run it.
* NEWS: Mention this.
2009-08-28 12:56:51 -06:00
Jim Meyering
2bc0f3caaa cp: ignore obscure failure to preserve symlink time stamps,
...when run on a kernel older than what was implied by headers and
libraries tested at configure time.
* src/copy.c (utimens_symlink): Ignore failure when errno == ENOSYS.
* NEWS (Bug fixes): Mention it.
Reported by Todd Zullinger and Kamil Dudka.
Details in this thread:
http://thread.gmane.org/gmane.linux.redhat.fedora.devel/119834
2009-08-24 12:44:13 +02:00
Jim Meyering
04a31ad99d post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2009-08-20 21:48:45 +02:00
Jim Meyering
af1996dde2 version 7.5
* NEWS: Record release date.
2009-08-20 21:19:36 +02:00
Giuseppe Scrivano
718b2790c0 nl: deprecate --page-increment in favor of --line-increment
* NEWS: Mention the change.
* doc/coreutils.texi: Document the new --line-increment option.
* src/nl.c (struct option): Add --line-increment,
(usage): Describe it,
(main): Use it.
2009-08-18 18:40:41 +02:00
Pádraig Brady
8574c74325 doc: clarify the cp --reflink NEWS
* NEWS: Remove the description associated with the removed
experimental code which unconditionally tried to reflink() on copy.
Also clarify where --reflink works exactly.
2009-08-14 10:48:07 +01:00
Pádraig Brady
e4caea5775 dd: fix a signal handling race
* src/dd.c (main): Install the signal handlers at startup
rather than just before the copy starts. In this way signals
received before the copy (like during a slow truncate for e.g.)
will be deferred and handled consistently.
* THANKS: Add Bernhard's email address.
* NEWS: Mention the fix.
Reported by Bernhard Voelker.
2009-08-13 16:06:50 +01:00
Giuseppe Scrivano
a1d7469835 cp: accept the --reflink option
* NEWS: Mention it.
* doc/coreutils.texi (cp invocation): Describe it.
* src/copy.h (struct cp_options) [reflink]: New member.
* src/copy.c (usage): Describe it.
(copy_reg): If reflink is true try to clone the file.
(main): Check for --reflink.
(cp_option_init): Initialize the new member.
* src/install.c (cp_option_init): Initialize the new member.
* src/mv.c (cp_option_init): Likewise.
* tests/cp/sparse: Add a new test case.
2009-08-07 17:14:22 +02:00
Jim Meyering
5929322ccb dd: work around buffer length restrictions with oflag=direct (O_DIRECT)
dd oflag=direct would fail to copy a file with size that is
not a multiple of 512 (destination file system specific)

* NEWS (Bug fixes): Mention it.
* src/dd.c (iwrite): Turn off O_DIRECT for any
smaller-than-obs-sized write.  Don't bother to restore it.
* tests/dd/direct: New test for the above.
* tests/Makefile.am (TESTS): Add dd/direct.
* doc/coreutils.texi (dd invocation): Mention oflag=direct
buffer size restriction.
Details in http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/17586
Reported by Eric Sandeen.
2009-08-06 09:41:50 +02:00
Jim Meyering
eae535e1a3 cp -pP (and e.g., -a): preserve time stamps on symlinks, too
* src/copy.c (utimensat_if_possible): New function.
(copy_internal): Remove variable, "preserve_metadata".
Replace with "dest_is_symlink".  That covers all cases but one:
the one in which cp --link has created hard links to non-directories.
In that case, there is no need to update attributes of the links.
Use utimensat_if_possible, to preserve timestamps of symlinks.
* NEWS (New features): Mention this.
* tests/Makefile.am (TESTS): Add cp/preserve-slink-time.
* tests/cp/preserve-slink-time: New file.
* m4/jm-macros.m4 (coreutils_MACROS): Test for utimensat.
Reported in http://bugzilla.redhat.com/230866
2009-08-04 17:38:54 +02:00
Kamil Dudka
1762092901 install runs faster again with SELinux enabled
* m4/jm-macros.m4: Pull in SELinux libraries while checking for
matchpathcon_init_prefix ().  Emit configure warning when not found
with SELinux enabled.
* NEWS (Bug fixes): Mention it.
The bug was introduced in coreutils-7.0 via commit 0647f3eb, 2008-06-02,
"accommodate older SELinux which lacks matchpathcon_init_prefix".
2009-08-04 16:51:52 +02:00
Jim Meyering
bc51349ccd maint: update NEWS
* NEWS (New features): Mention it.
2009-07-29 12:27:08 +02:00
Kamil Dudka
493c481684 ls -1U dir arg ... now works again
* src/ls.c (print_dir): Emit "$dir_name:\n" *before* accumulating (and
possibly printing) directory entry names.
The bug was introduced in coreutils-7.0 via commit
8d974b00, 2008-07-30, "ls -U1 now uses constant memory".
Reported by Julian Bradfield.
* NEWS (Bug fixes): Mention it.
2009-07-27 17:10:39 +02:00
Pádraig Brady
9c6c621c32 doc: clarify the tail inotify NEWS
* NEWS: Say why inotify was used
2009-06-25 14:50:05 +01:00
Pádraig Brady
a5a2a406f8 stdbuf: A new program to run a command with modified stdio buffering
* AUTHORS: Register as the author.
* NEWS: Mention this change.
* README: Add stdbuf command to list.
* configure.ac: Only enable on ELF systems with GCC.
* cfg.mk (sc_system_h_headers): Use VC_LIST_EXCEPT rather than
VC_LIST, so we can add an exception, if needed.
* .x-sc_system_h_headers: New file.  Exempt libstdbuf.c.
* Makefile.am (syntax_check_exceptions): Add .x-sc_system_h_headers.
* doc/coreutils.texi (stdbuf invocation): Add stdbuf info.
* man/.gitignore: Ignore generated manpage.
* src/.gitignore: Ignore stdbuf and libstdbuf.so binaries.
* man/Makefile.am (stdbuf.1): Add dependency.
* man/stdbuf.x: New file with example usage.
* po/POTFILES.in: Reference new command and shared library sources.
* src/Makefile.am (build_if_possible__progs): Add stdbuf and libstdbuf,
(pkglib_PROGRAMS): Reference optional shared lib,
(libstdbuf_so_LDADD): Ensure we don't link with non PIC libcoreutils.a.
(libstdbuf_so_LDFLAGS): Add -shared GCC option,
(libstdbuf_so_CFLAGS): Add -fPIC GCC option.
(check-README): Exclude libstbuf.
(check-AUTHORS): ditto.
(sc_tight_scope): Exclude functions starting with __.
* src/libstdbuf.c: The LD_PRELOAD shared library to control buffering.
* src/stdbuf.c: New file to setup env variables before execing command.
* tests/Makefile.am: Reference new test file.
* tests/misc/help-version: Set expected exit codes.
* tests/misc/invalid-opt: ditto.
* tests/misc/stdbuf: Add 9 tests.
2009-06-17 14:54:29 +01:00
Giuseppe Scrivano
ae494d4be8 tail: use inotify if it is available
* NEWS: Document the new feature.
* m4/jm-macros.m4: Check if inotify is present.
* src/tail.c (tail_forever_inotify): New function.
(main): Use the inotify-based function, if possible.
* tests/Makefile.am: Add new tests for tail.
* tests/test-lib.sh (require_proc_pid_status_, get_process_status_):
New functions.
* tests/tail-2/pid: New file.
* tests/tail-2/wait: New file.
* tests/tail-2/tail-n0f: Refactor code into the test-lib.sh
require_proc_pid_status_ function.
2009-06-15 18:34:14 +02:00
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