Compare commits

..

141 Commits
v6.2 ... v6.4

Author SHA1 Message Date
Jim Meyering
7054512f14 Remove -cvs suffix here, too. 2006-10-22 23:41:05 +02:00
Jim Meyering
479648040d add snprintf-related files to .gitignore 2006-10-22 23:39:45 +02:00
Jim Meyering
0c0121ed20 Version 6.4.
* NEWS: Record the 6.4 release date.
* configure.ac (AC_INIT): Remove "-cvs" suffix from version string.
2006-10-22 22:21:26 +02:00
Jim Meyering
33d52dbc43 * Makefile.maint: Complete the adaptation to function with a working
directory that is using git (rather than cvs) for version control.
2006-10-22 22:16:37 +02:00
Jim Meyering
9b34202141 * tests/chmod/c-option: Double-quote instances of `$abs_srcdir'.
* tests/cp/cp-parents: Likewise.
* tests/mkdir/parents: Likewise.
* tests/mkdir/perm: Likewise.
2006-10-22 22:12:13 +02:00
Jim Meyering
2457af43cf * tests/sample-test: Quote variables containing absolute build
tree paths.  In the cleanup trap, make sure `cd' succeeds before
`chmod'ing and `rm'ing the temporary files.
* tests/chgrp/basic: Likewise.
* tests/chgrp/deref: Likewise.
* tests/chgrp/no-x: Likewise.
* tests/chgrp/posix-H: Likewise.
* tests/chgrp/recurse: Likewise.
* tests/chmod/c-option: Likewise.
* tests/chmod/equal-x: Likewise.
* tests/chmod/equals: Likewise.
* tests/chmod/inaccessible: Likewise.
* tests/chmod/no-x: Likewise.
* tests/chmod/octal: Likewise.
* tests/chmod/setgid: Likewise.
* tests/chmod/umask-x: Likewise.
* tests/chmod/usage: Likewise.
* tests/chown/basic: Likewise.
* tests/chown/deref: Likewise.
* tests/chown/separator: Likewise.
* tests/cp/acl: Likewise.
* tests/cp/backup-1: Likewise.
* tests/cp/backup-dir: Likewise.
* tests/cp/backup-is-src: Likewise.
* tests/cp/cp-HL: Likewise.
* tests/cp/cp-deref: Likewise.
* tests/cp/cp-i: Likewise.
* tests/cp/cp-mv-backup: Likewise.
* tests/cp/cp-parents: Likewise.
* tests/cp/deref-slink: Likewise.
* tests/cp/dir-rm-dest: Likewise.
* tests/cp/dir-slash: Likewise.
* tests/cp/dir-vs-file: Likewise.
* tests/cp/fail-perm: Likewise.
* tests/cp/into-self: Likewise.
* tests/cp/link: Likewise.
* tests/cp/link-no-deref: Likewise.
* tests/cp/link-preserve: Likewise.
* tests/cp/no-deref-link1: Likewise.
* tests/cp/no-deref-link2: Likewise.
* tests/cp/no-deref-link3: Likewise.
* tests/cp/perm: Likewise.
* tests/cp/preserve-2: Likewise.
* tests/cp/r-vs-symlink: Likewise.
* tests/cp/same-file: Likewise.
* tests/cp/slink-2-slink: Likewise.
* tests/cp/sparse: Likewise.
* tests/cp/special-bits: Likewise.
* tests/cp/src-base-dot: Likewise.
* tests/cp/symlink-slash: Likewise.
* tests/dd/not-rewound: Likewise.
* tests/dd/skip-seek2: Likewise.
* tests/dd/unblock-sync: Likewise.
* tests/du/2g: Likewise.
* tests/du/8gb: Likewise.
* tests/du/basic: Likewise.
* tests/du/deref: Likewise.
* tests/du/deref-args: Likewise.
* tests/du/exclude: Likewise.
* tests/du/fd-leak: Likewise.
* tests/du/hard-link: Likewise.
* tests/du/inaccessible-cwd: Likewise.
* tests/du/long-from-unreadable: Likewise.
* tests/du/long-sloop: Likewise.
* tests/du/no-deref: Likewise.
* tests/du/no-x: Likewise.
* tests/du/restore-wd: Likewise.
* tests/du/slash: Likewise.
* tests/du/slink: Likewise.
* tests/du/trailing-slash: Likewise.
* tests/du/two-args: Likewise.
* tests/fmt/long-line: Likewise.
* tests/install/basic-1: Likewise.
* tests/install/create-leading: Likewise.
* tests/install/d-slashdot: Likewise.
* tests/install/trap: Likewise.
* tests/ln/misc: Likewise.
* tests/ln/target-1: Likewise.
* tests/ls/color-dtype-dir: Likewise.
* tests/ls/dangle: Likewise.
* tests/ls/dired: Likewise.
* tests/ls/file-type: Likewise.
* tests/ls/follow-slink: Likewise.
* tests/ls/infloop: Likewise.
* tests/ls/inode: Likewise.
* tests/ls/m-option: Likewise.
* tests/ls/no-arg: Likewise.
* tests/ls/recursive: Likewise.
* tests/ls/rt-1: Likewise.
* tests/ls/stat-dtype: Likewise.
* tests/ls/stat-failed: Likewise.
* tests/ls/stat-vs-dirent: Likewise.
* tests/misc/cat-proc: Likewise.
* tests/misc/close-stdout: Likewise.
* tests/misc/csplit: Likewise.
* tests/misc/date-sec: Likewise.
* tests/misc/false-status: Likewise.
* tests/misc/head-c: Likewise.
* tests/misc/head-pos: Likewise.
* tests/misc/mknod: Likewise.
* tests/misc/nl: Likewise.
* tests/misc/nohup: Likewise.
* tests/misc/pathchk1: Likewise.
* tests/misc/printf: Likewise.
* tests/misc/printf-hex: Likewise.
* tests/misc/pwd-long: Likewise.
* tests/misc/shuf: Likewise.
* tests/misc/sort-rand: Likewise.
* tests/misc/split-a: Likewise.
* tests/misc/split-fail: Likewise.
* tests/misc/split-l: Likewise.
* tests/misc/stat-fmt: Likewise.
* tests/misc/tac-continue: Likewise.
* tests/misc/wc-files0: Likewise.
* tests/mkdir/concurrent-1: Likewise.
* tests/mkdir/p-1: Likewise.
* tests/mkdir/p-2: Likewise.
* tests/mkdir/p-3: Likewise.
* tests/mkdir/p-slashdot: Likewise.
* tests/mkdir/p-thru-slink: Likewise.
* tests/mkdir/p-v: Likewise.
* tests/mkdir/parents: Likewise.
* tests/mkdir/perm: Likewise.
* tests/mkdir/t-slash: Likewise.
* tests/mv/acl: Likewise.
* tests/mv/atomic: Likewise.
* tests/mv/backup-dir: Likewise.
* tests/mv/childproof: Likewise.
* tests/mv/diag: Likewise.
* tests/mv/dir-file: Likewise.
* tests/mv/dir2dir: Likewise.
* tests/mv/dup-source: Likewise.
* tests/mv/hard-2: Likewise.
* tests/mv/hard-3: Likewise.
* tests/mv/hard-4: Likewise.
* tests/mv/hard-link-1: Likewise.
* tests/mv/hard-verbose: Likewise.
* tests/mv/i-2: Likewise.
* tests/mv/i-3: Likewise.
* tests/mv/i-4: Likewise.
* tests/mv/i-5: Likewise.
* tests/mv/i-link-no: Likewise.
* tests/mv/into-self-4: Likewise.
* tests/mv/leak-fd: Likewise.
* tests/mv/mv-special-1: Likewise.
* tests/mv/no-target-dir: 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/perm-1: Likewise.
* tests/mv/reply-no: Likewise.
* tests/mv/trailing-slash: Likewise.
* tests/mv/update: Likewise.
* tests/od/od-N: Likewise.
* tests/od/x8: Likewise.
* tests/readlink/can-e: Likewise.
* tests/readlink/can-f: Likewise.
* tests/readlink/can-m: Likewise.
* tests/readlink/rl-1: Likewise.
* tests/rm/cycle: Likewise.
* tests/rm/dangling-symlink: Likewise.
* tests/rm/deep-1: Likewise.
* tests/rm/dir-no-w: Likewise.
* tests/rm/dir-nonrecur: Likewise.
* tests/rm/dot-rel: Likewise.
* tests/rm/empty-inacc: Likewise.
* tests/rm/f-1: Likewise.
* tests/rm/fail-2eperm: Likewise.
* tests/rm/hash: Likewise.
* tests/rm/i-1: Likewise.
* tests/rm/i-no-r: Likewise.
* tests/rm/ignorable: Likewise.
* tests/rm/inaccessible: Likewise.
* tests/rm/interactive-always: Likewise.
* tests/rm/interactive-once: Likewise.
* tests/rm/ir-1: Likewise.
* tests/rm/isatty: Likewise.
* tests/rm/no-give-up: Likewise.
* tests/rm/r-1: Likewise.
* tests/rm/r-2: Likewise.
* tests/rm/r-3: Likewise.
* tests/rm/r-4: Likewise.
* tests/rm/readdir-bug: Likewise.
* tests/rm/rm1: Likewise.
* tests/rm/rm2: Likewise.
* tests/rm/rm3: Likewise.
* tests/rm/rm4: Likewise.
* tests/rm/rm5: Likewise.
* tests/rm/sunos-1: Likewise.
* tests/rm/unread2: Likewise.
* tests/rm/unread3: Likewise.
* tests/rmdir/fail-perm: Likewise.
* tests/rmdir/t-slash: Likewise.
* tests/shred/exact: Likewise.
* tests/shred/remove: Likewise.
* tests/sum/sysv: Likewise.
* tests/tail-2/append-only: Likewise.
* tests/tail-2/assert: Likewise.
* tests/tail-2/assert-2: Likewise.
* tests/tail-2/big-4gb: Likewise.
* tests/tail-2/fflush: Likewise.
* tests/tail-2/infloop-1: Likewise.
* tests/tail-2/proc-ksyms: Likewise.
* tests/tail-2/start-middle: Likewise.
* tests/tail-2/tail-n0f: Likewise.
* tests/tee/basic: Likewise.
* tests/tee/dash: Likewise.
* tests/touch/fail-diag: Likewise.
* tests/touch/no-create-missing: Likewise.
* tests/touch/not-owner: Likewise.
* tests/touch/obsolescent: Likewise.
* tests/touch/read-only: Likewise.
* tests/touch/relative: Likewise.
2006-10-22 19:37:31 +02:00
Jim Meyering
f5417daca0 ignore po/*.po; sort .gitignore files 2006-10-22 19:00:38 +02:00
Jim Meyering
b1289b8716 * NEWS: (cp --backup fix): Fix a typo. 2006-10-22 18:59:58 +02:00
Jim Meyering
dcf5b47708 * .gitignore: Remove some references to files in subdirectories.
* build-aux/.gitignore, doc/.gitignore, lib/.gitignore: New files.
* m4/.gitignore, po/.gitignore, src/.gitignore: Likewise.
2006-10-21 19:50:47 +00:00
Jim Meyering
46775398f2 * src/copy.c (copy_internal): Add a comment saying why we prefer
mknod over mkfifo.
2006-10-21 07:16:19 +00:00
Jim Meyering
a75684d6ea Enable an fts optimization (call lstat only for directories,
on some file system types) also with the --preserve-root option
of chown or chgrp.
* src/chown-core.c (change_file_owner): Compare fts_statp-based
dev/ino against root dev/ino only for directories.
(chown_files): Don't let the root_dev_ino setting influence whether
we use FTS_NOSTAT: fts always sets *fts_statp for a directory.
2006-10-20 23:01:59 +00:00
Jim Meyering
86719b3cd8 * src/od.c (usage): Change description of default to use "-w16",
not the now-invalid "-w 16" syntax.  From Dan Jacobson.
2006-10-20 15:31:11 +00:00
Jim Meyering
8d8af1248d * bootstrap: Add names to each .gitignore file (if it exists)
as well as to .cvsignore.
2006-10-20 10:08:05 +00:00
Jim Meyering
64e75cf0ed . 2006-10-19 11:54:43 +00:00
Jim Meyering
e116c805bf * POTFILES.in: Also include lib/regcomp.c, since it too uses gettext. 2006-10-19 08:54:01 +00:00
Jim Meyering
76a7aea9b6 * Makefile.maint (po-check): This rule didn't detect the new use
of "gettext" (as opposed to the use of "_" everywhere else) in
lib/xstrtol.h.  Adjust the grep regexp so that now it does.
2006-10-19 08:51:27 +00:00
Jim Meyering
14f131ea57 typo 2006-10-19 08:49:30 +00:00
Paul Eggert
177913f5b8 * POTFILES.in: Add lib/xstrtol.h. 2006-10-19 07:53:42 +00:00
Paul Eggert
86823158eb * src/copy.c (copy_reg): Rewrite slightly to avoid duplicte code
when opening dst_name.
(copy_reg, copy_internal): Use (SYSCALL != 0) rather than plain
(SYSCALL) to test for failure in a system call.
2006-10-19 05:22:54 +00:00
Paul Eggert
81afea0110 * src/copy.c (copy_internal): Use mknod rather than mkfifo to copy
a fifo.  This preserves the special mode bits on Solaris 10, which
is compatible with what Solaris 10 cp -R does.
2006-10-18 22:33:06 +00:00
Paul Eggert
7bc17873e5 * src/copy.c (copy_internal): Remove redundant and confusing local
variable src_type.
2006-10-18 21:02:27 +00:00
Paul Eggert
11cf1d39f2 * src/copy.c (copy_internal): Don't pass mkdir a mode greater than
7777.  This matches historical 'cp' behavior and avoids some
(though not all) implementation-defined behavior of mkdir.
* src/cp.c (make_dir_parents_private): Likewise.
* src/copy.c (copy_internal): Don't pass 'open' a mode greater
than 777.  This is required by POSIX.  It doesn't make any difference
in actual behavior on any host that I know of.
2006-10-18 20:56:38 +00:00
Jim Meyering
f594f1fb38 *** empty log message *** 2006-10-17 20:12:05 +00:00
Jim Meyering
a186e9eda6 * src/dd.c (usage): Use two spaces (not one) to separate the
"fdatasync" option string from its description, so help2man formats
the derived man page properly.  Reported by Samuel Thibault
in <http://bugs.debian.org/393649>.
2006-10-17 13:51:47 +00:00
Jim Meyering
d1ea87316f *** empty log message *** 2006-10-17 13:48:27 +00:00
Jim Meyering
8029cc8b5a * .x-sc_trailing_blank: Remove names of files that are no longer
version-controlled.
2006-10-16 20:20:03 +00:00
Paul Eggert
7a0f8b0487 * src/groups.sh (version): Reword message to match the other programs.
Problem reported by Eric Blake.
2006-10-16 16:53:22 +00:00
Paul Eggert
dd8398a3c6 [m4/ChangeLog]
* sha512.m4 (gl_SHA512): Add u64.h to AC_LIBSOURCES.
[lib/ChangeLog]
Port sha512sum to hosts where uintmax_t is only 32 bits, e.g.,
HP/Tandom NonStop OSS circa 2005 has 32-bit uintmax_t, 64-bit intmax_t.
* u64.h: New file.
* sha512.c (SWAP, sha512_init_ctx, sha384_init_ctx, sha512_read_ctx):
(sha384_read_ctx, sha512_conclude_ctx, sha512_process_bytes):
(sha512_round_constants, F2, F1, sha512_process_block):
(S0, S1, SS0, SS1, M, R):
Rewrite to use u64.h instead of assuming uint64_t.
* sha512.h: Include u64.h rather than stdint.h.
(rol64): Remove; moved to u64.h and renamed to u64rol.
2006-10-15 06:17:45 +00:00
Jim Meyering
443d509578 * Makefile.maint (headers_with_interesting_macro_defs): Define.
(.re-defmac, sc_always_defined_macros): New rules.
2006-10-14 12:17:24 +00:00
Jim Meyering
e0b2cb892a *** empty log message *** 2006-10-14 12:15:13 +00:00
Jim Meyering
ebcf61da0f * tests/cp/Makefile.am (TESTS): Add backup-dir. 2006-10-14 12:14:53 +00:00
Jim Meyering
1491ae9ceb * src/system.h (EXIT_FAILURE, EXIT_SUCCESS): Remove definitions.
Instead, include "exit.h".  This hereby retires the work-around for
"Sony NEWS-OS Release 4.0C"'s bug due to "#define EXIT_FAILURE 0".
2006-10-14 12:12:44 +00:00
Jim Meyering
f3fbb64189 * src/cksum.c (uint_fast32_t): Don't define.
Instead, include <stdint.h>.
2006-10-14 12:04:31 +00:00
Jim Meyering
32cfc1ffec clean up 2006-10-14 12:03:50 +00:00
Jim Meyering
46693ba15b * src/pinky.c: Don't include stat-macros.h; system.h already does it. 2006-10-14 12:02:14 +00:00
Jim Meyering
269263a5f7 * src/pinky.c (S_IWGRP): Don't define.
Instead, include "stat-macros.h".
2006-10-14 10:38:54 +00:00
Jim Meyering
34b35b1a3e [ChangeLog]
* Makefile.cfg: Remove cruft that's now handled via bootstrap.
* Makefile.maint: Likewise, remove these targets/rules/variables:
(local_updates, update, cvs-update, wget_files, get-targets): Remove.
(cvs_files, wget-update, automake_repo): Likewise.
Move the comment about cvsu to build-aux/vc-list-files,
where cvsu is actually used.
[build-aux/ChangeLog]
* vc-list-files: Add a comment about cvsu.
2006-10-14 09:51:58 +00:00
Jim Meyering
e2c177710a * Makefile.maint (cvs-update): Use $(CVS), not "cvs". 2006-10-14 09:39:34 +00:00
Jim Meyering
8a2e111207 * vc-list-files: Don't filter git-ls-files output through cut. 2006-10-14 09:31:27 +00:00
Jim Meyering
095c1c83eb Work also when the working directory (with e.g. coreutils sources)
is version controlled with git, rather than CVS.
* bootstrap (CVS_only_file): Test for the existence of README-cvs,
rather than CVS.
In messages and comments, say e.g., "checked-out sources",
rather than "CVS sources".
(version_controlled_file): New function.  Work for git as well as
for CVS.  Don't use grep's -q option.
(slurp): Call it here, in place of CVS-specific code.
2006-10-14 08:51:27 +00:00
Jim Meyering
0dc7f78986 * NEWS: cp -r --backup dir1 dir2, would rename an existing dir1/dir2
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.
2006-10-14 05:20:27 +00:00
Jim Meyering
779168820b *** empty log message *** 2006-10-14 05:06:38 +00:00
Jim Meyering
965232b5b9 More chown/chgrp dereferencing-related fixes.
* src/chown-core.c (change_file_owner): Don't use fts_statp if
we're dereferencing symlinks.
Reverse conjuncts, so that we use dereference file_stats
(aka ent->fts_statp) only *after* we've confirmed that
chopt->affect_symlink_referent is true.  Otherwise, we might
use ent->fts_statp uninitialized.
Don't turn on FTS_NOSTAT when dereferencing symlinks.
* tests/chown/deref: Update the expected diagnostic, now that
this test case (trying to use "chown --dereference ..." on a
dangling symlink) takes a different code path.
2006-10-13 21:11:53 +00:00
Paul Eggert
5dea5d07cd Sync from Bison, as follows:
2006-10-01  Paul Eggert  <eggert@cs.ucla.edu>

Fix problems with translating English-language diagnostics.
* bootstrap: Fix bug introduced in recent bootstrap changes, with
respect to bison-runtime pot generation.  The YY_ stuff
wasn't being captured.
2006-10-13 19:07:21 +00:00
Jim Meyering
f2c088fa10 * NEWS: Mention the above. 2006-10-13 19:05:07 +00:00
Jim Meyering
dc9790379c * src/chown-core.c (change_file_owner): Use fstatat, not stat,
now that we're using fts_open with FTS_CWDFD.
* tests/chgrp/posix-H: Add --preserve-root to an invocation of
chgrp, to exercise the above fix.
2006-10-13 18:51:08 +00:00
Jim Meyering
8552234cb5 * src/du-tests: Clean up a little, though it's still not portable. 2006-10-13 15:25:37 +00:00
Jim Meyering
b985c478d6 * .vg-suppressions: Add 3 more for debian unstable. 2006-10-13 14:40:34 +00:00
Jim Meyering
1471e1e61f * tests/ls/Test.pm: Remove long-unused file.
Suggestions from Bruno Haible.
2006-10-13 14:16:39 +00:00
Jim Meyering
8dda1ae431 * Makefile.am (EXTRA_DIST): Add bootstrap.conf.
Suggestion from Bruno Haible.
2006-10-13 14:13:24 +00:00
Jim Meyering
c0b262550c * Makefile.am (libcoreutils_a_LIBADD): Append $(LIBOBJS),
to accommodate the latest version of gnulib-tool.
(libcoreutils_a_DEPENDENCIES): Likewise.
From Bruno Haible.
2006-10-12 21:13:24 +00:00
Jim Meyering
bad80a7223 * Makefile.am (THANKS-to-translators): Add missing $(srcdir).
(MAINTAINERCLEANFILES): Add .kludge-stamp.
* man/Makefile.am (MAINTAINERCLEANFILES): Typo $(dist_man_MANS)
instead of $(man_MANS).

2006-10-12  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
2006-10-12 21:10:43 +00:00
Jim Meyering
9f70d6021b * configure.ac: Avoid compiler warnings about default return
type in function definitions and unused variables in tests.
* src/who.c (print_user) [HAVE_UT_HOST]: hostlen is only needed
if this is #defined.
2006-10-12 20:39:33 +00:00
Jim Meyering
5f60ffcfcf [ChangeLog]
* configure.ac: Reflect s/gl_MACROS/coreutils_MACROS/ renaming.
Call gl_INIT directly, rather than through the above.
[m4/ChangeLog]
* jm-macros.m4 (coreutils_MACROS): Rename from gl_MACROS, now that
most of the gnulib macros have migrated into gnulib.
Don't call gl_INIT here (now it's called from configure.ac, directly).
2006-10-12 20:37:02 +00:00
Paul Eggert
90224c6639 * bootstrap (symlink_to_gnulib): Fix bug: the dot_dots shell
variable was sometimes used without being initialized.  This
messed up the installation of the INSTALL file in some cases.
2006-10-11 23:03:55 +00:00
Jim Meyering
8202f4d6d5 *** empty log message *** 2006-10-11 05:46:25 +00:00
Jim Meyering
e3e4f829a1 * src/ls.c (usage): Correct description of -s, --size.
It works even without -l.  Suggestion from Karl Berry.
2006-10-11 05:44:41 +00:00
Paul Eggert
e245a66054 * src/ls.c (quote_name): Use initializer rather than memset to
initialize an object to zero.  This is easier to read and is less
likely to introduce an runtime error due to a mixup.  It causes
gcc -W to issue a warning, but you can work around this by
appending -Wno-missing-field-initializers.
* src/pathchk.c (portable_chars_only): Likewise.
* src/shred.c (main): Likewise.
* src/stty.c (main): Likewise.
* src/tr.c (card_of_complement): Likewise.
* src/wc.c (wc): Likewise.
2006-10-10 22:57:07 +00:00
Paul Eggert
489ff7f0cd * src/sort.c (usage): Mention again that sort fields are origin 1. 2006-10-09 23:26:33 +00:00
Paul Eggert
2983bf7c85 * NEWS: Fix typo: iso-8602 -> iso-8601. Problem reported by
Bob Proulx.
2006-10-09 20:38:56 +00:00
Paul Eggert
34d0ffbce4 * bootstrap (usage, main program, symlink_to_gnulib): Add option
--copy.  Inspired by a suggestion from Bruno Haible.
2006-10-09 20:33:38 +00:00
Jim Meyering
6089facdc3 Avoid a compiler warning.
* src/pathchk.c (portable_chars_only): Initialize variable of type
mbstate_t via memset, rather than via '{0}'.  Patch from Bruno Haible.
2006-10-09 11:56:40 +00:00
Jim Meyering
181428d653 * jm-macros.m4 (gl_MACROS): Remove use of AC_CONFIG_LIBOBJ_DIR(lib).
It is no longer needed, and was causing dependencies to appear
in lib/lib/.deps, which provoked a "make distcheck" failure.
2006-10-07 15:53:03 +00:00
Paul Eggert
4b86e52050 Give credit to Lars Wendler. 2006-10-07 07:12:12 +00:00
Paul Eggert
dc52b433ef * src/install.c (make_ancestor): New arg COMPONENT.
* src/mkdir.c (make_ancestor): Likewise.
* tests/install/basic-1: Check for install -Dv bug.
2006-10-07 07:08:29 +00:00
Paul Eggert
4767fc607e Fix bug reported today by Mike Frysinger: mkdir -pv is logging the
wrong file name in some cases.
* src/install.c (struct install_options): New type.
(install_file_in_file_parents, main):
Use it instead of struct cp_options.
(process_dir): Remember the full name.
(announce_mkdir, make_ancestor): Use the full name in announcements.
* src/mkdir.c (struct mkdir_options): Add full_name member.
(make_ancestor): Use the full name in announcements.
(process_dir): Remember the full name.
* tests/mkdir/Makefile.am (TESTS): Add p-v.
* tests/mkdir/p-v: New file, to test this bug.
2006-10-06 20:44:31 +00:00
Jim Meyering
0fc6edb714 Avoid a compiler warning: const'ify and remove a cast.
* randread.c (struct randread_source) [handler]: Make parameter "const".
[handler_arg]: Add "const" attribute.
(randread_error): Make parameter "const".
(simple_new, randread_set_handler, randread_set_handler_arg): Likewise.
(randread_new): Remove now-unnecessary cast.
* randread.h: Adjust prototypes.
2006-10-06 14:37:48 +00:00
Jim Meyering
c620aeeb90 * src/c99-to-c89.diff: Update to reflect new offsets. 2006-10-06 14:24:09 +00:00
Paul Eggert
2a8efc2647 * src/chgrp.c: Don't include lchown.h; no longer needed.
* src/chown.c: Likewise.
2006-10-05 22:40:55 +00:00
Paul Eggert
08984eef49 * tests/ls/stat-dtype: Use a dynamic test to decide whether the
current file system has useful d_type info.
2006-10-05 22:10:08 +00:00
Paul Eggert
1fa3b50140 * src/dd.c (flags): noatime and nofollow now depend on
HAVE_WORKING_O_NOATIME and HAVE_WORKING_O_NOFOLLOW, too.
(usage): Output info about noatime and nofollow only if
they are known to work.
* src/remove.c (AD_push): Inspect HAVE_WORKING_O_NOFOLLOW rather
than O_NOFOLLOW, when testing whether it's possible to avoid a
race condition reliably.
2006-10-05 21:39:12 +00:00
Jim Meyering
d78ad5cacc * tests/install/basic-1: Skip the latter part of this test if the
just-built dd binary is not readable.  Otherwise, this test would fail
when binaries were created as root.  Reported by Bauke Jan Douma in
<http://article.gmane.org/gmane.comp.gnu.core-utils.bugs/8433>.
2006-10-05 08:43:24 +00:00
Paul Eggert
c5bccf11cc * src/system.h (ST_BLKSIZE): Ceiling at SIZE_MAX / 8 + 1, not at 4
MiB, since XFS hosts can legitimately have large values of
st_blksize.  Problem reported by Tony Ernst in
<http://savannah.gnu.org/bugs/?17903>.
2006-10-03 22:25:51 +00:00
Jim Meyering
1d4ac49f9d * NEWS: Update here, too. 2006-10-03 22:07:36 +00:00
Jim Meyering
a1da4a039d * src/remove.c (nonexistent_file_errno): Remove ENAMETOOLONG.
Paul Eggert pointed out that the specified file may exist,
in spite of such an errno value.
* tests/rm/Makefile.am (TESTS): Remove ignore-name-too-long.
* tests/rm/ignore-name-too-long: Remove file.
2006-10-03 22:06:31 +00:00
Jim Meyering
184dcf2caf * tests/rm/fail-eperm: Report failure also if rm is terminated by
a signal.
2006-10-03 13:57:26 +00:00
Jim Meyering
41011fa81d * src/c99-to-c89.diff: Convert two c99'isms -- one in remove.c
and one in shred.c -- that were added before coreutils-6.3.
Reported by Michael Deutschmann.
2006-10-03 13:57:04 +00:00
Jim Meyering
2f7025ad2a * src/c99-to-c89.diff: Update to reflect new offsets. 2006-10-03 13:40:36 +00:00
Jim Meyering
9ac369c2bd * src/remove.c (remove_entry): With -f, exit successfully in spite
of a missing file under some very unusual conditions (with errno
being any of ENOENT, ENOTDIR, ENAMETOOLONG).
2006-10-03 13:32:55 +00:00
Jim Meyering
da9541f18e With --force (-f), rm no longer fails for ENOTDIR.
* 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.
2006-10-03 13:13:09 +00:00
Jim Meyering
d2e7358a9b * NEWS: Add a line for 6.4-cvs.
* configure.ac (AC_INIT): Bump to 6.4 and add "-cvs" suffix.
2006-10-02 11:47:48 +00:00
Jim Meyering
d8086bc220 * bootstrap: Undo last change to this file, since now gnulib-tool
sticks with the automake default in generating dependencies.
2006-10-02 11:47:35 +00:00
Jim Meyering
2244cc1456 . 2006-09-30 17:37:25 +00:00
Jim Meyering
10688306fa Version 6.3.
* 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.
2006-09-30 07:43:21 +00:00
Jim Meyering
af8862ae29 * src/c99-to-c89.diff: Update offsets. 2006-09-30 07:37:07 +00:00
Paul Eggert
37986655cf * .cvsignore: Add openat-proc.c. 2006-09-30 00:42:06 +00:00
Paul Eggert
f7ecea33e4 * tests/rm/readdir-bug: Don't use $(...) in a shell script,
as it doesn't work with Solaris /bin/sh.
2006-09-30 00:19:29 +00:00
Jim Meyering
e245139e46 * NEWS: Mention Paul's fix (to gnulib's canon-host.c) for
the pinky segfault.
2006-09-29 21:37:18 +00:00
Jim Meyering
2e328b0196 * tests/seq/basic [neg-2, eq-wid-2]: Comment out tests that
use .1 as the increment.  Actual output varies too much.
[eq-wid-3]: New, commented out test.
2006-09-29 16:52:59 +00:00
Jim Meyering
a38becce97 * src/shuf.c (read_input): Fix an off-by-one error that
would cause an infloop for piped input of 8KB or more.
* NEWS: Mention the fix.
* tests/misc/shuf: Test for the above fix.
2006-09-29 16:52:48 +00:00
Jim Meyering
31c77a2fde [ChangeLog]
Since any system may be affected by the Darwin readdir bug,
perform the extra rewinddir unconditionally.  The performance
impact of rewinding a directory is negligible.
* src/remove.c (NEED_REWIND): Define to use
CONSECUTIVE_READDIR_UNLINK_THRESHOLD unconditionally.
[m4/ChangeLog]
* readdir.m4: Remove file once again.
* jm-macros.m4: Remove reference to gl_FUNC_READDIR.
2006-09-29 15:58:04 +00:00
Jim Meyering
af46184a80 * tests/seq/basic: Use .11 as the upper bound, in case the ".1"
increment translates to a slightly larger value.
This corrects a test failure on FreeBSD 6.1 reported by Nelson Beebe.
The final expected value wasn't being printed.
2006-09-29 11:30:48 +00:00
Jim Meyering
a4d470409f Work around a readdir bug in Darwin 7.9.0 (MacOS X 10.3.9) on HFS+
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
2006-09-29 09:54:24 +00:00
Jim Meyering
344c446776 fix typo: s/dignostic/diagnostic/ 2006-09-28 23:08:20 +00:00
Paul Eggert
f2d5658c08 * tests/rm/fail-eperm: Unset BASH_ENV, CDPATH, and ENV, too;
suggested for Debian stable, which uses Perl 5.8.4.
2006-09-28 22:07:42 +00:00
Jim Meyering
0bc935e209 * readdir.m4: Increment serial number. 2006-09-28 21:03:58 +00:00
Jim Meyering
b15b6fa192 * jm-macros.m4: Require the new macro.
* readdir.m4 (gl_FUNC_READDIR): Rename from GL_FUNC_READDIR.
2006-09-28 21:03:15 +00:00
Jim Meyering
665b228730 * readdir.m4: Revivify this file.
We need it to work around a bug on Darwin 0.7.x.
2006-09-28 21:00:30 +00:00
Jim Meyering
d37c3b8c6d Automatically generated dependencies are important even
when all of the sources in a directory come from gnulib.
* bootstrap (gnulib_tool): Remove the "no-dependencies" automake
option that gnulib-tool adds to what becomes our lib/gnulib.mk.
2006-09-28 18:33:19 +00:00
Jim Meyering
ec3554cd95 * tests/rm/fail-eperm: Enable Perl's (-T) taint checking.
Ensure that IFS is set properly and unset PATH.
Sanitize inputs.
Work properly even when the name of the selected file starts with "-".
Invoke rm via "../../src/rm", and adjust expected output.
Prompted by a patch from Tim Waugh.
2006-09-28 13:31:57 +00:00
Jim Meyering
c2de7816d8 * README-cvs: Add Bison to the list of required packages. 2006-09-28 07:10:53 +00:00
Jim Meyering
0747af4b18 * src/c99-to-c89.diff: Update offsets. 2006-09-26 22:57:51 +00:00
Jim Meyering
a86a56f7d1 * NEWS: rm works around a bug in Darwin 8.6.1 w/NFS that kept
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.
2006-09-26 20:42:43 +00:00
Paul Eggert
b7c315cdda [ChangeLog]
* 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.
2006-09-26 19:11:25 +00:00
Jim Meyering
412a3ca0b0 * README: Warn not to run autoreconf manually. Use bootstrap instead. 2006-09-26 13:03:03 +00:00
Jim Meyering
bbab62fd27 * src/groups.sh: When invoked with 0 or 1 argument, just exec "id".
Rewrite to avoid using temporary, $status.
2006-09-26 09:46:35 +00:00
Jim Meyering
5f65d05616 * NEWS: Mention the bug fix.
* src/groups.sh: Don't hide a write failure.
Reported by Iain Calder <ic56@rogers.com>.
2006-09-26 09:28:17 +00:00
Jim Meyering
509febe18b *** empty log message *** 2006-09-26 09:18:20 +00:00
Paul Eggert
3d524d9ab2 * .cvsignore: Add fchmodat.c. 2006-09-26 05:21:55 +00:00
Jim Meyering
1cd04b34dd * fchmodat.c: Remove file. gnulib's copy is identical. 2006-09-25 16:58:53 +00:00
Jim Meyering
d3c6206631 * src/chown.c (usage): Clarify --dereference description.
* src/chgrp.c (usage): Likewise.  Suggestion from Jamie McClelland.
2006-09-25 06:28:34 +00:00
Jim Meyering
f951057414 *** empty log message *** 2006-09-25 06:22:35 +00:00
Jim Meyering
e05de760c2 * NEWS: Mention these fixes.
* 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.
2006-09-24 19:28:25 +00:00
Jim Meyering
de88ea4c5d . 2006-09-24 19:27:02 +00:00
Jim Meyering
af5967eae2 * tests/mv/hard-verbose: New file. Test for the above fix.
* tests/mv/Makefile.am (TESTS): Add hard-verbose.
2006-09-24 16:55:13 +00:00
Jim Meyering
6649f01059 * tests/help-version (sync_args): Don't call sync, since it spins up
disks that I've deliberately caused to spin down (but not unmounted).
2006-09-24 16:46:41 +00:00
Jim Meyering
200aa48e15 * NEWS: Mention the improvement to sort. 2006-09-24 11:44:16 +00:00
Jim Meyering
867251d725 * tests/tail-2/proc-ksyms: Require that /proc/ksyms be readable
as well as existing.
2006-09-24 07:29:44 +00:00
Jim Meyering
b4963a7f70 * tests/ls/stat-dtype: Don't use tmpfs on linux-2.4 or older,
since that predated addition of d_type support.
2006-09-24 07:27:00 +00:00
Jim Meyering
453c215003 * Makefile.am (EXTRA_DIST): Sort file names.
Add bootstrap and gl/modules/getloadavg.diff
2006-09-23 17:00:29 +00:00
Jim Meyering
328efced8b remove trailing blanks 2006-09-23 17:00:08 +00:00
Jim Meyering
7c8dece8c6 * gl/modules/getloadavg.diff: New file. Work around the way the latest
version of the getloadavg module interacts with our bootstrap script.
* bootstrap (gnulib_tool_options): Add "--local-dir gl".
2006-09-23 16:51:53 +00:00
Paul Eggert
5ffeefb1ab * bootstrap: Add support for --force.
(usage): New function.  Describe usage less tersely.
(CVS_only_file): New var.
2006-09-20 21:28:26 +00:00
Paul Eggert
2a01141018 * NEWS: Document fix for cp -i and mv -i.
* 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.
2006-09-20 17:32:14 +00:00
Jim Meyering
fae30e1af9 * NEWS: Mention the chmod bug fix. 2006-09-20 13:30:55 +00:00
Jim Meyering
2c83d42320 *** empty log message *** 2006-09-20 12:41:20 +00:00
Jim Meyering
396a52f790 * tests/chmod/inaccessible: New test.
* tests/chmod/Makefile.am (TESTS): Add inaccessible.
2006-09-20 12:38:22 +00:00
Jim Meyering
05ce3b2986 Fix the 2006-09-18 bug differently.
* src/chmod.c: (process_file): Upon FTS_NS for a top-level file,
tell fts_read to stat the file again, in case it has become
accessible since the initial fts_open call.
* src/chown-core.c (change_file_owner): Likewise.
2006-09-20 11:50:46 +00:00
Jim Meyering
1671b056a5 * src/chmod.c: Revert last change. There is a better way.
* src/chown-core.c: Likewise.
2006-09-20 11:26:18 +00:00
Paul Eggert
856443a97d * coreutils.texi (Disk usage): Clarify intro. Problem reported by Van Ly. 2006-09-19 22:39:38 +00:00
Paul Eggert
7889cfbbc7 * src/ln.c (target_directory_operand): Rewrite to avoid porting
problem on Tandem reported by Matthew Woehlke in
<https://savannah.gnu.org/bugs/?17172>.
2006-09-19 22:11:38 +00:00
Paul Eggert
90616d3a8f (cp invocation): Clarify cp -i a bit more. 2006-09-19 21:54:01 +00:00
Paul Eggert
f544d8dd1a * coreutils.texi (cp invocation): Say that -i and -f are
independent.  Clarify -i's behavior.
2006-09-19 16:49:06 +00:00
Paul Eggert
0e3b87195a Fix bug where chmod, chown, and chgrp did not process operands
left-to-right in some cases.
* src/chmod.c (wd_errno): New var.
(chmod_file): New function, with most of the contents of the
old prcess_file function.
(process_files): Use it.  This gives file names to fts one
at a time, so that they are processed left-to-right as POSIX
requires.
* src/chown-core.c (wd_errno, chown_files): Likewise.
(chown_file): New function.
* tests/install/basic-1: Redo test so as to not workaround
the chmod bug, thereby testing for it.
2006-09-18 22:09:49 +00:00
Paul Eggert
bebf83d0fd * src/shuf.c (main): Quote the entire range when reporting an
invalid one, rather than just the part that contained the error.
2006-09-18 20:38:54 +00:00
Paul Eggert
46dd4b1a8e * tests/stty/row-col-1: Rewrite to avoid temporary file that is
sometimes left behind if the test is skipped or interrupted.
2006-09-18 20:34:50 +00:00
Paul Eggert
058f319e6d * bootstrap (symlink_to_gnulib): New function.
(cp_mark_as_generated): Use it, to prefer symlinks-to-gnulib
to copies-of-gnulib.
(cp_mark_as_generated, slurp, gnulib_files):
Avoid making a copy if it's the same as the old version.
(gnulib_files): Add support for this variable (used by Bison).
2006-09-18 20:20:03 +00:00
Paul Eggert
87353aebd8 * tests/ls/stat-vs-dirent: Fix quoting problem in diagnostic
indicating flaw in kernel.  Reword to say that the flaw isn't
serious for coreutils, since the flaw does affect ls -i.
2006-09-18 16:34:27 +00:00
Paul Eggert
5a73ad8c63 Fix bug in test case exposed by building on
Solaris 8 in a setgid directory.  The test case incorrectly
assumed that 'symlink' would be in group $g1.
2006-09-18 16:11:00 +00:00
Jim Meyering
c9c0dc7bc6 * NEWS: Add a line for 6.3-cvs.
* configure.ac (AC_INIT): Bump to 6.3 and add "-cvs" suffix.
2006-09-18 13:01:09 +00:00
Jim Meyering
9c57927ad1 . 2006-09-18 08:09:54 +00:00
289 changed files with 3641 additions and 1287 deletions

119
.gitignore vendored
View File

@@ -6,6 +6,8 @@
*/.deps
*~
.kludge-stamp
ABOUT-NLS
INSTALL
Makefile
Makefile.in
THANKS-to-translators
@@ -23,123 +25,6 @@ coreutils-*.tar.gz
coreutils-*.tar.gz.sig
coreutils-*.xdelta
coreutils-*.xdelta.sig
doc/constants.texi
doc/coreutils.info
doc/stamp-vti
doc/version.texi
lib/alloca.h
lib/charset.alias
lib/getdate.c
lib/libcoreutils.a
lib/ref-add.sed
lib/ref-del.sed
lib/stdint.h
lib/t-fpending
po/Makefile.in
po/POTFILES
po/coreutils.pot
po/stamp-po
src/\[
src/base64
src/basename
src/cat
src/chgrp
src/chmod
src/chown
src/chroot
src/cksum
src/comm
src/cp
src/csplit
src/cut
src/date
src/dd
src/df
src/dir
src/dircolors
src/dircolors.h
src/dirname
src/du
src/echo
src/env
src/expand
src/expr
src/factor
src/false
src/fmt
src/fold
src/fs.h
src/ginstall
src/groups
src/head
src/hostid
src/hostname
src/id
src/join
src/kill
src/link
src/ln
src/localedir.h
src/logname
src/ls
src/md5sum
src/mkdir
src/mkfifo
src/mknod
src/mv
src/nice
src/nl
src/nohup
src/od
src/paste
src/pathchk
src/pinky
src/pr
src/printenv
src/printf
src/ptx
src/pwd
src/readlink
src/rm
src/rmdir
src/seq
src/setuidgid
src/sha1sum
src/sha224sum
src/sha256sum
src/sha384sum
src/sha512sum
src/shred
src/sleep
src/sort
src/split
src/stat
src/stty
src/su
src/sum
src/sync
src/tac
src/tail
src/tee
src/test
src/touch
src/tr
src/true
src/tsort
src/tty
src/uname
src/unexpand
src/uniq
src/unlink
src/uptime
src/users
src/vdir
src/wc
src/wheel-size.h
src/wheel.h
src/who
src/whoami
src/yes
stamp-h1
tests/cut/cut-tests
tests/head/head-tests

View File

@@ -1 +1 @@
6.1
6.3

View File

@@ -1,6 +1,6 @@
# Suppress valgrind diagnostics we don't care about.
# Copyright (C) 2003, 2004 Free Software Foundation, Inc.
# Copyright (C) 2003, 2004, 2006 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -49,3 +49,31 @@
sigaction(act)
fun:__libc_sigaction
}
{
libc_expand_dynamic_string_token
Memcheck:Cond
fun:strlen
fun:expand_dynamic_string_token
obj:*
obj:*
obj:*
obj:*
obj:*
}
{
libc__dl_new_object
Memcheck:Cond
fun:strlen
fun:_dl_new_object
obj:*
obj:*
obj:*
obj:*
}
{
libc_fillin_rpath
Memcheck:Cond
fun:strlen
fun:fillin_rpath
}

