Compare commits

...

90 Commits
v7.1 ... v7.2

Author SHA1 Message Date
Jim Meyering
3dcf7a4d23 version 7.2
* NEWS: Record release date.
2009-03-31 14:11:57 +02:00
Jim Meyering
eeeccb3d0f tests: don't use lang-default from individual tests
* tests/sample-test: Don't recommend using lang-default here.
It is now run for each test automatically, via TESTS_ENVIRONMENT.
* tests/dd/reblock: Don't source lang-default here.
* tests/misc/truncate-fail-diag: Likewise.
2009-03-29 19:54:54 +02:00
Jim Meyering
6fa5f12107 tests: other-fs-tmpdir: remove just-added duplicate /usr/tmp
* tests/other-fs-tmpdir (CANDIDATE_TMP_DIRS): Remove 2nd /usr/tmp.
2009-03-29 19:42:34 +02:00
Jim Meyering
d99c479311 tests: other-fs-tmpdir: avoid bogus "skipped **********..." diagnostic
* tests/other-fs-tmpdir (CANDIDATE_TMP_DIRS): Add /dev/shm to the list.
Don't use a line of asterisks as the first line of the "why skipped"
diagnostic, now that that line is printed on 'make check's stderr.
2009-03-29 09:59:23 +02:00
Jim Meyering
9f39fa8559 build: use automake's --silent-rules option when possible
* bootstrap: Use automake's --silent-rules option.
2009-03-28 13:46:02 +01:00
Jim Meyering
00f84872e4 tests: test-argv-iter.c: avoid declaration-after-stmt
* gl/tests/test-argv-iter.c: Move declaration "up", so as not
to ruffle feathers of crufty compilers.  We accommodate such
compilers here solely because this module may migrate to gnulib.
Tiny patch by Matthew Woehlke.
2009-03-27 17:33:26 +01:00
Eric Blake
a8fde98844 tests: fix 'make sc_tight_scope' on cygwin
* src/Makefile.am (sc_tight_scope): Ignore leading underscores in symbols.
2009-03-27 06:24:48 -06:00
Jim Meyering
e412e5cb49 tests: avoid spurious test failure in set-GID build dir
* tests/install/install-C-root: Skip this test if in set-gid directory.
Reported by Sven Joachim and C de-Avillez.
2009-03-27 09:39:51 +01:00
Jim Meyering
e65d0d0525 tests: migrate setgid-check into test-lib.sh
* tests/test-lib.sh (skip_if_setgid_): New function.
* tests/setgid-check: Remove file.
* tests/Makefile.am (EXTRA_DIST): Remove setgid-check.
* tests/chmod/c-option: Use the new function rather than sourcing
the separate file.
* tests/cp/cp-parents: Likewise.
* tests/install/install-C: Likewise.
* tests/mkdir/parents: Likewise.
* tests/mkdir/perm: Likewise.
2009-03-27 09:28:08 +01:00
Jim Meyering
9b6538aa8d tests: mark the rm/ext3-perf test as "very" expensive
* tests/rm/ext3-perf: Relegate this test to the very_expensive
category, since it is failing too often for me, when run in
parallel (-j4) with other disk-hammering tests.  This test fails
when it takes too long, so the fact that it fails under pressure
is an inconvenience more than a real problem.
2009-03-26 10:35:03 +01:00
Jim Meyering
843a0f1a23 * gnulib: Update submodule to latest. 2009-03-26 10:20:43 +01:00
Paul Eggert
22fa69e27d df: port the known-value fix to AIX as well
* src/df.c (known_value): New function, which also works on AIX
/proc file systems.
(df_readable, show_dev): Use it instead of hardcoding comparison to
UINTMAX_MAX.  Suggested by Jim Meyering and Matthew Woehlke.
2009-03-26 08:53:21 +01:00
Paul Eggert
c04cb1274c df: fix a bug when totaling unknown values
* src/df.c (show_dev): Don't add UINTMAX_MAX to grand totals, as that
value indicates that the true value is unknown; adding it effectively
subtracts 1 from the total, whereas we want to leave the total alone.
2009-03-26 08:53:21 +01:00
Jim Meyering
b102ed9ba6 tests: don't fail "make syntax-check" on cygwin
* maint.mk (NEWS_hash): Remove trailing " -" or " *-".
* cfg.mk (old_NEWS_hash): Regenerate, removing " -".
Reported by Eric Blake.
2009-03-25 22:51:55 +01:00
Eric Blake
9b4aa5e268 pwd: support -L and -P
* src/pwd.c (longopts): New variable.
(logical_getcwd): New function.
(main): Use it.
(usage): Document new options.
* doc/coreutils.texi (pwd invocation): Likewise.
* NEWS: Likewise.
* TODO (pwd): Mark it done.
* tests/misc/pwd-option: New file.
* tests/Makefile.am (TESTS): Add test.
* THANKS: Update.
Reported by Paul D. Smith, in savannah bug 24949.
2009-03-25 06:33:32 -06:00
Ondřej Vašík
53191d01e2 doc: update suffix regex in version sort
* doc/coreutils.texi: Reflect current filevercmp regex.
2009-03-25 12:28:03 +01:00
Ralf Wildenhues
26559b513d tests: CuTmpdir.pm: avoid use of undefined variable in warning
* tests/CuTmpdir.pm (chmod_tree): Do not warn if $dir is undefined.
2009-03-25 10:16:34 +01:00
Jim Meyering
b498eb071d tests: ls -v: exercise yet another change in gnulib's new filevercmp
* tests/misc/ls-misc: Add names with ~ and ~.1~ suffixes.
2009-03-24 22:33:47 +01:00
Jim Meyering
991a1d6de9 * gnulib: Update submodule to latest. 2009-03-24 21:49:03 +01:00
Kamil Dudka
2827bb5704 ls: make it possible to disable coloring of hard links
* src/ls.c (print_color_indicator): Don't color hard links if disabled
(when there is an empty hl= in the LS_COLORS environment variable).
* tests/ls/hardlink: Add test case for disabled hard link highlighting.
* NEWS: Mention the change.
2009-03-24 16:11:00 +00:00
Jim Meyering
d1df6ef183 tests: search only files that are under version control
* maint.mk (sc_error_exit_success): Search only files
that are under version control.
(sc_makefile_path_separator_check): Likewise.
Check *.mk files, too, not just Makefile.am files.
2009-03-21 09:58:43 +01:00
Jim Meyering
e45c9a02a4 tests: follow own advice: use $(PATH_SEPARATOR), not ":"
* maint.mk (coreutils-path-check): Use the variable, not the literal.
2009-03-21 09:58:37 +01:00
Jim Meyering
1f95a45099 tests: modernize: use $(var) makefile notation, not @var@
* maint.mk (sc_makefile_path_separator_check): Recommend
the use of $(PATH_SEPARATOR), not @PATH_SEPARATOR@.
Remove an obsolete comment.
2009-03-21 09:58:32 +01:00
Jim Meyering
143bfd67c9 tests: teach sc_dd_O_FLAGS about new syntax in dd.c
* cfg.mk (sc_dd_O_FLAGS): Adapt to new syntax.
2009-03-20 15:20:09 +01:00
Eric Blake
0b47305caa dd: use a more portable definition of O_FULLBLOCK
* src/dd.c (O_FULLBLOCK): Compute its value without using a 180KB
macro.  This avoids triggering a compilation failure with HP-UX's cc.
Reported by Matthew Woehlke.
2009-03-20 15:16:50 +01:00
Jim Meyering
25bbb44dbb tests: avoid spurious mkdir/selinux test failure on HP-UX 11.23
* tests/mkdir/selinux: Accept yet another diagnostic.
Reported by Matthew Woehlke.
2009-03-20 15:08:50 +01:00
Jim Meyering
25507a54f7 tests: df/total-verify: avoid test failure with older Perl
* tests/df/total-verify: Don't use perl's -f option.
Reported by Matthew Woehlke.
2009-03-19 18:49:57 +01:00
Jim Meyering
8e6a68e2fd * gnulib: Update submodule to latest. 2009-03-19 07:55:03 +01:00
Jim Meyering
5b86dc69d7 tests: adjust sort-continue not to fail under valgrind
* tests/misc/sort-continue: Don't run cat inside fd-limited shell.
If sort fails to run in an fd-limited shell, skip the test.
2009-03-18 21:44:45 +01:00
Paul Eggert
f31ea18146 tests: add another sort/nmerge test
* tests/Makefile.am (TESTS): Add sort-merge-fdlimit.
* tests/misc/sort-merge-fdlimit: New file.
* doc/coreutils.texi (sort invocation): Document that we now silently
lower nmerge if necessary.
Patch by Paul Eggert, Nima Nikzad, Max Chang, Alexander Nguyen,
Sahil Amoli, and Nick Graham.
2009-03-18 21:44:45 +01:00
Paul Eggert
8f7fae5972 sort: handle fd exhaustion better when merging
This is an alternative to my 9 March patch labeled "Silently lower
nmerge; don't (sometimes incorrectly) range-check"
<http://lists.gnu.org/archive/html/bug-coreutils/2009-03/msg00070.html>.
It differs by not using 'dup' to probe for extra file descriptors;
instead, it simply calls 'open' (and 'pipe') to open files and pipes,
until one of these calls fails due to file descriptor exhaustion; it
then backs off by 1, does a merge with the files that it has opened,
and then retries with the (now-smaller) number of files.

This patch requires quite a few more changes to the source code than
the earlier patch, but it is in some sense "better" because it doesn't
need to call "dup" ahead of time in order to decide whether "open" or
"pipe" will fail.  Also, it's more robust in the case where "open" or
"pipe" fails with errno==EMFILE because some system-wide limit is
exhausted.

* src/sort.c (create_temp_file): New arg SURVIVE_FD_EXHAUSTION.
(stream_open): New function, containing guts of xfopen.
(xfopen): Use it.
(pipe_fork): Set errno on failure.
(maybe_create_temp): New function, containing guts of create_temp.
(create_temp): Use it.
(open_temp): Distinguish failures due to file descriptor exhaustion
from other failures, and on fd exhaustion return a notice to caller
rather than dying.  Don't test execlp's return value; when it returns,
it *always* returns -1.
(open_input_files): New function.
(mergefps): New arg FPS. It's now the caller's responsibility to open
the input and output files.  All callers changed.
(mergefiles): New function.
(avoid_trashing_input, merge): Handle the case where a single merge
can't merge as much as we wanted due to file descriptor exhaustion, by
merging as much as we can and then retrying.
* tests/Makefile.am (TESTS): Add misc/sort-continue.
* tests/misc/sort-continue: New file.
* THANKS: Add Glen Lenker and Matt Pham who coauthored this patch.
2009-03-18 21:44:37 +01:00
Jim Meyering
e6d2d94794 maint: normalize leading-TAB indentation in Makefiles
* maint.mk (sc_makefile_TAB_only_indentation): New rule.
Replace each TAB+8-space sequence with two TABs.
* man/Makefile.am: Likewise.
* build-aux/check.mk: Likewise.
I used this command (run it more than once, if needed):
t=$'\t'; git grep -l -E "$t {8}"|grep -E 'Makefile|\.mk$' \
| xargs perl -pi -e 's/\t {8}/\t\t/'
2009-03-18 12:40:07 +01:00
Jim Meyering
fd53921a68 maint: remove long-unused Makefile
* tests/sort-time/Makefile: Remove long-unused file.
2009-03-15 21:40:54 +01:00
Jim Meyering
20d523bfa2 maint: remove unused include and definitions
* gl/lib/randread.c (__attribute__): Remove unused definition.
(ATTRIBUTE_UNUSED): Likewise.
* gl/lib/selinux-at.c (_): Remove unused definition.
Don't include <gettext.h>.  No longer needed.
2009-03-15 08:17:41 +01:00
Jim Meyering
bd23509bef * gnulib: Update submodule to latest. 2009-03-15 08:09:53 +01:00
Jim Meyering
a4780e67f4 system.h: correct compilation error: MAX not defined
* src/system.h (io_blksize): Move definition down, so it follows that
of MAX -- to avoid compilation failure on OpenSolaris.  Reported by
David Bartley.  Details in
http://lists.gnu.org/archive/html/bug-coreutils/2009-03/msg00190.html
2009-03-14 21:46:35 +01:00
Jim Meyering
b581752137 * gnulib: Update to pull in select/interix work-around. 2009-03-14 11:49:56 +01:00
Kamil Dudka
558525592b doc: update "version sort" documentation
* doc/coreutils.texi: Reflect current filevercmp behavior.
2009-03-13 12:20:06 +01:00
Jim Meyering
ba5a1036f1 tests: groups-version: don't require that id be built
* tests/misc/groups-version: groups is now independent of id.
2009-03-12 19:48:29 +01:00
Jim Meyering
d16b4760d7 tests: skip the groups-dash test when "groups" is not built
* tests/misc/groups-dash: Skip if groups is not being installed.
Suggested by Mike Frysinger.
Also fail if groups exits with nonzero status.
2009-03-12 19:48:21 +01:00
Pádraig Brady
98aec338ef maint: mention Autoconf version required to build Automake
* README-prereq: coreutils currently requires an unreleased
version of Automake, so mention the minimum version of Autoconf
required to build that. Suggestion from James Youngman.
2009-03-12 14:19:01 +00:00
Jim Meyering
ebb9617fde * gnulib: Update submodule to latest. 2009-03-12 10:46:31 +01:00
Ondřej Vašík
c160afe902 cp: make -a option preserve xattrs, but with reduced diagnostics
* copy.c (copy_attr_by_fd): Reduce xattr diagnostics for 'cp -a'.
(copy_attr_by_name): Likewise.
* cp.c (main): Preserve xattrs with -a option, when possible.
* doc/coreutils.texi: Document that xattrs are preserved with
cp -a, with no added diagnostics.
* NEWS: Mention the change.
* tests/misc/xattr: Add tests for 'cp --preserve=all' and 'cp -a'.
2009-03-11 17:32:44 +01:00
Pádraig Brady
cf0bb5e05d maint: Document how to best to enable gcc warnings for developers
* README-hacking: Mention --enable-gcc-warnings configure option
* configure.ac: Don't scare developers away from using gcc warnings
2009-03-11 14:52:52 +00:00
Jim Meyering
20dc2a6a61 maint: remove an obsolete FIXME comment
* src/Makefile.am (../AUTHORS): Remove obsolete FIXME comment.
There are no longer any installed *.sh programs.
2009-03-11 15:43:53 +01:00
Pádraig Brady
1644e58905 cat: Fix immediate output of processed data
Introduced by commit 790892db, 2006-06-08 "Ensure that cat works ...".
* NEWS: Mention the bugfix.
* src/cat.c (cat): Fix the typo which stopped the writing
of processed data before a blocking read() is done.
* tests/misc/cat-buf: Add to ensure processed data is not buffered.
* tests/Makefile.am: Reference the new test.
2009-03-11 14:27:39 +00:00
Pádraig Brady
55efc5f3ee cat,cp,mv,install,split: Set the minimum IO block size used to 32KiB
This is following on from this change:
[02c3dc9d 2008-03-06 cat: use larger buffer sizes ...]
which increased the IO block size used by cat by 8 times,
but also capped it at 32KiB.
* NEWS: Mention the change in behavior.
* src/system.h: Add a new io_blksize() function that
returns the max of ST_BLKSIZE or 32KiB, as this was
seen as a good value for a minimum block size to use
to get good performance while minimizing system call overhead.
* src/cat.c: Use it.
* src/copy.c: ditto
* src/split.c: ditto
2009-03-11 14:19:08 +00:00
Jim Meyering
93f6771e82 tests: add a test for newly-fixed bug in comm --check-order
* tests/misc/comm (ooo-prefix): Add a test for today's fix.
* NEWS (Bug fixes): Mention it.
2009-03-08 21:34:08 +01:00
Bruno Haible
83244ba312 comm: fix a bug in its new --check-order option
* src/comm.c: Include memcmp2.h.
(check_order): Use memcmp2 instead of memcmp.
* bootstrap.conf (gnulib_modules): Add memcmp2.
2009-03-08 21:34:08 +01:00
Jim Meyering
df2e983677 tests: ls -v: exercise the bug fixed by gnulib's new filevercmp
* tests/misc/ls-misc (version-sort): New test.
(mk_file): New function.
Reported by Josh Triplett in <http://bugs.debian.org/517558>.
Details in http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/16902
* NEWS (Bug fixes): Mention it.
2009-03-08 21:18:47 +01:00
Jim Meyering
97d21865fb gnulib: sync submodule to latest 2009-03-08 21:16:30 +01:00
Jim Meyering
a4053c5291 pr: fix a bug whereby --indent=N (-o) did not indent header lines
* src/pr.c (print_header): Honor chars_per_margin also for the header.
Inspired by a patch from C de-Avillez.
This change also adjusts two other %*s directives to be %*.*s instead,
(for the padding on either side of "file_text") to correct a bug that
could make pr print one space of padding instead of none.
* NEWS (Bug fixes): Mention it.
* tests/pr/o3Jml24f-lm-lo: Adjust for new expected output.
* tests/pr/o3a3Sl24f-tn: Likewise.
* tests/pr/o3a3Snl24f-tn: Likewise.
* tests/pr/o3a3l24f-tn: Likewise.
* tests/pr/o3b3Sl24f-tn: Likewise.
* tests/pr/o3b3Snl24f-tn: Likewise.
* tests/pr/o3b3l24f-tn: Likewise.
* tests/pr/o3mSl24f-bl-tn: Likewise.
* tests/pr/o3mSnl24fbltn: Likewise.
* tests/pr/o3ml24f-bl-tn: Likewise.
2009-03-07 23:52:08 +01:00
Jim Meyering
85507b24f9 bootstrap: add to XGETTEXT_OPTIONS
* bootstrap.conf (XGETTEXT_OPTIONS): Add c-format --flag options
for verror and verror_at_line; alphabetize.
2009-03-07 18:23:17 +01:00
Jim Meyering
19a0b6be60 maint: use a git submodule for gnulib
* .gitmodules: New file, to track gnulib.
* gnulib: New file, created by running this:
git submodule add git://git.sv.gnu.org/gnulib.git gnulib
2009-03-07 18:20:26 +01:00
Jim Meyering
51b88670cb build: allow ./bootstrap --srcdir=... to work with a git submodule
* bootstrap (git_modules_config): Use GIT_CONFIG, not GIT_CONFIG_LOCAL.
The latter was removed in v1.5.6.1-109-gdc87183.
2009-03-07 18:12:03 +01:00
Jim Meyering
4f526d2d64 build: avoid "multiply defined..." warning from automake
* Makefile.am (AM_CFLAGS): Add $(WARN_CFLAGS) via +=, not =, to
avoid "multiply defined..." warning from automake.
2009-03-07 13:28:20 +01:00
Jim Meyering
02c3dc9de8 cat: use larger buffer sizes to reduce read/write-syscall overhead
* src/cat.c (max): Remove definition.  Use MAX from system.h instead.
(compute_buffer_size): New function to compute the input and output
buffer sizes, which are now set at 8 times st_blksize with a maximum
of 32KiB. Previously the typical block sizes used were 1KiB for pipes
and 4KiB for files, and now will be 8KiB and 32KiB respectively.
(main): Use it.
This change can double throughput on modern systems.  For timings,
see http://article.gmane.org/gmane.comp.gnu.core-utils.bugs/16040
Suggestion from Tzvi Rotshtein.
2009-03-06 14:41:47 +01:00
Jim Meyering
8b638f994a maint: avoid new unused-macro warnings from gcc
* src/ls.c (ASSERT_MATCHING_DEV_INO): Comment-out unused definition,
to match commented-out use.
* src/install.c (INITIAL_HASH_MODULE, INITIAL_ENTRY_TAB_SIZE):
(READ_SIZE): Remove definitions of unused macros.
* src/mv.c (INITIAL_HASH_MODULE, INITIAL_ENTRY_TAB_SIZE): Likewise.
* src/dd.c (max): Likewise.
* src/expand.c (OUTPUT_BLOCK): Likewise.
* src/csplit.c (ALLOC_SIZE): Likewise.
* src/pr.c (NULLCOL): Likewise.
* src/ptx.c (Sword): Likewise.
* src/unexpand.c (OUTPUT_BLOCK): Likewise.
* src/factor.c (NDEBUG): Likewise.
2009-03-06 11:49:46 +01:00
Jim Meyering
5d71171e01 tests: fix just-introduced typo in rm/ext3-perf
* tests/rm/ext3-perf: Fix typo in commit 2b1e6636be,
2009-02-27 "tests: rm/ext3-perf: relax this test".
2009-03-06 11:48:16 +01:00
Jim Meyering
c763b485f5 maint: remove spurious case-ignoring option from a test
* maint.mk (sc_trailing_blank): Remove useless/harmless ignore_case=1.
2009-03-06 07:18:09 +01:00
Ralf Wildenhues
0d61f144a3 policy: use git to help avoid trailing white space
* HACKING (Avoid trailing white space): Describe how git can help.
2009-03-04 06:19:49 +01:00
Andreas Schwab
826095ffad Update Andreas Schwab's email address
* THANKS: Update Andreas Schwab's email address.
2009-03-03 23:07:16 +00:00
Jim Meyering
cb0d71399c maint: improve release-related process and documentation
* README-release: Fix typo. it's "maintainer-clean".
Refer to HACKING for full list of dependencies.
Use cvs add's -ko option to inhibit $Id$-style keyword expansion.
* maint.mk (web-manual): Factor out definition of $(manual_title).
(vc-dist): Set XZ_OPT=-9ev for the final "make dist".
* cfg.mk (manual_title): Define it here.
Suggestions from Eric Blake.
2009-03-03 08:24:29 +01:00
Jim Meyering
59cec5af12 dist: document our release procedure
* README-release: New file.
2009-03-02 19:53:25 +01:00
Jim Meyering
ce9c2c64de dist: automate the post-release web-manual update process
* maint.mk (web-manual): New rule, from m4's maint.mk.
* bootstrap.conf (gnulib_modules): Add gendocs.
2009-03-02 19:30:13 +01:00
Jim Meyering
2b1e6636be tests: rm/ext3-perf: relax this test
* tests/rm/ext3-perf: If set-up takes too long, use the set-up time
as the removal time limit.  Otherwise, a parallel "make check" would
usually fail when run with RUN_VERY_EXPENSIVE_TESTS=yes.
2009-03-02 09:35:12 +01:00
Jim Meyering
8c4f28b124 tests: don't skip setgid-dir related tests on SELinux-enabled systems
* tests/setgid-check: The change in ls (use ".", not "+") caused
this check always to report the working directory as set-gid.
Now, use stat, not ls.
2009-03-02 09:35:12 +01:00
Jim Meyering
0433f90e3d tests: reflect the s/+/./ SELinux indicator change
* tests/mkdir/perm: Now that this test is no longer always skipped,
make it work independently of ls: use stat, not ls, to get perm string.
* test-lib.sh (rwx_to_mode_): Use stat, not ls to get perm string
This test was run only when RUN_VERY_EXPENSIVE_TESTS=yes was set.
2009-03-02 09:35:12 +01:00
Jim Meyering
1c7d5b5847 tests: when skipping a test, say why on screen, not just in the log
* tests/test-lib.sh: Redirect also to descriptor 9.
Better one-line why-skip diagnostics.
* tests/check.mk (TESTS_ENVIRONMENT): Redirect 9 to stderr.
* tests/misc/pwd-unreadable-parent: Remove redundant "skipping..." diag.
2009-03-02 09:35:12 +01:00
Jim Meyering
6449370e9e maint: enable many gcc warnings
* bootstrap.conf (gnulib_modules): Add manywarnings.
* configure.ac: Use gl_MANYWARN_ALL_GCC, and exclude options
I don't want or that provoke too many warnings.
(WARN_CFLAGS, WERROR_CFLAGS): Define.
(lint, GNULIB_PORTCHECK): Define.
(_FORTIFY_SOURCE): Define to 2.
2009-03-02 09:10:26 +01:00
Jim Meyering
ebfbdf9f0e maint: avoid gcc warning about missing attributes
* src/prog-fprintf.h (prog_fprintf): Declare with printf attribute.
* src/system.h (usage): Declare with the "noreturn" attribute.
2009-03-02 09:10:17 +01:00
Jim Meyering
2d10b7617b maint: avoid warnings about potentially-counterproductive "inline"
* src/dd.c (quit): Remove "inline" attribute.
* src/test.c (advance, unary_advance): Likewise.
2009-03-02 09:10:06 +01:00
Jim Meyering
14cdeddbf3 maint: cp: avoid gcc warning about unused macro definitions
* src/cp.c (INITIAL_HASH_MODULE, INITIAL_ENTRY_TAB_SIZE): Remove.
2009-03-02 09:09:43 +01:00
Jim Meyering
2209d10f4c dist: do not emit MD5 or SHA1 checksums into announcement template
* maint.mk (announcement): Use announce-gen's new --no-print-checksums.
2009-03-02 08:59:06 +01:00
Jim Meyering
18332a65af maint: detect unnecessary inclusion of signal.h
* maint.mk (sc_prohibit_signal_without_use): New rule.
2009-02-28 11:06:35 +01:00
Jim Meyering
17b18bfa6c maint: remove an unnecessary inclusion of <signal.h>
* src/operand2sig.c: Don't include <signal.h>.
2009-02-28 11:06:35 +01:00
Pádraig Brady
eb1e30c213 tests: sort: Check skipping blanks in multibyte locales
* tests/misc/sort: On Fedora 8 at least, sort -k1b,1
mishandles blanks in multibyte locales, so add test.
2009-02-28 01:09:18 +00:00
Jim Meyering
d88c9f95e3 * HACKING: avoid trailing white space 2009-02-27 23:05:07 +01:00
Jim Meyering
b50a4ae557 cp: diagnose invalid "cp -rl dir dir" right away, once again
Running "mkdir dir; cp -rl dir dir" would create dir/dir/dir/...
rather than diagnosing the "copy-into-self" failure.

