Compare commits

..

39 Commits
v6.4 ... v6.5

Author SHA1 Message Date
Jim Meyering
497a5cf465 Version 6.5.
* NEWS: Record release date.  Remove "-cvs" suffix.
* configure.ac (AC_INIT): Remove "-cvs" suffix from version string.
2006-11-19 10:58:55 +01:00
Jim Meyering
1efc5bda6c "ln --backup f f" now produces a sensible diagnostic 2006-11-18 20:19:16 +01:00
Jim Meyering
0cafba44bb "ln --backup f f" produces a misleading diagnostic:
ln: creating hard link `f' => `f': No such file or directory
* src/ln.c (do_link): Give a better diagnostic in this unusual case.
(do_link): Rename local: s/lstat_ok/dest_lstat_ok/.
* tests/ln/Makefile.am (TESTS): Add hard-backup.
* tests/ln/hard-backup: New test for the above.
2006-11-18 20:00:39 +01:00
Paul Eggert
1a0333565f * bootstrap.conf (gnulib_modules): Add sys_stat, since we use it directly too.
* lib/.cvsignore, lib/.gitignore: Add root-dev-ino.c, root-dev-ino.h.
* m4/.cvsignore, m4/.gitignore: Add root-dev-ino.m4.
* src/ls.c (DIRED_FPUTS_LITERAL, PUSH_CURRENT_DIRED_POS):
Omit unnecessary parenthesization of args.
* src/od.c (EQUAL_BLOCKS): Likewise.
* src/system.h (STREQ, ASSIGN_STRDUPA): Likewise.
2006-11-16 19:51:23 +01:00
Jim Meyering
a73fdeb2ce * tests/tail-2/append-only: If chattr +a fails, exit 77 (to tell
automake we're skipping this test), and give a diagnostic to tell
the user the same thing.  Reported by Mike Grayson.
2006-11-16 10:05:36 +01:00
Jim Meyering
751f6acf54 change log date to be today's 2006-11-16 09:58:49 +01:00
Ralf Wildenhues
8b139ff78c Arrange to install manpages only for tools that are installed.
* man/Makefile.am (dist_man_MANS): Replace all optional manpages
with `$(MAN)', computed at configure time; also, list them ...
(optional_mans): ... in this new variable.
(max_aux, EXTRA_DIST): Ensure that we distribute all manpages.
2006-11-16 09:57:34 +01:00
Jim Meyering
b6b438c45d * src/csplit.c (load_buffer): Plug an inconsequential leak. 2006-11-16 09:16:08 +01:00
Jim Meyering
fc9b802e3d Help valgrind see that there is no leak in dd.c.
* src/dd.c (dd_copy): Declare real_buf and real_obuf to be static,
so we need not free them at all.  This is easier than freeing
both buffers at each of the early "return"s.
2006-11-16 09:15:47 +01:00
Jim Meyering
e189a79efd * .x-po-check: Exclude gl/ files. Otherwise, po-check would
complain that some of gl/lib/*.[ch] are not listed in POTFILES.in.
2006-11-15 10:37:02 +01:00
Jim Meyering
56206ccb80 * gl/m4/root-dev-ino.m4: Now that this is part of a real "module",
remove the now-unnecessary use of AC_LIBSOURCES.
2006-11-14 14:09:34 +01:00
Jim Meyering
3ef2f939f7 Adapt to new version of gnulib-tool.
* gl/modules/root-dev-ino: New file.
* lib/root-dev-ino.c, lib/root-dev-ino.h: Move these files ...
* gl/lib/root-dev-ino.c, gl/lib/root-dev-ino.h: ... to here.
* m4/root-dev-ino.m4: Move this file ...
* gl/m4/root-dev-ino.m4: ... to here.
* bootstrap.conf (gnulib_modules): Add root-dev-ino.
2006-11-14 14:02:18 +01:00
Jim Meyering
1b00a69ff2 * readlink-stub.c, lstat-stub.c: Remove now-unused files. 2006-11-14 09:38:32 +01:00
Jim Meyering
7932d2e2d4 * src/sort.c (insertkey): Use xmemdup, rather than xmalloc+assignment.
From Paul Eggert.
2006-11-13 19:15:43 +01:00
Jim Meyering
2061f04847 Plug another technically-unimportant leak in sort.
* src/sort.c (main): Don't allocate memory for each new key here.
(insertkey): Allocate memory for each key here, instead.
(key_init): Rename from new_key.  Don't allocate.
2006-11-13 15:19:22 +01:00
Jim Meyering
d5d00c7f9f * src/sort.c (main): Plug a tiny memory leak.
Move declaration of local "minus" down to be nearer point of use.
2006-11-13 15:06:15 +01:00
Jim Meyering
84268dae4e More automatically-added ignorables. 2006-11-12 22:45:14 +01:00
Jim Meyering
78a1d22aa0 * tests/du/Makefile.am (TESTS): Add inacc-dest. 2006-11-12 19:58:58 +01:00
Jim Meyering
597bfeb851 * NEWS: Mention this bug fix. 2006-11-12 19:13:32 +01:00
Jim Meyering
c24e93d926 du would exit early, when encountering an inaccessible directory
Reported by Mike Frysinger, in
http://article.gmane.org/gmane.comp.gnu.core-utils.bugs/8831
* tests/du/inacc-dest: New test, based on an example from Mike Frysinger.
* tests/chgrp/no-x: Remove the "fts_read failed: ..."
diagnostic from the expected output when using native fdopendir.
* tests/chmod/no-x: Likewise.
* tests/du/no-x: Likewise.
2006-11-12 18:42:24 +01:00
Jim Meyering
75be540f7d * Makefile.maint (sc_cast_of_x_alloc_return_value): Add an exclusion
for xalloc.h itself.
2006-11-12 18:41:01 +01:00
Jim Meyering
28c7ef509e Avoid false-positive when testing via valgrind.
* tests/mv/atomic: Grep strace output for a more specific pattern
than just "unlink", since that got a false positive when testing
under valgrind: unlink("/tmp/valgrind_proc_9657_cmdline_A51E9991") = 0
* tests/mv/Makefile.am (TESTS_ENVIRONMENT): Define EGREP.
2006-11-12 08:22:46 +01:00
Jim Meyering
7c96936a04 update .cvsignore/.gitignore files 2006-10-30 09:10:56 +01:00
Jim Meyering
e24ce7c58d * Makefile.maint (patch-check): Make it easier to regenerate
the src/c99-to-c89.diff file.  E.g., I do this:
make patch-check REGEN_PATCH=1; ediff src/c99-to-c89.diff new-diff
2006-10-28 18:23:30 +02:00
Jim Meyering
876e46bce7 * src/c99-to-c89.diff: Update to reflect new offsets in rm.c. 2006-10-28 18:21:13 +02:00
Jim Meyering
a0db0def2d * coreutils.texi (wc invocation): When giving the order in which
the various "counts" are listed, also mention "maximum line length".
Prompted by a report from Vincent LeFevre.
2006-10-28 18:19:05 +02:00
Jim Meyering
0766fb8b54 * src/system.h (ftello): Add a compile-time check for the highly
unlikely condition of off_t narrower than long int, rather than
handling it at run time.  Based on a patch from Paul Eggert.
2006-10-26 15:16:41 +02:00
Jim Meyering
b40b5b6917 Avoid a shell bug in Tru64 4.0 sh's handling of double-quoted strings.
[patch by Paul Eggert]

* tests/chmod/c-option: When double-quoting part of a word, prefer
to double-quote the whole word.  This is a bit easier to read (at
least for me), and in some cases it avoids a shell bug with Tru64
4.0 sh reported by Nelson H. F. Beebe.  For example, instead of
"$abs_srcdir"/../setgid-check we now write
"$abs_srcdir/../setgid-check".

* tests/cp/cp-parents: Likewise.
* tests/du/inaccessible-cwd: Likewise.
* tests/du/long-from-unreadable: Likewise.
* tests/install/basic-1: Likewise.
* tests/install/trap: Likewise.
* tests/misc/close-stdout: Likewise.
* tests/mkdir/concurrent-1: Likewise.
* tests/mkdir/p-1: Likewise.
* tests/mkdir/p-3: Likewise.
* tests/mkdir/parents: Likewise.
* tests/mkdir/perm: Likewise.
* tests/readlink/can-e: Likewise.
* tests/readlink/can-f: Likewise.
* tests/readlink/can-m: Likewise.
* tests/rm/inaccessible: Likewise.
* tests/rm/unread3: Likewise.
* tests/touch/no-create-missing: Likewise.

* lib/.cvsignore: Add uinttostr.c.
2006-10-26 11:03:30 +02:00
Jim Meyering
95954ad583 Portability to Tru64 V4.0.
* src/system.h (ftello) [!HAVE_FSEEKO && !defined ftello]:
Define inline replacement function.
This (along with a yesterday's fix for autoconf's
_AC_SYS_LARGEFILE_MACRO_VALUE macro) makes it so coreutils
now builds once more on Tru64 V4.0.  Reported by Nelson Beebe.
2006-10-25 11:47:06 +02:00
Jim Meyering
e81a82b74f * src/cat.c (infile): Add "const" to declaration.
* src/csplit.c (prefix): Likewise.
* src/printf.c (cfcc_msg): Likewise.
* src/tail.c (valid_file_spec): Likewise.
* src/cut.c (cut_file): Likewise, for a parameter.
* src/expr.c (str_value): Likewise.
* src/fold.c (fold_file): Likewise.
* src/pr.c (init_header): Likewise.
* src/dircolors.c (dc_parse_stream): Likewise, for a local.
* src/tr.c (make_printable_str): Likewise.
* src/nl.c (body_type, header_type, footer_type, current_type):
(separator_str, build_type_arg, nl_file): Likewise, for many.
* src/paste.c (main): Don't assign a read-only string to 'optarg'.
* src/tac.c (separator, tac_seekable, copy_to_temp): Likewise.
2006-10-25 01:05:30 +02:00
Jim Meyering
3e9cc76189 * tests/sample-test: Update copyright year list to include only
the current year, since this is what I'll want in any new test.
2006-10-25 00:16:13 +02:00
Jim Meyering
693311a5c3 * src/c99-to-c89.diff: Update to reflect new offsets. 2006-10-25 00:14:51 +02:00
Jim Meyering
5e42576c01 new feature: rm accepts new option: --one-file-system
Suggested by Steve McIntyre in <http://bugs.debian.org/392925>.
* src/remove.h (struct rm_options) [one_file_system]: New member.
* src/rm.c (rm_option_init): Initialize it.
(usage): Document the option.
* src/mv.c (rm_option_init): Likewise.
* src/remove.c (remove_dir): With --one-file-system and --recursive,
for each directory command line argument, do not affect a file system
different from that of the starting directory.  And give a diagnostic.
* src/rm.c (ONE_FILE_SYSTEM): New enum.
(main): Handle new option.
* tests/rm/one-file-system: Test the above.
* tests/rm/Makefile.am (TESTS): Add one-file-system.
* tests/Makefile.am (check-root): Add the rm/one-file-system
test to the list.
(EXTRA_DIST): Add other-fs-tmpdir.

* tests/mv/setup: Removed.  Renamed to...
* tests/other-fs-tmpdir: ...this new file.
* tests/mv/Makefile.am (EXTRA_DIST): Remove setup.
* tests/mv/acl: Reflect renaming: use ../other-fs-tmpdir.
* tests/mv/backup-is-src: Likewise.
* tests/mv/hard-link-1: Likewise.
* tests/mv/leak-fd: Likewise.
* tests/mv/mv-special-1: Likewise.
* tests/mv/part-fail: Likewise.
* tests/mv/part-hardlink: Likewise.
* tests/mv/part-rename: Likewise.
* tests/mv/part-symlink: Likewise.
* tests/mv/partition-perm: Likewise.
* tests/mv/to-symlink: Likewise.
* tests/mv/into-self-2: Likewise.

[doc/ChangeLog]
* coreutils.texi (rm invocation): Describe --one-file-system.
2006-10-25 00:01:33 +02:00
Jim Meyering
ba6b1acefd Don't let a failure in one test stop "make -k".
* tests/Makefile.am (t1 t2 t3 t4 t5): New targets.
(check-root): Depend on them, rather than executing the five
commands in a single rule.  Reported by Greg Schafer.
2006-10-24 08:46:25 +02:00
Jim Meyering
a3c4e0b94c * Makefile.maint (alpha beta major): Use a better log message.
Suggested by Bob Proulx.
2006-10-23 18:51:29 +02:00
Jim Meyering
7e4eef7e40 * tests/misc/pwd-long: Whoops. Don't exec the perl script. Otherwise, the sh-trap-based
clean-up code isn't run.
2006-10-23 12:22:15 +02:00
Jim Meyering
a002111341 * tests/misc/pwd-long: Undo last change, since it made Perl invoke
pwd via a shell.  Instead, ensure that the absolute name of the
pwd binary consists solely of reasonable characters.
2006-10-23 11:52:48 +02:00
Jim Meyering
0fdbf2e8c7 * NEWS: Add a line for 6.5-cvs.
* configure.ac (AC_INIT): Bump to 6.5 and add "-cvs" suffix.
2006-10-23 07:59:04 +02:00
Jim Meyering
9b17e1d7d4 . 2006-10-22 23:55:14 +02:00
91 changed files with 783 additions and 185 deletions

View File

@@ -1 +1 @@
6.3
6.4

View File

@@ -1,3 +1,4 @@
ChangeLog(-[0-9]+)?$
^old/
^src/c99-to-c98\.diff$
^gl/.*

234
ChangeLog
View File

@@ -1,3 +1,237 @@
2006-11-19 Jim Meyering <jim@meyering.net>
Version 6.5.
* NEWS: Record release date. Remove "-cvs" suffix.
* configure.ac (AC_INIT): Remove "-cvs" suffix from version string.
2006-11-18 Jim Meyering <jim@meyering.net>
"ln --backup f f" produces a misleading diagnostic:
ln: creating hard link `f' => `f': No such file or directory
* src/ln.c (do_link): Give a better diagnostic in this unusual case.
(do_link): Rename local: s/lstat_ok/dest_lstat_ok/.
* tests/ln/Makefile.am (TESTS): Add hard-backup.
* tests/ln/hard-backup: New test for the above.
* NEWS: Mention this fix.
2006-11-16 Paul Eggert <eggert@cs.ucla.edu>
* bootstrap.conf (gnulib_modules): Add sys_stat, since we use it
directly too.
* lib/.cvsignore, lib/.gitignore: Add root-dev-ino.c, root-dev-ino.h.
* m4/.cvsignore, m4/.gitignore: Add root-dev-ino.m4.
* src/ls.c (DIRED_FPUTS_LITERAL, PUSH_CURRENT_DIRED_POS):
Omit unnecessary parenthesization of args.
* src/od.c (EQUAL_BLOCKS): Likewise.
* src/system.h (STREQ, ASSIGN_STRDUPA): Likewise.
2006-11-16 Jim Meyering <jim@meyering.net>
* tests/tail-2/append-only: If chattr +a fails, exit 77 (to tell
automake we're skipping this test), and give a diagnostic to tell
the user the same thing. Reported by Mike Grayson.
2006-11-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
* man/Makefile.am (dist_man_MANS): Replace all optional manpages
with `$(MAN)', computed at configure time; also, list them ...
(optional_mans): ... in this new variable.
(max_aux, EXTRA_DIST): Ensure that we distribute all manpages.
2006-11-16 Jim Meyering <jim@meyering.net>
Help valgrind see that there is no leak in dd.c.
* src/dd.c (dd_copy): Declare real_buf and real_obuf to be static,
so we need not free them at all. This is easier than freeing
both buffers at each of the early "return"s.
* src/csplit.c (load_buffer): Plug an inconsequential leak.
2006-11-15 Jim Meyering <jim@meyering.net>
* .x-po-check: Exclude gl/ files. Otherwise, po-check would
complain that some of gl/lib/*.[ch] are not listed in POTFILES.in.
2006-11-14 Jim Meyering <jim@meyering.net>
* gl/m4/root-dev-ino.m4: Now that this is part of a real "module",
remove the now-unnecessary use of AC_LIBSOURCES.
Adapt to new version of gnulib-tool.
* gl/modules/root-dev-ino: New file.
* lib/root-dev-ino.c, lib/root-dev-ino.h: Move these files ...
* gl/lib/root-dev-ino.c, gl/lib/root-dev-ino.h: ... to here.
* m4/root-dev-ino.m4: Move this file ...
* gl/m4/root-dev-ino.m4: ... to here.
* bootstrap.conf (gnulib_modules): Add root-dev-ino.
2006-11-13 Jim Meyering <jim@meyering.net>
* src/sort.c (insertkey): Use xmemdup, rather than xmalloc+assignment.
From Paul Eggert.
Plug another technically-unimportant leak in sort.
* src/sort.c (main): Don't allocate memory for each new key here.
(insertkey): Allocate memory for each key here, instead.
(key_init): Rename from new_key. Don't allocate.
* src/sort.c (main): Plug a tiny memory leak.
Move declaration of local "minus" down to be nearer point of use.
2006-11-12 Jim Meyering <jim@meyering.net>
du would exit early, when encountering an inaccessible directory
Reported by Mike Frysinger, in
http://article.gmane.org/gmane.comp.gnu.core-utils.bugs/8831
* tests/du/inacc-dest: New test, based on an example from Mike Frysinger.
* tests/chgrp/no-x: Remove the "fts_read failed: ..."
diagnostic from the expected output when using native fdopendir.
* tests/chmod/no-x: Likewise.
* tests/du/no-x: Likewise.
* NEWS: Mention this bug fix.
* tests/du/Makefile.am (TESTS): Add inacc-dest.
* Makefile.maint (sc_cast_of_x_alloc_return_value): Add an exclusion
for xalloc.h itself.
Avoid false-positive when testing via valgrind.
* tests/mv/atomic: Grep strace output for a more specific pattern
than just "unlink", since that got a false positive when testing
under valgrind: unlink("/tmp/valgrind_proc_9657_cmdline_A51E9991") = 0
* tests/mv/Makefile.am (TESTS_ENVIRONMENT): Define EGREP.
2006-10-28 Jim Meyering <jim@meyering.net>
* Makefile.maint (patch-check): Make it easier to regenerate
the src/c99-to-c89.diff file. E.g., I do this:
make patch-check REGEN_PATCH=1; ediff src/c99-to-c89.diff new-diff
* src/c99-to-c89.diff: Update to reflect new offsets in rm.c.
2006-10-26 Jim Meyering <jim@meyering.net>
* src/system.h (ftello): Add a compile-time check for the highly
unlikely condition of off_t narrower than long int, rather than
handling it at run time. Based on a patch from Paul Eggert.
2006-10-25 Paul Eggert <eggert@cs.ucla.edu>
* tests/chmod/c-option: When double-quoting part of a word, prefer
to double-quote the whole word. This is a bit easier to read (at
least for me), and in some cases it avoids a shell bug with Tru64
4.0 sh reported by Nelson H. F. Beebe. For example, instead of
"$abs_srcdir"/../setgid-check we now write
"$abs_srcdir/../setgid-check".
* tests/cp/cp-parents: Likewise.
* tests/du/inaccessible-cwd: Likewise.
* tests/du/long-from-unreadable: Likewise.
* tests/install/basic-1: Likewise.
* tests/install/trap: Likewise.
* tests/misc/close-stdout: Likewise.
* tests/mkdir/concurrent-1: Likewise.
* tests/mkdir/p-1: Likewise.
* tests/mkdir/p-3: Likewise.
* tests/mkdir/parents: Likewise.
* tests/mkdir/perm: Likewise.
* tests/readlink/can-e: Likewise.
* tests/readlink/can-f: Likewise.
* tests/readlink/can-m: Likewise.
* tests/rm/inaccessible: Likewise.
* tests/rm/unread3: Likewise.
* tests/touch/no-create-missing: Likewise.
* lib/.cvsignore: Add uinttostr.c.
2006-10-25 Jim Meyering <jim@meyering.net>
Portability to Tru64 V4.0.
* src/system.h (ftello) [!HAVE_FSEEKO && !defined ftello]:
Define inline replacement function.
This (along with a yesterday's fix for autoconf's
_AC_SYS_LARGEFILE_MACRO_VALUE macro) makes it so coreutils
now builds once more on Tru64 V4.0. Reported by Nelson Beebe.
2006-10-25 Bruno Haible <bruno@clisp.org>
* src/cat.c (infile): Add "const" to declaration.
* src/csplit.c (prefix): Likewise.
* src/printf.c (cfcc_msg): Likewise.
* src/tail.c (valid_file_spec): Likewise.
* src/cut.c (cut_file): Likewise, for a parameter.
* src/expr.c (str_value): Likewise.
* src/fold.c (fold_file): Likewise.
* src/pr.c (init_header): Likewise.
* src/dircolors.c (dc_parse_stream): Likewise, for a local.
* src/tr.c (make_printable_str): Likewise.
* src/nl.c (body_type, header_type, footer_type, current_type):
(separator_str, build_type_arg, nl_file): Likewise, for many.
* src/paste.c (main): Don't assign a read-only string to 'optarg'.
* src/tac.c (separator, tac_seekable, copy_to_temp): Likewise.
2006-10-25 Jim Meyering <jim@meyering.net>
* tests/sample-test: Update copyright year list to include only
the current year, since this is what I'll want in any new test.
2006-10-24 Jim Meyering <jim@meyering.net>
* src/c99-to-c89.diff: Update to reflect new offsets.
* NEWS: new feature: rm accepts new option: --one-file-system
Suggested by Steve McIntyre in <http://bugs.debian.org/392925>.
* src/remove.h (struct rm_options) [one_file_system]: New member.
* src/rm.c (rm_option_init): Initialize it.
(usage): Document the option.
* src/mv.c (rm_option_init): Likewise.
* src/remove.c (remove_dir): With --one-file-system and --recursive,
for each directory command line argument, do not affect a file system
different from that of the starting directory. And give a diagnostic.
* src/rm.c (ONE_FILE_SYSTEM): New enum.
(main): Handle new option.
* tests/rm/one-file-system: Test the above.
* tests/rm/Makefile.am (TESTS): Add one-file-system.
* tests/Makefile.am (check-root): Add the rm/one-file-system
test to the list.
(EXTRA_DIST): Add other-fs-tmpdir.
* tests/mv/setup: Removed. Renamed to...
* tests/other-fs-tmpdir: ...this new file.
* tests/mv/Makefile.am (EXTRA_DIST): Remove setup.
* tests/mv/acl: Reflect renaming: use ../other-fs-tmpdir.
* tests/mv/backup-is-src: Likewise.
* tests/mv/hard-link-1: Likewise.
* tests/mv/leak-fd: Likewise.
* tests/mv/mv-special-1: Likewise.
* tests/mv/part-fail: Likewise.
* tests/mv/part-hardlink: Likewise.
* tests/mv/part-rename: Likewise.
* tests/mv/part-symlink: Likewise.
* tests/mv/partition-perm: Likewise.
* tests/mv/to-symlink: Likewise.
* tests/mv/into-self-2: Likewise.
Don't let a failure in one test stop "make -k" from running the others.
* tests/Makefile.am (t1 t2 t3 t4 t5): New targets.
(check-root): Depend on them, rather than executing the five
commands in a single rule. Reported by Greg Schafer.
2006-10-23 Bob Proulx <bob@proulx.com> (tiny change)
* Makefile.maint (alpha beta major): Use a better log message for
the automatic commit of .prev-version.
2006-10-23 Jim Meyering <jim@meyering.net>
* tests/misc/pwd-long: Undo last change, since it made Perl invoke
pwd via a shell. Instead, ensure that the absolute name of the
pwd binary consists solely of reasonable characters.
Whoops. Don't exec the perl script. Otherwise, the sh-trap-based
clean-up code isn't run.
* NEWS: Add a line for 6.5-cvs.
* configure.ac (AC_INIT): Bump to 6.5 and add "-cvs" suffix.
2006-10-22 Jim Meyering <jim@meyering.net>
Version 6.4.

View File

@@ -102,7 +102,8 @@ sc_cast_of_argument_to_free:
exit 1; } || :
sc_cast_of_x_alloc_return_value:
@grep -nE --exclude=$(srcdir)/lib/regex.c \
@grep -nE --exclude=$(srcdir)/lib/xalloc.h \
--exclude=$(srcdir)/lib/regex.c \
'\*\) *x(m|c|re)alloc\>' \
$(srcdir)/{lib,src}/*.[chy] && \
{ echo '$(ME): don'\''t cast x*alloc return value' 1>&2; \
@@ -330,6 +331,8 @@ patch-check:
(cd src-c89; patch -V never --fuzz=0) < src/c99-to-c89.diff \
> $@.1 2>&1
grep -v '^patching file ' $@.1 > $@.2 || :
if test "$${REGEN_PATCH+set}" = set; then \
diff -upr src src-c89 > new-diff || : ; fi
fail=0; test -s $@.2 && fail=1 || : ; \
rm -rf src-c89 $@.1 $@.2; \
test $$fail = 0
@@ -591,4 +594,6 @@ alpha beta major: news-date-check changelog-check $(local-check)
chmod a-w $(rel-files)
$(MAKE) -s emit_upload_commands RELEASE_TYPE=$@
echo $(VERSION) > $(prev_version_file)
$(VC) commit -m. $(prev_version_file)
$(VC) commit -m \
'$(prev_version_file): Record previous version: $(VERSION).' \
$(prev_version_file)

17
NEWS
View File

@@ -1,5 +1,22 @@
GNU coreutils NEWS -*- outline -*-
* Major changes in release 6.5 (2006-11-19) [stable]
** Bug fixes
du (and the other fts clients: chmod, chgrp, chown) would exit early
when encountering an inaccessible directory on a system with native
openat support (i.e., linux-2.6.16 or newer along with glibc-2.4
or newer). This bug was introduced with the switch to gnulib's
openat-based variant of fts, for coreutils-6.0.
"ln --backup f f" now produces a sensible diagnostic
** New features
rm accepts a new option: --one-file-system
* Major changes in release 6.4 (2006-10-22) [stable]
** Bug fixes

View File

@@ -53,11 +53,13 @@ gnulib_modules="
memrchr mkancesdirs mkdir mkdir-p mkstemp mktime modechange
mountlist obstack pathmax perl physmem posixtm posixver putenv
quote quotearg raise readlink readtokens readtokens0 readutmp
realloc regex rename-dest-slash rmdir rmdir-errno rpmatch
realloc regex rename-dest-slash rmdir rmdir-errno
root-dev-ino
rpmatch
safe-read same
save-cwd savedir savewd settime sha1 sig2str ssize_t stat-macros
stat-time stdbool stdlib-safer stpcpy strcase strftime
strpbrk strtoimax strtoumax strverscmp timespec tzset
strpbrk strtoimax strtoumax strverscmp sys_stat timespec tzset
unicodeio unistd-safer unlink-busy unlinkdir unlocked-io
uptime userspec utimecmp utimens vasprintf verify version-etc-fsf
wcwidth winsz-ioctl winsz-termios xalloc xgetcwd xgethostname

View File

@@ -20,7 +20,7 @@
dnl Written by Jim Meyering.
AC_PREREQ(2.60)
AC_INIT([GNU coreutils],[6.4],[bug-coreutils@gnu.org])
AC_INIT([GNU coreutils],[6.5],[bug-coreutils@gnu.org])
AC_CONFIG_SRCDIR(src/ls.c)
AC_CONFIG_AUX_DIR(build-aux)

View File

@@ -1,3 +1,13 @@
2006-10-27 Jim Meyering <jim@meyering.net>
* coreutils.texi (wc invocation): When giving the order in which
the various "counts" are listed, also mention "maximum line length".
Prompted by a report from Vincent LeFevre.
2006-10-23 Jim Meyering <jim@meyering.net>
* coreutils.texi (rm invocation): Describe --one-file-system.
2006-09-26 Paul Eggert <eggert@cs.ucla.edu>
* coreutils.texi (groups invocation): "groups" no longer prefixes

View File

@@ -2950,7 +2950,8 @@ wc [@var{option}]@dots{} [@var{file}]@dots{}
given as an argument, it prints the file name following the counts. If
more than one @var{file} is given, @command{wc} prints a final line
containing the cumulative counts, with the file name @file{total}. The
counts are printed in this order: newlines, words, characters, bytes.
counts are printed in this order: newlines, words, characters, bytes,
maximum line length.
Each count is printed right-justified in a field with at least one
space between fields so that the numbers and file names normally line
up nicely in columns. The width of the count fields varies depending
@@ -7772,6 +7773,24 @@ removal is requested. Equivalent to @option{-I}.
Specifying @option{--interactive} and no @var{when} is equivalent to
@option{--interactive=always}.
@itemx --one-file-system
@opindex --one-file-system
@cindex one file system, restricting @command{rm} to
When removing a hierarchy recursively, skip any directory that is on a
file system different from that of the corresponding command line argument.
This option is useful when removing a build ``chroot'' hierarchy,
which normally contains no valuable data. However, it is not uncommon
to bind-mount @file{/home} into such a hierarchy, to make it easier to
use one's start-up file. The catch is that it's easy to forget to
unmount @file{/home}. Then, when you use @command{rm -rf} to remove
your normally throw-away chroot, that command will remove everything
under @file{/home}, too.
Use the @option{--one-file-system} option, and it will
warn about and skip directories on other file systems.
Of course, this will not save your @file{/home} if it and your
chroot happen to be on the same file system.
@itemx --preserve-root
@opindex --preserve-root
@cindex root directory, disallow recursive destruction

View File

@@ -1,4 +1,4 @@
#serial 2
#serial 3
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,
@@ -6,7 +6,6 @@ dnl with or without modifications, as long as this notice is preserved.
AC_DEFUN([gl_ROOT_DEV_INO],
[
AC_LIBSOURCES([root-dev-ino.c, root-dev-ino.h, dev-ino.h, same-inode.h])
AC_LIBOBJ([root-dev-ino])
dnl Prerequisites

25
gl/modules/root-dev-ino Normal file
View File

@@ -0,0 +1,25 @@
Description:
Root device and inode number checking.
Files:
lib/root-dev-ino.h
lib/root-dev-ino.c
m4/root-dev-ino.m4
Depends-on:
dev-ino
same-inode
configure.ac:
gl_ROOT_DEV_INO
Makefile.am:
Include:
"root-dev-ino.h"
License:
GPL
Maintainer:
Jim Meyering

View File

@@ -145,6 +145,8 @@ hash.c
hash.h
human.c
human.h
i-ring.c
i-ring.h
idcache.c
imaxtostr.c
inet_ntop.c
@@ -251,6 +253,8 @@ regexec.c
rename-dest-slash.c
rename.c
rmdir.c
root-dev-ino.c
root-dev-ino.h
rpmatch.c
safe-read.c
safe-read.h
@@ -318,9 +322,11 @@ strverscmp.c
strverscmp.h
t-fpending
tempname.c
tempname.h
time_r.c
time_r.h
timespec.h
uinttostr.c
umaxtostr.c
unicodeio.h
unistd--.h

5
lib/.gitignore vendored
View File

@@ -135,6 +135,8 @@ hash.c
hash.h
human.c
human.h
i-ring.c
i-ring.h
idcache.c
imaxtostr.c
inet_ntop.c
@@ -241,6 +243,8 @@ regexec.c
rename-dest-slash.c
rename.c
rmdir.c
root-dev-ino.c
root-dev-ino.h
rpmatch.c
safe-read.c
safe-read.h
@@ -305,6 +309,7 @@ strverscmp.c
strverscmp.h
t-fpending
tempname.c
tempname.h
time_r.c
time_r.h
timespec.h

View File

@@ -1,3 +1,7 @@
2006-11-14 Jim Meyering <jim@meyering.net>
* readlink-stub.c, lstat-stub.c: Remove now-unused files.
2006-10-14 Paul Eggert <eggert@cs.ucla.edu>
Port sha512sum to hosts where uintmax_t is only 32 bits, e.g.,

View File

@@ -1,13 +0,0 @@
#include <config.h>
#include <sys/stat.h>
/* A trivial substitute for `lstat'.
DJGPP 2.03 and earlier don't have `lstat' and don't support
symlinks. */
int
lstat (const char *fname, struct stat *st_buf)
{
return stat (fname, st_buf);
}

View File

@@ -1,15 +0,0 @@
#include <config.h>
#include <stddef.h>
#include <errno.h>
/* A trivial substitute for `readlink'.
DJGPP 2.03 and earlier don't have `readlink' and don't support
symlinks. */
int
readlink (const char *file, char *buffer, size_t size)
{
errno = EINVAL;
return -1;
}

View File

@@ -43,6 +43,7 @@ file-type.m4
fileblocks.m4
filemode.m4
filenamecat.m4
flexmember.m4
fnmatch.m4
fpending.m4
fprintftime.m4
@@ -81,11 +82,15 @@ hard-locale.m4
hash.m4
host-os.m4
human.m4
i-ring.m4
iconv.m4
idcache.m4
include_next.m4
inet_ntop.m4
inline.m4
intdiv0.m4
intl.m4
intldir.m4
intmax.m4
intmax_t.m4
inttostr.m4
@@ -156,6 +161,7 @@ rename-dest-slash.m4
rename.m4
rmdir-errno.m4
rmdir.m4
root-dev-ino.m4
rpmatch.m4
safe-read.m4
safe-write.m4
@@ -200,6 +206,7 @@ strtoumax.m4
strverscmp.m4
sys_socket_h.m4
sys_stat_h.m4
tempname.m4
time_r.m4
timespec.m4
tm_gmtoff.m4

7
m4/.gitignore vendored
View File

@@ -42,6 +42,7 @@ file-type.m4
fileblocks.m4
filemode.m4
filenamecat.m4
flexmember.m4
fnmatch.m4
fpending.m4
fprintftime.m4
@@ -79,9 +80,13 @@ hard-locale.m4
hash.m4
host-os.m4
human.m4
i-ring.m4
iconv.m4
idcache.m4
inet_ntop.m4
inline.m4
intl.m4
intldir.m4
intmax.m4
intmax_t.m4
inttostr.m4
@@ -149,6 +154,7 @@ rename-dest-slash.m4
rename.m4
rmdir-errno.m4
rmdir.m4
root-dev-ino.m4
rpmatch.m4
safe-read.m4
safe-write.m4
@@ -192,6 +198,7 @@ strtoumax.m4
strverscmp.m4
sys_socket_h.m4
sys_stat_h.m4
tempname.m4
time_r.m4
timespec.m4
tm_gmtoff.m4

View File

@@ -19,22 +19,25 @@
# 02110-1301, USA.
dist_man_MANS = \
base64.1 basename.1 cat.1 chgrp.1 chmod.1 chown.1 chroot.1 cksum.1 comm.1 \
base64.1 basename.1 cat.1 chgrp.1 chmod.1 chown.1 cksum.1 comm.1 \
cp.1 csplit.1 cut.1 date.1 dd.1 df.1 dir.1 dircolors.1 dirname.1 du.1 \
echo.1 env.1 expand.1 expr.1 factor.1 false.1 fmt.1 fold.1 groups.1 \
head.1 hostid.1 hostname.1 id.1 install.1 join.1 kill.1 \
head.1 hostname.1 id.1 install.1 join.1 kill.1 \
link.1 ln.1 logname.1 \
ls.1 md5sum.1 mkdir.1 mkfifo.1 mknod.1 mv.1 nice.1 nl.1 nohup.1 od.1 \
paste.1 pathchk.1 pinky.1 pr.1 printenv.1 printf.1 ptx.1 pwd.1 readlink.1 \
ls.1 md5sum.1 mkdir.1 mkfifo.1 mknod.1 mv.1 nl.1 nohup.1 od.1 \
paste.1 pathchk.1 pr.1 printenv.1 printf.1 ptx.1 pwd.1 readlink.1 \
rm.1 rmdir.1 seq.1 sha1sum.1 sha224sum.1 sha256sum.1 sha384sum.1 sha512sum.1 \
shred.1 shuf.1 sleep.1 sort.1 split.1 stat.1 stty.1 \
shred.1 shuf.1 sleep.1 sort.1 split.1 stat.1 \
su.1 sum.1 sync.1 tac.1 tail.1 tee.1 test.1 touch.1 tr.1 true.1 tsort.1 \
tty.1 uname.1 unexpand.1 uniq.1 unlink.1 uptime.1 users.1 vdir.1 wc.1 \
who.1 whoami.1 yes.1
tty.1 unexpand.1 uniq.1 unlink.1 vdir.1 wc.1 \
whoami.1 yes.1 $(MAN)
optional_mans = \
chroot.1 hostid.1 nice.1 pinky.1 stty.1 uname.1 uptime.1 users.1 who.1
man_aux = $(dist_man_MANS:.1=.x)
EXTRA_DIST = $(man_aux) help2man
man_aux = $(dist_man_MANS:.1=.x) $(optional_mans:.1=.x)
EXTRA_DIST = $(man_aux) help2man $(optional_mans)
MAINTAINERCLEANFILES = $(dist_man_MANS)
# Depend on configure.ac to get version number changes.

View File

@@ -63,7 +63,7 @@ diff -u -p -u -r1.158 remove.c
}
/* Remove entries in the directory open on DIRP
@@ -1372,9 +1377,10 @@ remove_dir (int fd_cwd, Dirstack_state *
@@ -1389,9 +1394,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;
@@ -75,7 +75,7 @@ diff -u -p -u -r1.158 remove.c
assert (dirp != NULL || AD_stack_height (ds) == 1);
/* Try to remove EMPTY_DIR only if remove_cwd_entries succeeded. */
@@ -1386,8 +1392,9 @@ remove_dir (int fd_cwd, Dirstack_state *
@@ -1403,8 +1409,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;
@@ -86,7 +86,7 @@ diff -u -p -u -r1.158 remove.c
PA_REMOVE_DIR, &is_empty);
if (s != RM_OK)
@@ -1452,6 +1459,7 @@ rm_1 (Dirstack_state *ds, char const *fi
@@ -1469,6 +1476,7 @@ rm_1 (Dirstack_state *ds, char const *fi
return RM_ERROR;
}
@@ -94,7 +94,7 @@ diff -u -p -u -r1.158 remove.c
struct stat st;
cache_stat_init (&st);
if (x->root_dev_ino)
@@ -1473,6 +1481,7 @@ rm_1 (Dirstack_state *ds, char const *fi
@@ -1490,6 +1498,7 @@ rm_1 (Dirstack_state *ds, char const *fi
AD_push_initial (ds);
AD_INIT_OTHER_MEMBERS ();
@@ -102,7 +102,7 @@ diff -u -p -u -r1.158 remove.c
int fd_cwd = AT_FDCWD;
enum RM_status status = remove_entry (fd_cwd, ds, filename, &st, x, NULL);
if (status == RM_NONEMPTY_DIR)
@@ -1491,6 +1500,8 @@ rm_1 (Dirstack_state *ds, char const *fi
@@ -1508,6 +1517,8 @@ rm_1 (Dirstack_state *ds, char const *fi
ds_clear (ds);
return status;
@@ -111,7 +111,7 @@ diff -u -p -u -r1.158 remove.c
}
/* Remove all files and/or directories specified by N_FILES and FILE.
@@ -1513,9 +1524,11 @@ rm (size_t n_files, char const *const *f
@@ -1530,9 +1541,11 @@ rm (size_t n_files, char const *const *f
}
cycle_check_init (&ds->cycle_check_state);
@@ -130,7 +130,7 @@ retrieving revision 1.140
diff -u -p -u -r1.140 rm.c
--- src/rm.c 3 Sep 2006 02:53:58 -0000 1.140
+++ src/rm.c 6 Sep 2006 18:57:46 -0000
@@ -357,8 +357,10 @@ main (int argc, char **argv)
@@ -369,8 +369,10 @@ main (int argc, char **argv)
if (!yesno ())
exit (EXIT_SUCCESS);
}

View File

@@ -55,7 +55,7 @@
char *program_name;
/* Name of input file. May be "-". */
static char *infile;
static char const *infile;
/* Descriptor on which input file is open. */
static int input_desc;

View File

@@ -149,13 +149,13 @@ static uintmax_t current_line = 0;
static bool have_read_eof = false;
/* Name of output files. */
static char * volatile filename_space = NULL;
static char *volatile filename_space = NULL;
/* Prefix part of output file names. */
static char * volatile prefix = NULL;
static char const *volatile prefix = NULL;
/* Suffix part of output file names. */
static char * volatile suffix = NULL;
static char *volatile suffix = NULL;
/* Number of digits to use in output file names. */
static int volatile digits = 2;
@@ -526,6 +526,8 @@ load_buffer (void)
if (lines_found)
save_buffer (b);
else
free (b);
return lines_found != 0;
}

View File

@@ -1,5 +1,5 @@
/* cut - remove parts of lines of files
Copyright (C) 1997-2005 Free Software Foundation, Inc.
Copyright (C) 1997-2006 Free Software Foundation, Inc.
Copyright (C) 1984 David M. Ihnat
This program is free software; you can redistribute it and/or modify
@@ -702,7 +702,7 @@ cut_stream (FILE *stream)
Return true if successful. */
static bool
cut_file (char *file)
cut_file (char const *file)
{
FILE *stream;

View File

@@ -1377,8 +1377,10 @@ static int
dd_copy (void)
{
char *ibuf, *bufstart; /* Input buffer. */
char *real_buf; /* real buffer address before alignment */
char *real_obuf;
/* These are declared static so that even though we don't free the
buffers, valgrind will recognize that there is no "real" leak. */
static char *real_buf; /* real buffer address before alignment */
static char *real_obuf;
ssize_t nread; /* Bytes read in the current block. */
/* If nonzero, then the previously read block was partial and
@@ -1598,9 +1600,6 @@ dd_copy (void)
}
}
free (real_buf);
free (real_obuf);
if ((conversions_mask & C_FDATASYNC) && fdatasync (STDOUT_FILENO) != 0)
{
if (errno != ENOSYS && errno != EINVAL)

View File

@@ -246,7 +246,7 @@ dc_parse_stream (FILE *fp, const char *filename)
char *input_line = NULL;
size_t input_line_size = 0;
char const *line;
char *term;
char const *term;
bool ok = true;
/* State for the parser. */

View File

@@ -236,7 +236,7 @@ int_value (intmax_t i)
/* Return a VALUE for S. */
static VALUE *
str_value (char *s)
str_value (char const *s)
{
VALUE *v = xmalloc (sizeof *v);
v->type = string;

View File

@@ -1,5 +1,5 @@
/* fold -- wrap each input line to fit in specified width.
Copyright (C) 91, 1995-2005 Free Software Foundation, Inc.
Copyright (C) 91, 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
@@ -122,7 +122,7 @@ adjust_column (size_t column, char c)
Return true if successful. */
static bool
fold_file (char *filename, size_t width)
fold_file (char const *filename, size_t width)
{
FILE *istream;
int c;

View File

@@ -133,7 +133,7 @@ do_link (const char *source, const char *dest)
struct stat source_stats;
struct stat dest_stats;
char *dest_backup = NULL;
bool lstat_ok = false;
bool dest_lstat_ok = false;
bool source_is_dir = false;
bool ok;
@@ -171,8 +171,8 @@ do_link (const char *source, const char *dest)
if (remove_existing_files || interactive || backup_type != no_backups)
{
lstat_ok = (lstat (dest, &dest_stats) == 0);
if (!lstat_ok && errno != ENOENT)
dest_lstat_ok = (lstat (dest, &dest_stats) == 0);
if (!dest_lstat_ok && errno != ENOENT)
{
error (0, errno, _("accessing %s"), quote (dest));
return false;
@@ -184,8 +184,14 @@ do_link (const char *source, const char *dest)
(with --backup, it just renames any existing destination file)
But if the source and destination are the same, don't remove
anything and fail right here. */
if (remove_existing_files
&& lstat_ok
if ((remove_existing_files
/* Ensure that "ln --backup f f" fails here, with the
"... same file" diagnostic, below. Otherwise, subsequent
code would give a misleading "file not found" diagnostic.
This case is different than the others handled here, since
the command in question doesn't use --force. */
|| (!symbolic_link && backup_type != no_backups))
&& dest_lstat_ok
/* Allow `ln -sf --backup k k' to succeed in creating the
self-referential symlink, but don't allow the hard-linking
equivalent: `ln -f k k' (with or without --backup) to get
@@ -205,7 +211,7 @@ do_link (const char *source, const char *dest)
return false;
}
if (lstat_ok)
if (dest_lstat_ok)
{
if (S_ISDIR (dest_stats.st_mode))
{

View File

@@ -863,11 +863,11 @@ static size_t dired_pos;
/* Write S to STREAM and increment DIRED_POS by S_LEN. */
#define DIRED_FPUTS(s, stream, s_len) \
do {fputs ((s), (stream)); dired_pos += s_len;} while (0)
do {fputs (s, stream); dired_pos += s_len;} while (0)
/* Like DIRED_FPUTS, but for use when S is a literal string. */
#define DIRED_FPUTS_LITERAL(s, stream) \
do {fputs ((s), (stream)); dired_pos += sizeof((s)) - 1;} while (0)
do {fputs (s, stream); dired_pos += sizeof (s) - 1;} while (0)
#define DIRED_INDENT() \
do \
@@ -892,7 +892,7 @@ static struct obstack subdired_obstack;
do \
{ \
if (dired) \
obstack_grow ((obs), &dired_pos, sizeof (dired_pos)); \
obstack_grow (obs, &dired_pos, sizeof (dired_pos)); \
} \
while (0)

View File

@@ -94,6 +94,7 @@ rm_option_init (struct rm_options *x)
x->ignore_missing_files = false;
x->root_dev_ino = NULL;
x->recursive = true;
x->one_file_system = false;
/* Should we prompt for removal, too? No. Prompting for the `move'
part is enough. It implies removal. */

View File

@@ -64,16 +64,16 @@ enum section
char *program_name;
/* Format of body lines (-b). */
static char *body_type = "t";
static char const *body_type = "t";
/* Format of header lines (-h). */
static char *header_type = "n";
static char const *header_type = "n";
/* Format of footer lines (-f). */
static char *footer_type = "n";
static char const *footer_type = "n";
/* Format currently being used (body, header, or footer). */
static char *current_type;
static char const *current_type;
/* Regex for body lines to number (-bp). */
static struct re_pattern_buffer body_regex;
@@ -93,7 +93,7 @@ static char footer_fastmap[UCHAR_MAX + 1];
static struct re_pattern_buffer *current_regex = NULL;
/* Separator string to print after line number (-s). */
static char *separator_str = "\t";
static char const *separator_str = "\t";
/* Input section delimiter string (-d). */
static char const *section_del = DEFAULT_SECTION_DELIMITERS;
@@ -235,9 +235,10 @@ FORMAT is one of:\n\
according to `optarg'. */
static bool
build_type_arg (char **typep, struct re_pattern_buffer *regexp, char *fastmap)
build_type_arg (char const **typep,
struct re_pattern_buffer *regexp, char *fastmap)
{
const char *errmsg;
char const *errmsg;
bool rval = true;
switch (*optarg)
@@ -414,7 +415,7 @@ process_file (FILE *fp)
Return true if successful. */
static bool
nl_file (const char *file)
nl_file (char const *file)
{
FILE *stream;

View File

@@ -1175,7 +1175,7 @@ write_block (uintmax_t current_offset, size_t n_bytes,
static bool first = true;
static bool prev_pair_equal = false;
#define EQUAL_BLOCKS(b1, b2) (memcmp ((b1), (b2), bytes_per_block) == 0)
#define EQUAL_BLOCKS(b1, b2) (memcmp (b1, b2, bytes_per_block) == 0)
if (abbreviate_duplicate_blocks
&& !first && n_bytes == bytes_per_block

View File

@@ -463,9 +463,7 @@ main (int argc, char **argv)
{
case 'd':
/* Delimiter character(s). */
if (optarg[0] == '\0')
optarg = "\\0";
delim_arg = optarg;
delim_arg = (optarg[0] == '\0' ? "\\0" : optarg);
break;
case 's':

View File

@@ -430,7 +430,7 @@ static void getoptarg (char *arg, char switch_char, char *character,
void usage (int status);
static void print_files (int number_of_files, char **av);
static void init_parameters (int number_of_files);
static void init_header (char *filename, int desc);
static void init_header (char const *filename, int desc);
static bool init_fps (int number_of_files, char **av);
static void init_funcs (void);
static void init_store_cols (void);
@@ -1653,7 +1653,7 @@ print_files (int number_of_files, char **av)
FILENAME for reading. */
static void
init_header (char *filename, int desc)
init_header (char const *filename, int desc)
{
char *buf = NULL;
struct stat st;

View File

@@ -76,7 +76,7 @@ static bool posixly_correct;
/* This message appears in N_() here rather than just in _() below because
the sole use would have been in a #define. */
static char *const cfcc_msg =
static char const *const cfcc_msg =
N_("warning: %s: character(s) following character constant have been ignored");
/* The name this program was run with. */

View File

@@ -1298,6 +1298,7 @@ remove_dir (int fd_cwd, Dirstack_state *ds, char const *dir,
struct rm_options const *x, int *cwd_errno)
{
enum RM_status status;
dev_t current_dev = dir_st->st_dev;
/* There is a race condition in that an attacker could replace the nonempty
directory, DIR, with a symlink between the preceding call to rmdir
@@ -1359,15 +1360,31 @@ remove_dir (int fd_cwd, Dirstack_state *ds, char const *dir,
}
if (subdir)
{
AD_push (dirfd (dirp), ds, subdir, &subdir_sb);
AD_INIT_OTHER_MEMBERS ();
if ( ! x->one_file_system
|| subdir_sb.st_dev == current_dev)
{
AD_push (dirfd (dirp), ds, subdir, &subdir_sb);
AD_INIT_OTHER_MEMBERS ();
free (subdir);
continue;
}
/* Here, --one-file-system is in effect, and with remove_cwd_entries'
traversal into the current directory, (known as SUBDIR, from ..),
DIRP's device number is different from CURRENT_DEV. Arrange not
to do anything more with this hierarchy. */
error (0, errno, _("skipping %s, since it's on a different device"),
quote (full_filename (subdir)));
free (subdir);
continue;
AD_mark_current_as_unremovable (ds);
tmp_status = RM_ERROR;
UPDATE_STATUS (status, tmp_status);
}
/* Execution reaches this point when we've removed the last
removable entry from the current directory. */
removable entry from the current directory -- or, with
--one-file-system, when the current directory is on a
different file system. */
{
/* The name of the directory that we have just processed,
nominally removing all of its contents. */

View File

@@ -30,6 +30,14 @@ struct rm_options
/* If true, query the user about whether to remove each file. */
bool interactive;
/* If true, do not traverse into (or remove) any directory that is
on a file system (i.e., that has a different device number) other
than that of the corresponding command line argument. Note that
even without this option, rm will fail in the end, due to its
probable inability to remove the mount point. But there, the
diagnostic comes too late -- after removing all contents. */
bool one_file_system;
/* If true, recursively remove directories. */
bool recursive;

View File

@@ -72,6 +72,7 @@ char *program_name;
enum
{
INTERACTIVE_OPTION = CHAR_MAX + 1,
ONE_FILE_SYSTEM,
NO_PRESERVE_ROOT,
PRESERVE_ROOT,
PRESUME_INPUT_TTY_OPTION
@@ -90,6 +91,7 @@ static struct option const long_opts[] =
{"force", no_argument, NULL, 'f'},
{"interactive", optional_argument, NULL, INTERACTIVE_OPTION},
{"one-file-system", no_argument, NULL, ONE_FILE_SYSTEM},
{"no-preserve-root", no_argument, NULL, NO_PRESERVE_ROOT},
{"preserve-root", no_argument, NULL, PRESERVE_ROOT},
@@ -168,6 +170,11 @@ Remove (unlink) the FILE(s).\n\
while still giving protection against most mistakes\n\
--interactive[=WHEN] prompt according to WHEN: never, once (-I), or\n\
always (-i). Without WHEN, prompt always\n\
"), stdout);
fputs (_("\
--one-file-system when removing a hierarchy recursively, skip any\n\
directory that is on a file system different from\n\
that of the corresponding command line argument\n\
"), stdout);
fputs (_("\
--no-preserve-root do not treat `/' specially\n\
@@ -207,6 +214,7 @@ rm_option_init (struct rm_options *x)
{
x->ignore_missing_files = false;
x->interactive = false;
x->one_file_system = false;
x->recursive = false;
x->root_dev_ino = NULL;
x->stdin_tty = isatty (STDIN_FILENO);
@@ -299,6 +307,10 @@ main (int argc, char **argv)
break;
}
case ONE_FILE_SYSTEM:
x.one_file_system = true;
break;
case NO_PRESERVE_ROOT:
preserve_root = false;
break;

View File

@@ -2099,12 +2099,13 @@ sort (char * const *files, size_t nfiles, char const *output_file)
}
}
/* Insert key KEY at the end of the key list. */
/* Insert a malloc'd copy of key KEY_ARG at the end of the key list. */
static void
insertkey (struct keyfield *key)
insertkey (struct keyfield *key_arg)
{
struct keyfield **p;
struct keyfield *key = xmemdup (key_arg, sizeof *key);
for (p = &keylist; *p; p = &(*p)->next)
continue;
@@ -2271,9 +2272,9 @@ set_ordering (const char *s, struct keyfield *key, enum blanktype blanktype)
}
static struct keyfield *
new_key (void)
key_init (struct keyfield *key)
{
struct keyfield *key = xzalloc (sizeof *key);
memset (key, 0, sizeof *key);
key->eword = SIZE_MAX;
return key;
}
@@ -2282,6 +2283,7 @@ int
main (int argc, char **argv)
{
struct keyfield *key;
struct keyfield key_buf;
struct keyfield gkey;
char const *s;
int c = 0;
@@ -2292,7 +2294,7 @@ main (int argc, char **argv)
size_t nfiles = 0;
bool posixly_correct = (getenv ("POSIXLY_CORRECT") != NULL);
bool obsolete_usage = (posix2_version () < 200112);
char *minus = "-", **files;
char **files;
char const *outfile = NULL;
initialize_main (&argc, &argv);
@@ -2408,7 +2410,7 @@ main (int argc, char **argv)
{
/* Treat +POS1 [-POS2] as a key if possible; but silently
treat an operand as a file if it is not a valid +POS1. */
key = new_key ();
key = key_init (&key_buf);
s = parse_field_count (optarg + 1, &key->sword, NULL);
if (s && *s == '.')
s = parse_field_count (s + 1, &key->schar, NULL);
@@ -2463,7 +2465,7 @@ main (int argc, char **argv)
break;
case 'k':
key = new_key ();
key = key_init (&key_buf);
/* Get POS1. */
s = parse_field_count (optarg, &key->sword,
@@ -2657,7 +2659,9 @@ main (int argc, char **argv)
if (nfiles == 0)
{
static char *minus = "-";
nfiles = 1;
free (files);
files = &minus;
}

View File

@@ -293,7 +293,7 @@ select_plural (uintmax_t n)
return (n <= ULONG_MAX ? n : n % PLURAL_REDUCER + PLURAL_REDUCER);
}
#define STREQ(a, b) (strcmp ((a), (b)) == 0)
#define STREQ(a, b) (strcmp (a, b) == 0)
#if !HAVE_DECL_FREE
void free ();
@@ -506,7 +506,7 @@ enum
const char *s_ = (S); \
size_t len_ = strlen (s_) + 1; \
char *tmp_dest_ = alloca (len_); \
DEST = memcpy (tmp_dest_, (s_), len_); \
DEST = memcpy (tmp_dest_, s_, len_); \
} \
while (0)
#endif
@@ -515,10 +515,19 @@ enum
# define EOVERFLOW EINVAL
#endif
#if ! HAVE_FSEEKO && ! defined fseeko
# define fseeko(s, o, w) ((o) == (long int) (o) \
? fseek (s, o, w) \
: (errno = EOVERFLOW, -1))
#if ! HAVE_FSEEKO
# if ! defined fseeko
# define fseeko(s, o, w) ((o) == (long int) (o) \
? fseek (s, o, w) \
: (errno = EOVERFLOW, -1))
# endif
# if ! defined ftello
static inline off_t ftello (FILE *stream)
{
verify (sizeof (long int) <= sizeof (off_t));
return ftell (stream);
}
# endif
#endif
#if ! HAVE_SYNC

View File

@@ -78,7 +78,7 @@ tac -r -s '.\|
char *program_name;
/* The string that separates the records of the file. */
static char *separator;
static char const *separator;
/* True if we have ever read standard input. */
static bool have_read_stdin = false;
@@ -211,7 +211,7 @@ tac_seekable (int input_fd, const char *file)
Only used when the separator is attached to the preceding record. */
bool first_time = true;
char first_char = *separator; /* Speed optimization, non-regexp. */
char *separator1 = separator + 1; /* Speed optimization, non-regexp. */
char const *separator1 = separator + 1; /* Speed optimization, non-regexp. */
size_t match_length1 = match_length - 1; /* Speed optimization, non-regexp. */
struct re_registers regs;
@@ -426,7 +426,7 @@ static bool
copy_to_temp (FILE **g_tmp, char **g_tempfile, int input_fd, char const *file)
{
static char *template = NULL;
static char *tempdir;
static char const *tempdir;
char *tempfile;
FILE *tmp;
int fd;

View File

@@ -292,7 +292,7 @@ valid_file_spec (struct File_spec const *f)
return ((f->fd == -1) ^ (f->errnum == 0));
}
static char *
static char const *
pretty_name (struct File_spec const *f)
{
return (STREQ (f->name, "-") ? "standard input" : f->name);

View File

@@ -601,7 +601,7 @@ make_printable_str (char const *s, size_t len)
for (i = 0; i < len; i++)
{
char buf[5];
char *tmp = NULL;
char const *tmp = NULL;
unsigned char c = s[i];
switch (c)

View File

@@ -15,13 +15,13 @@ TESTS_ENVIRONMENT = \
EXTRA_DIST = \
$(TESTS) Coreutils.pm Makefile.am.in README acl envvar-check \
expensive group-names input-tty lang-default mk-script priv-check \
expensive group-names input-tty lang-default mk-script \
other-fs-tmpdir priv-check \
rwx-to-mode sample-test setgid-check sparse-file \
umask-check very-expensive
## N O T E :: Please do not add new tests/ directories.
## Some people feel that there are too many already.
## Put new tests in misc/.
## There are too many already. Put new tests in misc/.
SUBDIRS = \
chgrp chmod chown cp cut dd dircolors du expr factor fmt head \
install join ln ls ls-2 md5sum misc mkdir mv od pr readlink rm rmdir \
@@ -29,13 +29,22 @@ SUBDIRS = \
tsort unexpand uniq wc
## N O T E :: Please do not add new directories.
.PHONY: check-root
check-root:
all_t = t1 t2 t3 t4 t5 t6
.PHONY: check-root $(all_t)
check-root: $(all_t)
t1:
cd chown && $(MAKE) check TESTS=basic
t2:
cd cp && $(MAKE) check TESTS=special-bits
t3:
cd rm && $(MAKE) check TESTS=no-give-up
t4:
cd rm && $(MAKE) check TESTS=fail-2eperm
t5:
cd tail-2 && $(MAKE) check TESTS=append-only
t6:
cd rm && $(MAKE) check TESTS=one-file-system
check-recursive: root-hint

View File

@@ -59,7 +59,6 @@ EOF
# With native fdopendir, du uses a different code path.
cat <<\EOF > exp-native-fdopendir
chgrp: cannot access `d/no-x/y': Permission denied
chgrp: fts_read failed: Permission denied
EOF
if cmp out exp >/dev/null 2>&1; then

View File

@@ -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

@@ -55,7 +55,6 @@ EOF
# With native fdopendir, du uses a different code path.
cat <<\EOF > exp-native-fdopendir
chmod: cannot access `d/no-x/y': Permission denied
chmod: fts_read failed: Permission denied
EOF
if cmp out exp >/dev/null 2>&1; then

View File

@@ -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

@@ -21,6 +21,7 @@
AUTOMAKE_OPTIONS = 1.4 gnits
TESTS = \
inacc-dest \
long-from-unreadable \
long-sloop \
2g \

82
tests/du/inacc-dest Executable file
View File

@@ -0,0 +1,82 @@
#!/bin/sh
# Prior to coreutils-6.5, an inaccessible destination dir (chmod a-x)
# would cause du to exit prematurely on systems with native openat support.
# 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
du --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 f && cd f && mkdir a b c d e && touch c/j && chmod a-x 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
du > ../t 2>&1 && fail=1
# Accept either of the following outputs.
# You get the first from a system with openat _emulation_ (via /proc),
# the second from a system with native openat support.
# FIXME: there may well be a third output, for systems with neither
# /proc support, nor native openat support.
sed 's/^[0-9][0-9]* //' ../t | sort -u > out
cat <<\EOF > exp || fail=1
.
./a
./b
./d
./e
du: `./c': Permission denied
EOF
cat <<\EOF > exp2 || fail=1
.
./a
./b
./c
./d
./e
du: cannot access `./c/j': Permission denied
EOF
cmp out exp > /dev/null 2>&1 || {
cmp out exp2 || fail=1
}
test $fail = 1 && diff out exp 2> /dev/null
(exit $fail); exit $fail

View File

@@ -48,6 +48,6 @@ fi
fail=0
du "$pwd"/$tmp/a > /dev/null || fail=1
du "$pwd/$tmp/a" > /dev/null || fail=1
(exit $fail); exit $fail

View File

@@ -84,6 +84,6 @@ if test $framework_failure = 1; then
fi
fail=0
du -s "$pwd"/$tmp/$dir > /dev/null || fail=1
du -s "$pwd/$tmp/$dir" > /dev/null || fail=1
(exit $fail); exit $fail

View File

@@ -55,7 +55,6 @@ EOF
# With native fdopendir, du uses a different code path.
cat <<\EOF > exp-native-fdopendir
du: cannot access `d/no-x/y': Permission denied
du: fts_read failed: Permission denied
EOF
if cmp out exp >/dev/null 2>&1; then

View File

@@ -117,7 +117,7 @@ test -d newdir3 || fail=1
# hence cannot do anything meaningful with the following relative-named dirs.
abs=$pwd/$tmp
mkdir sub || fail=1
(cd sub && chmod 0 . && ginstall -d "$abs"/xx/yy rel/sub1 rel/sub2 2> /dev/null) && fail=1
(cd sub && chmod 0 . && ginstall -d "$abs/xx/yy" rel/sub1 rel/sub2 2> /dev/null) && fail=1
chmod 755 sub
# Ensure that the first argument-dir has been created.
@@ -132,7 +132,7 @@ test -d xx/rel && fail=1
# inaccessible parent. coreutils 5.97 fails this test.
mkdir -p sub1/d || fail=1
(cd sub1/d && chmod a-rx .. && chmod a-r . &&
ginstall -d "$abs"/xx/zz rel/a rel/b 2> /dev/null) || fail=1
ginstall -d "$abs/xx/zz" rel/a rel/b 2> /dev/null) || fail=1
chmod 755 sub1 sub1/d || fail=1
test -d xx/zz || fail=1
test -d sub1/d/rel/a || fail=1

View File

@@ -43,10 +43,10 @@ fail=0
# Use a subshell and an exec to work around a bug in FreeBSD 5.0 /bin/sh.
(
# ash doesn't support "trap '' CHLD"; it knows only signal numbers.
sig=`"$pwd"/../../src/kill -l CHLD 2>/dev/null` && trap '' $sig
sig=`"$pwd/../../src/kill" -l CHLD 2>/dev/null` && trap '' $sig
# Before 2004-04-21, install would infloop, in the `while (wait...' loop:
exec ginstall -s "$pwd"/../../src/ginstall$EXEEXT .
exec ginstall -s "$pwd/../../src/ginstall$EXEEXT" .
)
(exit $fail); exit $fail

View File

@@ -1,7 +1,7 @@
## Process this file with automake to produce Makefile.in -*-Makefile-*-.
AUTOMAKE_OPTIONS = 1.2 gnits
TESTS = target-1 sf-1 misc backup-1
TESTS = hard-backup target-1 sf-1 misc backup-1
EXTRA_DIST = $(TESTS)
TESTS_ENVIRONMENT = \
PATH="$(VG_PATH_PREFIX)`pwd`/../../src$(PATH_SEPARATOR)$$PATH"

54
tests/ln/hard-backup Executable file
View File

@@ -0,0 +1,54 @@
#!/bin/sh
# Ensure that 'ln --backup F F' gives a proper diagnostic.
# 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
ln --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
touch f || framework_failure=1
if test $framework_failure = 1; then
echo "$0: failure in testing framework" 1>&2
(exit 1); exit 1
fi
fail=0
ln --backup f f 2> out && fail=1
cat <<\EOF > exp || fail=1
ln: `f' and `f' are the same file
EOF
cmp out exp || fail=1
test $fail = 1 && diff out exp 2> /dev/null
(exit $fail); exit $fail

View File

@@ -56,21 +56,21 @@ mv d e >&- || fail=1
rmdir e >&- || fail=1
touch e >&- || fail=1
sleep 0 >&- || fail=1
"$pwd"/../../src/true >&- || fail=1
"$pwd"/../../src/printf '' >&- || fail=1
"$pwd/../../src/true" >&- || fail=1
"$pwd/../../src/printf" '' >&- || fail=1
# If >&- works, ensure these fail, because stdout is closed and they
# *do* generate output. >&- apparently does not work in HP-UX 11.23.
# This test is ineffective unless /dev/stdout also works.
if "$pwd"/../../src/test -w /dev/stdout >/dev/null &&
"$pwd"/../../src/test ! -w /dev/stdout >&-; then
"$pwd"/../../src/printf 'foo' >&- 2>/dev/null && fail=1
if "$pwd/../../src/test" -w /dev/stdout >/dev/null &&
"$pwd/../../src/test" ! -w /dev/stdout >&-; then
"$pwd/../../src/printf" 'foo' >&- 2>/dev/null && fail=1
cp --verbose a b >&- 2>/dev/null && fail=1
fi
# Likewise for /dev/full, if /dev/full works.
if test -w /dev/full && test -c /dev/full; then
"$pwd"/../../src/printf 'foo' >/dev/full 2>/dev/null && fail=1
"$pwd/../../src/printf" 'foo' >/dev/full 2>/dev/null && fail=1
cp --verbose a b >/dev/full 2>/dev/null && fail=1
fi

View File

@@ -1,5 +1,5 @@
#!/bin/sh
# Check "printf" with long arguments.
# Ensure that pwd works even when run from a very deep directory.
# Copyright (C) 2006 Free Software Foundation, Inc.
@@ -46,7 +46,7 @@ export ARGV_0
CWD=$pwd/$tmp
export CWD
$PERL -w -- - <<\EOF
$PERL -Tw -- - <<\EOF
# Show that pwd works even when the length of the resulting
# directory name is longer than PATH_MAX.
@@ -55,6 +55,10 @@ use Cwd;
(my $ME = $ENV{ARGV_0}) =~ s|.*/||;
# Set up a safe, well-known environment
delete @ENV{qw(BASH_ENV CDPATH ENV PATH)};
$ENV{IFS} = '';
my $cwd = $ENV{CWD};
my $z = 'z' x 31;
my $n = 256;
@@ -72,10 +76,19 @@ until (++$i == $n);
my $build_src_dir = $ENV{BUILD_SRC_DIR};
$build_src_dir
or die "$ME: envvar BUILD_SRC_DIR not defined\n";
if ($build_src_dir !~ m!^([-.:/\w]+)$!)
{
warn "$0: skipping this test; odd build source directory name:\n"
. "$build_src_dir\n";
exit 77;
}
$build_src_dir = $1;
my $pwd_binary = "$build_src_dir/pwd";
-x $pwd_binary
or die "$ME: $pwd_binary is not an executable file\n";
chomp (my $actual = `"$pwd_binary"`);
chomp (my $actual = `$pwd_binary`);
if ($expected ne $actual)
{
my $e_len = length $expected;

View File

@@ -32,7 +32,7 @@ tmp=`echo "$0"|sed 's,.*/,,'`.tmp
trap 'status=$?; cd "$pwd" && rm -rf $tmp && exit $status' 0
trap '(exit $?); exit' 1 2 13 15
mkdir --parents "$pwd"/$tmp/a/b/c || fail=1
mkdir --parents "$pwd/$tmp/a/b/c" || fail=1
test -d $tmp || fail=1

View File

@@ -28,7 +28,7 @@ tmp=`echo "$0"|sed 's,.*/,,'`.tmp
trap 'status=$?; cd "$pwd" && rm -rf $tmp && exit $status' 0
trap '(exit $?); exit' 1 2 13 15
mkdir --parents "$pwd"/$tmp || fail=1
mkdir --parents "$pwd/$tmp" || fail=1
test -d $tmp || fail=1

View File

@@ -45,20 +45,20 @@ if test $framework_failure = 1; then
fi
p=$pwd/$tmp
(cd no-access && chmod 0 . && mkdir -p "$p"/a/b u/v) 2> /dev/null && fail=1
test -d "$p"/a/b || fail=1
(cd no-access && chmod 0 . && mkdir -p "$p/a/b" u/v) 2> /dev/null && fail=1
test -d "$p/a/b" || fail=1
# Same as above, but with a following *absolute* name, it should succeed
(cd no-acce2s && chmod 0 . && mkdir -p "$p"/b/b "$p"/z) || fail=1
test -d "$p"/b/b && test -d "$p"/z || fail=1
(cd no-acce2s && chmod 0 . && mkdir -p "$p/b/b" "$p/z") || fail=1
test -d "$p/b/b" && test -d "$p/z" || fail=1
# Same as above, but a trailing relative name in an unreadable directory
# whose parent is inaccessible. coreutils 5.97 fails this test.
(cd no-acce3s/d && chmod a-rx .. && chmod a-r . && mkdir -p a/b "$p"/b/c d/e &&
(cd no-acce3s/d && chmod a-rx .. && chmod a-r . && mkdir -p a/b "$p/b/c" d/e &&
test -d a/b && test -d d/e) || fail=1
test -d "$p"/b/c || fail=1
test -d "$p/b/c" || fail=1
b=`ls "$p"/a|tr -d '\n'`
b=`ls "$p/a" | tr -d '\n'`
# With coreutils-5.3.0, this would fail with $b=bu.
test "x$b" = xb || fail=1

View File

@@ -44,7 +44,7 @@ if test $framework_failure = 1; then
(exit 1); exit 1
fi
. "$abs_srcdir"/../setgid-check
. "$abs_srcdir/../setgid-check"
fail=0
@@ -56,12 +56,12 @@ mkdir e-dir > /dev/null 2>&1 && fail=1
# Create an existing directory.
umask 077
mode_str=drwxr-x-wx
mode_arg=`"$abs_srcdir"/../rwx-to-mode $mode_str`
mode_arg=`"$abs_srcdir/../rwx-to-mode" $mode_str`
mkdir -m $mode_arg a || fail=1
# this `mkdir -p ...' shouldn't change perms of existing dir `a'.
d_mode_str=drwx-w--wx
d_mode_arg=`"$abs_srcdir"/../rwx-to-mode $d_mode_str`
d_mode_arg=`"$abs_srcdir/../rwx-to-mode" $d_mode_str`
mkdir -p -m $d_mode_arg a/b/c/d
# Make sure the permissions of `a' haven't been changed.

View File

@@ -45,8 +45,8 @@ if test $framework_failure = 1; then
(exit 1); exit 1
fi
. "$abs_srcdir"/../setgid-check
. "$abs_srcdir"/../umask-check
. "$abs_srcdir/../setgid-check"
. "$abs_srcdir/../umask-check"
fail=0

View File

@@ -43,8 +43,9 @@ TESTS = \
i-1 hard-link-1 force partition-perm to-symlink dir-file diag \
part-symlink part-rename trailing-slash
EXTRA_DIST = $(TESTS) setup vfat
EXTRA_DIST = $(TESTS) vfat
TESTS_ENVIRONMENT = \
PERL="$(PERL)" \
EGREP="$(EGREP)" \
PATH="$(VG_PATH_PREFIX)`pwd`/../../src$(PATH_SEPARATOR)$$PATH" \
PROG=mv

View File

@@ -20,7 +20,7 @@
# 02110-1301, USA.
. $srcdir/../acl
. $srcdir/setup
. $srcdir/../other-fs-tmpdir
# Make sure we get English translations.
. $srcdir/../lang-default

View File

@@ -58,7 +58,7 @@ fi
fail=0
strace -qe unlink mv -T s1 s2 > out 2>&1 || fail=1
grep unlink out && fail=1
$EGREP 'unlink.*"s1"' out && fail=1
# Ensure that the source, s1, is gone.
ls -dl s1 > /dev/null 2>&1 && fail=1

View File

@@ -23,7 +23,7 @@ if test "$VERBOSE" = yes; then
mv --version
fi
. $srcdir/setup
. $srcdir/../other-fs-tmpdir
. $srcdir/../envvar-check
if test -z "$other_partition_tmpdir"; then

View File

@@ -24,7 +24,7 @@ if test "$VERBOSE" = yes; then
mv --version
fi
. $srcdir/setup
. $srcdir/../other-fs-tmpdir
# Make sure we get English translations.
. $srcdir/../lang-default

View File

@@ -25,7 +25,7 @@ if test "$VERBOSE" = yes; then
mv --version
fi
. $srcdir/setup
. $srcdir/../other-fs-tmpdir
. $srcdir/../envvar-check
if test -z "$other_partition_tmpdir"; then

View File

@@ -30,7 +30,7 @@ if test "$VERBOSE" = yes; then
mv --version
fi
. $srcdir/setup
. $srcdir/../other-fs-tmpdir
. $srcdir/../envvar-check
PRIV_CHECK_ARG=require-non-root . $srcdir/../priv-check

View File

@@ -29,7 +29,7 @@ tmp=mv-spec.$$
trap 'status=$?; cd "$pwd" && exec 1>&2; rm -rf $tmp $other_partition_tmpdir && exit $status' 0
trap '(exit $?); exit' 1 2 13 15
. $srcdir/setup
. $srcdir/../other-fs-tmpdir
. $srcdir/../envvar-check
# Make sure we get English translations.
. $srcdir/../lang-default

View File

@@ -26,7 +26,7 @@ if test "$VERBOSE" = yes; then
mv --version
fi
. $srcdir/setup
. $srcdir/../other-fs-tmpdir
. $srcdir/../envvar-check
. $srcdir/../lang-default
PRIV_CHECK_ARG=require-non-root . $srcdir/../priv-check

View File

@@ -26,7 +26,7 @@ if test "$VERBOSE" = yes; then
mv --version
fi
. $srcdir/setup
. $srcdir/../other-fs-tmpdir
. $srcdir/../envvar-check
pwd=`pwd`

View File

@@ -25,7 +25,7 @@ if test "$VERBOSE" = yes; then
mv --version
fi
. $srcdir/setup
. $srcdir/../other-fs-tmpdir
. $srcdir/../envvar-check
pwd=`pwd`

View File

@@ -32,7 +32,7 @@ trap '(exit $?); exit' 1 2 13 15
pwd_tmp=$pwd/$tmp
. $srcdir/setup
. $srcdir/../other-fs-tmpdir
. $srcdir/../envvar-check
# Make sure the programs use C-locale formats/translations.
. $srcdir/../lang-default

View File

@@ -23,7 +23,7 @@ if test "$VERBOSE" = yes; then
mv --version
fi
. $srcdir/setup
. $srcdir/../other-fs-tmpdir
. $srcdir/../envvar-check
. $srcdir/../lang-default

View File

@@ -24,7 +24,7 @@ if test "$VERBOSE" = yes; then
mv --version
fi
. $srcdir/setup
. $srcdir/../other-fs-tmpdir
. $srcdir/../envvar-check
if test -z "$other_partition_tmpdir"; then

View File

@@ -31,7 +31,7 @@ trap 'status=$?; (exit $status); exit $status' 1 2 13 15
fail=1
while :; do
bindir=`cd ../../src && pwd`|| break
my_pwd=`"$bindir"/pwd` || break
my_pwd=`"$bindir/pwd"` || break
mkdir -p $tmp || break
cd $tmp || break

View File

@@ -31,7 +31,7 @@ trap 'status=$?; (exit $status); exit $status' 1 2 13 15
fail=1
while :; do
bindir=`cd ../../src && pwd`|| break
my_pwd=`"$bindir"/pwd` || break
my_pwd=`"$bindir/pwd"` || break
mkdir -p $tmp || break
cd $tmp || break

View File

@@ -31,7 +31,7 @@ trap 'status=$?; (exit $status); exit $status' 1 2 13 15
fail=1
while :; do
bindir=`cd ../../src && pwd`|| break
my_pwd=`"$bindir"/pwd` || break
my_pwd=`"$bindir/pwd"` || break
mkdir -p $tmp || break
cd $tmp || break

View File

@@ -21,6 +21,7 @@
AUTOMAKE_OPTIONS = 1.1 gnits
TESTS = \
one-file-system \
ignorable \
readdir-bug \
empty-inacc \

View File

@@ -56,9 +56,9 @@ fail=0
p=$pwd/$tmp
set +x
(cd no-access; chmod 0 . && rm -r "$p"/abs1 rel "$p"/abs2) 2> out && fail=1
test -d "$p"/abs1 && fail=1
test -d "$p"/abs2 && fail=1
(cd no-access; chmod 0 . && rm -r "$p/abs1" rel "$p/abs2") 2> out && fail=1
test -d "$p/abs1" && fail=1
test -d "$p/abs2" && fail=1
cat <<\EOF > exp || fail=1
rm: cannot remove `rel': Permission denied

67
tests/rm/one-file-system Executable file
View File

@@ -0,0 +1,67 @@
#!/bin/sh
# Demonstrate rm's new --one-file-system option.
# 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
rm --version
fi
PRIV_CHECK_ARG=require-root . $srcdir/../priv-check
. $srcdir/../lang-default
. $srcdir/../other-fs-tmpdir
if test -z "$other_partition_tmpdir"; then
(exit 77); exit 77
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 '(exit $?); exit $?' 1 2 13 15
t0="$t0 $other_partition_tmpdir"
framework_failure=0
mkdir -p $tmp || framework_failure=1
cd $tmp || framework_failure=1
t=$other_partition_tmpdir
mkdir -p a/b $t/y
mount --bind $t a/b || framework_failure=1
cat <<\EOF > exp || framework_failure=1
rm: skipping `a/b', since it's on a different device
EOF
if test $framework_failure = 1; then
echo "$0: failure in testing framework" 1>&2
(exit 1); exit 1
fi
fail=0
rm --one-file-system -rf a 2> out && fail=1
test -d $t/y || fail=1
umount $t
cmp out exp || fail=1
test $fail = 1 && diff out exp 2> /dev/null
(exit $fail); exit $fail

View File

@@ -47,16 +47,16 @@ chmod u=x,go= .
t=$pwd/$tmp
# With coreutils-5.2.1, this would get a failed assertion.
rm -r "$t"/a "$t"/b || fail=1
rm -r "$t/a" "$t/b" || fail=1
# With coreutils-5.2.1, this would get the following:
# rm: cannot get current directory: Permission denied
# rm: failed to return to initial working directory: Bad file descriptor
rm -r "$t"/d "$t"/e || fail=1
rm -r "$t/d" "$t/e" || fail=1
test -d "$t"/a && fail=1
test -d "$t"/b && fail=1
test -d "$t"/d && fail=1
test -d "$t"/e && fail=1
test -d "$t/a" && fail=1
test -d "$t/b" && fail=1
test -d "$t/d" && fail=1
test -d "$t/e" && fail=1
(exit $fail); exit $fail

View File

@@ -1,7 +1,7 @@
#!/bin/sh
# FIXME
# Copyright (C) 2000, 2001, 2002, 2003, 2006 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

View File

@@ -41,8 +41,8 @@ chattr +a f 2>/dev/null || framework_failure=1
echo x >> f || framework_failure=1
if test $framework_failure = 1; then
echo "$0: failure in testing framework" 1>&2
(exit 1); exit 1
echo "$0: chattr +a doesn't work on this file system; skipping this test " 1>&2
(exit 77); exit 77
fi
fail=0

View File

@@ -46,8 +46,8 @@ touch -ca no-file > /dev/null 2>&1 || fail=1
# If >&- works, test "touch -c -" etc.
# >&- apparently does not work in HP-UX 11.23.
# This test is ineffective unless /dev/stdout also works.
if "$pwd"/../../src/test -w /dev/stdout >/dev/null &&
"$pwd"/../../src/test ! -w /dev/stdout >&-; then
if "$pwd/../../src/test" -w /dev/stdout >/dev/null &&
"$pwd/../../src/test" ! -w /dev/stdout >&-; then
touch -c - >&- 2> /dev/null || fail=1
touch -cm - >&- 2> /dev/null || fail=1
touch -ca - >&- 2> /dev/null || fail=1