View File

@@ -1,5 +1 @@
Makefile\.in$
\.po$
^build-aux/texinfo\.tex$
^src/c99-to-c89\.diff
^tests/pr/

744
ChangeLog
View File

@@ -1,5 +1,749 @@
2006-10-22 Jim Meyering <jim@meyering.net>
Version 6.4.
* NEWS: Record the 6.4 release date.
* configure.ac (AC_INIT): Remove "-cvs" suffix from version string.
* Makefile.maint: Complete the adaptation to function with a working
directory that is using git (rather than cvs) for version control.
2006-10-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
* tests/chmod/c-option: Double-quote instances of `$abs_srcdir'.
* tests/cp/cp-parents: Likewise.
* tests/mkdir/parents: Likewise.
* tests/mkdir/perm: Likewise.
* tests/sample-test: Quote variables containing absolute build
tree paths. In the cleanup trap, make sure `cd' succeeds before
`chmod'ing and `rm'ing the temporary files.
* tests/chgrp/basic: Likewise.
* tests/chgrp/deref: Likewise.
* tests/chgrp/no-x: Likewise.
* tests/chgrp/posix-H: Likewise.
* tests/chgrp/recurse: Likewise.
* tests/chmod/c-option: Likewise.
* tests/chmod/equal-x: Likewise.
* tests/chmod/equals: Likewise.
* tests/chmod/inaccessible: Likewise.
* tests/chmod/no-x: Likewise.
* tests/chmod/octal: Likewise.
* tests/chmod/setgid: Likewise.
* tests/chmod/umask-x: Likewise.
* tests/chmod/usage: Likewise.
* tests/chown/basic: Likewise.
* tests/chown/deref: Likewise.
* tests/chown/separator: Likewise.
* tests/cp/acl: Likewise.
* tests/cp/backup-1: Likewise.
* tests/cp/backup-dir: Likewise.
* tests/cp/backup-is-src: Likewise.
* tests/cp/cp-HL: Likewise.
* tests/cp/cp-deref: Likewise.
* tests/cp/cp-i: Likewise.
* tests/cp/cp-mv-backup: Likewise.
* tests/cp/cp-parents: Likewise.
* tests/cp/deref-slink: Likewise.
* tests/cp/dir-rm-dest: Likewise.
* tests/cp/dir-slash: Likewise.
* tests/cp/dir-vs-file: Likewise.
* tests/cp/fail-perm: Likewise.
* tests/cp/into-self: Likewise.
* tests/cp/link: Likewise.
* tests/cp/link-no-deref: Likewise.
* tests/cp/link-preserve: Likewise.
* tests/cp/no-deref-link1: Likewise.
* tests/cp/no-deref-link2: Likewise.
* tests/cp/no-deref-link3: Likewise.
* tests/cp/perm: Likewise.
* tests/cp/preserve-2: Likewise.
* tests/cp/r-vs-symlink: Likewise.
* tests/cp/same-file: Likewise.
* tests/cp/slink-2-slink: Likewise.
* tests/cp/sparse: Likewise.
* tests/cp/special-bits: Likewise.
* tests/cp/src-base-dot: Likewise.
* tests/cp/symlink-slash: Likewise.
* tests/dd/not-rewound: Likewise.
* tests/dd/skip-seek2: Likewise.
* tests/dd/unblock-sync: Likewise.
* tests/du/2g: Likewise.
* tests/du/8gb: Likewise.
* tests/du/basic: Likewise.
* tests/du/deref: Likewise.
* tests/du/deref-args: Likewise.
* tests/du/exclude: Likewise.
* tests/du/fd-leak: Likewise.
* tests/du/hard-link: Likewise.
* tests/du/inaccessible-cwd: Likewise.
* tests/du/long-from-unreadable: Likewise.
* tests/du/long-sloop: Likewise.
* tests/du/no-deref: Likewise.
* tests/du/no-x: Likewise.
* tests/du/restore-wd: Likewise.
* tests/du/slash: Likewise.
* tests/du/slink: Likewise.
* tests/du/trailing-slash: Likewise.
* tests/du/two-args: Likewise.
* tests/fmt/long-line: Likewise.
* tests/install/basic-1: Likewise.
* tests/install/create-leading: Likewise.
* tests/install/d-slashdot: Likewise.
* tests/install/trap: Likewise.
* tests/ln/misc: Likewise.
* tests/ln/target-1: Likewise.
* tests/ls/color-dtype-dir: Likewise.
* tests/ls/dangle: Likewise.
* tests/ls/dired: Likewise.
* tests/ls/file-type: Likewise.
* tests/ls/follow-slink: Likewise.
* tests/ls/infloop: Likewise.
* tests/ls/inode: Likewise.
* tests/ls/m-option: Likewise.
* tests/ls/no-arg: Likewise.
* tests/ls/recursive: Likewise.
* tests/ls/rt-1: Likewise.
* tests/ls/stat-dtype: Likewise.
* tests/ls/stat-failed: Likewise.
* tests/ls/stat-vs-dirent: Likewise.
* tests/misc/cat-proc: Likewise.
* tests/misc/close-stdout: Likewise.
* tests/misc/csplit: Likewise.
* tests/misc/date-sec: Likewise.
* tests/misc/false-status: Likewise.
* tests/misc/head-c: Likewise.
* tests/misc/head-pos: Likewise.
* tests/misc/mknod: Likewise.
* tests/misc/nl: Likewise.
* tests/misc/nohup: Likewise.
* tests/misc/pathchk1: Likewise.
* tests/misc/printf: Likewise.
* tests/misc/printf-hex: Likewise.
* tests/misc/pwd-long: Likewise.
* tests/misc/shuf: Likewise.
* tests/misc/sort-rand: Likewise.
* tests/misc/split-a: Likewise.
* tests/misc/split-fail: Likewise.
* tests/misc/split-l: Likewise.
* tests/misc/stat-fmt: Likewise.
* tests/misc/tac-continue: Likewise.
* tests/misc/wc-files0: Likewise.
* tests/mkdir/concurrent-1: Likewise.
* tests/mkdir/p-1: Likewise.
* tests/mkdir/p-2: Likewise.
* tests/mkdir/p-3: Likewise.
* tests/mkdir/p-slashdot: Likewise.
* tests/mkdir/p-thru-slink: Likewise.
* tests/mkdir/p-v: Likewise.
* tests/mkdir/parents: Likewise.
* tests/mkdir/perm: Likewise.
* tests/mkdir/t-slash: Likewise.
* tests/mv/acl: Likewise.
* tests/mv/atomic: Likewise.
* tests/mv/backup-dir: Likewise.
* tests/mv/childproof: Likewise.
* tests/mv/diag: Likewise.
* tests/mv/dir-file: Likewise.
* tests/mv/dir2dir: Likewise.
* tests/mv/dup-source: Likewise.
* tests/mv/hard-2: Likewise.
* tests/mv/hard-3: Likewise.
* tests/mv/hard-4: Likewise.
* tests/mv/hard-link-1: Likewise.
* tests/mv/hard-verbose: Likewise.
* tests/mv/i-2: Likewise.
* tests/mv/i-3: Likewise.
* tests/mv/i-4: Likewise.
* tests/mv/i-5: Likewise.
* tests/mv/i-link-no: Likewise.
* tests/mv/into-self-4: Likewise.
* tests/mv/leak-fd: Likewise.
* tests/mv/mv-special-1: Likewise.
* tests/mv/no-target-dir: 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/perm-1: Likewise.
* tests/mv/reply-no: Likewise.
* tests/mv/trailing-slash: Likewise.
* tests/mv/update: Likewise.
* tests/od/od-N: Likewise.
* tests/od/x8: Likewise.
* tests/readlink/can-e: Likewise.
* tests/readlink/can-f: Likewise.
* tests/readlink/can-m: Likewise.
* tests/readlink/rl-1: Likewise.
* tests/rm/cycle: Likewise.
* tests/rm/dangling-symlink: Likewise.
* tests/rm/deep-1: Likewise.
* tests/rm/dir-no-w: Likewise.
* tests/rm/dir-nonrecur: Likewise.
* tests/rm/dot-rel: Likewise.
* tests/rm/empty-inacc: Likewise.
* tests/rm/f-1: Likewise.
* tests/rm/fail-2eperm: Likewise.
* tests/rm/hash: Likewise.
* tests/rm/i-1: Likewise.
* tests/rm/i-no-r: Likewise.
* tests/rm/ignorable: Likewise.
* tests/rm/inaccessible: Likewise.
* tests/rm/interactive-always: Likewise.
* tests/rm/interactive-once: Likewise.
* tests/rm/ir-1: Likewise.
* tests/rm/isatty: Likewise.
* tests/rm/no-give-up: Likewise.
* tests/rm/r-1: Likewise.
* tests/rm/r-2: Likewise.
* tests/rm/r-3: Likewise.
* tests/rm/r-4: Likewise.
* tests/rm/readdir-bug: Likewise.
* tests/rm/rm1: Likewise.
* tests/rm/rm2: Likewise.
* tests/rm/rm3: Likewise.
* tests/rm/rm4: Likewise.
* tests/rm/rm5: Likewise.
* tests/rm/sunos-1: Likewise.
* tests/rm/unread2: Likewise.
* tests/rm/unread3: Likewise.
* tests/rmdir/fail-perm: Likewise.
* tests/rmdir/t-slash: Likewise.
* tests/shred/exact: Likewise.
* tests/shred/remove: Likewise.
* tests/sum/sysv: Likewise.
* tests/tail-2/append-only: Likewise.
* tests/tail-2/assert: Likewise.
* tests/tail-2/assert-2: Likewise.
* tests/tail-2/big-4gb: Likewise.
* tests/tail-2/fflush: Likewise.
* tests/tail-2/infloop-1: Likewise.
* tests/tail-2/proc-ksyms: Likewise.
* tests/tail-2/start-middle: Likewise.
* tests/tail-2/tail-n0f: Likewise.
* tests/tee/basic: Likewise.
* tests/tee/dash: Likewise.
* tests/touch/fail-diag: Likewise.
* tests/touch/no-create-missing: Likewise.
* tests/touch/not-owner: Likewise.
* tests/touch/obsolescent: Likewise.
* tests/touch/read-only: Likewise.
* tests/touch/relative: Likewise.
2006-10-21 Jim Meyering <jim@meyering.net>
* NEWS: (cp --backup fix): Fix a typo.
* .gitignore: Remove some references to files in subdirectories.
* build-aux/.gitignore, doc/.gitignore, lib/.gitignore: New files.
* m4/.gitignore, po/.gitignore, src/.gitignore: Likewise.
* src/copy.c (copy_internal): Add a comment saying why we prefer
mknod over mkfifo.
Enable an fts optimization (call lstat only for directories,
on some file system types) also with the --preserve-root option
of chown or chgrp.
* src/chown-core.c (change_file_owner): Compare fts_statp-based
dev/ino against root dev/ino only for directories.
(chown_files): Don't let the root_dev_ino setting influence whether
we use FTS_NOSTAT: fts always sets *fts_statp for a directory.
2006-10-20 Jim Meyering <jim@meyering.net>
* src/od.c (usage): Change description of default to use "-w16",
not the now-invalid "-w 16" syntax. From Dan Jacobson.
2006-10-19 Jim Meyering <jim@meyering.net>
* bootstrap: Add names to each .gitignore file (if it exists)
as well as to .cvsignore.
* Makefile.maint (po-check): This rule didn't detect the new use
of "gettext" (as opposed to the use of "_" everywhere else) in
lib/xstrtol.h. Adjust the grep regexp so that now it does.
2006-10-18 Paul Eggert <eggert@cs.ucla.edu>
* src/copy.c (copy_reg): Rewrite slightly to avoid duplicate code
when opening dst_name.
(copy_reg, copy_internal): Use (SYSCALL != 0) rather than plain
(SYSCALL) to test for failure in a system call.
* src/copy.c (copy_internal): Use mknod rather than mkfifo to copy
a fifo. This preserves the special mode bits on Solaris 10, which
is compatible with what Solaris 10 cp -R does.
* src/copy.c (copy_internal): Remove redundant and confusing local
variable src_type.
* src/copy.c (copy_internal): Don't pass mkdir a mode greater than
7777. This matches historical 'cp' behavior and avoids some
(though not all) implementation-defined behavior of mkdir.
* src/cp.c (make_dir_parents_private): Likewise.
* src/copy.c (copy_internal): Don't pass 'open' a mode greater
than 777. This is required by POSIX. It doesn't make any difference
in actual behavior on any host that I know of.
2006-10-17 Jim Meyering <jim@meyering.net>
* src/dd.c (usage): Use two spaces (not one) to separate the
"fdatasync" option string from its description, so help2man formats
the derived man page properly. Reported by Samuel Thibault
in <http://bugs.debian.org/393649>.
2006-10-16 Jim Meyering <jim@meyering.net>
* .x-sc_trailing_blank: Remove names of files that are no longer
version-controlled.
2006-10-16 Paul Eggert <eggert@cs.ucla.edu>
* src/groups.sh (version): Reword message to match the other programs.
Problem reported by Eric Blake.
2006-10-14 Jim Meyering <jim@meyering.net>
* Makefile.maint (headers_with_interesting_macro_defs): Define.
(.re-defmac, sc_always_defined_macros): New rules.
* src/system.h (EXIT_FAILURE, EXIT_SUCCESS): Remove definitions.
Instead, include "exit.h". This hereby retires the work-around for
"Sony NEWS-OS Release 4.0C"'s bug due to "#define EXIT_FAILURE 0".
* src/cksum.c (uint_fast32_t): Don't define.
Instead, include <stdint.h>.
* src/pinky.c (S_IWGRP): Don't define.
It's already defined by "stat-macros.h" (included via system.h).
* Makefile.cfg: Remove cruft that's now handled via bootstrap.
* Makefile.maint: Likewise, remove these targets/rules/variables:
(local_updates, update, cvs-update, wget_files, get-targets): Remove.
(cvs_files, wget-update, automake_repo): Likewise.
Move the comment about cvsu to build-aux/vc-list-files,
where cvsu is actually used.
* Makefile.maint (cvs-update): Use $(CVS), not "cvs".
Work also when the working directory (with e.g. coreutils sources)
is version controlled with git, rather than CVS.
* bootstrap (CVS_only_file): Test for the existence of README-cvs,
rather than CVS.
In messages and comments, say e.g., "checked-out sources",
rather than "CVS sources".
(version_controlled_file): New function. Work for git as well as
for CVS. Don't use grep's -q option.
(slurp): Call it here, in place of CVS-specific code.
* NEWS: cp -r --backup dir1 dir2, would rename an existing dir1/dir2
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.
* tests/cp/Makefile.am (TESTS): Add backup-dir.
2006-10-13 Jim Meyering <jim@meyering.net>
More chown/chgrp dereferencing-related fixes.
* src/chown-core.c (change_file_owner): Don't use fts_statp if
we're dereferencing symlinks.
Reverse conjuncts, so that we use dereference file_stats
(aka ent->fts_statp) only *after* we've confirmed that
chopt->affect_symlink_referent is true. Otherwise, we might
use ent->fts_statp uninitialized.
Don't turn on FTS_NOSTAT when dereferencing symlinks.
* tests/chown/deref: Update the expected diagnostic, now that
this test case (trying to use "chown --dereference ..." on a
dangling symlink) takes a different code path.
2006-10-13 Paul Eggert <eggert@cs.ucla.edu>
Sync from Bison, as follows:
2006-10-01 Paul Eggert <eggert@cs.ucla.edu>
Fix problems with translating English-language diagnostics.
* bootstrap: Fix bug introduced in recent bootstrap changes, with
respect to bison-runtime pot generation. The YY_ stuff
wasn't being captured.
2006-10-13 Jim Meyering <jim@meyering.net>
* src/chown-core.c (change_file_owner): Use fstatat, not stat,
now that we're using fts_open with FTS_CWDFD.
* tests/chgrp/posix-H: Add --preserve-root to an invocation of
chgrp, to exercise the above fix.
* NEWS: Mention the above.
* src/du-tests: Clean up a little, though it's still not portable.
* .vg-suppressions: Add 3 more for debian unstable.
* tests/ls/Test.pm: Remove long-unused file.
* Makefile.am (EXTRA_DIST): Add bootstrap.conf.
Suggestions from Bruno Haible.
2006-10-12 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
* Makefile.am (THANKS-to-translators): Add missing $(srcdir).
(MAINTAINERCLEANFILES): Add .kludge-stamp.
* man/Makefile.am (MAINTAINERCLEANFILES): Typo $(dist_man_MANS)
instead of $(man_MANS).
2006-10-12 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
* configure.ac: Avoid compiler warnings about default return
type in function definitions and unused variables in tests.
* src/who.c (print_user) [HAVE_UT_HOST]: hostlen is only needed
if this is #defined.
2006-10-12 Jim Meyering <jim@meyering.net>
* configure.ac: Reflect s/gl_MACROS/coreutils_MACROS/ renaming.
Call gl_INIT directly, rather than through the above.
2006-10-11 Paul Eggert <eggert@cs.ucla.edu>
* bootstrap (symlink_to_gnulib): Fix bug: the dot_dots shell
variable was sometimes used without being initialized. This
messed up the installation of the INSTALL file in some cases.
2006-10-11 Jim Meyering <jim@meyering.net>
* src/ls.c (usage): Correct description of -s, --size.
It works even without -l. Suggestion from Karl Berry.
2006-10-10 Paul Eggert <eggert@cs.ucla.edu>
* src/ls.c (quote_name): Use initializer rather than memset to
initialize an object to zero. This is easier to read and is less
likely to introduce a runtime error due to a mixup. It causes
gcc -W to issue a warning, but you can work around this by
appending -Wno-missing-field-initializers.
* src/pathchk.c (portable_chars_only): Likewise.
* src/shred.c (main): Likewise.
* src/stty.c (main): Likewise.
* src/tr.c (card_of_complement): Likewise.
* src/wc.c (wc): Likewise.
2006-10-09 Paul Eggert <eggert@cs.ucla.edu>
* src/sort.c (usage): Mention again that sort fields are origin 1.
* NEWS: Fix typo: iso-8602 -> iso-8601. Problem reported by
Bob Proulx.
* bootstrap (usage, main program, symlink_to_gnulib): Add option
--copy. Inspired by a suggestion from Bruno Haible.
2006-10-09 Jim Meyering <jim@meyering.net>
Avoid a compiler warning.
* src/pathchk.c (portable_chars_only): Initialize variable of type
mbstate_t via memset, rather than via '{0}'. Patch from Bruno Haible.
2006-10-06 Paul Eggert <eggert@cs.ucla.edu>
Fix bug reported today by Mike Frysinger: mkdir -pv is logging the
wrong file name in some cases. Lars Wendler reported a bug in
my original fix.
* src/install.c (make_ancestor): New arg COMPONENT.
* src/mkdir.c (make_ancestor): Likewise.
* tests/install/basic-1: Check for install -Dv bug.
* tests/mkdir/Makefile.am (TESTS): Add p-v.
* tests/mkdir/p-v: New file, to test this bug.
2006-10-05 Paul Eggert <eggert@cs.ucla.edu>
* src/chgrp.c: Don't include lchown.h; no longer needed.
* src/chown.c: Likewise.
* tests/ls/stat-dtype: Use a dynamic test to decide whether the
current file system has useful d_type info.
* src/dd.c (flags): noatime and nofollow now depend on
HAVE_WORKING_O_NOATIME and HAVE_WORKING_O_NOFOLLOW, too.
(usage): Output info about noatime and nofollow only if
they are known to work.
* src/remove.c (AD_push): Inspect HAVE_WORKING_O_NOFOLLOW rather
than O_NOFOLLOW, when testing whether it's possible to avoid a
race condition reliably.
2006-10-05 Jim Meyering <jim@meyering.net>
* src/c99-to-c89.diff: Update to reflect new offsets.
* tests/install/basic-1: Skip the latter part of this test if the
just-built dd binary is not readable. Otherwise, this test would fail
when binaries were created as root. Reported by Bauke Jan Douma in
<http://article.gmane.org/gmane.comp.gnu.core-utils.bugs/8433>.
2006-10-03 Paul Eggert <eggert@cs.ucla.edu>
* src/system.h (ST_BLKSIZE): Ceiling at SIZE_MAX / 8 + 1, not at 4
MiB, since XFS hosts can legitimately have large values of
st_blksize. Problem reported by Tony Ernst in
<http://savannah.gnu.org/bugs/?17903>.
2006-10-04 Jim Meyering <jim@meyering.net>
* src/remove.c (nonexistent_file_errno): Remove ENAMETOOLONG.
Paul Eggert pointed out that the specified file may exist,
in spite of such an errno value.
* tests/rm/Makefile.am (TESTS): Remove ignore-name-too-long.
* tests/rm/ignore-name-too-long: Remove file.
* NEWS: Update here, too.
2006-10-03 Jim Meyering <jim@meyering.net>
* tests/rm/fail-eperm: Report failure also if rm is terminated by
a signal.
* src/c99-to-c89.diff: Convert two c99'isms -- one in remove.c
and one in shred.c -- that were added before coreutils-6.3.
Reported by Michael Deutschmann.
* src/c99-to-c89.diff: Update to reflect new offsets.
* src/remove.c (remove_entry): With -f, exit successfully in spite
of a missing file under some very unusual conditions (with errno
being any of ENOENT, ENOTDIR, ENAMETOOLONG).
With --force (-f), rm no longer fails for ENOTDIR.
* 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.
* bootstrap: Undo last change to this file, since now gnulib-tool
sticks with the automake default in generating dependencies.
* NEWS: Add a line for 6.4-cvs.
* configure.ac (AC_INIT): Bump to 6.4 and add "-cvs" suffix.
2006-09-30 Jim Meyering <jim@meyering.net>
Version 6.3.
* 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.
* src/c99-to-c89.diff: Update offsets.
2006-09-29 Paul Eggert <eggert@cs.ucla.edu>
* tests/rm/readdir-bug: Don't use $(...) in a shell script,
as it doesn't work with Solaris /bin/sh.
2006-09-29 Jim Meyering <jim@meyering.net>
* NEWS: Mention Paul's fix (to gnulib's canon-host.c) for
the pinky segfault.
* tests/seq/basic [neg-2, eq-wid-2]: Comment out tests that
use .1 as the increment. Actual output varies too much.
[eq-wid-3]: New, commented out test.
* src/shuf.c (read_input): Fix an off-by-one error that
would cause an infloop for piped input of 8KB or more.
* NEWS: Mention the fix.
* tests/misc/shuf: Test for the above fix.
Since any system may be affected by the Darwin readdir bug,
perform the extra rewinddir unconditionally. The performance
impact of rewinding a directory is negligible.
* src/remove.c (NEED_REWIND): Define to use
CONSECUTIVE_READDIR_UNLINK_THRESHOLD unconditionally.
* tests/seq/basic: Use .11 as the upper bound, in case the ".1"
increment translates to a slightly larger value.
This corrects a test failure on FreeBSD 6.1 reported by Nelson Beebe.
The final expected value wasn't being printed.
Work around a readdir bug in Darwin 7.9.0 (MacOS X 10.3.9) on HFS+
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
2006-09-28 Paul Eggert <eggert@cs.ucla.edu>
* tests/rm/fail-eperm: Unset BASH_ENV, CDPATH, and ENV, too;
suggested for Debian stable, which uses Perl 5.8.4.
2006-09-28 Jim Meyering <jim@meyering.net>
Automatically generated dependencies are important even
when all of the sources in a directory come from gnulib.
* bootstrap (gnulib_tool): Remove the "no-dependencies" automake
option that gnulib-tool adds to what becomes our lib/gnulib.mk.
* tests/rm/fail-eperm: Enable Perl's (-T) taint checking.
Ensure that IFS is set properly and unset PATH.
Sanitize inputs.
Work properly even when the name of the selected file starts with "-".
Invoke rm via "../../src/rm", and adjust expected output.
Prompted by a patch from Tim Waugh.
* README-cvs: Add Bison to the list of required packages.
2006-09-26 Jim Meyering <jim@meyering.net>
* src/c99-to-c89.diff: Update offsets.
* NEWS: rm works around a bug in Darwin 8.6.1 w/NFS that kept
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.
2006-09-26 Paul Eggert <eggert@cs.ucla.edu>
* 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.
2006-09-26 Jim Meyering <jim@meyering.net>
* README: Warn not to run autoreconf manually. Use bootstrap instead.
* src/groups.sh: When invoked with 0 or 1 argument, just exec "id".
Rewrite to avoid using temporary, $status.
* NEWS: Mention the bug fix.
* src/groups.sh: Don't hide a write failure.
Reported by Iain Calder <ic56@rogers.com>.
2006-09-25 Jim Meyering <jim@meyering.net>
* src/chown.c (usage): Clarify --dereference description.
* src/chgrp.c (usage): Likewise. Suggestion from Jamie McClelland.
2006-09-24 Jim Meyering <jim@meyering.net>
* NEWS: Mention these fixes.
* 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.
* tests/mv/hard-verbose: New file. Test for the above fix.
* tests/mv/Makefile.am (TESTS): Add hard-verbose.
* tests/help-version (sync_args): Don't call sync, since it spins up
disks that I've deliberately caused to spin down (but not unmounted).
* NEWS: Mention the improvement to sort.
* tests/tail-2/proc-ksyms: Require that /proc/ksyms be readable
as well as existing.
* tests/ls/stat-dtype: Don't use tmpfs on linux-2.4 or older,
since that predated addition of d_type support.
2006-09-23 Jim Meyering <jim@meyering.net>
* gl/modules/getloadavg.diff: New file. Work around the way the latest
version of the getloadavg module interacts with our bootstrap script.
* bootstrap (gnulib_tool_options): Add "--local-dir gl".
* Makefile.am (EXTRA_DIST): Sort file names.
Add bootstrap and gl/modules/getloadavg.diff
2006-09-20 Paul Eggert <eggert@cs.ucla.edu>
* bootstrap: Add support for --force.
(usage): New function. Describe usage less tersely.
(CVS_only_file): New var.
* NEWS: Document fix for cp -i and mv -i.
* 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.
2006-09-20 Jim Meyering <jim@meyering.net>
* NEWS: Mention the chmod bug fix.
* tests/chmod/inaccessible: New test, specifically for this bug.
Based on a test case from Paul Eggert.
* tests/chmod/Makefile.am (TESTS): Add inaccessible.
Fix the 2006-09-18 bug differently.
* src/chmod.c: (process_file): Upon FTS_NS for a top-level file,
tell fts_read to stat the file again, in case it has become
accessible since the initial fts_open call.
* src/chown-core.c (change_file_owner): Likewise.
* src/chmod.c: Revert last change. There is a better way.
* src/chown-core.c: Likewise.
2006-09-19 Paul Eggert <eggert@cs.ucla.edu>
* src/ln.c (target_directory_operand): Rewrite to avoid porting
problem on Tandem reported by Matthew Woehlke in
<https://savannah.gnu.org/bugs/?17172>.
2006-09-18 Paul Eggert <eggert@cs.ucla.edu>
Fix bug where chmod, chown, and chgrp did not process operands
left-to-right in some cases.
* src/chmod.c (wd_errno): New var.
(chmod_file): New function, with most of the contents of the
old prcess_file function.
(process_files): Use it. This gives file names to fts one
at a time, so that they are processed left-to-right as POSIX
requires.
* src/chown-core.c (wd_errno, chown_files): Likewise.
(chown_file): New function.
* tests/install/basic-1: Redo test so as to not workaround
the chmod bug, thereby testing for it.
* src/shuf.c (main): Quote the entire range when reporting an
invalid one, rather than just the part that contained the error.
* tests/stty/row-col-1: Rewrite to avoid temporary file that is
sometimes left behind if the test is skipped or interrupted.
* bootstrap (symlink_to_gnulib): New function.
(cp_mark_as_generated): Use it, to prefer symlinks-to-gnulib
to copies-of-gnulib.
(cp_mark_as_generated, slurp, gnulib_files):
Avoid making a copy if it's the same as the old version.
(gnulib_files): Add support for this variable (used by Bison).
* tests/ls/stat-vs-dirent: Fix quoting problem in diagnostic
indicating flaw in kernel. Reword to say that the flaw isn't
serious for coreutils, since the flaw does affect ls -i.
* tests/chgrp/basic: Fix bug in test case exposed by building on
Solaris 8 in a setgid directory. The test case incorrectly
assumed that 'symlink' would be in group $g1.
2006-09-18 Jim Meyering <jim@meyering.net>
* NEWS: Add a line for 6.3-cvs.
* configure.ac (AC_INIT): Bump to 6.3 and add "-cvs" suffix.
Version 6.2.
* NEWS: Record the 6.2 release date.
* configure.ac (AC_INIT): Remove "-cvs" suffix from version string.

