platform/upstream/coreutils.git
17 years agoNEWS: Move the other "sort" entry from the 6.9 section into 6.10 "Bug fixes".
Jim Meyering [Tue, 24 Jul 2007 08:00:59 +0000 (10:00 +0200)]
NEWS: Move the other "sort" entry from the 6.9 section into 6.10 "Bug fixes".

17 years agosort: add a test to exercise the affected code.
Jim Meyering [Tue, 24 Jul 2007 07:59:14 +0000 (09:59 +0200)]
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.

17 years agosort: avoid unaligned access.
Paul Eggert [Tue, 24 Jul 2007 07:40:55 +0000 (09:40 +0200)]
sort: avoid unaligned access.
* src/sort.c (fillbuf): When enlarging the line buffer, ensure that
the new size is a multiple of "sizeof (struct line)".  This avoids
alignment problems when indexing from the end of the buffer.
Problem reported by Andreas Schwab in
<http://lists.gnu.org/archive/html/bug-coreutils/2007-07/msg00158.html>.

17 years agoUpdate all copyright notices to use the newer form.
Jim Meyering [Mon, 23 Jul 2007 12:35:58 +0000 (14:35 +0200)]
Update all copyright notices to use the newer form.

17 years ago* COPYING: Update to Version 3.
Jim Meyering [Mon, 23 Jul 2007 12:31:01 +0000 (14:31 +0200)]
* COPYING: Update to Version 3.

17 years agoUpdate c99/c89 patch for new, copyright-change-induced offsets.
Jim Meyering [Mon, 23 Jul 2007 12:07:02 +0000 (14:07 +0200)]
Update c99/c89 patch for new, copyright-change-induced offsets.
* Makefile.maint (patch-check): Filter out '^Only in...' lines.
* src/c99-to-c89.diff: Handle new c99'isms in seq.c.

17 years agoArrange to rerun configure whenever src/Makefile.am changes.
Jim Meyering [Sun, 22 Jul 2007 16:26:23 +0000 (18:26 +0200)]
Arrange to rerun configure whenever src/Makefile.am changes.
* configure.ac: Arrange to rerun configure whenever src/Makefile.am changes.
That file contains the list of program names that must be substituted into
files like man/Makefile.
Add quotes around AC_SUBST arguments.

Signed-off-by: Jim Meyering <jim@meyering.net>
17 years ago* bootstrap (slurp): Work even in environments where "ls" defaults
Paul Eggert [Sat, 21 Jul 2007 13:00:54 +0000 (15:00 +0200)]
* bootstrap (slurp): Work even in environments where "ls" defaults
to "ls -A".  Put in a FIXME, though, since the current code does
not slurp files whose names start with ".", and this looks like
it might be a troublesome area.

17 years agoDocument and add a test for today's sort bug fix.
Jim Meyering [Fri, 20 Jul 2007 16:42:23 +0000 (18:42 +0200)]
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.

17 years ago* src/sort.c (main): Don't free a pointer to non-malloc'd memory.
Andreas Schwab [Fri, 20 Jul 2007 14:29:06 +0000 (16:29 +0200)]
* src/sort.c (main): Don't free a pointer to non-malloc'd memory.

17 years agoFix a portability bug in the new ls-color test.
Jim Meyering [Thu, 19 Jul 2007 08:17:39 +0000 (10:17 +0200)]
Fix a portability bug in the new ls-color test.
* tests/ls/stat-free-symlinks: Don't rely on the ability of
a built-in printf to interpolate '\e'.  Use '\033' instead.

17 years ago"cp -i --update older newer" no longer prompts; same for mv
Jim Meyering [Thu, 19 Jul 2007 08:14:41 +0000 (10:14 +0200)]
"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.

17 years agoChangeLog: Mention the correct function name in the 2007-07-08 bootstrap
Jim Meyering [Tue, 17 Jul 2007 07:16:59 +0000 (09:16 +0200)]
ChangeLog: Mention the correct function name in the 2007-07-08 bootstrap
entry.

17 years agols --color: Don't stat symlinks when neither ORPHAN nor MISSING attribute has a color.
Jim Meyering [Sun, 15 Jul 2007 20:13:16 +0000 (22:13 +0200)]
ls --color: Don't stat symlinks when neither ORPHAN nor MISSING attribute has a color.
* src/ls.c (main): Don't set check_symlink_color when C_EXEC is
colored, unless ln=target (aka color_symlink_as_referent) is set.
(gobble_file): Set f->linkok = true also when !check_symlink_color.
http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/10608/focus=10927
Reported by Jeremy Maitin-Shepard.
* tests/strace: New file, contents extracted from...
* tests/mv/atomic: ...here.  Source strace.
* tests/ls/stat-free-symlinks: New file.  Test for the above.
Use strace to ensure that in this corner case, ls does not call stat.
* tests/ls/Makefile.am (TESTS): Add stat-free-symlinks.
* tests/Makefile.am (EXTRA_DIST): Add strace.

