Compare commits

...

42 Commits
v6.6 ... v6.7

Author SHA1 Message Date
Jim Meyering
f044d2d51c Version 6.7.
* NEWS: Record release date.  Remove '-pre' suffix.
* configure.ac (AC_INIT): Remove version string suffix.
2006-12-08 00:03:00 +01:00
Jim Meyering
565b165115 * tests/touch/empty-file: Use envvar-check, so "make check" doesn't
evoke diagnostics like this when COLUMNS=0 in the environment:
ls: ignoring invalid width in environment variable COLUMNS: 0
* tests/touch/no-rights: Likewise.
* tests/help-version: Likewise.
2006-12-07 10:11:40 +01:00
Jim Meyering
9f1b96313e Make the output of "make check" more reproducible.
* tests/uniq/Test.pm: Don't perform the pipe-reading version of test
118, since it emits "cat: write error: Broken pipe" on some systems.
2006-12-07 10:04:04 +01:00
Paul Eggert
fc92148eac cp -p now clears special bits if it fails to preserve owner or group
* NEWS: Document the cp -p fix for special bits.
* src/copy.c (set_owner): Now returns a three-way result, so
that the caller can clear the special bits.  All callers changed.
(copy_reg): Don't set the special bits if chown failed.
(copy_internal): Likewise.
* tests/cp/special-bits: Test this fix.
Signed-off-by: Jim Meyering <jim@meyering.net>
2006-12-07 08:10:35 +01:00
Paul Eggert
a4f7b723f0 * NEWS: Document the cp --preserve=ownership fix.
* m4/jm-macros.m4 (coreutils_MACROS): Check for fchmod.
* src/copy.c (fchmod_or_lchmod): New function.
(copy_reg): New arg OMITTED_PERMISSIONS.  All uses changed.
Omit confusing and unused ", dst_mode" arg to 'open' without O_CREAT.
When creating a file, use O_EXCL, so we're more likely to detect
funny business by other processes.  At the end, if permissions
were omitted, chmod them back in.
(copy_internal): If the ownership might change, omit some permissions
at first, then restore them after chowning the file.
* src/cp.c (make_dir_parents_private): Likewise.
* src/copy.c (cached_umask): New function.
* src/copy.h (cached_umask): New decl.
2006-12-06 20:44:08 +01:00
Jim Meyering
e7f7dcb9d1 Make the output of "make check" more reproducible.
* tests/misc/date-sec: Don't emit any diagnostic about sleeping.
2006-12-06 16:36:29 +01:00
Jim Meyering
545df07893 NEWS: the du bug affects coreutils-6.4, 6.5 and 6.6. 2006-12-06 13:18:43 +01:00
Paul Eggert
8406e92795 install.c: Preserve time stamps before changing owner or file mode bits,
for consistency with other coreutils programs.
2006-12-04 10:06:11 +01:00
Jim Meyering
1ea616697a * Makefile.am (libcoreutils_a_SOURCES): Remove xmemcoll.c and
xmemcoll.h.  Now, they're handled by the gnulib xmemcoll module.
2006-12-03 19:42:26 +01:00
Jim Meyering
5e585ffe84 * tests/misc/date-sec: Output a fixed string. 2006-12-03 16:01:41 +01:00
Jim Meyering
370370c8e4 Add "Reported by" 2006-12-03 11:32:31 +01:00
Jim Meyering
ba45154d8e * NEWS: du --one-file-system (-x) would skip subdirectories of any
directory listed as second or subsequent command line argument.
* tests/du/one-file-system: New file.  Test for today's fts.c fix.
* tests/du/Makefile.am (TESTS): Add one-file-system.
2006-12-03 11:17:35 +01:00
Jim Meyering
6e7e2709c8 * tests/du/basic: Generate 4KB file simply using printf, rather than
seq+head.  This avoids a spurious "Broken pipe" diagnostic from seq.
2006-12-02 22:04:13 +01:00
Jim Meyering
aa0fb1e032 * perm.texi (Mode Structure): Fix typo: s/setgid/setuid/.
Reported by Georg Neis as Debian bug 400778.
2006-11-28 23:03:08 +01:00
Jim Meyering
1ddf7faf11 * tests/mv/no-target-dir: Detect a buggy rename syscall. If found,
skip this test.  This happens at least on ia64 linux-2.4.19 w/ext3.
Reported by Matthew Woehlke.
2006-11-28 13:36:37 +01:00
Jim Meyering
db7092bed3 * tests/mv/dir2dir: Also accept EBUSY.
Reported by Matthew Woehlke.
2006-11-28 09:21:00 +01:00
Jim Meyering
97136cb93f * Makefile.maint (patch-check): Rewrite to diagnose failure.
* src/c99-to-c89.diff: Adjust shred.c offsets.
2006-11-27 14:38:35 +01:00
Paul Eggert
9b06af3367 Improve the check for departures from C89, and fix the departures
I found.
* Makefile.maint (my-distcheck): Also check for C89 compatibility
as best we can with GCC.
* src/stat.c (PRINTF_OPTION): Omit comma before } in enum
declaration; C89 doesn't allow this.
* src/dcgen: Don't generate string literals longer than
what C89 requires support for.
* src/cut.c (usage): Don't use string literals longer than
what C89 requires support for.
* src/date.c (usage): Likewise.
* src/dd.c (usage): Likewise.
* src/du.c (usage): Likewise.
* src/ls.c (usage): Likewise.
* src/od.c (usage): Likewise.
* src/readlink.c (usage): Likewise.
* src/seq.c (usage): Likewise.
* src/shred.c (usage): Likewise.
2006-11-27 11:27:46 +01:00
Mike Frysinger
a45772d52d recognize new archive, audio, image formats; give audio files a separate color
* src/dircolors.hin: Add comments for common .sh and .csh scripts.
Add .bz2, .tbz2, .tz, .rar, .ace, .zoo, .cpio, .7z, .rz as archive
suffixes.  Add .mng, .pcx, .m2v, .mkv, .ogm, .mp4, .m4v, .mp4v, .vob,
.qt, .nuv, .wmv, .asf, .rm, .rmvb, .flc, .yuv as image formats.
Add .aac, .au, .mid, .midi, .mka, .ra as audio suffixes.  Change
audio color to 00;36 to differentiate from image/video color.
2006-11-27 08:58:40 +01:00
Jim Meyering
a43ee65ee5 * Makefile.maint (patch-check): Compile patched sources with
CFLAGS='-Wdeclaration-after-statement -Werror', to ensure that
no violations remain.
2006-11-26 18:51:27 +01:00
Jim Meyering
549bbdf7b4 * src/c99-to-c89.diff: Remove 3 bogus hunks. 2006-11-26 18:49:55 +01:00
Jim Meyering
5e2f415d17 * src/remove.c (fd_to_subdirp): Remove unused parameter, ds.
Update callers.
2006-11-26 18:47:54 +01:00
Jim Meyering
d6a37dfa3b * src/c99-to-c89.diff: Adjust for changes in rm.c and in remove.c. 2006-11-26 18:42:56 +01:00
Jim Meyering
8ec7811e82 * src/rm.c (main): Remove unnecessary (assuming C99) braces. 2006-11-26 18:35:38 +01:00
Jim Meyering
08dcc35470 Reflect that these are Paul's changes. I've divided them into separate
deltas.

Signed-off-by: Paul Eggert <eggert@cs.ucla.edu>
2006-11-26 17:41:00 +01:00
Paul Eggert
17a7d2c81b Port parts of the code to C89 to minimize the need for c99-to-c89.diff,
while trying to retain the readability of C99 as much as possible.
* src/remove.c (close_preserve_errno): Remove.
(fd_to_subdirp): Rewrite to avoid the need for decl after statement.

Signed-off-by: Paul Eggert <eggert@cs.ucla.edu>
2006-11-26 17:40:38 +01:00
Paul Eggert
a23c91026d * src/remove.c (rm): Move cycle_check_init call into callee...
Use an else clause in place of a "continue" statement.

Signed-off-by: Paul Eggert <eggert@cs.ucla.edu>
2006-11-26 17:40:37 +01:00
Paul Eggert
1ce71652fc * src/remove.c (AD_ensure_initialized): New function.
after statement.

Signed-off-by: Paul Eggert <eggert@cs.ucla.edu>
2006-11-26 17:40:16 +01:00
Paul Eggert
1b95d5ee81 * src/remove.c (AD_pop_and_chdir): Return prev_dir rather than storing through
a pointer argument.  All uses changed.

Signed-off-by: Paul Eggert <eggert@cs.ucla.edu>
2006-11-26 17:39:53 +01:00
Paul Eggert
6b7c67ad88 * src/remove.c (cache_stat_init): Return its argument, for convenience.
Update the caller in remove_dir.

Signed-off-by: Paul Eggert <eggert@cs.ucla.edu>
2006-11-26 17:39:27 +01:00
Paul Eggert
02e24f2593 * src/remove.c (rm_1): Remove decl of local, fd_cwd.
Replace each of two uses with literal AT_FDCWD.