View File

@@ -20,30 +20,33 @@
SUBDIRS = lib src doc man po tests
EXTRA_DIST = Makefile.cfg Makefile.maint GNUmakefile \
.hgignore \
.gitignore \
.hgignore \
.kludge-stamp .prev-version THANKS-to-translators THANKStt.in \
.vg-suppressions \
.x-po-check \
.x-sc_space_tab .x-sc_sun_os_names \
.x-sc_file_system .x-sc_obsolete_symbols \
.x-sc_prohibit_atoi_atof \
.x-sc_require_config_h \
.x-sc_space_tab .x-sc_sun_os_names \
.x-sc_trailing_blank \
.x-sc_unmarked_diagnostics \
.x-sc_useless_cpp_parens \
.x-sc_require_config_h \
.x-sc_prohibit_atoi_atof \
.x-sc_trailing_blank \
ChangeLog-2005 \
announce-gen \
bootstrap \
bootstrap.conf \
build-aux/cvsu \
build-aux/vc-list-files \
gl/modules/getloadavg.diff \
m4/ChangeLog \
ChangeLog-2005 \
old/fileutils/ChangeLog \
old/fileutils/ChangeLog-1997 \
old/fileutils/NEWS \
old/sh-utils/ChangeLog \
old/sh-utils/ChangeLog.0 \
old/textutils/ChangeLog \
old/fileutils/NEWS \
old/sh-utils/NEWS \
old/textutils/ChangeLog \
old/textutils/NEWS
install-root:
@@ -71,16 +74,17 @@ distcheck-hook:
rm_subst = \
s!(rm -f (rm|\$$\(bin_PROGRAMS\)))$$!$$1 > /dev/null 2>&1 || /bin/$$1!
MAINTAINERCLEANFILES = .kludge-stamp
.kludge-stamp: $(srcdir)/src/Makefile.in
perl -pi -e '$(rm_subst)' $(srcdir)/src/Makefile.in
touch $@
MAINTAINERCLEANFILES = THANKS-to-translators
MAINTAINERCLEANFILES += THANKS-to-translators
THANKS-to-translators: po/LINGUAS THANKStt.in
( \
cat $(srcdir)/THANKStt.in; \
for lang in `cat po/LINGUAS`; do \
for lang in `cat $(srcdir)/po/LINGUAS`; do \
echo http://www.iro.umontreal.ca/contrib/po/HTML/team-$$lang.html; \
done; \
) > $@-tmp && mv $@-tmp $@

View File

@@ -26,27 +26,6 @@ gnu_rel_host = $(gnu_ftp_host-$(RELEASE_TYPE))
url_dir_list = \
ftp://$(gnu_rel_host)/gnu/coreutils
# Files to update automatically.
wget_files = \
$(srcdir)/build-aux/config.guess \
$(srcdir)/build-aux/config.sub \
$(srcdir)/build-aux/texinfo.tex
# Of the above, texinfo.tex is out of date,
# and the other two are not available.
wget_files =
cvs_files = \
$(srcdir)/build-aux/elisp-comp \
$(srcdir)/build-aux/depcomp \
$(srcdir)/build-aux/mdate-sh \
$(srcdir)/build-aux/missing \
$(srcdir)/build-aux/install-sh \
$(srcdir)/build-aux/mkinstalldirs
# $(srcdir)/src/ansi2knr.c
local_updates = wget-update cvs-update
# The GnuPG ID of the key used to sign the tarballs.
gpg_key_ID = D333CBA1

View File

@@ -30,8 +30,9 @@ gzip_rsyncable := \
GZIP_ENV = '--no-name --best $(gzip_rsyncable)'
CVS = cvs
GIT = git
VC = $(GIT)
# cvsu is part of the cvsutils package: http://www.red-bean.com/cvsutils/
CVS_LIST = build-aux/vc-list-files
CVS_LIST_EXCEPT = \
@@ -46,7 +47,7 @@ VERSION_REGEXP = $(subst .,\.,$(VERSION))
tag-package = $(shell echo "$(PACKAGE)" | tr '[:lower:]' '[:upper:]')
tag-this-version = $(subst .,_,$(VERSION))
this-cvs-tag = $(tag-package)-$(tag-this-version)
this-vc-tag = $(tag-package)-$(tag-this-version)
my_distdir = $(PACKAGE)-$(VERSION)
# Old releases are stored here.
@@ -220,6 +221,40 @@ sc_root_tests:
&& { echo 'tests/Makefile.am: missing check-root action'>&2; \
exit 1; } || :
headers_with_interesting_macro_defs = \
exit.h \
fcntl_.h \
fnmatch_.h \
intprops.h \
inttypes_.h \
lchown.h \
openat.h \
stat-macros.h \
stdint_.h
# Create a list of regular expressions matching the names
# of macros that are guaranteed by parts of gnulib to be defined.
.re-defmac:
@(cd $(srcdir)/lib; \
for f in $(headers_with_interesting_macro_defs); do \
test -f $$f && \
sed -n '/^# *define \([^_ (][^ (]*\)[ (].*/s//\1/p' $$f; \
done; \
) | sort -u \
| grep -Ev 'ATTRIBUTE_NORETURN|SIZE_MAX' \
| sed 's/^/^# *define /' \
> $@-t
@mv $@-t $@
# Don't define macros that we already get from gnulib header files.
sc_always_defined_macros: .re-defmac
@if test -f $(srcdir)/src/system.h; then \
trap 'rc=$$?; rm -f .re-defmac; exit $$rc' 0 1 2 3 15; \
grep -f .re-defmac $$($(CVS_LIST)) \
&& { echo '$(ME): define the above via some gnulib .h file' \
1>&2; exit 1; } || :; \
fi
# Create a list of regular expressions matching the names
# of files included from system.h. Exclude a couple.
.re-list:
@@ -366,7 +401,8 @@ po-check:
esac; \
files="$$files $$file"; \
done; \
grep -E -l '\bN?_\([^)"]*("|$$)' $$files | sort -u > $@-2; \
grep -E -l '\b(N?_|gettext *)\([^)"]*("|$$)' $$files \
| sort -u > $@-2; \
diff -u $@-1 $@-2 || exit 1; \
rm -f $@-1 $@-2; \
fi
@@ -415,24 +451,32 @@ copyright-check:
fi
# Sanity checks with the CVS repository.
cvs-tag-check:
echo $(this-cvs-tag); \
if $(CVS) -n log -h README | grep -e $(this-cvs-tag): >/dev/null; then \
echo "$(this-cvs-tag) as already been used; not tagging" 1>&2; \
exit 1; \
else :; fi
cvs-diff-check:
if $(CVS) diff >cvs-diffs; then \
rm cvs-diffs; \
else \
echo "Some files are locally modified:" 1>&2; \
cat cvs-diffs; \
exit 1; \
# Sanity checks with the repository.
# Abort early if this tag has already been used.
vc-tag-check:
used=no; \
if $(VC) --help | grep CVS; then \
$(CVS) -n log -h README|grep -e $(this-vc-tag): >/dev/null \
&& used=yes; \
else \
$(GIT) tag -l '^$(this-vc-tag)$$' && used=yes; \
fi; \
if test "$$used" = yes; then \
echo "$(this-vc-tag) has already been used; not tagging" 1>&2; \
exit 1; \
fi
cvs-check: cvs-diff-check cvs-tag-check
vc-diff-check:
$(VC) diff > vc-diffs || :
if test -s vc-diffs; then \
cat vc-diffs; \
echo "Some files are locally modified:" 1>&2; \
exit 1; \
else \
rm vc-diffs; \
fi
cvs-check: vc-diff-check vc-tag-check
maintainer-distcheck:
$(MAKE) distcheck
@@ -442,9 +486,8 @@ maintainer-distcheck:
# Tag before making distribution. Also, don't make a distribution if
# checks fail. Also, make sure the NEWS file is up-to-date.
# FIXME: use dist-hook/my-dist like distcheck-hook/my-distcheck.
cvs-dist: $(local-check) cvs-check maintainer-distcheck
$(CVS) update po
$(CVS) tag -c $(this-cvs-tag)
vc-dist: $(local-check) cvs-check maintainer-distcheck
$(VC) tag $(this-vc-tag)
$(MAKE) dist
# Use this to make sure we don't run these programs when building
@@ -522,74 +565,6 @@ www-gnu = http://www.gnu.org
# Use mv, if you don't have/want move-if-change.
move_if_change ?= move-if-change
# --------------------- #
# Updating everything. #
# --------------------- #
.PHONY: update
local_updates ?= wget-update cvs-update
update: $(local_updates)
# -------------------------- #
# Updating GNU build tools. #
# -------------------------- #
# The following pseudo table associates a local directory and a URL
# with each of the files that belongs to some other package and is
# regularly updated from the specified URL.
wget_files ?= \
$(srcdir)/build-aux/config.guess \
$(srcdir)/build-aux/config.sub \
$(srcdir)/build-aux/texinfo.tex \
$(srcdir)/src/ansi2knr.c
get-targets = $(patsubst %, get-%, $(wget_files))
config.guess-url_prefix = $(ftp-gnu)/build-aux/
config.sub-url_prefix = $(ftp-gnu)/build-aux/
ansi2knr.c-url_prefix = ftp://ftp.cs.wisc.edu/ghost/
texinfo.tex-url_prefix = $(ftp-gnu)/texinfo/
standards.texi-url_prefix = $(www-gnu)/prep/
make-stds.texi-url_prefix = $(standards.texi-url_prefix)
target = $(patsubst get-%, %, $@)
url = $($(notdir $(target))-url_prefix)$(notdir $(target))
.PHONY: $(get-targets)
$(get-targets):
$(WGET) $(WGETFLAGS) $(url) -O $(target).t \
&& $(move_if_change) $(target).t $(target)
cvs_files ?= \
$(srcdir)/build-aux/depcomp \
$(srcdir)/build-aux/install-sh \
$(srcdir)/build-aux/missing \
$(srcdir)/build-aux/mkinstalldirs \
$(srcdir)/src/ansi2knr.c
automake_repo=:pserver:anoncvs:anoncvs@sources.redhat.com:/cvs/automake
.PHONY: wget-update
wget-update: $(get-targets)
.PHONY: cvs-update
cvs-update:
fail=; \
for f in $(cvs_files); do \
test -f $$f || { echo "*** skipping $$f" 1>&2; continue; }; \
cvs diff $$f > /dev/null \
|| { echo "*** $$f is locally modified; skipping it" 1>&2; \
fail=yes; continue; }; \
file=$$(basename $$f); \
echo checking out $$file...; \
$(CVS) -d $(automake_repo) co -p automake/lib/$$file> $$f.t \
&& $(move_if_change) $$f.t $$f; \
done; \
test "$$fail" && exit 1
emit_upload_commands:
@echo =====================================
@echo =====================================
@@ -609,11 +584,11 @@ alpha beta major: news-date-check changelog-check $(local-check)
&& { echo $(VERSION) | grep -E '^[0-9]+(\.[0-9]+)+$$' \
|| { echo "invalid version string: $(VERSION)" 1>&2; exit 1;};}\
|| :
$(MAKE) cvs-dist
$(MAKE) vc-dist
$(MAKE) $(xd-delta)
$(MAKE) -s announcement RELEASE_TYPE=$@ > /tmp/announce-$(my_distdir)
ln $(rel-files) $(release_archive_dir)
chmod a-w $(rel-files)
$(MAKE) -s emit_upload_commands RELEASE_TYPE=$@
echo $(VERSION) > $(prev_version_file)
$(CVS) ci -m. $(prev_version_file)
$(VC) commit -m. $(prev_version_file)

65
NEWS
View File