17 years ago* coreutils.texi: Revise node structure per new fdl.texi.
Jim Meyering [Sun, 15 Jul 2007 20:11:45 +0000 (22:11 +0200)]
* coreutils.texi: Revise node structure per new fdl.texi.

17 years agoRemove long-deprecated options.
Jim Meyering [Sat, 30 Jun 2007 17:43:53 +0000 (19:43 +0200)]
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>
17 years agoChange interface: make 2nd param _space_-separated, not comma-separated
Jim Meyering [Sat, 14 Jul 2007 08:02:57 +0000 (10:02 +0200)]
Change interface: make 2nd param _space_-separated, not comma-separated
* m4/include-exclude-prog.m4 (gl_INCLUDE_EXCLUDE_PROG): Remove now-
unnecessary use of tr.
Improve comments.
* configure.ac: Adjust caller, as well as the code that ensures the
2nd parameter stays in sync with the list in src/Makefile.am.

17 years ago* m4/include-exclude-prog.m4 (gl_REMOVE_PROG): Fix typo: s/$2/$1/.
Karel Zak [Sat, 14 Jul 2007 07:38:42 +0000 (09:38 +0200)]
* m4/include-exclude-prog.m4 (gl_REMOVE_PROG): Fix typo: s/$2/$1/.
(gl_INCLUDE_EXCLUDE_PROG): Quote first use of $2 parameter.
Don't mix comma- and space-separated lists.
Patch from Karel Zak.

17 years agoWarn about non-portable use of unescaped backslash at end of string,
Jim Meyering [Fri, 13 Jul 2007 16:37:16 +0000 (18:37 +0200)]
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.

17 years agoUse proper backslash-quoting inside backticks.
Jim Meyering [Fri, 13 Jul 2007 12:12:01 +0000 (14:12 +0200)]
Use proper backslash-quoting inside backticks.
* configure.ac: Otherwise we run afoul of strict GNU tr:
a string ending in a lone backslash would provoke a failure.

17 years agoExpand default-no-install prog list in ./configure --help output,
Jim Meyering [Thu, 12 Jul 2007 18:58:53 +0000 (20:58 +0200)]
Expand default-no-install prog list in ./configure --help output,
and fix some []-quoting bugs in sed expressions.
* configure.ac: Hard-code the list, "arch,su" here as well
as in src/Makefile.am, and ensure the two stay in sync.
* m4/include-exclude-prog.m4 (gl_INCLUDE_EXCLUDE_PROG): Use $2,
rather than the nearly-equivalent shell variable.
Karel Zak reported that ./configure --help's output included
the literal string, $gl_no_install_progs_default.

17 years agoClean up include-exclude-prog.m4.
Jim Meyering [Thu, 12 Jul 2007 09:41:32 +0000 (11:41 +0200)]
Clean up include-exclude-prog.m4.
* m4/include-exclude-prog.m4 (gl_ADD_PROG): Don't modify MAN.
(gl_REMOVE_PROG): Likewise.
Add omitted "\>" in sed regexp.
Remove any leading or trailing spaces.
(gl_ADD_PROG): Remove any leading space.
* configure.ac: Instead, derive $MAN from $optional_bin_progs.
Append $(EXEEXT) to *all* names, not just the first one.

17 years agoIf there's a GPL vN copyright comment, require that N == 3.
Jim Meyering [Wed, 11 Jul 2007 09:25:57 +0000 (11:25 +0200)]
If there's a GPL vN copyright comment, require that N == 3.
* Makefile.maint (sc_GPL_version): New rule.
* tests/misc/arch: Fix the sole violation.

17 years agoSkip "arch" test if it's not built.
Jim Meyering [Tue, 10 Jul 2007 20:37:48 +0000 (22:37 +0200)]
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>
17 years agoAdd support for enabling/disabling installation of specified programs.
Jim Meyering [Tue, 10 Jul 2007 20:37:05 +0000 (22:37 +0200)]
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.

17 years agoNew program: arch
Karel Zak [Tue, 5 Jun 2007 21:29:32 +0000 (23:29 +0200)]
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>
17 years agoChange "version 2" to "version 3" in all copyright notices.
Jim Meyering [Tue, 10 Jul 2007 10:21:15 +0000 (12:21 +0200)]
Change "version 2" to "version 3" in all copyright notices.