The easy fix would have been to revert this part of the change
[3ece0355 2008-11-09 cp: use far less memory in some cases]
that introduced the bug:

-         remember_copied (dst_name, dst_sb.st_ino, dst_sb.st_dev);
+         if (!x->hard_link)
+           remember_copied (dst_name, dst_sb.st_ino, dst_sb.st_dev);

However, that would have induced the failure of the new cp/link-heap
test, due to the added memory pressure of recording 10k dev/ino pairs.
And besides, I liked that improvement and wanted to keep it.

Now that it's obvious recording the just-created-directory dev/ino
needn't depend on the setting of hard_link, I realized it is necessary
to record the pair only for the first directory created for each
source command-line argument.

I made that change, then noticed the new test, cp -rl a d d, would pass
when run once, yet output the into-self diagnostic twice.  Also note
the side effect: it creates d/a and d/d.  However, running that same
command a second time, now with the modified directory, would fail.

That turned out to be due to the fact that although the first into-self
failure was detected in copy_dir, that function would continue copying
other entries regardless -- and that would make it fail (eventually)
with the unwanted recursion.

* src/copy.c (copy_internal): This function needed an indicator of
whether, for a give command line argument, it had already created its
first directory.  If so, no more need to record dev/ino pairs.  If this
is the first, then do record its pair.  Hence, the new parameter.
(copy_dir, copy): Update callers.
(copy_dir): Upon any into-self failure, break out of the loop.
* tests/cp/into-self: Test for the above.
Reported by Mikael Magnusson.
2009-02-27 11:44:26 +01:00
Jim Meyering
3a914fa76d tests: stty-row-col would hang when run in the background
* tests/misc/stty-row-col: Don't hang when run in background
at least on Solaris 10 and OpenBSD.
2009-02-26 20:25:42 +01:00
Pádraig Brady
224a69b56b sort: Fix two bugs with determining the end of field
* src/sort.c: When no specific number of chars to skip
is specified for the end field, always skip the whole field.
Also never include leading spaces from next field.
* tests/misc/sort: Add 2 new tests for these cases.
* NEWS: Mention this bug fix.
* THANKS: Add bug reporter.
Reported by Davide Canova.
2009-02-26 14:40:28 +00:00
Eric Blake
9a2a8f0b3e argv-iter: avoid variadic macro
* gl/lib/argv-iter.h (_ATTRIBUTE_NONNULL_): Don't assume C99 variadic
macros are portable yet; needed for at least IRIX/MIPSpro.
* THANKS: Update.
Reported by Stuart Shelton.
2009-02-26 07:00:30 -07:00
Pádraig Brady
3f1579c470 tests: Remove system specific error strings
* tests/dd/skip-seek-past-file: Just check for
the non system specific part of the error strings.
This was causing an erroneous failure on NetBSD 1.6 at least.
2009-02-26 09:50:30 +00:00
Jim Meyering
bba5a47651 tests: using printf with \e for ESC isn't portable
* tests/ls/color-clear-to-eol: Use \33, not \e for ascii ESC.
This test failed when using the built-in printf of /bin/sh from
NetBSD 1.6.
2009-02-25 22:43:07 +01:00
Pádraig Brady
ca4e48f822 Ensure comment for translators is included in po file
Issue reported by Göran Uddeborg.

* src/system.h: Move the translator comment adjacent
to the translated string.
* THANKS: Update Göran's email address.
2009-02-24 11:58:01 +00:00
Tobias Stoeckmann
3a8d16800c truncate: fix typo in man page
* man/truncate.x: Fix spelling.
* THANKS: Update.
2009-02-22 10:16:15 -07:00
Andrew Church
de13679b32 doc: describe dd's status=noxref option
* doc/coreutils.texi (dd invocation): Describe status=noxref.
2009-02-22 10:26:22 +01:00
Jim Meyering
f7da3f1c10 tests: reenable temporarily-disabled tests using e.g., trap '' TTOU
Revert "tests: skip newly-modified tests unconditionally..."
This reverts commit 773a88d33f.
* tests/misc/stty: Don't skip.
* tests/misc/stty-invalid: Likewise.
* tests/mv/i-3: Likewise.
2009-02-22 01:42:43 +01:00
James Youngman
9bde4fd426 update James Youngman's email address
* THANKS: Update James Youngman's email address
2009-02-22 01:41:47 +01:00
Jim Meyering
359c48d5c6 post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2009-02-21 22:49:24 +01:00
97 changed files with 1392 additions and 577 deletions

3
.gitmodules vendored Normal file
View File

@@ -0,0 +1,3 @@
[submodule "gnulib"]
path = gnulib
url = git://git.sv.gnu.org/gnulib.git

View File

@@ -1 +1 @@
7.0
7.1

43
HACKING
View File

@@ -356,6 +356,49 @@ With other files, there will be some existing differences.
Try not to add any more.
Avoid trailing white space
==========================
You may notice that the only trailing blanks in coreutils'
version-controlled files are in a single directory: tests/pr,
which contains expected output from various invocations of pr.
Do not add any more trailing blanks anywhere. While "make syntax-check"
will alert you if you slip up, it's better to nip any problem in the
bud, as you're typing. A good way to help you adapt to this rule is
to configure your editor to highlight any offending characters in the
files you edit. If you use Emacs, customize its font-lock mode (FIXME:
provide more detail) or try one of its whitespace packages. This appears
to be the one that will end up in emacs 23:
http://www.emacswiki.org/emacs/WhiteSpace
[that page says its version also works with emacs 21 and 22]
If you use vim, add this to ~/.vimrc:
let c_space_errors=1
highlight RedundantSpaces ctermbg=red guibg=red
match RedundantSpaces /\s\+$\| \+\ze\t/
Git can help too, by stopping you from committing any change that would
add trailing blanks. The example pre-commit hook contains code to check
for trailing whitespace and spaces before tabs; enable it by moving it
to the right place and making sure it is executable:
mv .git/hooks/pre-commit.sample .git/hooks/pre-commit
With a repository created by git-1.5.6 or older, use this command:
chmod +x .git/hooks/pre-commit
To manually check for whitespace errors before committing, you can use
git diff --check
Git also has some settings to enable suitable internal whitespace checks.
See the manpage for git-apply for details.
-------------------------------------------
Miscellaneous useful git commands

49
NEWS
View File

@@ -1,5 +1,54 @@
GNU coreutils NEWS -*- outline -*-
* Noteworthy changes in release 7.2 (2009-03-31) [stable]
** New features
pwd now accepts the options --logical (-L) and --physical (-P). For
compatibility with existing scripts, -P is the default behavior
unless POSIXLY_CORRECT is requested.
** Bug fixes
cat once again immediately outputs data it has processed.
Previously it would have been buffered and only output if enough
data was read, or on process exit.
[bug introduced in coreutils-6.0]
comm's new --check-order option would fail to detect disorder on any pair
of lines where one was a prefix of the other. For example, this would
fail to report the disorder: printf 'Xb\nX\n'>k; comm --check-order k k
[bug introduced in coreutils-7.0]
cp once again diagnoses the invalid "cp -rl dir dir" right away,
rather than after creating a very deep dir/dir/dir/... hierarchy.
The bug strikes only with both --recursive (-r, -R) and --link (-l).
[bug introduced in coreutils-7.1]
ls --sort=version (-v) sorted names beginning with "." inconsistently.
Now, names that start with "." are always listed before those that don't.
pr: fix the bug whereby --indent=N (-o) did not indent header lines
[bug introduced in coreutils-6.9.90]
sort now handles specified key ends correctly.
Previously -k1,1b would have caused leading space from field 2 to be
included in the sort while -k2,3.0 would have not included field 3.
** Changes in behavior
cp,mv,install,cat,split: now read and write a minimum of 32KiB
at a time. This was seen to increase throughput. Up to 2 times
when reading cached files on linux for example.
cp -a now tries to preserve extended attributes (xattr), but does not
diagnose xattr-preservation failure. However, cp --preserve=all still does.
ls --color: hard link highlighting can be now disabled by changing the
LS_COLORS environment variable. To disable it you can add something like
this to your profile: eval `dircolors | sed s/hl=[^:]*:/hl=:/`
* Noteworthy changes in release 7.1 (2009-02-21) [stable]
** New features

View File

@@ -53,7 +53,7 @@ which are extracted from other source packages:
And there you are! Just
$ ./configure
$ ./configure #[--enable-gcc-warnings]
$ make
$ make check

View File