@@ -1,5 +1,68 @@
GNU coreutils NEWS -*- outline -*-
* Major changes in release 6.4 (2006-10-22) [stable]
** Bug fixes
chgrp and chown would malfunction when invoked with both -R and -H and
with one or more of the following: --preserve-root, --verbose, --changes,
--from=o:g (chown only). This bug was introduced with the switch to
gnulib's openat-based variant of fts, for coreutils-6.0.
cp --backup dir1 dir2, would rename an existing dir2/dir1 to dir2/dir1~.
This bug was introduced in coreutils-6.0.
With --force (-f), rm no longer fails for ENOTDIR.
For example, "rm -f existing-non-directory/anything" now exits
successfully, ignoring the error about a nonexistent file.
* Major changes in release 6.3 (2006-09-30) [stable]
** Improved robustness
pinky no longer segfaults on Darwin 7.9.0 (MacOS X 10.3.9) due to a
buggy native getaddrinfo function.
rm works around a bug in Darwin 7.9.0 (MacOS X 10.3.9) that would
sometimes keep it from removing all entries in a directory on an HFS+
or NFS-mounted partition.
sort would fail to handle very large input (around 40GB) on systems with a
mkstemp function that returns a file descriptor limited to 32-bit offsets.
** Bug fixes
chmod would fail unnecessarily in an unusual case: when an initially-
inaccessible argument is rendered accessible by chmod's action on a
preceding command line argument. This bug also affects chgrp, but
it is harder to demonstrate. It does not affect chown. The bug was
introduced with the switch from explicit recursion to the use of fts
in coreutils-5.1.0 (2003-10-15).
cp -i and mv -i occasionally neglected to prompt when the copy or move
action was bound to fail. This bug dates back to before fileutils-4.0.
With --verbose (-v), cp and mv would sometimes generate no output,
or neglect to report file removal.
For the "groups" command:
"groups" no longer prefixes the output with "user :" unless more
than one user is specified; this is for compatibility with BSD.
"groups user" now exits nonzero when it gets a write error.
"groups" now processes options like --help more compatibly.
shuf would infloop, given 8KB or more of piped input
** Portability
Versions of chmod, chown, chgrp, du, and rm (tools that use openat etc.)
compiled for Solaris 8 now also work when run on Solaris 10.
* Major changes in release 6.2 (2006-09-18) [stable candidate]
** Changes in behavior
@@ -583,7 +646,7 @@ GNU coreutils NEWS -*- outline -*-
cp and mv: the --reply=X option is deprecated
date accepts the new option --rfc-3339=TIMESPEC. The old --iso-8602 (-I)
date accepts the new option --rfc-3339=TIMESPEC. The old --iso-8601 (-I)
option is deprecated; it still works, but new applications should avoid it.
date, du, ls, and pr's time formats now support new %:z, %::z, %:::z
specifiers for numeric time zone offsets like -07:00, -07:00:00, and -07.

6
README
View File

@@ -167,6 +167,12 @@ as you can. Based on the feedback that generates, you may be able to
convince us that it's worth adding.
WARNING: Now that we use the ./bootstrap script, you should not run
autoreconf manually. Doing that will overwrite essential source files
with older versions, which may make the package unbuildable or introduce
subtle bugs.
WARNING: If you modify files like configure.in, m4/*.m4, aclocal.m4,
or any Makefile.am, then don't be surprised if what gets regenerated no
longer works. To make things work, you'll have to be using appropriate

View File

@@ -11,6 +11,7 @@ stable versions of the maintainer tools we depend upon, including:
- Automake <http://www.gnu.org/software/automake/>
- Autoconf <http://www.gnu.org/software/autoconf/>
- Bison <http://www.gnu.org/software/bison/>
- Gettext <http://www.gnu.org/software/gettext/>
- Gzip <http://www.gnu.org/software/gzip/>
- Tar <http://www.gnu.org/software/tar/>

6
THANKS
View File

@@ -198,6 +198,7 @@ Holger Berger hberger@ess.nec.de
Hon-Yin Kok hkok@yoda.unl.edu
Hugh Daniel hugh@xanadu.com
Ian Bruce ian.bruce@myrealbox.com
Iain Calder ic56@rogers.com
Ian Jackson ijackson@chiark.greenend.org.uk
Ian Lance Taylor ian@cygnus.com
Ian Turner vectro@pipeline.com
@@ -211,6 +212,7 @@ James Sneeringer jvs@ocslink.com
James Tanis jtt@soscorp.com
James Youngman james+usenet@free-lunch.demon.co.uk
Jamie Lokier jamie@imbolc.ucc.ie
Jamie McClelland jm@mayfirst.org
Jan Fedak J.Fedak@sh.cvut.cz
Jan Nieuwenhuizen janneke@gnu.org
Janos Farkas chexum@shadow.banki.hu
@@ -287,6 +289,7 @@ Manas Garg manas@cygsoft.com
Manfred Hollstein manfred@s-direktnet.de
Marc Boucher marc@mbsi.ca
Marc Haber mh+debian-bugs@zugschlus.de
Marc Lehman schmorp@schmorp.de
Marc Olzheim marcolz@stack.nl
Marco Franzen Marco.Franzen@Thyron.com
Marcus Brinkmann http://www.marcus-brinkmann.de
@@ -388,6 +391,7 @@ Paul Worrall paul@basilisk.uklinux.net
Pawel Prokop pablo@wizard.ae.krakow.pl
Per Cederqvist ceder@lysator.liu.se
Per Kristian Hove perhov@math.ntnu.no
Peter Breitenlohner peb@mppmu.mpg.de
Peter Eriksson peter@ifm.liu.se
Peter Fales psfales@lucent.com
Peter Horst peter@ointment.org
@@ -432,6 +436,7 @@ Ross Paterson rap@doc.ic.ac.uk
Ross Ridge rridge@calum.csclub.uwaterloo.ca
Sami Farin sfarin@ratol.fi
Samuel Tardieu sam@rfc1149.net
Samuel Thibault samuel.thibault@ens-lyon.org
Samuli Karkkainen Samuli.Karkkainen@hut.fi
Sander van Malssen svm@kozmix.ow.nl
Santiago Vila Doncel sanvila@unex.es
@@ -449,6 +454,7 @@ Stephen Eglen eglen@pcg.wustl.edu
Stephen Gildea gildea@stop.mail-abuse.org
Stephen Smoogen smooge@mindspring.com
Steve McConnel steve@acadcomp.sil.org
Steve McIntyre steve@einval.com
Steven G. Johnson stevenj@alum.mit.edu
Steven Mocking ufo@quicknet.nl
Steven P Watson steven@magelico.net

206
bootstrap
View File

@@ -29,13 +29,37 @@ nl='
LC_ALL=C
export LC_ALL
usage() {
echo >&2 "\
Usage: $0 [OPTION]...
Bootstrap this package from the checked-out sources.
Options:
--gnulib-srcdir=DIRNAME Specify the local directory where gnulib
sources reside. Use this if you already
have gnulib sources on your machine, and
do not want to waste your bandwidth dowloading
them again.
--copy Copy files instead of creating symbolic links.
--force Attempt to bootstrap even if the sources seem
not to have been checked out.
--skip-po Do not download po files.
--cvs-user=USERNAME Set the CVS username to be used when accessing
the gnulib repository.
If the file .bootstrap.conf exists in the current working directory, its
contents are read as shell variables to configure the bootstrap.
Running without arguments will suffice in most cases.
"
}
# Configuration.
# List of gnulib modules needed.
gnulib_modules=
# Any extra gnulib files needed.
# Any gnulib files needed that are not in modules.
gnulib_files=
# Translation Project URL, for the registry of all projects
@@ -61,7 +85,7 @@ extract_package_name='
'
package=`sed -n "$extract_package_name" configure.ac` || exit
# Extra files from gnulib, which are not part of any module yet.
# Extra files from gnulib, which override files from other sources.
gnulib_extra_files='
build-aux/install-sh
build-aux/missing
@@ -86,6 +110,13 @@ XGETTEXT_OPTIONS='\\\
# Files we don't want to import.
excluded_files=
# File that should exist in the top directory of a checked out hierarchy,
# but not in a distribution tarball.
CVS_only_file=README-cvs
# Whether to use copies instead of symlinks.
copy=false
# Override the default configuration, if necessary.
test -r bootstrap.conf && . ./bootstrap.conf
@@ -97,7 +128,7 @@ for option
do
case $option in
--help)
echo "$0: usage: $0 [--gnulib-srcdir=DIR] [--cvs-user=USERNAME] [--skip-po]"
usage
exit;;
--gnulib-srcdir=*)
GNULIB_SRCDIR=`expr "$option" : '--gnulib-srcdir=\(.*\)'`;;
@@ -105,12 +136,21 @@ do
CVS_USER=`expr "$option" : '--cvs-user=\(.*\)'`;;
--skip-po)
SKIP_PO=t;;
--force)
CVS_only_file=;;
--copy)
copy=true;;
*)
echo >&2 "$0: $option: unknown option"
exit 1;;
esac
done
if test -n "$CVS_only_file" && test ! -r "$CVS_only_file"; then
echo "$0: Bootstrapping from a non-checked-out distribution is risky." >&2
exit 1
fi
echo "$0: Bootstrapping CVS $package..."
cleanup_gnulib() {
@@ -212,27 +252,102 @@ case $SKIP_PO in
fi;;
esac
symlink_to_gnulib()
{
src=$GNULIB_SRCDIR/$1
dst=${2-$1}
test -f "$src" && {
if $copy; then
{
test ! -h "$dst" || {
echo "$0: rm -f $dst" &&
rm -f "$dst"
}
} &&
test -f "$dst" &&
cmp -s "$src" "$dst" || {
echo "$0: cp -fp $src $dst" &&
cp -fp "$src" "$dst"
}
else
test -h "$dst" &&
src_ls=`ls -diL "$src" 2>/dev/null` && set $src_ls && src_i=$1 &&
dst_ls=`ls -diL "$dst" 2>/dev/null` && set $dst_ls && dst_i=$1 &&
test "$src_i" = "$dst_i" || {
dot_dots=
case $src in
/*) ;;
*)
case /$dst/ in
*//* | */../* | */./* | /*/*/*/*/*/)
echo >&2 "$0: invalid symlink calculation: $src -> $dst"
exit 1;;
/*/*/*/*/) dot_dots=../../../;;
/*/*/*/) dot_dots=../../;;
/*/*/) dot_dots=../;;
esac;;
esac
echo "$0: ln -fs $dot_dots$src $dst" &&
ln -fs "$dot_dots$src" "$dst"
}
fi
}
}
cp_mark_as_generated()
{
cp_src=$1
cp_dst=$2
case $cp_dst in
*.[ch]) c1='/* '; c2=' */';;
*.texi) c1='@c '; c2= ;;
*.m4|*/Make*|Make*) c1='# ' ; c2= ;;
*) c1= ; c2= ;;
esac
if test -z "$c1"; then
cp "$cp_src" "$cp_dst"
return
if cmp -s "$cp_src" "$GNULIB_SRCDIR/$cp_dst"; then
symlink_to_gnulib "$cp_dst"
else
case $cp_dst in
*.[ch]) c1='/* '; c2=' */';;
*.texi) c1='@c '; c2= ;;
*.m4|*/Make*|Make*) c1='# ' ; c2= ;;
*) c1= ; c2= ;;
esac
if test -z "$c1"; then
cmp -s "$cp_src" "$cp_dst" || {
echo "$0: cp -f $cp_src $cp_dst" &&
cp -f "$cp_src" "$cp_dst"
}
else
# Copy the file first to get proper permissions if it
# doesn't already exist. Then overwrite the copy.
cp "$cp_src" "$cp_dst-t" &&
(
echo "$c1-*- buffer-read-only: t -*- vi: set ro:$c2" &&
echo "${c1}DO NOT EDIT! GENERATED AUTOMATICALLY!$c2" &&
cat "$cp_src"
) > $cp_dst-t &&
if cmp -s "$cp_dst-t" "$cp_dst"; then
rm -f "$cp_dst-t"
else
echo "$0: cp $cp_src $cp_dst # with edits" &&
mv -f "$cp_dst-t" "$cp_dst"
fi
fi
fi
}
(
echo "$c1-*- buffer-read-only: t -*- vi: set ro:$c2"
echo "${c1}DO NOT EDIT! GENERATED AUTOMATICALLY!$c2"
cat "$cp_src"
) >> "$cp_dst"
version_controlled_file() {
dir=$1
file=$2
found=no
if test -d CVS; then
grep -F "/$file/" $dir/CVS/Entries 2>/dev/null |
grep '^/[^/]*/[0-9]' > /dev/null && found=yes
elif test -d .git; then
git-rm -n "$dir/$file" > /dev/null 2>&1 && found=yes
else
echo "$0: no version control for $dir/$file?" >&2
fi
test $found = yes
}
slurp() {
@@ -245,13 +360,15 @@ slurp() {
test "$dir/$file" = "$excluded_file" && continue 2
done
if test $file = Makefile.am; then
copied=$copied${sep}gnulib.mk; sep=$nl
echo "$0: Copying $1/$dir/$file to $dir/gnulib.mk ..." &&
rm -f $dir/gnulib.mk
sed '/^[^#].*\/intl/s/^/#/' $1/$dir/$file >$dir/gnulib.mk
elif test -r ${2-no/such/dir}/$dir/$file ||
grep -F "/$file/" $dir/CVS/Entries 2>/dev/null |
grep -q '^/[^/]*/[0-9]'; then
copied=$copied${sep}gnulib.mk; sep=$nl
remove_intl='/^[^#].*\/intl/s/^/#/'
sed "$remove_intl" $1/$dir/$file | cmp -s - $dir/gnulib.mk || {
echo "$0: Copying $1/$dir/$file to $dir/gnulib.mk ..." &&
rm -f $dir/gnulib.mk &&
sed "$remove_intl" $1/$dir/$file >$dir/gnulib.mk
}
elif { test "${2+set}" = set && test -r $2/$dir/$file; } ||
version_controlled_file $dir $file; then
echo "$0: $dir/$file overrides $1/$dir/$file"
else
copied=$copied$sep$file; sep=$nl
@@ -267,17 +384,18 @@ slurp() {
AC_DEFUN([gl_LOCK_EARLY], [])
' $1/$dir/$file >$dir/$file
else
rm -f $dir/$file
cp_mark_as_generated $1/$dir/$file $dir/$file
fi
fi || exit
done
ig=$dir/.cvsignore
if test -n "$copied" && test -f $ig; then
echo "$copied" | sort -u - $ig | cmp -s - $ig ||
echo "$copied" | sort -u - $ig -o $ig || exit
fi
for dot_ig in .cvsignore .gitignore; do
ig=$dir/$dot_ig
if test -n "$copied" && test -f $ig; then
echo "$copied" | sort -u - $ig | cmp -s - $ig ||
echo "$copied" | sort -u - $ig -o $ig || exit
fi
done
done
}
@@ -300,11 +418,16 @@ gnulib_tool_options="\
--m4-base $bt/m4/\
--source-base $bt/lib/\
--tests-base $bt/tests\
--local-dir gl\
"
echo "$0: $gnulib_tool $gnulib_tool_options --import ..."
$gnulib_tool $gnulib_tool_options --import $gnulib_modules &&
slurp $bt || exit
for file in $gnulib_files; do
symlink_to_gnulib $file || exit
done
# Import from gettext.
@@ -332,13 +455,11 @@ done
# Get some extra files from gnulib, overriding existing files.
for file in $gnulib_extra_files; do
src=$GNULIB_SRCDIR/$file
case $file in
*/INSTALL) dest=.;;
*) dest=$file;;
*/INSTALL) dst=INSTALL;;
*) dst=$file;;
esac
echo "$0: cp -fp $src $dest" &&
cp -fp $src $dest || exit
symlink_to_gnulib $file $dst || exit
done
@@ -356,13 +477,18 @@ sed '
' po/Makevars.template >po/Makevars
if test -d runtime-po; then
# Likewise for runtime-po/Makevars, except also change a few other parameters.
# Similarly for runtime-po/Makevars, but not quite the same.
rm -f runtime-po/Makevars
sed '
s/^\(DOMAIN\) *=.*/\1 = '"$package"'-runtime/
s/^\(subdir\) *=.*/\1 = runtime-po/
s/^\(XGETTEXT_OPTIONS\) *=.*/\1 = '"$XGETTEXT_OPTIONS_RUNTIME"'/
' <po/Makevars >runtime-po/Makevars
/^DOMAIN *=.*/s/=.*/= '"$package"'-runtime/
/^subdir *=.*/s/=.*/= runtime-po/
/^MSGID_BUGS_ADDRESS *=/s/=.*/= bug-'"$package"'@gnu.org/
/^XGETTEXT_OPTIONS *=/{
s/$/ \\/
a\
'"$XGETTEXT_OPTIONS_RUNTIME"' $${end_of_xgettext_options+}
}
' <po/Makevars.template >runtime-po/Makevars
# Copy identical files from po to runtime-po.
(cd po && cp -p Makefile.in.in *-quot *.header *.sed *.sin ../runtime-po)

11
build-aux/.gitignore vendored Normal file
View File

@@ -0,0 +1,11 @@
compile
config.guess
config.rpath
config.sub
depcomp
gnupload
install-sh
mdate-sh
missing
texinfo.tex
ylwrap

View File

@@ -1,3 +1,8 @@
2006-10-14 Jim Meyering <jim@meyering.net>
* vc-list-files: Don't filter git-ls-files output through cut.
Add a comment about cvsu.
2006-08-22 Paul Eggert <eggert@cs.ucla.edu>
* .cvsignore: New file.

View File

@@ -26,6 +26,7 @@
# with no trailing slashes. In mercurial mode, it's used as part of a
# "grep" pattern (prepend "^", append "/"), and in cvs mode, it's simply
# used as an argument to the cvsu script.
# cvsu is part of the cvsutils package: http://www.red-bean.com/cvsutils/
include_prefix=
case $# in
@@ -36,9 +37,9 @@ esac
if test -d .git; then
if test "x$include_prefix" = x; then
git-ls-files | cut -d ' ' -f 3
git-ls-files
else
git-ls-files | cut -d ' ' -f 3 | grep "^$include_prefix/"
git-ls-files | grep "^$include_prefix/"
fi
elif test -d .hg; then
if test "x$include_prefix" = x; then

View File

@@ -20,7 +20,7 @@
dnl Written by Jim Meyering.
AC_PREREQ(2.60)
AC_INIT([GNU coreutils],[6.2],[bug-coreutils@gnu.org])
AC_INIT([GNU coreutils],[6.4],[bug-coreutils@gnu.org])
AC_CONFIG_SRCDIR(src/ls.c)
AC_CONFIG_AUX_DIR(build-aux)
@@ -36,7 +36,8 @@ AC_PROG_GCC_TRADITIONAL
AC_PROG_RANLIB
AC_PROG_LN_S
gl_EARLY
gl_MACROS
gl_INIT
coreutils_MACROS
AC_CHECK_FUNCS(uname,
OPTIONAL_BIN_PROGS="$OPTIONAL_BIN_PROGS uname\$(EXEEXT)"
@@ -58,14 +59,14 @@ AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <time.h>
# include <stdlib.h>
#endif
extern char **environ;
unset_TZ ()
void unset_TZ (void)
{
char **from, **to;
for (to = from = environ; (*to = *from); from++)
if (! (to[0][0] == 'T' && to[0][1] == 'Z' && to[0][2] == '='))
to++;
}
main()
int main()
{
time_t now = time ((time_t *) 0);
int hour_GMT0, hour_unset;
@@ -146,7 +147,7 @@ coreutils_DUMMY_1
AC_MSG_CHECKING(ut_host in struct utmp)
AC_CACHE_VAL(su_cv_func_ut_host_in_utmp,
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
#include <utmp.h>]], [[struct utmp ut; ut.ut_host;]])],
#include <utmp.h>]], [[struct utmp ut; return !sizeof ut.ut_host;]])],
[su_cv_func_ut_host_in_utmp=yes],
[su_cv_func_ut_host_in_utmp=no])])
AC_MSG_RESULT($su_cv_func_ut_host_in_utmp)
@@ -159,7 +160,7 @@ if test -z "$have_ut_host"; then
AC_MSG_CHECKING(ut_host in struct utmpx)
AC_CACHE_VAL(su_cv_func_ut_host_in_utmpx,
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
#include <utmpx.h>]], [[struct utmpx ut; ut.ut_host;]])],
#include <utmpx.h>]], [[struct utmpx ut; return !sizeof ut.ut_host;]])],
[su_cv_func_ut_host_in_utmpx=yes],
[su_cv_func_ut_host_in_utmpx=no])])
AC_MSG_RESULT($su_cv_func_ut_host_in_utmpx)
@@ -201,7 +202,7 @@ yes
#define _XOPEN_SOURCE
#endif
#include <sys/types.h>
#include <termios.h>]], [[struct termios t; t.c_line;]])],
#include <termios.h>]], [[struct termios t; return !sizeof t.c_line;]])],
[su_cv_sys_c_line_in_termios=yes],
[su_cv_sys_c_line_in_termios=no])])
AC_MSG_RESULT($su_cv_sys_c_line_in_termios)

5
doc/.gitignore vendored Normal file
View File

@@ -0,0 +1,5 @@
coreutils.info
fdl.texi
getdate.texi
stamp-vti
version.texi

View File

@@ -1,3 +1,14 @@
2006-09-26 Paul Eggert <eggert@cs.ucla.edu>
* coreutils.texi (groups invocation): "groups" no longer prefixes
the output with "user :" unless more than one user is specified.
2006-09-19 Paul Eggert <eggert@cs.ucla.edu>
* coreutils.texi (cp invocation): Say that -i and -f are
independent. Clarify -i's behavior.
(Disk usage): Clarify intro. Problem reported by Van Ly.
2006-09-08 Paul Eggert <eggert@cs.ucla.edu>
* coreutils.texi (tail invocation): Ignore -f when standard input

View File

@@ -6890,6 +6890,9 @@ tries to open it again. Contrast this behavior with that enabled by
is never opened but rather is unlinked unconditionally. Also see the
description of @option{--remove-destination}.
This option is independent of the @option{--interactive} or
@option{-i} option: neither cancels the effect of the other.
@item -H
@opindex -H
If a command line argument specifies a symbolic link, then copy the
@@ -6901,7 +6904,8 @@ via recursive traversal.
@itemx --interactive
@opindex -i
@opindex --interactive
Prompt whether to overwrite existing regular destination files.
When copying a file other than a directory, prompt whether to
overwrite an existing destination file.
@item -l
@itemx --link
@@ -9225,11 +9229,9 @@ For example, use @samp{touch ./12312359 main.c} or @samp{touch -t
@cindex disk usage
No disk can hold an infinite amount of data. These commands report on
how much disk storage is in use or available. (This has nothing much to
do with how much @emph{main memory}, i.e., RAM, a program is using when
it runs; for that, you want @command{ps} or @command{pstat} or @command{swap}
or some such command.)
No disk can hold an infinite amount of data. These commands report
how much disk storage is in use or available, report other file and
file status information, and write buffers to disk.
@menu
* df invocation:: Report file system disk space usage.
@@ -11971,7 +11973,8 @@ options}.
@command{groups} prints the names of the primary and any supplementary
groups for each given @var{username}, or the current process if no names
are given. If names are given, the name of each user is printed before
are given. If more than one name is given, the name of each user is
printed before
the list of that user's groups. Synopsis:
@example

View File

@@ -0,0 +1,16 @@
Index: modules/getloadavg
===================================================================
RCS file: /sources/gnulib/gnulib/modules/getloadavg,v
retrieving revision 1.13
diff -u -p -r1.13 getloadavg
--- modules/getloadavg 22 Sep 2006 12:47:55 -0000 1.13
+++ modules/getloadavg 23 Sep 2006 16:41:36 -0000
@@ -14,7 +14,7 @@ stdbool
fcntl-safer
configure.ac:
-gl_GETLOADAVG([$gl_source_base])
+gl_GETLOADAVG([lib])
Makefile.am:

View File

@@ -67,6 +67,7 @@ exclude.h
exit.h
exitfail.c
exitfail.h
fchmodat.c
fchown-stub.c
fcntl--.h
fcntl-safer.h
@@ -195,6 +196,7 @@ mkdir.c
mkdirat.c
mkstemp-safer.c
mkstemp.c
mkstemp.h
mktime.c
modechange.c
modechange.h
@@ -207,6 +209,7 @@ offtostr.c
open-safer.c
openat-die.c
openat-priv.h
openat-proc.c
openat.c
openat.h
pathmax.h

360
lib/.gitignore vendored Normal file
View File

@@ -0,0 +1,360 @@
__fpending.c
__fpending.h
acl.c
acl.h
alloca.c
alloca.h
alloca_.h
allocsa.c
allocsa.h
allocsa.valgrind
argmatch.c
argmatch.h
asnprintf.c
asprintf.c
at-func.c
atexit.c
backupfile.c
backupfile.h
base64.c
base64.h
basename.c
c-strtod.c
c-strtod.h
c-strtold.c
calloc.c
canon-host.c
canon-host.h
canonicalize.c
canonicalize.h
charset.alias
chdir-long.c
chdir-long.h
chown.c
cloexec.c
cloexec.h
close-stream.c
close-stream.h
closeout.c
closeout.h
config.charset
configmake.h
creat-safer.c
cycle-check.c
cycle-check.h
dev-ino.h
diacrit.c
diacrit.h
dirchownmod.c
dirchownmod.h
dirfd.c
dirfd.h
dirname.c
dirname.h
dup-safer.c
dup2.c
error.c
error.h
euidaccess.c
euidaccess.h
exclude.c
exclude.h
exit.h
exitfail.c
exitfail.h
fchmodat.c
fchown-stub.c
fcntl--.h
fcntl-safer.h
fcntl.h
fcntl_.h
fd-safer.c
file-type.c
file-type.h
fileblocks.c
filemode.c
filemode.h
filenamecat.c
filenamecat.h
fnmatch.c
fnmatch_.h
fnmatch_loop.c
fopen-safer.c
fprintftime.c
fprintftime.h
free.c
fsusage.c
fsusage.h
ftruncate.c
fts-cycle.c
fts.c
fts_.h
full-read.c
full-read.h
full-write.c
full-write.h
gai_strerror.c
getaddrinfo.c
getaddrinfo.h
getcwd.c
getcwd.h
getdate.c
getdate.h
getdate.y
getdelim.c
getdelim.h
getgroups.c
gethostname.c
gethrxtime.c
gethrxtime.h
getline.c
getline.h
getloadavg.c
getndelim2.c
getndelim2.h
getopt.c
getopt1.c
getopt_.h
getopt_int.h
getpagesize.h
getpass.c
getpass.h
gettext.h
gettime.c
gettimeofday.c
getugroups.c
getusershell.c
gnulib.mk
group-member.c
group-member.h
hard-locale.c
hard-locale.h
hash-pjw.c
hash-pjw.h
hash.c
hash.h
human.c
human.h
idcache.c
imaxtostr.c
inet_ntop.c
inet_ntop.h
intprops.h
inttostr.c
inttostr.h
inttypes.h
inttypes_.h
isapipe.c
isapipe.h
lchmod.h
lchown.c
lchown.h
libcoreutils.a
linebuffer.c
linebuffer.h
localcharset.c
localcharset.h
long-options.c
long-options.h
lstat.c
lstat.h
malloc.c
mbchar.c
mbchar.h
mbswidth.c
mbswidth.h
mbuiter.h
md5.c
md5.h
memcasecmp.c
memcasecmp.h
memchr.c
memcmp.c
memcoll.c
memcoll.h
memcpy.c
memmove.c
mempcpy.c
mempcpy.h
memrchr.c
memrchr.h
memset.c
mkancesdirs.c
mkancesdirs.h
mkdir-p.c
mkdir-p.h
mkdir.c
mkdirat.c
mkstemp-safer.c
mkstemp.c
mkstemp.h
mktime.c
modechange.c
modechange.h
mountlist.c
mountlist.h
nanosleep.c
obstack.c
obstack.h
offtostr.c
open-safer.c
openat-die.c
openat-priv.h
openat-proc.c
openat.c
openat.h
pathmax.h
physmem.c
physmem.h
pipe-safer.c
posixtm.c
posixtm.h
posixver.c
posixver.h
printf-args.c
printf-args.h
printf-parse.h
putenv.c
quote.c
quote.h
quotearg.c
quotearg.h
raise.c
readlink.c
readtokens.c
readtokens.h
readtokens0.c
readtokens0.h
readutmp.c
readutmp.h
realloc.c
ref-add.sed
ref-add.sin
ref-del.sed
ref-del.sin
regcomp.c
regex.c
regex.h
regex_internal.c
regex_internal.h
regexec.c
rename-dest-slash.c
rename.c
rmdir.c
rpmatch.c
safe-read.c
safe-read.h
safe-write.c
safe-write.h
same-inode.h
same.c
same.h
save-cwd.c
save-cwd.h
savedir.c
savedir.h
savewd.c
savewd.h
setenv.c
setenv.h
settime.c
sha1.c
sha1.h
sig2str.c
sig2str.h
snprintf.c
snprintf.h
socket_.h
stat-macros.h
stat-time.h
stat_.h
stdbool_.h
stdint.h
stdint_.h
stdio--.h
stdio-safer.h
stdlib--.h
stdlib-safer.h
stpcpy.c
stpcpy.h
strcase.h
strcasecmp.c
strcspn.c
strdup.c
strdup.h
strftime.c
strftime.h
stripslash.c
strncasecmp.c
strndup.c
strndup.h
strnlen.c
strnlen.h
strnlen1.c
strnlen1.h
strpbrk.c
strpbrk.h
strtod.c
strtoimax.c
strtol.c
strtoll.c
strtoul.c
strtoull.c
strtoumax.c
strverscmp.c
strverscmp.h
t-fpending
tempname.c
time_r.c
time_r.h
timespec.h
uinttostr.c
umaxtostr.c
unicodeio.h
unistd--.h
unistd-safer.h
unlinkdir.c
unlinkdir.h
unlocked-io.h
unsetenv.c
userspec.c
userspec.h
utime.c
utimecmp.c
utimecmp.h
utimens.c
utimens.h
vasnprintf.h
vasprintf.c
vasprintf.h
verify.h
version-etc-fsf.c
version-etc.c
version-etc.h
wcwidth.h
xalloc-die.c
xalloc.h
xgetcwd.c
xgetcwd.h
xgethostname.c
xgethostname.h
xmalloc.c
xmemcoll.c
xmemcoll.h
xnanosleep.c
xnanosleep.h
xreadlink.c
xreadlink.h
xstrndup.c
xstrndup.h
xstrtod.c
xstrtod.h
xstrtoimax.c
xstrtol.c
xstrtol.h
xstrtold.c
xstrtoul.c
xstrtoumax.c
xtime.h
yesno.c
yesno.h

