Jim Meyering [Thu, 8 Jun 2006 20:13:37 +0000 (20:13 +0000)]
Ensure that cat works with any of the options, -A -v -e -E -T,
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.
Jim Meyering [Sat, 3 Jun 2006 09:04:22 +0000 (09:04 +0000)]
Make `cp --link --no-dereference' work also on systems where the
link system call cannot create a hard link to a symbolic link.
(copy_internal) [LINK_FOLLOWS_SYMLINKS]: Don't use
the link syscall on a symlink when it would do the wrong thing.
Based on the patch by Aurelien Jarno: <http://bugs.debian.org/329451>
Jim Meyering [Sat, 3 Jun 2006 09:03:19 +0000 (09:03 +0000)]
Test for this:
Make `cp --link --no-dereference' work also on systems where the
link system call cannot create a hard link to a symbolic link.
* src/copy.c (copy_internal) [LINK_FOLLOWS_SYMLINKS]: Don't use
the link syscall on a symlink when it would do the wrong thing.
Based on the patch by Aurelien Jarno: <http://bugs.debian.org/329451>
Jim Meyering [Sun, 28 May 2006 09:32:54 +0000 (09:32 +0000)]
AIX 4.3.3 gives a different diagnostic.
Recognize it, too. Reported by Ralf Wildenhues, in
http://lists.gnu.org/archive/html/bug-coreutils/2006-05/msg00192.html
Jim Meyering [Sat, 27 May 2006 14:44:41 +0000 (14:44 +0000)]
Support new options: --preserve-root and --no-preserve-root.
Somehow this program was skipped when those options were added to chown,
chmod, and rm. Reported by vaqflabuopac@spammotel.com in
<http://bugs.debian.org/365656>.
Paul Eggert [Thu, 25 May 2006 21:57:22 +0000 (21:57 +0000)]
(small_open, large_open): New macros.
(__open, __open64) [!_LIBC]: Remove.
(__gen_tempname): Use small_open and large_open instead of __open
and __open64. This fixes a portability bug on HP-UX 11.11i
reported by Simon Wing-Tang in
<http://lists.gnu.org/archive/html/bug-coreutils/2006-05/msg00114.html>.
Paul Eggert [Mon, 22 May 2006 20:11:45 +0000 (20:11 +0000)]
* filemode.c (setst): Remove.
(strmode): Rewrite to avoid setst. This makes the code shorter,
(arguably) clearer, and the generated code is a bit smaller on my
Debian GNU/Linux stable x86 host.
Jim Meyering [Sat, 20 May 2006 07:19:53 +0000 (07:19 +0000)]
(main): Rename local, s/symlink_deref_bit/symlink_deref_bits/
and arrange for -D to set fts' FTS_PHYSICAL bit as well as
FTS_COMFOLLOW. Spotted by Justin Pryzby.
Jim Meyering [Fri, 19 May 2006 12:36:18 +0000 (12:36 +0000)]
(main): Don't let -D, -L, or -P turn off the internal
FTS_TIGHT_CYCLE_CHECK directory traversal option.
Reported by Justin Pryzby in http://bugs.debian.org/367691
Jim Meyering [Mon, 15 May 2006 10:59:10 +0000 (10:59 +0000)]
Avoid the expense of an fstat, when possible.
(O_NOFOLLOW, STREQ): Define.
(diropen_fd): Remove function. Merge it into sole caller...
(diropen): ...here. Use O_NOFOLLOW when appropriate.
(fts_safe_changedir): Call fstat for dev/inode check, only if the
previous open/openat call may have opened the wrong directory.
Jim Meyering [Mon, 15 May 2006 10:00:16 +0000 (10:00 +0000)]
Restore the parts of fts that were removed on 2006-01-17, so that
it's easier for legacy applications designed for the version
of fts in glibc or BSD to convert to this more robust version.
Add a new mode, FTS_CWDFD, by which to enable the improved
(openat- based -- aka no-chdir) semantics.
* fts_.h (FTS_CWDFD): Define. Callers must use this fts_open
option to enable the more robust behavior.
(FTS_OPTIONMASK): Widen accordingly.
* fts.c: Restore removed code, reverting the default behavior.
Paul Eggert [Mon, 15 May 2006 03:17:08 +0000 (03:17 +0000)]
(AC_HEADER_STDBOOL): Fix overly-picky
test for C99 conformance; (bool) 0.5 is an integer constant
expression, but (bool) -0.5 is not. Problem reported by Fedor
Sergeev in <http://forum.sun.com/jive/thread.jspa?threadID=96202>.
Jim Meyering [Thu, 11 May 2006 08:55:04 +0000 (08:55 +0000)]
mv -T DIR EMPTY_DIR no longer fails
(copy_internal): Don't manually prohibit a move where
the destination is an existing directory. Sometimes doing that is
valid. Let the rename system call enforce the rules. That is
allowed only when the source is a directory and the destination
directory (to be replaced) is empty. Reported by Eric Blake.