Signed-off-by: Paul Eggert <eggert@cs.ucla.edu>
2006-11-26 17:38:09 +01:00
Jim Meyering
5891b7ce21 * Makefile.am (EXTRA_DIST): Remove announce-gen from here, too. 2006-11-25 19:16:26 +01:00
Theodoros V. Kalamatianos
c8092e5db0 * tests/du/inacc-dest: Skip this test when running as root. 2006-11-24 22:08:33 +01:00
Jim Meyering
8cafe0070a Add announce-gen to build-aux/.*ignore files. 2006-11-23 16:31:18 +01:00
Jim Meyering
d0275e280e * announce-gen: Remove file. It's moving to gnulib.
* bootstrap: Pull it from gnulib/build-aux instead.
* Makefile.maint (announcement): Reflect move to ./build-aux.
2006-11-23 16:28:49 +01:00
Jim Meyering
37012effc9 * tests/du/deref-args: Use "printf %65536s x" to create a 64KB file,
rather than a pipeline that would sometimes evoke a diagnostic
like "seq: write error: Broken pipe".
2006-11-23 09:09:53 +01:00
Jim Meyering
a409011bba * tests/help-version: Suppress dd transfer rate output. 2006-11-23 09:02:36 +01:00
Jim Meyering
a3ae3e8085 * configure.ac (AC_INIT): Bump to 6.7-pre, not 6.6-pre. 2006-11-23 01:12:22 +01:00
Paul Eggert
3ccd02d5b9 * randread.c (__attribute__): Don't define if __attribute__ is already defined.
Otherwise, the code won't conform to C99, since
the macro arg is spelled differently by some include file, and the
compilation fails with pedantic GCC.
2006-11-23 01:06:42 +01:00
Jim Meyering
5272c6daa1 * announce-gen (print_news_deltas): Fix silly, but harmless typo:
change "(:?..." to "(?:..." in regexps.
2006-11-22 16:16:05 +01:00
Jim Meyering
e750c5cac8 Post-release version change.
* NEWS: Add a line for 6.7-pre.
* configure.ac (AC_INIT): Bump to 6.7 and add "-pre" suffix.
2006-11-22 16:15:02 +01:00
Jim Meyering
92210636da .prev-version: Record previous version: 6.6. 2006-11-22 12:52:34 +01:00
48 changed files with 685 additions and 692 deletions

View File

@@ -1 +1 @@
6.5
6.6

177
ChangeLog
View File

@@ -1,5 +1,182 @@
2006-12-07 Jim Meyering jim@meyering.net
Version 6.7.
* NEWS: Record release date. Remove '-pre' suffix.
* configure.ac (AC_INIT): Remove version string suffix.
2006-12-07 Jim Meyering <jim@meyering.net>
Make the output of "make check" more reproducible.
* tests/touch/empty-file: Use envvar-check, so "make check" doesn't
evoke diagnostics like this when COLUMNS=0 in the environment:
ls: ignoring invalid width in environment variable COLUMNS: 0
* tests/touch/no-rights: Likewise.
* tests/help-version: Likewise.
* tests/uniq/Test.pm: Don't perform the pipe-reading version of test
118, since it emits "cat: write error: Broken pipe" on some systems.
2006-12-06 Paul Eggert <eggert@cs.ucla.edu>
* NEWS: Document the cp -p fix for special bits.
* src/copy.c (set_owner): Now returns a three-way result, so
that the caller can clear the special bits. All callers changed.
(copy_reg): Don't set the special bits if chown failed.
(copy_internal): Likewise.
* tests/cp/special-bits: Test this fix.
2006-12-06 Paul Eggert <eggert@cs.ucla.edu>
* NEWS: Document the cp --preserve=ownership fix.
* m4/jm-macros.m4 (coreutils_MACROS): Check for fchmod.
* src/copy.c (fchmod_or_lchmod): New function.
(copy_reg): New arg OMITTED_PERMISSIONS. All uses changed.
Omit confusing and unused ", dst_mode" arg to 'open' without O_CREAT.
When creating a file, use O_EXCL, so we're more likely to detect
funny business by other processes. At the end, if permissions
were omitted, chmod them back in.
(copy_internal): If the ownership might change, omit some permissions
at first, then restore them after chowning the file.
* src/cp.c (make_dir_parents_private): Likewise.
* src/copy.c (cached_umask): New function.
* src/copy.h (cached_umask): New decl.
2006-12-06 Jim Meyering <jim@meyering.net>
Make the output of "make check" more reproducible.
* tests/misc/date-sec: Don't emit any diagnostic about sleeping.
2006-12-03 Paul Eggert <eggert@cs.ucla.edu>
* src/install.c (install_file_in_file): Preserve time stamps
before changing owner or file mode bits, for consistency with
other coreutils programs.
2006-12-03 Jim Meyering <jim@meyering.net>
* tests/misc/date-sec: Output a fixed string.
* NEWS: du --one-file-system (-x) would skip subdirectories of any
directory listed as second or subsequent command line argument.
* tests/du/one-file-system: New file. Test for today's fts.c fix.
* tests/du/Makefile.am (TESTS): Add one-file-system.
Reported by Mike Frysinger.
2006-12-02 Jim Meyering <jim@meyering.net>
* tests/du/basic: Generate 4KB file simply using printf, rather than
seq+head. This avoids a spurious "Broken pipe" diagnostic from seq.
2006-11-28 Jim Meyering <jim@meyering.net>
* tests/mv/no-target-dir: Detect a buggy rename syscall. If found,
skip this test. This happens at least on ia64 linux-2.4.19 w/ext3.
Reported by Matthew Woehlke.
* tests/mv/dir2dir: Also accept EBUSY.
Reported by Matthew Woehlke.
2006-11-27 Jim Meyering <jim@meyering.net>
* Makefile.maint (patch-check): Rewrite to diagnose failure.
* src/c99-to-c89.diff: Adjust shred.c offsets.
2006-11-26 Paul Eggert <eggert@cs.ucla.edu>
Improve the check for departures from C89, and fix the departures
I found.
* Makefile.maint (my-distcheck): Also check for C89 compatibility
as best we can with GCC.
* src/stat.c (PRINTF_OPTION): Omit comma before } in enum
declaration; C89 doesn't allow this.
* src/dcgen: Don't generate string literals longer than
what C89 requires support for.
* src/cut.c (usage): Don't use string literals longer than
what C89 requires support for.
* src/date.c (usage): Likewise.
* src/dd.c (usage): Likewise.
* src/du.c (usage): Likewise.
* src/ls.c (usage): Likewise.
* src/od.c (usage): Likewise.
* src/readlink.c (usage): Likewise.
* src/seq.c (usage): Likewise.
* src/shred.c (usage): Likewise.
2006-11-26 Mike Frysinger <vapier@gentoo.org>
Recognize new archive, audio and image formats.
Give audio files a separate color.
* src/dircolors.hin: Add comments for common .sh and .csh scripts.
Add .bz2, .tbz2, .tz, .rar, .ace, .zoo, .cpio, .7z, .rz as archive
suffixes. Add .mng, .pcx, .m2v, .mkv, .ogm, .mp4, .m4v, .mp4v, .vob,
.qt, .nuv, .wmv, .asf, .rm, .rmvb, .flc, .yuv as image formats.
Add .aac, .au, .mid, .midi, .mka, .ra as audio suffixes. Change
audio color to 00;36 to differentiate from image/video color.
2006-11-26 Jim Meyering <jim@meyering.net>
* Makefile.maint (patch-check): Compile patched sources with
CFLAGS='-Wdeclaration-after-statement -Werror', to ensure that
no violations remain.
* src/c99-to-c89.diff: Remove 3 bogus hunks.
* src/remove.c (fd_to_subdirp): Remove unused parameter, ds.
Update callers.
* src/c99-to-c89.diff: Adjust for changes in rm.c and in remove.c.
* src/rm.c (main): Remove unnecessary (assuming C99) braces.
2006-11-26 Paul Eggert <eggert@cs.ucla.edu>
Port parts of the code to C89 to minimize the need for c99-to-c89.diff,
while trying to retain the readability of C99 as much as possible.
* src/remove.c (rm_1): Remove decl of local, fd_cwd.
Replace each of two uses with literal AT_FDCWD.
(cache_stat_init): Return its argument, for convenience.
Update the caller in remove_dir.
(AD_pop_and_chdir): Return prev_dir rather than storing through
a pointer argument. All uses changed.
(AD_ensure_initialized): New function.
(AD_mark_helper): Use it, to avoid the need for declaration
after statement.
(rm): Move cycle_check_init call into callee...
(rm_1): ...here.
Use an else clause in place of a "continue" statement.
(close_preserve_errno): Remove.
(fd_to_subdirp): Rewrite to avoid the need for decl after statement.
2006-11-25 Jim Meyering <jim@meyering.net>
* Makefile.am (EXTRA_DIST): Remove announce-gen from here, too.
2006-11-24 Theodoros V. Kalamatianos <thkala@softlab.ece.ntua.gr> (tiny change)
* tests/du/inacc-dest: Skip this test when running as root.
2006-11-23 Jim Meyering <jim@meyering.net>
* announce-gen: Remove file. It's moving to gnulib.
* bootstrap: Pull it from gnulib/build-aux instead.
* Makefile.maint (announcement): Reflect move to ./build-aux.
* tests/du/deref-args: Use "printf %65536s x" to create a 64KB file,
rather than a pipeline that would sometimes evoke a diagnostic
like "seq: write error: Broken pipe".
* tests/help-version: Suppress dd transfer rate output.
* configure.ac (AC_INIT): Bump to 6.7-pre, not 6.6-pre.
2006-11-22 Jim Meyering <jim@meyering.net>
* announce-gen (print_news_deltas): Fix silly, but harmless typo:
change "(:?..." to "(?:..." in regexps.
Post-release version change.
* NEWS: Add a line for 6.7-pre.
* configure.ac (AC_INIT): Bump to 6.7 and add "-pre" suffix.
Version 6.6.
* NEWS: Record release date. Remove "-pre" suffix.
* configure.ac (AC_INIT): Remove "-pre" suffix from version string.

View File

@@ -33,7 +33,6 @@ EXTRA_DIST = Makefile.cfg Makefile.maint GNUmakefile \
.x-sc_unmarked_diagnostics \
.x-sc_useless_cpp_parens \
ChangeLog-2005 \
announce-gen \
bootstrap \
bootstrap.conf \
build-aux/cvsu \

View File

