Commit Graph

543 Commits

Author SHA1 Message Date
Jim Meyering
8ad8aa5322 Version 6.9.92 2008-01-12 00:34:31 +01:00
Jim Meyering
e52a7c28ac tests/tr/Test.pm: Prefer en_US.ISO-8859-1 to en_US.iso88591.
Suggestions from James Youngman and Pádraig Brady in
http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/12218/focus=12227
2008-01-11 10:07:01 +01:00
Jim Meyering
ab1c9b54b1 NEWS: Mention the cp bug fix. 2008-01-07 12:18:00 +01:00
Jim Meyering
9b76bc2b54 touch: add a test for today's change.
* tests/touch/now-owned-by-other: New script.  Test today's change.
* tests/touch/Makefile.am (TESTS): Add now-owned-by-other.
* tests/Makefile.am (all_t): Add td, a new root-only test.
(td): New target.
* NEWS: Mention the improvement.
2008-01-06 12:50:54 +01:00
Jim Meyering
6efd10462d Avoid tr case-conversion failure in some locales.
* src/tr.c (skip_construct): New function.
(main): When processing a pair of case-converting classes, don't
iterate through the elements of each [:upper:] or [:lower:] class.
Reported by Gerald Pfeifer in
<http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/12218>.
* tests/tr/Test.pm [tolower-F]: New test for the above fix.
[upcase-xtra, dncase-xtra]: New tests, for a related code path.
* NEWS: Mention the tr bug fix.
2008-01-06 00:09:29 +01:00
Jim Meyering
e19a5aa428 Note that sorting uniq's input is often useful.
Suggested by Eric Blake.
2007-12-18 11:20:45 +01:00
Jim Meyering
7477cd1662 Version 6.9.91. 2007-12-15 09:44:40 +01:00
Jim Meyering
7407dc042a Add a test to exercise today's bug fix.
* tests/misc/selinux: Test for today's bug fix.
* NEWS: Mention the SELinux "ls -l" fix.
2007-12-11 21:41:52 +01:00
Jim Meyering
291eb90a0a * NEWS: Add the "Bug fixes" heading. 2007-12-11 19:08:03 +01:00
Jim Meyering
de5b055bbf "rm" as root would fail to unlink a non-directory on OS X 10.4.x
* src/remove.c (remove_entry) ["can unlink directories"]: Fix a
mistakenly reversed condition.
* NEWS: Mention this bug fix.
Reported by Pieter Bowman.
2007-12-09 00:57:00 +01:00
Jim Meyering
b1a1db5900 * NEWS: Add the usual "Noteworthy changes in release 6.9.91..." line. 2007-12-02 18:39:40 +01:00
Jim Meyering
bb5c20212f NEWS: Remove the now-untrue statement about cp vs. dangling symlinks 2007-12-01 22:46:05 +01:00
Jim Meyering
ab73462d4b * NEWS: Mention some of the SELinux changes.
Record release date and new version number.
* src/stat.c (main): Adjust a comment.
2007-12-01 18:48:43 +01:00
Lasse Collin
cbc06bb639 "cp -p" tries to preserve GID even if preserving the UID fails.
* NEWS: Mention this new feature.
* src/copy.c (set_owner): Try to preserve just the GID,
when initial fchown/lchown fails.
* src/cp.c (re_protect): Likewise.
2007-11-24 15:06:43 +01:00
Jim Meyering
0e9b06482e Add tests to show new class of strings accepted by date -d.
* tests/misc/date (rel-1day, rel-plus1): New tests for the recent
change in gnulib's getdate.y.
* NEWS: Mention the fix.
2007-11-23 08:27:16 +01:00
Jim Meyering
2bdc481219 cp: by default, refuse to copy through a dangling destination symlink
* NEWS: Mention this change.
* doc/coreutils.texi (cp invocation): Describe the new behavior.
* src/copy.c: No longer include "canonicalize.h".
(copy_reg): Upon failure to open a dangling destination symlink, don't
canonicalize the name, but rather fail (default) or, with POSIXLY_CORRECT,
repeat the open call without O_EXCL (potentially dangerous).
* src/copy.h (struct cp_options) [open_dangling_dest_symlink]:
New member.  Reorder the others, grouping "bool" and "enum"
members together.
* tests/cp/thru-dangling: Test for changed and new behavior.
* src/cp.c (cp_option_init): Initialize new member.
* src/install.c (cp_option_init): Likewise.
* src/mv.c (cp_option_init): Likewise.

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

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

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

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

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

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

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

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

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

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

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

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

* src/copy.c: Include "canonicalize.h".
(copy_reg): Use canonicalize_filename_mode to follow the symlink,
so that we can always open with O_EXCL and avoid a race.
2007-06-15 22:47:16 +02:00
Jim Meyering
b1b0f5c556 bug-fix: cp would fail to write through a dangling symlink
* NEWS: Mention the bug fix.
* src/copy.c (copy_reg): When open fails with EEXIST, the destination
is lstat'able, and a symlink, call open again, but now without O_EXCL.
* tests/cp/thru-dangling: New file, to test for the above fix.
* tests/cp/Makefile.am (TESTS): Add thru-dangling.
* THANKS: Add Michael McLagan.
Bug report from Michael McLagan in <http://bugzilla.redhat.com/243588>.
2007-06-10 15:01:18 +02:00
James Youngman
e82c7ddd47 wc: ignore multibyte-character decoding errors
* src/wc.c (wc): Don't issue an error message when mbrtowc
indicates that we have seen an invalid byte sequence.  This
makes "wc /bin/sh" bearable (though the word and line counts
are likely not to be useful).
* NEWS: Mention the change.
2007-05-26 07:13:50 +02:00
Jim Meyering
a6a447fc58 cut: diagnose a range starting with 0 (-f 0-2) as invalid, and
give a better diagnostic for a field-number/offset of 0.
* NEWS: Mention the fix.
* src/cut.c (ADD_RANGE_PAIR): Add an explicit check for 0.
Based on a patch from James Youngman.
* tests/misc/cut: Add tests for the above.
2007-05-22 18:47:17 +02:00