View File

@@ -1,3 +1,45 @@
2006-10-14 Paul Eggert <eggert@cs.ucla.edu>
Port sha512sum to hosts where uintmax_t is only 32 bits, e.g.,
HP/Tandom NonStop OSS circa 2005 has 32-bit uintmax_t, 64-bit intmax_t.
* u64.h: New file.
* sha512.c (SWAP, sha512_init_ctx, sha384_init_ctx, sha512_read_ctx):
(sha384_read_ctx, sha512_conclude_ctx, sha512_process_bytes):
(sha512_round_constants, F2, F1, sha512_process_block):
(S0, S1, SS0, SS1, M, R):
Rewrite to use u64.h instead of assuming uint64_t.
* sha512.h: Include u64.h rather than stdint.h.
(rol64): Remove; moved to u64.h and renamed to u64rol.
2006-10-12 Jim Meyering <jim@meyering.net>
* Makefile.am (libcoreutils_a_LIBADD): Append $(LIBOBJS),
to accommodate the latest version of gnulib-tool.
(libcoreutils_a_DEPENDENCIES): Likewise.
From Bruno Haible.
2006-10-06 Jim Meyering <jim@meyering.net>
Avoid a compiler warning: const'ify and remove a cast.
* randread.c (struct randread_source) [handler]: Make parameter "const".
[handler_arg]: Add "const" attribute.
(randread_error): Make parameter "const".
(simple_new, randread_set_handler, randread_set_handler_arg): Likewise.
(randread_new): Remove now-unnecessary cast.
* randread.h: Adjust prototypes.
2006-09-29 Paul Eggert <eggert@cs.ucla.edu>
* .cvsignore: Add openat-proc.c.
2006-09-25 Paul Eggert <eggert@cs.ucla.edu>
* .cvsignore: Add fchmodat.c.
2006-09-25 Jim Meyering <jim@meyering.net>
* fchmodat.c: Remove file. gnulib's copy is identical.
2006-09-01 Paul Eggert <eggert@cs.ucla.edu>
* .cvsignore: Add fcntl.h, fcntl_.h, inttypes_.h, isapipe.c,

View File

@@ -29,6 +29,9 @@ libcoreutils_a_SOURCES += \
xmemcoll.c xmemcoll.h \
xmemxfrm.c xmemxfrm.h
libcoreutils_a_LIBADD += $(LIBOBJS)
libcoreutils_a_DEPENDENCIES += $(LIBOBJS)
check: unit-test
.PHONY: unit-test

View File

@@ -1,50 +0,0 @@
/* Change the protections of file relative to an open directory.
Copyright (C) 2006 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
/* written by Jim Meyering */
#include <config.h>
#include "openat.h"
#include "dirname.h" /* solely for definition of IS_ABSOLUTE_FILE_NAME */
#include "save-cwd.h"
#include "openat-priv.h"
#ifndef HAVE_LCHMOD
/* Use a different name, to avoid conflicting with any
system-supplied declaration. */
# undef lchmod
# define lchmod lchmod_rpl
static int lchmod (char const *f, mode_t m) { errno = ENOSYS; return -1; }
#endif
/* Solaris 10 has no function like this.
Invoke chmod or lchmod on file, FILE, using mode MODE, in the directory
open on descriptor FD. If possible, do it without changing the
working directory. Otherwise, resort to using save_cwd/fchdir,
then mkdir/restore_cwd. If either the save_cwd or the restore_cwd
fails, then give a diagnostic and exit nonzero.
Note that an attempt to use a FLAG value of AT_SYMLINK_NOFOLLOW
on a system without lchmod support causes this function to fail. */
#define AT_FUNC_NAME fchmodat
#define AT_FUNC_F1 lchmod
#define AT_FUNC_F2 chmod
#define AT_FUNC_USE_F1_COND flag == AT_SYMLINK_NOFOLLOW
#define AT_FUNC_POST_FILE_PARAM_DECLS , mode_t mode, int flag
#define AT_FUNC_POST_FILE_ARGS , mode
#include "at-func.c"

View File

@@ -82,8 +82,8 @@ struct randread_source
there was an error. If this function returns, it should fix the
problem before returning. The default handler assumes that
handler_arg is the file name of the source. */
void (*handler) (void *);
void *handler_arg;
void (*handler) (void const *);
void const *handler_arg;
/* The buffer for SOURCE. It's kept here to simplify storage
allocation and to make it easier to clear out buffered random
@@ -116,7 +116,7 @@ struct randread_source
/* The default error handler. */
static void
randread_error (void *file_name)
randread_error (void const *file_name)
{
if (file_name)
error (exit_failure, errno,
@@ -129,7 +129,7 @@ randread_error (void *file_name)
handler. */
static struct randread_source *
simple_new (FILE *source, void *handler_arg)
simple_new (FILE *source, void const *handler_arg)
{
struct randread_source *s = xmalloc (sizeof *s);
s->source = source;
@@ -167,7 +167,7 @@ randread_new (char const *name, size_t bytes_bound)
file_name = NULL;
}
s = simple_new (source, (void *) file_name);
s = simple_new (source, file_name);
if (source)
setvbuf (source, s->buf.c, _IOFBF, MIN (sizeof s->buf.c, bytes_bound));
@@ -190,13 +190,13 @@ randread_new (char const *name, size_t bytes_bound)
does not return. */
void
randread_set_handler (struct randread_source *s, void (*handler) (void *))
randread_set_handler (struct randread_source *s, void (*handler) (void const *))
{
s->handler = handler;
}
void
randread_set_handler_arg (struct randread_source *s, void *handler_arg)
randread_set_handler_arg (struct randread_source *s, void const *handler_arg)
{
s->handler_arg = handler_arg;
}

View File

@@ -27,8 +27,8 @@ struct randread_source;
struct randread_source *randread_new (char const *, size_t);
void randread (struct randread_source *, void *, size_t);
void randread_set_handler (struct randread_source *, void (*) (void *));
void randread_set_handler_arg (struct randread_source *, void *);
void randread_set_handler (struct randread_source *, void (*) (void const *));
void randread_set_handler_arg (struct randread_source *, void const *);
int randread_free (struct randread_source *);
#endif

View File

@@ -36,9 +36,14 @@
# define SWAP(n) (n)
#else
# define SWAP(n) \
(((n) << 56) | (((n) & 0xff00) << 40) | (((n) & 0xff0000UL) << 24) \
| (((n) & 0xff000000UL) << 8) | (((n) >> 8) & 0xff000000UL) \
| (((n) >> 24) & 0xff0000UL) | (((n) >> 40) & 0xff00UL) | ((n) >> 56))
u64or (u64or (u64or (u64shl (n, 56), \
u64shl (u64and (n, u64lo (0x0000ff00)), 40)), \
u64or (u64shl (u64and (n, u64lo (0x00ff0000)), 24), \
u64shl (u64and (n, u64lo (0xff000000)), 8))), \
u64or (u64or (u64and (u64shr (n, 8), u64lo (0xff000000)), \
u64and (u64shr (n, 24), u64lo (0x00ff0000))), \
u64or (u64and (u64shr (n, 40), u64lo (0x0000ff00)), \
u64shr (n, 56))))
#endif
#define BLOCKSIZE 4096
@@ -59,32 +64,32 @@ static const unsigned char fillbuf[128] = { 0x80, 0 /* , 0, 0, ... */ };
void
sha512_init_ctx (struct sha512_ctx *ctx)
{
ctx->state[0] = 0x6a09e667f3bcc908ULL;
ctx->state[1] = 0xbb67ae8584caa73bULL;
ctx->state[2] = 0x3c6ef372fe94f82bULL;
ctx->state[3] = 0xa54ff53a5f1d36f1ULL;
ctx->state[4] = 0x510e527fade682d1ULL;
ctx->state[5] = 0x9b05688c2b3e6c1fULL;
ctx->state[6] = 0x1f83d9abfb41bd6bULL;
ctx->state[7] = 0x5be0cd19137e2179ULL;
ctx->state[0] = u64hilo (0x6a09e667, 0xf3bcc908);
ctx->state[1] = u64hilo (0xbb67ae85, 0x84caa73b);
ctx->state[2] = u64hilo (0x3c6ef372, 0xfe94f82b);
ctx->state[3] = u64hilo (0xa54ff53a, 0x5f1d36f1);
ctx->state[4] = u64hilo (0x510e527f, 0xade682d1);
ctx->state[5] = u64hilo (0x9b05688c, 0x2b3e6c1f);
ctx->state[6] = u64hilo (0x1f83d9ab, 0xfb41bd6b);
ctx->state[7] = u64hilo (0x5be0cd19, 0x137e2179);
ctx->total[0] = ctx->total[1] = 0;
ctx->total[0] = ctx->total[1] = u64lo (0);
ctx->buflen = 0;
}
void
sha384_init_ctx (struct sha512_ctx *ctx)
{
ctx->state[0] = 0xcbbb9d5dc1059ed8ULL;
ctx->state[1] = 0x629a292a367cd507ULL;
ctx->state[2] = 0x9159015a3070dd17ULL;
ctx->state[3] = 0x152fecd8f70e5939ULL;
ctx->state[4] = 0x67332667ffc00b31ULL;
ctx->state[5] = 0x8eb44a8768581511ULL;
ctx->state[6] = 0xdb0c2e0d64f98fa7ULL;
ctx->state[7] = 0x47b5481dbefa4fa4ULL;
ctx->state[0] = u64hilo (0xcbbb9d5d, 0xc1059ed8);
ctx->state[1] = u64hilo (0x629a292a, 0x367cd507);
ctx->state[2] = u64hilo (0x9159015a, 0x3070dd17);
ctx->state[3] = u64hilo (0x152fecd8, 0xf70e5939);
ctx->state[4] = u64hilo (0x67332667, 0xffc00b31);
ctx->state[5] = u64hilo (0x8eb44a87, 0x68581511);
ctx->state[6] = u64hilo (0xdb0c2e0d, 0x64f98fa7);
ctx->state[7] = u64hilo (0x47b5481d, 0xbefa4fa4);
ctx->total[0] = ctx->total[1] = 0;
ctx->total[0] = ctx->total[1] = u64lo (0);
ctx->buflen = 0;
}
@@ -99,7 +104,7 @@ sha512_read_ctx (const struct sha512_ctx *ctx, void *resbuf)
int i;
for (i = 0; i < 8; i++)
((uint64_t *) resbuf)[i] = SWAP (ctx->state[i]);
((u64 *) resbuf)[i] = SWAP (ctx->state[i]);
return resbuf;
}
@@ -110,7 +115,7 @@ sha384_read_ctx (const struct sha512_ctx *ctx, void *resbuf)
int i;
for (i = 0; i < 6; i++)
((uint64_t *) resbuf)[i] = SWAP (ctx->state[i]);
((u64 *) resbuf)[i] = SWAP (ctx->state[i]);
return resbuf;
}
@@ -124,17 +129,18 @@ static void
sha512_conclude_ctx (struct sha512_ctx *ctx)
{
/* Take yet unprocessed bytes into account. */
uint64_t bytes = ctx->buflen;
size_t bytes = ctx->buflen;
size_t size = (bytes < 112) ? 128 / 8 : 128 * 2 / 8;
/* Now count remaining bytes. */
ctx->total[0] += bytes;
if (ctx->total[0] < bytes)
++ctx->total[1];
ctx->total[0] = u64plus (ctx->total[0], u64lo (bytes));
if (u64lt (ctx->total[0], u64lo (bytes)))
ctx->total[1] = u64plus (ctx->total[1], u64lo (1));
/* Put the 64-bit file length in *bits* at the end of the buffer. */
ctx->buffer[size - 2] = SWAP ((ctx->total[1] << 3) | (ctx->total[0] >> 61));
ctx->buffer[size - 1] = SWAP (ctx->total[0] << 3);
ctx->buffer[size - 2] = SWAP (u64or (u64shl (ctx->total[1], 3),
u64shr (ctx->total[0], 61)));
ctx->buffer[size - 1] = SWAP (u64shl (ctx->total[0], 3));
memcpy (&((char *) ctx->buffer)[bytes], fillbuf, (size - 2) * 8 - bytes);
@@ -353,7 +359,7 @@ sha512_process_bytes (const void *buffer, size_t len, struct sha512_ctx *ctx)
{
#if !_STRING_ARCH_unaligned
# define alignof(type) offsetof (struct { char c; type x; }, x)
# define UNALIGNED_P(p) (((size_t) p) % alignof (uint64_t) != 0)
# define UNALIGNED_P(p) (((size_t) p) % alignof (u64) != 0)
if (UNALIGNED_P (buffer))
while (len > 128)
{
@@ -391,22 +397,52 @@ sha512_process_bytes (const void *buffer, size_t len, struct sha512_ctx *ctx)
/* SHA512 round constants */
#define K(I) sha512_round_constants[I]
static const uint64_t sha512_round_constants[80] = {
0x428a2f98d728ae22ULL, 0x7137449123ef65cdULL, 0xb5c0fbcfec4d3b2fULL, 0xe9b5dba58189dbbcULL, 0x3956c25bf348b538ULL, 0x59f111f1b605d019ULL, 0x923f82a4af194f9bULL, 0xab1c5ed5da6d8118ULL,
0xd807aa98a3030242ULL, 0x12835b0145706fbeULL, 0x243185be4ee4b28cULL, 0x550c7dc3d5ffb4e2ULL, 0x72be5d74f27b896fULL, 0x80deb1fe3b1696b1ULL, 0x9bdc06a725c71235ULL, 0xc19bf174cf692694ULL,
0xe49b69c19ef14ad2ULL, 0xefbe4786384f25e3ULL, 0x0fc19dc68b8cd5b5ULL, 0x240ca1cc77ac9c65ULL, 0x2de92c6f592b0275ULL, 0x4a7484aa6ea6e483ULL, 0x5cb0a9dcbd41fbd4ULL, 0x76f988da831153b5ULL,
0x983e5152ee66dfabULL, 0xa831c66d2db43210ULL, 0xb00327c898fb213fULL, 0xbf597fc7beef0ee4ULL, 0xc6e00bf33da88fc2ULL, 0xd5a79147930aa725ULL, 0x06ca6351e003826fULL, 0x142929670a0e6e70ULL,
0x27b70a8546d22ffcULL, 0x2e1b21385c26c926ULL, 0x4d2c6dfc5ac42aedULL, 0x53380d139d95b3dfULL, 0x650a73548baf63deULL, 0x766a0abb3c77b2a8ULL, 0x81c2c92e47edaee6ULL, 0x92722c851482353bULL,
0xa2bfe8a14cf10364ULL, 0xa81a664bbc423001ULL, 0xc24b8b70d0f89791ULL, 0xc76c51a30654be30ULL, 0xd192e819d6ef5218ULL, 0xd69906245565a910ULL, 0xf40e35855771202aULL, 0x106aa07032bbd1b8ULL,
0x19a4c116b8d2d0c8ULL, 0x1e376c085141ab53ULL, 0x2748774cdf8eeb99ULL, 0x34b0bcb5e19b48a8ULL, 0x391c0cb3c5c95a63ULL, 0x4ed8aa4ae3418acbULL, 0x5b9cca4f7763e373ULL, 0x682e6ff3d6b2b8a3ULL,
0x748f82ee5defb2fcULL, 0x78a5636f43172f60ULL, 0x84c87814a1f0ab72ULL, 0x8cc702081a6439ecULL, 0x90befffa23631e28ULL, 0xa4506cebde82bde9ULL, 0xbef9a3f7b2c67915ULL, 0xc67178f2e372532bULL,
0xca273eceea26619cULL, 0xd186b8c721c0c207ULL, 0xeada7dd6cde0eb1eULL, 0xf57d4f7fee6ed178ULL, 0x06f067aa72176fbaULL, 0x0a637dc5a2c898a6ULL, 0x113f9804bef90daeULL, 0x1b710b35131c471bULL,
0x28db77f523047d84ULL, 0x32caab7b40c72493ULL, 0x3c9ebe0a15c9bebcULL, 0x431d67c49c100d4cULL, 0x4cc5d4becb3e42b6ULL, 0x597f299cfc657e2aULL, 0x5fcb6fab3ad6faecULL, 0x6c44198c4a475817ULL,
static u64 const sha512_round_constants[80] = {
u64init (0x428a2f98, 0xd728ae22), u64init (0x71374491, 0x23ef65cd),
u64init (0xb5c0fbcf, 0xec4d3b2f), u64init (0xe9b5dba5, 0x8189dbbc),
u64init (0x3956c25b, 0xf348b538), u64init (0x59f111f1, 0xb605d019),
u64init (0x923f82a4, 0xaf194f9b), u64init (0xab1c5ed5, 0xda6d8118),
u64init (0xd807aa98, 0xa3030242), u64init (0x12835b01, 0x45706fbe),
u64init (0x243185be, 0x4ee4b28c), u64init (0x550c7dc3, 0xd5ffb4e2),
u64init (0x72be5d74, 0xf27b896f), u64init (0x80deb1fe, 0x3b1696b1),
u64init (0x9bdc06a7, 0x25c71235), u64init (0xc19bf174, 0xcf692694),
u64init (0xe49b69c1, 0x9ef14ad2), u64init (0xefbe4786, 0x384f25e3),
u64init (0x0fc19dc6, 0x8b8cd5b5), u64init (0x240ca1cc, 0x77ac9c65),
u64init (0x2de92c6f, 0x592b0275), u64init (0x4a7484aa, 0x6ea6e483),
u64init (0x5cb0a9dc, 0xbd41fbd4), u64init (0x76f988da, 0x831153b5),
u64init (0x983e5152, 0xee66dfab), u64init (0xa831c66d, 0x2db43210),
u64init (0xb00327c8, 0x98fb213f), u64init (0xbf597fc7, 0xbeef0ee4),
u64init (0xc6e00bf3, 0x3da88fc2), u64init (0xd5a79147, 0x930aa725),
u64init (0x06ca6351, 0xe003826f), u64init (0x14292967, 0x0a0e6e70),
u64init (0x27b70a85, 0x46d22ffc), u64init (0x2e1b2138, 0x5c26c926),
u64init (0x4d2c6dfc, 0x5ac42aed), u64init (0x53380d13, 0x9d95b3df),
u64init (0x650a7354, 0x8baf63de), u64init (0x766a0abb, 0x3c77b2a8),
u64init (0x81c2c92e, 0x47edaee6), u64init (0x92722c85, 0x1482353b),
u64init (0xa2bfe8a1, 0x4cf10364), u64init (0xa81a664b, 0xbc423001),
u64init (0xc24b8b70, 0xd0f89791), u64init (0xc76c51a3, 0x0654be30),
u64init (0xd192e819, 0xd6ef5218), u64init (0xd6990624, 0x5565a910),
u64init (0xf40e3585, 0x5771202a), u64init (0x106aa070, 0x32bbd1b8),
u64init (0x19a4c116, 0xb8d2d0c8), u64init (0x1e376c08, 0x5141ab53),
u64init (0x2748774c, 0xdf8eeb99), u64init (0x34b0bcb5, 0xe19b48a8),
u64init (0x391c0cb3, 0xc5c95a63), u64init (0x4ed8aa4a, 0xe3418acb),
u64init (0x5b9cca4f, 0x7763e373), u64init (0x682e6ff3, 0xd6b2b8a3),
u64init (0x748f82ee, 0x5defb2fc), u64init (0x78a5636f, 0x43172f60),
u64init (0x84c87814, 0xa1f0ab72), u64init (0x8cc70208, 0x1a6439ec),
u64init (0x90befffa, 0x23631e28), u64init (0xa4506ceb, 0xde82bde9),
u64init (0xbef9a3f7, 0xb2c67915), u64init (0xc67178f2, 0xe372532b),
u64init (0xca273ece, 0xea26619c), u64init (0xd186b8c7, 0x21c0c207),
u64init (0xeada7dd6, 0xcde0eb1e), u64init (0xf57d4f7f, 0xee6ed178),
u64init (0x06f067aa, 0x72176fba), u64init (0x0a637dc5, 0xa2c898a6),
u64init (0x113f9804, 0xbef90dae), u64init (0x1b710b35, 0x131c471b),
u64init (0x28db77f5, 0x23047d84), u64init (0x32caab7b, 0x40c72493),
u64init (0x3c9ebe0a, 0x15c9bebc), u64init (0x431d67c4, 0x9c100d4c),
u64init (0x4cc5d4be, 0xcb3e42b6), u64init (0x597f299c, 0xfc657e2a),
u64init (0x5fcb6fab, 0x3ad6faec), u64init (0x6c44198c, 0x4a475817),
};
/* Round functions. */
#define F2(A,B,C) ( ( A & B ) | ( C & ( A | B ) ) )
#define F1(E,F,G) ( G ^ ( E & ( F ^ G ) ) )
#define F2(A, B, C) u64or (u64and (A, B), u64and (C, u64or (A, B)))
#define F1(E, F, G) u64xor (G, u64and (E, u64xor (F, G)))
/* Process LEN bytes of BUFFER, accumulating context into CTX.
It is assumed that LEN % 128 == 0.
@@ -415,47 +451,50 @@ static const uint64_t sha512_round_constants[80] = {
void
sha512_process_block (const void *buffer, size_t len, struct sha512_ctx *ctx)
{
const uint64_t *words = buffer;
size_t nwords = len / sizeof (uint64_t);
const uint64_t *endp = words + nwords;
uint64_t x[16];
uint64_t a = ctx->state[0];
uint64_t b = ctx->state[1];
uint64_t c = ctx->state[2];
uint64_t d = ctx->state[3];
uint64_t e = ctx->state[4];
uint64_t f = ctx->state[5];
uint64_t g = ctx->state[6];
uint64_t h = ctx->state[7];
u64 const *words = buffer;
u64 const *endp = words + len / sizeof (u64);
u64 x[16];
u64 a = ctx->state[0];
u64 b = ctx->state[1];
u64 c = ctx->state[2];
u64 d = ctx->state[3];
u64 e = ctx->state[4];
u64 f = ctx->state[5];
u64 g = ctx->state[6];
u64 h = ctx->state[7];
/* First increment the byte count. FIPS PUB 180-2 specifies the possible
length of the file up to 2^128 bits. Here we only compute the
number of bytes. Do a double word increment. */
ctx->total[0] += len;
if (ctx->total[0] < len)
++ctx->total[1];
ctx->total[0] = u64plus (ctx->total[0], u64lo (len));
if (u64lt (ctx->total[0], u64lo (len)))
ctx->total[1] = u64plus (ctx->total[1], u64lo (1));
#define S0(x) (rol64(x,63)^rol64(x,56)^(x>>7))
#define S1(x) (rol64(x,45)^rol64(x,3)^(x>>6))
#define SS0(x) (rol64(x,36)^rol64(x,30)^rol64(x,25))
#define SS1(x) (rol64(x,50)^rol64(x,46)^rol64(x,23))
#define S0(x) u64xor (u64rol(x, 63), u64xor (u64rol (x, 56), u64shr (x, 7)))
#define S1(x) u64xor (u64rol (x, 45), u64xor (u64rol (x, 3), u64shr (x, 6)))
#define SS0(x) u64xor (u64rol (x, 36), u64xor (u64rol (x, 30), u64rol (x, 25)))
#define SS1(x) u64xor (u64rol(x, 50), u64xor (u64rol (x, 46), u64rol (x, 23)))
#define M(I) ( tm = S1(x[(I-2)&0x0f]) + x[(I-7)&0x0f] \
+ S0(x[(I-15)&0x0f]) + x[I&0x0f] \
, x[I&0x0f] = tm )
#define M(I) (x[(I) & 15] \
= u64plus (x[(I) & 15], \
u64plus (S1 (x[((I) - 2) & 15]), \
u64plus (x[((I) - 7) & 15], \
S0 (x[((I) - 15) & 15])))))
#define R(A,B,C,D,E,F,G,H,K,M) do { t0 = SS0(A) + F2(A,B,C); \
t1 = H + SS1(E) \
+ F1(E,F,G) \
+ K \
+ M; \
D += t1; H = t0 + t1; \
} while(0)
#define R(A, B, C, D, E, F, G, H, K, M) \
do \
{ \
u64 t0 = u64plus (SS0 (A), F2 (A, B, C)); \
u64 t1 = \
u64plus (H, u64plus (SS1 (E), \
u64plus (F1 (E, F, G), u64plus (K, M)))); \
D = u64plus (D, t1); \
H = u64plus (t0, t1); \
} \
while (0)
while (words < endp)
{
uint64_t tm;
uint64_t t0, t1;
int t;
/* FIXME: see sha1.c for a better implementation. */
for (t = 0; t < 16; t++)
@@ -545,13 +584,13 @@ sha512_process_block (const void *buffer, size_t len, struct sha512_ctx *ctx)
R( c, d, e, f, g, h, a, b, K(78), M(78) );
R( b, c, d, e, f, g, h, a, K(79), M(79) );
a = ctx->state[0] += a;
b = ctx->state[1] += b;
c = ctx->state[2] += c;
d = ctx->state[3] += d;
e = ctx->state[4] += e;
f = ctx->state[5] += f;
g = ctx->state[6] += g;
h = ctx->state[7] += h;
a = ctx->state[0] = u64plus (ctx->state[0], a);
b = ctx->state[1] = u64plus (ctx->state[1], b);
c = ctx->state[2] = u64plus (ctx->state[2], c);
d = ctx->state[3] = u64plus (ctx->state[3], d);
e = ctx->state[4] = u64plus (ctx->state[4], e);
f = ctx->state[5] = u64plus (ctx->state[5], f);
g = ctx->state[6] = u64plus (ctx->state[6], g);
h = ctx->state[7] = u64plus (ctx->state[7], h);
}
}

View File