17 years agoCompensate for new c99'isms in seq.c.
Jim Meyering [Mon, 9 Jul 2007 17:24:15 +0000 (19:24 +0200)]
Compensate for new c99'isms in seq.c.
* Makefile.maint (patch-check): Use -p1, not -p2, so a patch
generated via "make patch-check REGEN=1" actually works.
* src/c99-to-c89.diff: Handle new c99'isms in seq.c.

17 years agoFix the automatic number width formatting in seq.
P@draigBrady.com [Mon, 9 Jul 2007 15:07:38 +0000 (16:07 +0100)]
Fix the automatic number width formatting in seq.

* src/seq.c: Fix the -w logic. Ignore spaces and '+'
characters of input numbers when determining width.
Set format correctly for input numbers in scientific notation.
* tests/seq/basic: Add various number width tests.
Details: <http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/10903>

Signed-off-by: Pádraig Brady <Pádraig Brady P@draigBrady.com>
17 years agoRun the coreutils-specific code only if tests/Makefile.am.in exists.
Jim Meyering [Sun, 8 Jul 2007 18:09:59 +0000 (20:09 +0200)]
Run the coreutils-specific code only if tests/Makefile.am.in exists.
* bootstrap (mam_template): Move definition out of loop.

17 years agoRemove .gdb-history.
Jim Meyering [Sun, 8 Jul 2007 17:12:48 +0000 (19:12 +0200)]
Remove .gdb-history.

17 years agoAdd to .cvsignore and .gitignore files.
Jim Meyering [Sun, 8 Jul 2007 15:25:05 +0000 (17:25 +0200)]
Add to .cvsignore and .gitignore files.