@@ -16,6 +16,7 @@ getting the prerequisites for particular systems.
# yum install emacs #autoconf build requires emacs (20MB)
# rpmbuild --rebuild http://download.fedora.redhat.com/pub/fedora/linux/development/source/SRPMS/autoconf-2.63-1.fc10.src.rpm
# rpm -Uvh /usr/src/redhat/RPMS/noarch/autoconf-2.63-1.fc8.noarch.rpm
Note Autoconf 2.61a-341 or newer is needed to build automake-1.10a in step 3.
Apply the same method to install the lzma package.
[FIXME: mention xz when it's packaged]

95
README-release Normal file
View File

@@ -0,0 +1,95 @@
Here are most of the steps we (maintainers) follow when making a release.
* start from a clean, up-to-date git directory.
git checkout master; git pull
* Run ./configure && make maintainer-clean
* Ensure that the desired versions of autoconf, automake, bison, etc.
are in your PATH. See HACKING for the complete list.
* Ensure that you're on "master" with no uncommitted diffs.
This should produce no output: git checkout master; git diff
* Make sure your local gnulib directory is up to date.
* Run bootstrap, (assuming your local copy of gnulib is in /gnulib):
./bootstrap --gnulib-srcdir=/gnulib
FIXME: enable excluded programs like arch? to get their manual pages?
* Pre-release testing:
On at least one SELinux-enabled (enforcing) and one non-SELinux system,
run all tests, both root-only and regular.
Run *all* non-root tests, including expensive and very expensive ones i.e.,
run this: make check RUN_VERY_EXPENSIVE_TESTS=yes RUN_EXPENSIVE_TESTS=yes
Run the root-only tests:
sudo env PATH="$PATH" NON_ROOT_USERNAME=$USER make -k check-root
* Run "make distcheck"
* Manually set the date, version number, and [stable/alpha/beta] on
line 3 of NEWS, then do this:
v=7.1
git commit -F <(printf 'version '$v'\n\n* NEWS: Record release date.\n') -a
git tag -s -m "coreutils $v" v$v HEAD
* Run the following to create release tarballs. Your choice selects the
corresponding upload-to destination in the emitted gnupload command.
# "TYPE" must be major, beta or alpha
make TYPE
* Test the tarball. copy it to a few odd-ball systems and ensure that
it builds and passes all tests.
* While that's happening, write the release announcement that you will
soon post.
Once all the builds and tests have passed,
* Run the gnupload command suggested by your "XZ_OPT=-9e make major" run above.
* Wait a few minutes (maybe up to 30?) and then use the release URLs to
download all tarball/signature pairs and use gpg --verify to ensure
that they're all valid.
* Push the new tag:
git push origin tag v<JUST_RELEASED_VERSION_NUMBER>
* Send the gpg-signed announcement mail, e.g.,
To: info-gnu@gnu.org, coreutils-announce@gnu.org
Cc: coordinator@translationproject.org, bug-coreutils@gnu.org
Subject: coreutils-7.1 released [stable]
* Approve the announcement here:
http://lists.gnu.org/mailman/admindb/coreutils-announce
* Announce it on Savannah, too:
From here:
https://savannah.gnu.org/projects/coreutils/
click on the "submit news", then write something like the following:
The announcement is here:
http://article.gmane.org/gmane.comp.gnu.core-utils.announce/48
Then go here to approve it:
https://savannah.gnu.org/news/approve.php?group=coreutils
* For non-alpha releases, update the on-line manual at
http://www.gnu.org/software/coreutils/manual/
Run `make web-manual', then copy the contents of doc/manual
into a CVS checkout of the coreutils manual repository.
Also edit coreutils.html (FIXME? why?) before doing a CVS commit.
CVS_RSH=ssh \
cvs -d:ext:$USER@cvs.savannah.gnu.org:/web/coreutils co coreutils
Be sure to "cvs add -ko" any files that "cvs status" marks with "?".
That is necessary whenever a new texinfo node is added. Each becomes
a new file in html_node that must then be "cvs add"ed.

23
THANKS
View File

@@ -22,6 +22,7 @@ Albert Hopkins ahopkins@dynacare.com
Alberto Accomazzi alberto@cfa0.harvard.edu
aldomel aldomel@ix.netcom.com
Alen Muzinic zveki@fly.cc.fer.hr
Alexander Nguyen vinh@seas.ucla.edu
Alexander V. Lukyanov lav@netis.ru
Allen Hewes allen@decisiv.net
Axel Dörfler axeld@pinc-software.de
@@ -35,11 +36,12 @@ Andreas Frische andreasfrische@gmail.com
Andreas Gruenbacher ag@bestbits.at
Andreas Jaeger jaeger@gnu.org
Andreas Luik luik@isa.de
Andreas Schwab schwab@suse.de
Andreas Schwab schwab@linux-m68k.org
Andreas Stolcke stolcke@ICSI.Berkeley.EDU
Andrei Gaponenko andr@triumf.ca
Andres Soolo andres@soolo.matti.ee
Andrew Burgess aab@cichlid.com
Andrew Church achurch@achurch.org
Andrew Dalke dalke@bioreason.com
Andrew Fabbro andrew@fabbro.org
Andrew Pham andpha@us.ibm.com
@@ -88,6 +90,7 @@ Brian Youmans 3diff@gnu.org
Bruce Korb bkorb@veritas.com
Bruce Robertson brucer@theodolite.dyndns.org
Bruno Haible haible@clisp.cons.org
C de-Avillez hggdh2@gmail.com
Carl Johnson carlj@cjlinux.home.org
Carl Lowenstein cdl@mpl.UCSD.EDU
Carl Roth roth@urs.us
@@ -129,6 +132,7 @@ Darrel Francis d.francis@cheerful.com
Darren Salt ds@youmustbejoking.demon.co.uk
Dave Beckett dajobe@dajobe.org
David Alan Gilbert gilbertd@treblig.org
David Bartley dtbartle@csclub.uwaterloo.ca
David Dyck dcd@tc.fluke.COM
David Eisner cradle@umd.edu
David Flynn dav@chess.plus.com
@@ -136,6 +140,7 @@ David Godfrey dave@delta.demon.co.uk
David Luyer david_luyer@pacific.net.au
David Madore david.madore@ens.fr
David Malone dwmalone@cnri.dit.ie
Davide Canova kc.canova@gmail.com
Dawson Engler engler@stanford.edu
Dean Gaudet dean-savannah@arctic.org
Deepak Goel deego@gnufans.org
@@ -200,7 +205,8 @@ Geoff Whale geoffw@cse.unsw.EDU.AU
Gerald Pfeifer gerald@pfeifer.com
Gerhard Poul gpoul@gnu.org
Germano Leichsenring germano@jedi.cs.kobe-u.ac.jp
Göran Uddeborg goeran@uddeborg.pp.se
Glen Lenker glen.lenker@gmail.com
Göran Uddeborg goeran@uddeborg.se
Guochun Shi gshi@ncsa.uiuc.edu
GOTO Masanori gotom@debian.or.jp
Greg Louis glouis@dynamicro.on.ca
@@ -242,7 +248,7 @@ James Hunt jamesodhunt@hotmail.com
James Ralston ralston@pobox.com
James Sneeringer jvs@ocslink.com
James Tanis jtt@soscorp.com
James Youngman james+usenet@free-lunch.demon.co.uk
James Youngman jay@gnu.org
Jamie Lokier jamie@imbolc.ucc.ie
Jamie McClelland jm@mayfirst.org
Jan Engelhardt jengelh@medozas.de
@@ -287,6 +293,7 @@ Jon Peatfield J.S.Peatfield@damtp.cam.ac.uk
Joost van Baal joostvb@xs4all.nl
Jorge Stolfi stolfi@ic.unicamp.br
Joseph S. Myers jsm28@cam.ac.uk
Josh Triplett josh@freedesktop.org
Joshua Hudson joshudson@gmail.com
Josselin Mouette joss@debian.org
Juan F. Codagnone juam@arnet.com.ar
@@ -360,6 +367,7 @@ Mate Wierdl mw@moni.msci.memphis.edu
Matej Vela mvela@public.srce.hr
Matt Kraai kraai@ftbfs.org
Matt Perry matt@primefactor.com
Matt Pham mattvpham@gmail.com
Matt Schalit mschalit@pacbell.net
Matt Swift swift@alum.mit.edu
Matthew Arnison maffew@cat.org.au
@@ -373,6 +381,7 @@ Matthew Woehlke mw_triad@users.sourceforge.net
Matthias Urlichs smurf@noris.de
Matti Aarnio matti.aarnio@zmailer.org
Mattias Wadenstein maswan@acc.umu.se
Max Chang maxchang@ucla.edu
Meelis Roos mroos@tartu.cyber.ee
Michael michael@aplatform.com
Michael ??? michael@roka.net
@@ -396,6 +405,7 @@ Michal Politowski mpol@charybda.icm.edu.pl
Michal Svec msvec@suse.cz
Michel Robitaille robitail@IRO.UMontreal.CA
Michiel Bacchiani bacchian@raven.bu.edu
Mikael Magnusson mikachu@gmail.com
Mike Castle dalgoda@ix.netcom.com
Mike Coleman mkc@mathdogs.com
Mike Jetzer mjetzer@mke.catalystwms.com
@@ -409,11 +419,13 @@ Neal H Walfield neal@cs.uml.edu
Neil Brown neilb@cse.unsw.edu.au
Nelson H. F. Beebe beebe@math.utah.edu
Nick Estes debian@nickstoys.com
Nick Graham nick.d.graham@gmail.com
Nick Lawes nlawes@silverplatter.com
Nickolai Zeldovich nickolai@cs.stanford.edu
Nicolas François nicolas.francois@centraliens.net
Niklas Edmundsson nikke@acc.umu.se
Nikola Milutinovic Nikola.Milutinovic@ev.co.yu
Nima Nikzad nnikzad@ucla.edu
Noah Friedman friedman@splode.com
Noel Cragg noel@red-bean.com
Norbert Kiesel nkiesel@tbdnetworks.com
@@ -425,6 +437,7 @@ Oliver Kiddle okiddle@yahoo.co.uk
Oskar Liljeblad osk@hem.passagen.se
Pádraig Brady P@draigBrady.com
Patrick Mauritz oxygene@studentenbude.ath.cx
Paul D. Smith psmith@gnu.org
Paul Eggert eggert@twinsun.com
Paul Ghaleb paul.ghaleb@st.com
Paul Jarc prj@po.cwru.edu
@@ -486,6 +499,7 @@ Ross Alexander r.alexander@auckland.ac.nz
Ross Paterson rap@doc.ic.ac.uk
Ross Ridge rridge@calum.csclub.uwaterloo.ca
Rudolf Kastl rkastl@redhat.com
Sahil Amoli sahilamoli@gmail.com
Sami Farin sfarin@ratol.fi
Samuel Tardieu sam@rfc1149.net
Samuel Thibault samuel.thibault@ens-lyon.org
@@ -512,6 +526,7 @@ Steven G. Johnson stevenj@alum.mit.edu
Steven Mocking ufo@quicknet.nl
Steven P Watson steven@magelico.net
Stuart Kemp skemp@peter.bmc.com
Stuart Shelton stuart@shelton.me
Sven Joachim svenjoac@gmx.de
Szakacsits Szabolcs szaka@sienet.hu
Tadayoshi Funaba tadf@kt.rim.or.jp
@@ -532,6 +547,7 @@ Tim Mooney mooney@dogbert.cc.ndsu.NoDak.edu
Tim Ryan Tim_Ryan@bnz.co.nz
Tim Smithers mouse@dmouse.com.au
Tim Waugh twaugh@redhat
Tobias Stoeckmann tobias@bugol.de
Toby Peterson toby@opendarwin.org
Todd A. Jacobs tjacobs@codegnome.org
Tom Haynes thomas@netapp.com
@@ -548,6 +564,7 @@ Torbjorn Granlund tege@nada.kth.se
Torbjorn Lindgren tl@funcom.no
Torsten Landschoff torsten@pclab.ifg.uni-kiel.de
Tristan Miller psychonaut@nothingisreal.com
Tzvi Rotshtein tzvi.ro@gmail.com
Ulrich Drepper drepper@gnu.org
Ulrich Hermisson ulrich_hermisson@hotmail.com
Urs Thuermann urs@isnogud.escape.de

5
TODO
View File

@@ -36,11 +36,6 @@ printf:
platforms where the native *printf(3) is deficient.
Suggestion from Eric Blake.
pwd:
Implement the options -P and -L in a POSIX-compatible way.
Note the instructions in the initial paragraph of this file
before starting.
renice: POSIX utility, needs implementing.
suggestion from Karl Berry (among others).
Bob Proulx is working on this.

View File

@@ -2,7 +2,7 @@
# Bootstrap this package from checked-out sources.
# Copyright (C) 2003-2008 Free Software Foundation, Inc.
# Copyright (C) 2003-2009 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
@@ -342,7 +342,7 @@ cleanup_gnulib() {
}
git_modules_config () {
GIT_CONFIG_LOCAL=.gitmodules git config "$@"
GIT_CONFIG=.gitmodules git config "$@"
}
# Get gnulib files.
@@ -686,6 +686,12 @@ find "$m4_base" "$source_base" \
-depth \( -name '*.m4' -o -name '*.[ch]' \) \
-type l -xtype l -delete > /dev/null 2>&1
# Use automake's --silent-rules option, if possible.
automake="${AUTOMAKE-automake} --add-missing --copy --force-missing"
(${AUTOMAKE-automake} --help) 2>&1 \
| grep -e '^ *--silent-rules' > /dev/null \
&& automake="$automake --silent-rules"
# Reconfigure, getting other files.
for command in \
@@ -693,7 +699,7 @@ for command in \
"${ACLOCAL-aclocal} --force -I m4" \
"${AUTOCONF-autoconf} --force" \
"${AUTOHEADER-autoheader} --force" \
"${AUTOMAKE-automake} --add-missing --copy --force-missing"
"$automake"
do
if test "$command" = libtool; then
use_libtool=0

View File

@@ -57,6 +57,7 @@ gnulib_modules="
fsusage ftruncate
ftello
fts getdate getgroups gethrxtime
gendocs
getline getloadavg getndelim2 getopt getpagesize getpass-gnu
gettext gettime gettimeofday getugroups getusershell
git-version-gen
@@ -67,9 +68,10 @@ gnulib_modules="
inttostr inttypes isapipe
lchmod lchown lib-ignore linebuffer link-follow
long-options lstat malloc
manywarnings
mbrtowc
mbswidth
memcasecmp mempcpy
memcasecmp memcmp2 mempcpy
memrchr mgetgroups
mkancesdirs mkdir mkdir-p mkstemp mktime modechange
mountlist mpsort obstack pathmax perl physmem
@@ -120,17 +122,19 @@ EXTRA_LOCALE_CATEGORIES=LC_TIME
# Additional xgettext options to use. Use "\\\newline" to break lines.
XGETTEXT_OPTIONS=$XGETTEXT_OPTIONS'\\\
--from-code=UTF-8\\\
--flag=asprintf:2:c-format\\\
--flag=asnprintf:3:c-format\\\
--flag=asprintf:2:c-format\\\
--flag=error:3:c-format\\\
--flag=error_at_line:5:c-format\\\
--flag=vasprintf:2:c-format\\\
--flag=vasnprintf:3:c-format\\\
--flag=vasprintf:2:c-format\\\
--flag=verror:3:c-format\\\
--flag=verror_at_line:5:c-format\\\
--flag=wrapf:1:c-format\\\
--flag=xasprintf:1:c-format\\\
--flag=xfprintf:2:c-format\\\
--flag=xprintf:1:c-format\\\
--from-code=UTF-8\\\
'
# Append these, since we use the propername module.

View File

@@ -213,8 +213,8 @@ $(TEST_SUITE_LOG): $(TEST_LOGS)
for f in $(TEST_LOGS); \
do \
case $$(sed 1q $$f) in \
SKIP:*|PASS:*|XFAIL:*);; \
*) echo; cat $$f;; \
SKIP:*|PASS:*|XFAIL:*);; \
*) echo; cat $$f;; \
esac; \
done; \
} >$(TEST_SUITE_LOG).tmp; \

7
cfg.mk
View File

@@ -21,6 +21,9 @@ gnu_ftp_host-beta = alpha.gnu.org
gnu_ftp_host-major = ftp.gnu.org
gnu_rel_host = $(gnu_ftp_host-$(RELEASE_TYPE))
# Used in maint.mk's web-manual rule
manual_title = Core GNU utilities
url_dir_list = \
ftp://$(gnu_rel_host)/gnu/coreutils
@@ -42,13 +45,13 @@ gnulib_dir = /gnulib
# Now that we have better (check.mk) tests, make this the default.
export VERBOSE = yes
old_NEWS_hash = 791cf10529d00853f6363ca67f360747 -
old_NEWS_hash = fa6cba1740b3f385520c1b54d90859ca
# Ensure that the list of O_ symbols used to compute O_FULLBLOCK is complete.
dd = $(srcdir)/src/dd.c
sc_dd_O_FLAGS:
@rm -f $@.1 $@.2
@{ echo O_FULLBLOCK; perl -nle '/MAX \((O_\w*),/ and print $$1' \
@{ echo O_FULLBLOCK; perl -nle '/^ +\| (O_\w*)$$/ and print $$1' \
$(dd); } | sort > $@.1
@{ echo O_NOFOLLOW; perl -nle '/{"[a-z]+",\s*(O_\w+)},/ and print $$1' \
$(dd); } | sort > $@.2

View File

@@ -1,7 +1,7 @@
# -*- autoconf -*-
# Process this file with autoconf to produce a configure script.
# Copyright (C) 1991, 1993-2008 Free Software Foundation, Inc.
# Copyright (C) 1991, 1993-2009 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
@@ -46,7 +46,7 @@ coreutils_MACROS
AC_ARG_ENABLE([gcc-warnings],
[AS_HELP_STRING([--enable-gcc-warnings],
[turn on lots of GCC warnings (not recommended)])],
[turn on lots of GCC warnings (for developers)])],
[case $enableval in
yes|no) ;;
*) AC_MSG_ERROR([bad value $enableval for gcc-warnings option]) ;;
@@ -58,23 +58,52 @@ AC_ARG_ENABLE([gcc-warnings],
if test "$gl_gcc_warnings" = yes; then
gl_WARN_ADD([-Werror], [WERROR_CFLAGS])
AC_SUBST([WERROR_CFLAGS])
gl_WARN_ADD([-Wall])
gl_WARN_ADD([-Wextra])
gl_WARN_ADD([-Wshadow])
gl_WARN_ADD([-Wno-sign-compare])
gl_WARN_ADD([-Wformat])
gl_WARN_ADD([-Wformat-security])
gl_WARN_ADD([-Wcast-align])
gl_WARN_ADD([-Wpointer-arith])
gl_WARN_ADD([-Wwrite-strings])
gl_WARN_ADD([-Wbad-function-cast])
gl_WARN_ADD([-Wmissing-declarations])
gl_WARN_ADD([-Wmissing-prototypes])
gl_WARN_ADD([-Wstrict-prototypes])
# Add many warnings, except some...
nw="$nw -Wdeclaration-after-statement" # too useful to forbid
nw="$nw -Waggregate-return" # anachronistic
nw="$nw -Wc++-compat" # We don't care about C++ compilers
nw="$nw -Wundef" # Warns on '#if GNULIB_FOO' etc in gnulib
nw="$nw -Wtraditional" # Warns on #elif which we use often
nw="$nw -Wcast-qual" # Too many warnings for now
nw="$nw -Wconversion" # Too many warnings for now
nw="$nw -Wsystem-headers" # Don't let system headers trigger warnings
nw="$nw -Wsign-conversion" # Too many warnings for now
nw="$nw -Wtraditional-conversion" # Too many warnings for now
nw="$nw -Wunreachable-code" # Too many warnings for now
nw="$nw -Wpadded" # Our structs are not padded
nw="$nw -Wredundant-decls" # openat.h declares e.g., mkdirat
nw="$nw -Wlogical-op" # any use of fwrite provokes this
nw="$nw -Wformat-nonliteral" # who.c and pinky.c strftime uses
nw="$nw -Wvla" # warnings in gettext.h
nw="$nw -Wnested-externs" # use of XARGMATCH/verify_function__
nw="$nw -Wswitch-enum" # Too many warnings for now
nw="$nw -Wswitch-default" # Too many warnings for now
# things I might fix soon:
nw="$nw -Wfloat-equal" # sort.c, seq.c
nw="$nw -Wmissing-format-attribute" # copy.c
nw="$nw -Wunsafe-loop-optimizations" # a few src/*.c
nw="$nw -Winline" # system.h's readdir_ignoring_dot_and_dotdot
nw="$nw -Wstrict-overflow" # expr.c, pr.c, tr.c, factor.c
# ?? -Wstrict-overflow
gl_MANYWARN_ALL_GCC([ws])
gl_MANYWARN_COMPLEMENT([ws], [$ws], [$nw])
for w in $ws; do
gl_WARN_ADD([$w])
done
gl_WARN_ADD([-Wno-missing-field-initializers]) # We need this one
gl_WARN_ADD([-Wno-sign-compare]) # Too many warnings for now
gl_WARN_ADD([-Wno-pointer-sign]) # Too many warnings for now
gl_WARN_ADD([-Wno-unused-parameter]) # Too many warnings for now
gl_WARN_ADD([-fdiagnostics-show-option])
AC_SUBST([WARN_CFLAGS])
AC_DEFINE([lint], [1], [Define to 1 if the compiler is checking for lint.])
AC_DEFINE([_FORTIFY_SOURCE], [2],
[enable compile-time and run-time bounds-checking, and some warnings])
AC_DEFINE([GNULIB_PORTCHECK], [1], [enable some gnulib portability checks])
fi
AC_FUNC_FORK

1
doc/.gitignore vendored
View File

@@ -16,6 +16,7 @@ coreutils.toc
coreutils.tp
coreutils.vr
fdl.texi
gendocs_template
getdate.texi
stamp-vti
version.texi

View File

@@ -3937,13 +3937,17 @@ and I/0. Conversely a small value of @var{nmerge} may reduce memory
requirements and I/0 at the expense of temporary storage consumption and
merge performance.
The value of @var{nmerge} must be at least 2.
The value of @var{nmerge} must be at least 2. The default value is
currently 16, but this is implementation-dependent and may change in
the future.
The value of @var{nmerge} may be bounded by a resource limit for open
file descriptors. Try @samp{ulimit -n} or @samp{getconf OPEN_MAX} to
to display the limit for a particular system.
If the value of @var{nmerge} exceeds this limit, then @command{sort} will
issue a warning to standard error and exit with a nonzero status.
file descriptors. The commands @samp{ulimit -n} or @samp{getconf
OPEN_MAX} may display limits for your systems; these limits may be
modified further if your program already has some files open, or if
the operating system has other limits on the number of open files. If
the value of @var{nmerge} exceeds the resource limit, @command{sort}
silently uses a smaller value.
@item -o @var{output-file}
@itemx --output=@var{output-file}
@@ -6661,21 +6665,27 @@ foo.zml-25.gz foo.zml-25.gz
foo.zml-6.gz foo.zml-100.gz
@end example
Note also that numeric parts with leading zeros are considered as
fractional one:
Version-sorted strings are compared such that if @var{ver1} and @var{ver2}
are version numbers and @var{prefix} and @var{suffix} (@var{suffix} matching
the regular expression @samp{(\.[A-Za-z~][A-Za-z0-9~]*)*}) are strings then
@var{ver1} < @var{ver2} implies that the name composed of
``@var{prefix} @var{ver1} @var{suffix}'' sorts before
``@var{prefix} @var{ver2} @var{suffix}''.
Note also that leading zeros of numeric parts are ignored:
@example
$ ls -1 $ ls -1v
abc-1.007.tgz abc-1.007.tgz
abc-1.012b.tgz abc-1.01a.tgz
abc-1.007.tgz abc-1.01a.tgz
abc-1.012b.tgz abc-1.007.tgz
abc-1.01a.tgz abc-1.012b.tgz
@end example
This functionality is implemented using the @code{strverscmp} function.
@xref{String/Array Comparison, , , libc, The GNU C Library Reference Manual}.
One result of that implementation decision is that @code{ls -v} does not
use the locale category, @env{LC_COLLATE}. As a result, non-numeric prefixes
are sorted as if @env{LC_COLLATE} were set to @code{C}.
This functionality is implemented using gnulib's @code{filevercmp} function.
One result of that implementation decision is that @samp{ls -v}
and @samp{sort -V} do not use the locale category, @env{LC_COLLATE},
which means non-numeric prefixes are sorted as if @env{LC_COLLATE} were set
to @samp{C}.
@node General output formatting
@subsection General output formatting
@@ -7262,10 +7272,9 @@ Preserve as much as possible of the structure and attributes of the
original files in the copy (but do not attempt to preserve internal
directory structure; i.e., @samp{ls -U} may list the entries in a copied
directory in a different order).
Try to preserve SELinux security context, but ignore any failure to do that
and print no corresponding diagnostic.
This option does not preserve extended attributes(xattr) at the moment.
Equivalent to @option{-dR --preserve=all} with a few exceptions.
Try to preserve SELinux security context and extended attributes (xattr),
but ignore any failure to do that and print no corresponding diagnostic.
Equivalent to @option{-dR --preserve=all} with the reduced diagnostics.
@item -b
@itemx @w{@kbd{--backup}[=@var{method}]}
@@ -7649,6 +7658,11 @@ Skip @var{blocks} @samp{obs}-byte blocks in the output file before copying.
Copy @var{blocks} @samp{ibs}-byte blocks from the input file, instead
of everything until the end of the file.
@item status=noxfer
@opindex status
Do not print the overall transfer rate and volume statistics
that normally make up the third status line when @command{dd} exits.
@item conv=@var{conversion}[,@var{conversion}]@dots{}
@opindex conv
Convert the file as specified by the @var{conversion} argument(s).
@@ -11858,13 +11872,39 @@ so forth. See also the user-related commands in the next section.
@cindex current working directory, printing
@cindex working directory, printing
@cindex symbolic links and @command{pwd}
@command{pwd} prints the fully resolved name of the current directory.
That is, all components of the printed name will be actual directory
names---none will be symbolic links.
The only options are a lone @option{--help} or
@option{--version}. @xref{Common options}.
@command{pwd} prints the name of the current directory. Synopsis:
@example
pwd [@var{option}]@dots{}
@end example
The program accepts the following options. Also see @ref{Common options}.
@table @samp
@item -L
@itemx --logical
@opindex -L
@opindex --logical
If the contents of the environment variable @env{PWD} provide an
absolute name of the current directory with no @samp{.} or @samp{..}
components, but possibly with symbolic links, then output those
contents. Otherwise, fall back to default @option{-P} handling.
@item -P
@itemx --physical
@opindex -P
@opindex --physical
Print a fully resolved name for the current directory. That is, all
components of the printed name will be actual directory names---none
will be symbolic links.
@end table
@cindex symbolic links and @command{pwd}
If @option{-L} and @option{-P} are both given, the last one takes
precedence. If neither option is given, then this implementation uses
@option{-P} as the default unless the @env{POSIXLY_CORRECT}
environment variable is set.
@mayConflictWithShellBuiltIn{pwd}

View File

@@ -1,5 +1,5 @@
/* Iterate over arguments from argv or --files0-from=FILE
Copyright (C) 2008 Free Software Foundation, Inc.
Copyright (C) 2008-2009 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
@@ -22,9 +22,9 @@ enum argv_iter_err;
#undef _ATTRIBUTE_NONNULL_
#if __GNUC__ == 3 && __GNUC_MINOR__ >= 3 || 3 < __GNUC__
# define _ATTRIBUTE_NONNULL_(m,...) __attribute__ ((__nonnull__ (m)))
# define _ATTRIBUTE_NONNULL_(m) __attribute__ ((__nonnull__ (m)))
#else
# define _ATTRIBUTE_NONNULL_(m,...)
# define _ATTRIBUTE_NONNULL_(m)
#endif
enum argv_iter_err
@@ -40,7 +40,7 @@ struct argv_iterator *argv_iter_init_argv (char **argv)
struct argv_iterator *argv_iter_init_stream (FILE *fp)
_ATTRIBUTE_NONNULL_ (1);
char *argv_iter (struct argv_iterator *, enum argv_iter_err *)
_ATTRIBUTE_NONNULL_ (1, 2);
_ATTRIBUTE_NONNULL_ (1) _ATTRIBUTE_NONNULL_ (2);
size_t argv_iter_n_args (struct argv_iterator const *)
_ATTRIBUTE_NONNULL_ (1);
void argv_iter_free (struct argv_iterator *)

View File

@@ -1,6 +1,6 @@
/* Generate buffers of random data.
Copyright (C) 2006, 2008 Free Software Foundation, Inc.
Copyright (C) 2006, 2008-2009 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
@@ -43,16 +43,6 @@
# define MIN(a, b) ((a) < (b) ? (a) : (b))
#endif
#ifndef __attribute__
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8)
# define __attribute__(x)
# endif
#endif
#ifndef ATTRIBUTE_UNUSED
# define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
#endif
#if _STRING_ARCH_unaligned
# define ALIGNED_POINTER(ptr, type) true
#else

View File

@@ -1,5 +1,5 @@
/* openat-style fd-relative functions for SE Linux
Copyright (C) 2007 Free Software Foundation, Inc.
Copyright (C) 2007, 2009 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -29,9 +29,6 @@
#include "dirname.h" /* solely for definition of IS_ABSOLUTE_FILE_NAME */
#include "save-cwd.h"
#include "gettext.h"
#define _(msgid) gettext (msgid)
#include "openat-priv.h"
#define AT_FUNC_NAME getfileconat

View File

@@ -72,6 +72,7 @@ main ()
{
FILE *fp;
struct argv_iterator *ai;
size_t n_found = 0;
if (use_stream)
{
/* Generate an identical list to be read via FP. */
@@ -85,7 +86,6 @@ main ()
}
ASSERT (ai);
size_t n_found = 0;
while (1)
{
enum argv_iter_err ai_err;

1
gnulib Submodule

Submodule gnulib added at 5a1286a9f8

View File

@@ -1,6 +1,6 @@
## Makefile for gnulib/lib -*-Makefile-*-
# Copyright (C) 1995-2007 Free Software Foundation, Inc.
# Copyright (C) 1995-2007, 2009 Free Software Foundation, Inc.
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
@@ -17,7 +17,7 @@
include gnulib.mk
AM_CFLAGS = $(WARN_CFLAGS) # $(WERROR_CFLAGS)
AM_CFLAGS += $(WARN_CFLAGS) # $(WERROR_CFLAGS)
libcoreutils_a_SOURCES += \
buffer-lcm.c buffer-lcm.h \

View File

@@ -153,10 +153,9 @@ sc_prohibit_strcmp:
# Using EXIT_SUCCESS as the first argument to error is misleading,
# since when that parameter is 0, error does not exit. Use `0' instead.
sc_error_exit_success:
@grep -nF 'error (EXIT_SUCCESS,' \
$$(find -type f -name '*.[chly]') && \
{ echo '$(ME): found error (EXIT_SUCCESS' 1>&2; \
exit 1; } || :
@grep -nE 'error \(EXIT_SUCCESS,' \
$$($(VC_LIST_EXCEPT) | grep -E '\.[chly]$$') && \
{ echo '$(ME): found error (EXIT_SUCCESS' 1>&2; exit 1; } || :
# `FATAL:' should be fully upper-cased in error messages
# `WARNING:' should be fully upper-cased, or fully lower-cased
@@ -289,6 +288,43 @@ ctype_re = isalnum|isalpha|isascii|isblank|iscntrl|isdigit|isgraph|islower\
sc_prohibit_c_ctype_without_use:
@h='[<"]c-ctype.h[">]' re='\<c_($(ctype_re)) *\(' $(_header_without_use)
_empty =
_sp = $(_empty) $(_empty)
# The following list was generated by running:
# man signal.h|col -b|perl -ne '/bsd_signal.*;/.../sigwaitinfo.*;/ and print' \
# | perl -lne '/^\s+(?:int|void).*?(\w+).*/ and print $1' | fmt
_sig_functions = \
bsd_signal kill killpg pthread_kill pthread_sigmask raise sigaction \
sigaddset sigaltstack sigdelset sigemptyset sigfillset sighold sigignore \
siginterrupt sigismember signal sigpause sigpending sigprocmask sigqueue \
sigrelse sigset sigsuspend sigtimedwait sigwait sigwaitinfo
_sig_function_re = $(subst $(_sp),|,$(strip $(_sig_functions)))
# The following were extracted from "man signal.h" manually.
_sig_types_and_consts = \
MINSIGSTKSZ SA_NOCLDSTOP SA_NOCLDWAIT SA_NODEFER SA_ONSTACK \
SA_RESETHAND SA_RESTART SA_SIGINFO SIGEV_NONE SIGEV_SIGNAL \
SIGEV_THREAD SIGSTKSZ SIG_BLOCK SIG_SETMASK SIG_UNBLOCK SS_DISABLE \
SS_ONSTACK mcontext_t pid_t sig_atomic_t sigevent siginfo_t sigset_t \
sigstack sigval stack_t ucontext_t
# generated via this:
# perl -lne '/^#ifdef (SIG\w+)/ and print $1' lib/sig2str.c|sort -u|fmt -70
_sig_names = \
SIGABRT SIGALRM SIGALRM1 SIGBUS SIGCANCEL SIGCHLD SIGCLD SIGCONT \
SIGDANGER SIGDIL SIGEMT SIGFPE SIGFREEZE SIGGRANT SIGHUP SIGILL \
SIGINFO SIGINT SIGIO SIGIOT SIGKAP SIGKILL SIGKILLTHR SIGLOST SIGLWP \
SIGMIGRATE SIGMSG SIGPHONE SIGPIPE SIGPOLL SIGPRE SIGPROF SIGPWR \
SIGQUIT SIGRETRACT SIGSAK SIGSEGV SIGSOUND SIGSTKFLT SIGSTOP SIGSYS \
SIGTERM SIGTHAW SIGTRAP SIGTSTP SIGTTIN SIGTTOU SIGURG SIGUSR1 \
SIGUSR2 SIGVIRT SIGVTALRM SIGWAITING SIGWINCH SIGWIND SIGWINDOW \
SIGXCPU SIGXFSZ
_sig_syms_re = $(subst $(_sp),|,$(strip $(_sig_names) $(_sig_types_and_consts)))
# Prohibit the inclusion of signal.h without an actual use.
sc_prohibit_signal_without_use:
@h='<signal.h>' \
re='\<($(_sig_function_re)) *\(|\<($(_sig_syms_re))\>' \
$(_header_without_use)
sc_obsolete_symbols:
@re='\<(HAVE''_FCNTL_H|O''_NDELAY)\>' \
msg='do not use HAVE''_FCNTL_H or O'_NDELAY \
@@ -337,7 +373,7 @@ sc_the_the:
sc_trailing_blank:
@re='[ ]$$' \
ignore_case=1 msg='found trailing blank(s)' \
msg='found trailing blank(s)' \
$(_prohibit_regexp)
# Match lines like the following, but where there is only one space
@@ -424,9 +460,12 @@ sc_const_long_option:
echo 1>&2 '$(ME): add "const" to the above declarations'; \
exit 1; } || :
NEWS_hash = \
$$(sed -n '/^\*.* $(PREV_VERSION_REGEXP) ([0-9-]*)/,$$p' \
$(srcdir)/NEWS | grep -v '^Copyright .*Free Software' | md5sum -)
NEWS_hash = \
$$(sed -n '/^\*.* $(PREV_VERSION_REGEXP) ([0-9-]*)/,$$p' \
$(srcdir)/NEWS \
| grep -v '^Copyright .*Free Software' \
| md5sum - \
| sed 's/ .*//')
# Ensure that we don't accidentally insert an entry into an old NEWS block.
sc_immutable_NEWS:
@@ -500,6 +539,12 @@ changelog-check:
exit 1; \
fi
sc_makefile_TAB_only_indentation:
@grep -nE '^ [ ]{8}' \
$$($(VC_LIST_EXCEPT) | grep -E 'akefile|\.mk$$') \
&& { echo '$(ME): found TAB-8-space indentation' 1>&2; \
exit 1; } || :
sc_m4_quote_check:
@grep -nE '(AC_DEFINE(_UNQUOTED)?|AC_DEFUN)\([^[]' \
$$($(VC_LIST_EXCEPT) | grep -E '(^configure\.ac|\.m4)$$') \
@@ -538,20 +583,18 @@ sc_po_check:
# Sometimes it is useful to change the PATH environment variable
# in Makefiles. When doing so, it's better not to use the Unix-centric
# path separator of `:', but rather the automake-provided `@PATH_SEPARATOR@'.
# It'd be better to use `find -print0 ...|xargs -0 ...', but less portable,
# and there probably aren't many projects with so many Makefile.am files
# that we'd have to worry about limits on command line length.
msg = '$(ME): Do not use `:'\'' above; use @PATH_SEPARATOR@ instead'
# path separator of `:', but rather the automake-provided `$(PATH_SEPARATOR)'.
msg = '$(ME): Do not use `:'\'' above; use $$(PATH_SEPARATOR) instead'
sc_makefile_path_separator_check:
@grep -n 'PATH=.*:' `find $(srcdir) -name Makefile.am` \
@grep -nE 'PATH[=].*:' \
$$($(VC_LIST_EXCEPT) | grep -E 'akefile|\.mk$$') \
&& { echo $(msg) 1>&2; exit 1; } || :
# Check that `make alpha' will not fail at the end of the process.
writable-files:
if test -d $(release_archive_dir); then :; else \
for file in $(distdir).tar.gz \
$(release_archive_dir)/$(distdir).tar.gz; do \
$(release_archive_dir)/$(distdir).tar.gz; do \
test -e $$file || continue; \
test -w $$file \
|| { echo ERROR: $$file is not writable; fail=1; }; \
@@ -605,7 +648,7 @@ maintainer-distcheck:
# Don't make a distribution if checks fail.
# Also, make sure the NEWS file is up-to-date.
vc-dist: $(local-check) cvs-check maintainer-distcheck
$(MAKE) dist
XZ_OPT=-9ev $(MAKE) dist
# Use this to make sure we don't run these programs when building
# from a virgin tgz file, below.
@@ -701,10 +744,11 @@ define coreutils-path-check
esac; \
done \
&& ln -sf ../src/true $(bin)/false \
&& PATH=`pwd`/$(bin):$$PATH $(MAKE) -C tests check \
&& PATH=`pwd`/$(bin)$(PATH_SEPARATOR)$$PATH \
$(MAKE) -C tests check \
&& { test -d gnulib-tests \
&& $(MAKE) -C gnulib-tests check \
|| :; } \
&& $(MAKE) -C gnulib-tests check \
|| :; } \
&& rm -rf $(bin) \
&& fail=0; \
else \
@@ -775,6 +819,7 @@ announcement: NEWS ChangeLog $(rel-files)
--news=NEWS \
--bootstrap-tools=autoconf,automake,bison,gnulib \
--gnulib-version=$(gnulib-version) \
--no-print-checksums \
$(addprefix --url-dir=, $(url_dir_list))
## ---------------- ##
@@ -824,3 +869,13 @@ alpha beta major: $(local-check) writable-files
perl -pi -e '$$. == 3 and print "$(noteworthy)\n\n\n"' NEWS
$(emit-commit-log) > .ci-msg
$(VC) commit -F .ci-msg -a
.PHONY: web-manual
web-manual:
@test -z "$(manual_title)" \
&& { echo define manual_title in cfg.mk 1>&2; exit 1; } || :
@cd '$(srcdir)/doc'; \
$(SHELL) ../build-aux/gendocs.sh -o '$(abs_builddir)/doc/manual' \
--email $(PACKAGE_BUGREPORT) $(PACKAGE) \
"$(PACKAGE_NAME) - $(manual_title)"
@echo " *** Upload the doc/manual directory to web-cvs."