@@ -20,16 +20,17 @@
# define SHA512_H 1
# include <stdio.h>
# include <stdint.h>
# include "u64.h"
/* Structure to save state of computation between the single steps. */
struct sha512_ctx
{
uint64_t state[8];
u64 state[8];
uint64_t total[2];
uint64_t buflen;
uint64_t buffer[32];
u64 total[2];
size_t buflen;
u64 buffer[32];
};
@@ -85,6 +86,4 @@ extern int sha384_stream (FILE *stream, void *resblock);
extern void *sha512_buffer (const char *buffer, size_t len, void *resblock);
extern void *sha384_buffer (const char *buffer, size_t len, void *resblock);
# define rol64(x,n) ( ((x) << (n)) | ((x) >> (64-(n))) )
#endif

160
lib/u64.h Normal file
View File

@@ -0,0 +1,160 @@
/* uint64_t-like operations that work even on hosts lacking uint64_t
Copyright (C) 2006 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option) any
later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
/* Written by Paul Eggert. */
#include <stddef.h>
#include <stdint.h>
/* Return X rotated left by N bits, where 0 < N < 64. */
#define u64rol(x, n) u64or (u64shl (x, n), u64shr (x, 64 - n))
#ifdef UINT64_MAX
/* Native implementations are trivial. See below for comments on what
these operations do. */
typedef uint64_t u64;
# define u64hilo(hi, lo) ((u64) (((u64) (hi) << 32) + (lo)))
# define u64init(hi, lo) u64hilo (hi, lo)
# define u64lo(x) ((u64) (x))
# define u64lt(x, y) ((x) < (y))
# define u64and(x, y) ((x) & (y))
# define u64or(x, y) ((x) | (y))
# define u64xor(x, y) ((x) ^ (y))
# define u64plus(x, y) ((x) + (y))
# define u64shl(x, n) ((x) << (n))
# define u64shr(x, n) ((x) >> (n))
#else
/* u64 is a 64-bit unsigned integer value.
u64init (HI, LO), is like u64hilo (HI, LO), but for use in
initializer contexts. */
# ifdef WORDS_BIGENDIAN
typedef struct { uint32_t hi, lo; } u64;
# define u64init(hi, lo) { hi, lo }
# else
typedef struct { uint32_t lo, hi; } u64;
# define u64init(hi, lo) { lo, hi }
# endif
/* Given the high and low-order 32-bit quantities HI and LO, return a u64
value representing (HI << 32) + LO. */
static inline u64
u64hilo (uint32_t hi, uint32_t lo)
{
u64 r;
r.hi = hi;
r.lo = lo;
return r;
}
/* Return a u64 value representing LO. */
static inline u64
u64lo (uint32_t lo)
{
u64 r;
r.hi = 0;
r.lo = lo;
return r;
}
/* Return X < Y. */
static inline int
u64lt (u64 x, u64 y)
{
return x.hi < y.hi || (x.hi == y.hi && x.lo < y.lo);
}
/* Return X & Y. */
static inline u64
u64and (u64 x, u64 y)
{
u64 r;
r.hi = x.hi & y.hi;
r.lo = x.lo & y.lo;
return r;
}
/* Return X | Y. */
static inline u64
u64or (u64 x, u64 y)
{
u64 r;
r.hi = x.hi | y.hi;
r.lo = x.lo | y.lo;
return r;
}
/* Return X ^ Y. */
static inline u64
u64xor (u64 x, u64 y)
{
u64 r;
r.hi = x.hi ^ y.hi;
r.lo = x.lo ^ y.lo;
return r;
}
/* Return X + Y. */
static inline u64
u64plus (u64 x, u64 y)
{
u64 r;
r.lo = x.lo + y.lo;
r.hi = x.hi + y.hi + (r.lo < x.lo);
return r;
}
/* Return X << N. */
static inline u64
u64shl (u64 x, int n)
{
u64 r;
if (n < 32)
{
r.hi = (x.hi << n) | (x.lo >> (32 - n));
r.lo = x.lo << n;
}
else
{
r.hi = x.lo << (n - 32);
r.lo = 0;
}
return r;
}
/* Return X >> N. */
static inline u64
u64shr (u64 x, int n)
{
u64 r;
if (n < 32)
{
r.hi = x.hi >> n;
r.lo = (x.hi << (32 - n)) | (x.lo >> n);
}
else
{
r.hi = 0;
r.lo = x.hi >> (n - 32);
}
return r;
}
#endif

225
m4/.gitignore vendored Normal file
View File

@@ -0,0 +1,225 @@
absolute-header.m4
acl.m4
alloca.m4
allocsa.m4
argmatch.m4
arpa_inet_h.m4
assert.m4
atexit.m4
backupfile.m4
base64.m4
bison.m4
c-strtod.m4
calloc.m4
canon-host.m4
canonicalize.m4
chdir-long.m4
chown.m4
clock_time.m4
cloexec.m4
close-stream.m4
closeout.m4
codeset.m4
config-h.m4
cycle-check.m4
d-ino.m4
d-type.m4
dirfd.m4
dirname.m4
dos.m4
double-slash-root.m4
dup2.m4
eealloc.m4
eoverflow.m4
error.m4
euidaccess.m4
exclude.m4
exitfail.m4
extensions.m4
fcntl-safer.m4
fcntl_h.m4
file-type.m4
fileblocks.m4
filemode.m4
filenamecat.m4
fnmatch.m4
fpending.m4
fprintftime.m4
free.m4
fstypename.m4
fsusage.m4
ftruncate.m4
fts.m4
getaddrinfo.m4
getcwd-abort-bug.m4
getcwd-path-max.m4
getcwd.m4
getdate.m4
getdelim.m4
getgroups.m4
gethostname.m4
gethrxtime.m4
getline.m4
getloadavg.m4
getndelim2.m4
getopt.m4
getpagesize.m4
getpass.m4
gettext.m4
gettime.m4
gettimeofday.m4
getugroups.m4
getusershell.m4
glibc21.m4
gnulib-cache.m4
gnulib-comp.m4
gnulib-tool.m4
group-member.m4
hard-locale.m4
hash.m4
host-os.m4
human.m4
iconv.m4
idcache.m4
inet_ntop.m4
intmax.m4
intmax_t.m4
inttostr.m4
inttypes-h.m4
inttypes-pri.m4
inttypes.m4
inttypes_h.m4
isapipe.m4
jm-winsz1.m4
jm-winsz2.m4
lchmod.m4
lchown.m4
lib-ignore.m4
lib-ld.m4
lib-link.m4
lib-prefix.m4
link-follow.m4
localcharset.m4
long-options.m4
longdouble.m4
longlong.m4
ls-mntd-fs.m4
lstat.m4
mbchar.m4
mbiter.m4
mbrtowc.m4
mbstate_t.m4
mbswidth.m4
md5.m4
memcasecmp.m4
memchr.m4
memcmp.m4
memcoll.m4
memcpy.m4
memmove.m4
mempcpy.m4
memrchr.m4
memset.m4
mkancesdirs.m4
mkdir-p.m4
mkdir-slash.m4
mkstemp.m4
mktime.m4
modechange.m4
mountlist.m4
nanosleep.m4
netinet_in_h.m4
nls.m4
openat.m4
pathmax.m4
perl.m4
physmem.m4
po.m4
posixtm.m4
posixver.m4
progtest.m4
putenv.m4
quote.m4
quotearg.m4
readlink.m4
readtokens.m4
readutmp.m4
regex.m4
rename-dest-slash.m4
rename.m4
rmdir-errno.m4
rmdir.m4
rpmatch.m4
safe-read.m4
safe-write.m4
same.m4
save-cwd.m4
savedir.m4
savewd.m4
setenv.m4
settime.m4
sha1.m4
sig2str.m4
signed.m4
snprintf.m4
socklen.m4
sockpfaf.m4
ssize_t.m4
st_dm_mode.m4
stat-macros.m4
stat-time.m4
stdarg.m4
stdbool.m4
stdint.m4
stdint_h.m4
stdio-safer.m4
stdlib-safer.m4
stpcpy.m4
strcase.m4
strcspn.m4
strdup.m4
strftime.m4
strndup.m4
strnlen.m4
strpbrk.m4
strtod.m4
strtoimax.m4
strtol.m4
strtoll.m4
strtoul.m4
strtoull.m4
strtoumax.m4
strverscmp.m4
sys_socket_h.m4
sys_stat_h.m4
time_r.m4
timespec.m4
tm_gmtoff.m4
tzset.m4
unicodeio.m4
unistd-safer.m4
unistd_h.m4
unlink-busy.m4
unlinkdir.m4
unlocked-io.m4
uptime.m4
userspec.m4
utimbuf.m4
utime.m4
utimecmp.m4
utimens.m4
utimes-null.m4
utimes.m4
vasnprintf.m4
vasprintf.m4
wchar_t.m4
wcwidth.m4
wint_t.m4
xalloc.m4
xgetcwd.m4
xnanosleep.m4
xreadlink.m4
xstrndup.m4
xstrtod.m4
xstrtol.m4
yesno.m4

View File

@@ -1,3 +1,32 @@
2006-10-14 Paul Eggert <eggert@cs.ucla.edu>
* sha512.m4 (gl_SHA512): Add u64.h to AC_LIBSOURCES.
2006-10-12 Jim Meyering <jim@meyering.net>
* jm-macros.m4 (coreutils_MACROS): Rename from gl_MACROS, now that
most of the gnulib macros have migrated into gnulib.
Don't call gl_INIT here (now it's called from configure.ac, directly).
2006-10-07 Jim Meyering <jim@meyering.net>
* jm-macros.m4 (gl_MACROS): Remove use of AC_CONFIG_LIBOBJ_DIR(lib).
It is no longer needed, and was causing dependencies to appear
in lib/lib/.deps, which provoked a "make distcheck" failure.
2006-09-29 Jim Meyering <jim@meyering.net>
* readdir.m4: Remove file once again.
* jm-macros.m4: Remove reference to gl_FUNC_READDIR.
2006-09-28 Jim Meyering <jim@meyering.net>
* jm-macros.m4: Require the new macro.
* readdir.m4 (gl_FUNC_READDIR): Rename from GL_FUNC_READDIR.
Increment serial number.
* readdir.m4: Revivify this file.
We need it to work around a bug on Darwin 0.7.x.
2006-09-01 Paul Eggert <eggert@cs.ucla.edu>
* .cvsignore: Add fcntl_h.m4, getloadavg.m4, inttypes-h.m4,

View File