17 years agoCreate symlinks for gl/{lib,m4}/*, just as for gnulib/{lib,m4}/*.
Jim Meyering [Sun, 8 Jul 2007 15:24:29 +0000 (17:24 +0200)]
Create symlinks for gl/{lib,m4}/*, just as for gnulib/{lib,m4}/*.
* bootstrap (symlink_to_dir): Rename function from symlink_to_gnulib.
Add a directory parameter.  Update all callers.
(cp_mark_as_generated): Also check for -- and link to -- files in gl/.

17 years agoTHANKS: Add Pádraig Brady.
Jim Meyering [Sun, 8 Jul 2007 14:42:16 +0000 (16:42 +0200)]
THANKS: Add Pádraig Brady.

2007-07-08  Jim Meyering  <jim@meyering.net>

17 years agoAdapt to deeper hierarchy in gnulib.
Jim Meyering [Sun, 8 Jul 2007 10:42:05 +0000 (12:42 +0200)]
Adapt to deeper hierarchy in gnulib.
* bootstrap (gnulib_tool): If the destination directory doesn't exist,
create it. This is required at least for "lib/uniwidth/cjk.h".

17 years agoUse <wchar.h>, not "wcwidth.h".
Jim Meyering [Sun, 8 Jul 2007 08:16:44 +0000 (10:16 +0200)]
Use <wchar.h>, not "wcwidth.h".
* src/wc.c: Now that gnulib provides the POSIX-specified <wchar.h>,
include it and <wctype.h>, rather than "wcwidth.h".
* src/ls.c: Include <wchar.h>, rather than "wcwidth.h".

17 years agoFix typo in comment.
Jim Meyering [Fri, 6 Jul 2007 23:49:12 +0000 (01:49 +0200)]
Fix typo in comment.

17 years agosetuidgid: set all groups, not just the primary one; mgetgroups: new module
Jim Meyering [Thu, 5 Jul 2007 15:42:29 +0000 (17:42 +0200)]
setuidgid: set all groups, not just the primary one;  mgetgroups: new module

I wanted to use the xgetgroups function from id.c, so factored it out
and made it into a non-exiting function (hence the "m" prefix rather than "x").
* src/setuidgid.c (main): Use mgetgroups. Include "mgetgroups.h".

* src/id.c (xgetgroups): Remove function.
Include "mgetgroups.h".
(print_group_list): Use mgetgroups, not xgetgroups.

* gl/modules/mgetgroups: New module.
* gl/lib/mgetgroups.c: New file.  mgetgroups is derived from
id.c's xgetgroups function.
* bootstrap.conf (gnulib_modules): Add mgetgroups.
* gl/m4/mgetgroups.m4: New file.
* gl/lib/mgetgroups.h: New file.

17 years ago* bootstrap: Merge in changes from gnulib.
Jim Meyering [Thu, 5 Jul 2007 15:44:31 +0000 (17:44 +0200)]
* bootstrap: Merge in changes from gnulib.

17 years ago* src/id.c: Include "getugroups.h" rather than declaring manually.
Jim Meyering [Thu, 5 Jul 2007 12:44:20 +0000 (14:44 +0200)]
* src/id.c: Include "getugroups.h" rather than declaring manually.

17 years agoAdd Paul's ChangeLog for previous patch.
Jim Meyering [Wed, 4 Jul 2007 11:16:53 +0000 (13:16 +0200)]
Add Paul's ChangeLog for previous patch.
Restore the m4/.gitignore file I inadvertently removed.

17 years agopr -F no longer suppresses the footer or the first two blank header lines
Paul Eggert [Tue, 3 Jul 2007 18:36:43 +0000 (11:36 -0700)]
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>
17 years agoPrefer "STREQ (a, b)" over "strcmp (a, b) == 0"; similar for != 0.
Jim Meyering [Sat, 23 Jun 2007 08:11:25 +0000 (10:11 +0200)]
Prefer "STREQ (a, b)" over "strcmp (a, b) == 0"; similar for != 0.
* src/base64.c (main): Likewise.
* src/install.c (setdefaultfilecon): Likewise.
* src/sort.c (main): Likewise.
* Makefile.maint (sc_prohibit_strcmp): New rule.
* .x-sc_prohibit_strcmp: New file, to list the few exceptions.
* Makefile.am (EXTRA_DIST): Add .x-sc_prohibit_strcmp.

17 years agoseq no longer mishandles cases like "seq 0 0.000001 0.000003",
Paul Eggert [Sat, 23 Jun 2007 07:27:11 +0000 (09:27 +0200)]
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.

17 years agoAdd test cases for seq off-by-one problem.
Pádraig Brady [Fri, 22 Jun 2007 18:39:56 +0000 (20:39 +0200)]
Add test cases for seq off-by-one problem.

17 years ago* src/stat.c (long_options): Add a FIXME comment to help ensure
Jim Meyering [Fri, 22 Jun 2007 18:26:01 +0000 (20:26 +0200)]
* src/stat.c (long_options): Add a FIXME comment to help ensure
that the deprecated and undocumented "--filesystem" option is
removed someday.

17 years agoA few more symlink-related fixes. Fix a bug triggered by cp
Paul Eggert [Mon, 18 Jun 2007 09:58:47 +0000 (11:58 +0200)]
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.

17 years agoUse mreadlink_with_size (doesn't exit), not xreadlink_with_size.
Jim Meyering [Mon, 18 Jun 2007 09:17:30 +0000 (11:17 +0200)]
Use mreadlink_with_size (doesn't exit), not xreadlink_with_size.

* bootstrap.conf (gnulib_modules): Add readlink-with-size.
Remove xreadlink and xreadlink-with-size.
* src/copy.c (copy_internal): Use mreadlink_with_size,
not xreadlink_with_size.
* src/ls.c (get_link_name): Likewise.
* src/readlink.c (main): Likewise.
* src/stat.c (print_stat): Likewise.

17 years ago* README-hacking: Don't mention Gzip 1.2.4, now that 1.3.12 is out.
Jim Meyering [Mon, 18 Jun 2007 09:19:57 +0000 (11:19 +0200)]
* README-hacking: Don't mention Gzip 1.2.4, now that 1.3.12 is out.

17 years agoMake chgrp and chown diagnostics consistent.
Jim Meyering [Sat, 16 Jun 2007 10:53:40 +0000 (12:53 +0200)]
Make chgrp and chown diagnostics consistent.
* src/chown.c (main): Emit the diagnostic before the file name,
not after it, to be consistent with chgrp's diagnostic.
* src/chgrp.c (parse_group): Emit a ":" between the diagnostic
and the file name.
Reported by Egmont Koblinger.
* THANKS: Add Egmont Koblinger.

17 years agoCorrect cp's handling of destination symlinks in some cases.
Paul Eggert [Fri, 15 Jun 2007 20:47:16 +0000 (22:47 +0200)]
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.

17 years agoDon't include "quote.h" when it is not used.
Jim Meyering [Fri, 15 Jun 2007 13:44:15 +0000 (15:44 +0200)]
Don't include "quote.h" when it is not used.
* src/md5sum.c: Remove unnecessary inclusion of "quote.h".
* src/expr.c: Likewise.
* src/shred.c: Likewise.
* Makefile.maint (sc_prohibit_quote_without_use): New rule.
* src/c99-to-c89.diff: Adjust offsets.

17 years agoClarify what "cat" documentation means by "blank" lines.
Paul Eggert [Fri, 15 Jun 2007 07:29:18 +0000 (09:29 +0200)]
Clarify what "cat" documentation means by "blank" lines.
* doc/coreutils.texi (cat invocation): "Blank" lines actually mean
empty lines.
* src/cat.c (usage): Say that "nonblank" means nonempty.  Clarify
--squeeze-blank.

17 years agormdir: give better diagnostics
Jim Meyering [Wed, 13 Jun 2007 13:53:12 +0000 (15:53 +0200)]
rmdir: give better diagnostics
* src/rmdir.c (remove_parents): Give a more descriptive/consistent
diagnostic upon failure.
(main): Likewise.
Suggestion from Joey Hess.
* THANKS: Add Joey Hess.

17 years agoDon't include "quotearg.h" when it is not used.
Jim Meyering [Wed, 13 Jun 2007 13:33:38 +0000 (15:33 +0200)]
Don't include "quotearg.h" when it is not used.
* Makefile.maint (sc_prohibit_quotearg_without_use): New rule.
* src/cp.c: Don't include "quotearg.h".  It wasn't used.

17 years ago* README-hacking: List Gperf as a build-requirement, too.
Jim Meyering [Wed, 13 Jun 2007 06:00:41 +0000 (08:00 +0200)]
* README-hacking: List Gperf as a build-requirement, too.
Reported by Steve Ward.

17 years agoREADME: Also mention README-hacking,
Jim Meyering [Mon, 11 Jun 2007 09:07:21 +0000 (11:07 +0200)]
README: Also mention README-hacking,
for whose who start from
cloned/checked-out sources rather than from a distribution tarball.
Reported by Steve Ward.
* THANKS: Add Steve Ward.

Signed-off-by: Jim Meyering <jim@meyering.net>
17 years agoAdd to .cvsignore and .gitignore files.
Jim Meyering [Sun, 10 Jun 2007 16:39:53 +0000 (18:39 +0200)]
Add to .cvsignore and .gitignore files.

17 years agobug-fix: cp would fail to write through a dangling symlink
Jim Meyering [Sun, 10 Jun 2007 12:56:39 +0000 (14:56 +0200)]
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>.

17 years ago* coreutils.texi (rmdir invocation): Fix a tiny typo.
Jim Meyering [Wed, 6 Jun 2007 06:00:44 +0000 (08:00 +0200)]
* coreutils.texi (rmdir invocation): Fix a tiny typo.

17 years agodoc: -h and --human-readable are equivalent to --block-size=human-readable
Paul Eggert [Mon, 4 Jun 2007 17:31:22 +0000 (19:31 +0200)]
doc: -h and --human-readable are equivalent to --block-size=human-readable
* doc/coreutils.texi (Common options): Mention that -h and
--human-readable are equivalent to --block-size=human-readable.
Documentation problem reported by Steve Ward in
<http://lists.gnu.org/archive/html/bug-coreutils/2007-06/msg00007.html>.
(du invocation): Use optSi rather than duplicating the macro's
contents (incorrectly, since we claimed a "B" was output).

17 years agoRemove constants.texi from version control.
Jim Meyering [Sun, 3 Jun 2007 19:55:09 +0000 (21:55 +0200)]
Remove constants.texi from version control.

This file has always been generated.
* .gitignore: Add constants.texi.

Signed-off-by: Jim Meyering <jim@meyering.net>
17 years agoAdd to .cvsignore and .gitignore files.
Jim Meyering [Sat, 2 Jun 2007 21:00:09 +0000 (23:00 +0200)]
Add to .cvsignore and .gitignore files.

17 years agoPull printf-related code from gnulib, rather than using forked copy.
Jim Meyering [Thu, 31 May 2007 14:40:51 +0000 (16:40 +0200)]
Pull printf-related code from gnulib, rather than using forked copy.
* bootstrap.conf (gnulib_modules): Don't avoid size_max and xsize
modules.  While I dislike xsize-style overflow avoidance, maintaining
a forked version of e.g., vasnprintf.c was too much work.
* lib/printf-parse.c, lib/vasnprintf.c, lib/unicodeio.c: Remove local
copies, so we now get these files from gnulib.

17 years ago* src/dircolors.hin: Add screen-256color.
Jim Meyering [Thu, 31 May 2007 06:05:02 +0000 (08:05 +0200)]
* src/dircolors.hin: Add screen-256color.
Suggested by sdl.web@gmail.com in <http://bugzilla.redhat.com/239266>.

17 years ago* TODO: Add an entry for comm --output-delimiter=STR
Jim Meyering [Thu, 31 May 2007 06:03:40 +0000 (08:03 +0200)]
* TODO: Add an entry for comm --output-delimiter=STR

17 years agowc: ignore multibyte-character decoding errors
James Youngman [Sat, 26 May 2007 05:08:18 +0000 (07:08 +0200)]
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.

17 years agoAdd to .cvsignore and .gitignore files.
Jim Meyering [Sat, 26 May 2007 04:30:30 +0000 (06:30 +0200)]
Add to .cvsignore and .gitignore files.

17 years agoCheck for an up-to-date copyright year in coreutils.texi.
Jim Meyering [Tue, 22 May 2007 18:41:00 +0000 (20:41 +0200)]
Check for an up-to-date copyright year in coreutils.texi.
* Makefile.maint (copyright-check): Also check for an up-to-date
copyright year in doc/$().texi, if that file exists.
* doc/coreutils.texi: Add 2007 to list of Copyright years.
Reported by Karl Berry.

17 years agocut: diagnose a range starting with 0 (-f 0-2) as invalid, and
Jim Meyering [Tue, 22 May 2007 12:25:19 +0000 (14:25 +0200)]
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.

17 years ago"cut -f 2-0" now fails; before, it was equivalent to "cut -f 2-"
Jim Meyering [Tue, 22 May 2007 11:56:34 +0000 (13:56 +0200)]
"cut -f 2-0" now fails; before, it was equivalent to "cut -f 2-"
Also, diagnose the '-' in "cut -f -" as an invalid range, rather
than interpreting it as the unlimited range, "1-".
* NEWS: Mention these changes.
* src/cut.c (set_fields): Don't interpret an accumulator "value"
of 0 as an unspecified range endpoint.
Give better diagnostics.
Adjust a comment so that it is true also for 64-bit size_t.
* tests/cut/Test.pm: Add tests for the above.

17 years agostty: fix a harmless syntax nit
Jim Meyering [Tue, 22 May 2007 05:58:42 +0000 (07:58 +0200)]
stty: fix a harmless syntax nit
* src/stty.c (visible): Use ";" as the statement terminator
between two assignments, not ",".
(integer_arg): Join an unnecessarily wrapped line.

17 years agostty: diagnose an invalid hex value in 35-colon commmand-line argument
Jim Meyering [Sun, 20 May 2007 12:45:38 +0000 (14:45 +0200)]
stty: diagnose an invalid hex value in 35-colon commmand-line argument
* NEWS: Mention this.
* src/stty.c (strtoul_tcflag_t, strtoul_cc_t): New functions.
(recover_mode): Use those functions (not sscanf), to parse the
string robustly.
* tests/stty/invalid: New file.  Test for the above.
* tests/stty/Makefile.am (TESTS): Add invalid.
* .x-sc_prohibit_atoi_atof: Don't exempt stty.c from this check.
Add tests/stty/invalid so we don't have to obfuscate the comment
about sscanf therein.
* Makefile.maint (sc_prohibit_atoi_atof): Mention sscanf in the
diagnostic, too.

17 years ago* TODO: Remove some now-completed or no longer relevant items.
Jim Meyering [Sun, 20 May 2007 12:04:28 +0000 (14:04 +0200)]
* TODO: Remove some now-completed or no longer relevant items.

17 years agoRename uses of futimens -> gl_futimens; glibc now declares the former.
Jim Meyering [Sat, 19 May 2007 16:36:03 +0000 (18:36 +0200)]
Rename uses of futimens -> gl_futimens; glibc now declares the former.
* src/copy.c (copy_reg): Reflect renaming: futimens -> gl_futimens.
* src/touch.c (touch): Likewise.

17 years ago* Makefile.maint (my-distcheck): Remove -pedantic from $(CFLAGS)
Jim Meyering [Fri, 18 May 2007 07:01:03 +0000 (09:01 +0200)]
* Makefile.maint (my-distcheck): Remove -pedantic from $(CFLAGS)
for now, to avoid c89-check failure due to use of #include_next.

17 years agoGenerate a dozen test-related Makefile.am files at bootstrap-time.
Jim Meyering [Tue, 15 May 2007 08:18:48 +0000 (10:18 +0200)]
Generate a dozen test-related Makefile.am files at bootstrap-time.
* README-hacking: Build-from-checkout now require Perl, too.
* bootstrap: Now that these generated Makefile.am files are no longer
under version control, they must be created at bootstrap time.

17 years ago* man/chmod.x: Document chmod's behavior with setuid and setgid bits.
Paul Eggert [Tue, 15 May 2007 05:14:55 +0000 (07:14 +0200)]
* man/chmod.x: Document chmod's behavior with setuid and setgid bits.
Remove misleading implication about leading zero.  Problem
reported by Jan Engelhardt in
<http://lists.gnu.org/archive/html/bug-coreutils/2007-05/msg00134.html>.

17 years agoRemove the generated tests/*/Makefile.am files from version control.
Jim Meyering [Sun, 13 May 2007 16:23:41 +0000 (18:23 +0200)]
Remove the generated tests/*/Makefile.am files from version control.
* tests/cut/Makefile.am: git-remove this generated file.
* tests/head/Makefile.am: Likewise.
* tests/join/Makefile.am: Likewise.
* tests/pr/Makefile.am: Likewise.
* tests/sort/Makefile.am: Likewise.
* tests/tac/Makefile.am: Likewise.
* tests/tail/Makefile.am: Likewise.
* tests/test/Makefile.am: Likewise.
* tests/tr/Makefile.am: Likewise.
* tests/uniq/Makefile.am: Likewise.
* tests/wc/Makefile.am: Likewise.
* .cvsignore, .gitignore: Ignore these generated files.

* src/.cvsignore, src/.gitignore: Add chcon here, ...
* .cvsignore, .gitignore: ... not here.

17 years agoTest uniq's new --zero-terminated (-z) option.
Jim Meyering [Sun, 13 May 2007 09:08:01 +0000 (11:08 +0200)]
Test uniq's new --zero-terminated (-z) option.
* tests/uniq/Test.pm: When possible, create a "-z"-testing variant
of each existing test.
(2z, 3z, 4z, 5z, 20z, 122, 123): New tests from James Youngman.

17 years agoAdd -z option to uniq. Originally proposed by Egmont Koblinger.
James Youngman [Sun, 13 May 2007 09:02:43 +0000 (11:02 +0200)]
Add -z option to uniq.  Originally proposed by Egmont Koblinger.
* NEWS: Mention uniq's new option: --zero-terminated (-z).
* src/uniq.c: Add new option, --zero-terminated (-z), to make
uniq use the NUL byte as separator/delimiter rather than newline.
(check_file): Add a parameter: delimiter.  Update caller.
Use readlinebuffer_delim in place of readlinebuffer everywhere.
(main): Handle the new option.
(usage): Describe new option the same way sort does.
* doc/coreutils.texi (uniq invocation): Describe the new option.

17 years ago* NEWS: Mention that last week's tr bug dates back to 1992.
Jim Meyering [Mon, 7 May 2007 19:56:27 +0000 (21:56 +0200)]
* NEWS: Mention that last week's tr bug dates back to 1992.

17 years agoAvoid test failure when run with an unusual umask.
Jim Meyering [Fri, 4 May 2007 11:32:46 +0000 (13:32 +0200)]
Avoid test failure when run with an unusual umask.
* tests/ls/color-dtype-dir: Set umask to 022.
Suggestion from AIDA Shinra.

17 years agoAvoid failure of root-only test when run with a restrictive umask.
Jim Meyering [Fri, 4 May 2007 10:01:43 +0000 (12:01 +0200)]
Avoid failure of root-only test when run with a restrictive umask.
* tests/rm/no-give-up: Ensure that non-root can access "d/" through
root-owned ".".  Reported by AIDA Shinra.

17 years agotr -c: don't abort when translating with S2 larger than complement of S1
Jim Meyering [Fri, 4 May 2007 07:57:10 +0000 (09:57 +0200)]
tr -c: don't abort when translating with S2 larger than complement of S1
* src/tr.c (main): Remove invalid assertion triggered by e.g.,
tr -c a '[b*256]'.  There's nothing wrong with having Set2 larger
than Set1.  Reported by Guntram Blohm.
* tests/tr/Test.pm (no-abort-1): Test for the above.
* NEWS: Mention this bug fix.
* THANKS: Add Guntram Blohm.

17 years agoAvoid test failure when run with a permissive umask.
Jim Meyering [Thu, 3 May 2007 17:36:34 +0000 (19:36 +0200)]
Avoid test failure when run with a permissive umask.
* tests/rm/no-give-up: Set permissions of test directory properly,
i.e., not depending on umask prohibiting go=w.
Reported by AIDA Shinra.

17 years agoThe following commands and options now support the standard size
Paul Eggert [Thu, 3 May 2007 11:45:26 +0000 (13:45 +0200)]
The following commands and options now support the standard size
suffixes kB, M, MB, G, GB, and so on for T, P, Y, Z, and Y:
head -c, head -n, od -j, od -N, od -S, split -b, split -C,
tail -c, tail -n.
* doc/coreutils.texi (od invocation, head invocation, tail invocation):
Document support for new size suffixes.
(head invocation, tail invocation):
Document that -n uses the same suffixes as -c.
(tail invocation): More-clearly document what leading "+" does.
* src/head.c (usage, string_to_integer): Support new suffixes.
* src/od.c (usage, main): Likewise.
* src/split.c (usage, main): Likewise.
* src/tail.c (usage, parse_options): Likewise.
Prompted by a patch from Evan Hunt.

17 years ago* src/du.c (usage): Tweak description of --dereference-args (-D) again.
Jim Meyering [Wed, 2 May 2007 21:37:55 +0000 (23:37 +0200)]
* src/du.c (usage): Tweak description of --dereference-args (-D) again.
Prompted by another request for clarification from Justin Pryzby.

17 years agoInvoke rm via 'setuidgid ... env PATH="$PATH" ...', as in fail-eperm.
Jim Meyering [Wed, 2 May 2007 21:30:00 +0000 (23:30 +0200)]
Invoke rm via 'setuidgid ... env PATH="$PATH" ...', as in fail-eperm.
* tests/rm/fail-2eperm: Patch from AIDA Shinra.
Reported by Peter Dyballa.
* THANKS: Add AIDA Shinra and Peter Dyballa.

17 years ago* src/nohup.c (usage): Describe how standard input and output are redirected.
Paul Eggert [Sat, 28 Apr 2007 18:47:29 +0000 (20:47 +0200)]
* src/nohup.c (usage): Describe how standard input and output are redirected.

17 years agoAdd "runcon" to .cvsignore and .gitignore files.
Jim Meyering [Wed, 25 Apr 2007 13:52:53 +0000 (15:52 +0200)]
Add "runcon" to .cvsignore and .gitignore files.

17 years ago* src/du.c (usage): Clarify description of --dereference-args (-D).
Jim Meyering [Wed, 25 Apr 2007 11:54:21 +0000 (13:54 +0200)]
* src/du.c (usage): Clarify description of --dereference-args (-D).
Prompted by a report from Justin Pryzby.

17 years ago* bootstrap.conf (gnulib_modules): Add autobuild.
Jim Meyering [Wed, 25 Apr 2007 09:29:27 +0000 (11:29 +0200)]
* bootstrap.conf (gnulib_modules): Add autobuild.
* m4/autobuild.m4: Remove file.  Now, provided by gnulib.

17 years ago* bootstrap.conf (gnulib_modules): Add fseeko and ftello.
Jim Meyering [Wed, 25 Apr 2007 08:55:56 +0000 (10:55 +0200)]
* bootstrap.conf (gnulib_modules): Add fseeko and ftello.

17 years agoAdd to .cvsignore and .gitignore files.
Jim Meyering [Wed, 25 Apr 2007 08:55:35 +0000 (10:55 +0200)]
Add to .cvsignore and .gitignore files.

17 years ago* bootstrap.conf (gnulib_modules): Add fseeko.
Jim Meyering [Wed, 25 Apr 2007 08:40:12 +0000 (10:40 +0200)]
* bootstrap.conf (gnulib_modules): Add fseeko.

17 years agoAdd to .cvsignore and .gitignore files.
Jim Meyering [Wed, 25 Apr 2007 08:39:48 +0000 (10:39 +0200)]
Add to .cvsignore and .gitignore files.

17 years ago* THANKS: Add Andreas Frische.
Jim Meyering [Tue, 24 Apr 2007 07:20:52 +0000 (09:20 +0200)]
* THANKS: Add Andreas Frische.
* NEWS: Mention today's ls --color fix.
* tests/ls-2/tests (sl-dangle): Add a test for today's fix.

17 years agols --color once again colors dangling symlinks correctly
Eric Blake [Tue, 24 Apr 2007 07:18:56 +0000 (09:18 +0200)]
ls --color once again colors dangling symlinks correctly
* src/ls.c (gobble_file): Much like the 2007-04-07 fix,
add a term to the expression that decides whether we need
stat and/or lstat calls.  Reported by Andreas Frische.

17 years agocut synopsis: fix coreutils.texi, too.
Jim Meyering [Mon, 16 Apr 2007 20:00:28 +0000 (22:00 +0200)]
cut synopsis: fix coreutils.texi, too.
* doc/coreutils.texi (cut invocation): Adjust synopsis to show that an
* THANKS: Add Rudolf Kastl.
OPTION is required.  Reported by Rudolf Kastl.