@@ -330,12 +330,16 @@ patch-check:
cp -a src src-c89
(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
grep -v '^patching file ' $@.1 > $@.2 || :
msg=ok; test -s $@.2 && msg='fuzzy patch' || : ; \
rm -f src-c89/*.o || msg='rm failed'; \
$(MAKE) -C src-c89 CFLAGS='-Wdeclaration-after-statement -Werror' \
|| msg='compile failure with extra options'; \
rm -rf src-c89 $@.1 $@.2; \
test $$msg = ok && : || echo "$$msg" 1>&2; \
test $$msg = ok
# Ensure that date's --help output stays in sync with the info
# documentation for GNU strftime. The only exception is %N,
@@ -525,6 +529,11 @@ my-distcheck: $(local-check) $(release_archive_dir)/$(prev-tgz)
(cd $(t) && mv $(distdir) $(distdir).old \
&& $(AMTAR) -zxf - ) < $(distdir).tar.gz
diff -ur $(t)/$(distdir).old $(t)/$(distdir)
cd $(t)/$(distdir) \
&& (cd src && patch -V never --fuzz=0 <c99-to-c89.diff) \
&& ./configure --disable-largefile \
CFLAGS='-Werror -ansi -pedantic -Wno-long-long' \
&& $(MAKE)
-rm -rf $(t)
@echo "========================"; \
echo "$(distdir).tar.gz is ready for distribution"; \
@@ -547,7 +556,7 @@ xd-delta = $(PACKAGE)-$(PREV_VERSION)-$(VERSION).xdelta
rel-files = $(xd-delta) $(DIST_ARCHIVES)
announcement: NEWS ChangeLog $(rel-files)
@./announce-gen \
@./build-aux/announce-gen \
--release-type=$(RELEASE_TYPE) \
--package=$(PACKAGE) \
--prev=$(PREV_VERSION) \

26
NEWS
View File

@@ -1,5 +1,31 @@
GNU coreutils NEWS -*- outline -*-
* Noteworthy changes in release 6.7 (2006-12-08) [stable]
** Bug fixes
When cp -p copied a file with special mode bits set, the same bits
were set on the copy even when ownership could not be preserved.
This could result in files that were setuid to the wrong user.
To fix this, special mode bits are now set in the copy only if its
ownership is successfully preserved. Similar problems were fixed
with mv when copying across file system boundaries. This problem
affects all versions of coreutils through 6.6.
cp --preserve=ownership would create output files that temporarily
had too-generous permissions in some cases. For example, when
copying a file with group A and mode 644 into a group-B sticky
directory, the output file was briefly readable by group B.
Fix similar problems with cp options like -p that imply
--preserve=ownership, with install -d when combined with either -o
or -g, and with mv when copying across file system boundaries.
This bug affects coreutils 6.0 through 6.6.
du --one-file-system (-x) would skip subdirectories of any directory
listed as second or subsequent command line argument. This bug affects
coreutils-6.4, 6.5 and 6.6.
* Noteworthy changes in release 6.6 (2006-11-22) [stable]
** Bug fixes

View File

@@ -1,435 +0,0 @@
#!/usr/bin/perl -w
# Generate an announcement message.
# Copyright (C) 2002, 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
# 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.
use strict;
use Getopt::Long;
use Digest::MD5;
use Digest::SHA1;
(my $VERSION = '$Revision: 1.25 $ ') =~ tr/[0-9].//cd;
(my $ME = $0) =~ s|.*/||;
my %valid_release_types = map {$_ => 1} qw (alpha beta major);
END
{
# Nobody ever checks the status of print()s. That's okay, because
# if any do fail, we're guaranteed to get an indicator when we close()
# the filehandle.
#
# Close stdout now, and if there were no errors, return happy status.
# If stdout has already been closed by the script, though, do nothing.
defined fileno STDOUT
or return;
close STDOUT
and return;
# Errors closing stdout. Indicate that, and hope stderr is OK.
warn "$ME: closing standard output: $!\n";
# Don't be so arrogant as to assume that we're the first END handler
# defined, and thus the last one invoked. There may be others yet
# to come. $? will be passed on to them, and to the final _exit().
#
# If it isn't already an error, make it one (and if it _is_ an error,
# preserve the value: it might be important).
$? ||= 1;
}
sub usage ($)
{
my ($exit_code) = @_;
my $STREAM = ($exit_code == 0 ? *STDOUT : *STDERR);
if ($exit_code != 0)
{
print $STREAM "Try `$ME --help' for more information.\n";
}
else
{
my @types = sort keys %valid_release_types;
print $STREAM <<EOF;
Usage: $ME [OPTIONS]
OPTIONS:
Generate an announcement message.
FIXME: describe the following
--release-type=TYPE TYPE must be one of @types
--package-name=PACKAGE_NAME
--previous-version=VER
--current-version=VER
--gpg-key-id=ID The GnuPG ID of the key used to sign the tarballs
--url-directory=URL_DIR
--news=NEWS_FILE optional
--help display this help and exit
--version output version information and exit
EOF
}
exit $exit_code;
}
=item C<%size> = C<sizes (@file)>
Compute the sizes of the C<@file> and return them as a hash. Return
C<undef> if one of the computation failed.
=cut
sub sizes (@)
{
my (@file) = @_;
my $fail = 0;
my %res;
foreach my $f (@file)
{
my $cmd = "du --human $f";
my $t = `$cmd`;
# FIXME-someday: give a better diagnostic, a la $PROCESS_STATUS
$@
and (warn "$ME: command failed: `$cmd'\n"), $fail = 1;
chomp $t;
$t =~ s/^([\d.]+[MkK]).*/${1}B/;
$res{$f} = $t;
}
return $fail ? undef : %res;
}
=item C<print_locations ($title, \@url, \%size, @file)
Print a section C<$title> dedicated to the list of <@file>, which
sizes are stored in C<%size>, and which are available from the C<@url>.
=cut
sub print_locations ($\@\%@)
{
my ($title, $url, $size, @file) = @_;
print "Here are the $title:\n";
foreach my $url (@{$url})
{
for my $file (@file)
{
print " $url/$file";
print " (", $$size{$file}, ")"
if exists $$size{$file};
print "\n";
}
}
print "\n";
}
=item C<print_checksums (@file)
Print the MD5 and SHA1 signature section for each C<@file>.
=cut
sub print_checksums (@)
{
my (@file) = @_;
print "Here are the MD5 and SHA1 checksums:\n";
print "\n";
foreach my $meth (qw (md5 sha1))
{
foreach my $f (@file)
{
open IN, '<', $f
or die "$ME: $f: cannot open for reading: $!\n";
binmode IN;
my $dig =
($meth eq 'md5'
? Digest::MD5->new->addfile(*IN)->hexdigest
: Digest::SHA1->new->addfile(*IN)->hexdigest);
close IN;
print "$dig $f\n";
}
}
}
=item C<print_news_deltas ($news_file, $prev_version, $curr_version)
Print the section of the NEWS file C<$news_file> addressing changes
between versions C<$prev_version> and C<$curr_version>.
=cut
sub print_news_deltas ($$$)
{
my ($news_file, $prev_version, $curr_version) = @_;
print "\n$news_file\n\n";
# Print all lines from $news_file, starting with the first one
# that mentions $curr_version up to but not including
# the first occurrence of $prev_version.
my $in_items;
my $re_prefix = qr/\* (:?Noteworthy|Major) change/;
open NEWS, '<', $news_file
or die "$ME: $news_file: cannot open for reading: $!\n";
while (defined (my $line = <NEWS>))
{
if ( ! $in_items)
{
# Match lines like these:
# * Major changes in release 5.0.1:
# * Noteworthy changes in release 6.6 (2006-11-22) [stable]
$line =~ /^$re_prefix.*(:?[^\d.]|$)\Q$curr_version\E(:?[^\d.]|$)/o
or next;
$in_items = 1;
print $line;
}
else
{
# This regexp must not match version numbers in NEWS items.
# For example, they might well say `introduced in 4.5.5',
# and we don't want that to match.
$line =~ /^$re_prefix.*(:?[^\d.]|$)\Q$prev_version\E(:?[^\d.]|$)/o
and last;
print $line;
}
}
close NEWS;
$in_items
or die "$ME: $news_file: no matching lines for `$curr_version'\n";
}
sub print_changelog_deltas ($$)
{
my ($package_name, $prev_version) = @_;
# Print new ChangeLog entries.
# First find all CVS-controlled ChangeLog files.
use File::Find;
my @changelog;
find ({wanted => sub {$_ eq 'ChangeLog' && -d 'CVS'
and push @changelog, $File::Find::name}},
'.');
# If there are no ChangeLog files, we're done.
@changelog
or return;
my %changelog = map {$_ => 1} @changelog;
# Reorder the list of files so that if there are ChangeLog
# files in the specified directories, they're listed first,
# in this order:
my @dir = qw ( . src lib m4 config doc );
# A typical @changelog array might look like this:
# ./ChangeLog
# ./po/ChangeLog
# ./m4/ChangeLog
# ./lib/ChangeLog
# ./doc/ChangeLog
# ./config/ChangeLog
my @reordered;
foreach my $d (@dir)
{
my $dot_slash = $d eq '.' ? $d : "./$d";
my $target = "$dot_slash/ChangeLog";
delete $changelog{$target}
and push @reordered, $target;
}
# Append any remaining ChangeLog files.
push @reordered, sort keys %changelog;
# Remove leading `./'.
@reordered = map { s!^\./!!; $_ } @reordered;
print "\nChangeLog entries:\n\n";
# print join ("\n", @reordered), "\n";
$prev_version =~ s/\./_/g;
my $prev_cvs_tag = "\U$package_name\E-$prev_version";
my $cmd = "cvs -n diff -u -r$prev_cvs_tag -rHEAD @reordered";
open DIFF, '-|', $cmd
or die "$ME: cannot run `$cmd': $!\n";
# Print two types of lines, making minor changes:
# Lines starting with `+++ ', e.g.,
# +++ ChangeLog 22 Feb 2003 16:52:51 -0000 1.247
# and those starting with `+'.
# Don't print the others.
my $prev_printed_line_empty = 1;
while (defined (my $line = <DIFF>))
{
if ($line =~ /^\+\+\+ /)
{
my $separator = "*"x70 ."\n";
$line =~ s///;
$line =~ s/\s.*//;
$prev_printed_line_empty
or print "\n";
print $separator, $line, $separator;
}
elsif ($line =~ /^\+/)
{
$line =~ s///;
print $line;
$prev_printed_line_empty = ($line =~ /^$/);
}
}
close DIFF;
# The exit code should be 1.
# Allow in case there are no modified ChangeLog entries.
$? == 256 || $? == 128
or warn "$ME: warning: `cmd' had unexpected exit code or signal ($?)\n";
}
{
# Neutralize the locale, so that, for instance, "du" does not
# issue "1,2" instead of "1.2", what confuses our regexps.
$ENV{LC_ALL} = "C";
my $release_type;
my $package_name;
my $prev_version;
my $curr_version;
my $gpg_key_id;
my @url_dir_list;
my @news_file;
GetOptions
(
'release-type=s' => \$release_type,
'package-name=s' => \$package_name,
'previous-version=s' => \$prev_version,
'current-version=s' => \$curr_version,
'gpg-key-id=s' => \$gpg_key_id,
'url-directory=s' => \@url_dir_list,
'news=s' => \@news_file,
help => sub { usage 0 },
version => sub { print "$ME version $VERSION\n"; exit },
) or usage 1;
my $fail = 0;
# Ensure that sure each required option is specified.
$release_type
or (warn "$ME: release type not specified\n"), $fail = 1;
$package_name
or (warn "$ME: package name not specified\n"), $fail = 1;
$prev_version
or (warn "$ME: previous version string not specified\n"), $fail = 1;
$curr_version
or (warn "$ME: current version string not specified\n"), $fail = 1;
$gpg_key_id
or (warn "$ME: GnuPG key ID not specified\n"), $fail = 1;
@url_dir_list
or (warn "$ME: URL directory name(s) not specified\n"), $fail = 1;
exists $valid_release_types{$release_type}
or (warn "$ME: `$release_type': invalid release type\n"), $fail = 1;
@ARGV
and (warn "$ME: too many arguments\n"), $fail = 1;
$fail
and usage 1;
my $my_distdir = "$package_name-$curr_version";
my $tgz = "$my_distdir.tar.gz";
my $tbz = "$my_distdir.tar.bz2";
my $xd = "$package_name-$prev_version-$curr_version.xdelta";
my %size = sizes ($tgz, $tbz, $xd);
%size
or exit 1;
# The markup is escaped as <\# so that when this script is sent by
# mail (or part of a diff), Gnus is not triggered.
print <<EOF;
Subject: $my_distdir released
<\#secure method=pgpmime mode=sign>
FIXME: put comments here
EOF
print_locations ("compressed sources", @url_dir_list, %size,
$tgz, $tbz);
print_locations ("xdelta-style diffs", @url_dir_list, %size,
$xd);
print_locations ("GPG detached signatures[*]", @url_dir_list, %size,
"$tgz.sig", "$tbz.sig");
print_checksums ($tgz, $tbz, $xd);
print <<EOF;
[*] You can use either of the above signature files to verify that
the corresponding file (without the .sig suffix) is intact. First,
be sure to download both the .sig file and the corresponding tarball.
Then, run a command like this:
gpg --verify $tgz.sig
If that command fails because you don't have the required public key,
then run this command to import it:
gpg --keyserver wwwkeys.pgp.net --recv-keys $gpg_key_id
and rerun the \`gpg --verify' command.
EOF
print_news_deltas ($_, $prev_version, $curr_version)
foreach @news_file;
$release_type eq 'major'
or print_changelog_deltas ($package_name, $prev_version);
exit 0;
}
### Setup "GNU" style for perl-mode and cperl-mode.
## Local Variables:
## perl-indent-level: 2
## perl-continued-statement-offset: 2
## perl-continued-brace-offset: 0
## perl-brace-offset: 0
## perl-brace-imaginary-offset: 0
## perl-label-offset: -2
## cperl-indent-level: 2
## cperl-brace-offset: 0
## cperl-continued-brace-offset: 0
## cperl-label-offset: -2
## cperl-extra-newline-before-brace: t
## cperl-merge-trailing-else: nil
## cperl-continued-statement-offset: 2
## End:

View File

@@ -87,6 +87,7 @@ package=`sed -n "$extract_package_name" configure.ac` || exit
# Extra files from gnulib, which override files from other sources.
gnulib_extra_files='
build-aux/announce-gen
build-aux/install-sh
build-aux/missing
build-aux/mdate-sh

View File

@@ -1,3 +1,4 @@
announce-gen
compile
config.guess
config.rpath

View File

@@ -1,3 +1,4 @@
announce-gen
compile
config.guess
config.rpath

View File

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

View File

@@ -1,3 +1,8 @@
2006-11-28 Jim Meyering <jim@meyering.net>
* perm.texi (Mode Structure): Fix typo: s/setgid/setuid/.
Reported by Georg Neis as Debian bug 400778.
2006-10-27 Jim Meyering <jim@meyering.net>
* coreutils.texi (wc invocation): When giving the order in which

View File

@@ -75,7 +75,7 @@ executable files (programs) and, on most systems, directories:
@cindex set-user-ID
@cindex setuid
Set the process's effective user ID to that of the file upon execution
(called the @dfn{set-user-ID bit}, or sometimes the @dfn{setgid bit}).
(called the @dfn{set-user-ID bit}, or sometimes the @dfn{setuid bit}).
For directories on a few systems, give files created in the directory
the same owner as the directory, no matter who creates them, and set
the set-user-ID bit of newly-created subdirectories.

View File

@@ -1,3 +1,15 @@
2006-12-03 Jim Meyering <jim@meyering.net>
* Makefile.am (libcoreutils_a_SOURCES): Remove xmemcoll.c and
xmemcoll.h. Now, they're handled by the gnulib xmemcoll module.
2006-11-22 Paul Eggert <eggert@cs.ucla.edu>
* randread.c (__attribute__): Don't define if __attribute__ is
already defined. Otherwise, the code won't conform to C99, since
the macro arg is spelled differently by some include file, and the
compilation fails with pedantic GCC.
2006-11-22 Jim Meyering <jim@meyering.net>
* .cvsignore, .gitignore: Add fstat.c.

View File

@@ -26,7 +26,6 @@ LDADD = $(noinst_LIBRARIES)
libcoreutils_a_SOURCES += \
buffer-lcm.c buffer-lcm.h \
xmemcoll.c xmemcoll.h \
xmemxfrm.c xmemxfrm.h
libcoreutils_a_LIBADD += $(LIBOBJS)

View File

@@ -44,8 +44,10 @@
# define MIN(a, b) ((a) < (b) ? (a) : (b))
#endif
#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8) || __STRICT_ANSI__
# define __attribute__(x)
#ifndef __attribute__
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8) || __STRICT_ANSI__
# define __attribute__(x)
# endif
#endif
#ifndef ATTRIBUTE_UNUSED

View File

@@ -62,6 +62,7 @@ AC_DEFUN([coreutils_MACROS],
endgrent \
endpwent \
fchown \
fchmod \
ftruncate \
iswspace \
mkfifo \

View File

@@ -2,10 +2,11 @@ Index: src/remove.c
===================================================================
RCS file: /fetish/cu/src/remove.c,v
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
@@ -245,9 +245,10 @@ pop_dir (Dirstack_state *ds)
diff --git a/src/remove.c b/src/remove.c
index 4728bdd..7477da5 100644
--- a/src/remove.c
+++ b/src/remove.c
@@ -236,9 +236,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);
@@ -17,7 +18,7 @@ diff -u -p -u -r1.158 remove.c
assert (top_len >= 2);
/* Pop the specified length of file name. */
@@ -379,10 +380,11 @@ AD_stack_top (Dirstack_state const *ds)
@@ -370,10 +371,11 @@ AD_stack_top (Dirstack_state const *ds)
static void
AD_stack_pop (Dirstack_state *ds)
{
@@ -30,116 +31,57 @@ diff -u -p -u -r1.158 remove.c
if (top->unremovable)
hash_free (top->unremovable);
obstack_blank (&ds->Active_dir, -(int) sizeof (struct AD_ent));
@@ -549,6 +551,7 @@ AD_mark_helper (Hash_table **ht, char *f
if (*ht == NULL)
xalloc_die ();
}
+ {
void *ent = hash_insert (*ht, filename);
if (ent == NULL)
xalloc_die ();
@@ -557,7 +560,7 @@ AD_mark_helper (Hash_table **ht, char *f
if (ent != filename)
free (filename);
}
-
+ }
}
/* Mark FILENAME (in current directory) as unremovable. */
@@ -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)
{
@@ -1137,6 +1141,7 @@ fd_to_subdirp (int fd_cwd, char const *f
}
return subdir_dirp;
+ }
}
/* Remove entries in the directory open on DIRP
@@ -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;
+ 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. */
@@ -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;
+ 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)
@@ -1469,6 +1476,7 @@ rm_1 (Dirstack_state *ds, char const *fi
@@ -1463,6 +1465,7 @@ rm_1 (Dirstack_state *ds, char const *fi
return RM_ERROR;
}
+ {
struct stat st;
cache_stat_init (&st);
if (x->root_dev_ino)
@@ -1490,6 +1498,7 @@ rm_1 (Dirstack_state *ds, char const *fi
cycle_check_init (&ds->cycle_check_state);
@@ -1485,6 +1488,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);
enum RM_status status = remove_entry (AT_FDCWD, ds, filename, &st, x, NULL);
if (status == RM_NONEMPTY_DIR)
@@ -1508,6 +1517,8 @@ rm_1 (Dirstack_state *ds, char const *fi
ds_clear (ds);
{
@@ -1501,6 +1505,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.
@@ -1530,9 +1541,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);
assert (VALID_STATUS (s));
UPDATE_STATUS (status, s);
+ }
}
if (x->require_restore_cwd && cwd_errno)
Index: src/rm.c
===================================================================
RCS file: /fetish/cu/src/rm.c,v
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
@@ -369,8 +369,10 @@ main (int argc, char **argv)
if (!yesno ())
exit (EXIT_SUCCESS);
}
+ {
enum RM_status status = rm (n_files, file, &x);
assert (VALID_STATUS (status));
exit (status == RM_ERROR ? EXIT_FAILURE : EXIT_SUCCESS);
+ }
}
diff --git a/src/rm.c b/src/rm.c
index 364a21c..7a24014 100644
--- a/src/rm.c
+++ b/src/rm.c
@@ -355,6 +355,7 @@ main (int argc, char **argv)
quote ("/"));
}
+ {
size_t n_files = argc - optind;
char const *const *file = (char const *const *) argv + optind;
@@ -368,7 +369,10 @@ main (int argc, char **argv)
if (!yesno ())
exit (EXIT_SUCCESS);
}
+ {
enum RM_status status = rm (n_files, file, &x);
assert (VALID_STATUS (status));
exit (status == RM_ERROR ? EXIT_FAILURE : EXIT_SUCCESS);
+ }
+ }
}
Index: shred.c
===================================================================
@@ -148,7 +90,7 @@ 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
@@ -464,7 +464,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. */

View File

@@ -175,22 +175,22 @@ copy_dir (char const *src_name_in, char const *dst_name_in, bool new_dst,
st_gid fields of SRC_SB. If DEST_DESC is undefined (-1), set
the owner and owning group of DST_NAME instead. DEST_DESC must
refer to the same file as DEST_NAME if defined.
Return true if the syscall succeeds, or if it's ok not to
preserve ownership. */
Return 1 if the syscall succeeds, 0 if it fails but it's OK
not to preserve ownership, -1 otherwise. */
static bool
static int
set_owner (const struct cp_options *x, char const *dst_name, int dest_desc,
uid_t uid, gid_t gid)
{
if (HAVE_FCHOWN && dest_desc != -1)
{
if (fchown (dest_desc, uid, gid) == 0)
return true;
return 1;
}
else
{
if (chown (dst_name, uid, gid) == 0)
return true;
return 1;
}
if (! chown_failure_ok (x))
@@ -198,10 +198,10 @@ set_owner (const struct cp_options *x, char const *dst_name, int dest_desc,
error (0, errno, _("failed to preserve ownership for %s"),
quote (dst_name));
if (x->require_preserve)
return false;
return -1;
}
return true;
return 0;
}
/* Set the st_author field of DEST_DESC to the st_author field of
@@ -230,11 +230,26 @@ set_author (const char *dst_name, int dest_desc, const struct stat *src_sb)
#endif
}
/* Change the file mode bits of the file identified by DESC or NAME to MODE.
Use DESC if DESC is valid and fchmod is available, NAME otherwise. */
static int
fchmod_or_lchmod (int desc, char const *name, mode_t mode)
{
#if HAVE_FCHMOD
if (0 <= desc)
return fchmod (desc, mode);
#endif
return lchmod (name, mode);
}
/* Copy a regular file from SRC_NAME to DST_NAME.
If the source file contains holes, copies holes and blocks of zeros
in the source file as holes in the destination file.
(Holes are read as zeroes by the `read' system call.)
Use DST_MODE as the 3rd argument in the call to open.
When creating the destination, use DST_MODE & ~OMITTED_PERMISSIONS
as the third argument in the call to open, adding
OMITTED_PERMISSIONS after copying as needed.
X provides many option settings.
Return true if successful.
*NEW_DST is as in copy_internal.
@@ -242,13 +257,15 @@ set_author (const char *dst_name, int dest_desc, const struct stat *src_sb)
static bool
copy_reg (char const *src_name, char const *dst_name,
const struct cp_options *x, mode_t dst_mode, bool *new_dst,
const struct cp_options *x,
mode_t dst_mode, mode_t omitted_permissions, bool *new_dst,
struct stat const *src_sb)
{
char *buf;
char *buf_alloc = NULL;
int dest_desc;
int source_desc;
mode_t src_mode = src_sb->st_mode;
struct stat sb;
struct stat src_open_sb;
bool return_val = true;
@@ -282,7 +299,7 @@ copy_reg (char const *src_name, char const *dst_name,
The if-block will be taken in move_mode. */
if (! *new_dst)
{
dest_desc = open (dst_name, O_WRONLY | O_TRUNC | O_BINARY, dst_mode);
dest_desc = open (dst_name, O_WRONLY | O_TRUNC | O_BINARY);
if (dest_desc < 0 && x->unlink_dest_after_failed_open)
{
@@ -301,7 +318,10 @@ copy_reg (char const *src_name, char const *dst_name,
}
if (*new_dst)
dest_desc = open (dst_name, O_WRONLY | O_CREAT | O_BINARY, dst_mode);
dest_desc = open (dst_name, O_WRONLY | O_CREAT | O_EXCL | O_BINARY,
dst_mode & ~omitted_permissions);
else
omitted_permissions = 0;
if (dest_desc < 0)
{
@@ -500,10 +520,16 @@ copy_reg (char const *src_name, char const *dst_name,
if (x->preserve_ownership && ! SAME_OWNER_AND_GROUP (*src_sb, sb))
{
if (! set_owner (x, dst_name, dest_desc, src_sb->st_uid, src_sb->st_gid))
{
switch (set_owner (x, dst_name, dest_desc,
src_sb->st_uid, src_sb->st_gid))
{
case -1:
return_val = false;
goto close_src_and_dst_desc;
case 0:
src_mode &= ~ (S_ISUID | S_ISGID | S_ISVTX);
break;
}
}
@@ -511,8 +537,8 @@ copy_reg (char const *src_name, char const *dst_name,
if (x->preserve_mode || x->move_mode)
{
if (copy_acl (src_name, source_desc, dst_name, dest_desc,
src_sb->st_mode) != 0 && x->require_preserve)
if (copy_acl (src_name, source_desc, dst_name, dest_desc, src_mode) != 0
&& x->require_preserve)
return_val = false;
}
else if (x->set_mode)
@@ -520,6 +546,18 @@ copy_reg (char const *src_name, char const *dst_name,
if (set_acl (dst_name, dest_desc, x->mode) != 0)
return_val = false;
}
else if (omitted_permissions)
{
omitted_permissions &= ~ cached_umask ();
if (omitted_permissions
&& fchmod_or_lchmod (dest_desc, dst_name, dst_mode) != 0)
{
error (0, errno, _("preserving permissions for %s"),
quote (dst_name));
if (x->require_preserve)
return_val = false;
}
}
close_src_and_dst_desc:
if (close (dest_desc) < 0)
@@ -967,6 +1005,7 @@ copy_internal (char const *src_name, char const *dst_name,
struct stat dst_sb;
mode_t src_mode;
mode_t dst_mode IF_LINT (= 0);
mode_t omitted_permissions;
bool restore_dst_mode = false;
char *earlier_file = NULL;
char *dst_backup = NULL;
@@ -1465,6 +1504,14 @@ copy_internal (char const *src_name, char const *dst_name,
new_dst = true;
}
/* If the ownership might change, omit some permissions at first, so
unauthorized users cannot nip in before the file has the right
ownership. */
omitted_permissions =
(x->preserve_ownership
? (x->set_mode ? x->mode : src_mode) & (S_IRWXG | S_IRWXO)
: 0);
delayed_ok = true;
/* In certain modes (cp's --symbolic-link), and for certain file types
@@ -1502,7 +1549,10 @@ copy_internal (char const *src_name, char const *dst_name,
(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)
mode_t mkdir_mode =
((x->set_mode ? x->mode : src_mode)
& CHMOD_MODE_BITS & ~omitted_permissions);
if (mkdir (dst_name, mkdir_mode) != 0)
{
error (0, errno, _("cannot create directory %s"),
quote (dst_name));
@@ -1629,7 +1679,7 @@ copy_internal (char const *src_name, char const *dst_name,
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))
omitted_permissions, &new_dst, &src_sb))
goto un_backup;
}
else if (S_ISFIFO (src_mode))
@@ -1637,7 +1687,7 @@ copy_internal (char const *src_name, char const *dst_name,
/* 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)
if (mknod (dst_name, src_mode & ~omitted_permissions, 0) != 0)
{
error (0, errno, _("cannot create fifo %s"), quote (dst_name));
goto un_backup;
@@ -1645,7 +1695,8 @@ copy_internal (char const *src_name, char const *dst_name,
}
else if (S_ISBLK (src_mode) || S_ISCHR (src_mode) || S_ISSOCK (src_mode))
{
if (mknod (dst_name, src_mode, src_sb.st_rdev) != 0)
if (mknod (dst_name, src_mode & ~omitted_permissions, src_sb.st_rdev)
!= 0)
{
error (0, errno, _("cannot create special file %s"),
quote (dst_name));
@@ -1757,8 +1808,15 @@ copy_internal (char const *src_name, char const *dst_name,
if (x->preserve_ownership
&& (new_dst || !SAME_OWNER_AND_GROUP (src_sb, dst_sb)))
{
if (! set_owner (x, dst_name, -1, src_sb.st_uid, src_sb.st_gid))
return false;
switch (set_owner (x, dst_name, -1, src_sb.st_uid, src_sb.st_gid))
{
case -1:
return false;
case 0:
src_mode &= ~ (S_ISUID | S_ISGID | S_ISVTX);
break;
}
}
set_author (dst_name, -1, &src_sb);
@@ -1774,14 +1832,40 @@ copy_internal (char const *src_name, char const *dst_name,
if (set_acl (dst_name, -1, x->mode) != 0)
return false;
}
else if (restore_dst_mode)
else
{
if (lchmod (dst_name, dst_mode) != 0)
if (omitted_permissions)
{
error (0, errno, _("preserving permissions for %s"),
quote (dst_name));
if (x->require_preserve)
return false;
omitted_permissions &= ~ cached_umask ();
if (omitted_permissions && !restore_dst_mode)
{
/* Permissions were deliberately omitted when the file
was created due to security concerns. See whether
they need to be re-added now. It'd be faster to omit
the lstat, but deducing the current destination mode
is tricky in the presence of implementation-defined
rules for special mode bits. */
if (new_dst && lstat (dst_name, &dst_sb) != 0)
{
error (0, errno, _("cannot stat %s"), quote (dst_name));
return false;
}
dst_mode = dst_sb.st_mode;
if (omitted_permissions & ~dst_mode)
restore_dst_mode = true;
}
}
if (restore_dst_mode)
{
if (lchmod (dst_name, dst_mode | omitted_permissions) != 0)
{
error (0, errno, _("preserving permissions for %s"),
quote (dst_name));
if (x->require_preserve)
return false;
}
}
}
@@ -1885,3 +1969,17 @@ chown_failure_ok (struct cp_options const *x)
return ((errno == EPERM || errno == EINVAL) && !x->chown_privileges);
}
/* Return the user's umask, caching the result. */
extern mode_t
cached_umask (void)
{
static mode_t mask = -1;
if (mask == (mode_t) -1)
{
mask = umask (0);
umask (mask);
}
return mask;
}

View File

@@ -213,5 +213,6 @@ void src_info_init (struct cp_options *);
bool chown_privileges (void);
bool chown_failure_ok (struct cp_options const *);
mode_t cached_umask (void);
#endif

View File

@@ -413,6 +413,8 @@ make_dir_parents_private (char const *const_dir, size_t src_offset,
if (XSTAT (x, dir, &stats))
{
mode_t src_mode;
mode_t omitted_permissions;
mode_t mkdir_mode;
/* This component does not exist. We must set
*new_dst and new->mode inside this loop because,
@@ -427,12 +429,15 @@ make_dir_parents_private (char const *const_dir, size_t src_offset,
return false;
}
src_mode = stats.st_mode;
omitted_permissions =
x->preserve_ownership ? src_mode & (S_IRWXG | S_IRWXO) : 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 (dir, src_mode & CHMOD_MODE_BITS) != 0)
mkdir_mode = src_mode & CHMOD_MODE_BITS & ~omitted_permissions;
if (mkdir (dir, mkdir_mode) != 0)
{
error (0, errno, _("cannot make directory %s"),
quote (dir));
@@ -454,28 +459,30 @@ make_dir_parents_private (char const *const_dir, size_t src_offset,
quote (dir));
return false;
}
else
{
if (x->preserve_mode)
{
new->mode = src_mode;
new->restore_mode = (src_mode != stats.st_mode);
}
if ((stats.st_mode & S_IRWXU) != S_IRWXU)
{
/* Make the new directory searchable and writable. The
original permissions will be restored later. */
new->mode = stats.st_mode;
if (! x->preserve_mode)
{
if (omitted_permissions & ~stats.st_mode)
omitted_permissions &= ~ cached_umask ();
if (omitted_permissions & ~stats.st_mode
|| (stats.st_mode & S_IRWXU) != S_IRWXU)
{
new->mode = stats.st_mode | omitted_permissions;
new->restore_mode = true;
}
}
if (lchmod (dir, stats.st_mode | S_IRWXU) != 0)
{
error (0, errno, _("setting permissions for %s"),
quote (dir));
return false;
}
if ((stats.st_mode & S_IRWXU) != S_IRWXU)
{
/* Make the new directory searchable and writable.
The original permissions will be restored later. */
if (lchmod (dir, stats.st_mode | S_IRWXU) != 0)
{
error (0, errno, _("setting permissions for %s"),
quote (dir));
return false;
}
}
}

View File

@@ -223,6 +223,8 @@ Mandatory arguments to long options are mandatory for short options too.\n\
Use one, and only one of -b, -c or -f. Each LIST is made up of one\n\
range, or many ranges separated by commas. Selected input is written\n\
in the same order that it is read, and is written exactly once.\n\
"), stdout);
fputs (_("\
Each range is one of:\n\
\n\
N N'th byte, character or field, counted from 1\n\

View File

@@ -223,6 +223,8 @@ specifies Coordinated Universal Time. Interpreted sequences are:\n\
%Z alphabetic time zone abbreviation (e.g., EDT)\n\
\n\
By default, date pads numeric fields with zeroes.\n\
"), stdout);
fputs (_("\
The following optional flags may follow `%':\n\
\n\
- (hyphen) do not pad the field\n\

View File

@@ -1,7 +1,7 @@
#!/usr/bin/perl -w
# dcgen -- convert dircolors.hin to dircolors.h.
# Copyright (C) 1996, 1998, 2004, 2005 Free Software Foundation, Inc.
# Copyright (C) 1996, 1998, 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
@@ -44,12 +44,14 @@ while (<>)
and push @line, $_;
}
my $last_line = pop @line;
my $indent = ' ';
print "static char const G_line[] =\n";
print "static char const G_line[] =\n{\n";
foreach (@line)
{
print "$indent\"$_\\0\"\n";
s/./'$&',/g;
s/'\\'/'\\\\'/g;
s/'''/'\\''/g;
print "$indent${_}0,\n";
}
print "$indent\"$last_line\";\n";
print "};\n";

View File

@@ -448,6 +448,8 @@ Each CONV symbol may be:\n\
notrunc do not truncate the output file\n\
ucase change lower case to upper case\n\
swab swap every pair of input bytes\n\
"), stdout);
fputs (_("\
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\

View File

@@ -86,8 +86,13 @@ EXEC 01;32
#.com 01;32
#.btm 01;32
#.bat 01;32
# Or if you want to colorize scripts even if they do not have the
# executable bit actually set.
#.sh 01;32
#.csh 01;32
.tar 01;31 # archives or compressed (bright red)
# archives or compressed (bright red)
.tar 01;31
.tgz 01;31
.arj 01;31
.taz 01;31
@@ -97,9 +102,18 @@ EXEC 01;32
.Z 01;31
.gz 01;31
.bz2 01;31
.bz 01;31
.tbz2 01;31
.tz 01;31
.deb 01;31
.rpm 01;31
.jar 01;31
.rar 01;31
.ace 01;31
.zoo 01;31
.cpio 01;31
.7z 01;31
.rz 01;31
# image formats
.jpg 01;35
@@ -115,19 +129,42 @@ EXEC 01;32
.tif 01;35
.tiff 01;35
.png 01;35
.mng 01;35
.pcx 01;35
.mov 01;35
.mpg 01;35
.mpeg 01;35
.m2v 01;35
.mkv 01;35
.ogm 01;35
.mp4 01;35
.m4v 01;35
.mp4v 01;35
.vob 01;35
.qt 01;35
.nuv 01;35
.wmv 01;35
.asf 01;35
.rm 01;35
.rmvb 01;35
.flc 01;35
.avi 01;35
.fli 01;35
.gl 01;35
.dl 01;35
.xcf 01;35
.xwd 01;35
.yuv 01;35
# audio formats
.flac 01;35
.mp3 01;35
.mpc 01;35
.ogg 01;35
.wav 01;35
.aac 00;36
.au 00;36
.flac 00;36
.mid 00;36
.midi 00;36
.mka 00;36
.mp3 00;36
.mpc 00;36
.ogg 00;36
.ra 00;36
.wav 00;36

View File

@@ -293,6 +293,8 @@ Mandatory arguments to long options are mandatory for short options too.\n\
the apparent size is usually smaller, it may be\n\
larger due to holes in (`sparse') files, internal\n\
fragmentation, indirect blocks, and the like\n\
"), stdout);
fputs (_("\
-B, --block-size=SIZE use SIZE-byte blocks\n\
-b, --bytes equivalent to `--apparent-size --block-size=1'\n\
-c, --total produce a grand total\n\
@@ -305,6 +307,8 @@ Mandatory arguments to long options are mandatory for short options too.\n\
change to be equivalent to --dereference-args (-D)\n\
-h, --human-readable print sizes in human readable format (e.g., 1K 234M 2G)\n\
--si like -h, but use powers of 1000 not 1024\n\
"), stdout);
fputs (_("\
-k like --block-size=1K\n\
-l, --count-links count sizes many times if hard linked\n\
-m like --block-size=1M\n\

View File

@@ -459,11 +459,10 @@ install_file_in_file (const char *from, const char *to,
return false;
if (strip_files)
strip (to);
if (! change_attributes (to))
if (x->preserve_timestamps && (strip_files || ! S_ISREG (from_sb.st_mode))
&& ! change_timestamps (&from_sb, to))
return false;
if (x->preserve_timestamps && (strip_files || ! S_ISREG (from_sb.st_mode)))
return change_timestamps (&from_sb, to);
return true;
return change_attributes (to);
}
/* Copy file FROM into directory TO_DIR, keeping its same name,

View File

@@ -4270,6 +4270,8 @@ Mandatory arguments to long options are mandatory for short options too.\n\
-h, --human-readable with -l, print sizes in human readable format\n\
(e.g., 1K 234M 2G)\n\
--si likewise, but use powers of 1000 not 1024\n\
"), stdout);
fputs (_("\
-H, --dereference-command-line\n\
follow symbolic links listed on the command line\n\
--dereference-command-line-symlink-to-dir\n\
@@ -4331,6 +4333,8 @@ Mandatory arguments to long options are mandatory for short options too.\n\
non-recent files and FORMAT2 to recent files;\n\
if STYLE is prefixed with `posix-', STYLE\n\
takes effect only outside the POSIX locale\n\
"), stdout);
fputs (_("\
-t sort by modification time\n\
-T, --tabsize=COLS assume tab stops at each COLS instead of 8\n\
"), stdout);

View File

@@ -358,6 +358,8 @@ An OFFSET operand means -j OFFSET. LABEL is the pseudo-address\n\
at first byte printed, incremented when dump is progressing.\n\
For OFFSET and LABEL, a 0x or 0X prefix indicates hexadecimal;\n\
suffixes may be . for octal and b for multiply by 512.\n\
"), stdout);
fputs (_("\
\n\
TYPE is made up of one or more of these specifications:\n\
\n\

View File

@@ -1,5 +1,5 @@
/* readlink -- display value of a symbolic link.
Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
Copyright (C) 2002, 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
@@ -74,6 +74,8 @@ usage (int status)
-e, --canonicalize-existing canonicalize by following every symlink in\n\
every component of the given name recursively,\n\
all components must exist\n\
"), stdout);
fputs (_("\
-m, --canonicalize-missing canonicalize by following every symlink in\n\
every component of the given name recursively,\n\
without requirements on components existence\n\

View File

@@ -148,16 +148,6 @@ struct dirstack_state
};
typedef struct dirstack_state Dirstack_state;
/* Just like close(fd), but don't modify errno. */
static inline int
close_preserve_errno (int fd)
{
int saved_errno = errno;
int result = close (fd);
errno = saved_errno;
return result;
}
/* Like fstatat, but cache the result. If ST->st_size is -1, the
status has not been gotten yet. If less than -1, fstatat failed
with errno == -1 - ST->st_size. Otherwise, the status has already
@@ -173,11 +163,12 @@ cache_fstatat (int fd, char const *file, struct stat *st, int flag)
return -1;
}
/* Initialize a fstatat cache *ST. */
static inline void
/* Initialize a fstatat cache *ST. Return ST for convenience. */
static inline struct stat *
cache_stat_init (struct stat *st)
{
st->st_size = -1;
return st;
}
/* Return true if *ST has been statted. */
@@ -437,11 +428,11 @@ ds_free (Dirstack_state *ds)
that the post-chdir dev/ino numbers for `.' match the saved ones.
If any system call fails or if dev/ino don't match then give a
diagnostic and longjump out.
Set *PREV_DIR to the name (in malloc'd storage) of the
Return the name (in malloc'd storage) of the
directory (usually now empty) from which we're coming, and which
corresponds to the input value of *DIRP. */
static void
AD_pop_and_chdir (DIR **dirp, Dirstack_state *ds, char **prev_dir)
static char *
AD_pop_and_chdir (DIR **dirp, Dirstack_state *ds)
{
struct AD_ent *leaf_dir_ent = AD_stack_top(ds);
struct dev_ino leaf_dev_ino = leaf_dir_ent->dev_ino;
@@ -450,7 +441,7 @@ AD_pop_and_chdir (DIR **dirp, Dirstack_state *ds, char **prev_dir)
/* Get the name of the current (but soon to be `previous') directory
from the top of the stack. */
*prev_dir = top_dir (ds);
char *prev_dir = top_dir (ds);
AD_stack_pop (ds);
pop_dir (ds);
@@ -478,7 +469,7 @@ AD_pop_and_chdir (DIR **dirp, Dirstack_state *ds, char **prev_dir)
if (closedir (*dirp) != 0)
{
error (0, errno, _("FATAL: failed to close directory %s"),
quote (full_filename (*prev_dir)));
quote (full_filename (prev_dir)));
goto next_cmdline_arg;
}
@@ -491,7 +482,7 @@ AD_pop_and_chdir (DIR **dirp, Dirstack_state *ds, char **prev_dir)
if (fd < 0)
{
error (0, errno, _("FATAL: cannot open .. from %s"),
quote (full_filename (*prev_dir)));
quote (full_filename (prev_dir)));
goto next_cmdline_arg;
}
@@ -521,7 +512,7 @@ AD_pop_and_chdir (DIR **dirp, Dirstack_state *ds, char **prev_dir)
close (fd);
next_cmdline_arg:;
free (*prev_dir);
free (prev_dir);
longjmp (ds->current_arg_jumpbuf, 1);
}
}
@@ -530,17 +521,18 @@ AD_pop_and_chdir (DIR **dirp, Dirstack_state *ds, char **prev_dir)
if (closedir (*dirp) != 0)
{
error (0, errno, _("FATAL: failed to close directory %s"),
quote (full_filename (*prev_dir)));
quote (full_filename (prev_dir)));
goto next_cmdline_arg;
}
*dirp = NULL;
}
return prev_dir;
}
/* Initialize *HT if it is NULL.
Insert FILENAME into HT. */
static void
AD_mark_helper (Hash_table **ht, char *filename)
/* Initialize *HT if it is NULL. Return *HT. */
static Hash_table *
AD_ensure_initialized (Hash_table **ht)
{
if (*ht == NULL)
{
@@ -549,7 +541,16 @@ AD_mark_helper (Hash_table **ht, char *filename)
if (*ht == NULL)
xalloc_die ();
}
void *ent = hash_insert (*ht, filename);
return *ht;
}
/* Initialize *HT if it is NULL.
Insert FILENAME into HT. */
static void
AD_mark_helper (Hash_table **ht, char *filename)
{
void *ent = hash_insert (AD_ensure_initialized (ht), filename);
if (ent == NULL)
xalloc_die ();
else
@@ -557,7 +558,6 @@ AD_mark_helper (Hash_table **ht, char *filename)
if (ent != filename)
free (filename);
}
}
/* Mark FILENAME (in current directory) as unremovable. */
@@ -1106,37 +1106,33 @@ remove_entry (int fd_cwd, Dirstack_state const *ds, char const *filename,
static DIR *
fd_to_subdirp (int fd_cwd, char const *f,
struct rm_options const *x, int prev_errno,
struct stat *subdir_sb, Dirstack_state *ds,
struct stat *subdir_sb,
int *cwd_errno ATTRIBUTE_UNUSED)
{
int open_flags = O_RDONLY | O_NOCTTY | O_NOFOLLOW | O_NONBLOCK;
int fd_sub = openat_permissive (fd_cwd, f, open_flags, 0, cwd_errno);
int saved_errno;
/* Record dev/ino of F. We may compare them against saved values
to thwart any attempt to subvert the traversal. They are also used
to detect directory cycles. */
if (fd_sub < 0 || fstat (fd_sub, subdir_sb) != 0)
if (fd_sub < 0)
return NULL;
else if (fstat (fd_sub, subdir_sb) != 0)
saved_errno = errno;
else if (S_ISDIR (subdir_sb->st_mode))
{
if (0 <= fd_sub)
close_preserve_errno (fd_sub);
return NULL;
DIR *subdir_dirp = fdopendir (fd_sub);
if (subdir_dirp)
return subdir_dirp;
saved_errno = errno;
}
else
saved_errno = (prev_errno ? prev_errno : ENOTDIR);
if (! S_ISDIR (subdir_sb->st_mode))
{
errno = prev_errno ? prev_errno : ENOTDIR;
close_preserve_errno (fd_sub);
return NULL;
}
DIR *subdir_dirp = fdopendir (fd_sub);
if (subdir_dirp == NULL)
{
close_preserve_errno (fd_sub);
return NULL;
}
return subdir_dirp;
close (fd_sub);
errno = saved_errno;
return NULL;
}
/* Remove entries in the directory open on DIRP
@@ -1220,7 +1216,7 @@ remove_cwd_entries (DIR **dirp,
case RM_NONEMPTY_DIR:
{
DIR *subdir_dirp = fd_to_subdirp (dirfd (*dirp), f,
x, errno, subdir_sb, ds, NULL);
x, errno, subdir_sb, NULL);
if (subdir_dirp == NULL)
{
status = RM_ERROR;
@@ -1308,7 +1304,7 @@ remove_dir (int fd_cwd, Dirstack_state *ds, char const *dir,
fd_to_subdirp's fstat, along with the `fstat' and the dev/ino
comparison in AD_push ensure that we detect it and fail. */
DIR *dirp = fd_to_subdirp (fd_cwd, dir, x, 0, dir_st, ds, cwd_errno);
DIR *dirp = fd_to_subdirp (fd_cwd, dir, x, 0, dir_st, cwd_errno);
if (dirp == NULL)
{
@@ -1388,9 +1384,7 @@ remove_dir (int fd_cwd, Dirstack_state *ds, char const *dir,
{
/* The name of the directory that we have just processed,
nominally removing all of its contents. */
char *empty_dir;
AD_pop_and_chdir (&dirp, ds, &empty_dir);
char *empty_dir = AD_pop_and_chdir (&dirp, ds);
int fd = (dirp != NULL ? dirfd (dirp) : AT_FDCWD);
assert (dirp != NULL || AD_stack_height (ds) == 1);
@@ -1403,8 +1397,8 @@ remove_dir (int fd_cwd, Dirstack_state *ds, char const *dir,
But that's no big deal since we're interactive. */
struct stat empty_st;
Ternary is_empty;
cache_stat_init (&empty_st);
enum RM_status s = prompt (fd, ds, empty_dir, &empty_st, x,
enum RM_status s = prompt (fd, ds, empty_dir,
cache_stat_init (&empty_st), x,
PA_REMOVE_DIR, &is_empty);
if (s != RM_OK)
@@ -1471,6 +1465,7 @@ rm_1 (Dirstack_state *ds, char const *filename,
struct stat st;
cache_stat_init (&st);
cycle_check_init (&ds->cycle_check_state);
if (x->root_dev_ino)
{
if (cache_fstatat (AT_FDCWD, filename, &st, AT_SYMLINK_NOFOLLOW) != 0)
@@ -1490,8 +1485,7 @@ rm_1 (Dirstack_state *ds, char const *filename,
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);
enum RM_status status = remove_entry (AT_FDCWD, ds, filename, &st, x, NULL);
if (status == RM_NONEMPTY_DIR)
{
/* In the event that remove_dir->remove_cwd_entries detects
@@ -1500,13 +1494,12 @@ rm_1 (Dirstack_state *ds, char const *filename,
if (setjmp (ds->current_arg_jumpbuf))
status = RM_ERROR;
else
status = remove_dir (fd_cwd, ds, filename, &st, x, cwd_errno);
status = remove_dir (AT_FDCWD, ds, filename, &st, x, cwd_errno);
AD_stack_clear (ds);
}
ds_clear (ds);
return status;
}
@@ -1526,13 +1519,13 @@ rm (size_t n_files, char const *const *file, struct rm_options const *x)
{
error (0, 0, _("cannot remove relative-named %s"), quote (file[i]));
status = RM_ERROR;
continue;
}
cycle_check_init (&ds->cycle_check_state);
enum RM_status s = rm_1 (ds, file[i], x, &cwd_errno);
assert (VALID_STATUS (s));
UPDATE_STATUS (status, s);
else
{
enum RM_status s = rm_1 (ds, file[i], x, &cwd_errno);
assert (VALID_STATUS (s));
UPDATE_STATUS (status, s);
}
}
if (x->require_restore_cwd && cwd_errno)

View File

@@ -355,22 +355,20 @@ main (int argc, char **argv)
quote ("/"));
}
{
size_t n_files = argc - optind;
char const *const *file = (char const *const *) argv + optind;
size_t n_files = argc - optind;
char const *const *file = (char const *const *) argv + optind;
if (prompt_once && (x.recursive || 3 < n_files))
{
fprintf (stderr,
(x.recursive
? _("%s: remove all arguments recursively? ")
: _("%s: remove all arguments? ")),
program_name);
if (!yesno ())
exit (EXIT_SUCCESS);
}
enum RM_status status = rm (n_files, file, &x);
assert (VALID_STATUS (status));
exit (status == RM_ERROR ? EXIT_FAILURE : EXIT_SUCCESS);
}
if (prompt_once && (x.recursive || 3 < n_files))
{
fprintf (stderr,
(x.recursive
? _("%s: remove all arguments recursively? ")
: _("%s: remove all arguments? ")),
program_name);
if (!yesno ())
exit (EXIT_SUCCESS);
}
enum RM_status status = rm (n_files, file, &x);
assert (VALID_STATUS (status));
exit (status == RM_ERROR ? EXIT_FAILURE : EXIT_SUCCESS);
}

View File

@@ -92,6 +92,8 @@ omitted INCREMENT defaults to 1 even when LAST is smaller than FIRST.\n\
FIRST, INCREMENT, and LAST are interpreted as floating point values.\n\
INCREMENT is usually positive if FIRST is smaller than LAST, and\n\
INCREMENT is usually negative if FIRST is greater than LAST.\n\
"), stdout);
fputs (_("\
FORMAT must be suitable for printing one argument of type `double';\n\
it defaults to %.PRECf if FIRST, INCREMENT, and LAST are all fixed point\n\
decimal numbers with maximum precision PREC, and to %g otherwise.\n\

View File

@@ -220,6 +220,8 @@ version 3 clients\n\
\n\
* compressed file systems\n\
\n\
"), stdout);
fputs (_("\
In the case of ext3 file systems, the above disclaimer applies\n\
(and shred is thus of limited effectiveness) only in data=journal mode,\n\
which journals file data in addition to just metadata. In both the\n\
@@ -228,6 +230,8 @@ Ext3 journaling modes can be changed by adding the data=something option\n\
to the mount options for a particular file system in the /etc/fstab file,\n\
as documented in the mount man page (man mount).\n\
\n\
"), stdout);
fputs (_("\
In addition, file system backups and remote mirrors may contain copies\n\
of the file that cannot be removed, and that will allow a shredded file\n\
to be recovered later.\n\

View File

@@ -154,7 +154,7 @@ statfs (char const *filename, struct fs_info *buf)
enum
{
PRINTF_OPTION = CHAR_MAX + 1,
PRINTF_OPTION = CHAR_MAX + 1
};
static struct option const long_options[] = {

View File

@@ -38,9 +38,12 @@ framework_failure=0
mkdir -p $tmp || framework_failure=1
cd $tmp || framework_failure=1
touch a b || framework_failure=1
touch a b c || framework_failure=1
chmod u+sx,go= a || framework_failure=1
chmod u=rwx,g=sx,o= b || framework_failure=1
chmod a=r,ug+sx c || framework_failure=1
chown $NON_ROOT_USERNAME . || framework_failure=1
chmod u=rwx,g=rx,o=rx . || framework_failure=1
if test $framework_failure = 1; then
echo 'failure in testing framework'
@@ -59,4 +62,9 @@ set _ `ls -l b`; shift; p1=$1
set _ `ls -l b2`; shift; p2=$1
test $p1 = $p2 || fail=1
setuidgid $NON_ROOT_USERNAME env PATH="$PATH" cp -p c c2 || fail=1
set _ `ls -l c`; shift; p1=$1
set _ `ls -l c2`; shift; p2=$1
test $p1 = $p2 && fail=1
(exit $fail); exit $fail

View File

@@ -21,6 +21,7 @@
AUTOMAKE_OPTIONS = 1.4 gnits
TESTS = \
one-file-system \
inacc-dest \
long-from-unreadable \
long-sloop \

View File

@@ -41,7 +41,7 @@ mkdir -p a/b d d/sub || framework_failure=1
# immediately disqualify file systems (e.g., NetApp) on which smaller
# files take up zero disk blocks.
printf '%*s' 257 make-sure-the-file-is-non-empty > a/b/F || framework_failure=1
seq --format=%100g 1 90 | head --bytes=4k > d/1
printf %4096s x > d/1
cp d/1 d/sub/2
if test $framework_failure = 1; then

View File

@@ -36,7 +36,7 @@ mkdir -p $tmp || framework_failure=1
cd $tmp || framework_failure=1
mkdir -p dir/a
ln -s dir slink
seq --format=%100g 900 | head --bytes=64k > 64k
printf %65536s x > 64k
ln -s 64k slink-to-64k
if test $framework_failure = 1; then

View File

@@ -26,6 +26,7 @@ fi
. $srcdir/../envvar-check
. $srcdir/../lang-default
PRIV_CHECK_ARG=require-non-root . $srcdir/../priv-check
pwd=`pwd`
t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$

61
tests/du/one-file-system Executable file
View File

@@ -0,0 +1,61 @@
#!/bin/sh
# Test for a bug in fts's handling of FTS_XDEV, the flag behind
# du's --one-file-system (-x) 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
du --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 -p b/c y/z || framework_failure=1
if test $framework_failure = 1; then
echo "$0: failure in testing framework" 1>&2
(exit 1); exit 1
fi
fail=0
# Due to a used-uninitialized variable, the "du -x" from coreutils-6.6
# would not traverse into second and subsequent directories listed
# on the command line.
du -ax b y > t || fail=1
sed 's/^[0-9][0-9]* //' t > out
cat <<\EOF > exp || fail=1
b/c
b
y/z
y
EOF
cmp out exp || fail=1
test $fail = 1 && diff out exp 2> /dev/null
(exit $fail); exit $fail

View File

@@ -28,6 +28,8 @@ test "$VERBOSE" = yes && set -x
test "x$SHELL" = x && SHELL=/bin/sh
export SHELL
. $srcdir/envvar-check
expected_failure_status_nohup=127
expected_failure_status_printenv=2
expected_failure_status_tty=3
@@ -133,6 +135,11 @@ mknod_args=--version
uptime_args=--version
cmp_args="$tmp_in $tmp_in2"
# Tell dd not to print the line with transfer rate and total.
# The transfer rate would vary between runs.
dd_args=status=noxfer
diff_args="$tmp_in $tmp_in2"
sdiff_args="$tmp_in $tmp_in2"
diff3_args="$tmp_in $tmp_in2 $tmp_in2"

View File

@@ -56,7 +56,7 @@ case "$s" in
esac
# If necessary, wait for the system clock to pass the minute mark.
test $n = 0 || { echo sleeping for $n seconds...; sleep $n; }
test $n = 0 || sleep $n
s=`date --date="21:04 +0100" +%S`
case "$s" in

View File

@@ -52,8 +52,9 @@ fail=0
# diagnostic about moving one directory to a subdirectory of itself.
mv b/t a 2> out && fail=1
# Accept either EEXIST or ENOTEMPTY.
sed 's/: File exists/: Directory not empty/'<out>o1;mv o1 out
# Accept any of these: EEXIST, ENOTEMPTY, EBUSY.
sed 's/: File exists/: Directory not empty/'<out>o1;mv o1 out
sed 's/: Device or resource busy/: Directory not empty/'<out>o1;mv o1 out
cat <<\EOF > exp || fail=1
mv: cannot move `b/t' to `a/t': Directory not empty

View File

@@ -35,11 +35,19 @@ cd $tmp || framework_failure=1
mkdir -p d/sub empty src d2/sub e2 || framework_failure=1
touch f || framework_failure=1
# Skip this test if there's an underlying kernel bug.
mkdir a b b/a || framework_failure=1
if test $framework_failure = 1; then
echo "$0: failure in testing framework" 1>&2
(exit 1); exit 1
fi
mv a b || {
echo "$0: skipping this test: your kernel's rename syscall is buggy" 1>&2
(exit 77); exit 77
}
fail=0
# This should succeed, since both src and dest are directories,

View File

@@ -1,7 +1,7 @@
#!/bin/sh
# Make sure touch can set the mtime on an empty file.
# Copyright (C) 1998, 1999, 2000, 2005 Free Software Foundation, Inc.
# Copyright (C) 1998, 1999, 2000, 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,6 +28,8 @@ if test "$VERBOSE" = yes; then
touch --version
fi
. $srcdir/../envvar-check
DEFAULT_SLEEP_SECONDS=2
SLEEP_SECONDS=${SLEEP_SECONDS=$DEFAULT_SLEEP_SECONDS}

View File

@@ -2,7 +2,7 @@
# Make sure touch can update the times on a file that is neither
# readable nor writable.
# Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc.
# Copyright (C) 1999, 2000, 2002, 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
@@ -24,6 +24,8 @@ if test "$VERBOSE" = yes; then
touch --version
fi
. $srcdir/../envvar-check
DEFAULT_SLEEP_SECONDS=2
SLEEP_SECONDS=${SLEEP_SECONDS=$DEFAULT_SLEEP_SECONDS}

View File

@@ -117,6 +117,9 @@ sub test_vector
$test_name =~ /^obs-plus/
and $Test::env{$test_name} = ['_POSIX2_VERSION=199209'];
$flags =~ /badoption/
and $Test::input_via{$test_name} = {REDIR => 0};
}
return @tv;