View File

@@ -156,13 +156,13 @@ mapped_name = `echo $*|sed 's/^install$$/ginstall/; s/^test$$/[/'`
*) \
rm -f $@ \
&& { echo "Updating man page $@"; \
rm -rf $t; \
mkdir $t; \
(cd $t && $(LN_S) ../../src/$(mapped_name) $*); \
$(PERL) -- $(srcdir)/help2man \
--source='$(PACKAGE_STRING)' \
--include=$(srcdir)/$*.x \
--output=$t/$@ $t/$*; \
rm -rf $t; \
mkdir $t; \
(cd $t && $(LN_S) ../../src/$(mapped_name) $*); \
$(PERL) -- $(srcdir)/help2man \
--source='$(PACKAGE_STRING)' \
--include=$(srcdir)/$*.x \
--output=$t/$@ $t/$*; \
} \
&& sed 's|$*\.td/||g' $t/$@ > $@ \
&& rm -rf $t ;; \

View File

@@ -1,5 +1,5 @@
[NAME]
truncate \- shrink or extend the size of a file to the specifed size
truncate \- shrink or extend the size of a file to the specified size
[DESCRIPTION]
.\" Add any additional description here
[SEE ALSO]

View File

@@ -405,7 +405,6 @@ sed_filter = s/^ *//;s/N_ (//;s/^"//;s/")*$$//
s1 = '/^\#define AUTHORS \([^\\]\)/{;s//\1/;$(sed_filter);p;q;}'
# Sometimes the string is on the backslash-continued line after the #define.
s2 = '/^\#define AUTHORS \\\\/{;n;$(sed_filter);p;q;}'
# FIXME: handle *.sh; and use $(all_programs), not $(SOURCES)
../AUTHORS: $(SOURCES)
rm -f $@-t
( \
@@ -449,6 +448,7 @@ sc_tight_scope: $(all_programs)
) | $(ASSORT) -u | sed 's/^/^/;s/$$/$$/' > $$t; \
nm -e *.$(OBJEXT) \
| sed -n 's/.* T //p' \
| sed 's/^_//' \
| grep -Ev -f $$t && \
{ echo 'the above functions should have static scope' 1>&2; \
exit 1; } || : ; \
@@ -457,6 +457,7 @@ sc_tight_scope: $(all_programs)
$$hdr *.h ) | $(ASSORT) -u > $$t; \
nm -e *.$(OBJEXT) \
| sed -n 's/.* [BD] //p' \
| sed 's/^_//' \
| grep -Ev -f $$t && \
{ echo 'the above variables should have static scope' 1>&2; \
exit 1; } || :

View File

