* NEWS: Describe how the fix affects pr.
* src/pr.c (init_parameters): The --merge (-m) option does
not imply --expand-tabs (-e), so don't set "untabify_input".
Reported by Wis Macomson.
* tests/misc/pr: New file. Test for the above fix.
* tests/misc/Makefile.am (TESTS): Add pr.
* THANKS: Update.
* NEWS: mention cp -x bug fix
* src/copy.c (copy_internal): Don't return immediately after
copying a mount point that we do not intend to recurse under.
Based on a patch by Andrew Church.
* NEWS: With -P, the default block size and output format is not
affected by DF_BLOCK_SIZE, BLOCK_SIZE, or BLOCKSIZE.
* src/df.c (main): Implement this.
* doc/coreutils.texi (df invocation): With -P, the default block size
and output format is not affected by DF_BLOCK_SIZE, BLOCK_SIZE, or
BLOCKSIZE.
* bootstrap.conf: Remove findprog.
* doc/coreutils.texi (sort invocation): The default is to not
compress. Don't treat "" specially.
* src/sort.c: Don't include findprog.h.
(create_temp): Compress only if the user specified --compress-program.
* tests/misc/sort-compress: Adjusts tests to match new behavior.
an environment variable.
* doc/coreutils.texi (sort invocation): Document this.
* src/sort.c (usage): Likewise.
(COMPRESS_PROGRAM_OPTION): New const.
(long_options, create_temp, main): Support new option.
* tests/misc/sort-compress: Test it.
* src/copy.c (copy_internal): Omit the group- or other-writeable
permissions when creating a directory, to avoid a race condition
if the special mode bits aren't right just after the directory is
created.
* src/cp.c (make_dir_parents_private): Likewise.
* tests/cp/parent-perm-race: Test for the "cp --preserve=mode"
race fix in copy.c.
* src/cp.c (make_dir_parents_private): Report the error sooner with
"cp --parents DIR/FILE DEST" when DIR is a non-directory, thus not
creating the directory, DEST/DIR.
* tests/cp/cp-parents: Test for the non-race-condition bug fixed
by the above change.
like it will be approved. Also add --check=quiet, --check=silent
as long aliases, and --check=diagnose-first as an alias for -c.
* doc/coreutils.texi (sort invocation): Document this.
Also, mention that sort -c can take at most one file.
* src/sort.c: Implement this.
Include argmatch.h.
(usage): Document the change.
(CHECK_OPTION): New constant.
(long_options): --check now takes an optional argument, and is now
treated differently from 'c'.
(check_args, check_types): New constant arrays.
(check): New arg CHECKONLY, which suppresses diagnostic if -C.
(main): Parse the new options.
* tests/sort/Test.pm (02d, 02d, incompat5, incompat6):
New tests for -C.
In pipe_fork callers, use these named constants, not "2" and "8".
(proctab, nprocs): Declare to be "static".
(pipe_fork) [lint]: Initialize local, pid,
to avoid unwarranted may-be-used-uninitialized warning.
(create_temp): Use the active voice. Describe parameters, too.
2007-01-21 James Youngman <jay@gnu.org>
Centralize all the uses of sigprocmask(). Don't restore an invalid
saved mask.
* src/sort.c (enter_cs, leave_cs): New functions for protecting
code sequences against signal delivery.
* (exit_cleanup): Use enter_cs and leave_cs instead of
calling sigprocmask directly.
(create_temp_file, pipe_fork, zaptemp): Likewise
2007-01-21 Dan Hipschman <dsh@linux.ucla.edu>
Add compression of temp files to sort.
* NEWS: Mention this.
* bootstrap.conf: Import findprog.
* configure.ac: Add AC_FUNC_FORK.
* doc/coreutils.texi: Document GNUSORT_COMPRESSOR environment
variable.
* src/sort.c (compress_program): New global, holds the name of the
external compression program.
(struct sortfile): New type used by mergepfs and friends instead
of filenames to hold PIDs of compressor processes.
(proctab): New global, holds compressor PIDs on which to wait.
(enum procstate, struct procnode): New types used by proctab.
(proctab_hasher, proctab_comparator): New functions for proctab.
(nprocs): New global, number of forked but unreaped children.
(reap, reap_some): New function, wait for/cleanup forked processes.
(register_proc, update_proc, wait_proc): New functions for adding,
modifying and removing proctab entries.
(create_temp_file): Change parameter type to pointer to file
descriptor, and return type to pointer to struct tempnode.
(dup2_or_die): New function used in create_temp and open_temp.
(pipe_fork): New function, creates a pipe and child process.
(create_temp): Creates a temp file and possibly a compression
program to which we filter output.
(open_temp): Opens a compressed temp file and creates a
decompression process through which to filter the input.
(mergefps): Change FILES parameter type to struct sortfile array
and update access accordingly. Use open_temp and reap_some.
(avoid_trashing_input, merge): Change FILES parameter like
mergefps and call create_temp instead of create_temp_file.
(sort): Call create_temp instead of create_temp_file.
Use reap_some.
(avoid_trashing_input, merge, sort, main): Adapt to mergefps.
* NEWS: Mention this.
* src/remove.h (enum rm_interactive): New ternary type.
(struct rm_options) [interactive]: Use it, here -- rather than bool.
* src/remove.c (prompt): Reflect type change.
* src/mv.c (rm_option_init): Initialize to RMI_NEVER now.
* src/rm.c (main): Add a FIXME comment for '-d' option.
Adapt to type change of rm_options.interactive.
* tests/rm/i-never: New file. Test for the above fix.
* tests/rm/Makefile.am (TESTS): Add i-never.
* NEWS: Mention this bug fix.
* src/ls.c (gobble_file): Fix bug reported by
Nobuyuki Tsuchimura in
http://lists.gnu.org/archive/html/bug-coreutils/2006-12/msg00152.html
where "ls -FRL" didn't follow a symbolic link in some cases on Linux.
* tests/ls/follow-slink: Add a test for this case.
Signed-off-by: Jim Meyering <jim@meyering.net>
as POSIX requires.
* src/dd.c (scanargs): Implement it.
* tests/dd/misc (outbytes): Test it.
* doc/coreutils.texi (dd invocation): Specify that bs=N
overrides later ibs and obs, undoing part of the
previous change. (The behavior was wrong.)
* src/remove.c (remove_entry): Handle EACCES for a non-directory, too.
Karl Berry reported that a cross-partition "mv /etc/issue ~"
failed with the um,... suboptimal diagnostic,
"mv: cannot remove `/etc/issue': Not a directory".
* tests/rm/Makefile.am (TESTS): Add fail-eacces.
* tests/rm/fail-eacces: New file.
* NEWS: Mention that both mv and rm are affected.
* src/cut.c (cut_fields): Set file-scoped global to NULL after
freeing it. This avoids a double-free (and core dump on some systems)
for this usage: "echo 1>a; echo 2>b; cut -f2- a b". Reported by
James Hunt in <http://bugzilla.redhat.com/220312>.
* NEWS: List this bug fix.
* THANKS: Mention him.
* tests/misc/cut: New file.
* tests/misc/Makefile.am (TESTS): Add cut.
* src/chmod.c (process_file): Do honor the --preserve-root option.
* src/chown-core.c (change_file_owner): Likewise, but here, also
handle the case in which a traversal would go "through" a symlink
to root. Reported by Matthew M. Boedicker
* tests/chown/preserve-root: Test for the above.
* tests/chown/Makefile.am (TESTS): Add preserve-root.
* NEWS: Document the cp -p fix for special bits.
* src/copy.c (set_owner): Now returns a three-way result, so
that the caller can clear the special bits. All callers changed.
(copy_reg): Don't set the special bits if chown failed.
(copy_internal): Likewise.
* tests/cp/special-bits: Test this fix.
Signed-off-by: Jim Meyering <jim@meyering.net>
* m4/jm-macros.m4 (coreutils_MACROS): Check for fchmod.
* src/copy.c (fchmod_or_lchmod): New function.
(copy_reg): New arg OMITTED_PERMISSIONS. All uses changed.
Omit confusing and unused ", dst_mode" arg to 'open' without O_CREAT.
When creating a file, use O_EXCL, so we're more likely to detect
funny business by other processes. At the end, if permissions
were omitted, chmod them back in.
(copy_internal): If the ownership might change, omit some permissions
at first, then restore them after chowning the file.
* src/cp.c (make_dir_parents_private): Likewise.
* src/copy.c (cached_umask): New function.
* src/copy.h (cached_umask): New decl.
directory listed as second or subsequent command line argument.
* tests/du/one-file-system: New file. Test for today's fts.c fix.
* tests/du/Makefile.am (TESTS): Add one-file-system.
Suggested by Steve McIntyre in <http://bugs.debian.org/392925>.
* src/remove.h (struct rm_options) [one_file_system]: New member.
* src/rm.c (rm_option_init): Initialize it.
(usage): Document the option.
* src/mv.c (rm_option_init): Likewise.
* src/remove.c (remove_dir): With --one-file-system and --recursive,
for each directory command line argument, do not affect a file system
different from that of the starting directory. And give a diagnostic.
* src/rm.c (ONE_FILE_SYSTEM): New enum.
(main): Handle new option.
* tests/rm/one-file-system: Test the above.
* tests/rm/Makefile.am (TESTS): Add one-file-system.
* tests/Makefile.am (check-root): Add the rm/one-file-system
test to the list.
(EXTRA_DIST): Add other-fs-tmpdir.
* tests/mv/setup: Removed. Renamed to...
* tests/other-fs-tmpdir: ...this new file.
* tests/mv/Makefile.am (EXTRA_DIST): Remove setup.
* tests/mv/acl: Reflect renaming: use ../other-fs-tmpdir.
* tests/mv/backup-is-src: Likewise.
* tests/mv/hard-link-1: Likewise.
* tests/mv/leak-fd: Likewise.
* tests/mv/mv-special-1: Likewise.
* tests/mv/part-fail: Likewise.
* tests/mv/part-hardlink: Likewise.
* tests/mv/part-rename: Likewise.
* tests/mv/part-symlink: Likewise.
* tests/mv/partition-perm: Likewise.
* tests/mv/to-symlink: Likewise.
* tests/mv/into-self-2: Likewise.
[doc/ChangeLog]
* coreutils.texi (rm invocation): Describe --one-file-system.
to dir1/dir2~.
* src/copy.c (copy_internal): Although we do create a backup of each
destination directory when in move mode, don't do that when copying.
Reported by Peter Breitenlohner, in
<http://article.gmane.org/gmane.comp.gnu.core-utils.bugs/8616>.
* tests/cp/backup-dir: New file. Test for the above.
* src/remove.c (ignorable_missing): New function.
Use it everywhere, rather than open-coding the test.
Andreas Schwab reported the ENOTDIR problem.
(ignorable_missing): Similarly, don't fail for ENAMETOOLONG.
* NEWS: Mention the bug fix.
* tests/rm/ignorable: New file. Test for the ENOTDIR case.
* tests/rm/ignore-name-too-long: New file. Test for ENAMETOOLONG.
* tests/rm/Makefile.am (TESTS): Add the new file names.
* NEWS: Record the 6.3 release date.
* configure.ac (AC_INIT): Remove "-cvs" suffix from version string.
* NEWS: Mention Paul's Solaris 8 vs. 10 work-around.
and NFS, whereby rm would not remove all files in a directory.
* src/remove.c (CONSECUTIVE_READDIR_UNLINK_THRESHOLD): Reduce to 10.
(NEED_REWIND): New macro, so that we incur the cost of the work-around
rewinddir only on afflicted systems.
* NEWS: Clarify and correct.
* tests/rm/readdir-bug: New file. Test for the above fix.
* tests/rm/Makefile.am (TESTS): Add it.
Prompted by testing and analysis from Bruno Haible:
http://lists.gnu.org/archive/html/bug-coreutils/2006-09/msg00326.html
it from removing a directory containing 188 or more entries.
* src/remove.c (CONSECUTIVE_READDIR_UNLINK_THRESHOLD): Decrease by
20, go work around the buggy readdir on Darwin 8.6.1 with NFS.
Reported by Matthew Woehlke.
* NEWS: "groups user" no longer outputs "user :"; you need at least
two users. "groups" now processes options like --help more compatibly.
* src/groups.sh: Implement the option-processing change.
Handle user and group names with special characters more robustly.
Report write errors instead of exiting silently with status 1.
[doc/ChangeLog]
* coreutils.texi (groups invocation): "groups" no longer prefixes
the output with "user :" unless more than one user is specified.
* src/copy.c (copy_reg): With --verbose (-v), print
"removed `file_name'" just after unlinking a file.
(copy_internal): Likewise, in three more places.
Marc Lehman reported that "touch x; ln x y; mv -v x y" was silent.
* src/copy.c (copy_internal): With -i, prompt even if the source
is a directory and the destination is not. This is required by
POSIX and gives the user a chance to bail out before failing.
* tests/cp/Makefile.am (TESTS): Add cp-i.
* tests/cp/cp-i: New file.
* tests/mv/Makefile.am (TESTS): Add i-5.
* tests/mv/i-5: New file.
* bootstrap.conf (gnulib_modules): Add savewd.
* src/install.c: Include savewd.h.
(process_dir): New function.
(main, install_file_in_file_parents): Use it, along with the new
savewd module, to avoid some race conditions.
* src/mkdir.c: Include savewd.h.
(struct mkdir_options): New members make_ancestor_function, mode,
mode_bits.
(make_ancestor): Return 1 if the resulting directory is not readable.
(process_dir): New function.
(main): Use it, along with new savewd module, to avoid some
race conditions. Fill in new slots of struct mkdir_options, so
that callees get the values.
* tests/install/basic-1: Test for coreutils 5.97 bug that was
fixed in coreutils 6.0, and which should still be fixed with
this change.
* tests/mkdir/p-3: Likewise.
where the first one names a directory and the second name ends in
a slash and doesn't exist. E.g., "mv dir B/", for nonexistent B,
now succeeds, once more. This reverts part of the 2004-06-27
change for 5.3.0.
* NEWS: Say the above.
* src/mv.c (target_directory_operand): Don't require (here)
that the target operand "look like" a directory. This change
pushes the test down to the rename syscall level, where a
"mv dir existing-non-dir/" will mistakenly succeed on older systems
that ignore trailing slashes in the rename destination argument.
* src/cp.c (target_directory_operand): Likewise, but for cp.
* tests/mv/trailing-slash: Exercise the above fixes.
* tests/cp/trailing-slash: New file.
* tests/cp/Makefile.am (EXTRA_DIST): Add trailing-slash.
" (backup: foo.~1~)" suffix also when backing up a directory.
* NEWS: Report this bug fix.
* src/copy.c (emit_verbose): New function, factored out of...
(copy_internal): ...here. Use the new function.
* tests/mv/backup-dir: Test for the above fix.
no differently than regular directories on a file system with
dirent.d_type support.
* NEWS: Say the above.
* src/ls.c (gobble_file): With --color, also stat the file when
we know it is a directory.
Derived from an anonymous one-line fix and bug report:
<https://savannah.gnu.org/bugs/?15043>.
* tests/ls/color-dtype-dir: New file. Test for the above fix.
* tests/ls/Makefile.am (TESTS): Add color-dtype-dir.
when the file's apparent size is not a multiple of its block size.
* src/copy.c (copy_reg): Don't write a NUL before calling ftruncate.
For some file sizes, writing that single byte would unnecessarily
waste a few file blocks. That write may have been necessary in the
early days of Linux, but now, removing it should be safe.
Based on a patch by Alan Curry: <http://bugs.debian.org/370792>
* tests/cp/sparse: New test for the above.
* tests/cp/Makefile.am (TESTS): Add sparse.
* tests/sparse-file: New file, essence factored out of...
* tests/du/8gb: ... here. Use the new script.
no output. This change was in 6.0 but inadvertently unmentioned.
* doc/coreutils.texi (df invocation): df exits nonzero if it outpus
nothing.
* src/df.c (file_systems_processed): Renamed from n_valid_args, and now
a boolean.
(show_dev): Don't set it until we actually output something.
Print the header if this is the first output.
(main): Don't print a header, as that is now show_dev's job.
* tests/misc/Makefile.am (TESTS): Add df.
* tests/misc/df: New file.
stat for a symlink, even though it wasn't always needed.
In some cases, that unnecessary stat would cause ls to fail.
* src/ls.c (gobble_file): Don't treat symlinks specially (in
requiring a stat syscall). Remove the offending exclusion.
* NEWS: Mention the fix.
* tests/ls/stat-dtype: New file/test, for the above fix.
Also exercises the new df feature, below.
of directories alone unless you specify them explicitly.
install and mkdir now implement X correctly.
install now creates parent directories with mode 755, without
changing their owner or group.
information if seq's operands are all fixed point decimal numbers.
You no longer need the `-f%.f' in `seq -f%.f 1048575 1024 1050623',
for example, since the default format now has the same effect.
seq now lets you use %a, %A, %E, %F, and %G formats.
seq now uses long double internally rather than double.
* src/remove.c (remove_cwd_entries): If we can't open a directory,
and the failure is not being ignored, try to remove the directory
with rmdir (aka unlinkat-with-AT_REMOVEDIR), in case it's empty.
Problem report and test case from Paul Eggert in
<http://article.gmane.org/gmane.comp.gnu.core-utils.bugs/7425>.
* tests/rm/empty-inacc: New test, for the above.
contains a list of NUL-separated file names.
* src/wc.c: Include "readtokens.h".
(usage): Describe the new option, and adjust the `Usage':
with this option, no FILE may be specified on the command line.
(main): Handle the new option.
* tests/misc/wc-files0: New tests, for the above.
* tests/misc/wc-files0-from: Likewise.
* tests/misc/Makefile.am (TESTS): Add wc-files0.
when applied to files in /proc and /sys, even when the FIONREAD
ioctl produces nonsensical results. Before this change, cat would
produce no output (or truncated output), for some linux kernels.
* src/cat.c (write_pending): New function, factored out of cat.
(cat): Also interpret a negative ioctl/FIONREAD count as indicating
that there are bytes to read. Some versions of linux-2.6.16 do that.
Write any pending output before returning.
Reported by Dan Jacobson in <http://bugs.debian.org/370583>.
* NEWS: Mention this bug fix.
* tests/misc/cat-proc: New file. Test for the above.
* tests/misc/Makefile.am (TESTS): Add cat-proc.
that provide openat (Solaris), and on systems like Linux+procfs
where our openat emulation code is reentrant. This also fixes a
few low-probability leaks and eliminates some code that could,
in very unusual circumstances, cause rm() (via a callee) to exit.