@@ -1,4 +1,4 @@
#serial 103 -*- autoconf -*-
#serial 104 -*- autoconf -*-
dnl Misc type-related macros for coreutils.
@@ -21,10 +21,8 @@ dnl Misc type-related macros for coreutils.
# Written by Jim Meyering.
AC_DEFUN([gl_MACROS],
AC_DEFUN([coreutils_MACROS],
[
gl_INIT
GNU_PACKAGE="GNU $PACKAGE"
AC_DEFINE_UNQUOTED(GNU_PACKAGE, "$GNU_PACKAGE",
[The concatenation of the strings `GNU ', and PACKAGE.])
@@ -46,8 +44,6 @@ AC_DEFUN([gl_MACROS],
AC_REQUIRE([AC_FUNC_FSEEKO])
AC_CONFIG_LIBOBJ_DIR([lib])
# By default, argmatch should fail calling usage (1).
AC_DEFINE(ARGMATCH_DIE, [usage (1)],
[Define to the function xargmatch calls on failures.])

View File

@@ -1,12 +1,12 @@
# sha512.m4 serial 1
dnl Copyright (C) 2005 Free Software Foundation, Inc.
# sha512.m4 serial 2
dnl Copyright (C) 2005, 2006 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
AC_DEFUN([gl_SHA512],
[
AC_LIBSOURCES([sha512.c, sha512.h])
AC_LIBSOURCES([sha512.c, sha512.h, u64.h])
AC_LIBOBJ([sha512])
dnl Prerequisites of lib/sha512.c.

View File

@@ -35,7 +35,7 @@ dist_man_MANS = \
man_aux = $(dist_man_MANS:.1=.x)
EXTRA_DIST = $(man_aux) help2man
MAINTAINERCLEANFILES = $(man_MANS)
MAINTAINERCLEANFILES = $(dist_man_MANS)
# Depend on configure.ac to get version number changes.
common_dep = $(top_srcdir)/configure.ac

17
po/.gitignore vendored Normal file
View File

@@ -0,0 +1,17 @@
*.po
LINGUAS
Makefile.in
Makefile.in.in
Makevars
Makevars.template
POTFILES
Rules-quot
boldquot.sed
coreutils.pot
en@boldquot.header
en@quot.header
insert-header.sin
quot.sed
remove-potcdate.sed
remove-potcdate.sin
stamp-po

View File

@@ -1,3 +1,11 @@
2006-10-19 Jim Meyering <jim@meyering.net>
* POTFILES.in: Also include lib/regcomp.c, since it too uses gettext.
2006-10-19 Paul Eggert <eggert@cs.ucla.edu>
* POTFILES.in: Add lib/xstrtol.h.
2006-08-22 Paul Eggert <eggert@cs.ucla.edu>
* .cvsignore: More ../bootstrap-related fixes, plus remove old

View File

@@ -16,15 +16,17 @@ lib/obstack.c
lib/openat-die.c
lib/quotearg.c
lib/randread.c
lib/regcomp.c
lib/root-dev-ino.h
lib/rpmatch.c
lib/unicodeio.c
lib/userspec.c
lib/version-etc.c
lib/xalloc-die.c
lib/xmemxfrm.c
lib/xfts.c
lib/xmemcoll.c
lib/xmemxfrm.c
lib/xstrtol.h
# Package source files

102
src/.gitignore vendored Normal file
View File

@@ -0,0 +1,102 @@
\[
base64
basename
cat
chgrp
chmod
chown
chroot
cksum
comm
cp
csplit
cut
date
dd
df
dir
dircolors
dircolors.h
dirname
du
echo
env
expand
expr
factor
false
fmt
fold
fs.h
ginstall
groups
head
hostid
hostname
id
join
kill
link
ln
localedir.h
logname
ls
md5sum
mkdir
mkfifo
mknod
mv
nice
nl
nohup
od
paste
pathchk
pinky
pr
printenv
printf
ptx
pwd
readlink
rm
rmdir
seq
setuidgid
sha1sum
sha224sum
sha256sum
sha384sum
sha512sum
shred
sleep
sort
split
stat
stty
su
sum
sync
tac
tail
tee
test
touch
tr
true
tsort
tty
uname
unexpand
uniq
unlink
uptime
users
vdir
wc
wheel-size.h
wheel.h
who
whoami
yes
shuf

View File

@@ -5,32 +5,32 @@ retrieving revision 1.158
diff -u -p -u -r1.158 remove.c
--- src/remove.c 3 Sep 2006 02:54:51 -0000 1.158
+++ src/remove.c 6 Sep 2006 18:57:46 -0000
@@ -238,9 +238,10 @@ pop_dir (Dirstack_state *ds)
@@ -245,9 +245,10 @@ pop_dir (Dirstack_state *ds)
{
size_t n_lengths = obstack_object_size (&ds->len_stack) / sizeof (size_t);
size_t *length = obstack_base (&ds->len_stack);
+ size_t top_len;
assert (n_lengths > 0);
- size_t top_len = length[n_lengths - 1];
+ top_len = length[n_lengths - 1];
assert (top_len >= 2);
/* Pop the specified length of file name. */
@@ -372,10 +373,11 @@ AD_stack_top (Dirstack_state const *ds)
@@ -379,10 +380,11 @@ AD_stack_top (Dirstack_state const *ds)
static void
AD_stack_pop (Dirstack_state *ds)
{
+ struct AD_ent *top;
assert (0 < AD_stack_height (ds));
/* operate on Active_dir. pop and free top entry */
- struct AD_ent *top = AD_stack_top (ds);
+ top = AD_stack_top (ds);
if (top->unremovable)
hash_free (top->unremovable);
obstack_blank (&ds->Active_dir, -(int) sizeof (struct AD_ent));
@@ -542,6 +544,7 @@ AD_mark_helper (Hash_table **ht, char *f
@@ -549,6 +551,7 @@ AD_mark_helper (Hash_table **ht, char *f
if (*ht == NULL)
xalloc_die ();
}
@@ -38,44 +38,55 @@ diff -u -p -u -r1.158 remove.c
void *ent = hash_insert (*ht, filename);
if (ent == NULL)
xalloc_die ();
@@ -550,7 +553,7 @@ AD_mark_helper (Hash_table **ht, char *f
@@ -557,7 +560,7 @@ AD_mark_helper (Hash_table **ht, char *f
if (ent != filename)
free (filename);
}
-
+ }
}
/* Mark FILENAME (in current directory) as unremovable. */
@@ -1090,6 +1093,7 @@ fd_to_subdirp (int fd_cwd, char const *f
@@ -1129,6 +1132,7 @@ fd_to_subdirp (int fd_cwd, char const *f
return NULL;
}
+ {
DIR *subdir_dirp = fdopendir (fd_sub);
if (subdir_dirp == NULL)
{
@@ -1098,6 +1102,7 @@ fd_to_subdirp (int fd_cwd, char const *f
@@ -1137,6 +1141,7 @@ fd_to_subdirp (int fd_cwd, char const *f
}
return subdir_dirp;
+ }
}
/* Remove entries in the directory open on DIRP
@@ -1334,9 +1339,10 @@ remove_dir (int fd_cwd, Dirstack_state *
@@ -1372,9 +1377,10 @@ remove_dir (int fd_cwd, Dirstack_state *
/* The name of the directory that we have just processed,
nominally removing all of its contents. */
char *empty_dir;
+ int fd;
AD_pop_and_chdir (&dirp, ds, &empty_dir);
- int fd = (dirp != NULL ? dirfd (dirp) : AT_FDCWD);
+ fd = (dirp != NULL ? dirfd (dirp) : AT_FDCWD);
assert (dirp != NULL || AD_stack_height (ds) == 1);
/* Try to remove EMPTY_DIR only if remove_cwd_entries succeeded. */
@@ -1414,6 +1420,7 @@ rm_1 (Dirstack_state *ds, char const *fi
@@ -1386,8 +1392,9 @@ remove_dir (int fd_cwd, Dirstack_state *
But that's no big deal since we're interactive. */
struct stat empty_st;
Ternary is_empty;
+ enum RM_status s;
cache_stat_init (&empty_st);
- enum RM_status s = prompt (fd, ds, empty_dir, &empty_st, x,
+ s = prompt (fd, ds, empty_dir, &empty_st, x,
PA_REMOVE_DIR, &is_empty);
if (s != RM_OK)
@@ -1452,6 +1459,7 @@ rm_1 (Dirstack_state *ds, char const *fi
return RM_ERROR;
}
@@ -83,26 +94,26 @@ diff -u -p -u -r1.158 remove.c
struct stat st;
cache_stat_init (&st);
if (x->root_dev_ino)
@@ -1435,6 +1442,7 @@ rm_1 (Dirstack_state *ds, char const *fi
@@ -1473,6 +1481,7 @@ rm_1 (Dirstack_state *ds, char const *fi
AD_push_initial (ds);
AD_INIT_OTHER_MEMBERS ();
+ {
int fd_cwd = AT_FDCWD;
enum RM_status status = remove_entry (fd_cwd, ds, filename, &st, x, NULL);
if (status == RM_NONEMPTY_DIR)
@@ -1453,6 +1461,8 @@ rm_1 (Dirstack_state *ds, char const *fi
@@ -1491,6 +1500,8 @@ rm_1 (Dirstack_state *ds, char const *fi
ds_clear (ds);
return status;
+ }
+ }
}
/* Remove all files and/or directories specified by N_FILES and FILE.
@@ -1475,9 +1485,11 @@ rm (size_t n_files, char const *const *f
@@ -1513,9 +1524,11 @@ rm (size_t n_files, char const *const *f
}
cycle_check_init (&ds->cycle_check_state);
+ {
enum RM_status s = rm_1 (ds, file[i], x, &cwd_errno);
@@ -110,7 +121,7 @@ diff -u -p -u -r1.158 remove.c
UPDATE_STATUS (status, s);
+ }
}
if (x->require_restore_cwd && cwd_errno)
Index: src/rm.c
===================================================================
@@ -130,3 +141,19 @@ diff -u -p -u -r1.140 rm.c
+ }
}
}
Index: shred.c
===================================================================
RCS file: /fetish/cu/src/shred.c,v
retrieving revision 1.130
diff -u -p -r1.130 shred.c
--- shred.c 3 Sep 2006 02:53:16 -0000 1.130
+++ shred.c 3 Oct 2006 13:48:24 -0000
@@ -460,7 +460,7 @@ dopass (int fd, char const *qname, off_t
out. Thus, it shouldn't give up on bad blocks. This
code works because lim is always a multiple of
SECTOR_SIZE, except at the end. */
- verify (sizeof r % SECTOR_SIZE == 0);
+ { verify (sizeof r % SECTOR_SIZE == 0); }
if (errnum == EIO && 0 <= size && (soff | SECTOR_MASK) < lim)
{
size_t soff1 = (soff | SECTOR_MASK) + 1;

View File

@@ -28,7 +28,6 @@
#include "error.h"
#include "fts_.h"
#include "group-member.h"
#include "lchown.h"
#include "quote.h"
#include "root-dev-ino.h"
#include "xstrtol.h"
@@ -120,8 +119,8 @@ Change the group of each FILE to GROUP.\n\
With --reference, change the group of each FILE to that of RFILE.\n\
\n\
-c, --changes like verbose but report only when a change is made\n\
--dereference affect the referent of each symbolic link, rather\n\
than the symbolic link itself (this is the default)\n\
--dereference affect the referent of each symbolic link (this is\n\
the default), rather than the symbolic link itself\n\
"), stdout);
fputs (_("\
-h, --no-dereference affect each symbolic link instead of any referenced\n\

View File

@@ -193,6 +193,19 @@ process_file (FTS *fts, FTSENT *ent)
return true;
case FTS_NS:
/* For a top-level file or directory, this FTS_NS (stat failed)
indicator is determined at the time of the initial fts_open call.
With programs like chmod, chown, and chgrp, that modify
permissions, it is possible that the file in question is
accessible when control reaches this point. So, if this is
the first time we've seen the FTS_NS for this file, tell
fts_read to stat it "again". */
if (ent->fts_level == 0 && ent->fts_number == 0)
{
ent->fts_number = 1;
fts_set (fts, ent, FTS_AGAIN);
return true;
}
error (0, ent->fts_errno, _("cannot access %s"), quote (file_full_name));
ok = false;
break;

View File

@@ -267,6 +267,19 @@ change_file_owner (FTS *fts, FTSENT *ent,
break;
case FTS_NS:
/* For a top-level file or directory, this FTS_NS (stat failed)
indicator is determined at the time of the initial fts_open call.
With programs like chmod, chown, and chgrp, that modify
permissions, it is possible that the file in question is
accessible when control reaches this point. So, if this is
the first time we've seen the FTS_NS for this file, tell
fts_read to stat it "again". */
if (ent->fts_level == 0 && ent->fts_number == 0)
{
ent->fts_number = 1;
fts_set (fts, ent, FTS_AGAIN);
return true;
}
error (0, ent->fts_errno, _("cannot access %s"), quote (file_full_name));
ok = false;
break;
@@ -292,7 +305,9 @@ change_file_owner (FTS *fts, FTSENT *ent,
file_stats = NULL;
}
else if (required_uid == (uid_t) -1 && required_gid == (gid_t) -1
&& chopt->verbosity == V_off && ! chopt->root_dev_ino)
&& chopt->verbosity == V_off
&& ! chopt->root_dev_ino
&& ! chopt->affect_symlink_referent)
{
do_chown = true;
file_stats = ent->fts_statp;
@@ -303,9 +318,9 @@ change_file_owner (FTS *fts, FTSENT *ent,
/* If this is a symlink and we're dereferencing them,
stat it to get info on the referent. */
if (S_ISLNK (file_stats->st_mode) && chopt->affect_symlink_referent)
if (chopt->affect_symlink_referent && S_ISLNK (file_stats->st_mode))
{
if (stat (file, &stat_buf) != 0)
if (fstatat (fts->fts_cwd_fd, file, &stat_buf, 0) != 0)
{
error (0, errno, _("cannot dereference %s"),
quote (file_full_name));
@@ -322,7 +337,12 @@ change_file_owner (FTS *fts, FTSENT *ent,
|| required_gid == file_stats->st_gid));
}
if (do_chown && ROOT_DEV_INO_CHECK (chopt->root_dev_ino, file_stats))
if (do_chown
/* With FTS_NOSTAT, file_stats is valid only for directories.
Don't need to check for FTS_D, since it is handled above,
and same for FTS_DNR, since then do_chown is false. */
&& (ent->fts_info == FTS_DP || ent->fts_info == FTS_DC)
&& ROOT_DEV_INO_CHECK (chopt->root_dev_ino, file_stats))
{
ROOT_DEV_INO_WARN (file_full_name);
ok = do_chown = false;
@@ -441,7 +461,8 @@ chown_files (char **files, int bit_flags,
/* Use lstat and stat only if they're needed. */
int stat_flags = ((required_uid != (uid_t) -1 || required_gid != (gid_t) -1
|| chopt->verbosity != V_off || chopt->root_dev_ino)
|| chopt->affect_symlink_referent
|| chopt->verbosity != V_off)
? 0
: FTS_NOSTAT);

View File

@@ -37,7 +37,6 @@
#include "chown-core.h"
#include "error.h"
#include "fts_.h"
#include "lchown.h"
#include "quote.h"
#include "root-dev-ino.h"
#include "userspec.h"
@@ -101,8 +100,8 @@ Change the owner and/or group of each FILE to OWNER and/or GROUP.\n\
With --reference, change the owner and group of each FILE to those of RFILE.\n\
\n\
-c, --changes like verbose but report only when a change is made\n\
--dereference affect the referent of each symbolic link, rather\n\
than the symbolic link itself (this is the default)\n\
--dereference affect the referent of each symbolic link (this is\n\
the default), rather than the symbolic link itself\n\
"), stdout);
fputs (_("\
-h, --no-dereference affect each symbolic link instead of any referenced\n\

View File

@@ -1,5 +1,5 @@
/* cksum -- calculate and print POSIX checksums and sizes of files
Copyright (C) 92, 1995-2005 Free Software Foundation, Inc.
Copyright (C) 92, 1995-2006 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -42,12 +42,9 @@
#include <stdio.h>
#include <sys/types.h>
#include <stdint.h>
#include "system.h"
#if !defined UINT_FAST32_MAX && !defined uint_fast32_t
# define uint_fast32_t unsigned int
#endif
#ifdef CRCTAB
# define BIT(x) ((uint_fast32_t) 1 << (x))

View File

@@ -260,7 +260,7 @@ copy_reg (char const *src_name, char const *dst_name,
return false;
}
if (fstat (source_desc, &src_open_sb))
if (fstat (source_desc, &src_open_sb) != 0)
{
error (0, errno, _("cannot fstat %s"), quote (src_name));
return_val = false;
@@ -280,11 +280,7 @@ copy_reg (char const *src_name, char const *dst_name,
/* These semantics are required for cp.
The if-block will be taken in move_mode. */
if (*new_dst)
{
dest_desc = open (dst_name, O_WRONLY | O_CREAT | O_BINARY, dst_mode);
}
else
if (! *new_dst)
{
dest_desc = open (dst_name, O_WRONLY | O_TRUNC | O_BINARY, dst_mode);
@@ -296,15 +292,17 @@ copy_reg (char const *src_name, char const *dst_name,
return_val = false;
goto close_src_desc;
}
if (x->verbose)
printf (_("removed %s\n"), quote (dst_name));
/* Tell caller that the destination file was unlinked. */
*new_dst = true;
/* Try the open again, but this time with different flags. */
dest_desc = open (dst_name, O_WRONLY | O_CREAT | O_BINARY, dst_mode);
}
}
if (*new_dst)
dest_desc = open (dst_name, O_WRONLY | O_CREAT | O_BINARY, dst_mode);
if (dest_desc < 0)
{
error (0, errno, _("cannot create regular file %s"), quote (dst_name));
@@ -312,7 +310,7 @@ copy_reg (char const *src_name, char const *dst_name,
goto close_src_desc;
}
if (fstat (dest_desc, &sb))
if (fstat (dest_desc, &sb) != 0)
{
error (0, errno, _("cannot fstat %s"), quote (dst_name));
return_val = false;
@@ -968,7 +966,6 @@ copy_internal (char const *src_name, char const *dst_name,
struct stat src_sb;
struct stat dst_sb;
mode_t src_mode;
mode_t src_type;
mode_t dst_mode IF_LINT (= 0);
bool restore_dst_mode = false;
char *earlier_file = NULL;
@@ -989,11 +986,9 @@ copy_internal (char const *src_name, char const *dst_name,
return false;
}
src_type = src_sb.st_mode;
src_mode = src_sb.st_mode;
if (S_ISDIR (src_type) && !x->recursive)
if (S_ISDIR (src_mode) && !x->recursive)
{
error (0, 0, _("omitting directory %s"), quote (src_name));
return false;
@@ -1036,34 +1031,57 @@ copy_internal (char const *src_name, char const *dst_name,
that it is XSTAT'able. */
bool return_now;
bool unlink_src;
bool ok = same_file_ok (src_name, &src_sb, dst_name, &dst_sb,
x, &return_now, &unlink_src);
if (unlink_src)
{
if (!abandon_move (x, dst_name, &dst_sb)
&& unlink (src_name) != 0)
{
error (0, errno, _("cannot remove %s"), quote (src_name));
return false;
}
/* Tell the caller that there's no need to remove src_name. */
if (rename_succeeded)
*rename_succeeded = true;
}
if (return_now)
return true;
if (! ok)
if (! same_file_ok (src_name, &src_sb, dst_name, &dst_sb,
x, &return_now, &unlink_src))
{
error (0, 0, _("%s and %s are the same file"),
quote_n (0, src_name), quote_n (1, dst_name));
return false;
}
/* When there is an existing destination file, we may end up
returning early, and hence not copying/moving the file.
This may be due to an interactive `negative' reply to the
prompt about the existing file. It may also be due to the
use of the --reply=no option.
cp and mv treat -i and -f differently. */
if (x->move_mode)
{
if (abandon_move (x, dst_name, &dst_sb)
|| (unlink_src && unlink (src_name) == 0))
{
/* Pretend the rename succeeded, so the caller (mv)
doesn't end up removing the source file. */
if (rename_succeeded)
*rename_succeeded = true;
if (unlink_src && x->verbose)
printf (_("removed %s\n"), quote (src_name));
return true;
}
if (unlink_src)
{
error (0, errno, _("cannot remove %s"), quote (src_name));
return false;
}
}
else
{
if (! S_ISDIR (src_mode)
&& (x->interactive == I_ALWAYS_NO
|| (x->interactive == I_ASK_USER
&& (overwrite_prompt (dst_name, &dst_sb), 1)
&& ! yesno ())))
return true;
}
if (return_now)
return true;
if (!S_ISDIR (dst_sb.st_mode))
{
if (S_ISDIR (src_type))
if (S_ISDIR (src_mode))
{
if (x->move_mode && x->backup_type != no_backups)
{
@@ -1097,7 +1115,7 @@ copy_internal (char const *src_name, char const *dst_name,
}
}
if (!S_ISDIR (src_type))
if (!S_ISDIR (src_mode))
{
if (S_ISDIR (dst_sb.st_mode))
{
@@ -1140,37 +1158,6 @@ copy_internal (char const *src_name, char const *dst_name,
}
}
/* When there is an existing destination file, we may end up
returning early, and hence not copying/moving the file.
This may be due to an interactive `negative' reply to the
prompt about the existing file. It may also be due to the
use of the --reply=no option. */
if (!S_ISDIR (src_type))
{
/* cp and mv treat -i and -f differently. */
if (x->move_mode)
{
if (abandon_move (x, dst_name, &dst_sb))
{
/* Pretend the rename succeeded, so the caller (mv)
doesn't end up removing the source file. */
if (rename_succeeded)
*rename_succeeded = true;
return true;
}
}
else
{
if (x->interactive == I_ALWAYS_NO
|| (x->interactive == I_ASK_USER
&& (overwrite_prompt (dst_name, &dst_sb), 1)
&& ! yesno ()))
{
return true;
}
}
}
if (x->move_mode)
{
/* Don't allow user to move a directory onto a non-directory. */
@@ -1187,7 +1174,13 @@ copy_internal (char const *src_name, char const *dst_name,
if (x->backup_type != no_backups
/* Don't try to back up a destination if the last
component of src_name is "." or "..". */
&& ! dot_or_dotdot (last_component (src_name)))
&& ! dot_or_dotdot (last_component (src_name))
/* Create a backup of each destination directory in move mode,
but not in copy mode. FIXME: it might make sense to add an
option to suppress backup creation also for move mode.
That would let one use mv to merge new content into an
existing hierarchy. */
&& (x->move_mode || ! S_ISDIR (dst_sb.st_mode)))
{
char *tmp_backup = find_backup_file_name (dst_name,
x->backup_type);
@@ -1250,6 +1243,8 @@ copy_internal (char const *src_name, char const *dst_name,
return false;
}
new_dst = true;
if (x->verbose)
printf (_("removed %s\n"), quote (dst_name));
}
}
}
@@ -1257,7 +1252,7 @@ copy_internal (char const *src_name, char const *dst_name,
/* If the source is a directory, we don't always create the destination
directory. So --verbose should not announce anything until we're
sure we'll create a directory. */
if (x->verbose && !S_ISDIR (src_type))
if (x->verbose && !S_ISDIR (src_mode))
emit_verbose (src_name, dst_name, backup_succeeded ? dst_backup : NULL);
/* Associate the destination file name with the source device and inode
@@ -1300,7 +1295,7 @@ copy_internal (char const *src_name, char const *dst_name,
|| (command_line_arg
&& x->dereference == DEREF_COMMAND_LINE_ARGUMENTS)
|| x->dereference == DEREF_ALWAYS))
|| (x->recursive && S_ISDIR (src_type)))
|| (x->recursive && S_ISDIR (src_mode)))
{
earlier_file = remember_copied (dst_name, src_sb.st_ino, src_sb.st_dev);
}
@@ -1313,7 +1308,7 @@ copy_internal (char const *src_name, char const *dst_name,
/* Avoid damaging the destination file system by refusing to preserve
hard-linked directories (which are found at least in Netapp snapshot
directories). */
if (S_ISDIR (src_type))
if (S_ISDIR (src_mode))
{
/* If src_name and earlier_file refer to the same directory entry,
then warn about copying a directory into itself. */
@@ -1354,6 +1349,8 @@ copy_internal (char const *src_name, char const *dst_name,
error (0, errno, _("cannot remove %s"), quote (dst_name));
goto un_backup;
}
if (x->verbose)
printf (_("removed %s\n"), quote (dst_name));
link_failed = (link (earlier_file, dst_name) != 0);
}
@@ -1372,7 +1369,7 @@ copy_internal (char const *src_name, char const *dst_name,
{
if (rename (src_name, dst_name) == 0)
{
if (x->verbose && S_ISDIR (src_type))
if (x->verbose && S_ISDIR (src_mode))
emit_verbose (src_name, dst_name,
backup_succeeded ? dst_backup : NULL);
@@ -1476,7 +1473,7 @@ copy_internal (char const *src_name, char const *dst_name,
In such cases, set this variable to zero. */
preserve_metadata = true;
if (S_ISDIR (src_type))
if (S_ISDIR (src_mode))
{
struct dir_list *dir;
@@ -1501,7 +1498,11 @@ copy_internal (char const *src_name, char const *dst_name,
if (new_dst || !S_ISDIR (dst_sb.st_mode))
{
if (mkdir (dst_name, src_mode) != 0)
/* POSIX says mkdir's behavior is implementation-defined when
(src_mode & ~S_IRWXUGO) != 0. However, common practice is
to ask mkdir to copy all the CHMOD_MODE_BITS, letting mkdir
decide what to do with S_ISUID | S_ISGID | S_ISVTX. */
if (mkdir (dst_name, src_mode & CHMOD_MODE_BITS) != 0)
{
error (0, errno, _("cannot create directory %s"),
quote (dst_name));
@@ -1575,8 +1576,8 @@ copy_internal (char const *src_name, char const *dst_name,
/* If either stat call fails, it's ok not to report
the failure and say dst_name is in the current
directory. Other things will fail later. */
|| stat (".", &dot_sb)
|| stat (dst_parent, &dst_parent_sb)
|| stat (".", &dot_sb) != 0
|| stat (dst_parent, &dst_parent_sb) != 0
|| SAME_INODE (dot_sb, dst_parent_sb));
free (dst_parent);
@@ -1619,34 +1620,39 @@ copy_internal (char const *src_name, char const *dst_name,
goto un_backup;
}
}
else if (S_ISREG (src_type)
|| (x->copy_as_regular && !S_ISLNK (src_type)))
else if (S_ISREG (src_mode)
|| (x->copy_as_regular && !S_ISLNK (src_mode)))
{
copied_as_regular = true;
/* POSIX says the permission bits of the source file must be
used as the 3rd argument in the open call, but that's not consistent
with historical practice. */
if (! copy_reg (src_name, dst_name, x, src_mode, &new_dst, &src_sb))
used as the 3rd argument in the open call. Historical
practice passed all the source mode bits to 'open', but the extra
bits were ignored, so it should be the same either way. */
if (! copy_reg (src_name, dst_name, x, src_mode & S_IRWXUGO,
&new_dst, &src_sb))
goto un_backup;
}
else if (S_ISFIFO (src_type))
else if (S_ISFIFO (src_mode))
{
if (mkfifo (dst_name, src_mode))
/* Use mknod, rather than mkfifo, because the former preserves
the special mode bits of a fifo on Solaris 10, while mkfifo
does not. */
if (mknod (dst_name, src_mode, 0) != 0)
{
error (0, errno, _("cannot create fifo %s"), quote (dst_name));
goto un_backup;
}
}
else if (S_ISBLK (src_type) || S_ISCHR (src_type) || S_ISSOCK (src_type))
else if (S_ISBLK (src_mode) || S_ISCHR (src_mode) || S_ISSOCK (src_mode))
{
if (mknod (dst_name, src_mode, src_sb.st_rdev))
if (mknod (dst_name, src_mode, src_sb.st_rdev) != 0)
{
error (0, errno, _("cannot create special file %s"),
quote (dst_name));
goto un_backup;
}
}
else if (S_ISLNK (src_type))
else if (S_ISLNK (src_mode))
{
char *src_link_val = xreadlink (src_name, src_sb.st_size);
if (src_link_val == NULL)

View File

@@ -428,7 +428,11 @@ make_dir_parents_private (char const *const_dir, size_t src_offset,
}
src_mode = stats.st_mode;
if (mkdir (dir, src_mode))
/* POSIX says mkdir's behavior is implementation-defined when
(src_mode & ~S_IRWXUGO) != 0. However, common practice is
to ask mkdir to copy all the CHMOD_MODE_BITS, letting mkdir
decide what to do with S_ISUID | S_ISGID | S_ISVTX. */
if (mkdir (dir, src_mode & CHMOD_MODE_BITS) != 0)
{
error (0, errno, _("cannot make directory %s"),
quote (dir));

View File

@@ -265,9 +265,9 @@ static struct symbol_value const flags[] =
{"direct", O_DIRECT},
{"directory", O_DIRECTORY},
{"dsync", O_DSYNC},
{"noatime", O_NOATIME},
{"noatime", HAVE_WORKING_O_NOATIME ? O_NOATIME : 0},
{"noctty", O_NOCTTY},
{"nofollow", O_NOFOLLOW},
{"nofollow", HAVE_WORKING_O_NOFOLLOW ? O_NOFOLLOW : 0},
{"nolinks", O_NOLINKS},
{"nonblock", O_NONBLOCK},
{"sync", O_SYNC},
@@ -451,7 +451,7 @@ Each CONV symbol may be:\n\
noerror continue after read errors\n\
sync pad every input block with NULs to ibs-size; when used\n\
with block or unblock, pad with spaces rather than NULs\n\
fdatasync physically write output file data before finishing\n\
fdatasync physically write output file data before finishing\n\
fsync likewise, but also write metadata\n\
"), stdout);
fputs (_("\
@@ -470,12 +470,12 @@ Each FLAG symbol may be:\n\
fputs (_(" sync likewise, but also for metadata\n"), stdout);
if (O_NONBLOCK)
fputs (_(" nonblock use non-blocking I/O\n"), stdout);
if (O_NOATIME)
if (HAVE_WORKING_O_NOATIME)
fputs (_(" noatime do not update access time\n"), stdout);
if (O_NOCTTY)
fputs (_(" noctty do not assign controlling terminal from file\n"),
stdout);
if (O_NOFOLLOW)
if (HAVE_WORKING_O_NOFOLLOW)
fputs (_(" nofollow do not follow symlinks\n"), stdout);
if (O_NOLINKS)
fputs (_(" nolinks fail if multiply-linked\n"), stdout);

View File

@@ -1,6 +1,6 @@
#!/bin/bash
# Copyright (C) 2003 Free Software Foundation, Inc.
# Copyright (C) 2003, 2006 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -18,11 +18,17 @@
cat - <<\EOF > /dev/null
Invoke e.g., like this
DU1=du-4.5.2 DU2=du ./du-tests
VG_PATH_PREFIX=/cu/src/vg: DU1=/cu/src/du DU2=/usr/bin/du ./du-tests
Where /cu/src/vg/du is a valgrind wrapper around du,
and DU1 refers to the just-built du binary you want to test.
EOF
test -x "$DU1" || { echo DU1 envvar not set; exit 1; }
test -x "$DU2" || { echo DU2 envvar not set; exit 1; }
test -z "$DU1" && { echo DU1 envvar not set 1>&2; exit 1; }
test -z "$DU2" && { echo DU2 envvar not set 1>&2; exit 1; }
test -x "$DU1" || { echo $DU1 not executable 1>&2; exit 1; }
test -x "$DU2" || { echo $DU2 not executable 1>&2; exit 1; }
# Expects $DU1 and $DU2 to be the binaries to compare.
d1=$(mktemp -d)
cp -a $DU1 $d1/du
@@ -47,6 +53,6 @@ for args in \
; do
echo Args: $args ======================
diff -u --label=$DU1 --label=$DU2 \
<(PATH=$d1 du $args 2>&1) <(PATH=$d2 du $args 2>&1)
<(PATH=$VG_PATH_PREFIX$d1 du $args 2>&1) <(PATH=$d2 du $args 2>&1)
done
rm -rf $d1 $d2

View File

@@ -1,6 +1,6 @@
#!/bin/sh
# groups -- print the groups a user is in
# Copyright (C) 1991, 1997, 2000, 2002, 2004 Free Software Foundation, Inc.
# Copyright (C) 1991, 1997, 2000, 2002, 2004, 2006 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -32,39 +32,52 @@ Same as id -Gn. If no USERNAME, use current process.
Report bugs to <@PACKAGE_BUGREPORT@>."
version='groups (@GNU_PACKAGE@) @VERSION@
Written by David MacKenzie.
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software. You may redistribute copies of it under the terms of
the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
There is NO WARRANTY, to the extent permitted by law.
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.'
Written by David MacKenzie.'
fail=0
for arg
do
case $arg in
--help | --hel | --he | --h)
exec echo "$usage" ;;
--version | --versio | --versi | --vers | --ver | --ve | --v)
exec echo "$version" ;;
--)
shift
break ;;
-*)
echo "$0: invalid option: $arg" >&2
exit 1 ;;
esac
done
# With fewer than two arguments, simply exec "id".
case $# in
1 )
case "z${1}" in
z--help )
echo "$usage" || fail=1; exit $fail;;
z--version )
echo "$version" || fail=1; exit $fail;;
* ) ;;
esac
;;
* ) ;;
0|1) exec id -Gn -- "$@" ;;
esac
if [ $# -eq 0 ]; then
id -Gn
fail=$?
else
for name in "$@"; do
groups=`id -Gn -- $name`
# With more, we need a loop, and be sure to exit nonzero upon failure.
status=0
write_error=0
for name
do
if groups=`id -Gn -- "$name"`; then
echo "$name : $groups" || {
status=$?
if test $write_error = 0; then
echo "$0: write error" >&2
write_error=1
fi
}
else
status=$?
if test $status = 0; then
echo $name : $groups
else
fail=$status
fi
done
fi
exit $fail
fi
done
exit $status

View File

@@ -79,7 +79,8 @@ static bool install_file_in_file (const char *from, const char *to,
static void get_ids (void);
static void strip (char const *name);
static void announce_mkdir (char const *dir, void *options);
static int make_ancestor (char const *dir, void *options);
static int make_ancestor (char const *dir, char const *component,
void *options);
void usage (int status);
/* The name this program was run with, for error messages. */
@@ -629,11 +630,13 @@ announce_mkdir (char const *dir, void *options)
error (0, 0, _("creating directory %s"), quote (dir));
}
/* Make ancestor directory DIR, with options OPTIONS. */
/* Make ancestor directory DIR, whose last file name component is
COMPONENT, with options OPTIONS. Assume the working directory is
COMPONENT's parent. */
static int
make_ancestor (char const *dir, void *options)
make_ancestor (char const *dir, char const *component, void *options)
{
int r = mkdir (dir, DEFAULT_MODE);
int r = mkdir (component, DEFAULT_MODE);
if (r == 0)
announce_mkdir (dir, options);
return r;

View File

@@ -112,8 +112,9 @@ target_directory_operand (char const *file)
size_t blen = strlen (b);
bool looks_like_a_dir = (blen == 0 || ISSLASH (b[blen - 1]));
struct stat st;
int err = ((dereference_dest_dir_symlinks ? stat : lstat) (file, &st) == 0
? 0 : errno);
int stat_result =
(dereference_dest_dir_symlinks ? stat (file, &st) : lstat (file, &st));
int err = (stat_result == 0 ? 0 : errno);
bool is_a_dir = !err && S_ISDIR (st.st_mode);
if (err && err != ENOENT)
error (EXIT_FAILURE, err, _("accessing %s"), quote (file));
@@ -254,7 +255,7 @@ do_link (const char *source, const char *dest)
Try to unlink DEST even if we may have backed it up successfully.
In some unusual cases (when DEST and DEST_BACKUP are hard-links
that refer to the same file), rename succeeds and DEST remains.
If we didn't remove DEST in that case, the subsequent LINKFUNC
If we didn't remove DEST in that case, the subsequent symlink or link
call would fail. */
if (!ok && errno == EEXIST && (remove_existing_files || dest_backup))

View File

@@ -3604,8 +3604,7 @@ quote_name (FILE *out, const char *name, struct quoting_options const *options,
reach its end, replacing each non-printable multibyte
character with a single question mark. */
{
mbstate_t mbstate;
memset (&mbstate, 0, sizeof mbstate);
mbstate_t mbstate = { 0, };
do
{
wchar_t wc;
@@ -4313,7 +4312,7 @@ Mandatory arguments to long options are mandatory for short options too.\n\
fputs (_("\
-r, --reverse reverse order while sorting\n\
-R, --recursive list subdirectories recursively\n\
-s, --size with -l, print size of each file, in blocks\n\
-s, --size print the size of each file, in blocks\n\
"), stdout);
fputs (_("\
-S sort by file size\n\

View File

@@ -81,7 +81,7 @@ struct mkdir_options
{
/* Function to make an ancestor, or NULL if ancestors should not be
made. */
int (*make_ancestor_function) (char const *, void *);
int (*make_ancestor_function) (char const *, char const *, void *);
/* Mode for ancestor directory. */
mode_t ancestor_mode;
@@ -105,15 +105,16 @@ announce_mkdir (char const *dir, void *options)
error (0, 0, o->created_directory_format, quote (dir));
}
/* Make ancestor directory DIR, with options OPTIONS. Return 0 if
successful and the resulting directory is readable, 1 if successful
but the resulting directory is not readable, -1 (setting errno)
otherwise. */
/* Make ancestor directory DIR, whose last component is COMPONENT,
with options OPTIONS. Assume the working directory is COMPONENT's
parent. Return 0 if successful and the resulting directory is
readable, 1 if successful but the resulting directory is not
readable, -1 (setting errno) otherwise. */
static int
make_ancestor (char const *dir, void *options)
make_ancestor (char const *dir, char const *component, void *options)
{
struct mkdir_options const *o = options;
int r = mkdir (dir, o->ancestor_mode);
int r = mkdir (component, o->ancestor_mode);
if (r == 0)
{
r = ! (o->ancestor_mode & S_IRUSR);

View File

@@ -388,7 +388,7 @@ of output. \
"), stdout);
fputs (_("\
--string without a number implies 3. --width without a number\n\
implies 32. By default, od uses -A o -t d2 -w 16.\n\
implies 32. By default, od uses -A o -t d2 -w16.\n\
"), stdout);
printf (_("\nReport bugs to <%s>.\n"), PACKAGE_BUGREPORT);
}

View File

@@ -1,5 +1,5 @@
/* pathchk -- check whether file names are valid or portable
Copyright (C) 1991-2005 Free Software Foundation, Inc.
Copyright (C) 1991-2006 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -200,7 +200,7 @@ portable_chars_only (char const *file, size_t filelen)
if (*invalid)
{
mbstate_t mbstate = {0};
mbstate_t mbstate = { 0, };
size_t charlen = mbrlen (invalid, filelen - validlen, &mbstate);
error (0, 0,
_("nonportable character %s in file name %s"),

View File

@@ -40,10 +40,6 @@
# define MAXHOSTNAMELEN 64
#endif
#ifndef S_IWGRP
# define S_IWGRP 020
#endif
char *ttyname ();
/* The name this program was run with. */

View File

@@ -50,19 +50,26 @@
#define obstack_chunk_free free
/* This is the maximum number of consecutive readdir/unlink calls that
can be made (with no intervening rewinddir or closedir/opendir)
before triggering a bug that makes readdir return NULL even though
some directory entries have not been processed. The bug afflicts
SunOS's readdir when applied to ufs file systems and Darwin 6.5's
(and OSX v.10.3.8's) HFS+. This maximum is conservative in that
demonstrating the problem seems to require a directory containing
at least 254 deletable entries (which doesn't count . and ..), so
we could conceivably increase the maximum value to 254. */
can be made (with no intervening rewinddir or closedir/opendir) before
triggering a bug that makes readdir return NULL even though some
directory entries have not been processed. The bug afflicts SunOS's
readdir when applied to ufs file systems and Darwin 6.5's (and OSX
v.10.3.8's) HFS+. This maximum is conservative in that demonstrating
the problem requires a directory containing at least 16 deletable
entries (which doesn't count . and ..).
This problem also affects Darwin 7.9.0 (aka MacOS X 10.3.9) on HFS+
and NFS-mounted file systems, but not vfat ones. */
enum
{
CONSECUTIVE_READDIR_UNLINK_THRESHOLD = 200
CONSECUTIVE_READDIR_UNLINK_THRESHOLD = 10
};
/* FIXME: in 2009, or whenever Darwin 7.9.0 (aka MacOS X 10.3.9) is no
longer relevant, remove this work-around code. Then, there will be
no need to perform the extra rewinddir call, ever. */
#define NEED_REWIND(readdir_unlink_count) \
(CONSECUTIVE_READDIR_UNLINK_THRESHOLD <= (readdir_unlink_count))
enum Ternary
{
T_UNKNOWN = 2,
@@ -614,7 +621,7 @@ AD_push (int fd_cwd, Dirstack_state *ds, char const *dir,
/* If our uses of openat are guaranteed not to
follow a symlink, then we can skip this check. */
if ( ! O_NOFOLLOW)
if (! HAVE_WORKING_O_NOFOLLOW)
{
struct stat sb;
if (fstat (fd_cwd, &sb) != 0)
@@ -892,7 +899,7 @@ is_dir_lstat (char const *filename, struct stat *st)
return RM_OK; \
} \
\
if (errno == ENOENT && (X)->ignore_missing_files) \
if (ignorable_missing (X, errno)) \
return RM_OK; \
} \
while (0)
@@ -908,7 +915,7 @@ is_dir_lstat (char const *filename, struct stat *st)
return RM_OK; \
} \
\
if (errno == ENOENT && (X)->ignore_missing_files) \
if (ignorable_missing (X, errno)) \
return RM_OK; \
\
if (errno == ENOTEMPTY || errno == EEXIST) \
@@ -916,6 +923,35 @@ is_dir_lstat (char const *filename, struct stat *st)
} \
while (0)
/* When a function like unlink, rmdir, or fstatat fails with an errno
value of ERRNUM, return true if the specified file system object
is guaranteed not to exist; otherwise, return false. */
static inline bool
nonexistent_file_errno (int errnum)
{
/* Do not include ELOOP here, since the specified file may indeed
exist, but be (in)accessible only via too long a symlink chain.
Likewise for ENAMETOOLONG, since rm -f ./././.../foo may fail
if the "..." part expands to a long enough sequence of "./"s,
even though ./foo does indeed exist. */
switch (errnum)
{
case ENOENT:
case ENOTDIR:
return true;
default:
return false;
}
}
/* Encapsulate the test for whether the errno value, ERRNUM, is ignorable. */
static inline bool
ignorable_missing (struct rm_options const *x, int errnum)
{
return x->ignore_missing_files && nonexistent_file_errno (errnum);
}
/* Remove the file or directory specified by FILENAME.
Return RM_OK if it is removed, and RM_ERROR or RM_USER_DECLINED if not.
But if FILENAME specifies a non-empty directory, return RM_NONEMPTY_DIR. */
@@ -983,6 +1019,9 @@ remove_entry (int fd_cwd, Dirstack_state const *ds, char const *filename,
|| errno == ENOENT || errno == ENOTDIR
|| errno == ELOOP || errno == ENAMETOOLONG)
{
if (ignorable_missing (x, errno))
return RM_OK;
/* Either --recursive is not in effect, or the file cannot be a
directory. Report the unlink problem and fail. */
error (0, errno, _("cannot remove %s"),
@@ -1007,7 +1046,7 @@ remove_entry (int fd_cwd, Dirstack_state const *ds, char const *filename,
{
if (fstatat (fd_cwd, filename, st, AT_SYMLINK_NOFOLLOW))
{
if (errno == ENOENT && x->ignore_missing_files)
if (ignorable_missing (x, errno))
return RM_OK;
error (0, errno, _("cannot remove %s"),
@@ -1138,8 +1177,7 @@ remove_cwd_entries (DIR **dirp,
{
/* fall through */
}
else if (CONSECUTIVE_READDIR_UNLINK_THRESHOLD
< n_unlinked_since_opendir_or_last_rewind)
else if (NEED_REWIND (n_unlinked_since_opendir_or_last_rewind))
{
/* Call rewinddir if we've called unlink or rmdir so many times
(since the opendir or the previous rewinddir) that this
@@ -1189,7 +1227,7 @@ remove_cwd_entries (DIR **dirp,
/* CAUTION: this test and diagnostic are identical to
those following the other use of fd_to_subdirp. */
if (errno == ENOENT && x->ignore_missing_files)
if (ignorable_missing (x, errno))
{
/* With -f, don't report "file not found". */
}
@@ -1275,7 +1313,7 @@ remove_dir (int fd_cwd, Dirstack_state *ds, char const *dir,
{
/* CAUTION: this test and diagnostic are identical to
those following the other use of fd_to_subdirp. */
if (errno == ENOENT && x->ignore_missing_files)
if (ignorable_missing (x, errno))
{
/* With -f, don't report "file not found". */
}
@@ -1420,7 +1458,7 @@ rm_1 (Dirstack_state *ds, char const *filename,
{
if (cache_fstatat (AT_FDCWD, filename, &st, AT_SYMLINK_NOFOLLOW) != 0)
{
if (errno == ENOENT && x->ignore_missing_files)
if (ignorable_missing (x, errno))
return RM_OK;
error (0, errno, _("cannot remove %s"), quote (filename));
return RM_ERROR;

View File

@@ -1091,7 +1091,7 @@ int
main (int argc, char **argv)
{
bool ok = true;
struct Options flags;
struct Options flags = { 0, };
char **file;
int n_files;
int c;
@@ -1106,8 +1106,6 @@ main (int argc, char **argv)
atexit (close_stdout);
memset (&flags, 0, sizeof flags);
flags.n_iterations = DEFAULT_PASSES;
flags.size = -1;

View File

@@ -178,7 +178,7 @@ read_input (FILE *in, char eolbyte, char ***pline)
do
{
if (alloc == used)
if (alloc <= used + 1)
{
if (alloc == SIZE_MAX)
xalloc_die ();
@@ -279,6 +279,7 @@ main (int argc, char **argv)
{
unsigned long int argval = 0;
char *p = strchr (optarg, '-');
char const *hi_optarg = optarg;
bool invalid = !p;
if (input_numbers_option_used (lo_input, hi_input))
@@ -292,10 +293,10 @@ main (int argc, char **argv)
|| SIZE_MAX < argval);
*p = '-';
lo_input = argval;
optarg = p + 1;
hi_optarg = p + 1;
}
invalid |= ((xstrtoul (optarg, NULL, 10, &argval, NULL)
invalid |= ((xstrtoul (hi_optarg, NULL, 10, &argval, NULL)
!= LONGINT_OK)
|| SIZE_MAX < argval);
hi_input = argval;

View File

@@ -337,7 +337,7 @@ Other options:\n\
fputs (_("\
\n\
POS is F[.C][OPTS], where F is the field number and C the character position\n\
in the field. If neither the -t nor the -b option is in effect, the characters\n\
in the field; both are origin 1. If neither -t nor -b is in effect, characters\n\
in a field are counted from the beginning of the preceding whitespace. OPTS is\n\
one or more single-letter ordering options, which override global ordering\n\
options for that key. If no key is given, use the entire line as the key.\n\

View File

@@ -729,7 +729,10 @@ settings, CHAR is taken literally, or coded as in ^c, 0x37, 0177 or\n\
int
main (int argc, char **argv)
{
struct termios mode;
/* Initialize to all zeroes so there is no risk memcmp will report a
spurious difference in an uninitialized portion of the structure. */
struct termios mode = { 0, };
enum output_type output_type;
int optc;
int argi = 0;
@@ -840,9 +843,6 @@ main (int argc, char **argv)
else
device_name = _("standard input");
/* Initialize to all zeroes so there is no risk memcmp will report a
spurious difference in an uninitialized portion of the structure. */
memset (&mode, 0, sizeof (mode));
if (tcgetattr (STDIN_FILENO, &mode))
error (EXIT_FAILURE, errno, "%s", device_name);
@@ -1002,7 +1002,9 @@ main (int argc, char **argv)
if (require_set_attr)
{
struct termios new_mode;
/* Initialize to all zeroes so there is no risk memcmp will report a
spurious difference in an uninitialized portion of the structure. */
struct termios new_mode = { 0, };
if (tcsetattr (STDIN_FILENO, TCSADRAIN, &mode))
error (EXIT_FAILURE, errno, "%s", device_name);
@@ -1014,9 +1016,6 @@ main (int argc, char **argv)
this partial failure, get the current terminal attributes and
compare them to the requested ones. */
/* Initialize to all zeroes so there is no risk memcmp will report a
spurious difference in an uninitialized portion of the structure. */
memset (&new_mode, 0, sizeof (new_mode));
if (tcgetattr (STDIN_FILENO, &new_mode))
error (EXIT_FAILURE, errno, "%s", device_name);

View File

@@ -117,18 +117,7 @@ you must include <sys/types.h> before including this file
#include <stdbool.h>
#include <stdlib.h>
/* The following test is to work around the gross typo in
systems like Sony NEWS-OS Release 4.0C, whereby EXIT_FAILURE
is defined to 0, not 1. */
#if !EXIT_FAILURE
# undef EXIT_FAILURE
# define EXIT_FAILURE 1
#endif
#ifndef EXIT_SUCCESS
# define EXIT_SUCCESS 0
#endif
#include <exit.h>
/* Exit statuses for programs like 'env' that exec other programs.
EXIT_FAILURE might not be 1, so use EXIT_FAIL in such programs. */
@@ -206,11 +195,14 @@ enum
/* Some systems, like Sequents, return st_blksize of 0 on pipes.
Also, when running `rsh hpux11-system cat any-file', cat would
determine that the output stream had an st_blksize of 2147421096.
So here we arbitrarily limit the `optimal' block size to 4MB.
If anyone knows of a system for which the legitimate value for
st_blksize can exceed 4MB, please report it as a bug in this code. */
Conversely st_blksize can be 2 GiB (or maybe even larger) with XFS
on 64-bit hosts. Somewhat arbitrarily, limit the `optimal' block
size to SIZE_MAX / 8 + 1. (Dividing SIZE_MAX by only 4 wouldn't
suffice, since "cat" sometimes multiplies the result by 4.) If
anyone knows of a system for which this limit is too small, please
report it as a bug in this code. */
# define ST_BLKSIZE(statbuf) ((0 < (statbuf).st_blksize \
&& (statbuf).st_blksize <= (1 << 22)) /* 4MB */ \
&& (statbuf).st_blksize <= SIZE_MAX / 8 + 1) \
? (statbuf).st_blksize : DEV_BSIZE)
# if defined hpux || defined __hpux__ || defined __hpux
/* HP-UX counts st_blocks in 1024-byte units.

View File

@@ -1177,9 +1177,8 @@ card_of_complement (struct Spec_list *s)
{
int c;
int cardinality = N_CHARS;
bool in_set[N_CHARS];
bool in_set[N_CHARS] = { 0, };
memset (in_set, 0, sizeof in_set);
s->state = BEGIN_STATE;
while ((c = get_next (s, NULL)) != -1)
{

View File

@@ -273,7 +273,7 @@ wc (int fd, char const *file_x, struct fstatus *fstatus)
{
bool in_word = false;
uintmax_t linepos = 0;
mbstate_t state;
mbstate_t state = { 0, };
uintmax_t last_error_line = 0;
int last_error_errno = 0;
# if SUPPORT_OLD_MBRTOWC
@@ -289,7 +289,6 @@ wc (int fd, char const *file_x, struct fstatus *fstatus)
const size_t prev = 0;
# endif
memset (&state, 0, sizeof (mbstate_t));
while ((bytes_read = safe_read (fd, buf + prev, BUFFER_SIZE - prev)) > 0)
{
const char *p;

View File

@@ -320,7 +320,9 @@ print_user (const STRUCT_UTMP *utmp_ent, time_t boottime)
char mesg;
char idlestr[IDLESTR_LEN + 1];
static char *hoststr;
#if HAVE_UT_HOST
static size_t hostlen;
#endif
#define DEV_DIR_WITH_TRAILING_SLASH "/dev/"
#define DEV_DIR_LEN (sizeof (DEV_DIR_WITH_TRAILING_SLASH) - 1)

View File

@@ -30,7 +30,7 @@ fi
pwd=`pwd`
tmp=basic.$$
trap 'status=$?; cd $pwd; rm -rf $tmp && exit $status' 0
trap 'status=$?; cd "$pwd" && rm -rf $tmp && exit $status' 0
trap '(exit $?); exit' 1 2 13 15
framework_failure=0
@@ -73,11 +73,10 @@ chgrp $g2 d ||fail=1; test `stat --p=%g: $d_files` = "$g2:$g1:" || fail=1
rm -f f
touch f
ln -s f symlink
chgrp $g1 f; test `stat --printf=%g f` = $g1 || fail=1
chgrp $g1 f
test `stat --printf=%g f` = $g1 || fail=1
# This should not change the group of f.
test `stat --printf=%g f` = $g1 || fail=1
test `stat --printf=%g symlink` = $g1 || fail=1
chgrp -h $g2 symlink
test `stat --printf=%g f` = $g1 || fail=1
test `stat --printf=%g symlink` = $g2 || fail=1

View File

@@ -1,7 +1,7 @@
#!/bin/sh
# see if chgrp can change the group of a symlink
# Copyright (C) 2000, 2004, 2005 Free Software Foundation, Inc.
# Copyright (C) 2000, 2004, 2005, 2006 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,7 +27,7 @@ fi
pwd=`pwd`
tmp=slink.$$
trap 'status=$?; cd $pwd; rm -rf $tmp && exit $status' 0
trap 'status=$?; cd "$pwd" && rm -rf $tmp && exit $status' 0
trap '(exit $?); exit' 1 2 13 15
framework_failure=0

View File

@@ -34,7 +34,7 @@ PRIV_CHECK_ARG=require-non-root . $srcdir/../priv-check
pwd=`pwd`
t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
trap 'status=$?; cd $pwd; chmod -R u+rwx $t0; rm -rf $t0 && exit $status' 0
trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
trap '(exit $?); exit $?' 1 2 13 15
framework_failure=0

View File

@@ -1,7 +1,7 @@
#!/bin/sh
# Test POSIX-mandated -H option.
# Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
# Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -30,7 +30,7 @@ g2=$2
pwd=`pwd`
t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
trap 'status=$?; cd $pwd; chmod -R u+rwx $t0; rm -rf $t0 && exit $status' 0
trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
trap '(exit $?); exit $?' 1 2 13 15
framework_failure=0
@@ -50,7 +50,7 @@ fi
fail=0
chgrp -H -R $g2 1s 2 || fail=1
chgrp --preserve-root -H -R $g2 1s 2 || fail=1
# These must have group $g2.
# =========================

View File

@@ -1,7 +1,7 @@
#!/bin/sh
# ad-hoc tests of chgrp with -R and -H or -L and symlinks
# Copyright (C) 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
# Copyright (C) 2000, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,7 +27,7 @@ fi
pwd=`pwd`
tmp=recurse.$$
trap 'status=$?; cd $pwd; rm -rf $tmp && exit $status' 0
trap 'status=$?; cd "$pwd" && rm -rf $tmp && exit $status' 0
trap '(exit $?); exit' 1 2 13 15
framework_failure=0

View File

@@ -1,7 +1,17 @@
## Process this file with automake to produce Makefile.in -*-Makefile-*-.
AUTOMAKE_OPTIONS = 1.4 gnits
TESTS = octal no-x equals equal-x c-option setgid umask-x usage
TESTS = \
inaccessible \
c-option \
equal-x \
equals \
no-x \
octal \
setgid \
umask-x \
usage
EXTRA_DIST = $(TESTS)
TESTS_ENVIRONMENT = \
PATH="$(VG_PATH_PREFIX)`pwd`/../../src$(PATH_SEPARATOR)$$PATH"

View File

@@ -1,7 +1,7 @@
#!/bin/sh
# Verify that chmod's --changes (-c) option works.
# Copyright (C) 2000, 2004 Free Software Foundation, Inc.
# Copyright (C) 2000, 2004, 2006 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,7 +27,7 @@ fi
pwd=`pwd`
tmp=c-option.$$
trap 'status=$?; cd $pwd; rm -rf $tmp && exit $status' 0
trap 'status=$?; cd "$pwd" && rm -rf $tmp && exit $status' 0
trap '(exit $?); exit' 1 2 13 15
framework_failure=0
@@ -36,7 +36,7 @@ framework_failure=0
cd $srcdir || framework_failure=1
abs_srcdir=`pwd`
cd $pwd || framework_failure=1
cd "$pwd" || framework_failure=1
mkdir $tmp || framework_failure=1
cd $tmp || framework_failure=1
@@ -50,7 +50,7 @@ if test $framework_failure = 1; then
(exit 1); exit 1
fi
. $abs_srcdir/../setgid-check
. "$abs_srcdir"/../setgid-check
fail=0

View File

@@ -1,7 +1,7 @@
#!/bin/sh
# Test "chmod =x" and the like.
# Copyright (C) 1999, 2000, 2002, 2004, 2005 Free Software Foundation,
# Copyright (C) 1999, 2000, 2002, 2004, 2005, 2006 Free Software Foundation,
# Inc.
# This program is free software; you can redistribute it and/or modify
@@ -26,7 +26,7 @@ fi
pwd=`pwd`
t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
trap 'status=$?; cd $pwd; chmod -R u+rwx $t0; rm -rf $t0 && exit $status' 0
trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
trap '(exit $?); exit' 1 2 13 15
framework_failure=0

View File

@@ -3,7 +3,7 @@
# Before fileutils-4.1.2, some of them didn't.
# Also, before coreutils-5.3.1, =[ugo] sometimes didn't work.
# Copyright (C) 2001, 2002, 2004, 2005 Free Software Foundation,
# Copyright (C) 2001, 2002, 2004, 2005, 2006 Free Software Foundation,
# Inc.
# This program is free software; you can redistribute it and/or modify
@@ -28,7 +28,7 @@ fi
pwd=`pwd`
tmp=equals.$$
trap 'status=$?; cd $pwd; rm -rf $tmp && exit $status' 0
trap 'status=$?; cd "$pwd" && rm -rf $tmp && exit $status' 0
trap '(exit $?); exit' 1 2 13 15
framework_failure=0

47
tests/ls/Test.pm → tests/chmod/inaccessible Normal file → Executable file
View File

@@ -1,6 +1,7 @@
# Test "ls".
#!/bin/sh
# Test for the bug fixed on 2006-09-20.
# Copyright (C) 1997 Free Software Foundation, Inc.
# Copyright (C) 2006 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -17,30 +18,30 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
package Test;
require 5.002;
use strict;
if test "$VERBOSE" = yes; then
set -x
chmod --version
fi
$Test::input_via_default = {FILE => 0};
pwd=`pwd`
t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
trap '(exit $?); exit $?' 1 2 13 15
my @tv = (
# test name, options, input, expected output, expected return code
#
['q1', '-b', sub{('""""" "', 'b')}, '"""""\\ " b', 0],
['q2', '-b -Q', sub{('""""" "', 'b')}, '\\"\\"\\"\\"\\"\\ \\" b', 0],
);
framework_failure=0
mkdir -p $tmp || framework_failure=1
cd $tmp || framework_failure=1
sub test_vector
{
my $t;
foreach $t (@tv)
{
# FIXME: append newline
my ($test_name, $flags, $in, $exp, $ret) = @$t;
mkdir -p d/e
chmod 0 d/e d
}
if test $framework_failure = 1; then
echo "$0: failure in testing framework" 1>&2
(exit 1); exit 1
fi
return @tv;
}
fail=0
1;
chmod u+rwx d d/e || fail=1
(exit $fail); exit $fail

View File

@@ -29,7 +29,7 @@ PRIV_CHECK_ARG=require-non-root . $srcdir/../priv-check
pwd=`pwd`
t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
trap 'status=$?; cd $pwd; chmod -R u+rwx $t0; rm -rf $t0 && exit $status' 0
trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
trap '(exit $?); exit $?' 1 2 13 15
framework_failure=0

View File

@@ -1,7 +1,7 @@
#!/bin/sh
# ensure that chmod diagnoses a certain type of invalid mode string
# Copyright (C) 2005 Free Software Foundation, Inc.
# Copyright (C) 2005, 2006 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@ fi
pwd=`pwd`
t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
trap 'status=$?; cd $pwd; chmod -R u+rwx $t0; rm -rf $t0 && exit $status' 0
trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
trap '(exit $?); exit $?' 1 2 13 15
framework_failure=0

View File

@@ -29,7 +29,7 @@ fi
pwd=`pwd`
tmp=setgid.$$
trap 'status=$?; cd $pwd; rm -rf $tmp && exit $status' 0
trap 'status=$?; cd "$pwd" && rm -rf $tmp && exit $status' 0
trap '(exit $?); exit' 1 2 13 15
framework_failure=0

View File

@@ -1,7 +1,7 @@
#!/bin/sh
# Test that chmod -x file reports an error if the result is executable.
# Copyright (C) 2005 Free Software Foundation, Inc.
# Copyright (C) 2005, 2006 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,7 +27,7 @@ fi
pwd=`pwd`
tmp=minus.$$
trap 'status=$?; cd $pwd; rm -rf $tmp && exit $status' 0
trap 'status=$?; cd "$pwd" && rm -rf $tmp && exit $status' 0
trap '(exit $?); exit' 1 2 13 15
framework_failure=0

View File

@@ -1,7 +1,7 @@
#!/bin/sh
# Verify that chmod works correctly with odd option combinations.
# Copyright (C) 2004, 2005 Free Software Foundation, Inc.
# Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,7 +27,7 @@ fi
pwd=`pwd`
t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
trap 'status=$?; cd $pwd; chmod -R u+rwx $t0; rm -rf $t0 && exit $status' 0
trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
trap '(exit $?); exit $?' 1 2 13 15
framework_failure=0

View File

@@ -1,7 +1,7 @@
#!/bin/sh
# make sure chown --from=... works
# Copyright (C) 2001, 2004 Free Software Foundation, Inc.
# Copyright (C) 2001, 2004, 2006 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -29,7 +29,7 @@ PRIV_CHECK_ARG=require-root . $srcdir/../priv-check
pwd=`pwd`
tmp=basic.$$
trap 'status=$?; cd $pwd; rm -rf $tmp && exit $status' 0
trap 'status=$?; cd "$pwd" && rm -rf $tmp && exit $status' 0
trap '(exit $?); exit' 1 2 13 15
framework_failure=0

View File

@@ -2,7 +2,7 @@
# For coreutils-5.2.1 and earlier, chown --dereference would skip
# symlinks having owner/group matching the specified owner/group.
# Copyright (C) 2004 Free Software Foundation, Inc.
# Copyright (C) 2004, 2006 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -28,7 +28,7 @@ fi
pwd=`pwd`
t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
trap 'status=$?; cd $pwd; chmod -R u+rwx $t0; rm -rf $t0 && exit $status' 0
trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
trap '(exit $?); exit $?' 1 2 13 15
framework_failure=0
@@ -50,7 +50,7 @@ chown --dereference $user dangle 2> out1 && fail=1
sed 's/: [^:]*$//' out1 > out
cat <<\EOF > exp || fail=1
chown: changing ownership of `dangle'
chown: cannot dereference `dangle'
EOF
cmp out exp || fail=1

View File

@@ -1,7 +1,7 @@
#!/bin/sh
# Make sure "chown USER:GROUP FILE" works, and similar tests with separators.
# Copyright (C) 2004, 2005 Free Software Foundation, Inc.
# Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@ fi
pwd=`pwd`
t0=`echo "$0" |sed 's,.*/,,'`.tmp; tmp=$t0/$$
trap 'status=$?; cd $pwd; chmod -R u+rwx $t0; rm -rf $t0 && exit $status' 0
trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
trap 'status=$?; (exit $status); exit $status' 1 2 13 15
framework_failure=0

View File

@@ -21,6 +21,7 @@
AUTOMAKE_OPTIONS = 1.1 gnits
TESTS = \
backup-dir \
src-base-dot \
sparse \
link-no-deref \
@@ -29,7 +30,7 @@ TESTS = \
preserve-2 r-vs-symlink link-preserve \
backup-1 no-deref-link1 no-deref-link2 no-deref-link3 backup-is-src \
same-file cp-mv-backup symlink-slash slink-2-slink fail-perm dir-slash \
perm cp-HL special-bits link dir-rm-dest cp-parents deref-slink \
perm cp-HL cp-i special-bits link dir-rm-dest cp-parents deref-slink \
dir-vs-file into-self
EXTRA_DIST = $(TESTS) trailing-slash
TESTS_ENVIRONMENT = \

View File

@@ -39,7 +39,7 @@ fi
pwd=`pwd`
t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
trap 'status=$?; cd $pwd; chmod -R u+rwx $t0; rm -rf $t0 && exit $status' 0
trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
trap '(exit $?); exit $?' 1 2 13 15
framework_failure=0

View File

@@ -1,7 +1,7 @@
#!/bin/sh
# Test cp backup.
# Copyright (C) 1997, 1999, 2002, 2004 Free Software Foundation, Inc.
# Copyright (C) 1997, 1999, 2002, 2004, 2006 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@ fi
pwd=`pwd`
t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
trap 'status=$?; cd $pwd; rm -rf $t0 && exit $status' 0
trap 'status=$?; cd "$pwd" && rm -rf $t0 && exit $status' 0
trap '(exit $?); exit' 1 2 13 15
framework_failure=0

52
tests/cp/backup-dir Executable file
View File

@@ -0,0 +1,52 @@
#!/bin/sh
# Ensure that cp -b doesn't back up directories.
# Copyright (C) 2006 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
if test "$VERBOSE" = yes; then
set -x
cp --version
fi
. $srcdir/../envvar-check
pwd=`pwd`
t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
trap '(exit $?); exit $?' 1 2 13 15
framework_failure=0
mkdir -p $tmp || framework_failure=1
cd $tmp || framework_failure=1
mkdir x y || framework_failure=1
if test $framework_failure = 1; then
echo "$0: failure in testing framework" 1>&2
(exit 1); exit 1
fi
fail=0
cp -a x y || fail=1
# This would mistakenly create a backup of y/x (y/x~) in coreutils-6.3.
cp -ab x y || fail=1
test -d y/x || fail=1
test -d y/x~ && fail=1
(exit $fail); exit $fail

View File

@@ -1,7 +1,7 @@
#!/bin/sh
# Test cp backup to source file.
# Copyright (C) 1998, 1999, 2000, 2002, 2004 Free Software Foundation,
# Copyright (C) 1998, 1999, 2000, 2002, 2004, 2006 Free Software Foundation,
# Inc.
# This program is free software; you can redistribute it and/or modify
@@ -29,7 +29,7 @@ fi
pwd=`pwd`
t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
trap 'status=$?; cd $pwd; rm -rf $t0 && exit $status' 0
trap 'status=$?; cd "$pwd" && rm -rf $t0 && exit $status' 0
trap '(exit $?); exit' 1 2 13 15
framework_failure=0

View File

@@ -1,7 +1,7 @@
#!/bin/sh
# test cp's -H and -L options
# Copyright (C) 2000, 2002, 2004 Free Software Foundation, Inc.
# Copyright (C) 2000, 2002, 2004, 2006 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,7 +27,7 @@ fi
pwd=`pwd`
t0=`echo "$0"|sed 's,.*/,,'`.tmp;tmp=$t0/$$
trap 'status=$?; cd $pwd; rm -rf $t0 && exit $status' 0
trap 'status=$?; cd "$pwd" && rm -rf $t0 && exit $status' 0
trap 'exit $?' 1 2 13 15
framework_failure=0

View File

@@ -26,7 +26,7 @@ fi
pwd=`pwd`
t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
trap 'status=$?; cd $pwd; chmod -R u+rwx $t0; rm -rf $t0 && exit $status' 0
trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
trap '(exit $?); exit $?' 1 2 13 15
framework_failure=0

51
tests/cp/cp-i Executable file
View File

@@ -0,0 +1,51 @@
#!/bin/sh
# Test whether cp -i prompts in the right place.
# Copyright (C) 2006 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
if test "$VERBOSE" = yes; then
set -x
cp --version
fi
. $srcdir/../envvar-check
. $srcdir/../lang-default
pwd=`pwd`
t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
trap '(exit $?); exit $?' 1 2 13 15
framework_failure=0
mkdir -p $tmp || framework_failure=1
cd $tmp || framework_failure=1
mkdir -p a b/a/c || framework_failure=1
touch a/c || framework_failure=1
if test $framework_failure = 1; then
echo "$0: failure in testing framework" 1>&2
(exit 1); exit 1
fi
fail=0
# coreutils 6.2 cp would neglect to prompt in this case.
echo n | cp -iR a b 2>/dev/null || fail=1
(exit $fail); exit $fail

View File

@@ -1,7 +1,7 @@
#!/bin/sh
# Test basic --backup functionality for both cp and mv.
# Copyright (C) 1999, 2000, 2002, 2004 Free Software Foundation, Inc.
# Copyright (C) 1999, 2000, 2002, 2004, 2006 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -36,7 +36,7 @@ umask 022
pwd=`pwd`
t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
trap 'status=$?; cd $pwd; exec 1>&2; rm -rf $t0 && exit $status' 0
trap 'status=$?; cd "$pwd" && exec 1>&2; rm -rf $t0 && exit $status' 0
trap '(exit $?); exit' 1 2 13 15
framework_failure=0

View File

@@ -2,7 +2,7 @@
# cp -R --parents dir-specified-with-trailing-slash/ other-dir
# would get a failed assertion.
# Copyright (C) 2000, 2002, 2004, 2005 Free Software Foundation, Inc.
# Copyright (C) 2000, 2002, 2004, 2005, 2006 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -28,7 +28,7 @@ umask 022
pwd=`pwd`
t0=`echo "$0"|sed 's,.*/,,'`.tmp;tmp=$t0/$$
trap 'status=$?; cd $pwd; exec 1>&2; rm -rf $t0 && exit $status' 0
trap 'status=$?; cd "$pwd" && exec 1>&2; rm -rf $t0 && exit $status' 0
trap '(exit $?); exit' 1 2 13 15
framework_failure=0
@@ -36,7 +36,7 @@ framework_failure=0
# Record absolute path of srcdir and cd back to current dir.
cd $srcdir || framework_failure=1
abs_srcdir=`pwd`
cd $pwd || framework_failure=1
cd "$pwd" || framework_failure=1
. $srcdir/../envvar-check
. $srcdir/../umask-check
@@ -44,7 +44,7 @@ cd $pwd || framework_failure=1
mkdir -p $tmp || framework_failure=1
cd $tmp || framework_failure=1
. $abs_srcdir/../setgid-check
. "$abs_srcdir"/../setgid-check
mkdir foo bar || framework_failure=1
mkdir -p a/b/c d e || framework_failure=1

View File

@@ -2,7 +2,7 @@
# Demonstrate bug when using -d with an existing destination file
# that is a symlink.
# Copyright (C) 2000, 2002, 2004 Free Software Foundation, Inc.
# Copyright (C) 2000, 2002, 2004, 2006 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -29,7 +29,7 @@ fi
pwd=`pwd`
t0=`echo "$0"|sed 's,.*/,,'`.tmp;tmp=$t0/$$
trap 'status=$?; cd $pwd; rm -rf $t0 && exit $status' 0
trap 'status=$?; cd "$pwd" && rm -rf $t0 && exit $status' 0
trap '(exit $?); exit' 1 2 13 15
framework_failure=0

View File

@@ -1,7 +1,7 @@
#!/bin/sh
# verify that cp's --remove-destination option works with -R
# Copyright (C) 2000, 2002, 2004 Free Software Foundation, Inc.
# Copyright (C) 2000, 2002, 2004, 2006 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@ fi
pwd=`pwd`
t0=`echo "$0"|sed 's,.*/,,'`.tmp;tmp=$t0/$$
trap 'status=$?; cd $pwd; rm -rf $t0 && exit $status' 0
trap 'status=$?; cd "$pwd" && rm -rf $t0 && exit $status' 0
trap '(exit $?); exit' 1 2 13 15
framework_failure=0

View File

@@ -2,7 +2,7 @@
# Make sure that cp -R DIR1 DIR2 does the right thing
# when DIR1 is written with a trailing slash.
# Copyright (C) 2000, 2002, 2004 Free Software Foundation, Inc.
# Copyright (C) 2000, 2002, 2004, 2006 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@ fi
pwd=`pwd`
t0=`echo "$0"|sed 's,.*/,,'`.tmp;tmp=$t0/$$
trap 'status=$?; cd $pwd; rm -rf $t0 || exit $?; exit $status' 0
trap 'status=$?; cd "$pwd" && rm -rf $t0 || exit $?; exit $status' 0
trap 'exit $?' 1 2 13 15
framework_failure=0

View File

@@ -1,7 +1,7 @@
#!/bin/sh
# A directory may not replace an existing file.
# Copyright (C) 2001, 2002, 2004 Free Software Foundation, Inc.
# Copyright (C) 2001, 2002, 2004, 2006 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,7 +27,7 @@ fi
pwd=`pwd`
t0=`echo "$0"|sed 's,.*/,,'`.tmp;tmp=$t0/$$
trap 'status=$?; cd $pwd; rm -rf $t0 && exit $status' 0
trap 'status=$?; cd "$pwd" && rm -rf $t0 && exit $status' 0
trap '(exit $?); exit' 1 2 13 15
framework_failure=0

View File

@@ -28,7 +28,7 @@ PRIV_CHECK_ARG=require-non-root . $srcdir/../priv-check
pwd=`pwd`
t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
trap 'status=$?; cd $pwd; chmod -R u+rwx $t0; rm -rf $t0 && exit $status' 0
trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
trap '(exit $?); exit' 1 2 13 15
framework_failure=0

Some files were not shown because too many files have changed in this diff Show More