@@ -1,5 +1,5 @@
/* cat -- concatenate files and print on the standard output.
Copyright (C) 88, 90, 91, 1995-2008 Free Software Foundation, Inc.
Copyright (C) 88, 90, 91, 1995-2009 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
@@ -48,10 +48,6 @@
proper_name_utf8 ("Torbjorn Granlund", "Torbj\303\266rn Granlund"), \
proper_name ("Richard M. Stallman")
/* Undefine, to avoid warning about redefinition on some systems. */
#undef max
#define max(h,i) ((h) > (i) ? (h) : (i))
/* Name of input file. May be "-". */
static char const *infile;
@@ -337,7 +333,7 @@ cat (
input_pending = true;
#endif
if (input_pending)
if (!input_pending)
write_pending (outbuf, &bpout);
/* Read more input into INBUF. */
@@ -640,7 +636,7 @@ main (int argc, char **argv)
if (fstat (STDOUT_FILENO, &stat_buf) < 0)
error (EXIT_FAILURE, errno, _("standard output"));
outsize = ST_BLKSIZE (stat_buf);
outsize = io_blksize (stat_buf);
/* Input file can be output file for non-regular files.
fstat on pipes returns S_IFSOCK on some systems, S_IFIFO
on others, so the checking should not be done for those types,
@@ -704,7 +700,7 @@ main (int argc, char **argv)
ok = false;
goto contin;
}
insize = ST_BLKSIZE (stat_buf);
insize = io_blksize (stat_buf);
/* Compare the device and i-node numbers of this input file with
the corresponding values of the (output file associated with)
@@ -726,7 +722,7 @@ main (int argc, char **argv)
if (! (number | show_ends | show_nonprinting
| show_tabs | squeeze_blank))
{
insize = max (insize, outsize);
insize = MAX (insize, outsize);
inbuf = xmalloc (insize + page_size - 1);
ok &= simple_cat (ptr_align (inbuf, page_size), insize);

View File

@@ -1,5 +1,5 @@
/* comm -- compare two sorted files line by line.
Copyright (C) 86, 90, 91, 1995-2005, 2008 Free Software Foundation, Inc.
Copyright (C) 86, 90, 91, 1995-2005, 2008-2009 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -25,6 +25,7 @@
#include "error.h"
#include "quote.h"
#include "stdio--.h"
#include "memcmp2.h"
#include "xmemcoll.h"
/* The official name of this program (e.g., no `g' prefix). */
@@ -199,10 +200,8 @@ check_order (struct linebuffer const *prev,
order = xmemcoll (prev->buffer, prev->length - 1,
current->buffer, current->length - 1);
else
{
size_t len = min (prev->length, current->length) - 1;
order = memcmp (prev->buffer, current->buffer, len);
}
order = memcmp2 (prev->buffer, prev->length - 1,
current->buffer, current->length - 1);
if (0 < order)
{

View File

@@ -104,6 +104,7 @@ static bool copy_internal (char const *src_name, char const *dst_name,
struct dir_list *ancestors,
const struct cp_options *x,
bool command_line_arg,
bool *first_dir_created_per_command_line_arg,
bool *copy_into_self,
bool *rename_succeeded);
static bool owner_failure_ok (struct cp_options const *x);
@@ -158,7 +159,7 @@ copy_attr_free (struct error_context *ctx ATTRIBUTE_UNUSED,
static bool
copy_attr_by_fd (char const *src_path, int src_fd,
char const *dst_path, int dst_fd)
char const *dst_path, int dst_fd, const struct cp_options *x)
{
struct error_context ctx =
{
@@ -166,11 +167,13 @@ copy_attr_by_fd (char const *src_path, int src_fd,
.quote = copy_attr_quote,
.quote_free = copy_attr_free
};
return 0 == attr_copy_fd (src_path, src_fd, dst_path, dst_fd, 0, &ctx);
return 0 == attr_copy_fd (src_path, src_fd, dst_path, dst_fd, 0,
x->reduce_diagnostics ? NULL : &ctx);
}
static bool
copy_attr_by_name (char const *src_path, char const *dst_path)
copy_attr_by_name (char const *src_path, char const *dst_path,
const struct cp_options *x)
{
struct error_context ctx =
{
@@ -178,19 +181,21 @@ copy_attr_by_name (char const *src_path, char const *dst_path)
.quote = copy_attr_quote,
.quote_free = copy_attr_free
};
return 0 == attr_copy_file (src_path, dst_path, 0, &ctx);
return 0 == attr_copy_file (src_path, dst_path, 0,
x-> reduce_diagnostics ? NULL :&ctx);
}
#else /* USE_XATTR */
static bool
copy_attr_by_fd (char const *src_path, int src_fd,
char const *dst_path, int dst_fd)
char const *dst_path, int dst_fd, const struct cp_options *x)
{
return true;
}
static bool
copy_attr_by_name (char const *src_path, char const *dst_path)
copy_attr_by_name (char const *src_path, char const *dst_path,
const struct cp_options *x)
{
return true;
}
@@ -201,13 +206,16 @@ copy_attr_by_name (char const *src_path, char const *dst_path)
DST_NAME_IN is a directory that was created previously in the
recursion. SRC_SB and ANCESTORS describe SRC_NAME_IN.
Set *COPY_INTO_SELF if SRC_NAME_IN is a parent of
FIRST_DIR_CREATED_PER_COMMAND_LINE_ARG FIXME
(or the same as) DST_NAME_IN; otherwise, clear it.
Return true if successful. */
static bool
copy_dir (char const *src_name_in, char const *dst_name_in, bool new_dst,
const struct stat *src_sb, struct dir_list *ancestors,
const struct cp_options *x, bool *copy_into_self)
const struct cp_options *x,
bool *first_dir_created_per_command_line_arg,
bool *copy_into_self)
{
char *name_space;
char *namep;
@@ -237,12 +245,19 @@ copy_dir (char const *src_name_in, char const *dst_name_in, bool new_dst,
ok &= copy_internal (src_name, dst_name, new_dst, src_sb->st_dev,
ancestors, &non_command_line_options, false,
first_dir_created_per_command_line_arg,
&local_copy_into_self, NULL);
*copy_into_self |= local_copy_into_self;
free (dst_name);
free (src_name);
/* If we're copying into self, there's no point in continuing,
and in fact, that would even infloop, now that we record only
the first created directory per command line argument. */
if (local_copy_into_self)
break;
namep += strlen (namep) + 1;
}
free (name_space);
@@ -557,7 +572,7 @@ copy_reg (char const *src_name, char const *dst_name,
/* Choose a suitable buffer size; it may be adjusted later. */
size_t buf_alignment = lcm (getpagesize (), sizeof (word));
size_t buf_alignment_slop = sizeof (word) + buf_alignment - 1;
size_t buf_size = ST_BLKSIZE (sb);
size_t buf_size = io_blksize (sb);
/* Deal with sparse files. */
bool last_write_made_hole = false;
@@ -585,21 +600,12 @@ copy_reg (char const *src_name, char const *dst_name,
buffer size. */
if (! make_holes)
{
/* These days there's no point ever messing with buffers smaller
than 8 KiB. It would be nice to configure SMALL_BUF_SIZE
dynamically for this host and pair of files, but there doesn't
seem to be a good way to get readahead info portably. */
enum { SMALL_BUF_SIZE = 8 * 1024 };
/* Compute the least common multiple of the input and output
buffer sizes, adjusting for outlandish values. */
size_t blcm_max = MIN (SIZE_MAX, SSIZE_MAX) - buf_alignment_slop;
size_t blcm = buffer_lcm (ST_BLKSIZE (src_open_sb), buf_size,
size_t blcm = buffer_lcm (io_blksize (src_open_sb), buf_size,
blcm_max);
/* Do not use a block size that is too small. */
buf_size = MAX (SMALL_BUF_SIZE, blcm);
/* Do not bother with a buffer larger than the input file, plus one
byte to make sure the file has not grown while reading it. */
if (S_ISREG (src_open_sb.st_mode) && src_open_sb.st_size < buf_size)
@@ -757,7 +763,7 @@ copy_reg (char const *src_name, char const *dst_name,
set_author (dst_name, dest_desc, src_sb);
if (x->preserve_xattr && ! copy_attr_by_fd (src_name, source_desc,
dst_name, dest_desc)
dst_name, dest_desc, x)
&& x->require_preserve_xattr)
return false;
@@ -1125,6 +1131,7 @@ restore_default_fscreatecon_or_die (void)
not known. ANCESTORS points to a linked, null terminated list of
devices and inodes of parent directories of SRC_NAME. COMMAND_LINE_ARG
is true iff SRC_NAME was specified on the command line.
FIRST_DIR_CREATED_PER_COMMAND_LINE_ARG is both input and output.
Set *COPY_INTO_SELF if SRC_NAME is a parent of (or the
same as) DST_NAME; otherwise, clear it.
Return true if successful. */
@@ -1135,6 +1142,7 @@ copy_internal (char const *src_name, char const *dst_name,
struct dir_list *ancestors,
const struct cp_options *x,
bool command_line_arg,
bool *first_dir_created_per_command_line_arg,
bool *copy_into_self,
bool *rename_succeeded)
{
@@ -1815,11 +1823,15 @@ copy_internal (char const *src_name, char const *dst_name,
}
}
/* Insert the created directory's inode and device
numbers into the search structure, so that we can
avoid copying it again. */
if (!x->hard_link)
remember_copied (dst_name, dst_sb.st_ino, dst_sb.st_dev);
/* Record the created directory's inode and device numbers into
the search structure, so that we can avoid copying it again.
Do this only for the first directory that is created for each
source command line argument. */
if (!*first_dir_created_per_command_line_arg)
{
remember_copied (dst_name, dst_sb.st_ino, dst_sb.st_dev);
*first_dir_created_per_command_line_arg = true;
}
if (x->verbose)
emit_verbose (src_name, dst_name, NULL);
@@ -1838,6 +1850,7 @@ copy_internal (char const *src_name, char const *dst_name,
in a source directory would cause the containing destination
directory not to have owner/perms set properly. */
delayed_ok = copy_dir (src_name, dst_name, new_dst, &src_sb, dir, x,
first_dir_created_per_command_line_arg,
copy_into_self);
}
}
@@ -2067,7 +2080,7 @@ copy_internal (char const *src_name, char const *dst_name,
set_author (dst_name, -1, &src_sb);
if (x->preserve_xattr && ! copy_attr_by_name (src_name, dst_name)
if (x->preserve_xattr && ! copy_attr_by_name (src_name, dst_name, x)
&& x->require_preserve_xattr)
return false;
@@ -2185,8 +2198,11 @@ copy (char const *src_name, char const *dst_name,
top_level_src_name = src_name;
top_level_dst_name = dst_name;
bool first_dir_created_per_command_line_arg = false;
return copy_internal (src_name, dst_name, nonexistent_dst, 0, NULL,
options, true, copy_into_self, rename_succeeded);
options, true,
&first_dir_created_per_command_line_arg,
copy_into_self, rename_succeeded);
}
/* Set *X to the default options for a value of type struct cp_options. */

View File

@@ -81,12 +81,6 @@ enum
UNLINK_DEST_BEFORE_OPENING
};
/* Initial number of entries in each hash table entry's table of inodes. */
#define INITIAL_HASH_MODULE 100
/* Initial number of entries in the inode hash table. */
#define INITIAL_ENTRY_TAB_SIZE 70
/* True if the kernel is SELinux enabled. */
static bool selinux_enabled;
@@ -931,6 +925,7 @@ main (int argc, char **argv)
x.require_preserve = true;
if (selinux_enabled)
x.preserve_security_context = true;
x.preserve_xattr = true;
x.reduce_diagnostics = true;
x.recursive = true;
break;

View File

@@ -1,5 +1,5 @@
/* csplit - split a file into sections determined by context lines
Copyright (C) 91, 1995-2008 Free Software Foundation, Inc.
Copyright (C) 91, 1995-2009 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
@@ -41,9 +41,6 @@
proper_name ("Stuart Kemp"), \
proper_name ("David MacKenzie")
/* Increment size of area for control records. */
#define ALLOC_SIZE 20
/* The default prefix for output file names. */
#define DEFAULT_PREFIX "xx"

View File

@@ -76,7 +76,6 @@ static void process_signals (void);
# define fdatasync(fd) (errno = ENOSYS, -1)
#endif
#define max(a, b) ((a) > (b) ? (a) : (b))
#define output_char(c) \
do \
{ \
@@ -266,23 +265,28 @@ static struct symbol_value const conversions[] =
enum
{
/* Use a value that is larger than that of any other O_ symbol. */
O_FULLBLOCK = ((MAX (O_APPEND,
MAX (O_BINARY,
MAX (O_CIO,
MAX (O_DIRECT,
MAX (O_DIRECTORY,
MAX (O_DSYNC,
MAX (O_NOATIME,
MAX (O_NOCTTY,
MAX (O_NOFOLLOW,
MAX (O_NOLINKS,
MAX (O_NONBLOCK,
MAX (O_SYNC,
MAX (O_TEXT, 0)))))))))))))) << 1)
/* Compute a value that's bitwise disjoint from the union
of all O_ values. */
v = ~(0
| O_APPEND
| O_BINARY
| O_CIO
| O_DIRECT
| O_DIRECTORY
| O_DSYNC
| O_NOATIME
| O_NOCTTY
| O_NOFOLLOW
| O_NOLINKS
| O_NONBLOCK
| O_SYNC
| O_TEXT
),
/* Use its lowest bit. */
O_FULLBLOCK = v ^ (v & (v - 1))
};
/* Ensure that we didn't shift it off the end. */
/* Ensure that we got something. */
verify (O_FULLBLOCK != 0);
#define MULTIPLE_BITS_SET(i) (((i) & ((i) - 1)) != 0)
@@ -669,7 +673,7 @@ cleanup (void)
_("closing output file %s"), quote (output_file));
}
static inline void ATTRIBUTE_NORETURN
static void ATTRIBUTE_NORETURN
quit (int code)
{
cleanup ();

View File

@@ -231,18 +231,28 @@ excluded_fstype (const char *fstype)
return false;
}
/* Return true if N is a known integer value. On many file systems,
UINTMAX_MAX represents an unknown value; on AIX, UINTMAX_MAX - 1
represents unknown. Use a rule that works on AIX file systems, and
that almost-always works on other types. */
static bool
known_value (uintmax_t n)
{
return n < UINTMAX_MAX - 1;
}
/* Like human_readable (N, BUF, human_output_opts, INPUT_UNITS, OUTPUT_UNITS),
except:
- If NEGATIVE, then N represents a negative number,
expressed in two's complement.
- Otherwise, return "-" if N is UINTMAX_MAX. */
- Otherwise, return "-" if N is unknown. */
static char const *
df_readable (bool negative, uintmax_t n, char *buf,
uintmax_t input_units, uintmax_t output_units)
{
if (n == UINTMAX_MAX && !negative)
if (! known_value (n) && !negative)
return "-";
else
{
@@ -393,8 +403,10 @@ show_dev (char const *disk, char const *mount_point,
negate_available = false;
available_to_root = available;
grand_fsu.fsu_files += total;
grand_fsu.fsu_ffree += available;
if (known_value (total))
grand_fsu.fsu_files += total;
if (known_value (available))
grand_fsu.fsu_ffree += available;
}
else
{
@@ -419,19 +431,22 @@ show_dev (char const *disk, char const *mount_point,
total = fsu.fsu_blocks;
available = fsu.fsu_bavail;
negate_available = (fsu.fsu_bavail_top_bit_set
& (available != UINTMAX_MAX));
& known_value (available));
available_to_root = fsu.fsu_bfree;
grand_fsu.fsu_blocks += input_units * total;
grand_fsu.fsu_bfree += input_units * available_to_root;
add_uint_with_neg_flag (&grand_fsu.fsu_bavail,
&grand_fsu.fsu_bavail_top_bit_set,
input_units * available, negate_available);
if (known_value (total))
grand_fsu.fsu_blocks += input_units * total;
if (known_value (available_to_root))
grand_fsu.fsu_bfree += input_units * available_to_root;
if (known_value (available))
add_uint_with_neg_flag (&grand_fsu.fsu_bavail,
&grand_fsu.fsu_bavail_top_bit_set,
input_units * available, negate_available);
}
used = UINTMAX_MAX;
negate_used = false;
if (total != UINTMAX_MAX && available_to_root != UINTMAX_MAX)
if (known_value (total) && known_value (available_to_root))
{
used = total - available_to_root;
negate_used = (total < available_to_root);
@@ -446,7 +461,7 @@ show_dev (char const *disk, char const *mount_point,
width, df_readable (negate_available, available,
buf[2], input_units, output_units));
if (used == UINTMAX_MAX || available == UINTMAX_MAX)
if (! known_value (used) || ! known_value (available))
;
else if (!negate_used
&& used <= TYPE_MAXIMUM (uintmax_t) / 100

View File

@@ -1,5 +1,5 @@
/* expand - convert tabs to spaces
Copyright (C) 89, 91, 1995-2006, 2008 Free Software Foundation, Inc.
Copyright (C) 89, 91, 1995-2006, 2008-2009 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
@@ -47,10 +47,6 @@
#define AUTHORS proper_name ("David MacKenzie")
/* The number of bytes added at a time to the amount of memory
allocated for the output line. */
#define OUTPUT_BLOCK 256
/* If true, convert blanks even after nonblank characters have been
read on the line. */
static bool convert_entire_line;

View File

@@ -1,5 +1,5 @@
/* factor -- print prime factors of n.
Copyright (C) 86, 1995-2005, 2007-2008 Free Software Foundation, Inc.
Copyright (C) 86, 1995-2005, 2007-2009 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -29,9 +29,7 @@
#include <gmp.h>
#endif
#include <assert.h>
#define NDEBUG 1
#include "system.h"
#include "error.h"

View File

@@ -71,15 +71,6 @@ static bool use_default_selinux_context = true;
# define matchpathcon_init_prefix(a, p) /* empty */
#endif
/* Initial number of entries in each hash table entry's table of inodes. */
#define INITIAL_HASH_MODULE 100
/* Initial number of entries in the inode hash table. */
#define INITIAL_ENTRY_TAB_SIZE 70
/* Number of bytes of a file to copy at a time. */
#define READ_SIZE (32 * 1024)
static bool change_timestamps (struct stat const *from_sb, char const *to);
static bool change_attributes (char const *name);
static bool copy_file (const char *from, const char *to,

View File

@@ -943,6 +943,7 @@ dev_ino_pop (void)
return *(struct dev_ino *) obstack_next_free (&dev_ino_obstack);
}
/* Note the use commented out below:
#define ASSERT_MATCHING_DEV_INO(Name, Di) \
do \
{ \
@@ -953,7 +954,7 @@ dev_ino_pop (void)
assert (sb.st_ino == Di.st_ino); \
} \
while (0)
*/
/* Write to standard output PREFIX, followed by the quoting style and
a space-separated list of the integers stored in OS all on one line. */
@@ -4007,7 +4008,7 @@ print_color_indicator (const char *name, mode_t mode, int linkok,
type = C_CAP;
else if ((mode & S_IXUGO) != 0)
type = C_EXEC;
else if (1 < nlink)
else if (is_colored (C_HARDLINK) && (1 < nlink))
type = C_HARDLINK;
}
else if (S_ISDIR (mode))

View File

@@ -41,12 +41,6 @@
proper_name ("David MacKenzie"), \
proper_name ("Jim Meyering")
/* Initial number of entries in each hash table entry's table of inodes. */
#define INITIAL_HASH_MODULE 100
/* Initial number of entries in the inode hash table. */
#define INITIAL_ENTRY_TAB_SIZE 70
/* For long options that have no equivalent short option, use a
non-character as a pseudo short option, starting with CHAR_MAX + 1. */
enum

View File

@@ -1,5 +1,5 @@
/* operand2sig.c -- common function for parsing signal specifications
Copyright (C) 2008 Free Software Foundation, Inc.
Copyright (C) 2008, 2009 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,7 +24,6 @@
#include <config.h>
#include <stdio.h>
#include <sys/types.h>
#include <signal.h>
#if HAVE_SYS_WAIT_H
# include <sys/wait.h>

View File

@@ -413,8 +413,6 @@ struct COLUMN
typedef struct COLUMN COLUMN;
#define NULLCOL (COLUMN *)0
static int char_to_clump (char c);
static bool read_line (COLUMN *p);
static bool print_page (void);
@@ -2404,8 +2402,10 @@ print_header (void)
lhs_spaces = available_width >> 1;
rhs_spaces = available_width - lhs_spaces;
printf ("\n\n%s%*s%s%*s%s\n\n\n",
date_text, lhs_spaces, " ", file_text, rhs_spaces, " ", page_text);
printf ("\n\n%*.*s%s%*.*s%s%*.*s%s\n\n\n",
chars_per_margin, chars_per_margin, " ",
date_text, lhs_spaces, lhs_spaces, " ",
file_text, rhs_spaces, rhs_spaces, " ", page_text);
print_a_header = false;
output_position = 0;

View File

@@ -1,5 +1,5 @@
/* prog-fprintf.h - common formating output functions and definitions
Copyright (C) 2008 Free Software Foundation, Inc.
Copyright (C) 2008-2009 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
@@ -19,6 +19,7 @@
# include <stdio.h>
extern void prog_fprintf (FILE *fp, char const *fmt, ...);
extern void prog_fprintf (FILE *fp, char const *fmt, ...)
__attribute__ ((__format__ (__printf__, 2, 3)));
#endif

View File

@@ -1,5 +1,5 @@
/* Permuted index for GNU, with keywords in their context.
Copyright (C) 1990, 1991, 1993, 1998-2008 Free Software Foundation, Inc.
Copyright (C) 1990, 1991, 1993, 1998-2009 Free Software Foundation, Inc.
François Pinard <pinard@iro.umontreal.ca>, 1988.
This program is free software: you can redistribute it and/or modify
@@ -65,9 +65,6 @@
the actual reallocation step, but its base two logarithm. */
#define SWALLOW_REALLOC_LOG 12
/* Imported from "regex.c". */
#define Sword 1
/* Program options. */
enum Format

View File

@@ -1,5 +1,5 @@
/* pwd - print current directory
Copyright (C) 1994-1997, 1999-2008 Free Software Foundation, Inc.
Copyright (C) 1994-1997, 1999-2009 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
@@ -21,7 +21,6 @@
#include "system.h"
#include "error.h"
#include "long-options.h"
#include "quote.h"
#include "root-dev-ino.h"
#include "xgetcwd.h"
@@ -38,6 +37,15 @@ struct file_name
char *start;
};
static struct option const longopts[] =
{
{"logical", no_argument, NULL, 'L'},
{"physical", no_argument, NULL, 'P'},
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
{NULL, 0, NULL, 0}
};
void
usage (int status)
{
@@ -46,10 +54,14 @@ usage (int status)
program_name);
else
{
printf (_("Usage: %s [OPTION]\n"), program_name);
printf (_("Usage: %s [OPTION]...\n"), program_name);
fputs (_("\
Print the full filename of the current working directory.\n\
\n\
"), stdout);
fputs (_("\
-L, --logical use PWD from environment, even if it contains symlinks\n\
-P, --physical avoid all symlinks\n\
"), stdout);
fputs (HELP_OPTION_DESCRIPTION, stdout);
fputs (VERSION_OPTION_DESCRIPTION, stdout);
@@ -279,10 +291,42 @@ robust_getcwd (struct file_name *file_name)
file_name_prepend (file_name, "", 0);
}
/* Return PWD from the environment if it is acceptable for 'pwd -L'
output, otherwise NULL. */
static char *
logical_getcwd (void)
{
struct stat st1;
struct stat st2;
char *wd = getenv ("PWD");
char *p;
/* Textual validation first. */
if (!wd || wd[0] != '/')
return NULL;
p = wd;
while ((p = strstr (p, "/.")))
{
if (!p[2] || p[2] == '/'
|| (p[2] == '.' && (!p[3] || p[3] == '/')))
return NULL;
p++;
}
/* System call validation. */
if (stat (wd, &st1) == 0 && stat (".", &st2) == 0 && SAME_INODE(st1, st2))
return wd;
return NULL;
}
int
main (int argc, char **argv)
{
char *wd;
/* POSIX requires a default of -L, but most scripts expect -P. */
bool logical = (getenv ("POSIXLY_CORRECT") != NULL);
initialize_main (&argc, &argv);
set_program_name (argv[0]);
@@ -292,14 +336,42 @@ main (int argc, char **argv)
atexit (close_stdout);
parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE_NAME, Version,
usage, AUTHORS, (char const *) NULL);
if (getopt_long (argc, argv, "", NULL, NULL) != -1)
usage (EXIT_FAILURE);
while (1)
{
int c = getopt_long (argc, argv, "LP", longopts, NULL);
if (c == -1)
break;
switch (c)
{
case 'L':
logical = true;
break;
case 'P':
logical = false;
break;
case_GETOPT_HELP_CHAR;
case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
default:
usage (EXIT_FAILURE);
}
}
if (optind < argc)
error (0, 0, _("ignoring non-option arguments"));
if (logical)
{
wd = logical_getcwd ();
if (wd)
{
puts (wd);
exit (EXIT_SUCCESS);
}
}
wd = xgetcwd ();
if (wd != NULL)
{

View File

@@ -732,10 +732,13 @@ exit_cleanup (void)
}
/* Create a new temporary file, returning its newly allocated tempnode.
Store into *PFD the file descriptor open for writing. */
Store into *PFD the file descriptor open for writing.
If the creation fails, return NULL and store -1 into *PFD if the
failure is due to file descriptor exhaustion and
SURVIVE_FD_EXHAUSTION; otherwise, die. */
static struct tempnode *
create_temp_file (int *pfd)
create_temp_file (int *pfd, bool survive_fd_exhaustion)
{
static char const slashbase[] = "/sortXXXXXX";
static size_t temp_dir_index;
@@ -768,8 +771,13 @@ create_temp_file (int *pfd)
errno = saved_errno;
if (fd < 0)
error (SORT_FAILURE, errno, _("cannot create temporary file in %s"),
quote (temp_dir));
{
if (! (survive_fd_exhaustion && errno == EMFILE))
error (SORT_FAILURE, errno, _("cannot create temporary file in %s"),
quote (temp_dir));
free (node);
node = NULL;
}
*pfd = fd;
return node;
@@ -779,27 +787,30 @@ create_temp_file (int *pfd)
standard output; HOW should be "w". When opening for input, "-"
means standard input. To avoid confusion, do not return file
descriptors STDIN_FILENO, STDOUT_FILENO, or STDERR_FILENO when
opening an ordinary FILE. */
opening an ordinary FILE. Return NULL if unsuccessful. */
static FILE *
stream_open (const char *file, const char *how)
{
if (!file)
return stdout;
if (STREQ (file, "-") && *how == 'r')
{
have_read_stdin = true;
return stdin;
}
return fopen (file, how);
}
/* Same as stream_open, except always return a non-null value; die on
failure. */
static FILE *
xfopen (const char *file, const char *how)
{
FILE *fp;
if (!file)
fp = stdout;
else if (STREQ (file, "-") && *how == 'r')
{
have_read_stdin = true;
fp = stdin;
}
else
{
fp = fopen (file, how);
if (! fp)
die (_("open failed"), file);
}
{
FILE *fp = stream_open (file, how);
if (!fp)
die (_("open failed"), file);
return fp;
}
@@ -838,7 +849,8 @@ dup2_or_die (int oldfd, int newfd)
/* Fork a child process for piping to and do common cleanup. The
TRIES parameter tells us how many times to try to fork before
giving up. Return the PID of the child or -1 if fork failed. */
giving up. Return the PID of the child, or -1 (setting errno)
on failure. */
static pid_t
pipe_fork (int pipefds[2], size_t tries)
@@ -881,8 +893,10 @@ pipe_fork (int pipefds[2], size_t tries)
if (pid < 0)
{
saved_errno = errno;
close (pipefds[0]);
close (pipefds[1]);
errno = saved_errno;
}
else if (pid == 0)
{
@@ -900,15 +914,22 @@ pipe_fork (int pipefds[2], size_t tries)
}
/* Create a temporary file and start a compression program to filter output
to that file. Set *PFP to the file handle and if *PPID is non-NULL,
set it to the PID of the newly-created process. */
to that file. Set *PFP to the file handle and if PPID is non-NULL,
set *PPID to the PID of the newly-created process. If the creation
fails, return NULL if the failure is due to file descriptor
exhaustion and SURVIVE_FD_EXHAUSTION; otherwise, die. */
static char *
create_temp (FILE **pfp, pid_t *ppid)
maybe_create_temp (FILE **pfp, pid_t *ppid, bool survive_fd_exhaustion)
{
int tempfd;
struct tempnode *node = create_temp_file (&tempfd);
char *name = node->name;
struct tempnode *node = create_temp_file (&tempfd, survive_fd_exhaustion);
char *name;
if (! node)
return NULL;
name = node->name;
if (compress_program)
{
@@ -949,48 +970,68 @@ create_temp (FILE **pfp, pid_t *ppid)
return name;
}
/* Create a temporary file and start a compression program to filter output
to that file. Set *PFP to the file handle and if *PPID is non-NULL,
set it to the PID of the newly-created process. Die on failure. */
static char *
create_temp (FILE **pfp, pid_t *ppid)
{
return maybe_create_temp (pfp, ppid, false);
}
/* Open a compressed temp file and start a decompression process through
which to filter the input. PID must be the valid processes ID of the
process used to compress the file. */
process used to compress the file. Return NULL (setting errno to
EMFILE) if we ran out of file descriptors, and die on any other
kind of failure. */
static FILE *
open_temp (const char *name, pid_t pid)
{
int tempfd, pipefds[2];
pid_t child_pid;
FILE *fp;
FILE *fp = NULL;
wait_proc (pid);
tempfd = open (name, O_RDONLY);
if (tempfd < 0)
die (_("couldn't open temporary file"), name);
return NULL;
child_pid = pipe_fork (pipefds, MAX_FORK_TRIES_DECOMPRESS);
if (0 < child_pid)
switch (pipe_fork (pipefds, MAX_FORK_TRIES_DECOMPRESS))
{
case -1:
if (errno != EMFILE)
error (SORT_FAILURE, errno, _("couldn't create process for %s -d"),
compress_program);
close (tempfd);
close (pipefds[1]);
}
else if (child_pid == 0)
{
errno = EMFILE;
break;
case 0:
close (pipefds[0]);
dup2_or_die (tempfd, STDIN_FILENO);
close (tempfd);
dup2_or_die (pipefds[1], STDOUT_FILENO);
close (pipefds[1]);
if (execlp (compress_program, compress_program, "-d", (char *) NULL) < 0)
error (SORT_FAILURE, errno, _("couldn't execute %s -d"),
compress_program);
}
else
error (SORT_FAILURE, errno, _("couldn't create process for %s -d"),
compress_program);
execlp (compress_program, compress_program, "-d", (char *) NULL);
error (SORT_FAILURE, errno, _("couldn't execute %s -d"),
compress_program);
fp = fdopen (pipefds[0], "r");
if (! fp)
die (_("couldn't create temporary file"), name);
default:
close (tempfd);
close (pipefds[1]);
fp = fdopen (pipefds[0], "r");
if (! fp)
{
int saved_errno = errno;
close (pipefds[0]);
errno = saved_errno;
}
break;
}
return fp;
}
@@ -1366,7 +1407,6 @@ begfield (const struct line *line, const struct keyfield *key)
char *ptr = line->text, *lim = ptr + line->length - 1;
size_t sword = key->sword;
size_t schar = key->schar;
size_t remaining_bytes;
/* The leading field separator itself is included in a field when -t
is absent. */
@@ -1388,16 +1428,14 @@ begfield (const struct line *line, const struct keyfield *key)
++ptr;
}
/* If we're ignoring leading blanks when computing the Start
of the field, skip past them here. */
if (key->skipsblanks)
while (ptr < lim && blanks[to_uchar (*ptr)])
++ptr;
/* Advance PTR by SCHAR (if possible), but no further than LIM. */
remaining_bytes = lim - ptr;
if (schar < remaining_bytes)
ptr += schar;
else
ptr = lim;
ptr = MIN (lim, ptr + schar);
return ptr;
}
@@ -1410,7 +1448,9 @@ limfield (const struct line *line, const struct keyfield *key)
{
char *ptr = line->text, *lim = ptr + line->length - 1;
size_t eword = key->eword, echar = key->echar;
size_t remaining_bytes;
if (echar == 0)
eword++; /* Skip all of end field. */
/* Move PTR past EWORD fields or to one past the last byte on LINE,
whichever comes first. If there are more than EWORD fields, leave
@@ -1487,19 +1527,17 @@ limfield (const struct line *line, const struct keyfield *key)
}
#endif
/* If we're ignoring leading blanks when computing the End
of the field, don't start counting bytes until after skipping
past any leading blanks. */
if (key->skipeblanks)
while (ptr < lim && blanks[to_uchar (*ptr)])
++ptr;
if (echar != 0) /* We need to skip over a portion of the end field. */
{
/* If we're ignoring leading blanks when computing the End
of the field, skip past them here. */
if (key->skipeblanks)
while (ptr < lim && blanks[to_uchar (*ptr)])
++ptr;
/* Advance PTR by ECHAR (if possible), but no further than LIM. */
remaining_bytes = lim - ptr;
if (echar < remaining_bytes)
ptr += echar;
else
ptr = lim;
/* Advance PTR by ECHAR (if possible), but no further than LIM. */
ptr = MIN (lim, ptr + echar);
}
return ptr;
}
@@ -2151,31 +2189,53 @@ check (char const *file_name, char checkonly)
return ordered;
}
/* Open FILES (there are NFILES of them) and store the resulting array
of stream pointers into (*PFPS). Allocate the array. Return the
number of successfully opened files, setting errno if this value is
less than NFILES. */
static size_t
open_input_files (struct sortfile *files, size_t nfiles, FILE ***pfps)
{
FILE **fps = *pfps = xnmalloc (nfiles, sizeof *fps);
int i;
/* Open as many input files as we can. */
for (i = 0; i < nfiles; i++)
{
fps[i] = (files[i].pid
? open_temp (files[i].name, files[i].pid)
: stream_open (files[i].name, "r"));
if (!fps[i])
break;
}
return i;
}
/* Merge lines from FILES onto OFP. NTEMPS is the number of temporary
files (all of which are at the start of the FILES array), and
NFILES is the number of files; 0 <= NTEMPS <= NFILES <= NMERGE.
Close input and output files before returning.
FPS is the vector of open stream corresponding to the files.
Close input and output streams before returning.
OUTPUT_FILE gives the name of the output file. If it is NULL,
the output file is standard output. If OFP is NULL, the output
file has not been opened yet (or written to, if standard output). */
the output file is standard output. */
static void
mergefps (struct sortfile *files, size_t ntemps, size_t nfiles,
FILE *ofp, char const *output_file)
FILE *ofp, char const *output_file, FILE **fps)
{
FILE **fps = xnmalloc (nmerge, sizeof *fps);
/* Input streams for each file. */
struct buffer *buffer = xnmalloc (nmerge, sizeof *buffer);
struct buffer *buffer = xnmalloc (nfiles, sizeof *buffer);
/* Input buffers for each file. */
struct line saved; /* Saved line storage for unique check. */
struct line const *savedline = NULL;
/* &saved if there is a saved line. */
size_t savealloc = 0; /* Size allocated for the saved line. */
struct line const **cur = xnmalloc (nmerge, sizeof *cur);
struct line const **cur = xnmalloc (nfiles, sizeof *cur);
/* Current line in each line table. */
struct line const **base = xnmalloc (nmerge, sizeof *base);
struct line const **base = xnmalloc (nfiles, sizeof *base);
/* Base of each line table. */
size_t *ord = xnmalloc (nmerge, sizeof *ord);
size_t *ord = xnmalloc (nfiles, sizeof *ord);
/* Table representing a permutation of fps,
such that cur[ord[0]] is the smallest line
and will be next output. */
@@ -2188,9 +2248,6 @@ mergefps (struct sortfile *files, size_t ntemps, size_t nfiles,
/* Read initial lines from each input file. */
for (i = 0; i < nfiles; )
{
fps[i] = (files[i].pid
? open_temp (files[i].name, files[i].pid)
: xfopen (files[i].name, "r"));
initbuf (&buffer[i], sizeof (struct line),
MAX (merge_buffer_size, sort_size / nfiles));
if (fillbuf (&buffer[i], fps[i], files[i].name))
@@ -2212,13 +2269,13 @@ mergefps (struct sortfile *files, size_t ntemps, size_t nfiles,
free (buffer[i].buf);
--nfiles;
for (j = i; j < nfiles; ++j)
files[j] = files[j + 1];
{
files[j] = files[j + 1];
fps[j] = fps[j + 1];
}
}
}
if (! ofp)
ofp = xfopen (output_file, "w");
/* Set up the ord table according to comparisons among input lines.
Since this only reorders two items if one is strictly greater than
the other, it is stable. */
@@ -2356,6 +2413,28 @@ mergefps (struct sortfile *files, size_t ntemps, size_t nfiles,
free(cur);
}
/* Merge lines from FILES onto OFP. NTEMPS is the number of temporary
files (all of which are at the start of the FILES array), and
NFILES is the number of files; 0 <= NTEMPS <= NFILES <= NMERGE.
Close input and output files before returning.
OUTPUT_FILE gives the name of the output file.
Return the number of files successfully merged. This number can be
less than NFILES if we ran low on file descriptors, but in this
case it is never less than 2. */
static size_t
mergefiles (struct sortfile *files, size_t ntemps, size_t nfiles,
FILE *ofp, char const *output_file)
{
FILE **fps;
size_t nopened = open_input_files (files, nfiles, &fps);
if (nopened < nfiles && nopened < 2)
die (_("open failed"), files[nopened].name);
mergefps (files, ntemps, nopened, ofp, output_file, fps);
return nopened;
}
/* Merge into T the two sorted arrays of lines LO (with NLO members)
and HI (with NHI members). T, LO, and HI point just past their
respective arrays, and the arrays are in reverse order. NLO and
@@ -2522,10 +2601,19 @@ avoid_trashing_input (struct sortfile *files, size_t ntemps,
FILE *tftp;
pid_t pid;
char *temp = create_temp (&tftp, &pid);
mergefps (&files[i],0, nfiles - i, tftp, temp);
files[i].name = temp;
files[i].pid = pid;
return i + 1;
size_t num_merged = 0;
while (i + num_merged < nfiles)
{
num_merged += mergefiles (&files[i], 0, nfiles - i, tftp, temp);
files[i].name = temp;
files[i].pid = pid;
memmove(&files[i], &files[i + num_merged],
num_merged * sizeof *files);
ntemps += 1;
nfiles -= num_merged - 1;;
i += num_merged;
}
}
}
@@ -2556,17 +2644,20 @@ merge (struct sortfile *files, size_t ntemps, size_t nfiles,
/* Number of easily-available slots at the next loop iteration. */
size_t cheap_slots;
/* Do as many NMERGE-size merges as possible. */
for (out = in = 0; out < nfiles / nmerge; out++, in += nmerge)
/* Do as many NMERGE-size merges as possible. In the case that
nmerge is bogus, increment by the maximum number of file
descriptors allowed. */
for (out = in = 0; nmerge <= nfiles - in; out++)
{
FILE *tfp;
pid_t pid;
char *temp = create_temp (&tfp, &pid);
size_t nt = MIN (ntemps, nmerge);
ntemps -= nt;
mergefps (&files[in], nt, nmerge, tfp, temp);
size_t num_merged = mergefiles (&files[in], MIN (ntemps, nmerge),
nmerge, tfp, temp);
ntemps -= MIN (ntemps, num_merged);
files[out].name = temp;
files[out].pid = pid;
in += num_merged;
}
remainder = nfiles - in;
@@ -2581,12 +2672,12 @@ merge (struct sortfile *files, size_t ntemps, size_t nfiles,
FILE *tfp;
pid_t pid;
char *temp = create_temp (&tfp, &pid);
size_t nt = MIN (ntemps, nshortmerge);
ntemps -= nt;
mergefps (&files[in], nt, nshortmerge, tfp, temp);
size_t num_merged = mergefiles (&files[in], MIN (ntemps, nshortmerge),
nshortmerge, tfp, temp);
ntemps -= MIN (ntemps, num_merged);
files[out].name = temp;
files[out++].pid = pid;
in += nshortmerge;
in += num_merged;
}
/* Put the remaining input files into the last NMERGE-sized output
@@ -2597,7 +2688,57 @@ merge (struct sortfile *files, size_t ntemps, size_t nfiles,
}
nfiles = avoid_trashing_input (files, ntemps, nfiles, output_file);
mergefps (files, ntemps, nfiles, NULL, output_file);
/* We aren't guaranteed that this final mergefiles will work, therefore we
try to merge into the output, and then merge as much as we can into a
temp file if we can't. Repeat. */
for (;;)
{
/* Merge directly into the output file if possible. */
FILE **fps;
size_t nopened = open_input_files (files, nfiles, &fps);
if (nopened == nfiles)
{
FILE *ofp = stream_open (output_file, "w");
if (ofp)
{
mergefps (files, ntemps, nfiles, ofp, output_file, fps);
break;
}
if (errno != EMFILE || nopened <= 2)
die (_("open failed"), output_file);
}
else if (nopened <= 2)
die (_("open failed"), files[nopened].name);
/* We ran out of file descriptors. Close one of the input
files, to gain a file descriptor. Then create a temporary
file with our spare file descriptor. Retry if that failed
(e.g., some other process could open a file between the time
we closed and tried to create). */
FILE *tfp;
pid_t pid;
char *temp;
do
{
nopened--;
xfclose (fps[nopened], files[nopened].name);
temp = maybe_create_temp (&tfp, &pid, ! (nopened <= 2));
}
while (!temp);
/* Merge into the newly allocated temporary. */
mergefps (&files[0], MIN (ntemps, nopened), nopened, tfp, temp, fps);
ntemps -= MIN (ntemps, nopened);
files[0].name = temp;
files[0].pid = pid;
memmove (&files[1], &files[nopened], (nfiles - nopened) * sizeof *files);
ntemps++;
nfiles -= nopened - 1;
}
}
/* Sort NFILES FILES onto OUTPUT_FILE. */
@@ -3152,12 +3293,9 @@ main (int argc, char **argv)
badfieldspec (optarg, N_("field number is zero"));
}
if (*s == '.')
s = parse_field_count (s + 1, &key->echar,
N_("invalid number after `.'"));
else
{
/* `-k 2,3' is equivalent to `+1 -3'. */
key->eword++;
s = parse_field_count (s + 1, &key->echar,
N_("invalid number after `.'"));
}
s = set_ordering (s, key, bl_end);
}

View File

@@ -554,7 +554,7 @@ main (int argc, char **argv)
if (fstat (STDIN_FILENO, &stat_buf) != 0)
error (EXIT_FAILURE, errno, "%s", infile);
in_blk_size = ST_BLKSIZE (stat_buf);
in_blk_size = io_blksize (stat_buf);
buf = ptr_align (xmalloc (in_blk_size + 1 + page_size - 1), page_size);

View File

@@ -147,6 +147,9 @@ enum
# define D_INO(dp) NOT_AN_INODE_NUMBER
#endif
/* include here for SIZE_MAX. */
#include <inttypes.h>
/* Get or fake the disk device blocksize.
Usually defined by sys/param.h (if at all). */
#if !defined DEV_BSIZE && defined BSIZE
@@ -228,8 +231,6 @@ enum
#include "timespec.h"
#include <inttypes.h>
#include <ctype.h>
#if ! (defined isblank || HAVE_DECL_ISBLANK)
@@ -627,14 +628,16 @@ emit_bug_reporting_address (void)
fputs (_("General help using GNU software: <http://www.gnu.org/gethelp/>\n"),
stdout);
/* TRANSLATORS: Replace LANG_CODE in this URL with your language code
<http://translationproject.org/team/LANG_CODE.html> to form one of
the URLs at http://translationproject.org/team/. Otherwise, replace
the entire URL with your translation team's email address. */
if (hard_locale (LC_MESSAGES))
printf (_("Report %s translation bugs to "
"<http://translationproject.org/team/>\n"),
last_component (program_name));
{
/* TRANSLATORS: Replace LANG_CODE in this URL with your language code
<http://translationproject.org/team/LANG_CODE.html> to form one of
the URLs at http://translationproject.org/team/. Otherwise, replace
the entire URL with your translation team's email address. */
printf (_("Report %s translation bugs to "
"<http://translationproject.org/team/>\n"),
last_component (program_name));
}
}
#include "inttostr.h"
@@ -653,4 +656,49 @@ bad_cast (char const *s)
return (char *) s;
}
void usage (int status);
/* As of Mar 2009, 32KiB is determined to be the minimium
blksize to best minimize system call overhead.
This can be tested with this script with the results
shown for a 1.7GHz pentium-m with 2GB of 400MHz DDR2 RAM:
for i in $(seq 0 10); do
size=$((8*1024**3)) #ensure this is big enough
bs=$((1024*2**$i))
printf "%7s=" $bs
dd bs=$bs if=/dev/zero of=/dev/null count=$(($size/$bs)) 2>&1 |
sed -n 's/.* \([0-9.]* [GM]B\/s\)/\1/p'
done
1024=734 MB/s
2048=1.3 GB/s
4096=2.4 GB/s
8192=3.5 GB/s
16384=3.9 GB/s
32768=5.2 GB/s
65536=5.3 GB/s
131072=5.5 GB/s
262144=5.7 GB/s
524288=5.7 GB/s
1048576=5.8 GB/s
Note that this is to minimize system call overhead.
Other values may be appropriate to minimize file system
or disk overhead. For example on my current linux system
the readahead setting is 128KiB which was read using:
file="."
device=$(df -P --local "$file" | tail -n1 | cut -d' ' -f1)
echo $(( $(blockdev --getra $device) * 512 ))
However there isn't a portable way to get the above.
In the future we could use the above method if available
and default to io_blksize() if not.
*/
enum { IO_BUFSIZE = 32*1024 };
static inline size_t
io_blksize (struct stat sb)
{
return MAX (IO_BUFSIZE, ST_BLKSIZE (sb));
}
void usage (int status) ATTRIBUTE_NORETURN;

View File

@@ -91,7 +91,7 @@ test_syntax_error (char const *format, char const *arg)
past the end of the argument list. This check is supressed if the
argument is false. */
static inline void
static void
advance (bool f)
{
++pos;
@@ -100,7 +100,7 @@ advance (bool f)
beyond ();
}
static inline void
static void
unary_advance (void)
{
advance (true);
@@ -567,9 +567,9 @@ test_unop (char const *op)
case 'u': case 'w': case 'x': case 'z':
case 'G': case 'L': case 'O': case 'S': case 'N':
return true;
default:
return false;
}
return false;
}
static bool

View File

@@ -1,5 +1,5 @@
/* unexpand - convert blanks to tabs
Copyright (C) 89, 91, 1995-2006, 2008 Free Software Foundation, Inc.
Copyright (C) 89, 91, 1995-2006, 2008-2009 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
@@ -48,10 +48,6 @@
#define AUTHORS proper_name ("David MacKenzie")
/* The number of bytes added at a time to the amount of memory
allocated for the output line. */
#define OUTPUT_BLOCK 256
/* If true, convert blanks even after nonblank characters have been
read on the line. */
static bool convert_entire_line;

View File

@@ -1,7 +1,7 @@
package CuTmpdir;
# create, then chdir into a temporary sub-directory
# Copyright (C) 2007-2008 Free Software Foundation, Inc.
# Copyright (C) 2007-2009 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
@@ -45,7 +45,11 @@ sub chmod_1
sub chmod_tree
{
if (defined $dir && chdir $dir)
# When tempdir fails, it croaks, which leaves $dir undefined.
defined $dir
or return;
if (chdir $dir)
{
# Perform the equivalent of find . -type d -print0|xargs -0 chmod -R 700.
my $options = {untaint => 1, wanted => \&chmod_1};

View File

@@ -15,7 +15,6 @@ EXTRA_DIST = \
other-fs-tmpdir \
require-perl \
sample-test \
setgid-check \
test-lib.sh \
$(pr_data)
@@ -142,6 +141,7 @@ TESTS = \
misc/join \
pr/pr-tests \
misc/df-P \
misc/pwd-option \
misc/pwd-unreadable-parent \
misc/chcon-fail \
misc/cut \
@@ -149,6 +149,7 @@ TESTS = \
misc/wc-files0-from \
misc/wc-files0 \
misc/cat-proc \
misc/cat-buf \
misc/base64 \
misc/basename \
misc/close-stdout \
@@ -200,8 +201,10 @@ TESTS = \
misc/shuf \
misc/sort \
misc/sort-compress \
misc/sort-continue \
misc/sort-files0-from \
misc/sort-merge \
misc/sort-merge-fdlimit \
misc/sort-rand \
misc/sort-version \
misc/split-a \

View File

@@ -1,5 +1,5 @@
# Include this file at the end of each tests/*/Makefile.am.
# Copyright (C) 2007, 2008 Free Software Foundation, Inc.
# Copyright (C) 2007-2009 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
@@ -52,6 +52,7 @@ TESTS_ENVIRONMENT = \
tmp__=$$TMPDIR; test -d "$$tmp__" || tmp__=.; \
. $(srcdir)/envvar-check; \
TMPDIR=$$tmp__; export TMPDIR; \
exec 9>&2; \
shell_or_perl_() { \
if grep '^\#!/usr/bin/perl' "$$1" > /dev/null; then \
if $(PERL) -e 'use warnings' > /dev/null 2>&1; then \

View File

@@ -28,7 +28,7 @@ file=f
touch $file || framework_failure
chmod 444 $file || framework_failure
. "$abs_srcdir/setgid-check"
skip_if_setgid_
fail=0

View File

@@ -28,7 +28,7 @@ fi
working_umask_or_skip_
# Run the setgid check from the just-created directory.
. "$abs_srcdir/setgid-check"
skip_if_setgid_
mkdir foo bar || framework_failure
mkdir -p a/b/c d e g || framework_failure

View File

@@ -1,7 +1,7 @@
#!/bin/sh
# Confirm that copying a directory into itself gets a proper diagnostic.
# Copyright (C) 2001, 2002, 2004, 2006-2008 Free Software Foundation, Inc.
# Copyright (C) 2001, 2002, 2004, 2006-2009 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,15 +28,32 @@ fi
. $srcdir/test-lib.sh
mkdir dir || framework_failure
mkdir a dir || framework_failure
fail=0
# This command should exit nonzero.
cp -R dir dir 2> out && fail=1
echo 1 >> out
# This should, too. However, with coreutils-7.1 it would infloop.
cp -rl dir dir 2>> out && fail=1
echo 2 >> out
cp -rl a dir dir 2>> out && fail=1
echo 3 >> out
cp -rl a dir dir 2>> out && fail=1
echo 4 >> out
cat > exp <<\EOF
cp: cannot copy a directory, `dir', into itself, `dir/dir'
1
cp: cannot copy a directory, `dir', into itself, `dir/dir'
2
cp: cannot copy a directory, `dir', into itself, `dir/dir'
3
cp: cannot copy a directory, `dir', into itself, `dir/dir'
4
EOF
#'

View File

@@ -1,7 +1,7 @@
#!/bin/sh
# test dd reblocking vs. bs=
# Copyright (C) 2008 Free Software Foundation, Inc.
# Copyright (C) 2008-2009 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
@@ -21,7 +21,6 @@ if test "$VERBOSE" = yes; then
dd --version
fi
. $srcdir/lang-default
. $srcdir/test-lib.sh
# 2 short reads -> 1 full write + 1 partial write

View File

@@ -69,10 +69,8 @@ compare err_ok err || fail=1
# skipping > OFF_T_MAX should fail immediately
dd bs=1 skip=$OFF_T_OFLOW count=0 status=noxfer < file 2> err && fail=1
echo "dd: \`standard input': cannot skip: Value too large for defined data type
0+0 records in
0+0 records out" > err_ok || framework_failure
compare err_ok err || fail=1
# error message should be "... cannot skip: strerror(EOVERFLOW)"
grep "cannot skip:" err >/dev/null || fail=1
# skipping > max file size should fail immediately
if ! truncate --size=$OFF_T_MAX in 2>/dev/null; then
@@ -80,8 +78,6 @@ if ! truncate --size=$OFF_T_MAX in 2>/dev/null; then
dd bs=1 skip=$OFF_T_MAX count=0 status=noxfer < file 2> err \
&& lseek_ok=yes \
|| lseek_ok=no
printf '%s\n' "dd: \`standard input': cannot skip: Invalid argument" \
'0+0 records in' '0+0 records out' > err_ok || framework_failure
if test $lseek_ok = yes; then
# On Solaris 10 at least, lseek(>max file size) succeeds,
@@ -89,7 +85,8 @@ if ! truncate --size=$OFF_T_MAX in 2>/dev/null; then
compare skip_err err || fail=1
else
# On Linux at least lseek(>max file size) fails.
compare err_ok err || fail=1
# error message should be "... cannot skip: strerror(EINVAL)"
grep "cannot skip:" err >/dev/null || fail=1
fi
fi

View File

@@ -1,7 +1,7 @@
#!/bin/sh
# Ensure "df --total" computes accurate totals
# Copyright (C) 2008 Free Software Foundation, Inc.
# Copyright (C) 2008-2009 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
@@ -62,7 +62,7 @@ df --total -i -P > inode || framework_failure
cat inode
fail=0
$PERL -f check-df space || fail=1
$PERL -f check-df inode || fail=1
$PERL check-df space || fail=1
$PERL check-df inode || fail=1
Exit $fail

View File

@@ -22,7 +22,7 @@ if test "$VERBOSE" = yes; then
fi
. $srcdir/test-lib.sh
. "$abs_srcdir/setgid-check"
skip_if_setgid_
mode1=0644
mode2=0755

View File

@@ -23,6 +23,7 @@ fi
. $srcdir/test-lib.sh
require_root_
skip_if_setgid_
u1=1
u2=2

View File

@@ -26,9 +26,10 @@ fi
long_name=zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz.foo
touch $long_name || framework_failure
e='\33'
color_code='0;31;42'
c_pre='\e[0m\e['"${color_code}m"
c_post='\e[0m\e[K\n\e[m'
c_pre="$e[0m$e[${color_code}m"
c_post="$e[0m$e[K\n$e[m"
printf "$c_pre$long_name$c_post" > exp || framework_failure
fail=0

View File

@@ -26,19 +26,35 @@ working_umask_or_skip_
touch file file1 || framework_failure
ln file1 file2 || skip_test_ "can't create hard link"
code='44;37'
code_hl='44;37'
code_png='01;35'
fail=0
# regular file - not hard linked
LS_COLORS="hl=$code" ls -U1 --color=always file > out || fail=1
LS_COLORS="hl=$code_hl" ls -U1 --color=always file > out || fail=1
printf "file\n" > out_ok || fail=1
compare out out_ok || fail=1
# hard links
LS_COLORS="hl=$code" ls -U1 --color=always file1 file2 > out || fail=1
LS_COLORS="hl=$code_hl" ls -U1 --color=always file1 file2 > out || fail=1
printf "\033[0m\033[44;37mfile1\033[0m
\033[44;37mfile2\033[0m
\033[m" > out_ok || fail=1
compare out out_ok || fail=1
# hard links and png
mv file2 file2.png || framework_failure
LS_COLORS="hl=$code_hl:*.png=$code_png" ls -U1 --color=always file1 file2.png > out || fail=1
printf "\033[0m\033[44;37mfile1\033[0m
\033[44;37mfile2.png\033[0m
\033[m" > out_ok || fail=1
compare out out_ok || fail=1
# hard links and png (hard links highlighting disabled)
LS_COLORS="hl=:*.png=$code_png" ls -U1 --color=always file1 file2.png > out || fail=1
printf "file1
\033[0m\033[01;35mfile2.png\033[0m
\033[m" > out_ok || fail=1
compare out out_ok || fail=1
Exit $fail

41
tests/misc/cat-buf Executable file
View File

@@ -0,0 +1,41 @@
#!/bin/sh
# Ensure that cat outputs processed data immediately.
# Copyright (C) 2009 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 3 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, see <http://www.gnu.org/licenses/>.
if test "$VERBOSE" = yes; then
set -x
cat --version
fi
. $srcdir/test-lib.sh
# Use a fifo rather than a pipe in the tests below
# so that the producer (cat) will wait until the
# consumer (dd) opens the fifo therefore increasing
# the chance that dd will read the data from each
# write separately.
mkfifo fifo || framework_failure
echo '1' > exp
dd count=1 if=fifo > out 2> err&
(echo '1'; sleep .2; echo '2') | cat -v > fifo
wait #for dd to complete
compare out exp || fail=1
Exit $fail

View File

@@ -2,7 +2,7 @@
# -*- perl -*-
# Test comm
# Copyright (C) 2008 Free Software Foundation, Inc.
# Copyright (C) 2008-2009 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
@@ -116,6 +116,13 @@ my @Tests =
{OUT => "\t\t2\n"},
{ERR => "$prog: file 1 is not in sorted order\n"}],
# out-of-order, line 2 is a prefix of line 1
# until coreutils-7.2, this test would fail -- no disorder detected
['ooo-prefix', '--check-order', {IN=>{a=>"Xa\nX\n"}}, {IN=>{b=>""}},
{EXIT=>1},
{OUT => "Xa\n"},
{ERR => "$prog: file 1 is not in sorted order\n"}],
# alternate delimiter: ','
['delim-comma', '--output-delimiter=,', @inputs,
{OUT=>"1\n,2\n,,3\n"} ],

View File

@@ -1,7 +1,7 @@
#!/bin/sh
# ensure groups handles -- sanely
# Copyright (C) 2007-2008 Free Software Foundation, Inc.
# Copyright (C) 2007-2009 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
@@ -22,13 +22,14 @@ if test "$VERBOSE" = yes; then
fi
. $srcdir/test-lib.sh
require_built_ groups
# Coreutils 6.9 and earlier failed to display information on first argument
# if later argument was --.
fail=0
groups none -- > out 2>&1
groups none -- > out 2>&1 && fail=1
echo $? >> out
groups -- none -- > exp 2>&1
groups -- none -- > exp 2>&1 && fail=1
echo $? >> exp
compare out exp || fail=1

View File

@@ -1,7 +1,7 @@
#!/bin/sh
# ensure groups --version output is similar to id --version
# Copyright (C) 2007-2008 Free Software Foundation, Inc.
# Copyright (C) 2007-2009 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
@@ -22,7 +22,7 @@ if test "$VERBOSE" = yes; then
fi
. $srcdir/test-lib.sh
require_built_ groups id
require_built_ groups
fail=0
groups --version | sed 's/^groups/id/; /^$/q' > out || fail=1

View File

@@ -1,6 +1,6 @@
#!/usr/bin/perl
# Copyright (C) 1998, 2000-2008 Free Software Foundation, Inc.
# Copyright (C) 1998, 2000-2009 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
@@ -64,12 +64,20 @@ sub setuid_setup()
. "so can't run this test\n"), exit 77;
}
sub mk_file(@)
{
foreach my $f (@_)
{
open (F, '>', $f) && close F
or die "creating $f: $!\n";
}
}
sub mkdir_d {mkdir 'd',0755 or die "d: $!\n"}
sub rmdir_d {rmdir 'd' or die "d: $!\n"}
my $mkdir = {PRE => sub {mkdir_d}};
my $rmdir = {POST => sub {rmdir_d}};
my $mkdir_reg = {PRE => sub {mkdir_d; open (FH, '>d/f') && close FH
or die "d/f: $!\n" }};
my $mkdir_reg = {PRE => sub {mkdir_d; mk_file 'd/f' }};
my $rmdir_reg = {POST => sub {unlink 'd/f' or die "d/f: $!\n";
rmdir 'd' or die "d: $!\n"}};
@@ -100,10 +108,12 @@ my $rmdir_d_slink = {POST => sub {unlink 'd/s' or die "d/s: $!\n";
sub make_j_d ()
{
mkdir 'j', 0700 or die "creating j: $!\n";
(open F, '>j/d') && close F or die "creating j/d: $!\n";
mk_file 'j/d';
chmod 0555, 'j/d' or die "making j/d executable: $!\n";
}
my @v1 = (qw(0 9 A Z a z), 'zz~', 'zz', 'zz.~1~', 'zz.0');
my @v_files = ((map { ".$_" } @v1), @v1);
my $exe_in_subdir = {PRE => sub { make_j_d (); push_ls_colors('ex=01;32') }};
my $remove_j = {POST => sub {unlink 'j/d' or die "j/d: $!\n";
rmdir 'j' or die "j: $!\n";
@@ -207,6 +217,13 @@ my @Tests =
# For 5.97 and earlier, --file-type acted like --indicator-style=slash.
['file-type', '--file-type d', {OUT => "s@\n"},
$mkdir_d_slink, $rmdir_d_slink],
# 7.1 had a regression in how -v -a ordered some files
['version-sort', '-v -A ' . join (' ', @v_files),
{OUT => join ("\n", @v_files) . "\n"},
{PRE => sub { mk_file @v_files }},
{POST => sub { unlink @v_files }},
],
);
# Start with an unset LS_COLORS environment variable.

67
tests/misc/pwd-option Executable file
View File

@@ -0,0 +1,67 @@
#!/bin/sh
# Ensure that pwd options work.
# Copyright (C) 2009 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 3 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, see <http://www.gnu.org/licenses/>.
if test "$VERBOSE" = yes; then
set -x
env -- pwd --version
fi
. $srcdir/test-lib.sh
mkdir -p a/b || framework_failure
ln -s a/b c || framework_failure
base=$(env -- pwd)
# Remove any logical paths from $PWD.
cd "$base" || framework_failure
test "x$PWD" = "x$base" || framework_failure
# Enter a logical directory.
cd c || framework_failure
test "x$PWD" = "x$base/c" || skip_test_ "cd does not properly update \$PWD"
fail=0
env -- pwd -L > out || fail=1
printf %s\\n "$base/c" > exp || fail=1
env -- pwd --logical -P >> out || fail=1
printf %s\\n "$base/a/b" >> exp || fail=1
env -- pwd --physical >> out || fail=1
printf %s\\n "$base/a/b" >> exp || fail=1
# By default, we use -P unless POSIXLY_CORRECT.
env -- pwd >> out || fail=1
printf %s\\n "$base/a/b" >> exp || fail=1
env -- POSIXLY_CORRECT=1 pwd >> out || fail=1
printf %s\\n "$base/c" >> exp || fail=1
# Make sure we reject bogus values, and silently fall back to -P.
env -- PWD="$PWD/." pwd -L >> out || fail=1
printf %s\\n "$base/a/b" >> exp || fail=1
env -- PWD=bogus pwd -L >> out || fail=1
printf %s\\n "$base/a/b" >> exp || fail=1
env -- PWD="$base/a/../c" pwd -L >> out || fail=1
printf %s\\n "$base/a/b" >> exp || fail=1
compare out exp || fail=1
Exit $fail

View File

@@ -3,7 +3,7 @@
# is unreadable. Perform this test only on systems with a usable getcwd
# function that has this capability.
# Copyright (C) 2007-2008 Free Software Foundation, Inc.
# Copyright (C) 2007-2009 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -32,7 +32,7 @@ test $host_os != linux-gnu &&
# Linux ia64 has the gl_FUNC_GETCWD_ABORT_BUG, so we can't use
# the system getcwd.
test $REPLACE_GETCWD = 1 &&
skip_test_ "can't use buggy system getcwd; skipping this test"
skip_test_ "can't use buggy system getcwd"
mkdir -p a/b || framework_failure
cd a/b || framework_failure

View File

@@ -24,6 +24,10 @@ my $prog = 'sort';
# Turn off localization of executable's output.
@ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3;
my $mb_locale = $ENV{LOCALE_FR_UTF8};
! defined $mb_locale || $mb_locale eq 'none'
and $mb_locale = 'C';
# Since each test is run with a file name and with redirected stdin,
# the name in the diagnostic is either the file name or "-".
# Normalize each diagnostic to use '-'.
@@ -110,6 +114,8 @@ my @Tests =
["07b", '-k 2,3', {IN=>"a a b\nz a a\n"}, {OUT=>"z a a\na a b\n"}],
["07c", '-k 2,3', {IN=>"y k b\nz k a\n"}, {OUT=>"z k a\ny k b\n"}],
["07d", '+1 -3', {IN=>"y k b\nz k a\n"}, {OUT=>"z k a\ny k b\n"}],
# ensure a character position of 0 includes whole field
["07e", '-k 2,3.0', {IN=>"a a b\nz a a\n"}, {OUT=>"z a a\na a b\n"}],
#
# report an error for `.' without following char spec
["08a", '-k 2.,3', {EXIT=>2},
@@ -210,6 +216,16 @@ my @Tests =
# key start and key end.
["18e", '-nb -k1.1,1.2', {IN=>" 901\n100\n"}, {OUT=>"100\n 901\n"}],
# When ignoring leading blanks for end position, ensure blanks from
# next field are not included in the sort. I.E. order should not change here.
["18f", '-k1,1b', {IN=>"a y\na z\n"}, {OUT=>"a y\na z\n"}],
# When ignoring leading blanks for start position, ensure blanks from
# next field are not included in the sort. I.E. order should not change here.
# This was noticed as an issue on fedora 8 (only in multibyte locales).
["18g", '-k1b,1', {IN=>"a y\na z\n"}, {OUT=>"a y\na z\n"},
{ENV => "LC_ALL=$mb_locale"}],
# This looks odd, but works properly -- 2nd keyspec is never
# used because all lines are different.
["19a", '+0 +1nr', {IN=>"b 2\nb 1\nb 3\n"}, {OUT=>"b 1\nb 2\nb 3\n"}],

51
tests/misc/sort-continue Executable file
View File

@@ -0,0 +1,51 @@
#!/bin/bash
# Tests for file descriptor exhaustion.
# Copyright (C) 2009 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 3 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, see <http://www.gnu.org/licenses/>.
if test "$VERBOSE" = yes; then
set -x
sort --version
fi
. $srcdir/test-lib.sh
# Skip the test when running under valgrind.
( ulimit -n 6; sort < /dev/null ) \
|| skip_test_ 'fd-limited sort failed; are you running under valgrind?'
for i in $(seq 31); do
echo $i | tee -a in > __test.$i || framework_failure
done
fail=0
(
ulimit -n 6
exec 0</dev/null 3<&- 4<&- 5<&-
sort -n -m __test.* > out
) &&
compare in out || { fail=1; echo 'file descriptor exhaustion not handled' 1>&2; }
echo 32 | tee -a in > in1
(
ulimit -n 6
exec 3<&- 4<&- 5<&-
sort -n -m __test.* - < in1 > out
) &&
compare in out || { fail=1; echo 'stdin not handled properly' 1>&2; }
Exit $fail

54
tests/misc/sort-merge-fdlimit Executable file
View File

@@ -0,0 +1,54 @@
#!/bin/sh
# Test whether sort avoids opening more file descriptors than it is
# allowed when merging files.
# Copyright (C) 2009 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 3 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, see <http://www.gnu.org/licenses/>.
if test "$VERBOSE" = yes; then
set -x
sort --version
fi
. $srcdir/test-lib.sh
require_ulimit_
mkdir in err || framework_failure
fail=0
for i in `seq 17`; do
echo $i >in/$i
done
# When these tests are run inside the automated testing framework, they
# have one less available file descriptor than when run outside the
# automated testing framework. If a test with a batch size of b fails
# inside the ATF, then the same test with batch size b+1 may pass outside
# the ATF but fail inside it.
# The default batch size (nmerge) is 16.
(ulimit -n 19 \
&& sort -m --batch-size=16 in/* 2>err/merge-default-err \
|| ! grep "open failed" err/merge-default-err) || fail=1
# If sort opens a file (/dev/urandom) to sort by random hashes of keys,
# it needs to consider this file against its limit on open file
# descriptors.
(ulimit -n 20 \
&& sort -mR --batch-size=16 in/* 2>err/merge-random-err \
|| ! grep "open failed" err/merge-random-err) || fail=1
Exit $fail

View File

@@ -24,9 +24,6 @@ fi
# Make sure there's a tty on stdin.
. $srcdir/test-lib.sh
require_controlling_input_terminal_
skip_test_ FIXME: skip, until portability of trap ... TTOU is assured
trap '' TTOU # Ignore SIGTTOU
# The following list of reversible options was generated with

View File

@@ -23,9 +23,6 @@ fi
. $srcdir/test-lib.sh
require_controlling_input_terminal_
skip_test_ FIXME: skip, until portability of trap ... TTOU is assured
trap '' TTOU # Ignore SIGTTOU
fail=0

View File

@@ -1,7 +1,7 @@
#! /bin/sh
# Test "stty" with rows and columns.
# Copyright (C) 1998-2001, 2003-2008 Free Software Foundation, Inc.
# Copyright (C) 1998-2001, 2003-2009 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
@@ -38,6 +38,7 @@ export LC_ALL
. $srcdir/test-lib.sh
require_controlling_input_terminal_
trap '' TTOU # Ignore SIGTTOU
# Versions of GNU stty from shellutils-1.9.2c and earlier failed
# tests #2 and #4 when run on SunOS 4.1.3.

View File

@@ -5,7 +5,7 @@
# open ("missing/", O_CREAT & (O_WRONLY | O_RDWR), ...) -> EISDIR
# open ("missing/file", O_CREAT & (O_WRONLY | O_RDWR), ...) -> ENOENT
# Copyright (C) 2008 Free Software Foundation, Inc.
# Copyright (C) 2008-2009 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -25,7 +25,6 @@ if test "$VERBOSE" = yes; then
truncate --version
fi
. $srcdir/lang-default
. $srcdir/test-lib.sh
skip_if_root_

View File

@@ -1,6 +1,7 @@
#!/bin/sh
# Ensure that cp --preserve=xattr and mv preserve extended attributes and
# install does not preserve extended attributes.
# Ensure that cp --preserve=xattr, cp --preserve=all and mv preserve extended
# attributes and install does not preserve extended attributes.
# cp -a should preserve xattr, error diagnostics should not be displayed
# Copyright (C) 2009 Free Software Foundation, Inc.
@@ -66,6 +67,16 @@ cp --preserve=xattr a b || fail=1
getfattr -d b >out_b || skip_test_ "failed to get xattr of file"
grep -F "$xattr_pair" out_b >/dev/null || fail=1
#test if --preserve=all option works
cp --preserve=all a c || fail=1
getfattr -d c >out_c || skip_test_ "failed to get xattr of file"
grep -F "$xattr_pair" out_c >/dev/null || fail=1
#test if -a option works without any diagnostics
cp -a a d 2>err && test -s err && fail=1
getfattr -d d >out_d || skip_test_ "failed to get xattr of file"
grep -F "$xattr_pair" out_d >/dev/null || fail=1
rm b || framework_failure
# install should never preserve xattr

View File

@@ -22,7 +22,7 @@ if test "$VERBOSE" = yes; then
fi
. $srcdir/test-lib.sh
. "$abs_srcdir/setgid-check"
skip_if_setgid_
mkdir -m 700 e-dir || framework_failure

View File

@@ -2,7 +2,7 @@
# Verify that mkdir's `-m MODE' option works properly
# with various umask settings.
# Copyright (C) 2000, 2002-2008 Free Software Foundation, Inc.
# Copyright (C) 2000, 2002-2009 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
@@ -23,7 +23,7 @@ if test "$VERBOSE" = yes; then
fi
. $srcdir/test-lib.sh
. "$abs_srcdir/setgid-check"
skip_if_setgid_
working_umask_or_skip_
@@ -72,11 +72,11 @@ for p in empty -p; do
mkdir $p $mode parent/sub || fail=1
perms=`ls -ld parent | sed 's/ .*//; s/+$//'`
perms=$(stat --printf %A parent)
test "$parent_perms" = "$perms" \
|| { fail=1; echo parent: expected $parent_perms, got $perms; }
perms=`ls -ld parent/sub | sed 's/ .*//; s/+$//'`
perms=$(stat --printf %A parent/sub)
test "$sub_perms" = "$perms" \
|| { fail=1; echo parent/sub: expected $sub_perms, got $perms; }

View File

@@ -1,7 +1,7 @@
#!/bin/sh
# ensure that an invalid context doesn't cause a segfault
# Copyright (C) 2008 Free Software Foundation, Inc.
# Copyright (C) 2008-2009 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,6 +44,7 @@ for cmd_w_arg in 'mkdir dir' 'mknod b p' 'mkfifo f'; do
# Some systems fail with ENOTSUP, EINVAL, ENOENT, or even
# "Unknown system error", or "Function not implemented".
# For AIX 5.3: "Unsupported attribute value"
# For HP-UX 11.23: Unknown error (252)
sed \
-e 's/ Not supported$//' \
-e 's/ Invalid argument$//' \
@@ -51,6 +52,7 @@ for cmd_w_arg in 'mkdir dir' 'mknod b p' 'mkfifo f'; do
-e 's/ Operation not supported$//' \
-e 's/ Function not implemented$//' \
-e 's/ Unsupported attribute value$//' \
-e 's/ Unknown error .*$//' \
-e 's/ No such file or directory$//' out > k || fail=1
mv k out || fail=1
compare out exp || fail=1

View File

@@ -25,9 +25,6 @@ fi
. $srcdir/test-lib.sh
require_controlling_input_terminal_
skip_if_root_
skip_test_ FIXME: skip, until portability of trap ... TTIN is assured
trap '' TTIN # Ignore SIGTTIN
touch f g h i || framework_failure

View File

@@ -4,7 +4,8 @@
# of the current directory. If one is found, create a temporary directory
# inside it.
# Copyright (C) 1998, 1999, 2001, 2002, 2005, 2007-2008 Free Software Foundation, Inc.
# Copyright (C) 1998, 1999, 2001, 2002, 2005, 2007-2009
# 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
@@ -20,7 +21,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
test "${CANDIDATE_TMP_DIRS+set}" = set \
|| CANDIDATE_TMP_DIRS="$TMPDIR /tmp /var/tmp /usr/tmp $HOME"
|| CANDIDATE_TMP_DIRS="$TMPDIR /tmp /dev/shm /var/tmp /usr/tmp $HOME"
other_partition_tmpdir=
@@ -45,13 +46,11 @@ done
if test -z "$other_partition_tmpdir"; then
skip_test_ \
"**************************************
This test requires a writable directory on a different
disk partition, and I couldn't find one. I tried these:
"requires a writable directory on a different disk partition,
and I couldn't find one. I tried these:
$CANDIDATE_TMP_DIRS
Set your environment variable CANDIDATE_TMP_DIRS to make
this test use a different list.
**************************************"
this test use a different list."
fi
test "$VERBOSE" = yes && set -x

View File

@@ -1,6 +1,6 @@
-- Date/Time -- x Page 1
-- Date/Time --xPage 1
1<<< -Test: FF's in
@@ -19,13 +19,13 @@
14<<< 123456789 123
-- Date/Time -- x Page 2
-- Date/Time --xPage 2
-- Date/Time -- x Page 3
-- Date/Time --xPage 3
15<<< xyzxyzxyz XYZ
@@ -44,13 +44,13 @@
28<<< trunc
-- Date/Time -- x Page 4
-- Date/Time --xPage 4
-- Date/Time -- x Page 5
-- Date/Time --xPage 5
29<<<xyzxyzxyz XYZXY
@@ -69,19 +69,19 @@
42<<< 123456789 abc
-- Date/Time -- x Page 6
-- Date/Time --xPage 6
-- Date/Time -- x Page 7
-- Date/Time --xPage 7
-- Date/Time -- x Page 8
-- Date/Time --xPage 8
43<<< xyzxyzxyz XYZ
@@ -100,7 +100,7 @@
56<<< 123456789 abc
-- Date/Time -- x Page 9
-- Date/Time --xPage 9
57<<< xyzxyzxyz XYZ

View File

@@ -1,6 +1,6 @@
-- Date/Time -- x Page 1
-- Date/Time -- x Page 1
1<<< -Test: FF's in Text >>> 1::: Test-INPUT: "Without FF set by Hand" :::
@@ -19,7 +19,7 @@
14<<< 123456789 123456789 123456789 >>> 14::: 89 123456789 123456789 123456789 123456789 123456789 123456789 1234567890 :::
-- Date/Time -- x Page 2
-- Date/Time -- x Page 2
15::: xyzxyzxyz XYZXYZXYZ abcabcab :::
@@ -38,7 +38,7 @@
28::: 89 123456789 123456789 123456789 123456789 123456789 123456789 1234567890 :::
-- Date/Time -- x Page 3
-- Date/Time -- x Page 3
15<<< xyzxyzxyz XYZXYZXYZ abcabcab >>> 29::: xyzxyzxyz XYZXYZXYZ abcabcab :::
@@ -57,7 +57,7 @@
28<<< trunc 42::: 89 123456789 123456789 123456789 123456789 123456789 123456789 1234567890 :::
-- Date/Time -- x Page 4
-- Date/Time -- x Page 4
43::: xyzxyzxyz XYZXYZXYZ abcabcab :::
@@ -76,7 +76,7 @@
56::: 89 123456789 123456789 123456789 123456789 123456789 123456789 1234567890 :::
-- Date/Time -- x Page 5
-- Date/Time -- x Page 5
29<<<xyzxyzxyz XYZXYZXYZ abcabcab >>> 57::: xyzxyzxyz XYZXYZXYZ abcabcab :::
@@ -95,19 +95,19 @@
42<<< 123456789 abcdefghi ABCDEDFHI >>>
-- Date/Time -- x Page 6
-- Date/Time -- x Page 6
-- Date/Time -- x Page 7
-- Date/Time -- x Page 7
-- Date/Time -- x Page 8
-- Date/Time -- x Page 8
43<<< xyzxyzxyz XYZXYZXYZ abcabcab >>>
@@ -126,7 +126,7 @@
56<<< 123456789 abcdefghi ABCDEDFHI >>>
-- Date/Time -- x Page 9
-- Date/Time -- x Page 9
57<<< xyzxyzxyz XYZXYZXYZ abcabcab >>>

View File

@@ -1,6 +1,6 @@
-- Date/Time -- x Page 1
-- Date/Time -- x Page 1
1 Test-INPUT: "With:--:2 Options -b -3 [+2:--:3 Options -a -3 [+2
@@ -19,7 +19,7 @@
40 DEFGHI 123456789 :--:41 yzxyzxyz XYZXYZXYZ:--:42 456789 123456789 a
-- Date/Time -- x Page 2
-- Date/Time -- x Page 2
43 xyzxyzxyz XYZXYZXY:--:44 456789 123456789 x:--:5

View File

@@ -1,6 +1,6 @@
-- Date/Time -- x Page 1
-- Date/Time -- x Page 1
1.1 Test-INPUT::--: 2.2 Options -b :--: 3.3 Options -a
@@ -19,7 +19,7 @@
40.40 DEFGHI 12345:--: 41.41 yzxyzxyz XYZ:--: 42.42 456789 12345
-- Date/Time -- x Page 2
-- Date/Time -- x Page 2
43.43 xyzxyzxyz XY:--: 44.44 456789 12345:--: 45.5

View File

@@ -1,6 +1,6 @@
-- Date/Time -- x Page 1
-- Date/Time -- x Page 1
1 Test-INPUT: "Withou 2 Options -b -3 [+2|+ 3 Options -a -3 [+2|+
@@ -19,7 +19,7 @@
40 DEFGHI 123456789 41 yzxyzxyz XYZXYZXYZ a 42 456789 123456789 abc
-- Date/Time -- x Page 2
-- Date/Time -- x Page 2
43 xyzxyzxyz XYZXYZXYZ 44 456789 123456789 xyz 5

View File

@@ -1,6 +1,6 @@
-- Date/Time -- x Page 1
-- Date/Time -- x Page 1
1 Test-INPUT: "With:--:15 xyzxyzxyz XYZXYZXY:--:29 xyzxyzxyz XYZXYZXY
@@ -19,7 +19,7 @@
14 456789 123456789 1:--:28 no trunc :--:42 456789 123456789 a
-- Date/Time -- x Page 2
-- Date/Time -- x Page 2
43 xyzxyzxyz XYZXYZXY:--:50 :--:57 xyzxyzxyz XYZXYZXY

View File

@@ -1,6 +1,6 @@
-- Date/Time -- x Page 1
-- Date/Time -- x Page 1
1.1 Test-INPUT::--: 15.15 xyzxyzxyz XY:--: 29.29 xyzxyzxyz XY
@@ -19,7 +19,7 @@
14.14 456789 12345:--: 28.28 no trunc :--: 42.42 456789 12345
-- Date/Time -- x Page 2
-- Date/Time -- x Page 2
43.43 xyzxyzxyz XY:--: 50.50 :--: 57.57 xyzxyzxyz XY

View File

@@ -1,6 +1,6 @@
-- Date/Time -- x Page 1
-- Date/Time -- x Page 1
1 Test-INPUT: "Withou 15 xyzxyzxyz XYZXYZXYZ 29 xyzxyzxyz XYZXYZXYZ
@@ -19,7 +19,7 @@
14 456789 123456789 123 28 no trunc 42 456789 123456789 abc
-- Date/Time -- x Page 2
-- Date/Time -- x Page 2
43 xyzxyzxyz XYZXYZXYZ 50 57 xyzxyzxyz XYZXYZXYZ

View File

@@ -1,6 +1,6 @@
-- Date/Time -- x Page 1
-- Date/Time -- x Page 1
1 FF-Test: FF's in Text :--:1 Test-INPUT: "Without FF set by
@@ -19,7 +19,7 @@
14 456789 123456789 123456789 1234:--:14 456789 123456789 123456789 1234
-- Date/Time -- x Page 2
-- Date/Time -- x Page 2
:--:15 xyzxyzxyz XYZXYZXYZ abcabcab
@@ -38,7 +38,7 @@
:--:28 no trunc
-- Date/Time -- x Page 3
-- Date/Time -- x Page 3
15 xyzxyzxyz XYZXYZXYZ abcabcab :--:29 xyzxyzxyz XYZXYZXYZ abcabcab
@@ -57,7 +57,7 @@
:--:42 456789 123456789 abcdefghi ABCD
-- Date/Time -- x Page 4
-- Date/Time -- x Page 4
:--:43 xyzxyzxyz XYZXYZXYZ abcabcab
@@ -76,7 +76,7 @@
:--:56 456789 123456789 abcdefghi ABCD
-- Date/Time -- x Page 5
-- Date/Time -- x Page 5
29 xyzxyzxyz XYZXYZXYZ abcabcab :--:57 xyzxyzxyz XYZXYZXYZ abcabcab
@@ -95,19 +95,19 @@
42 456789 123456789 abcdefghi ABCD
-- Date/Time -- x Page 6
-- Date/Time -- x Page 6
-- Date/Time -- x Page 7
-- Date/Time -- x Page 7
-- Date/Time -- x Page 8
-- Date/Time -- x Page 8
43 xyzxyzxyz XYZXYZXYZ abcabcab :--:
@@ -126,7 +126,7 @@
56 456789 123456789 abcdefghi ABCD
-- Date/Time -- x Page 9
-- Date/Time -- x Page 9
:--:
@@ -145,7 +145,7 @@
70 456789 123456789 abcdefghi ABC:--:
-- Date/Time -- x Page 10
-- Date/Time -- x Page 10
1 :--:

View File

@@ -1,6 +1,6 @@
-- Date/Time -- x Page 1
-- Date/Time -- x Page 1
1.1 FF-Test: FF's in Text :--:1 Test-INPUT: "Without FF set
@@ -19,7 +19,7 @@
14.14 456789 123456789 123456789 1:--:14 456789 123456789 123456789 1
-- Date/Time -- x Page 2
-- Date/Time -- x Page 2
15. :--:15 xyzxyzxyz XYZXYZXYZ abcabcab
@@ -38,7 +38,7 @@
28. :--:28 no trunc
-- Date/Time -- x Page 3
-- Date/Time -- x Page 3
29.15 xyzxyzxyz XYZXYZXYZ abcabcab:--:29 xyzxyzxyz XYZXYZXYZ abcabcab
@@ -57,7 +57,7 @@
42. :--:42 456789 123456789 abcdefghi A
-- Date/Time -- x Page 4
-- Date/Time -- x Page 4
43. :--:43 xyzxyzxyz XYZXYZXYZ abcabcab
@@ -76,7 +76,7 @@
56. :--:56 456789 123456789 abcdefghi A
-- Date/Time -- x Page 5
-- Date/Time -- x Page 5
57.29 xyzxyzxyz XYZXYZXYZ abcabcab:--:57 xyzxyzxyz XYZXYZXYZ abcabcab
@@ -95,19 +95,19 @@
70.42 456789 123456789 abcdefghi A
-- Date/Time -- x Page 6
-- Date/Time -- x Page 6
-- Date/Time -- x Page 7
-- Date/Time -- x Page 7
-- Date/Time -- x Page 8
-- Date/Time -- x Page 8
71.43 xyzxyzxyz XYZXYZXYZ abcabcab:--:
@@ -126,7 +126,7 @@
84.56 456789 123456789 abcdefghi A
-- Date/Time -- x Page 9
-- Date/Time -- x Page 9
85. :--:
@@ -145,7 +145,7 @@
98.70 456789 123456789 abcdefghi :--:
-- Date/Time -- x Page 10
-- Date/Time -- x Page 10
99.1 :--:

View File

@@ -1,6 +1,6 @@
-- Date/Time -- x Page 1
-- Date/Time -- x Page 1
1 FF-Test: FF's in Text 1 Test-INPUT: "Without FF set by
@@ -19,7 +19,7 @@
14 456789 123456789 123456789 12345 14 456789 123456789 123456789 12345
-- Date/Time -- x Page 2
-- Date/Time -- x Page 2
15 xyzxyzxyz XYZXYZXYZ abcabcab
@@ -38,7 +38,7 @@
28 no trunc
-- Date/Time -- x Page 3
-- Date/Time -- x Page 3
15 xyzxyzxyz XYZXYZXYZ abcabcab 29 xyzxyzxyz XYZXYZXYZ abcabcab
@@ -57,7 +57,7 @@
42 456789 123456789 abcdefghi ABCDE
-- Date/Time -- x Page 4
-- Date/Time -- x Page 4
43 xyzxyzxyz XYZXYZXYZ abcabcab
@@ -76,7 +76,7 @@
56 456789 123456789 abcdefghi ABCDE
-- Date/Time -- x Page 5
-- Date/Time -- x Page 5
29 xyzxyzxyz XYZXYZXYZ abcabcab 57 xyzxyzxyz XYZXYZXYZ abcabcab
@@ -95,19 +95,19 @@
42 456789 123456789 abcdefghi ABCDE
-- Date/Time -- x Page 6
-- Date/Time -- x Page 6
-- Date/Time -- x Page 7
-- Date/Time -- x Page 7
-- Date/Time -- x Page 8
-- Date/Time -- x Page 8
43 xyzxyzxyz XYZXYZXYZ abcabcab
@@ -126,7 +126,7 @@
56 456789 123456789 abcdefghi ABCDE
-- Date/Time -- x Page 9
-- Date/Time -- x Page 9
@@ -145,7 +145,7 @@
70 456789 123456789 abcdefghi ABCD
-- Date/Time -- x Page 10
-- Date/Time -- x Page 10
1

View File

@@ -1,7 +1,7 @@
#!/bin/sh
# ensure that "rm -rf DIR-with-many-entries" is not O(N^2)
# Copyright (C) 2008 Free Software Foundation, Inc.
# Copyright (C) 2008-2009 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
@@ -23,7 +23,7 @@ fi
. $srcdir/test-lib.sh
expensive_
very_expensive_
# Using rm -rf to remove a 400k-entry directory takes:
# - 9 seconds with the patch, on a 2-yr-old system
@@ -67,6 +67,11 @@ test $ok = 1 || framework_failure
setup_duration=$(expr $(date +%s) - $start)
echo creating a $n-entry directory took $setup_duration seconds
# If set-up took longer than the default $threshold_seconds,
# use the longer set-up duration as the limit.
test $threshold_seconds -lt $setup_duration \
&& threshold_seconds=$setup_duration
fail=0
start=$(date +%s)
timeout ${threshold_seconds}s rm -rf d; err=$?

View File

@@ -21,7 +21,6 @@ if test "$VERBOSE" = yes; then
FIXME --version
fi
# FIXME: . $srcdir/lang-default
. $srcdir/test-lib.sh
# FIXME: skip_if_root_
# FIXME: require_root_

View File

@@ -1,37 +0,0 @@
# -*- sh -*-
# Disable the current test if the working directory seems to have
# the setgid bit set.
# Copyright (C) 2000, 2002, 2004, 2005, 2007 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 3 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, see <http://www.gnu.org/licenses/>.
# This test should be run in the temporary directory that ends
# up being removed via the trap commands.
cwd_is_setgid=no
setgid_tmpdir=setgid-$$
(umask 77; mkdir $setgid_tmpdir)
p=`ls -ld $setgid_tmpdir|sed 's/ .*//'`
rmdir $setgid_tmpdir
case $p in
drwx------);;
drwx------+);;
drwxr-xr-x);; # Windows98 + DJGPP 2.03 + fileutils-4.1 does this.
*) cwd_is_setgid=yes;;
esac
if test $cwd_is_setgid = yes; then
skip_test_ 'this directory has the setgid bit set'
fi

View File

@@ -1,48 +0,0 @@
# Copyright (C) 1997 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 3 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, see <http://www.gnu.org/licenses/>.
N = 1000000
dot30 = ..............................
dot31 = $(dot30).
safe_redirect_prologue = rm -f $@ $@-tmp
safe_redirect = $@-tmp && mv $@-tmp $@
time = /p/bin/time --verbose
all: t30 t31
t3%: in-3%
@$(safe_redirect_prologue)
$(time) sort $< > $(safe_redirect)
rand-digits: rand-gen
@$(safe_redirect_prologue)
./$< --integer $(N) |tr -d '\012' > $(safe_redirect)
in-30: rand-digits
@$(safe_redirect_prologue)
perl -pe 's/($(dot30))/$$1\n/g' $< > $(safe_redirect)
in-31: rand-digits
@$(safe_redirect_prologue)
perl -pe 's/($(dot31))/$$1\n/g' $< > $(safe_redirect)
clean:
rm -f t30 t31 in-30 in-31
realclean: clean
rm -f rand-digits

View File

@@ -25,6 +25,7 @@ fi
skip_test_()
{
echo "$0: skipping test: $@" | head -1 1>&9
echo "$0: skipping test: $@" 1>&2
Exit 77
}
@@ -85,9 +86,10 @@ require_controlling_input_terminal_()
tty -s || have_input_tty=no
test -t 0 || have_input_tty=no
if test "$have_input_tty" = no; then
skip_test_ "This test must have a controlling input \`terminal'," \
"so it may not be run via \`batch', \`at', or \`rsh'." \
"On some systems, it may not even be run in the background."
skip_test_ 'requires controlling input terminal
This test must have a controlling input "terminal", so it may not be
run via "batch", "at", or "ssh". On some systems, it may not even be
run in the background.'
fi
}
@@ -134,7 +136,7 @@ rwx_to_mode_()
case $rwx in
[ld-][rwx-][rwx-][rwxsS-][rwx-][rwx-][rwxsS-][rwx-][rwx-][rwxtT-]) ;;
[ld-][rwx-][rwx-][rwxsS-][rwx-][rwx-][rwxsS-][rwx-][rwx-][rwxtT-]+) ;;
[ld-][rwx-][rwx-][rwxsS-][rwx-][rwx-][rwxsS-][rwx-][rwx-][rwxtT-][+.]) ;;
*) echo "$0: invalid mode string: $rwx" 1>&2; return;;
esac
@@ -175,7 +177,7 @@ require_selinux_()
very_expensive_()
{
if test "$RUN_VERY_EXPENSIVE_TESTS" != yes; then
skip_test_ '
skip_test_ 'very expensive: disabled by default
This test is very expensive, so it is disabled by default.
To run it anyway, rerun make check with the RUN_VERY_EXPENSIVE_TESTS
environment variable set to yes. E.g.,
@@ -188,7 +190,7 @@ environment variable set to yes. E.g.,
expensive_()
{
if test "$RUN_EXPENSIVE_TESTS" != yes; then
skip_test_ '
skip_test_ 'expensive: disabled by default
This test is relatively expensive, so it is disabled by default.
To run it anyway, rerun make check with the RUN_EXPENSIVE_TESTS
environment variable set to yes. E.g.,
@@ -217,8 +219,8 @@ require_membership_in_two_groups_()
groups=${COREUTILS_GROUPS-`(id -G || /usr/xpg4/bin/id -G) 2>/dev/null`}
case "$groups" in
*' '*) ;;
*) skip_test_ '
$0: this test requires that you be a member of more than one group,
*) skip_test_ 'requires membership in two groups
this test requires that you be a member of more than one group,
but running `id -G'\'' either failed or found just one. If you really
are a member of at least two groups, then rerun this test with
COREUTILS_GROUPS set in your environment to the space-separated list
@@ -260,6 +262,21 @@ mkfifo_or_skip_()
fi
}
# Disable the current test if the working directory seems to have
# the setgid bit set.
skip_if_setgid_()
{
setgid_tmpdir=setgid-$$
(umask 77; mkdir $setgid_tmpdir)
perms=$(stat --printf %A $setgid_tmpdir)
rmdir $setgid_tmpdir
case $perms in
drwx------);;
drwxr-xr-x);; # Windows98 + DJGPP 2.03
*) skip_test_ 'this directory has the setgid bit set';;
esac
}
skip_if_mcstransd_is_running_()
{
test $# = 0 || framework_failure