Compare commits

...

623 Commits
v6.11 ... 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
Jim Meyering
74ba433a14 version 7.1
* NEWS: Record release date.
2009-02-21 22:35:33 +01:00
Jim Meyering
c980b0566a * README: Mention that c99-to-c89.diff is no longer maintained. 2009-02-21 21:32:17 +01:00
Jim Meyering
31896c21c6 tests: skip new install-C test if working directory is set-gid
* tests/install/install-C: Use setgid-check.
2009-02-21 19:49:40 +01:00
Jim Meyering
773a88d33f tests: skip newly-modified tests unconditionally, just to be safe
* tests/misc/stty-invalid: Skip.
* tests/misc/stty: Likewise.
* tests/mv/i-3: Likewise.
2009-02-21 16:52:42 +01:00
Jim Meyering
cd78f85b0b tests: don't let SIGTTOU/TTIN hang a backgrounded "make check"
Running "make check &" would hang due to SIGTTOU and SIGTTIN signals.
* tests/misc/stty: Ignore SIGTTOU.
* tests/misc/stty-invalid: Likewise.
* tests/mv/i-3: Ignore SIGTTIN.
2009-02-21 16:52:39 +01:00
Jim Meyering
2061cd8aa6 doc: ls: clarify description of -s
* src/ls.c (usage): Make the description of -s mention "allocated size",
so that it's less likely to be confused with an apparent byte-count.
Suggested by Vito Caputo.
2009-02-20 19:32:02 +01:00
Jim Meyering
0c91ae335d doc: dd: document that the default block size is 512 bytes
* src/dd.c (usage): Document the default block size.
* doc/coreutils.texi (dd invocation): Document that the default
block size (bs, ibs, obs) is 512 bytes.
Reported by Petr Uzel.
2009-02-19 12:45:18 +01:00
Jim Meyering
0e40e9de57 maint: changing NEWS' copyright date must not invalidate checksum
* maint.mk (NEWS_hash): Don't let the Copyright date line contribute
to the checksum.
* cfg.mk (old_NEWS_hash): Update to reflect the new policy.
2009-02-18 16:09:45 +01:00
Jim Meyering
0a3f944791 doc: explain how to recover from changes committed to master
* HACKING: A beginner's commit-to-master is so common,
and causes enough confusion, that we describe how to recover.
2009-02-18 15:40:53 +01:00
Jim Meyering
fa391362e1 maint: add copyright notices
* HACKING: Add copyright notice.
* tests/test-lib.sh: Likewise.
2009-02-18 15:40:44 +01:00
Ondřej Vašík
8c243ff965 cp: -a now preserves SELinux context, with reduced diagnostics
* copy.c (copy_reg): Reduce SELinux context diagnostics for 'cp -a'.
(copy_internal): Likewise
* copy.h (cp_options): Add boolean reduce_diagnostics.
* cp.c (usage): Say that --archive (-a) behaves like -dR --preserve=all.
(cp_option_init): Initialize added reduce_diagnostics.
(main): Add reduce_diagnostics for the -a option, and preserve SELinux
context, if possible.
* mv.c (cp_options_init): Initialize new cp_options booleans.
* install.c (cp_option_init): Likewise.
* NEWS: Mention those behaviour changes.
* doc/coreutils.texi: Document --preserve=context, document that
diagnostics are not shown for failures of non-mandatory attributes
(just SELinux at the moment).
* tests/cp/cp-a-selinux: Check not only failures, but succesful use
of preserving SELinux context in cp.
2009-02-18 15:27:10 +01:00
Eric Blake
86cef85b36 add missing copyright dates
* NEWS: Add 2009 to copyright.
* README: Likewise.
* README-hacking: Likewise.
* TODO: Likewise.
* doc/Makefile.am: Likewise.
* m4/prereq.m4: Likewise.
* src/nl.c: Likewise.
* src/seq.c: Likewise.
* tests/cp/cp-i: Likewise.
* tests/install/install-C: Likewise.
* tests/install/install-C-root: Likewise.
* tests/install/install-C-selinux: Likewise.
* tests/misc/seq: Likewise.
* tests/mv/mv-n: Likewise.
2009-02-18 06:07:30 -07:00
Eric Blake
65ba955988 install: compare files in binary mode
* src/install.c (need_copy): Use O_BINARY when it matters.
2009-02-17 07:58:39 -07:00
Kamil Dudka
dac5f12c6e install: add --compare (-C) option to install file only when necessary
* src/install.c (have_same_content): New function to compare files
content.
(extra_mode): New function checking for non-permission bits in mode.
(need_copy): New function to check if copy is necessary.
(main): Handle new option --compare (-C).
(copy_file): Skip file copying if not necessary.
(usage): Show new option --compare (-C) in --help.
* tests/install/install-C: Basic tests for install --compare (-C).
* tests/install/install-C-root: Tests requiring root privileges.
* tests/install/install-C-selinux: Tests requiring SELinux.
* tests/Makefile.am: Add new tests for install --compare (-C).
* doc/coreutils.texi: Document new install option --compare (-C).
* NEWS: Mention the change.
2009-02-17 14:12:44 +01:00
Ondřej Vašík
26d3d090bd nl: correct long-option name for -v in usage
* nl.c (usage): Use --starting-line-number, not --first-page for -v
2009-02-17 14:10:39 +01:00
Jim Meyering
1eaacac312 doc: id: make --help and .man more descriptive
* src/id.c (usage): Improve description, based on a suggestion
from Brian M. Carlson in http://bugs.debian.org/514675
* man/id.x: Use a better one-liner, based on the one at top of id.c.
2009-02-15 10:17:19 +01:00
Pádraig Brady
5d0b158f4c seq: Fix equal width calculation when '.' added to last number
Issue reported by Samuel Hapák.
<http://lists.gnu.org/archive/html/bug-coreutils/2009-02/msg00139.html>

* src/seq.c: Account for '.' added to "last" number.
* tests/misc/seq: Add corresponding test.
* NEWS: Mention the fix.
2009-02-14 23:47:14 +00:00
Jim Meyering
982504452d du,chgrp,chmod,chown: use FTS_DEFER_STAT
* src/du.c (main): Use FTS_DEFER_STAT, for better locality of inode
reference.  Important when traversing file systems with fake inodes.
* src/chgrp.c (main): Likewise.
* src/chmod.c (main): Likewise.
* src/chown.c (main): Likewise.
The only remaining fts client, chcon, doesn't need this, since it goes
further and uses FTS_NOSTAT, which suppresses all non- directory
stat calls.
2009-02-13 18:41:01 +01:00
Pádraig Brady
48cae1e864 maint: mention how to run a single test in HACKING docs
* HACKING: Give an example of how to run a test in isolation.
* README: Fix/simplify example for running a single test.
* README-hacking: Reference the HACKING file.
2009-02-13 11:13:33 +00:00
Eric Blake
022889a457 ln: add details to --help text
* src/ln.c (usage): Mention more about symlink properties.
* doc/coreutils.texi (ln invocation): Likewise.
* THANKS: Update.
Reported by Vitali Lovich.

Signed-off-by: Eric Blake <ebb9@byu.net>
2009-02-11 21:26:51 -07:00
Jim Meyering
adc62b5d9f ls: clean up after wrapped+colored file names with clear-to-EOL
This change addresses a relatively unusual case: ls --color, with
a highlighted name being printed initially in the last row of a
terminal emulator (possibly followed by other lines of output) such
that it is wrapped onto the following line, as the terminal emulator
scrolls the output.  That would cause the entire following line to
be highlighted, even if the name happened to use only one position.
The least-invasive patch would have made colorized output larger for
all uses.  The approach taken below is more invasive, but limits the
increase in overhead to only those lines that are expected to wrap.
* src/ls.c (enum indicator_no): Add C_CLR_TO_EOL.
(indicator_name): Add "cl".
(color_indicator): Add default escape codes for "cl".
(print_long_format): Propagate width to print_name_with_quoting.
(print_name_with_quoting): Print new C_CLR_TO_EOL string if needed.
Return the width of what we're printing.
(print_file_name_and_frills): Propagate width.
(print_type_indicator): Return bool (aka width).
(print_many_per_line): Pass column position to print_* function.
(print_current_files): Likewise.
(print_horizontal): Likewise.
(print_with_commas): Likewise.
* src/dircolors.c (slack_codes): Add "CLRTOEOL".
(ls_codes): Add "cl".
* tests/ls/color-clear-to-eol: New file.  Test for this fix.
* tests/Makefile.am (TESTS): Add ls/color-clear-to-eol.
* THANKS: Update.
Reported by Alexander V. Lukyanov.  See thread for details:
http://thread.gmane.org/gmane.linux.kernel/740021/focus=14824
Thanks to Jan Engelhardt for helping me reproduce the problem.

Demonstrate with this in an 80-column xterm:
  seq 200 # to start in the "bottom" row
  touch zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz.foo
  env LS_COLORS='*.foo=0;31;42' ls -og --color=always

Before the fix, you'd see something like this:
(where the file name is printed in red on a green background,
and each "=" denotes a space on a green background)
...
  -rw-r--r--  1       0 Feb  5 11:31 zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\
  zzzzzzzzzzzzzz.foo===================================================

After the patch, the trailing green spaces are gone:

  -rw-r--r--  1       0 Feb  5 11:31 zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\
  zzzzzzzzzzzzzz.foo
2009-02-10 14:47:39 +01:00
Jim Meyering
1f4fcd083d * tests/test-lib.sh: Use skip_test_... in place of echo...;exit 77. 2009-02-10 14:39:10 +01:00
Nix
9c8e4f6918 tests: avoid skipping stty-* tests
* tests/test-lib.sh (require_controlling_input_terminal_):
Check stdout, not stdin.
2009-02-10 14:38:42 +01:00
Jim Meyering
ed85df444a touch: deprecate --file option: equivalent to --reference (-r)
* src/touch.c: Mark long-undocumented --file for removal in 2010.
(main): Warn upon use of --file.
2009-02-09 11:44:40 +01:00
Pádraig Brady
0dc4478f13 tests: fix dd skip=greater_max_file_size test on Solaris 10
* tests/dd/skip-seek-past-file: I had previously commented that
on some systems lseek(> max file size) may succeed, but left
the possibility of failure in that case, so that I could determine
specific systems to put in the comments for both failure modes.
2009-02-06 07:46:08 +01:00
Jim Meyering
8ed84c3438 avoid spurious parentheses/arith-op-related warnings from newer gcc
* src/copy.c (set_owner): Use && rather than &.
* src/stty.c (main): Likewise.
* src/wc.c (wc): Likewise.
2009-02-05 14:53:10 +01:00
Jim Meyering
c55c0e7369 maint: tighten atoi/atof-prohibiting regexp, clean up .x-sc- file
* maint.mk (sc_prohibit_atoi_atof): Require "(" after token.
* .x-sc_prohibit_atoi_atof: Remove names that no longer contain a match.
2009-02-02 09:37:48 +01:00
Jim Meyering
e3e9713fad doc: preserve --help line breaks in 'REPORTING BUGS' man page section
* man/help2man: Insert .br between adjacent lines.
2009-02-02 09:37:48 +01:00
Jim Meyering
6b8578af5e * src/system.h (emit_bug_reporting_address): Remove periods. 2009-02-02 09:37:48 +01:00
Jim Meyering
04d49874a2 update copyright dates from recent changes
* src/dd.c: Add 2009 to list of copyright years.
* tests/dd/seek-skip-past-file: Likewise.
* tests/dd/seek-skip-past-dev: Likewise.
* m4/xattr.m4: Likewise.
* src/copy.h: Likewise.
2009-02-02 09:37:48 +01:00
Jim Meyering
18810ae65f * maint.mk (sc_redundant_const): Use $(_prohibit_regexp). 2009-02-02 09:37:48 +01:00
jidanni@jidanni.org
d3dcb10f90 date doc: warn at -d about LC_TIME
We also warn here about LC_TIME, so the user will know even if he
doesn't look in the @xref{Date input formats}.
2009-02-02 08:40:18 +01:00
jidanni@jidanni.org
52b4d2a51a document sort --ignore-case --unique interaction 2009-02-02 08:38:41 +01:00
Jim Meyering
2b32399fdc maint: detect useless inclusion of c-ctype.h
* maint.mk (sc_prohibit_c_ctype_without_use): New rule.
2009-01-31 09:39:12 +01:00
Jim Meyering
44421c22a3 maint: teach "make syntax-check" to print each check name as it's run
* maint.mk (%.m): New rules to print each syntax-checking rule name,
just before running its commands.
($(syntax-check-rules)): Depend on it.
2009-01-29 13:31:28 +01:00
Jim Meyering
61a42e3743 maint: silence some syntax-check rules
* cfg.mk (sc_strftime_check): Silence the rule.
(sc_tight_scope): Likewise.
* src/Makefile.am (check-AUTHORS): Likewise.
2009-01-29 13:31:15 +01:00
Jim Meyering
60ca9e1599 maint: factor syntax-check rules
* maint.mk (_ignore_case): New macro.
(_prohibit_regexp): Use it.
Factor many existing syntax-check rules to use $(_prohibit_regexp).
2009-01-29 13:30:45 +01:00
Kamil Dudka
0889381cbf cp/mv: add xattr support
This patch was originally written by Andreas Grünbacher, nowadays
available at
http://www.suse.de/~agruen/coreutils/5.91/coreutils-xattr.diff

* bootstrap.conf: Add gnulib module verror.
* po/POTFILES.in: Add lib/verror.c.
* m4/xattr.m4: Check for libattr availability, new configure option
--disable-xattr.
* m4/prereq.m4: Require gl_FUNC_XATTR.
* src/Makefile.am: Link cp, mv and ginstall with libattr.
* src/copy.h: Add preserve_xattr and require_preserve_xattr to
cp_options.
* src/copy.c (copy_attr_error): New function to handle errors during
xattr copying.
(copy_attr_quote): New function to quote file name in error messages
printed by libattr.
(copy_attr_free): Empty function requested by libattr to free quoted
string.
(copy_attr_by_fd): New fd-oriented function to copy xattr.
(copy_attr_by_name): New name-oriented function to copy xattr.
(copy_reg, copy_internal): Call copy_extended_attributes function.
* src/cp.c (usage): Mention new --preserve=xattr option.
(decode_preserve_arg): Handle new --preserve=xattr option.
* src/mv.c: Always attempt to preserve xattr.
* src/install.c: Never attempt to preserve xattr.
* tests/misc/xattr: New test for xattr support in cp, mv and install.
* tests/Makefile.am: Add the new test to list.
* doc/coreutils.texi: Mention xattr support, new --preserve=xattr
option.
* NEWS: Mention the change.
2009-01-29 13:26:07 +01:00
Jim Meyering
1bdf77ad52 system.h: add a comment re autoconf's new AC_PACKAGE_URL
* src/system.h (emit_bug_reporting_address): Add a comment
suggesting to use AC_PACKAGE_URL once we require autoconf-2.64.
2009-01-28 18:36:08 +01:00
Pádraig Brady
05a50b7848 tests: Fixup shred-passes test
* tests/misc/shred-passes: Set the $fail variable correctly.
The issue was noticed by Jim Meyering.
2009-01-28 16:43:52 +00:00
Pádraig Brady
2f61473e85 tests: Add a test to verify shred's default operations
* tests/Makefile.am: add new test
* tests/misc/shred-passes: Verify the operations shred
does by default to overwrite and remove a zero length file.
2009-01-28 15:39:18 +00:00
Pádraig Brady
460ebb078e dd: Better handle user specified offsets that are too big
Following are the before and after operations for seekable files,
for the various erroneous offsets handled by this patch:

skip beyond end of file
  before: immediately exit(0);
  after : immediately printf("cannot skip to specified offset"); exit(0);

skip > max file size
  before: read whole file and exit(0);
  after : immediately printf("cannot skip: Invalid argument"); exit(1);
seek > max file size
  before: immediately printf("truncate error: EFBIG"); exit(1);
  after : immediately printf("truncate error: EFBIG"); exit(1);

skip > OFF_T_MAX
  before: read whole device/file and exit(0);
  after : immediately printf("cannot skip:"); exit(1);
seek > OFF_T_MAX
  before: immediately printf("truncate error: offset too large"); exit(1);
  after : immediately printf("truncate error: offset too large"); exit(1);

skip > device size
  before: read whole device and exit(0);
  after : immediately printf("cannot skip: Invalid argument"); exit(1);
seek > device size
  before: read whole device and printf("write error: ENOSPC"); exit(1);
  after : immediately printf("cannot seek: Invalid argument"); exit(1);

* NEWS: Summarize this change in behavior.
* src/dd.c (skip): Add error checking for large seek/skip offsets on
seekable files, rather than deferring to using read() to advance offset.
(dd_copy): Print a warning if skip past EOF, as per FIXME comment.
* test/Makefile.am: Add 2 new tests.
* tests/dd/seek-skip-past-file: Add tests for first 3 cases above.
* tests/dd/seek-skip-past-dev: Add root only test for last case above.
2009-01-28 15:14:57 +00:00
Jim Meyering
0d5508de13 doc: emit better bug-reporting info, to help help2man
* src/system.h (emit_bug_reporting_address): End each "sentence"
with period, mark URLs with <...>.
Based on a suggestion from Eric Blake.
Use fputs on a string without %s, not printf.
2009-01-27 20:20:20 +01:00
Jim Meyering
ddf56e0440 doc: ensure that emit_bug_reporting_address changes propagate to *.1
* man/Makefile.am ($(MAN)): Depend on system.h.
2009-01-27 20:20:07 +01:00
Jim Meyering
2fbee63cc9 doc: restore "REPORTING BUGS" section to generated man pages
* man/help2man ($PAT_BUGS): Update regexp to match the newer
"Report PROG bugs ..." --help output, as well as "Report bugs...".
Reported by Eric Blake.
2009-01-27 19:17:14 +01:00
Jim Meyering
b27275c668 tests: generalize install-transform-check
* maint.mk (install-transform-check): Generalize to work also
in a project that installs manuals in a section other than "1".
2009-01-26 18:54:58 +01:00
Jim Meyering
016f8c9998 build: resolve conflict with new declaration from version-etc.h
* src/system.h (emit_bug_reporting_address): Define away,
now, gnulib's version-etc.h also declares this function.
In this package, we choose to include each program's name in
the diagnostic.  Define away the conflicting declaration.
(emit_bug_reporting_address): Also emit home page and
"General help..." links, like the new function does.
Reported by Bob Proulx.
2009-01-23 18:27:36 +01:00
Pádraig Brady
10f3e12a0d doc: shred: Correct docs on default number of overwrites.
* NEWS: Mention the change to the default number of passes.
* doc/Makefile.am: Update constants.texi with the default
number of passes shred uses, so that the documentation
will automatically reflect any future changes.
* doc/coreutils.texi (shred invocation): Update the description
of the --iterations option to have the correct default number,
while still conveying that there are 25 internal patterns
that may be useful.
2009-01-22 23:42:51 +00:00
Pádraig Brady
83ae1bdd44 shred: change default number of overwrites from 25 to 3
* src/shred.c: The concensus is that a default of 3
passes is appropriate for current drive technologies.
* src/TODO: Reference Paul Eggert's suggestion
of enhancing shred to conform to DoD 5220 rules.
2009-01-22 13:26:04 +00:00
Jim Meyering
2a8f5104cd m4: don't use AC_REQUIRE([AC_C_BIGENDIAN])
* m4/jm-macros.m4: Use AC_REQUIRE([gl_BIGENDIAN]) instead.
This avoids a subtle problem recently documented in autoconf:
http://git.sv.gnu.org/gitweb/?p=autoconf.git;a=commitdiff;h=34e2c8d5484
2009-01-21 14:48:39 +01:00
Jim Meyering
065f14f471 no longer define *_FILENO constants
* src/system.h (STDIN_FILENO, STDOUT_FILENO, STDERR_FILENO):
Remove definitions.  Now guaranteed by gnulib.
2009-01-19 21:27:57 +01:00
Jim Meyering
9a45c19667 build: use dist-xz, not dist-lzma, cont'd
* README-hacking: mention XZ utils
* README-prereq: Add a FIXME comment.
2009-01-19 13:47:04 +01:00
Jim Meyering
f6240c49df tests: tail-2/infloop-1 is racy
* tests/tail-2/infloop-1: Add a comment to that effect.
2009-01-19 12:09:12 +01:00
Jim Meyering
b52a88607f build: use dist-xz, not dist-lzma
* configure.ac (AM_INIT_AUTOMAKE): s/dist-lzma/dist-xz/.
Requires recent "xz" from git://ctrl.tukaani.org/lzma-utils.git
2009-01-18 13:20:26 +01:00
Jim Meyering
f15842de47 maint: remove obsolete sc_author_mark_check rule
* maint.mk (sc_author_mark_check): Remove rule.
"and" no longer appears in the definition of AUTHORS.
2009-01-16 23:31:04 +01:00
Jim Meyering
c926d002b5 Merge branch 'master' of git://git.sv.gnu.org/coreutils 2009-01-16 23:30:27 +01:00
Jim Meyering
31b6c0489a maint: enforce existing prohibition: no cvs $keywords$
* maint.mk (sc_prohibit_cvs_keyword): New rule.
2009-01-16 23:28:20 +01:00
Jim Meyering
a488f288a2 echo, printf, test: remove unused #include directives
* src/echo.c: Don't include "long-options.h". No longer used.
* src/printf.c: Likewise.
* src/test.c: Likewise.
2009-01-16 13:37:32 +01:00
Pádraig Brady
a7592cfcb2 pathchk: avoid -Wsign-compare warnings
* src/pathchk.c: Compare pathconf limits to _signed_ MAX constants,
as pathconf returns signed values.
2009-01-16 11:06:09 +00:00
Pádraig Brady
3288ebb0d7 pr: avoid -Wsign-compare warnings
* src/pr.c: Use unsigned variables in unsigned comparisons.
2009-01-16 11:06:09 +00:00
Pádraig Brady
9934f50282 shred: avoid -Wsign-compare warnings
* src/shred.c: Use already assigned signed variable sizeof_r,
rather than the unsigned sizeof(r). Don't use signed integer
overflow check that contemporary compilers may remove anyway.
2009-01-16 11:06:09 +00:00
Pádraig Brady
46d6df933e simplify mgetgroups() and avoid -Wsign-compare warnings
* gl/lib/mgetgroups.c: Avoid -Wsign-compare warning by using unsigned
types for the parameters of the new function realloc_groupbuf().
mgetgroups() was refactored to use this function rather than
explicitly allocating and copying from automatic storage itself.
* src/group-list.c: Use int rather than size_t as variable is
used in signed comparisons.
* src/id.c: ditto.
2009-01-16 11:06:09 +00:00
Eric Blake
7b1967351c test, echo, printf: don't accept option abbreviation
* src/test.c (main): Directly parse accepted options, thus
avoiding abbreviations.
* src/echo.c (main): Likewise.
* src/printf.c (main): Likewise.
2009-01-14 14:32:13 -07:00
Kamil Dudka
d01338eb3d cp/mv: add --no-clobber (-n) option to not overwrite target
* src/cp.c (usage): Show new option -n in --help.
(main): Handle new option -n.
* src/mv.c (usage): Show new option -n in --help.
(main): Handle new option -n.
* doc/coreutils.texi: Document new cp/mv option -n.
* tests/cp/cp-i: Add tests for -f, -i and -n options.
* tests/mv/mv-n: New test for mv -n.
* tests/Makefile.am: Add test mv/mv-n to the list.
* NEWS: Mention the change.
2009-01-14 09:09:22 +01:00
Eric Blake
a99c35b04d option handling: make exceptions more consistent
* doc/coreutils.texi (Common options): Not all utilities reject
option abbreviations.
* src/chroot.c (main): Report correct name on failure.
* src/echo.c (usage): Clarify long option usage.
* src/setuidgid.c (usage): Likewise.
* src/hostid.c (usage): Condense.
2009-01-08 07:57:36 -07:00
Jim Meyering
5e3a5ae519 * bootstrap.conf (avoided_gnulib_modules): Add dummy. 2009-01-07 22:57:19 +01:00
Jim Meyering
1fd718e93c * maint.mk: align some backslashes 2009-01-07 22:54:11 +01:00
Pádraig Brady
972967903d doc: pathchk description enhancements
* doc/coreutils.texi (pathchk invocation): Mention pathchk
checks validity (for current system) as well as portability.
Say messages go to stderr, and reorder description of checks
done for the -p option, to match what's done in code.
* src/pathchk.c (usage): Mention pathchk checks name validity.
Suggested clarifications were from Dan Jacobson.
2009-01-05 00:01:21 +00:00
Pádraig Brady
e0035fa4eb src/.gitignore: Ignore getlimits utility
* src/.gitignore: Ignore getlimits
2009-01-03 15:10:42 +00:00
Pádraig Brady
99be907838 tests: refactor to use the new getlimits utility
* tests/Coreutils.pm: Add function to make limits available
* tests/test-lib.sh: ditto
* tests/misc/join: Check for both SIZE_OFLOW and UINTMAX_OFLOW
rather than using arbitrary 2^128
* tests/misc/sort: ditto
* tests/misc/uniq: ditto
* tests/misc/printf: Check for both INT_OFLOW and INT_UFLOW
rather than using arbitrary -2^31
* tests/misc/seq-long-double: Check for INTMAX_OFLOW
rather than using arbitrary 2^63
* tests/misc/split-fail: Check --lines --bytes and --line-bytes
options limits on all platforms. Note getlimits obviates the
need to use expr to check if 32 bit integers are supported,
which I think was invalid anyway as expr now supports bignum?
* tests/misc/test: Check for UINTMAX_OFLOW rather than
using arbitrary 2^64 and 2^128. Check for INTMAX_UFLOW
rather than using arbitrary -2^64
* tests/misc/timeout-parameters: Check for UINT_OFLOW
rather than using arbitrary 2^32
* tests/misc/truncate-overflow: Don't depend on truncate
to determine if we're on a 32 or 64 bit platform and
instead use the various OFF_T limits
* tests/misc/sort-merge: Check for UINTMAX_OFLOW
rather than using arbitrary 2^64+1
* tests/misc/unexpand: ditto
2009-01-03 15:10:42 +00:00
Michael Meskes
1ead085826 stat: print file-system total inode count (%c) as an unsigned number
* src/stat.c (print_statfs): Print statfs.f_files, the total inode
count of a file system, as an unsigned number.
2009-01-03 09:42:39 +01:00
Jim Meyering
695682d514 tests: factor ls-misc (no semantic change)
* tests/misc/ls-misc: Factor out uses of "\e[0m".
2009-01-01 10:05:24 +01:00
Jim Meyering
442d63051c update copyright year
* doc/coreutils.texi: Likewise.
* tests/sample-test: Likewise.
2009-01-01 02:15:07 +01:00
Jim Meyering
7fc5292a29 improve M4 quoting
* configure.ac: Add quotes.
* gl/m4/mgetgroups.m4 (gl_MGETGROUPS): Likewise.
* m4/boottime.m4 (GNULIB_BOOT_TIME): Likewise.
* m4/check-decl.m4 (gl_CHECK_DECLS): Likewise.
* m4/gmp.m4 (cu_GMP): Likewise.
* m4/jm-macros.m4 (coreutils_MACROS, gl_CHECK_ALL_HEADERS): Likewise.
(gl_CHECK_ALL_TYPES): Likewise.
* m4/lib-check.m4 (cu_LIB_CHECK): Likewise.
* m4/stat-prog.m4 (cu_PREREQ_STAT_PROG): Likewise.

FYI, I first ran this command:
git ls-files | grep -E '\.(m4|ac)$' | xargs perl -pi \
-e 's/(AC_[A-Z_]+\()([^[()]+?)([,)])/$1\[$2]$3/g;' \
-e 's/(AC_[A-Z_]+\(\[[^,]+?\], )([^,[()]+?)([,)])/$1\[$2]$3/g;' \
-e 's/(AC_[A-Z_]+\((?:\[[^,]+?\], ){2})([^,[()]+?)([,)])/$1\[$2]$3/g'
Then I updated serial numbers and copyright dates manually.
Also, I manually added two pairs of quotes in boottime.m4.
2009-01-01 02:15:07 +01:00
Jim Meyering
cf5616a0aa bootstrap: don't use cmp's -s option when reading from a pipe
GNU cmp exits without reading all input when given the -s option,
and that can cause termination of the writing process via SIGPIPE.
Instead, when reading from a pipe, just redirect output to /dev/null
so that all input is read.
2009-01-01 02:15:07 +01:00
Jim Meyering
13601dd3cf maint: factor out common code; prohibit use of HAVE_MBRTOWC
* maint.mk (_prohibit_regexp): New macro.
(sc_avoid_if_before_free, sc_cast_of_argument_to_free):
(sc_cast_of_x_alloc_return_value, sc_cast_of_alloca_return_value):
(sc_space_tab, sc_prohibit_atoi_atof, sc_prohibit_strcmp):
(sc_prohibit_stat_st_blocks, sc_prohibit_S_IS_definition): Use it.
(sc_prohibit_HAVE_MBRTOWC): New rule.
2009-01-01 02:15:07 +01:00
Jim Meyering
1ee192a9ff maint: use more sc_-prefixed names
* maint.mk (sc_po_check): Renamed from po-check.
(sc_author_mark_check): Renamed from author_mark_check.
(sc_copyright_check): Renamed from copyright-check.
(sc_makefile_path_separator_check): Renamed from
makefile_path_separator_check.
(local-checks-available): Remove the old names.
* Makefile.am (EXTRA_DIST): Reflect the renaming: .x-sc_po_check
* .x-po-check: Rename to...
* .x-sc_po_check: ...new file.
2009-01-01 02:15:07 +01:00
Jim Meyering
cbecb8cab8 maint: tighten m4 AC_ quoting check
* maint.mk (sc_m4_quote_check): Renamed from m4-check.
Also search for AC_DEFINE and AC_DEFINE_UNQUOTED.
Also search in configure.ac.
* configure.ac: Quote first argument of AC_DEFINE.
* jm-macros.m4 (coreutils_MACROS): Quote the first argument to AC_DEFINE.
2009-01-01 02:15:07 +01:00
Jim Meyering
fb992bae4c maint: move coreutils-specific syntax check rules into cfg.mk
* maint.mk (sc_dd_max_sym_length, sc_prohibit_jm_in_m4):
(sc_root_tests, sc_always_defined_macros, sc_system_h_headers):
(sc_sun_os_names, sc_tight_scope, sc_no_exec_perl_coreutils):
Move rules into cfg.mk.
(sc_strftime_check): Renamed from strftime-check, and moved, too.
* cfg.mk: Add the above rules.
2009-01-01 02:15:07 +01:00
Jim Meyering
ac9e4915ad portability: accommodate gnulib's getaddrinfo change
* src/Makefile.am (pinky_LDADD, who_LDADD): Append $(GETADDRINFO_LIB)
2009-01-01 02:15:07 +01:00
Jim Meyering
92465d59c6 cleanup/modernize: don't test HAVE_MBRTOWC; now gnulib provides it
* bootstrap.conf (gnulib_modules): Include mbrtowc explicitly.
* src/ls.c (quote_name): Don't test HAVE_MBRTOWC, now that we're
guaranteed to have the function.
* src/wc.c (wc): Likewise.
2009-01-01 02:15:07 +01:00
Eric Blake
921feefb12 doc: mention long option abbreviation
* doc/coreutils.texi (Common options): Give example of
abbreviating options.
* THANKS: Update.
Reported by Adam Jimerson.
2008-12-27 10:32:58 -07:00
Jim Meyering
0c65638b0f maint: ensure dd's computation of O_FULLBLOCK uses all O_ symbol names
* src/dd.c (O_FULLBLOCK): Use a more uniform initializer, that makes
it easier to extract all O_ symbol names.
* maint.mk (syntax-check-rules): Also search for sc_ rules in cfg.mk.
(sc_root_tests): Ensure that this rule sets $diff.
* cfg.mk (sc_dd_O_FLAGS): New rule.
2008-12-26 12:08:51 +01:00
Matt Harden
5c065bb0cb dd: add support for opening files in Concurrent I/O (CIO) mode
* src/dd.c (O_CIO): New flag.
* src/dd.c (O_FULLBLOCK): Add O_CIO to the list of flags that
O_FULLBLOCK should be greater than.
* src/dd.c (flags): Give the name "cio" to the new O_CIO flag, mirroring
the treatment of O_DIRECT.
* src/dd.c (usage): Add a description of the new flag when it is available.
* doc/coreutils.text (dd invocation): Describe the new flag.
* NEWS: Mention the new feature.
2008-12-26 10:57:05 +01:00
Jim Meyering
680afe6751 build: do enable $(WERROR_CFLAGS) for src/ files.
This reverts the more recent commit (of two) entitled "build:
add configure-time --enable-gcc-warnings option; avoid warnings".
Pádraig Brady spotted the contradiction between the log message
and actual change.

This reverts commit 292d68565a.
2008-12-23 17:22:57 +01:00
Pádraig Brady
0fcf730104 doc: stty: Clarification of some input and output settings
* doc/coreutils.texi (stty invocation): Clarify any
ambiguity in regard to the direction of input and output settings.
Add some notes on the case changing settings.
Most of the text was supplied by Dan Jacobson.
2008-12-23 14:26:22 +00:00
Pádraig Brady
f144582e17 timeout: remove problematic casts
* src/timeout.c (apply_time_suffix): Change input parameter from
unsigned int to unsigned long, which is the type of the variable it's
actually manipulating.  This removes the need for the cast which was
giving a warning with the gcc options: -fstrict-aliasing
-Wstrict-aliasing.  Also add a check for overflow possible on 16-bit
platforms, and fix indents.
(main): Remove a redundant cast in the alarm() call.
2008-12-23 10:29:05 +00:00
Jim Meyering
9a913a2461 * .x-sc_require_config_h: Remove obsolete regexps. 2008-12-21 17:50:09 +01:00
Jim Meyering
317d2c6384 maint.mk: enforce the "include <config.h> first" rule
* maint.mk (sc_require_config_h_first): New rule.
* .x-sc_require_config_h_first: New file.
2008-12-21 17:49:58 +01:00
Jim Meyering
292d68565a build: add configure-time --enable-gcc-warnings option; avoid warnings
* bootstrap.conf (gnulib_modules): Add "warnings" module.
* configure.ac: Add --enable-gcc-warnings, derived from code in bison.
* src/Makefile.am (AM_CFLAGS): Set to $(WARN_CFLAGS) # $(WERROR_CFLAGS)
* lib/Makefile.am (AM_CFLAGS): Change spelling to $(WARN_CFLAGS)
Don't use $(WERROR_CFLAGS), yet.
* src/system.h (usage): Declare.
* src/base64.c (usage): Declare to be global, for consistency.
* src/timeout.c (usage): Likewise.
* src/truncate.c (usage): Likewise.
* src/getlimits.c (usage): Likewise.
* src/pinky.c (ttyname): Declare with prototype, rather than an
empty argument list.
* src/who.c (ttyname): Likewise.
* src/su.c (crypt, getusershell, setusershell, endusershell): Likewise.
2008-12-21 17:49:58 +01:00
Jim Meyering
c352bb469d build: turn on $(WERROR_CFLAGS) for src/ 2008-12-21 17:49:58 +01:00
Jim Meyering
22a2a43021 build: add configure-time --enable-gcc-warnings option; avoid warnings
* bootstrap.conf (gnulib_modules): Add "warnings" module.
* configure.ac: Add --enable-gcc-warnings, derived from code in bison.
* src/Makefile.am (AM_CFLAGS): Set to $(WARN_CFLAGS) # $(WERROR_CFLAGS)
* lib/Makefile.am (AM_CFLAGS): Change spelling to $(WARN_CFLAGS)
Don't use $(WERROR_CFLAGS), yet.
* src/system.h (usage): Declare.
* src/base64.c (usage): Declare to be global, for consistency.
* src/timeout.c (usage): Likewise.
* src/truncate.c (usage): Likewise.
* src/getlimits.c (usage): Likewise.
* src/pinky.c (ttyname): Declare with prototype, rather than an
empty argument list.
* src/who.c (ttyname): Likewise.
* src/su.c (crypt, getusershell, setusershell, endusershell): Likewise.
2008-12-21 17:49:58 +01:00
Pádraig Brady
4000c35ae3 doc: Remove curly quotes from shell examples in man pages
Use \(aq rather than a literal ' as groff will convert apostrophe
to a right quote (\u2029) in utf8 locales for example.
Stepan Kasal details the issue and fix here:
http://lists.gnu.org/archive/html/bug-coreutils/2008-12/msg00124.html
2008-12-17 10:47:23 +00:00
Jim Meyering
99eccc3359 ChangeLog-2008: say ChangeLog files are no longer manually maintained
and point to HACKING's policy.  Suggestion from Dan Jacobson.
2008-12-16 08:15:39 +01:00
Jim Meyering
9965d234e5 du: -H now does what POSIX requires
* src/du.c (usage): Update --help output.
(main): Move -H-handling code from the --si block to
the one for --dereference-args (-D).
* doc/coreutils.texi (du invocation): Update description.
* NEWS (Changes in behavior): Mention this.
2008-12-16 08:04:01 +01:00
Jim Meyering
a011b01af1 doc: pr: formatting corrections
* doc/coreutils.texi (pr invocation): Fix some overzealous uses of @var.
Reported by Andreas Schwab.
2008-12-13 18:00:47 +01:00
Ralf Wildenhues
28fbe5a487 more portable bootstrap procedure
* bootstrap (get_version): Fix portability issues in sed script.
(check_versions): For buildreq apps, honor the corresponding
$APP variable like $AMTAR, $AUTOCONF.
(usage): Document this.
(update_po_files): Honor $SHA1SUM.
(main): Honor $AUTOPOINT, $ACLOCAL, $AUTOCONF, $AUTOHEADER,
$AUTOMAKE, $LIBTOOLIZE.
2008-12-13 18:00:44 +01:00
Jim Meyering
9b8023e69c tests: ensure that chmod, chgrp and chown honor --silent
* tests/chmod/silent: New file, to test all three programs.
* tests/Makefile.am (TESTS): Add chmod/silent.
* NEWS (Bug fixes): Mention this.
The bug was introduced in 96a5d2ce6a.
2008-12-03 11:02:57 +01:00
Ondřej Vašík
b8497a3a7a chmod, chown, chgrp: honor --silent (-f) once again
* chmod.c (process_file): Make -f suppress fts-related diagnostics.
* chown-core.c (change_file_owner): Likewise.
Reported via <http://bugzilla.redhat.com/474220>.
2008-12-03 11:02:45 +01:00
Jim Meyering
c2e56e0de7 wc: read and process --files0-from= input a name at a time,
when the file name list is not too large.  Before, wc would always read
the entire file name list into memory and *then* process each file name.
wc does read the list into memory when the list is known not to be too
large; this is done in order to be able to align the output numbers,
as it does with arguments specified on the command-line
* src/wc.c: Include "argv-iter.h".
(main): Rewrite to use argv-iter when the input file name list
is known to be too large.
* NEWS (Bug fixes): Mention it.
2008-12-02 13:12:22 +01:00
Jim Meyering
031e2fb5e9 du: read and process --files0-from= input a name at a time,
rather than by reading the entire input into memory and *then*
processing each file name.
* src/du.c: Include "argv-iter.h", not "readtokens0.h".
(main): Rewrite to use argv-iter.
Call xfts_open on each argument, rather than on the entire
argv list at once.
Call print_size here, not from du_files.
Diagnose read failure.
* NEWS (Bug fixes): Mention it.
* THANKS: update.
Reported by Barry Kelly.  More details in
http://article.gmane.org/gmane.comp.gnu.core-utils.bugs/15159/
2008-12-02 13:12:13 +01:00
Jim Meyering
e181802521 seq: plug a leak
* src/factor.c (emit_ul_factor): Call mpz_clear.
2008-12-01 22:44:20 +01:00
Jim Meyering
c58b5daa33 avoid warnings about initialization of automatic aggregates
* src/system.h (DZA_CONCAT0, DZA_CONCAT): New macros.
(DECLARE_ZEROED_AGGREGATE): New macro.
* src/ls.c (quote_name): Use it.
* src/pathchk.c (portable_chars_only): Use it.
* src/shred.c (main): Use it.
* src/stty.c (main): Use it.
* src/wc.c (SUPPORT_OLD_MBRTOWC): Use it.
2008-12-01 21:18:52 +01:00
Jim Meyering
80325aca2d * bootstrap.conf (gnulib_modules): Add argv-iter. 2008-12-01 17:41:18 +01:00
Jim Meyering
d3b5555f10 argv-iter: add tests
* gl/modules/argv-iter-tests: New module.
* gl/tests/test-argv-iter.c: New file.
2008-12-01 17:41:08 +01:00
Jim Meyering
ca738e4414 argv-iter: new module
* gl/lib/argv-iter.h: New file.
* gl/lib/argv-iter.c: New file.
* gl/modules/argv-iter: New file.
With a suggestion for improved memory management by Pádraig Brady.
2008-12-01 17:40:59 +01:00
Jim Meyering
21eb87e6ea * src/hostname.c (sethostname) [!HAVE_SETHOSTNAME]: Remove declaration. 2008-12-01 17:40:27 +01:00
Jim Meyering
7ef56a26fd cp, mv: remove 3-year-deprecated+warned-about --reply option
* src/cp.c (reply_args, reply_vals): Remove globals.
[REPLY_OPTION]: Remove enum.
(long_opts) ["reply"]: Remove initializer.
(main): Remove case stmt.
* src/mv.c: Likewise.
Don't include "argmatch.h".  No longer used.
* NEWS (Changes in behavior): Mention this.
* tests/Makefile.am (TESTS): Remove mv/reply-no.
* tests/mv/reply-no: Remove file.
* tests/mv/i-link-no: Update, now that --reply= is gone.
2008-12-01 17:03:37 +01:00
Pádraig Brady
aa2617b908 doc: Make descriptions of ASCII NUL and --zero-terminated option consistent
doc/coretuils.texi: Refactor shuf, sort and uniq --zero-terminated
option to use the same text. Also refer to NUL characters as
@acronym{ASCII} @sc{nul} consistently.
2008-12-01 14:05:56 +00:00
Jim Meyering
016958f2f0 doc: enforce @var{lower} policy
* doc/coreutils.texi: Fix remaining violations.
* doc/Makefile.am (sc-lower-case-var): New rule.
Add some command-suppressing "@" directives so that a successful
"make check" run is less noisy.
2008-12-01 09:25:06 +01:00
Pádraig Brady
1ce9d86c30 doc: Tweak info docs to standarise on lower-case @var{file}
* doc/coreutils.texi: s/@var{FILE}/@var{file}/
2008-12-01 02:29:57 +00:00
Pádraig Brady
00b5a2db33 doc: Improve description of --files0-from option
* doc/coreutils.texi: Describe the most common
usage of --files0-from=- to read names from stdin.
* src/du.c: Likewise.
* src/sort.c: Likewise.
* src/wc.c: Likewise.
2008-12-01 02:09:19 +00:00
Pádraig Brady
e34894bf3f tests: dd/reblock: Reduce chance of timing related failures
* tests/dd/reblock: Change the IPC mechanism to the dd process
under test, from pipes to fifos. Also change the delay
between data writes to 0.2s for both tests.
This should increase the chance that the dd process
will read the data chunks separately.
2008-12-01 01:20:18 +00:00
Jim Meyering
b14e5c40b9 m4: avoid a warning from gcc's -Wstrict-prototypes
* m4/jm-macros.m4 (ARGMATCH_DIE_DECL): Use proper prototype for usage.
2008-11-30 19:15:51 +01:00
Jim Meyering
90f74735aa tests: df: skip total-verify if df fails
* tests/df/total-verify: Skip the test if df fails.
2008-11-30 19:15:51 +01:00
Jim Meyering
d6a62182f0 build: don't reject definition of STREQ
* maint.mk (sc_prohibit_strcmp): Tighten rule: exclude
macro definitions like the one in system.h.
* .x-sc_prohibit_strcmp: Don't exempt src/system.h.
2008-11-30 19:15:51 +01:00
Jim Meyering
847ab6a518 tests: start long-running cp/link-heap earlier
* tests/Makefile.am (TESTS): Move cp/link-heap nearer the start of the
list, so that its termination doesn't delay a parallel "make check".
2008-11-30 19:15:51 +01:00
Jim Meyering
b5b3690d06 tests: avoid failure of cp/link-heap on some systems
* tests/cp/link-heap: Raise virtual memory limit from 10,000
to 14,000, to avoid failure on Debian/unstable (libc6 2.7-16).
2008-11-30 19:15:51 +01:00
Jim Meyering
57e2022b8d remove explicit declaration of putenv, ...
* src/date.c: ... now that gnulib guarantees that it's in <stdlib.h>.
* src/env.c: Likewise.
2008-11-30 19:14:29 +01:00
Jim Meyering
be6b4218e4 tests: dd/reblock: avoid occasional failure
* tests/dd/reblock: Sleep longer to avoid a race condition.
Reported by Bob Proulx.
2008-11-30 19:01:45 +01:00
James Youngman
48a05a9ce9 pwd: add pwd -P, -L to TODO
* TODO: Add to-do entry for -P and -L options of pwd.
2008-11-27 12:22:59 +01:00
Ondřej Vašík
fc3b301d4f doc: fix typo in units factorization, removed TODO items
* doc/coreutils: switch typo (switched gibibytes/gigabytes)
* TODO:          removed missing chcon and runcon documentation from list
2008-11-26 16:18:50 +01:00
Jim Meyering
c7e971bee0 doc: factor out list of suffix-to-number (e.g., KB->1000B) mappings
* coreutils.texi (multiplierSuffixes, multiplierSuffixesNoBlocks):
New macros.
(od invocation, head invocation, tail invocation, split invocation):
(truncate invocation): Use them.
2008-11-26 15:37:47 +01:00
Jim Meyering
b0312caf6f doc: tail: one more s/bytes/n/ change
* doc/coreutils.texi (tail invocation): Make one more
@var{bytes} -> @var{n} change.
2008-11-26 15:36:55 +01:00
Pádraig Brady
1c318d52de doc: tail: fix description of --bytes=N (-c)
* doc/coreutils.texi (tail invocation): Use @var{n} consistently,
not a mix of that and @var{bytes}.  Reported by anonymous
in <http://savannah.gnu.org/bugs/?24934>.
2008-11-26 14:27:09 +00:00
Karl Berry
186b655094 doc: move @shortcontents and @contents from end to start
* doc/coreutils.texi: Move @shortcontents and @contents from the
end to the beginning, just after "@end titlepage".
2008-11-23 12:45:40 +01:00
Jim Meyering
8333cc3c0f doc (stat): clarify: there are two sets of format directives
* doc/coreutils.texi (stat invocation): Clarify description of
--file-system format directives.
2008-11-23 12:36:13 +01:00
Karl Berry
c27c4a0957 doc (stat): correct formatting in coreutils.texi
* doc/coreutils.texi (stat invocation): Move the list of regular,
non-file-system, format directives from the description of --terse,
out of the enclosing table.
2008-11-23 12:36:08 +01:00
Jim Meyering
a5e53ecc2c tests: dd: add a test for the required behavior
* tests/dd/reblock: New file.  Test for the required functionality.
Based on an example and discussion from this thread:
http://lists.gnu.org/archive/html/bug-coreutils/2008-11/msg00153.html
* tests/Makefile.am (TESTS): Add dd/reblock.
2008-11-22 10:31:08 +01:00
Pádraig Brady
d5ab05998c Revert part of "dd: avoid unnecessary memory copies"
This reverts part of commit fbd87029cf.
Paul Eggert noticed the problem in
http://lists.gnu.org/archive/html/bug-coreutils/2008-11/msg00153.html
* doc/coreutils.texi (dd invocation): Clarify.
2008-11-22 10:20:31 +01:00
Pádraig Brady
a2be861b04 getlimits: A new utility for use in coreutils' tests
* src/getlimits.c: A utility to print platform dependent
limits in a format suitable for use in shell scripts.
* src/Makefile.am: Add getlimits to list of utilities
to build but not install. Also add it to the list linked
with libiconv
* po/POTFILES.in: Add getlimits to translation list.
2008-11-21 15:46:26 +00:00
Pádraig Brady
fbd87029cf dd: avoid unnecessary memory copies
* src/dd.c (scanargs): When not otherwise required (e.g. for
conversion), use two-buffer mode only when the input and output
buffer sizes differ.  Before, some of the most basic invocations of
dd, e.g., dd < in > out, would unnecessarily use separate buffers
and perform memory copies between them.
2008-11-21 11:50:59 +00:00
Jim Meyering
3ece0355d5 cp: use far less memory in some cases
cp --link was "remembering" many name,dev,inode triples unnecessarily.
cp was doing the same, even without --link, for every directory in the
source hierarchy, while it can do its job with entries merely for the
command-line arguments.  Prompted by a report from Patrick Shoenfeld.
Details <http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/15081>.
* src/copy.c (copy_internal): Refrain from remembering
name,dev,inode for most files, when invoked via cp --link.
Record an infloop-avoidance triple for each directory specified
on the command line, not for each directory in the source tree.
Don't record a dir-triple when x->hard_link is set.
* NEWS (Buf fixes): Mention it.
* tests/cp/link-heap: New file.  Test for cp's lowered memory usage.
* tests/Makefile.am (TESTS): Add link-heap.
2008-11-20 10:21:52 +01:00
Jim Meyering
1760ade090 tests: add a test of cp --preserve=links
* tests/cp/link-preserve: Add a case and comments.
2008-11-20 10:21:52 +01:00
Jim Meyering
ed017d44b2 cp: remove unused code
* src/cp-hash.c (remember_created): Remove unused function.
Remove thus-obviated headers: <stdio.h>, "quote.h", "error.h".
* src/cp-hash.h (remember_created): Remove declaration.
2008-11-20 10:21:52 +01:00
Jim Meyering
8b09875b59 doc: HACKING: reference http://www.gnu.org/licenses/why-assign.html
Suggestion from Patrick Schoenfeld.
2008-11-17 11:16:19 +01:00
Jim Meyering
4e38e6a19c tests: remove debug code that would try to write into /t/k-env
* tests/ls/no-cap: Remove debugging "tee".
2008-11-16 10:45:41 +01:00
Jim Meyering
b3e779c090 tests: change misc/printf-surprise so that it doesn't segfault anymore
* tests/misc/printf-surprise: Disable MALLOC_PERTURB_, so that "make
check" no longer provokes a segfault from printf(1).  Before, that
would be detected as a known problem and cause the test to be skipped.
Adjust the test so that a segfault once again results in test failure.
2008-11-16 09:53:48 +01:00
Jim Meyering
17409787bb tests: remove df/total
* tests/df/total: Remove file.
* tests/Makefile.am (TESTS): Remove df/total.
It is subsumed by df/total-verify.
2008-11-12 13:29:38 +01:00
Ondřej Vašík
ac819e1044 * tests/df/total-verify [VERBOSE]: Run df --version, not ls --version. 2008-11-12 13:27:23 +01:00
Jim Meyering
36eb45201f avoid spurious test failure when df always fails
* tests/df/total-verify: Skip upon _df_ failure, not tee failure.
Reported by Ondřej Vašík.  Details in
<http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/15028>.
2008-11-12 12:53:54 +01:00
Eric Blake
b43255473f jm-macros.m4: avoid syntax issue with newer autoconf
* jm-macros.m4 (coreutils_MACROS): Make LIB_CAP assignment persistent.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-11-11 10:44:59 -07:00
Jim Meyering
90a83264b9 Update references to GFDL: 1.2 -> 1.3
* doc/coreutils.texi: Likewise.
* doc/perm.texi: Likewise.
* old/fileutils/NEWS: Likewise.
* old/sh-utils/NEWS: Likewise.
* old/textutils/NEWS: Likewise.
2008-11-11 09:51:30 +01:00
Jim Meyering
43448b0493 make --help print "Report PROGRAM translation bugs to <...>."
for all but the C/POSIX locale.
* src/system.h: Include "hard-locale.h".
(emit_bug_reporting_address): Tell where to report translation bugs.

don't include "hard-locale.h", now that system.h does
* src/comm.c: Likewise.
* src/join.c: Likewise.
* src/ls.c: Likewise.
* src/pinky.c: Likewise.
* src/pr.c: Likewise.
* src/sort.c: Likewise.
* src/uniq.c: Likewise.
* src/who.c: Likewise.
2008-11-10 08:19:52 +01:00
Jim Meyering
854284f788 avoid warnings about discarding "qualifiers from pointer target type"
Use the new "bad_cast" function or an actual cast-to-"(char *)"
to avoid warnings.
* src/system.h (bad_cast): Define.
* src/chown.c (main):
* src/chroot.c (main):
* src/date.c (main):
* src/du.c (main):
* src/expand.c (stdin_argv):
* src/ls.c (decode_switches):
* src/md5sum.c (main):
* src/paste.c (main):
* src/pr.c (col_sep_string, column_separator, line_separator, main):
* src/sort.c (main):
* src/split.c (main):
* src/tail.c (main):
* src/unexpand.c (stdin_argv):
* src/yes.c (main):
2008-11-10 08:11:59 +01:00
Jim Meyering
0e2ac2de24 avoid a compiler warning
(strip_program): Declare to be const.
2008-11-10 08:11:59 +01:00
Jim Meyering
03911ef780 use xfreopen in place of unchecked freopen
* bootstrap.conf (modules): Add xfreopen.
* src/cat.c (main): Include "xfreopen.h".  Use xfreopen.
* src/cksum.c (cksum): Likewise.
* src/head.c (head_file, main): Likewise.
* src/md5sum.c (digest_file): Likewise.
* src/od.c (open_next_file): Likewise.
* src/split.c (type_undef): Likewise.
* src/sum.c (bsd_sum_file, sysv_sum_file): Likewise.
* src/tac.c (tac_file, main): Likewise.
* src/tail.c (tail_file, main): Likewise.
* src/tee.c (tee_files): Likewise.
* src/tr.c (main): Likewise.
* src/wc.c (wc_file): Likewise.
* po/POTFILES.in: Add lib/xfreopen.c
2008-11-10 08:11:59 +01:00
Jim Meyering
32d4d0dd5e xfreopen: new module
* gl/lib/xfreopen.c: New file.
* gl/lib/xfreopen.h: New file.
* gl/modules/xfreopen: New file.
2008-11-10 08:11:59 +01:00
Jim Meyering
cfa2120e83 Update URL: s!www.iro.umontreal.ca!translationproject.org/team/...!
* Makefile.am (THANKS-to-translators): Update URL template.
2008-11-09 15:35:51 +01:00
James Youngman
1c5e5d6277 install: indicate clearly it's not for installing packages
* src/install.c (usage): Indicate the program copies files,
as opposed to installing packages.
2008-11-09 13:56:00 +01:00
Jim Meyering
41ec3548b0 emit more precise bug-reporting instructions
Hoping that this will decrease the volume of bug reports
mistakenly directed to the coreutils mailing list.
* src/system.h (emit_bug_reporting_address): Specify the program
name in the "Report bugs to <...>." line in each program's --help
output and man page.  Now, it will say "Report PROGRAM_NAME bugs
to <...>."  Suggestion from Ondřej Vašík.
2008-11-08 19:59:52 +01:00
Jim Meyering
5b27ec57b0 include gnulib's strdup module explicitly
* bootstrap.conf (gnulib_modules): Include strdup explicitly, to
keep the latest version of gnulib-tool from omitting this now-marked-
as-obsolete module.
2008-11-05 19:18:59 +01:00
Kamil Dudka
1e48b1fee5 ls: --color now highlights hard linked files, too
* src/ls.c (print_color_indicator): Colorize hard linked files.
* src/dircolors.c: Add color for hard link.
* src/dircolors.hin: Add color for hard link.
* tests/ls/hardlink: Test for ls - colorize hard linked files.
* tests/Makefile.am (TESTS): Add ls/hardlink.
* NEWS: Mention the change.
2008-10-28 21:08:30 +01:00
Jim Meyering
5dc070cc86 tests: ls/stat-failed: don't discard stderr.
* tests/ls/stat-failed: Let stderr be recorded, to ease debugging.
2008-10-28 09:24:01 +01:00
Jim Meyering
b4ec994b26 tests: seq: check for today's extended long double fix
* tests/misc/seq-long-double: New file.  Test for today's bug fix.
* tests/check.mk (TESTS_ENVIRONMENT): Export CC definition.
* tests/Makefile.am (TESTS): Add misc/seq-long-double.
* NEWS (Bug fixes): Mention it.
2008-10-26 10:45:34 +01:00
Paul Eggert
2bf151cd93 seq: improve quality of format-checking code
* src/seq.c (validate_format): Remove. Migrate its checks into...
(long_double_format): Report an error and exit if an error is found,
instead of returning NULL.  All callers changed.
Use a more-consistent format for diagnostics.
* tests/misc/seq: Adjust to the more-consistent format for diagnostics.
2008-10-26 09:51:33 +01:00
Jim Meyering
153477479a factor: avoid compilation failure without libgmp
* src/factor.c (debug) [!HAVE_GMP]: Define.
Reported by Bob Proulx.
2008-10-25 22:57:42 +02:00
Paul Eggert
fec0e89c20 factor: remove --bignum and --no-bignum options
Here's a patch to remove the --bignum and --no-bignum options from
'factor'.  The case for removing --bignum isn't as strong as that for
'expr', but still, it seems to me that these options are not needed and
complicate the documentation unnecessarily.

* doc/coreutils.texi (factor invocation): Remove --bignum, --no-bignum.
* src/factor.c (algorithm, ALGORITHM_CHOICE, USE_BIGNUM, NO_USE_BIGNUM):
Remove; all uses removed.
(extract_factors_multi): Remove, replacing with....
(print_factors_multi): New function, with signature similar to that
of new signature of print_factors_single.
(print_factors_single): Migrate checking code to caller.
(print_factors): Use GMP if it's available; don't bother asking user.
Improve accuracy of check for "large" numbers.
(long_options, main): Remove support for --bignum.
2008-10-25 21:05:41 +02:00
Jim Meyering
407e8f0fdd tests: df/total: don't fail for an inaccessible mount point
* tests/df/total: Ignore nonzero exit status from df.
2008-10-25 16:30:54 +02:00
Paul Eggert
461231f022 seq: revert Solaris 8 work-around that caused x86 regression
* src/seq.c: Don't include <math.h>, <float.h>.
(abs_rel_diff): Remove.
(print_numbers): Test for equality, not for an epsilonish value.
This reverts 4827dd27b0, aka
v6.10-185-g4827dd2, which broke 'seq' on the x86; for example, it
causes "seq 9223372036854775807 9223372036854775808" to incorrectly
output 3 numbers instead of 2.  It's better to punish obsolescent
hosts that have incorrectly-working floating-point than to punish
correctly-working hosts.
* tests/misc/seq: Use 0.9000000000000, rather than
0.90000000000000000000, to avoid tickling a bug in Solaris 8 strtold,
which converts "0.9" and "0.9000000000000" correctly, but incorrectly
converts "0.90000000000000000000" to a smaller value.
2008-10-25 10:59:07 +02:00
Eric Blake
b705e9a9e7 group-list: avoid compiler warning
* src/group-list.c (print_group_list) [!HAVE_GETGROUPS]: Always
return value.
2008-10-24 11:44:48 -06:00
Jim Meyering
b3677e5e38 ls: use '.' (not +) as SELinux-only alt. access flag in ls -l output
* src/ls.c (gobble_file) [long_format]: Map SELinux-only to '.',
any other nonempty combination of MAC and ACL to '+', and all else
to the usual ' '.  Suggested by Michael Stone.
* tests/misc/selinux: Adapt: expect '.', not '+'.
* doc/coreutils.texi (What information is listed): Document this.
* NEWS (Changes in behavior): Mention it.
2008-10-23 14:18:25 +02:00
Pádraig Brady
cc0f637b6d Remove lzma as a specific build requirement
* bootstrap.conf: lzma was added as a build requirement
in the recently added build tools requirements check.
Remove that as it's quite new and also only required
for the make dist stage.
2008-10-22 22:15:10 +01:00
Paul Eggert
7920f2c14a * src/ls.c (usage): Describe exit statuses more concisely. 2008-10-22 18:40:56 +02:00
Pádraig Brady
99f4994982 Add better checks and docs for build tools
Prompted by a report from Ed Avis:
<http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/14710>

* README-hacking: Organise LZMA and Valgrind as
as optional requirements rather than in their own sections.
Mention bootstrap will now check tool versions.
* README-prereq: Make a start on specific instructions
for optaining build tools. Currently we just have notes
for Fedora linux.
* bootstrap.conf: Add the list of tools and versions required.
* bootstrap: Add the logic to check for the required tools,
and list all required tools and versions if any are missing.
2008-10-22 16:31:57 +01:00
Jim Meyering
5afac2aee1 clean up gl/modules/selinux-at
* gl/modules/selinux-at:
Ensure that LIB_SELINUX is cleared, in case it's set in the environment.
m4-quote the first two args to AC_SEARCH_LIBS.
Don't violate autoconf's ac_ namespace: s/ac_save/gl_save/
Drop the useless double quotes around a simple assignment RHS.
2008-10-22 12:44:17 +02:00
Jim Meyering
aa67daf63b move selinux-h module from gl/ to gnulib
* gl/lib/se-context.in.h: Remove file.
* gl/lib/se-selinux.in.h: Likewise.
* gl/m4/selinux-context-h.m4: Likewise.
* gl/m4/selinux-selinux-h.m4: Likewise.
* gl/modules/selinux-h: Likewise.
2008-10-21 18:05:55 +02:00
Jim Meyering
f7a009c17c prepare to move selinux-h module to gnulib
* gl/modules/selinux-h (Makefile.am)
[selinux/selinux.h, selinux/context.h]:
Remove temporary file and target, in case they're read-only.
Use $(MKDIR_P), not mkdir -p.
(License): Relax to LGPLv2+.
Remove vestigial comments.
2008-10-21 15:58:11 +02:00
Jim Meyering
028e12ce3b tests: test today's ls-vs-capability fix
Test for this fix: f3f1ccfd87.
* tests/Makefile.am (TESTS): Add ls/no-cap.
* tests/ls/no-cap: New file.
2008-10-21 13:09:58 +02:00
Kamil Dudka
f3f1ccfd87 ls: make it possible to disable file capabilities checking
* ls.c (print_color_indicator): Do not check for file capability
if that attribute is not being colored.
Since 84f6abfe00, ls --color would check
each file for "capabilities".  In <http://bugzilla.redhat.com/467508>,
James Antill reported that ls --color seemed slower with capabilities
detection.
2008-10-21 11:13:01 +02:00
Jim Meyering
08c38ab7cb reflect gnulib's removal of lstat.h
* src/copy.h: Don't include "lstat.h".
* src/ls.c: Likewise.
* src/remove.c: Likewise.
* src/rm.c: Likewise.
2008-10-21 08:10:29 +02:00
Pádraig Brady
d60e33e241 expr: Fixup authors
* src/expr.c: Standardise the format of AUTHORS to
that used in other utils with multiple authors.
Also add Paul Eggert since he basically rewrote it
with his bignum fixes.
* AUTHORS (expr): Add Paul Eggert.
2008-10-20 15:40:50 +01:00
Jim Meyering
31a884dab7 accommodate gnulib header removals
* src/copy.c: Don't include "euidaccess.h" or "lchmod.h".
* src/cp.c: Don't include "lchmod.h".
* src/ls.c: Don't include "dirfd.h".
* src/mkdir.c: Don't include "lchmod.h".
* src/pwd.c: Don't include "dirfd.h".
* src/remove.c: Don't include "dirfd.h" or "euidaccess.h".
* src/test.c: Don't include "euidaccess.h".
* gl/modules/getloadavg.diff: Adjust diff for changed context.
* src/uptime.c (uptime): Remove declaration.
2008-10-19 14:15:31 +02:00
Jim Meyering
74443830ea * maint.mk (coreutils-path-check): New definition, now run
only if src/true.c exists.  Factored out of...
(my-distcheck):  ...here.
2008-10-18 12:55:04 +02:00
Jim Meyering
2ae61facc7 maint: avoid warning in ls.c
* src/ls.c (has_capability) [!HAVE_CAP]: Add unused attribute.
2008-10-17 08:55:12 +02:00
Jim Meyering
bb7fa1e932 maint: avoid warnings due to attribute warn_unused_result
Now that a (void) cast no longer suffices to ignore warnings from gcc
about uses of functions marked with the warn_unused_result attribute,
we need an alternative.  For the record, here's one of the ignorable
warnings: "copy.c:233: warning: ignoring return value of 'fchown',
declared with attribute warn_unused_result"
* bootstrap.conf (gnulib_modules): Import ignore-value.
* src/copy.c: Include "ignore-value.h".
(set_owner): Use ignore_value in place of "(void)" casts,
to ignore lchown and fchown failures.
* src/cp.c (re_protect): Likewise, to ignore lchown failure.
* src/remove.c (preprocess_dir): Remove unnecessary "(void)" cast.
2008-10-17 07:06:54 +02:00
Jim Meyering
16c8062085 mktemp: diagnose freopen failure
* src/mktemp [--quiet]: Don't ignore freopen failure.
2008-10-16 23:00:22 +02:00
Paul Eggert
17278118ee * src/mktemp.c (main): Add 'const' twice to avoid GCC warning. 2008-10-16 22:27:08 +02:00
Jim Meyering
7f6fb43e7d build: when po-check fails, say why and suggest a fix
* maint.mk (po-check): Before, when this check failed, it just
spat out a diff mentioning two temporary files.  Now, it tells
you what's wrong and suggests a fix with a patch using the name
of the affected file (rather than temporary file names) in the
diff output.
2008-10-16 14:25:53 +02:00
Eric Blake
ddc409b59e csplit: prefer sigaction over signal
* bootstrap.conf (gnulib_modules): Import sigaction.
* src/csplit.c (sigprocmask, siginterrupt) [SA_NOCLDSTOP]: Delete
workarounds.
(interrupt_handler, main): Drop use of signal.  Rely on sigaction
to block fatal signal during cleanup, and to restore it to default
in case of nested signals.
2008-10-16 06:20:50 -06:00
Pádraig Brady
7eb3aab88b tests: add option processing tests for 'expr'
* tests/misc/expr: Add tests for various combinations
of options where the first part of the expression
could be confused with an option.
2008-10-15 16:32:05 +02:00
Paul Eggert
4fb3704c25 expr: remove --bignum and --no-bignum options
* doc/coreutils.texi (expr invocation): Remove the --bignum and
--no-bignum options.  They weren't really needed, and they broke
longstanding (albeit nonportable) scripts.
* src/expr.c: Don't include <assert.h>.  Include "inttostr.h",
"long-options.h", "verify.h".  Check at compile-time that
size_t fits in unsigned long int, as the code assumes this in
several places.
(HAVE_GMP): Define to 0 if not defined, for convenience.
(mpz_t, mpz_clear, mpz_init_set_ui, mpz_init_set_str, mpz_add):
(mpz_sub, mpz_mul, mpz_tdiv_q, mpz_tdiv_r, mpz_get_str, mpz_sgn):
(mpz_fits_ulong_p, mpz_get_ui, mpz_out_str):
Supply substitutes when !HAVE_GMP, which work well enough for
expr's purposes.
(mp_integer): Remove.  All integers are gmp, if gmp is available.
(struct valinfo): Remove 'z' member; no longer needed.  The 'i'
member is always of type mpz_t.
(enum arithmetic_mode, MP_NEVER, MP_ALWAYS, MP_AUTO, mode):
Remove; no longer needed.
(usage): Remove documentation of --bignum and --no-bignum.
(integer_overflow): Abort if error misbehaves, to pacify GCC.
Restore old message on arithmetic overflow, to be conservative.
(die): Omit exit_status parameter; not needed (is always EXPR_FAILURE).
(string_too_long, USE_BIGNUM, NO_USE_BIGNUM, long_options):
Remove; no longer needed.
(main): Don't use getopt_long; this breaks old nonportable scripts.
(int_value): Arg is unsigned, in case we have strings whose length
exceeds LONG_MAX (!).
(int_value, freev, printv, null, tostring, toarith):
(eval6, eval4, eval3):
Always use mpz_ functions, to simplify the code.
(substr_value): Remove; no longer needed.
(getsize): Simplify the API: one arg rather than 3.  Don't assume
unsigned long int fits in size_t.
(promote, domult, dodivide, doadd): Remove; no longer needed.
* tests/misc/expr: Don't use --bignum to test for bignum support.
Instead, use big numbers to test this.
2008-10-15 16:30:28 +02:00
Jim Meyering
514b7fbc00 expr: don't interpret argv[0] as an operand
* src/expr.c (main): Given a first argument like -22 (negative, with
two or more digits), expr would decrement optind to 0 and then attempt
to evaluate argv[0].
2008-10-15 15:34:58 +02:00
Jim Meyering
555c219d9e doc: cp, mv: remove mention of deprecated --reply= option
* doc/coreutils.texi (cp invocation, mv invocation): Don't mention it.
2008-10-15 15:08:58 +02:00
Jim Meyering
59964c164b doc: adjust spacing in ls --help output, for better man formatting
* src/ls.c (usage): Adjust spacing so the "Exit status:" list
renders well in the help2man-generated man page.
2008-10-13 21:08:07 +02:00
Ondřej Vašík
7377f49ea8 doc: ls: clarify exit status description
* src/ls.c (exit_status): Clarify comments.
(usage): Clarify exit status description in --help output.
* doc/coreutils.texi (ls invocation): Clarify exit status documentation
Reported by Greg Metcalfe in <http://bugzilla.redhat.com/446294>.
2008-10-13 09:01:54 +02:00
Jim Meyering
969841cb77 doc: reorder tsort/ptx nodes so body and menu ordering are consistent
* doc/coreutils.texi (tsort invocation, tsort background): Move these
nodes "down", so that they follow the ptx nodes, thus matching the
alphabetized order in the menu.
(tsort background): Make this a subsection.
Suggested by Karl Berry.
2008-10-12 19:53:20 +02:00
Jim Meyering
c3e1fe230b tests: move check-misc targets from src/Makefile.am to maint.mk
* src/Makefile.am (check): Remove check-misc.
(check-misc): Remove target.
* maint.mk (sc_prohibit_stat_st_blocks): New target.
(sc_prohibit_S_IS_definition): New target.
* Makefile.am (EXTRA_DIST): Add .x-sc_prohibit_stat_st_blocks.
* .x-sc_prohibit_stat_st_blocks: New file.
Andreas Schwab reported that "make check" could fail to detect
violation of the no-S_IS*-definition policy.
2008-10-12 11:21:19 +02:00
Jim Meyering
1833a876ae tests: df: avoid test failure when using mawk
* tests/df/total-awk: Rewrite to use $PERL, not $AWK.
mawk can't even count above 2^31.  Reported by Ed Avis.
http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/14792/focus=14802
* tests/df/total-verify: Rename from total-awk.
* tests/Makefile.am (TESTS): Reflect renaming.
2008-10-12 11:11:38 +02:00
Jim Meyering
0f5695bd59 bootstrap: merge from gnulib 2008-10-10 09:13:58 +02:00
Ondřej Vašík
42df6d7de2 doc: document runcon and chcon in SELinux context section
* doc/coreutils.texi: Document runcon and chcon.
Add minimal SELinux context section.
2008-10-07 23:43:27 +02:00
Ondřej Vašík
9c0c57a1b4 chcon: remove traces of unimplemented --change (-c) option
This option was never supported in upstream coreutils.
* chcon.c (usage): Remove --change (-c) from help message.
(main): Remove 'c' from getopt string.
Remove related and now-unused enums.
2008-10-06 22:53:04 +02:00
Andreas Dilger
a36f4cb451 stat: add lustre filesystem type
* src/stat.c (human_fstype) [S_MAGIC_LUSTRE]: Add case.
Make "stat -f" recognize the "Lustre" filesystem type.
<http://en.wikipedia.org/wiki/Lustre_(file_system)>
* NEWS: Mention this feature.
2008-10-06 22:35:57 +02:00
Jim Meyering
ed0a1c9f94 remove.c: avoid compile failure on OS/2
* src/remove.c (dirent_inode_sort_may_be_useful): Guard also with
"#if defined __linux__".  Reported by Elbert Pol.
2008-10-06 07:31:50 +02:00
Jim Meyering
f9da2d0e87 post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2008-10-05 21:27:05 +02:00
Jim Meyering
42285406aa version 7.0
* NEWS: Record release date.
2008-10-05 20:40:19 +02:00
Jim Meyering
5149348906 * maint.mk (alpha beta major): Add "-a" to git commit ... command. 2008-10-05 20:31:35 +02:00
Jim Meyering
fbc5aa7c47 tests: fix the install/strip-program test
* tests/install/strip-program: Use $PREFERABLY_POSIX_SHELL,
not POSIX_SHELL.  The latter may be empty, and would fail
on OpenBSD 3.9.
* tests/check.mk (TESTS_ENVIRONMENT): Propagate
PREFERABLY_POSIX_SHELL to tests.
2008-10-04 17:12:08 +02:00
Jim Meyering
15f4d612df timeout.c: don't use perror; exit 125 upon failed fork
* src/timeout.c (main): Use "error", not perror.
Elbert Pol noticed a build failure on OS/2.
* src/timeout.c (main): Exit 125 (not errno) upon failed fork.
Make the failed fork diagnostic match the one from install.c.
2008-10-03 18:39:31 +02:00
Kamil Dudka
e505736f82 ls and sort: use filevercmp instead of strverscmp
* src/ls.c (cmp_version): Use filevercmp instead of strverscmp.
* src/sort.c (usage): Remove mna reference to strverscmp(3).
(compare_version): Use filevercmp instead of strverscmp.
* bootstrap.conf: Add filevercmp to list of gnulib modules.
* tests/misc/sort-version: Remove conflicting string and enhance test.
* NEWS: Mention the change.
2008-10-03 11:59:17 +02:00
Jim Meyering
7eb15e1020 tests: skip a root-only test when configured without libcap
* tests/ls/capability: Test for HAVE_CAP definition in config.h.
2008-10-02 15:54:36 +02:00
Eric Blake
ef13885b37 ignore additional built file 2008-10-02 13:18:00 +02:00
Eric Blake
0628b73f35 remove.c: allow compilation on cygwin
* src/remove.c (dirent_inode_sort_may_be_useful)
[!HAVE_STRUCT_DIRENT_D_TYPE]: Elide definition when there is no point
in trying to use it.
2008-10-02 13:17:48 +02:00
Jim Meyering
dafbd407bc bootstrap: merge from gnulib
* bootstrap: add submodule support, git-merge-changelog
2008-10-02 13:16:47 +02:00
Jim Meyering
94c59c97f9 remove.c: combine two helper functions, to avoid sign-extension
* src/remove.c (fs_handles_readdir_ordered_dirents_efficiently):
Remove function, so as not to have to worry about the type of
statfs.f_type and sign extension.
(dirent_inode_sort_may_be_useful): Adjust comment.
Perform the switch directly on the struct.member here, instead.
Andreas Schwab spotted the potential for a sign-extension bug,
that happens not to bite for the S_* f_type values currently used.
2008-10-01 12:27:10 +02:00
Jim Meyering
ab02e256e9 rm: don't preprocess a directory on a file system of type tmpfs or nfs
The preprocessing phase is not necessary on tmpfs, and induces
a 20% performance decrease when removing a 2M-entry directory.
* src/remove.c (fs_handles_readdir_ordered_dirents_efficiently):
(dirent_inode_sort_may_be_useful): New functions from gnulib/fts.c.
They'll probably become a gnulib module -- eventually.
(preprocess_dir): Use dirent_inode_sort_may_be_useful.
2008-10-01 09:00:52 +02:00
Jim Meyering
0eff09dfcf tests: use our new timeout program
* tests/rm/ext3-perf: Also, record set-up duration and FS type.
2008-10-01 08:45:26 +02:00
Ralf Wildenhues
0482f193b5 fix make variable quotation error
* tests/check.mk (TESTS_ENVIRONMENT): Quote shell variable
$tmp__, fix expansion.
2008-09-29 22:49:08 +02:00
Jim Meyering
cfe3602ad6 seq: solve e13188e7ef more cleanly
* src/seq.c (print_numbers): Don't switch c_strtold -> strtold
in order to accommodate the locale-dependent behavior of our internal
asprintf use.  Instead, simply set the locale to C before calling
asprintf, and then set it back afterwards.
2008-09-29 15:28:03 +02:00
Jim Meyering
cee53c1430 build: avoid spurious valgrind warning about uses of touch
* .vg-suppressions (utimensat-NULL): Avoid bogus valgrind warning
that appears on at least Fedora 9.
2008-09-28 23:02:41 +02:00
Jim Meyering
0643c51cab mktemp: plug an inconsequential leak
* src/mktemp.c (main) [lint]: Free template.
2008-09-28 23:02:40 +02:00
Jim Meyering
b616886492 THANKS: add Erik Auerswald 2008-09-28 23:02:15 +02:00
Eric Blake
58aaf71f07 remove.c: avoid compiler warning
* src/remove.c (compare_ino, dirent_count)
[!HAVE_STRUCT_DIRENT_D_TYPE]: Mask declaration when unused.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-09-27 18:14:07 -06:00
Jim Meyering
24412edeaf rm -r: avoid O(n^2) performance for a directory with very many entries
This enhancement works around a problem that is specific to at least
ext3 and ext4 file systems.  With them, it would take hours to remove
a two-million-entry directory.  RAM-backed file systems (tmpfs) are
not affected, since there is no seek penalty.
* remove.c (rm_malloc, rm_free, compare_ino): New functions.
(dirent_count, preprocess_dir): New function.
[struct readdir_data]: New struct.
(remove_cwd_entries): Call preprocess_dir.
* tests/rm/ext3-perf: New file.  Test for the performance fix.
* NEWS: mention the new feature
2008-09-27 00:10:08 +02:00
Jim Meyering
a5111af33e remove.c: don't use xmalloc; don't let obstack call exit on failure
(obstack_chunk_alloc, obstack_chunk_free): Don't define.
(top_dir): Param is no longer "const".
Use malloc, not xmalloc, and call longjmp upon failed malloc.
(obstack_init_minimal): New function.
(ds_init): Don't use xmalloc.  Instead, use caller-supplied buffer.
Use obstack_specify_allocation_with_arg, not obstack_init, so
that we control what happens upon allocation failure.
Arrange for ds_free not to free uninitialized if/when
any obstack_specify_allocation_with_arg allocation fails.
(ds_free): Don't free DS, now that it's no longer malloc'd.
(rm): Allocate DS on the stack.
Arrange to handle ds_init allocation failure.

step1
2008-09-27 00:10:08 +02:00
Jim Meyering
1e3ebd660a * maint.mk (my-distcheck): remove duplicate c99-related test code 2008-09-27 00:10:08 +02:00
Jim Meyering
2f706199d0 maint: allow more C99 constructs; stop maintaining c99-to-c89 patch set
* cfg.mk (local-checks-to-skip): Add patch-check.
With the recent changes to remove.c, I no longer wish
to maintain the c99-to-c89 patch set.
2008-09-27 00:08:39 +02:00
Jim Meyering
e13188e7ef seq -0.1 0.1 2: print final number when locale's decimal point is ","
* src/seq.c (print_numbers): Use strtold, not c_strtold to convert
from just-formatted-using-asprintf string back to double, since
asprintf may have used something other than "." as the decimal point.
Reported by lsof@nodata.co.uk as <http://bugzilla.redhat.com/463556>.
Thanks to Ondřej Vašík for discovering that the bug was locale-related.

    $ LC_ALL=cs_CZ.UTF-8 seq -0.1 0.1 2|grep 2.0
    [Exit 1]
    $ seq -0.1 0.1 2|grep 2.0
    2.0

* tests/check.mk (TESTS_ENVIRONMENT): Add LOCALE_FR_UTF8, for...
* tests/misc/seq [locale-dec-pt]: New test for the above.
* NEWS (bug fix): Mention it.
2008-09-26 23:31:30 +02:00
Jim Meyering
2a4dcb627e maint: relax a check so "make distcheck" succeeds again
* maint.mk (makefile-check): Relax the check, in order to exempt
the necessary use of a sole @...@-delimited Makefile.am variable.
2008-09-26 23:21:25 +02:00
Jim Meyering
13a2025998 maint: avoid using find -name Makefile.am; could get false positives
* maint.mk (makefile-check): Instead, search for the offending
@...@ construct only in version-controlled files.
2008-09-24 16:25:02 +02:00
Benno Schulenberg
9a33347007 pinky: gettextize two missed strings
Additionally differentiate the strings for unknown idle time and
unknown real name so they can be translated differently.
2008-09-24 08:05:07 +02:00
Jim Meyering
e916c8ff05 cp.c: adjust a comment to make it consistent with documentation
'-a' is equivalent to -dpR, so s/-dpPR/-dpR/;  the -P is redundant,
since -d already implies -P, and both --help and "info cp" say -dpR:
Corresponding doc changes: 080ac77850
b7c2db6766.
2008-09-24 07:24:47 +02:00
Ralf Wildenhues
beaee48f26 fix installation with ./ginstall in src
* src/Makefile.am (cu_install_program): New variable, set to
either ./ginstall or @INSTALL_PROGRAM@ (for cross compilation).
(INSTALL_PROGRAM): Override AC_SUBST unconditionally, to avoid
warning, and wrong initialization order.
2008-09-22 22:42:20 +02:00
Benno Schulenberg
2643b4b77d doc: alphabetize 'who's option descriptions
* doc/coreutils.texi (who invocation): Alphabetize.
2008-09-22 10:00:20 +02:00
Benno Schulenberg
8c4a656fad who --help: add a general description 2008-09-19 12:27:37 +02:00
Benno Schulenberg
fec05eb377 uptime --help: put together message parts that belong together 2008-09-19 12:27:37 +02:00
Benno Schulenberg
6d5bf36d5c tr --help: gettextize a single paragraph as a single string
Breaking a paragraph into several strings is awkward for translators.
2008-09-19 12:27:37 +02:00
Benno Schulenberg
be11df4916 tail: gettextize the string, "standard input" 2008-09-19 12:27:37 +02:00
Benno Schulenberg
2f776f3096 tail --help: move the --retry entry into alphabetical order
* src/tail.c (usage): Also simplify --retry description, split a
long string in two, remove a stray period, and add the usual indent.
2008-09-19 12:27:37 +02:00
Benno Schulenberg
13edec7c62 shred --help: lowercase a stray capital 2008-09-19 12:27:37 +02:00
Benno Schulenberg
57622cac71 stty --help: correct the alignment of an entry
* src/stty.c (usage): Also remove a stray period, and ungettextize
a debugging message.
2008-09-19 12:27:37 +02:00
Benno Schulenberg
3b39aa796f sort --help: sort the options better alphabetically
Take the opportunity to split the long message into three parts.
2008-09-19 12:27:37 +02:00
Benno Schulenberg
a7ea04404c rmdir --help: use lower case in option description; adjust indentation 2008-09-19 12:27:37 +02:00
Benno Schulenberg
e34eb51728 remove.c: move comment to right before string, so gettext will pick it up 2008-09-19 12:27:36 +02:00
Benno Schulenberg
771484f47a pr --help: elide arguments after short options that allow a space
* src/pr.c (usage): Also, put the -S option with its description.
2008-09-19 12:27:36 +02:00
Benno Schulenberg
c7c961a3e5 od: ungettextize debugging messages 2008-09-19 12:27:36 +02:00
Benno Schulenberg
4718a2fdf4 nohup, remove, tr: also gettextize the alternative messages 2008-09-19 12:27:36 +02:00
Benno Schulenberg
2298544c64 od --help: avoid concatening two messages without a newline
src/od.c (usage): Better: make them into two separate paragraphs.
2008-09-19 12:27:36 +02:00
Benno Schulenberg
18efee4e2a mkfifo, mknod --help: put -Z option in its alphabetical position
Options are normally sorted by their short form, not their long form.
Also line up their descriptions.
2008-09-19 12:27:36 +02:00
Jim Meyering
f923ceceba doc: coreutils.texi (csplit invocation): Add an example. 2008-09-19 09:27:43 +02:00
Ralf Wildenhues
e10e4b6697 various VPATH-related fixes
* maint.mk (VC_LIST): Prepend '$(srcdir)/'.
(patch-check): Fix to make it work with a VPATH build.
* src/Makefile.am (sc_tight_scope): Likewise.
* man/Makefile.am (.x.1): Do not make outputs unwritable.
2008-09-14 17:42:48 +02:00
Jim Meyering
cddcb5d468 stat: remove obsolete and undocumented option, --filesystem
* src/stat.c: Remove obsolete and undocumented --filesystem.
2008-09-14 09:38:59 +02:00
Jim Meyering
3e8f9c8d35 tests: reenable disabled test, now that automake can handle it
This reverts the change in ae1c205fc4.
2008-09-13 15:08:16 +02:00
Jim Meyering
ae1c205fc4 tests: temporarily disable part of "make distcheck"
* maint.mk (install-transform-check): Temporarily disable.
2008-09-11 22:37:39 +02:00
Jim Meyering
2221ea2c3a tweak wording and check to avoid failure
* doc/coreutils.texi (printf invocation): Tweak wording.
* doc/Makefile.am (check-texinfo): Allow "search path".
2008-09-11 18:14:00 +02:00
Jim Meyering
a06afbeec5 doc: mention which commands may be built-in functions
* doc/coreutils.texi (mayConflictWithShellBuiltIn): New macro.
(mknod invocation, stat invocation, echo invocation)
(printf invocation, test invocation, pwd invocation)
(nice invocation, kill invocation, sleep invocation): Use it.
(printf invocation): Invoke via "env" rather than using a
literal /usr/local/bin/ prefix in examples.
2008-09-10 13:20:27 +02:00
Ralf Wildenhues
d9903062cf simplify installation rules, using new Automake
This relies on development Automake to provide multi-file
installation, and avoids relying on undocumented Automake
interfaces.  It also removes special-casing for `['.
* configure.ac (AM_INIT_AUTOMAKE): Depend on 1.10a.
(CROSS_COMPILING): New Automake conditional.
* src/Makefile.am (install-exec-am, filtered_PROGS)
(d_bindir, cu-install-binPROGRAMS): Remove.
(INSTALL_PROGRAM) [!CROSS_COMPILING]: Set to `./ginstall'.
2008-09-10 13:20:27 +02:00
Ralf Wildenhues
9dcebc51be fix minor shell issues in test suite
* tests/misc/help-version: Fix bad quoting.
* tests/cp/same-file: Fix unportable shell quoting.
* tests/mv/part-symlink: Likewise.
2008-09-10 13:20:27 +02:00
Jim Meyering
1084bf78ea tests: don't use "local" in bourne shell scripts
* tests/test-lib.sh (remove_tmp_, skip_if_mcstransd_is_running_):
Avoid failure on Solaris 11, since their /bin/sh passes the tests
in posix-shell.m4, yet does not support "local" (which is not POSIX).
2008-09-10 13:20:27 +02:00
Jim Meyering
68561594ca tests: use "Exit $fail", not (exit $fail); exit $fail
* tests/test-lib.sh (Exit): New function by Ralf Wildenhues in automake
http://git.sv.gnu.org/gitweb/?p=automake.git;a=commitdiff;h=20594c08f63
* tests/**: Convert all uses:

This restrictive change converted the vast majority:

  git grep -l '^(exit \$fail); exit \$fail$' \
    | xargs perl -pi -e 's/'^\(exit \$fail\); exit \$fail$/Exit \$fail/'

And this did the rest, plus a few undesirable ones, so I manually
backed out the changes to ChangeLog-* and build-aux/check.mk:

  git grep -l -E '\(exit [^)]+\); exit ' \
    | xargs perl -pi -e 's/\(exit (.+?)\); exit \1/Exit $1/'
2008-09-10 13:20:10 +02:00
Jim Meyering
22e5102f19 tests: move input-tty into a test-lib.sh function
* tests/test-lib.sh (require_controlling_input_terminal_): New function, from
* tests/input-tty: ...here.  Remove file.
* tests/Makefile.am (EXTRA_DIST): Remove input-tty.
* tests/mv/i-3: Use the function, not the file.
* tests/misc/stty: Likewise.
* tests/misc/stty-row-col: Likewise.
* tests/misc/stty-invalid: Likewise.
2008-09-08 08:20:03 +02:00
Jim Meyering
e4fa3e7808 tests: work around Solaris 11 bug
* tests/misc/printf-surprise: Accept bogus prefix on stderr output.
2008-09-07 20:50:49 +02:00
Jim Meyering
737461d23f tests: don't let rounding-to-1KB blocks provoke a failure
* tests/df/total-awk: Use df's --block-size=512 option.
2008-09-07 20:49:34 +02:00
Jim Meyering
6b22726dd4 tests: don't fail due to built-in sleep from Solaris 11's /bin/sh
* tests/misc/help-version (id_args): Invoke via env to ensure we
run the just-built version of sleep.
2008-09-07 19:16:42 +02:00
Kamil Dudka
54281e9c60 install: new option: --strip-program,
...to specify the program used to strip binaries
* src/install.c (main): Handle new option --strip-program.
(strip): Use strip program from global variable strip_program.
(usage): Mention new option --strip-program in --help.
* tests/tests/strip-program: Test case for new option --strip-program.
* tests/Makefile.am: Add new test case to test set.
* doc/coreutils.texi: Mention new option --strip-program.
* NEWS: Mention the change.
* TODO: Remove completed task.
2008-09-06 13:38:20 +02:00
Kamil Dudka
ea2887bbe4 df: new option: --total to print grand totals
* src/df.c (add_uint_with_neg_flag): New function to add two integral
values with separate negation flag.
(show_dev): New parameter force_fsu to display numbers directly. Collect
summary statistics on each printed device.
(usage): Mention new option --total in --help.
(main): Initialize summary on program start. Handle new option --total.
* tests/df/total: Dummy test case for new --total option.
* tests/df/total-awk: Better test case for new --total option (requires
awk).
* doc/coreutils.texi: Mention new parameter --total.
* NEWS: Mention the change.
* TODO: Removed completed task.
2008-09-03 15:39:28 +02:00
Jim Meyering
ef6a361a07 TODO: add an item for a chmod optimization 2008-09-03 09:11:05 +02:00
Jerry Snitselaar
63a7120c28 env, groups: remove duplicate inclusion of <getopt.h>
* src/env.c: Remove redundant #include.
* src/groups.c: Likewise.
Tiny change.
2008-08-31 15:58:27 +02:00
Jim Meyering
5bf3e7ee96 generate version.c and version.h
* src/Makefile.am (version.c, version.h): New rules.  Generate.
(nodist_libver_a_SOURCES): Define
* .gitignore: Add src/version.c and src/version.h.
(DISTCLEANFILES): Add version.c and version.h.
2008-08-26 18:45:06 +02:00
Jim Meyering
0c1fc1c715 use new global, "Version", rather than macro, VERSION
With this change, a version-string update no longer
forces recompilation of 100+ src/*.o files.
* src/version.c (Version): New global.  New file.
* src/version.h: Declare it.
* src/Makefile.am: Put it in a library that everyone links to.
(noinst_LIBRARIES, libver_a_SOURCES): Define.
(LDADD): Add libver.a.
(sc_tight_scope): Use perl (was sed), and a more relaxed regexp
to build the global-variable-name-recognizing regexp list.
* src/system.h: Include "version.h".
(case_GETOPT_VERSION_CHAR): Use Version rather than VERSION.
* src/basename.c (main): Use Version rather than VERSION.
* src/chroot.c (main): Likewise.
* src/cksum.c (main): Likewise.
* src/dd.c (main): Likewise.
* src/dirname.c (main): Likewise.
* src/echo.c (main): Likewise.
* src/hostid.c (main): Likewise.
* src/hostname.c (main): Likewise.
* src/link.c (main): Likewise.
* src/logname.c (main): Likewise.
* src/nice.c (main): Likewise.
* src/nohup.c (main): Likewise.
* src/printenv.c (main): Likewise.
* src/printf.c (main): Likewise.
* src/pwd.c (main): Likewise.
* src/setuidgid.c (main): Likewise.
* src/sleep.c (main): Likewise.
* src/sync.c (main): Likewise.
* src/test.c (main): Likewise.
* src/timeout.c (main): Likewise.
* src/true.c (main): Likewise.
* src/tsort.c (main): Likewise.
* src/unlink.c (main): Likewise.
* src/uptime.c (main): Likewise.
* src/users.c (main): Likewise.
* src/whoami.c (main): Likewise.
* src/yes.c (main): Likewise.
2008-08-26 18:45:06 +02:00
Jim Meyering
f03a67735a bootstrap: preserve permissions of more copied files
* bootstrap (cp_mark_as_generated): Preserve perms of copied files.
Remove a kludge, now that this is fixed.
2008-08-26 18:43:52 +02:00
Bruno Haible
f325d180cf doc: clarify wc -L documentation
* doc/coreutils.texi (wc invocation): Explain what the -L option
measures.
2008-08-23 15:52:02 +02:00
Eric Blake
bfe4a55520 ls: adjust to gnulib change
* src/ls.c (includes): "strverscmp.h" no longer exists.
2008-08-20 12:43:27 +02:00
Eric Blake
8ea96a5c90 .gitignore: ignore more files
* .gitignore: Ignore directories created by gnulib.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-08-19 18:38:24 +02:00
Eric Blake
f3574102d3 .gitattributes: generalize
* .gitattributes: Relax the glob pattern, so it matches *.texinfo, too.
Suggest a POSIX BRE, rather than one that uses the GNU extension, \\+.
2008-08-19 08:56:29 +02:00
Eric Blake
edd292f8d4 sort: improve usage wording
* src/sort.c (usage): Mention that -k defaults to end of line if
POS2 omitted.
* THANKS: Update.
Reported by Tim Ryan.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-08-18 21:52:04 -06:00
Jim Meyering
929479026b adjust 2008-08-15 10:18:51 +02:00
Bruce Korb
4c9fae4e97 sort: new option, --sort=version, for version number ordering
* src/sort.c [struct keyfield] (version): New member.
(usage): Describe --version-sort.
(sort_options): Add 'V'.
(long_options): Add "version-sort".
(CHECK_TABLE, _ct_, SORT_TABLE, _st_): Define new macros.
(check_args, sort_args, sort_types): Use these new macros in declarations.
(ARGMATCH_VERIFY): Remove use.  No longer needed.
(compare_version): New function.
(key_compare): Add a case.
(check_ordering_compatibility): Handle new type.
(main): Likewise.  Reformat two expressions for readability.
* tests/misc/sort-version: new test file
* tests/Makefile.am: add it to the list
* doc/coreutils.texi (sort invocation): Document it.
* NEWS: Mention the new feature.
2008-08-15 09:52:06 +02:00
Jim Meyering
a01c4720d6 set envvars via "env" to avoid spurious set -x output from bad shells
* tests/dd/misc: Set LC_ALL=C via env.
* tests/cp/thru-dangling: Set POSIXLY_CORRECT via env.
This is necessary at least on AIX 5.3.
Reported by Jeph Cowan and Ralf Wildenhues.  Details here:
http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/14235/focus=14257
2008-08-14 23:08:03 +02:00
Jim Meyering
081ebb2822 "expr --bignum 1" now fails when expr is built without libgmp
* src/expr.c (main): When --bignum is requested, yet expr was built
without libgmp, exit nonzero (3) in addition to giving a diagnostic.
2008-08-14 14:37:49 +02:00
Jim Meyering
22999697b8 mktemp, sort, tac: don't use undefined after mkstemp failure
When mkstemp fails, the template buffer may have undefined
contents, so we must not print it.
* src/sort.c (create_temp_file): Use temp_dir, not "file"
when diagnosing failed mkstemp, because "file" may be undefined.
* tests/misc/sort-merge: Adjust for new expected output.
Jeph Cowan and Ralf Wildenhues reported the test failure:
http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/14235/focus=14257
* src/tac.c (copy_to_temp): Don't use template buffer after
failed mkstemp call, since its contents may be undefined.
* tests/misc/tac (pipe-bad-tmpdir): New test for the above.
* src/mktemp.c (main): Save a copy of the template string,
solely for use in case mkstemp fails.
* tests/misc/mktemp (pipe-bad-tmpdir): New test for the above.
2008-08-14 14:37:37 +02:00
Benno Schulenberg
7e0019b168 kill: micro grammar nit in description of SIGNAL 2008-08-12 20:41:25 +02:00
Benno Schulenberg
64c25ed741 groups: let synopsis show that the command allows multiple usernames
Also make the docstring say so.
2008-08-12 20:41:25 +02:00
Benno Schulenberg
d9c0881137 id: remove superfluous condition test; it is caught at -Z above 2008-08-12 20:41:25 +02:00
Benno Schulenberg
4290abda87 id: gettextize a few missed tiny strings 2008-08-12 20:41:25 +02:00
Benno Schulenberg
5a74a2d566 fmt: remove the 'no file' sentence; the standard phrase is given below
Replace the sentence with a more useful explanation of -DIGITS.
2008-08-12 20:38:37 +02:00
Benno Schulenberg
7ee3d2430a echo: correct description of \c
* src/echo.c (usage): Correct description of \c.
* coreutils.texi (echo invocation): Likewise.
* src/echo.c: Remove --help-duplicating comment.
2008-08-11 10:09:56 +02:00
Benno Schulenberg
f0f6e14610 doc: the quote operator for expr is '+', not 'quote' 2008-08-11 09:47:01 +02:00
Benno Schulenberg
e4fd2bf4e6 factor: remove duplicate docstring; use the more detailed one 2008-08-11 09:47:01 +02:00
Benno Schulenberg
18e2a330b9 echo: gettextize the alternative option description too 2008-08-11 09:47:01 +02:00
Benno Schulenberg
4ebf956b4e dd: clarify meaning of multiplication factors; put xM in order 2008-08-11 09:47:01 +02:00
Benno Schulenberg
0392142b87 doc: remove stray word from date's field width description 2008-08-11 09:47:01 +02:00
Benno Schulenberg
127c689f64 date: remove confusing and unneeded sentence from --help
It makes it unclear what 'sequences' refers to,
and the -u option already says enough.
2008-08-11 09:47:01 +02:00
Benno Schulenberg
baad54258d printenv: say what it does when variables are specified 2008-08-11 09:47:01 +02:00
Benno Schulenberg
d3ad58376d doc: put the exitstatus paragraph in a better place
* doc/coreutils.texi (tsort invocation): move two lines
2008-08-11 09:47:01 +02:00
Benno Schulenberg
a1cb30c1fb cp: move a newline to make second message identical to others 2008-08-11 09:47:00 +02:00
Benno Schulenberg
d7e2f425e7 who: Gettextize two forgotten strings 2008-08-11 09:47:00 +02:00
Jim Meyering
4b5e044be3 sort: remove unnecessary declaration of strtod
* src/sort.c (STDC_HEADERS): Remove declaration of strtod.
2008-08-10 16:49:59 +02:00
Jim Meyering
43f66923cc sort: avoid erroneous cast
* src/sort.c (OPEN_MAX): Define if not already defined.
(MAX_NMERGE): Remove definition.
(specify_nmerge): Don't cast MAX_NMERGE (of type size_t) to unsigned int.
Instead, use OPEN_MAX as the fall-back value.
2008-08-10 16:49:40 +02:00
Jim Meyering
cd1f4bc1ec sort: don't print uninitialized in diagnostic
* src/sort.c (specify_nmerge): Do use uinttostr value.
Provoke with e.g., sort -m --batch-size=18446744073709551617
Omit quotes around known-numeric value in diagnostic.
* tests/misc/sort-merge [nmerge-big]: Tighten ERR_SUBST regexp
to require a numeric value in that diagnostic, so this particular
failure cannot reappear.
2008-08-10 16:48:55 +02:00
Jim Meyering
b673a5b8ac * .gitattributes: Better diff output for texinfo sources. 2008-08-09 16:56:01 +02:00
Jim Meyering
2a2d3f237b dd.c: reduce duplication in new O_FULLBLOCK-defining code
* src/dd.c (MULTIPLE_BITS_SET): New macro, extracted from...
(multiple_bits_set): ...this function.
Use a single-line, and far simpler expression (no need to list all
O_* symbols again) to validate the derived O_FULLBLOCK value.
2008-08-09 16:56:01 +02:00
Jim Meyering
0d279d2378 * coreutils.texi (factor invocation, expr invocation): Adjust wording. 2008-08-09 16:56:01 +02:00
Jim Meyering
c339cff4a6 expr: avoid compiler warnings
* src/expr.c (die): New "noreturn" function to wrap one-arg use of
error
(string_too_long): Use die rather than error.
(toint): Remove definition of now-unused function.
(eval6): Remove a little duplication.
Use die rather than error.
(dodivide): Remove declaration of now-unused variable.
2008-08-09 16:56:01 +02:00
Jim Meyering
ae5ae5e117 * tests/misc/expr: Add tests of the new GMP-based code. 2008-08-09 16:55:45 +02:00
James Youngman
f65cafd67b expr: support arbitrary-precision arithmetic
* src/Makefile.am (expr_LDADD): Link expr against GNU MP.
* doc/coreutils.texi (expr invocation): Describe --bignum,
--no-bignum.   Explain the new arbitrary-precision functionality.
* NEWS: Indicate that arbitrary-precision arithmetic is now
supported in expr.
* src/expr.c (enum valtype): Added mp_integer, signifying a GNU MP
number.
(usage): Document the new options --bignum and --no-bignum which
force and prohibit the use of arbitrary-precision arithmetic,
respectively.
(long_options): data structure for getopt_long, which we need to
use to parse the options mentioned above.
(main): parse these options with getopt_long instead of
parse_long_options.
(valinfo): Downgrade the numeric member of the union from
intmax_t to signed long, since MP lacks functions for promoting an
intmax_t to an arbitrary-precision quantity.
(enum arithmetic_mode): Represents the current choice between
--bignum, --no-bignum and the default (automatically switch from
one to the other if needed).
(integer_overflow): issue a more explicit error message indicating
that MP is not available.
(string_too_long): new function, emits a fatal error message for
the case where an argument to the 'index' expression is too long
for a string offset to be represented.
(int_value): With --bignum, create the value as mp_integer rather
than plain integer.
(substr_value): factored out of eval6; implements "substr".
(freev): also destroy mp_integer values.  Check that no mp_integer
values exist if --no-bignum was specified.
(printv, null, tostring): support mp_integer.
(toint): new funtion for converting from string or mp_integer to
integer.
(getsize): extracts a size_t value from a VALUE object; used to
implement substr.
(promote): promotes a value from integer to mp_integer.
(domult, dodivide): functions for multiplication and division,
factored out of eval4.
(doadd): addition/subraction function, factpred out of eval3.
(eval3): support mp_integer types; call doadd.
(eval4): support mp_integer types; call domult, dodivide.
(eval6): support mp_integer offsets and lengths for "substr" and
"index".
* TODO: Mention that expr supports arbitrary-precision arithmetic,
and suggest that this might also be a good idea for seq.
* AUTHORS (expr): Add James Youngman.
2008-08-06 08:47:55 +02:00
James Youngman
d9207b48a3 doc: mv,cp: undocument the --reply option
* doc/coreutils.texi (mv invocation): Remove documentation for mv --reply.
(cp invocation): Likewise.
* NEWS: mention this.
2008-08-06 08:36:46 +02:00
James Youngman
d7f79cf6cb document the supported baud rates beyond 38400
* doc/coreutils.texi (Special):  Document the supported baud rates
beyond 38400.
2008-08-06 08:34:50 +02:00
John David Anglin
8c3835bf93 ls: ignore spurious getfilecon failure due to lack of SELinux support
* src/ls.c (gobble_file): Upon failed getfilecon, treat an errno value
of EOPNOTSUPP just like ENOTSUP.  See <http://bugs.debian.org/488549>.
2008-08-05 12:27:18 +02:00
James Youngman
273c10fc2c Document uptime.
* doc/coreutils.texi (uptime invocation): document uptime.
* TODO: uptime is documented now.
* src/uptime.c (print_uptime): Use fprintftime to print the time, rather
than printf. This should make the situation better for translations.
2008-08-05 12:21:30 +02:00
Benno Schulenberg
f4bffea5e9 doc: correct and normalize --help output of several tools
* src/chroot.c (usage): Add "[ARG]" to synopsis.
* src/cut.c (usage): Remove an inconsistent period in an option
description.
* src/du.c (usage): Remove superfluous argument after short option -X.
Also remove inconsistent uppercase and final period.
Use a single indent level for prettiness.
* src/shred.c (usage): Normalize the synopsis.
* src/stty.c (usage): Options -F and --file are alternatives, cannot
both be used.
* src/sum.c (usage): -r does not overrule -s; the last one counts.
* src/uptime.c (usage): Remove inconsistent space from the synopsis.
* src/users.c: Likewise.
2008-08-04 11:10:14 +02:00
Jim Meyering
6b9f1bdd66 false: mark "false" description for translation
* src/true.c (usage): Mark both strings with N_, so that
the one for "false" is also extracted for translation.
For consistency, mark both, although only the latter one needed it.
Inspired by a patch from Benno Schulenberg.
2008-08-04 10:28:16 +02:00
James Youngman
ffc630e598 factor: credit Torbjörn Granlund
* src/factor.c: Credit Torbjörn Granlund as the author of the
arbitrary-precision factorization code.
2008-08-04 09:11:19 +02:00
Jim Meyering
c4c3dbc024 doc: make it clear we're talking about the Linux kernel
* doc/coreutils.texi (mv invocation): tweak wording
2008-08-03 08:53:52 +02:00
Ralf Wildenhues
110df929fc tests: fix build-aux/check.mk for non-GNU make
* build-aux/check.mk ($(TEST_LOGS)) [!GNU_MAKE]: Check for
a $(TESTS) test in the build dir, before one in srcdir.  For details,
see <http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/14198>.
2008-08-02 13:57:17 +02:00
Ralf Wildenhues
e3b5543ea8 * bootstrap: Fix unportable expr usage. 2008-08-02 10:49:35 +02:00
Kamil Dudka
84f6abfe00 ls: --color now highlights files with capabilities, too
* src/ls.c: [HAVE_CAP] Include <sys/capability.h>.
(has_capability): New function for capability detection.
(print_color_indicator): Colorize file with capability.
* m4/jm-macro.m4: New configure option: --disable-libcap.
Check for libcap usability.
* src/Makefile.am (dir_LDADD, ls_LDADD, ...): Append $(LIB_CAP).
* src/dircolors.c: Update color lists.
* src/dircolors.hin: Mention new CAPABILITY color attribute.
* tests/ls/capability: Test for ls - colorize file with capability.
* tests/Makefile.am (root_tests): Add ls/capability.
* NEWS: Mention the change.
2008-08-01 22:13:25 +02:00
James Youngman
00c6aacf31 factor arbitrarily large numbers
* m4/gmp.m4: New file; adds cu_GMP, which detects GNU MP.
* configure.ac: Use cu_GMP.
* src/Makefile.am: Link factor against libgmp if available.
* src/factor.c: Use GNU MP if it is available.
(emit_factor, emit_ul_factor, factor_using_division,
factor_using_pollard_rho, extract_factors_multi,
sort_and_print_factors, free_factors): new functions
for the arbitrary-precision implementation, taken from an example
in GNU MP.
(factor_wheel): Renamed; was called factor.
(print_factors_single): Renamed; was called print_factors.
(print_factors): New function, chooses between the single- and
arbitrary-precision algorithms according to availability of GNU MP
and the length of the number to be factored.
(usage, main): New options --bignum and --no-bignum.
* coreutils.texi (factor invocation): Document new command-line
options for the MP implementation and update the performance
numbers to take into account the asymptotically faster algorithm.
* TODO: Remove item about factoring large primes (it's done).
* m4/gmp.m4: Add support for --without-gmp.
* NEWS: Mention the new feature.
2008-08-01 11:15:05 +02:00
Kamil Dudka
8d974b00fb ls -U1 now uses constant memory
When printing one name per line and not sorting, ls now uses
constant memory per directory, no matter how many files are in
the directory.
* ls.c (print_dir): Print each file name immediately, when possible.
* NEWS: Mention the improvement.
2008-08-01 08:36:38 +02:00
Jim Meyering
b44f5f74aa * timeout.c: Fix grammar in a comment. Normalize comment syntax. 2008-07-30 15:42:52 +02:00
Jim Meyering
662ce25d83 bootstrap: work also when there are no .po files in po/
* bootstrap (update_po_files): Complete the change that I began
in 7ba2dd8082.
2008-07-28 20:36:52 +02:00
Jim Meyering
0d75784da0 * NEWS: Move shuf --zero-terminated item into bug-fixes section. 2008-07-27 22:21:14 +02:00
Mikael Magnusson
cbdcc9fb4e shuf: correctly document --head-count
* src/shuf.c (usage): Correct --help output.
* doc/coreutils.texi: Correct option listing.
* NEWS: Mention correction.
2008-07-27 22:18:06 +02:00
Jim Meyering
bee58d8a04 shuf: honor --zero-terminated option even with --input-range=LO-HI
* src/shuf.c (write_permuted_output): Add EOLBYTE parameter and use
it rather than hard-coding "\n".
(main): Adjust sole caller.
* tests/misc/shuf: Add a test to exercise this bug fix.
* NEWS: Mention it.
2008-07-27 15:25:27 +02:00
Jim Meyering
e535754fdb dd: minor fullblock changes
* src/dd.c (O_FULLBLOCK): Define using an enum, not #define.
Derive the value, rather than hard-coding to one that might conflict.
(usage): Mention iflag=fullblock in --help output.
(scanargs): Reset the O_FULLBLOCK bit, so that we don't try to set
an undefined attribute via fcntl (fd, F_SETFL, ...
* tests/dd/misc: Signal framework_failure when necessary.
Use "compare actual expected", so any diffs look "right".
* NEWS (dd): Alphabetize and reword.
* coreutils.texi (dd invocation): Adjust wording.
2008-07-23 15:55:45 +02:00
Kamil Dudka
f674a10f7e dd: new option: iflag=fullblock to accumulate full input blocks
* src/dd.c (iread_fullblock): New function for reading full blocks.
(scanargs): Check for new parameter iflag=fullblock.
(skip): Use iread_fnc pointer instead of iread function.
(dd_copy): Use iread_fnc pointer instead of iread function.
* tests/dd/misc: Add test for dd - read full blocks.
* doc/coretuils.texi: Mention new parameter iflag=fullblock.
* NEWS: Mentioned the change.
2008-07-23 15:55:45 +02:00
Jim Meyering
4fff95cfe1 dd: adjust --help output so help2man formats the man page properly
* src/dd.c (usage): Use two spaces (not one) to separate
"directory" from its description, so help2man formats
the derived man page properly.
2008-07-23 15:50:40 +02:00
Reuben Thomas
77d97a1be4 doc: add example .bashrc code for a ~/.dircolors file
* coreutils.texi: Add tip for .bashrc use from Jim Meyering.
2008-07-23 09:11:53 +02:00
Jim Meyering
f82c5ba71e tests: do not run chmod on a prefix of space-embedded tmpdir
* TESTS/test-lib.sh (remove_tmp_): New function.
(trap 0): Use it instead of open-coded (and misquoted) version.
2008-07-22 13:15:02 +02:00
Jim Meyering
9bb0d5766e tests: ensure "make check" w/tainted build dir no longer impacts $HOME
* maint.mk (taint-distcheck): New rule.
(maintainer-distcheck): Make it.
2008-07-22 13:15:02 +02:00
Ralf Wildenhues
1ee81530c0 tests: again, do not change the mode of all directories below $HOME
* tests/CuTmpdir.pm (chmod_tree): Do not run chmod on undefined
argument, can happen when the build path contains spaces.
2008-07-22 13:15:02 +02:00
Jim Meyering
ecb0ea20ca * THANKS: Update, now that I have a name for jemm4jemm. 2008-07-19 15:42:49 +02:00
Andreas Schwab
9a221e27f5 mknod: correct misplaced -Z description in --help output
* src/mknod.c (usage): Put it after the "Mandatory arguments..." line.
2008-07-18 17:51:58 +02:00
Jim Meyering
4e6af68846 dircolors.hin: add Ogg/Theora-related extensions
* dircolors.hin: Add extensions from
http://wiki.xiph.org/index.php/MIME_Types_and_File_Extensions
Suggestion from jemm4jemm@yahoo.com.
2008-07-16 15:29:11 +02:00
Jim Meyering
186b45aaed * HACKING: describe how to find a misplaced change-set 2008-07-16 15:29:04 +02:00
Jim Meyering
773be9eca8 fix two bugs in ptx
* src/ptx.c (fix_output_parameters): Don't let before_max_width
go negative -- that would cause an infloop in define_all_fields.
(main): Don't clobber name[0] with lists of two or more input files.
* tests/misc/ptx: New file.  Test for the above.
* tests/Makefile.am (TESTS): Add misc/ptx.
2008-07-15 08:30:38 +02:00
Pádraig Brady
8461d49df0 tests: expand: test for lines starting with both spaces and tabs
The expand released in current distributions (Fedora Core 4 - Fedora 9
at least), doesn't expand --initial tabs if spaces are present.

tests/misc/expand: Add test to verify --initial works correctly
with lines starting with both spaces and tabs.
2008-07-11 14:03:23 +02:00
Jim Meyering
b1a1fcbf57 make check: accommodate stricter POSIX-conforming shells
Without this, test-related variable settings were not exported to
the shell_or_perl_ function when using dash or Solaris 11's /bin/sh.
* tests/check.mk (TESTS_ENVIRONMENT): Use an explicit "export",
so as not to rely on non-POSIX behavior of some /bin/sh (e.g.,
bash-based ones).
2008-07-10 08:41:28 +02:00
Jim Meyering
0fb0a03c5c * bootstrap: Remove $bt and $bt2 also when not using gettext. 2008-07-06 23:15:23 +02:00
Jim Meyering
63467fa187 who -r: don't print "last=" when the corresponding byte is unprintable
* src/who.c (print_runlevel): Print last=%c only when the "preceding
run-level" byte is printable.  Reported by Gian Piero De Lolliis in
<http://bugzilla.redhat.com/453249>.
2008-07-04 16:34:39 +02:00
Ondřej Vašík
5483165b12 doc: describe who's -p, -r, and -t options
* doc/coreutils.texi (who invocation):
2008-07-04 16:03:50 +02:00
Jim Meyering
9a4e22d036 install with just-built ./ginstall only when not cross-compiling
* src/Makefile.am (install-exec-am): ...otherwise, use the default
value, $(INSTALL_PROGRAM).  Reported by Brian Silverman.
2008-07-04 09:46:31 +02:00
Jim Meyering
bba4d3e054 * README-hacking: Update the section on LZMA. 2008-07-04 09:46:31 +02:00
Pádraig Brady
760bc6f7e7 truncate: ignore whitespace in --size parameters
Without this, `truncate -s '> -1' F` would truncate F to length 0,
and `truncate -s " +1" F` would truncate F to 1 byte.  Now, each
elicits a diagnostic.
* src/truncate.c: Skip leading white space in the --size option
argument and any white space after one of the relative modifiers,
so that the presence of a +/- modifier can be detected reliably.
* tests/misc/truncate-parameters: Add tests for the above.
2008-06-30 10:23:17 +02:00
Jim Meyering
9396eb9037 doc: add "..." to Usage, to indicate there may be multiple OPTIONs
* src/base64.c (usage): Likewise.
* src/cat.c (usage): Likewise.
* src/md5sum.c (usage): Likewise.
* src/mkdir.c (usage): Likewise.
* src/mkfifo.c (usage): Likewise.
* src/split.c (usage): Likewise.
* src/stat.c (usage): Likewise.
Heiko Marr reported the problem with mkdir.
2008-06-28 10:03:27 +02:00
Jim Meyering
8da8dfc470 mkfifo: correct misplaced -Z description in --help output
* src/mkfifo.c (usage): Put it *after* the "Mandatory arguments..." line.
2008-06-28 09:48:11 +02:00
Jim Meyering
1d9b3de948 uniq: remove redundant test
* src/uniq.c (find_field): Remove redundant test in outer loop-
termination expression. Also, add a "const" attribute.
2008-06-28 00:12:40 +02:00
Pádraig Brady
f38003890b timeout: fix invalid argument tests
* tests/misc/timeout-parameters: Remove test for invalid
signal number (we don't know what signal numbers are
invalid on all systems). Also tweak the other invalid
signal check so that the rest of the arguments are correct.
2008-06-27 17:46:52 +02:00
Jim Meyering
5b610a06b2 avoid a -Wsign-compare warning
* src/tee.c (tee_files): Swap fwrite's size/n_elem args and
compare the return value against "1".
2008-06-27 16:34:00 +02:00
Jim Meyering
5cc42f7de6 base64: don't rely on feof returning 0/1
* src/base64.c (do_decode): feof is specified to return nonzero,
not 0/1, so use "k < 1 + !!feof(in)" as the loop termination test.
2008-06-27 16:26:05 +02:00
Pádraig Brady
0a98d79bd2 truncate: silence -Wsign-compare warnings
* src/truncate.c: Cast signed to unsigned to
confirm intent which will silence -Wsign-compare warnings
2008-06-27 16:02:54 +02:00
Jim Meyering
a676856285 factor out time_t-to-string conversion idiom
* src/system.h: Include "inttostr.h".
(timetostr): New function, factored out of...
* src/date.c (show_date): Use timetostr.
* src/du.c (show_date): Likewise.
* src/ls.c (print_long_format): Likewise.
* src/pinky.c (time_string): Likewise.
* src/stat.c (human_time): Likewise.
* src/*.c: Don't include inttostr.h, since system.h does.
* src/c99-to-c89.diff: Adjust offsets.
2008-06-27 10:54:23 +02:00
Pádraig Brady
e2dbcee444 truncate: Fix integer portability issues
* src/truncate.c: Explicitly convert from off_t to intmax_t
when printing numbers as they may be different types.
Also don't mix size_t and off_t types in operations as
the latter will be promoted to unsigned when these types
are the same size.
2008-06-27 08:11:21 +02:00
Jim Meyering
8ce745dc61 tests: adjust c99-to-c89 patch as well as the code to generate it
* maint.mk (patch-check) [REGEN_PATCH]: Trim some trailing blanks.
* src/c99-to-c89.diff: Adjust shred.c offsets.
2008-06-26 23:31:05 +02:00
Jim Meyering
1fcd8cf8b4 tests: fix make distcheck failure due to TODO change
* maint.mk (po-check): Limit check for e.g., _(...)-marked
messages to files matching *.? and *.??, thus excluding TODO
and *.diff.
2008-06-26 22:45:57 +02:00
Jim Meyering
595fc63c42 * TODO: Add item: remove uses of imaxtostr. 2008-06-26 21:16:17 +02:00
Peter O'Gorman
58b2e1204a tests: accommodate difference in an AIX 5.3 diagnostic
* tests/mkdir/selinux: Handle different strerror (ENOTSUP) spelling.
2008-06-26 21:08:22 +02:00
Jim Meyering
27311c9e85 shred: also ignore EISDIR upon failed fsync/fdatasync on HP-UX
* src/shred.c (ignorable_sync_errno): New function.
(dosync): Use it.
Based on a patch from Peter O'Gorman.
2008-06-26 21:08:22 +02:00
Jim Meyering
556fbb5721 * HACKING: use shorter "-1" (over HEAD~1) with git format-patch 2008-06-26 21:08:22 +02:00
Jim Meyering
b1a1c9ee06 bootstrap.conf: don't list "open" specifically
It is no longer necessary to list it specifically,
now that several gnulib modules depend on the "open" module.
This reverts commit 3ea1fe588e.
2008-06-26 08:01:26 +02:00
Jim Meyering
3d309aa725 truncate: handle the case in which off_t != intmax_t
* src/truncate.c (parse_len): Use a temporary of type intmax_t,
rather than off_t; detect out of range [OFF_T_MIN..OFF_T_MAX].
(main) [IF_LINT]: Initialize, to avoid an unwarranted
"may be used uninitialized" warning.
Reported by Michael Geng.

Signed-off-by: Pádraig Brady <P@draigBrady.com>
2008-06-26 07:48:25 +02:00
Jim Meyering
4f4700cca8 basename: List David MacKenzie as the author.
* src/basename.c (AUTHORS): List David as the author.
* AUTHORS: Update here, too.
2008-06-23 14:54:33 +02:00
Ondřej Vašík
2e6fa14d16 echo: use AUTHORS from bash's built-in echo
* AUTHORS,src/echo.c: Use bash builtin echo authors instead of FIXME unknown
2008-06-23 14:46:05 +02:00
Jim Meyering
3ea1fe588e use gnulib's "open" module
* bootstrap.conf (gnulib_modules): Add open.
This is required at least for Solaris 9 and HP-UX 11, to
avoid a truncate test failure.  For details, see this thread:
http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/13755
2008-06-22 18:57:39 +02:00
Jim Meyering
574f761403 stat: warn that the --context (-Z) option (a no-op) is obsolete
* src/stat.c (main): It will be removed in a couple years.
* NEWS (Change in behavior): Mention this.
2008-06-22 12:27:49 +02:00
Jim Meyering
c1aabf84e6 make "make syntax-check" quieter
* maint.mk (po-check, makefile-check, sc_proper_name_utf8_requires_ICONV):
Add "@" prefix.
2008-06-20 11:30:34 +02:00
Bo Borgerson
02bfd65480 sort: Fix bug where --batch-size option shrank SORT_SIZE.
* src/sort.c (specify_nmerge, main): Only adjust SORT_SIZE if it's already set.
* tests/misc/sort-merge: Test bug fix.
2008-06-20 08:47:28 +02:00
Jim Meyering
2c88abe2a2 tests: avoid test failure when root's primary group-ID is not 0
* tests/cp/preserve-gid: Expect a cp-without-`-p'-created file to
have a group ID of $(id -g).  Reported by Jarod Wilson.  Details in
http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/13803/focus=13837
2008-06-19 09:20:31 +02:00
Jim Meyering
7d10e30088 tests: avoid root-only test failure when run in a chroot
* tests/misc/runcon-no-reorder: Accept the diagnostic that is
produced when running in a chroot without /selinux/context.
Reported by Jarod Wilson.  Details in
http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/13803/focus=13837
2008-06-19 09:20:31 +02:00
Jim Meyering
61f94d4dbc * tests/check.mk: Fix a typo in a comment. 2008-06-18 10:01:54 +02:00
Jim Meyering
a087f17a44 doc: fix a syntax error
* coreutils.texi (du invocation): Add missing comma.
2008-06-17 23:34:47 +02:00
Bo Borgerson
20905b0cdc sort: accept new option --batch-size=NMERGE
* src/sort.c: (static unsigned int nmerge) Replace constant NMERGE.
(specify_nmerge) Validate and apply new option.
(mergefps) Replace some arrays with pointers to xnmalloc'd storage.
* tests/misc/sort-merge: Test new option.
* doc/coreutils.texi: Describe new option.
* NEWS: Advertise new option.
2008-06-17 22:36:51 +02:00
Bo Borgerson
322c6f2e5c sort: add new option --files0-from=F
* src/sort.c: Support new option.
* tests/misc/sort-files0-from: Test new option.
* tests/misc/Makefile.am: Indicate new test.
* docs/coreutils.texi: Explain new option.
* NEWS: Advertise new option.

Signed-off-by: Bo Borgerson <gigabo@gmail.com>
2008-06-17 08:50:41 +02:00
Bo Borgerson
3435bb7f40 HACKING: Add section for tips on reducing translator workload.
* HACKING (Be nice to translators): New section.
Add Jim's suggestion to avoid changing translatable strings if possible.
2008-06-17 08:29:23 +02:00
Jim Meyering
96ae7199c4 * THANKS: Add name and email for Carl Roth. 2008-06-17 08:18:49 +02:00
Eric Blake
a7a328af0f ls, od: avoid redundant const
* src/ls.c (long_time_format, sort_functions): Avoid redundant const.
* src/od.c (charname): Likewise.
* maint.mk (sc_redundant_const): Add rule to detect this.
2008-06-17 08:17:14 +02:00
Bo Borgerson
94cecb5cf6 join: improve memory management
* src/join.c (struct seq): Use a (struct line **) for `lines' rather than
one long (struct line *).  This allows individual lines to be swapped out
if necessary.
(reset_line): Get a line ready for new input.
(init_linep): Create a new line and assign it to the the pointer passed in.
(spareline[2]): Hold a spare line for each input file.
(free_spareline): Clean up.
(get_line): Take a (struct line **) instead of a (struct line *).  If the
line to be overwritten is the previous line for the current file then swap
it out for the spare.
(join): Accomodate new structure of SEQs and new parameters to get_line;
Don't free stale lines until the end -- they're re-usable now.
(dup_line): Remove function.
* NEWS: Mention the performance improvement.
2008-06-17 00:52:30 +02:00
Ralf Wildenhues
58db1bb942 * doc/coreutils.texi (join invocation): Drop leading blanks. 2008-06-16 19:58:53 +02:00
Jim Meyering
45e67188d6 remove redundant const directives
In 1463824d8e, I added some
missing "const" directives, as well as some new, redundant ones.
This removes the redundant ones.  Pointed out by Eric Blake.
* base64.c, cat.c, chcon.c, chgrp.c, chmod.c, chown.c, comm.c:
* cp.c, csplit.c, cut.c, date.c, dd.c, df.c, dircolors.c, du.c:
* env.c, expand.c, fmt.c, fold.c, groups.c, head.c, id.c:
* install.c, join.c, kill.c, ln.c, ls.c, md5sum.c, mkdir.c:
* mkfifo.c, mknod.c, mktemp.c, mv.c, nice.c, nl.c, od.c:
* paste.c, pathchk.c, pinky.c, pr.c, ptx.c, readlink.c, rm.c:
* rmdir.c, runcon.c, seq.c, shred.c, shuf.c, sort.c, split.c:
* stat.c, stty.c, su.c, sum.c, tac.c, tail.c, tee.c, timeout.c:
* touch.c, tr.c, truncate.c, tty.c, uname.c, unexpand.c, uniq.c:
* wc.c, who.c: Remove redundant const directives.
* maint.mk (sc_const_long_option): Don't require redundant "const".
2008-06-16 16:40:59 +02:00
Jim Meyering
3de1559830 chcon: correct --verbose output to include newlines
* src/chcon.c (process_file): Append "\n" to --verbose diagnostic.
* tests/misc/chcon: Add a test for the above.
* NEWS: mention the bug fix
Reported by Carl D. Roth in http://bugzilla.redhat.com/451478.
2008-06-16 13:42:01 +02:00
Jim Meyering
956abf969c address root cause of compilation failures:
The affected code wasn't even being compiled on my system,
because HAVE_NL_LANGINFO was not defined.  On other systems, where
vasnprintf.m4 determines it needs %A or %a replacement support, it
_would_ check for nl_langinfo, and expose the compilation failure.
* m4/jm-macros.m4: Check for nl_langinfo, required by sort.c.
2008-06-15 18:57:13 +02:00
Jim Meyering
b1db942595 fix the compilation failure for real
* src/sort.c (monthtab): Neither "const" may be added.
2008-06-15 18:52:27 +02:00
Jim Meyering
2cbbbf6319 fix a const-related compilation failure in sort.c
* src/sort.c (monthtab): Remove overzealous "const".
Table entries are modified in an #if HAVE_NL_LANGINFO block.
Introduced by 1463824d8e.
2008-06-15 16:28:48 +02:00
Jim Meyering
837bb31803 update HACKING guidelines
* HACKING: Don't suggest --signoff; it's redundant.
(log requirements): Specify preferred forms.
Mention preference for "<" over ">".
Mention the "const placement" preference.
2008-06-15 16:01:29 +02:00
Jim Meyering
44530f2ddd run gnulib-tests in parallel
* tests/Makefile.am: Define AUTOMAKE_OPTIONS, so check.mk can append.
* tests/check.mk: Define SUFFIXES, so check.mk can append.
* build-aux/check.mk (SUFFIXES): Append, so as not to evoke
automake warning the prior definition in gnulib-tests/gnulib.mk.
(AUTOMAKE_OPTIONS): Likewise.
* gnulib-tests/Makefile.am (TEST_LOGS): Define.
Include build-aux/check.mk
2008-06-14 22:35:02 +02:00
Jim Meyering
9823682c2f * maint.mk (sc_proper_name_utf8_requires_ICONV) Fix typo in diagnostic. 2008-06-14 22:26:29 +02:00
Jim Meyering
1463824d8e add "const" attribute, where possible
* maint.mk (sc_const_long_option): New rule.  Enforce global change.
* src/base64.c (long_options): Use "const" where possible.
* src/cat.c (main): Likewise.
* src/chcon.c (long_options): Likewise.
* src/chgrp.c (long_options): Likewise.
* src/chmod.c (long_options): Likewise.
* src/chown.c (long_options): Likewise.
* src/comm.c (long_options, OUTPUT_DELIMITER_OPTION): Likewise.
* src/cp.c (long_opts): Likewise.
* src/csplit.c (longopts): Likewise.
* src/cut.c (longopts): Likewise.
* src/date.c (long_options): Likewise.
* src/dd.c (conversions, flags, statuses): Likewise.
* src/df.c (long_options): Likewise.
* src/dircolors.c (long_options): Likewise.
* src/du.c (long_options): Likewise.
* src/env.c (longopts): Likewise.
* src/expand.c (longopts): Likewise.
* src/fmt.c (long_options): Likewise.
* src/fold.c (longopts): Likewise.
* src/groups.c (longopts): Likewise.
* src/head.c (long_options): Likewise.
* src/id.c (longopts): Likewise.
* src/install.c (long_options): Likewise.
* src/join.c (longopts): Likewise.
* src/kill.c (long_options): Likewise.
* src/ln.c (long_options): Likewise.
* src/ls.c (long_time_format, long_options, sort_functions): Likewise.
* src/md5sum.c (long_options): Likewise.
* src/mkdir.c (longopts): Likewise.
* src/mkfifo.c (longopts): Likewise.
* src/mknod.c (longopts): Likewise.
* src/mktemp.c (longopts): Likewise.
* src/mv.c (long_options): Likewise.
* src/nice.c (longopts): Likewise.
* src/nl.c (longopts): Likewise.
* src/od.c (charname, long_options): Likewise.
* src/paste.c (longopts): Likewise.
* src/pathchk.c (longopts): Likewise.
* src/pinky.c (longopts): Likewise.
* src/pr.c (long_options): Likewise.
* src/ptx.c (long_options): Likewise.
* src/readlink.c (longopts): Likewise.
* src/rm.c (long_opts): Likewise.
* src/rmdir.c (longopts): Likewise.
* src/runcon.c (long_options): Likewise.
* src/seq.c (long_options): Likewise.
* src/shred.c (long_opts): Likewise.
* src/shuf.c (long_opts): Likewise.
* src/sort.c (monthtab, long_options): Likewise.
* src/split.c (longopts): Likewise.
* src/stat.c (long_options): Likewise.
* src/stty.c (mode_info, control_info, longopts, set_mode) Likewise.
(set_control_char, speeds): Likewise.
* src/su.c (longopts): Likewise.
* src/sum.c (longopts): Likewise.
* src/tac.c (longopts): Likewise.
* src/tail.c (long_options): Likewise.
* src/tee.c (long_options): Likewise.
* src/timeout.c (long_options): Likewise.
* src/touch.c (longopts): Likewise.
* src/tr.c (long_options): Likewise.
* src/truncate.c (longopts): Likewise.
* src/tty.c (longopts): Likewise.
* src/uname.c (uname_long_options, arch_long_options): Likewise.
* src/unexpand.c (longopts): Likewise.
* src/uniq.c (longopts): Likewise.
* src/wc.c (longopts): Likewise.
* src/who.c (longopts): Likewise.
2008-06-14 22:24:28 +02:00
Jim Meyering
d42994df5d revert previous change, "don't use "const" with scalar types"
* src/truncate.c: There is nothing wrong with that construct.
This reverts commit d7d80c5b7b.
2008-06-14 11:04:41 +02:00
Jim Meyering
d7d80c5b7b don't use "const" with scalar types
* src/truncate.c: Several vendor compilers reject that.
See http://article.gmane.org/gmane.comp.lib.gnulib.bugs/13876
2008-06-14 09:47:44 +02:00
Eric Blake
20c0b8701f od: improve handling of padding
* src/od.c (decode_one_format): Alter the format, again.
(FMT_BYTES_ALLOCATED): Reduce size by adjusting to new format.
(MAX_INTEGRAL_TYPE_SIZE): Move earlier in the file.
(charname): Turn it into a 2D array, since there's no need for
pointers now.
(PRINT_TYPE, print_named_ascii, print_ascii): Add a width
parameter.
(write_block): Account for width parameter.
Using ideas from Paul Eggert.
2008-06-13 23:07:58 +02:00
Eric Blake
46a811b9e7 od: align multiple -t specs
* src/od.c (struct tspec): Add pad_width field, and adjust
print_function prototype.
(decode_one_format): Rewrite all fmt_string values to account for
pad width.
(FMT_BYTES_ALLOCATED): Adjust to new format style.
(main): Compute pad width per spec.
(write_block): Account for pad width.
(dump): Don't print padding-only fields.
(PRINT_TYPE, print_named_ascii, print_ascii): All print functions
adjusted to use variable pad width.
* tests/Makefile.am (TESTS): Add test.
* tests/misc/od-multiple-t: New file.
* THANKS: Update.
* NEWS: Mention the improvement.
Reported by Gary Johnson.
2008-06-13 23:06:03 +02:00
Eric Blake
bbbc35c9ed od: use gnulib printf replacement as necessary
* src/od.c (includes): Add xprintf.h.
(PRINT_TYPE): New macro, using xprintf instead of printf.
(print_s_char, print_char, print_s_short, print_short, print_int)
(print_long, print_long_long, print_float, print_double)
(print_long_double): Factor into PRINT_TYPE macro.
(print_named_ascii, print_ascii): Use xprintf.
* NEWS: Mention this as a bug fix.
2008-06-13 23:00:04 +02:00
Eric Blake
c49b2e32bb od: simplify long double support
* m4/jm-macros.m4 (gl_CHECK_ALL_TYPES): Remove obsolete check for
AC_C_LONG_DOUBLE.
* src/od.c (LONG_DOUBLE): Delete.
(width_bytes, MAX_FP_TYPE_SIZE, decode_one_format, main): Just use
'long double' directly.
(print_long_double): No longer protect by HAVE_LONG_DOUBLE.
2008-06-13 22:46:50 +02:00
Eric Blake
b83c498809 doc: od defaults to -toS, not -td2
* src/od.c (usage): Correct description of default.
2008-06-13 22:46:50 +02:00
Jim Meyering
6c79825ce9 skip (don't fail) root-only tests for common set-up failures
Address 2 of 4 failures reported by Jarod Wilson in
http://bugzilla.redhat.com/442352.  More details here:
http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/13803
* tests/cp/cp-a-selinux: Skip the test if "mkfs -t ext2" fails.
* tests/rm/fail-2eperm: Skip the test if "rm" is not accessible.
2008-06-13 22:45:50 +02:00
Jim Meyering
3808eccbbf tweak to conform with syntax policy
Use "<" or "<=" rather than ">" or ">=".
Use "Type const *", rather than "const Type *".
2008-06-12 21:38:17 +02:00
Bo Borgerson
81d0c8f367 comm: accept new option: --output-delimiter=STR
* src/comm.c (delimiter): New global.
(writeline): Use delimiter string instead of single TAB character.
(main): Initialize delimiter.
* tests/misc/comm: Add tests for comm output delimiter specification.
* doc/coreutils.texi: Document new option.
* NEWS: Advertise new option.
* TODO: Remove associated item.
2008-06-12 21:03:05 +02:00
Bo Borgerson
98a96822d9 comm: ensure that input files are sorted
* NEWS: List new behavior.
* doc/coreutils.texi (checkOrderOption) New macro for
describing `--check-order' and `--nocheck-order', used in
both join and comm.
* src/comm.c (main): Initialize new options.
(usage): Describe new options.
(compare_files): Keep an extra pair of buffers for the previous
line from each file to check the internal order.
(check_order): If an order-check is required, compare and handle
the result appropriately.
(copylinebuffer): Copy a linebuffer; used for copy before read.
* tests/misc/Makefile.am: List new test.
* tests/misc/comm: Tests for the comm program, including the
new order-checking functionality and attendant command-line options.
2008-06-12 19:38:43 +02:00
Jim Meyering
5f47278372 fix another unportable use of 'tr'
* configure.ac [EXTRA_PROGRAMS]: Add omitted space in tr's STRING2.
Spotted by Denis Excoffier, upon Solaris 8 build failure.
2008-06-11 14:18:36 +02:00
Jim Meyering
47ed009e57 tests: skip a chown test on FreeBSD 6.x
* tests/chown/separator: Skip this test if is likely to fail
due to the combination of a bogus group name and a broken
getgrnam function.
2008-06-11 11:52:03 +02:00
Jim Meyering
394f88c4aa tests: remove duplicate mention of misc/selinux
* tests/Makefile.am (TESTS): Remove misc/selinux, since it's
already listed in $(root_tests).
2008-06-11 11:02:32 +02:00
Bruno Haible
8253a9aeb4 fix build failure on AIX 4
* configure.ac: Fix unportable invocation of 'tr', introduced on
2008-04-22.  Affects tr from at least AIX 4.3.2.
2008-06-11 08:09:46 +02:00
Pádraig Brady
a16bee4f07 remove test for specific diagnostic when truncating missing directory
Solaris 10 returns ENOTDIR when truncating a nonexistent directory,
whereas Linux returns EISDIR (because it has a trailing /).
* tests/misc/truncate-fail-diag: Remove the test for the specific error.
2008-06-10 08:32:52 +02:00
Pádraig Brady
e63c9825da timeout: use system-independent exit values
Change exit values from ETIMEDOUT and ECANCELED,
the values of which are system dependent, to
124 and 125 respectively.
* src/timeout.c (EXIT_TIMEDOUT, EXIT_CANCELED): Define.
(usage, main): Adjust.
* coreutils.texi (timeout invocation): Update.
* tests/misc/timeout: Adjust.
2008-06-10 08:27:52 +02:00
Jim Meyering
263bb1be67 enforce the proper_name_utf8-requires-ICONV link rule
* maint.mk (sc_proper_name_utf8_requires_ICONV): New rule.
* src/Makefile.am (timeout_LDADD, truncate_LDADD): Add $(LIBICONV).
2008-06-09 10:54:57 +02:00
Bruno Haible
23c2a0cbac * NEWS (Improvements): Mention improved (via gnulib) ACL support. 2008-06-09 09:11:04 +02:00
Jim Meyering
252d6d01c9 maint.mk: my-distcheck runs $(MAKE) syntax-check once again
* maint.mk (my-distcheck): Run $(MAKE) syntax-check once again.
Run "$(MAKE) check" _after_ the less expensive syntax-check.
2008-06-08 12:33:28 +02:00
Bo Borgerson
6eec737ade standardize some error messages
* maint.mk: (sc_error_message_warn_fatal, sc_error_message_uppercase):
(sc_error_message_period): Add automatic checks for non-standard error
messages.
* .x-sc_error_message_uppercase: explicit exclusion for this check
* src/cp.c: Standardize some error messages.
* src/date.c: Likewise.
* src/dircolors.c: Likewise.
* src/du.c: Likewise.
* src/expr.c: Likewise.
* src/install.c: Likewise.
* src/join.c: Likewise.
* src/ln.c: Likewise.
* src/mv.c: Likewise.
* src/od.c: Likewise.
* src/pr.c: Likewise.
* src/split.c: Likewise.
* src/truncate.c: Likewise.
* src/wc.c: Likewise.
* tests/du/files0-from: Expect new error message.
* tests/misc/join: Likewise.
* tests/misc/split-a: Likewise.
* tests/misc/wc-files0-from: Likewise.
* tests/misc/xstrtol: Likewise.
* lib/xmemxfrm.c: Likewise.
2008-06-08 12:11:47 +02:00
Jim Meyering
68158e6b10 syntax-check: detect anachronistic Perl-based tests
* maint.mk (sc_no_exec_perl_coreutils): Rename and rewrite.
2008-06-08 10:30:50 +02:00
Pádraig Brady
75e0047c4b Add new program: truncate
* AUTHORS: Register as the author
* NEWS: Mention this change
* README: Add truncate command to list
* src/truncate.c: New command
* src/Makefile.am: Add truncate command to list to build
* src/.gitignore: Add truncate binary to list to ignore
* doc/coreutils.texi (truncate invocation): Add truncate info
* man/Makefile.am: Add truncate man page to list to build
* man/truncate.x: Add truncate man page template
* po/POTFILES.in: Add truncate to list to translate
* tests/Makefile.am: Add truncate tests
* tests/misc/help-version: Add support for new truncate command
* tests/misc/truncate-dangling-symlink: check dangling link ok
* tests/misc/truncate-dir-fail: ensure dirs fail
* tests/misc/truncate-fail-diag: validate messages for missing paths
* tests/misc/truncate-fifo: ensure fifos ignored
* tests/misc/truncate-no-create-missing: ensure -c option honoured
* tests/misc/truncate-overflow: check signed integer overflows
* tests/misc/truncate-owned-by-other: root permissions check
* tests/misc/truncate-parameters: check invalid parameter combinations
* tests/misc/truncate-relative: check invalid relative sizes
2008-06-06 14:16:45 +02:00
Eric Blake
74c0bfbc4c improve 'date +%C' documentation
* src/date.c (usage): Use 20, not 21, for current century.
* THANKS: Update.
Reported by Dameon G. Rogers, fix suggested by Philip Rowlands.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-06-06 08:22:02 +02:00
Jim Meyering
80213bc66d nice.c: avoid a cast
* src/nice.c (main): Use argv[0], rather than
"program_name with a cast".  Suggestion from Eric Blake.
2008-06-03 13:58:07 +02:00
Jim Meyering
4b92612944 adjust c99-to-c89 patch as well as the code to generate it
* maint.mk (patch-check) [REGEN_PATCH]: Eliminate date-related
differences in generated diffs.
* src/c99-to-c89.diff: Adjust offsets.
2008-06-03 10:33:17 +02:00
Jim Meyering
896b672499 use gnulib's progname module
* bootstrap.conf (gnulib_modules): Add progname.
* src/*.c (program_name): Remove declaration.
* (main): Call set_program_name rather than setting program_name.
* src/nice.c (main): Cast program_name to "(char *)".
* src/prog-fprintf.c: Include "system.h"
* src/system.h: Include "progname.h".
* maint.mk (sc_program_name): Adjust rule.
Suggestion from Eric Blake.
2008-06-03 09:15:00 +02:00
Jim Meyering
1b0b6c8d08 remove duplicate definition of matchpathcon_init_prefix
* gl/lib/se-selinux.in.h (matchpathcon_init_prefix): Remove definition.
It is already defined there.  Reported by Eric Blake.
2008-06-03 07:44:09 +02:00
Jim Meyering
cc4bdb92f9 fix cpp indentation policy violations
* src/copy.c (mkfifo): Indent nested "# define".
* src/timeout.c (ECANCELED): Likewise.
2008-06-02 21:47:19 +02:00
Jim Meyering
0647f3eb5a accommodate older SELinux which lacks matchpathcon_init_prefix
* m4/jm-macros.m4: Check for matchpathcon_init_prefix.
* src/install.c [!HAVE_MATCHPATHCON_INIT_PREFIX]
(matchpathcon_init_prefix): Define away.
* gl/lib/se-selinux.in.h (matchpathcon_init_prefix): Define.
Reported by Ilya N. Golubev in
<http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/13686>.
2008-06-02 21:34:40 +02:00
Jim Meyering
77b1bfc85c each file with a "main" must also declare program_name
* maint.mk (sc_program_name): New rule.
* .x-sc_program_name: New file.
* Makefile.am (EXTRA_DIST): Add .x-sc_program_name.
2008-06-02 18:50:00 +02:00
Jim Meyering
434258ca73 declare program_name consistently
* src/base64.c: Likewise.
* src/basename.c: Likewise.
* src/cat.c: Likewise.
* src/chcon.c: Likewise.
* src/chgrp.c: Likewise.
* src/chmod.c: Likewise.
* src/chown.c: Likewise.
* src/chroot.c: Likewise.
* src/cksum.c: Likewise.
* src/comm.c: Likewise.
* src/cp.c: Likewise.
* src/csplit.c: Likewise.
* src/cut.c: Likewise.
* src/date.c: Likewise.
* src/dd.c: Likewise.
* src/df.c: Likewise.
* src/dircolors.c: Likewise.
* src/dirname.c: Likewise.
* src/du.c: Likewise.
* src/echo.c: Likewise.
* src/env.c: Likewise.
* src/expand.c: Likewise.
* src/expr.c: Likewise.
* src/factor.c: Likewise.
* src/fmt.c: Likewise.
* src/fold.c: Likewise.
* src/groups.c: Likewise.
* src/head.c: Likewise.
* src/hostid.c: Likewise.
* src/hostname.c: Likewise.
* src/id.c: Likewise.
* src/install.c: Likewise.
* src/join.c: Likewise.
* src/kill.c: Likewise.
* src/link.c: Likewise.
* src/ln.c: Likewise.
* src/logname.c: Likewise.
* src/ls.c: Likewise.
* src/md5sum.c: Likewise.
* src/mkdir.c: Likewise.
* src/mkfifo.c: Likewise.
* src/mknod.c: Likewise.
* src/mktemp.c: Likewise.
* src/mv.c: Likewise.
* src/nice.c: Likewise.
* src/nl.c: Likewise.
* src/nohup.c: Likewise.
* src/od.c: Likewise.
* src/paste.c: Likewise.
* src/pathchk.c: Likewise.
* src/pinky.c: Likewise.
* src/pr.c: Likewise.
* src/printenv.c: Likewise.
* src/printf.c: Likewise.
* src/ptx.c: Likewise.
* src/pwd.c: Likewise.
* src/readlink.c: Likewise.
* src/rm.c: Likewise.
* src/rmdir.c: Likewise.
* src/runcon.c: Likewise.
* src/seq.c: Likewise.
* src/setuidgid.c: Likewise.
* src/shuf.c: Likewise.
* src/sleep.c: Likewise.
* src/sort.c: Likewise.
* src/split.c: Likewise.
* src/stat.c: Likewise.
* src/stty.c: Likewise.
* src/su.c: Likewise.
* src/sum.c: Likewise.
* src/sync.c: Likewise.
* src/tac.c: Likewise.
* src/tail.c: Likewise.
* src/tee.c: Likewise.
* src/test.c: Likewise.
* src/timeout.c: Likewise.
* src/touch.c: Likewise.
* src/tr.c: Likewise.
* src/true.c: Likewise.
* src/tsort.c: Likewise.
* src/tty.c: Likewise.
* src/uname.c: Likewise.
* src/unexpand.c: Likewise.
* src/uniq.c: Likewise.
* src/unlink.c: Likewise.
* src/uptime.c: Likewise.
* src/users.c: Likewise.
* src/wc.c: Likewise.
* src/who.c: Likewise.
* src/whoami.c: Likewise.
* src/yes.c: Likewise.
2008-06-02 17:47:32 +02:00
Eric Blake
eebe731014 export program_name, required by gnulib
* src/timeout.c (program_name): Export.
2008-06-02 16:04:50 +02:00
Jim Meyering
91c1384602 revert inadvertent change in last patch
* configure.ac (AM_INIT_AUTOMAKE): Restore accidentally-modified
options.  Spotted by Eric Blake.
2008-06-02 15:07:37 +02:00
Pádraig Brady
265c4b83a8 new program: timeout
* AUTHORS: Register as the author.
* NEWS: Mention this change.
* README: Add timeout command to list.
* src/timeout.c: New file.
* src/kill.c (operand2sig): Move function to its own file,
now that timeout.c will also use it.
* src/operand2sig.c (operand2sig): New file, extracted from kill.c.
* src/operand2sig.h (operand2sig): Declare.
* src/Makefile.am (EXTRA_PROGRAMS): Add timeout.
* src/.gitignore: Add timeout binary to list to ignore.
* doc/coreutils.texi (timeout invocation): Add timeout info.
(Signal specifications): New section, also referenced by kill.
* man/Makefile.am (timeout.1): Add dependency.
* man/timeout.x: New file.
* po/POTFILES.in: Add timeout.c and operand2sig.c to list to translate.
* tests/Makefile.am (TESTS): Add the two new tests.
* tests/misc/help-version: Add support for new timeout command.
* tests/misc/invalid-opt: Add support for new timeout command.
* tests/misc/timeout: New file: check basic timeout operation.
* tests/misc/timeout-parameters: New file: check invalid parameter
combinations.
2008-06-02 14:40:26 +02:00
Jim Meyering
4a510cd399 spell author names consistently
* src/comm.c (AUTHORS): Use RMS' middle initial.
* src/ls.c (AUTHORS): Likewise.
* src/rm.c (AUTHORS): Likewise.
* src/uniq.c (AUTHORS): Likewise.
* src/cut.c (AUTHORS): Use David M. Ihnat's middle initial.
* AUTHORS: Update to match.
Reported by Michael Piefel.
2008-06-02 14:12:59 +02:00
Simon Josefsson
ecb67c8389 doc: adjust base64 documentation
* coreutils.texi (base64 invocation): Use RFC 4648 as the specification.
Move the URL down a bit in the text.
2008-06-01 18:02:32 +02:00
Erik Auerswald
86535835fe md5sum: new option, --quiet, to suppress OK messages
sha1sum, sha224sum, sha384sum, and sha512sum accept it, too.
* src/md5sum.c: add option --quiet to suppress OK messages
* doc/coreutils.texi: document option --quiet
* tests/misc/md5sum: add test for option --quiet
* NEWS: mention new option --quiet for md5sum+sha*sum in "New
  features" section
2008-06-01 16:55:11 +02:00
Jim Meyering
01e6181965 add rules to commit three post-release changes automatically
* maint.mk (noteworthy): Define.
(emit-commit-log): Define.
(alpha beta major): Also update NEWS and cfg.mk automatically,
and commit all three changes at once.
2008-06-01 14:48:07 +02:00
Jim Meyering
8a4192d3c0 update old_NEWS_hash
* cfg.mk (old_NEWS_hash): Update by running "make update-NEWS-hash".
Reported by Erik Auerswald.
2008-06-01 14:44:50 +02:00
Simon Josefsson
423f28be77 src/base64.c: Improve comments. 2008-06-01 13:25:57 +02:00
Jim Meyering
dd3612a12b * NEWS: add header line for next release 2008-06-01 11:00:51 +02:00
Jim Meyering
3cafcf8584 adjust format of .prev-version commit message
* maint.mk (alpha beta major): Start with "*", omit version number.
2008-06-01 10:39:13 +02:00
Jim Meyering
4db4c2aa6d * .prev-version: Record previous version. 2008-06-01 10:11:01 +02:00
Jim Meyering
d81d2e0ba6 Version 6.12.
* NEWS: Record release date.
2008-05-31 23:20:56 +02:00
Jim Meyering
eba365275b install: reenable matchpathcon-related code
The underlying performance problem is being dealt with in Automake
by limiting the number of install invocations, and in SELinux with
incremental changes as well as a potential new implementation.
* src/Makefile.am (ginstall_CPPFLAGS) [ENABLE_MATCHPATHCON]: Define.
* src/install.c [ENABLE_WHEN_MATCHPATHCON_IS_MORE_EFFICIENT]:
Rename to ENABLE_MATCHPATHCON.
* NEWS: mention this change
2008-05-31 22:42:20 +02:00
Jim Meyering
eb4b2d462e configure.ac: remove explicit use of AB_INIT
* configure.ac: Don't invoke AB_INIT directly, now that it's
done automatically via gl_INIT.
2008-05-30 14:14:43 +02:00
Jim Meyering
72df741618 tests: ignore known failure on all Darwin 8.x / Mac OS X v10.4.x
* tests/chgrp/basic: Update comment and host_triplet version test.
2008-05-30 10:45:45 +02:00
Jim Meyering
fc6827e2bb tests: avoid failure with older version of Perl's File::Temp
* tests/CuTmpdir.pm (import): Use &File::Temp::cleanup only
if it is defined.  Reported by Bruno Haible in
http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/13652
2008-05-30 09:45:53 +02:00
Jim Meyering
6c9b505329 NEWS: mention that cp -p copies permissions more portably
Based on wording suggested by Bruno Haible.
2008-05-30 09:08:51 +02:00
Jim Meyering
9f678af5f3 improve description of du's--separate-dirs option
* coreutils.texi (du invocation): Prompted by Volker Badziong's
report in http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/13646
2008-05-29 21:32:40 +02:00
Jim Meyering
8581bcc9e3 du.c: tiny cleanup (no semantic change)
* src/du.c (process_file): Use "file", rather than
equivalent "ent->fts_path".
2008-05-29 18:01:05 +02:00
Jim Meyering
00a3098235 in 280+ tests/* files, use $srcdir, not $top_srcdir/tests 2008-05-27 13:48:32 +02:00
Jim Meyering
c6c9e8730e prefer abs_srcdir over abs_top_srcdir, ...
so that e.g., tests/* may refer to absolute names without
hard-coding the name of the containing directory (tests/, here).
* tests/check.mk (TESTS_ENVIRONMENT): Define abs_srcdir.
* tests/pr/pr-tests: Use $abs_srcdir/pr not $abs_top_srcdir/tests/pr.
* tests/chmod/c-option: Use $abs_srcdir, not $abs_top_srcdir/tests.
* tests/cp/cp-parents: Likewise.
* tests/mkdir/parents: Likewise.
* tests/mkdir/perm: Likewise.
* tests/mv/acl: Likewise.
* tests/mv/backup-is-src: Likewise.
* tests/mv/hard-link-1: Likewise.
* tests/mv/into-self-2: Likewise.
* tests/mv/leak-fd: Likewise.
* tests/mv/mv-special-1: Likewise.
* tests/mv/part-fail: Likewise.
* tests/mv/part-hardlink: Likewise.
* tests/mv/part-rename: Likewise.
* tests/mv/part-symlink: Likewise.
* tests/mv/partition-perm: Likewise.
* tests/mv/sticky-to-xpart: Likewise.
* tests/mv/to-symlink: Likewise.
* tests/rm/one-file-system: Likewise.
* tests/sample-test: Likewise.
2008-05-27 13:30:44 +02:00
Jim Meyering
8976a2b27e tests: generalize my-distcheck
* maint.mk (my-distcheck): Accommodate missing gnulib-tests.
2008-05-27 12:29:57 +02:00
Jim Meyering
87386cc8a9 reflect renaming of acl.c in gnulib
* POTFILES.in: s/acl.c/set-mode-acl.c/
2008-05-26 19:42:24 +02:00
Jim Meyering
545a116748 test installation results more thoroughly
* maint.mk (my-distcheck): Ensure that properly-named binaries
are installed.  Also check all man pages, except [.1.
Move configure-time --prefix= to install-time prefix=.
(my-instcheck, install-transform-check): Define.
2008-05-26 14:34:17 +02:00
Jim Meyering
9d59509937 install many binaries at once, when possible
* src/Makefile.am (install-exec-am): Override the standard
automake-generated target, so we can decide whether to use
the usual install-one-by-one rule, or whether we can use
the new install-many-at-once rule:
(cu-install-binPROGRAMS): New rule.
2008-05-26 12:10:21 +02:00
Jim Meyering
26552f2756 * src/runcon.c: Add copyright comment. 2008-05-26 08:40:33 +02:00
Jim Meyering
86837548f1 adjust AUTHORS and check-AUTHORS rule to accommodate
* AUTHORS: Add coding: utf-8 comment at end.
Spell François' and Torbjörn's names properly.
* src/Makefile.am: Parse AUTHORS file more carefully.
Use perl to join now-split lines.
Use en_US.UTF-8 to generate --version output.
2008-05-26 08:40:33 +02:00
Jim Meyering
199d850038 * src/c99-to-c89.diff: Adjust offsets. 2008-05-26 08:40:33 +02:00
Jim Meyering
581b2e3cee adjust copyright dates 2008-05-26 08:40:33 +02:00
Jim Meyering
d8382a4d26 convert the rest to use proper_name -- manually
* src/base64.c (AUTHORS): Rename from AUTHOR, for consistency.
2008-05-26 08:40:33 +02:00
Jim Meyering
74a106985a convert 3-author programs to use proper_name
g grep -E -l 'define AUTHORS "[^,]+", "[^,]+", "[^,]+"$'|xargs perl -pi -e \
  's/(define AUTHORS) ("[^,]+"), ("[^,]+"), ("[^,]+")$/$1 \\\n  proper_name ($2), \\\n  proper_name ($3), \\\n  proper_name ($4)/'
2008-05-26 08:40:33 +02:00
Jim Meyering
be2abe31fd convert 2-author programs to use proper_name
g grep -E -l 'define AUTHORS "[^,]+", "[^,]+"$'|xargs perl -pi -e \
  's/(define AUTHORS) ("[^,]+"), ("[^,]+")$/$1 \\\n  proper_name ($2), \\\n  proper_name ($3)/'
2008-05-26 08:40:33 +02:00
Jim Meyering
b69b4cca95 convert single-author programs to use proper_name
g grep -E -l 'define AUTHORS "[^,]+"$'|xargs perl -pi -e \
  's/(define AUTHORS) ("[^,]+")$/$1 proper_name ($2)/'
2008-05-26 08:40:32 +02:00
Jim Meyering
7855cbfcac use gnulib's proper_name_utf8 function, but *not* proper_name
* bootstrap.conf (gnulib_modules): Add propername.
(XGETTEXT_OPTIONS): Add options to tell xgettext about the functions.
* src/cat.c, src/cp.c, src/df.c, src/du.c, src/split.c:
Mark Torbjörn Granlund's name.
* src/ptx.c: Mark François Pinard's name.
Use "TRANSLATORS:" comment marker, rather than "Note to translators:".
* src/system.h: Include propername.h.
(proper_name): Define away.
* src/Makefile.am (cat_LDADD, df_LDADD, du_LDADD, ptx_LDADD, split_LDADD):
Initialize, so we can...
(cat_LDADD, cp_LDADD, df_LDADD, du_LDADD, ptx_LDADD, split_LDADD):
...Use "+=" to append $(LIBICONV) for each program that uses
proper_name_utf8.
2008-05-26 08:37:08 +02:00
Jim Meyering
29290d0485 * POTFILES.in: Add lib/copy-acl.c.
Signed-off-by: Jim Meyering <meyering@redhat.com>
2008-05-24 09:29:33 +02:00
Jim Meyering
3ceabe1bfc install: avoid a leak in currently-ifdef'd-out code
* src/install.c (setdefaultfilecon)
[ENABLE_WHEN_MATCHPATHCON_IS_MORE_EFFICIENT]:
Call matchpathcon_init_prefix only once.
Suggestion from Stephen Smalley.  Reported by Ben Webb in
<http://bugzilla.redhat.com/447410>.
2008-05-20 21:35:40 +02:00
Jim Meyering
5e6a1837ea use gnulib's base64 module, now that it's sync'd to match this one
* gl/lib/base64.c: Remove file.
* gl/lib/base64.h: Remove file.
2008-05-19 19:50:34 +02:00
Pádraig Brady
76367f06b3 doc: clarify field delimiter description in uniq --help output
* src/uniq.c: Clarify in help output that field delimiters are
blanks and not the larger set of whitespace characters.
2008-05-19 13:47:14 +02:00
Jim Meyering
c4a9551eee tests: skip when a debian libc6-2.7-11 bug makes printf segfault
* tests/misc/printf-surprise: Detect case of a low-memory-provoked
segfault and skip the test (this is actually a bug in snprintf).
For details, see http://bugs.debian.org/481543
2008-05-17 08:29:00 +02:00
Jim Meyering
9300779cc8 tests: sync and update wc and du --files0-from tests
* tests/du/files0-from: Sync from tests/misc/wc-files0-from.
(minus-in-minus): New test.
Adjust for new diagnostics.
* tests/misc/wc-files0-from: Adjust for new diagnostics.
2008-05-17 08:29:00 +02:00
Jim Meyering
878e51ebfa du, wc: merge improved --files0-from=F-related diagnostics
du gave a better diagnostic for one unusual case,
and wc gave a better diagnostic for a different one.
Now each diagnoses both unusual cases.
* src/du.c (main): Disallow '-' as file name when reading from stdin.
* src/wc.c (main): Give a better diagnostic for a zero-length file name.
2008-05-17 08:28:59 +02:00
Jim Meyering
51243cdaca test invalid-option handling in all programs
* tests/Makefile.am (TESTS): Add misc/invalid-opt.
* tests/misc/invalid-opt: New file.
2008-05-17 08:28:59 +02:00
Jim Meyering
1081bbc74e tests: remove ugly /bin/sh wrapper around each perl-based test script
* tests/check.mk (TESTS_ENVIRONMENT): Save and restore TMPDIR around
envvar-check, so that the few scripts that require $TMPDIR don't fail.
This is also good to let a user's default TMPDIR setting be used e.g.,
in the search for an 'other-partition'.
FIXME: this is pretty ugly.  maybe undo it and find a better way.
(TESTS_ENVIRONMENT): Invoke perl scripts with $(PERL), and use -T
if the script requires that.  Otherwise, use $(SHELL).

* tests/misc/md5sum-newline: Create a file whose name contains
a newline in Perl (resort to using "system", since open refuses).

Fix old brokenness exposed by this change:
* tests/du/files0-from: Correct test not to rely on stdin
being attached to a non-tty.
* tests/misc/sort (3g, 3h, 3i): Likewise: add explicit empty input file.
Avoid warnings about using qw()-around-commas.

* tests/rm/fail-eperm: Now that this test is run from a temporary
subdirectory, adjust the full name of the "rm" program we're going
to run.

Change #!/bin/sh to #!/usr/bin/perl, and factor out the few lines
of boilerplate code to invoke perl.  Do not "require 5.00x";
a configure-time Perl test handles that
* tests/dd/skip-seek:
* tests/misc/base64:
* tests/misc/basename:
* tests/misc/cut:
* tests/misc/date:
* tests/misc/dircolors:
* tests/misc/dirname:
* tests/misc/expand:
* tests/misc/expr:
* tests/misc/factor:
* tests/misc/fmt:
* tests/misc/fold:
* tests/misc/head:
* tests/misc/head-elide-tail:
* tests/misc/join:
* tests/misc/ls-misc:
* tests/misc/md5sum:
* tests/misc/md5sum-newline:
* tests/misc/mktemp:
* tests/misc/od:
* tests/misc/paste:
* tests/misc/pr:
* tests/misc/printf-cov:
* tests/misc/seq:
* tests/misc/sha1sum:
* tests/misc/sha1sum-vec:
* tests/misc/sha224sum:
* tests/misc/sha256sum:
* tests/misc/sha384sum:
* tests/misc/sha512sum:
* tests/misc/sort-merge:
* tests/misc/stat-printf:
* tests/misc/sum:
* tests/misc/tac:
* tests/misc/tail:
* tests/misc/test:
* tests/misc/test-diag:
* tests/misc/tr:
* tests/misc/tsort:
* tests/misc/tty-eof:
* tests/misc/unexpand:
* tests/misc/uniq:
* tests/misc/wc:
* tests/misc/wc-files0-from:
* tests/misc/xstrtol:
* tests/mv/i-1:
* tests/pr/pr-tests:
* tests/rm/empty-name:
* tests/rm/fail-eperm:
* tests/rm/unreadable:
2008-05-17 08:27:58 +02:00
Jim Meyering
ea54b6f47c tests: allow to run Perl tests more cleanly
Before this change, perl tests were run via a #!/bin/sh script
in which perl was invoked via $(PERL) ... -- - <<\EOF.
That made some stty tests fail due to the way stdin was usurped.
* build-aux/check.mk (am__check_pre): Don't append $(SHELL) to this
nominally automake-internal variable.
* tests/check.mk (TESTS_ENVIRONMENT): Instead, define a shell function
here, and append it to the more user-visible $(TESTS_ENVIRONMENT).
2008-05-16 10:10:34 +02:00
Jim Meyering
4a4fe636dc tests: env-related clean up
* tests/Coreutils.pm: tiny clean-up: s/env/env --/
* tests/misc/help-version: Use "env" rather than an absolute file
name prefix.
* tests/misc/printf-surprise: Likewise.
2008-05-16 10:10:34 +02:00
Jim Meyering
c6a3937288 tests: improve coverage of printf.c
* tests/misc/printf-cov: New file.
* tests/Makefile.am (TESTS): Add misc/printf-cov.
* tests/misc/help-version: Use env rather than abs file name prefix.
2008-05-16 10:10:34 +02:00
Jim Meyering
0bf3eb3682 make HACKING slightly more generic
* HACKING: remove some uses of "coreutils"
Point to git's own SubmittingPatches URL.
2008-05-16 10:08:56 +02:00
Bruno Haible
513a235858 doc: some Unicode characters cannot be specified via \u or \U
* doc/coreutils.texi (printf invocation): Clarify invalid ranges for
Unicode character escape syntax.
2008-05-15 09:33:33 +02:00
Jim Meyering
433881d802 move sha256 and sha512 modules to gnulib
* bootstrap.conf (gnulib_modules) [sha256, sha512]: Add "crypto/"
prefix to module name, now that they come from gnulib.
* gl/lib/sha256.c: Remove file.
* gl/lib/sha256.h: Likewise.
* gl/lib/sha512.c: Likewise.
* gl/lib/sha512.h: Likewise.
* gl/lib/u64.h: Likewise.
* gl/m4/sha256.m4: Likewise.
* gl/m4/sha512.m4: Likewise.
* gl/modules/sha256: Likewise.
* gl/modules/sha512: Likewise.
2008-05-11 09:00:59 +02:00
Jim Meyering
295d47736a now that the last of the mk-script-using tests is gone...
* tests/Makefile.am (EXTRA_DIST): Remove Makefile.am.in and mk-script.
Move/adjust SUBDIRS-related comments.
* tests/Makefile.am.in: Remove file, no longer used.
* tests/mk-script: Likewise.
* bootstrap: Remove coreutils-specific SUBDIRS-related code.
2008-05-10 13:35:30 +02:00
Jim Meyering
346dd8b5bf tests: remove directory, tests/join/
* configure.ac (AC_CONFIG_FILES): Remove tests/join/Makefile.
* tests/misc/join: New file, with tests from...
* tests/join/Test.pm: ...here.  Remove file.
* tests/Makefile.am (SUBDIRS): Remove definition.
2008-05-10 13:35:30 +02:00
Jim Meyering
65d65fe094 * tests/misc/tac: Also perform stdin and piped tests. 2008-05-10 13:35:29 +02:00
Jim Meyering
a59258fbc7 tests: convert pr tests
* configure.ac (AC_CONFIG_FILES): Remove tests/pr/Makefile.
* tests/Makefile.am (SUBDIRS): Remove pr.
* tests/pr/pr-tests: New file, with tests from...
* tests/pr/Test.pm: ...here.  Remove file.
* tests/Makefile.am (EXTRA_DIST): Add $(pr_data).
(pr_data): List all of the pr's test-related data files.
2008-05-10 13:35:29 +02:00
Jim Meyering
b347377bd3 tests: remove directory, tests/tail/
* configure.ac (AC_CONFIG_FILES): Remove tests/tail/Makefile.
* tests/Makefile.am (SUBDIRS): Remove tail.
* tests/misc/tail: New file, with tests from...
* tests/tail/Test.pm: ...here.  Remove file.
2008-05-10 10:11:45 +02:00
Bernhard Marx
0fe9fc4558 doc: improve description of "niceness" values
* doc/coreutils.texi (nice invocation):
2008-05-09 08:50:46 +02:00
Jim Meyering
15b0d75930 tests: remove directory, tests/sort/
* configure.ac (AC_CONFIG_FILES): Remove tests/sort/Makefile.
* tests/Makefile.am (SUBDIRS): Remove sort.
* tests/misc/sort: New file, with tests from...
* tests/sort/Test.pm: ...here.  Remove file.
2008-05-09 08:11:12 +02:00
Bruno Haible
f0ad302ca9 Speed up "wc -m" and "wc -w" in multibyte case.
* src/wc.c: Include mbchar.h.
(wc): New variable in_shift. Use it to avoid calling mbrtowc for most
ASCII characters.  Reported via Jan Engelhardt in
http://bugzilla.novell.com/381873 with discussion here
http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/13520
2008-05-08 23:21:04 +02:00
Jim Meyering
28c9d4ecff tests: remove directory, tests/tac/
* configure.ac (AC_CONFIG_FILES): Remove tests/tac/Makefile.
* tests/Makefile.am (SUBDIRS): Remove tac.
* tests/misc/tac: Many new tests, from...
* tests/tac/Test.pm: ...here.  Remove file.
2008-05-08 10:33:15 +02:00
Jim Meyering
ce7b12ef1b tests: remove directory, tests/test/
* configure.ac (AC_CONFIG_FILES): Remove tests/test/Makefile.
* tests/Makefile.am (SUBDIRS): Remove test.
* tests/misc/test: Many new tests, from...
* tests/test/Test.pm: ...here.  Remove file.
2008-05-08 09:12:53 +02:00
Jim Meyering
7fcb73cec0 tests: Coreutils.pm: support running a program that is a shell built-in
* tests/Coreutils.pm (run_tests): Add support for running a
program like 'test', that is a shell built-in.
2008-05-08 09:12:43 +02:00
Jim Meyering
6a9c6804dd * TODO: Bo Borgerson is rewriting support for cp --recursive 2008-05-06 14:29:57 +02:00
Jim Meyering
7c9c6c7875 tests: remove directory, tests/tr/
* configure.ac (AC_CONFIG_FILES): Remove tests/tr/Makefile.
* tests/Makefile.am (SUBDIRS): Remove tr.
* tests/misc/tr: Many new tests, from...
* tests/tr/Test.pm: ...here.  Remove file.
* tests/tr/failures: Remove file.
* tests/tr/TODO: Remove file.
2008-05-06 11:00:29 +02:00
Jim Meyering
d3dc29c0be tests: skip another test if mcstransd is running
* tests/test-lib.sh (skip_if_mcstransd_is_running_): New function,
extracted from...
* tests/misc/chcon: ...here.  Use function, not open-coded test.
* tests/misc/selinux: Use the function here, too.
Require root, not non-root.
* tests/Makefile.am (root_tests): Add misc/selinux.
2008-05-06 08:21:30 +02:00
Jim Meyering
6ec3a4f033 tests: translate uniq-z-test-adding code to new framework
* tests/misc/uniq (add-z-variants): New function.
Use it.
2008-05-06 08:21:30 +02:00
Jim Meyering
7cc3733f29 tests: remove directory, tests/uniq/
* configure.ac (AC_CONFIG_FILES): Remove tests/uniq/Makefile.
* tests/Makefile.am (SUBDIRS): Remove uniq.
* tests/misc/uniq: Many new tests, from...
* tests/uniq/Test.pm: ...here.  Remove file.
2008-05-06 08:21:30 +02:00
Jim Meyering
e98006dde0 tests: remove directory, tests/cut/
* configure.ac (AC_CONFIG_FILES): Remove tests/cut/Makefile.
* tests/Makefile.am (SUBDIRS): Remove cut.
* tests/misc/cut: Many new tests, from...
* tests/cut/Test.pm: ...here.  Remove file.
2008-05-06 08:21:30 +02:00
Jim Meyering
bc2b9e04e9 tests: remove directory, tests/head/
* configure.ac (AC_CONFIG_FILES): Remove tests/head/Makefile.
* tests/Makefile.am (SUBDIRS): Remove head.
* tests/misc/head: New file, derived from ...
* tests/head/Test.pm: ...this.  Remove file.
* tests/head/in: Remove file.
* tests/head/in-1024: Remove file.
* tests/Coreutils.pm (triple_test): New function.
2008-05-06 08:21:30 +02:00
Jim Meyering
5ad6145142 tests: Coreutils.pm improvements
* tests/Coreutils.pm: Allow test names longer than 12.
Print a useful diagnostic for bogus spec entry.

Handle the combination of IN_PIPE and ENV properly.
* tests/Coreutils.pm (run_tests): Put ENV right before command,
not before the "cat INPUT_FILE |" prefix.
2008-05-06 08:21:30 +02:00
Jim Meyering
2656da4705 tests: move "sparse-file" into test-lib.sh
* tests/sparse-file: Remove file  Move contents into ...
* tests/test-lib.sh (require_sparse_support_): ...here.  New function.
* tests/cp/sparse: Use the function, not the file.
* tests/du/8gb: Likewise.
* tests/Makefile.am (EXTRA_DIST): Remove sparse-file.
2008-05-06 08:21:30 +02:00
Jim Meyering
3269104d17 tests: move "group-names" into test-lib.sh
* tests/group-names: Remove file  Move contents into ...
* tests/test-lib.sh (require_membership_in_two_groups_): ...here.  New function.
* tests/chgrp/basic: Use the function, not the file.
* tests/chgrp/default-no-deref: Likewise.
* tests/chgrp/deref: Likewise.
* tests/chgrp/no-x: Likewise.
* tests/chgrp/posix-H: Likewise.
* tests/chgrp/recurse: Likewise.
* tests/cp/existing-perm-race: Likewise.
* tests/Makefile.am (EXTRA_DIST): Remove group-names.
2008-05-06 08:21:30 +02:00
Jim Meyering
f15e62d12e tests: use printf+sed rather than yes+head+tr
* tests/misc/fmt-long-line: Minor clean-up.
Using "yes" like that has caused trouble in the past.
2008-05-06 08:21:30 +02:00
Jim Meyering
32b84c9c90 tests: save and restore TERM around use of TESTS_ENVIRONMENT,
now that TESTS_ENVIRONMENT unsets it.
* check.mk (am__check_pre): Save $TERM.
(am__check_post): Restore saved value of TERM and export.
2008-05-06 08:21:30 +02:00
Jim Meyering
1f3e964802 tests: hoist the sourcing of "lang-default"
* tests/check.mk (TESTS_ENVIRONMENT): Source lang-default here, ...
... rather than in each of 100+ test scripts.
* tests/chgrp/basic:
* tests/chgrp/no-x:
* tests/chmod/c-option:
* tests/chmod/no-x:
* tests/chmod/setgid:
* tests/chmod/thru-dangling:
* tests/chmod/umask-x:
* tests/chmod/usage:
* tests/chown/basic:
* tests/chown/deref:
* tests/chown/preserve-root:
* tests/cp/abuse:
* tests/cp/acl:
* tests/cp/backup-is-src:
* tests/cp/cp-a-selinux:
* tests/cp/cp-i:
* tests/cp/cp-mv-backup:
* tests/cp/deref-slink:
* tests/cp/fail-perm:
* tests/cp/into-self:
* tests/cp/link-preserve:
* tests/cp/preserve-gid:
* tests/cp/same-file:
* tests/cp/slink-2-slink:
* tests/cp/special-f:
* tests/cp/symlink-slash:
* tests/cp/thru-dangling:
* tests/du/basic:
* tests/du/hard-link:
* tests/du/inacc-dest:
* tests/du/long-sloop:
* tests/du/no-x:
* tests/install/basic-1:
* tests/ln/hard-backup:
* tests/ln/sf-1:
* tests/ls/file-type:
* tests/ls/infloop:
* tests/ls/nameless-uid:
* tests/ls/rt-1:
* tests/ls/stat-failed:
* tests/ls/symlink-slash:
* tests/ls/x-option:
* tests/misc/chcon:
* tests/misc/chcon-fail:
* tests/misc/csplit:
* tests/misc/df-P:
* tests/misc/groups-dash:
* tests/misc/groups-version:
* tests/misc/nohup:
* tests/misc/printf-surprise:
* tests/misc/runcon-no-reorder:
* tests/misc/selinux:
* tests/misc/split-a:
* tests/misc/split-fail:
* tests/misc/tac-continue:
* tests/misc/wc-files0:
* tests/mkdir/p-v:
* tests/mkdir/selinux:
* tests/mv/acl:
* tests/mv/backup-dir:
* tests/mv/backup-is-src:
* tests/mv/childproof:
* tests/mv/diag:
* tests/mv/dir2dir:
* tests/mv/dup-source:
* tests/mv/force:
* tests/mv/hard-link-1:
* tests/mv/hard-verbose:
* tests/mv/i-2:
* tests/mv/i-3:
* tests/mv/i-4:
* tests/mv/i-5:
* tests/mv/i-link-no:
* tests/mv/into-self:
* tests/mv/into-self-2:
* tests/mv/into-self-3:
* tests/mv/mv-special-1:
* tests/mv/part-fail:
* tests/mv/part-symlink:
* tests/mv/partition-perm:
* tests/mv/perm-1:
* tests/mv/reply-no:
* tests/mv/sticky-to-xpart:
* tests/mv/update:
* tests/rm/cycle:
* tests/rm/dir-no-w:
* tests/rm/dir-nonrecur:
* tests/rm/fail-2eperm:
* tests/rm/fail-eacces:
* tests/rm/inaccessible:
* tests/rm/interactive-always:
* tests/rm/interactive-once:
* tests/rm/isatty:
* tests/rm/one-file-system:
* tests/rm/r-1:
* tests/rm/r-2:
* tests/rm/rm1:
* tests/rm/rm2:
* tests/rm/rm3:
* tests/rm/rm4:
* tests/rm/rm5:
* tests/rm/unread2:
* tests/rm/v-slash:
* tests/touch/fail-diag:
* tests/touch/not-owner:
2008-05-06 08:21:29 +02:00
Jim Meyering
62ebe4dabd tests: hoist envvar-check so it is run for every test
I.e., also for Perl-based tests; not just the ones using test-lib.sh.
* tests/check.mk (TESTS_ENVIRONMENT): Source envvar-check here, ...
* tests/test-lib.sh: ...not here.
2008-05-06 08:21:29 +02:00
Jim Meyering
cca51697aa fix typo in comments: s/ouput/output/
adjust spelling in that same comment: s/localisation/localization/
2008-05-06 08:21:29 +02:00
Jim Meyering
22adc16d9c * tests/touch/Makefile.am: Remove now-unused file. 2008-05-06 08:21:29 +02:00
Jim Meyering
f375a52f51 tests: test split more thoroughly
* tests/misc/split-a: Clean up.  Catch more failures.
2008-05-06 08:21:28 +02:00
Jim Meyering
eb62800728 * tests/misc/wc: Remove an unused variable. 2008-05-06 08:21:28 +02:00
Jim Meyering
f02102211e tests: detect and check more uses of strcmp
* maint.mk (sc_prohibit_strcmp): Relax regexp to recognize other
formatting styles.
2008-05-06 08:21:28 +02:00
Jim Meyering
209850fd7e avoid problems with sign-extended "char" operand to is* functions
* src/cut.c (set_fields): Apply to_uchar to isblank operands.
* src/uniq.c (find_field): Likewise.
* src/seq.c (scan_arg): Likewise, for isspace.
* tests/misc/uniq: New file.  Test for the above, but only
when isspace(0240).
* tests/Makefile.am (TESTS): Add misc/uniq.
* configure.ac: Use gt_LOCALE_FR.
* tests/check.mk (TESTS_ENVIRONMENT): Propagate LOCALE_FR to scripts.
* NEWS: Mention the bug fixes.

Before this patch, on FreeBSD 6:

  $ printf 'x y z\nx \xa0 y z\n' > in
  $ LC_ALL=fr_FR.UTF-8 uniq -f2 in|tr ' ' .
  x.y.z
  x. .y.z

With the patch:

  $ LC_ALL=fr_FR.UTF-8 uniq -f2 in|tr ' ' .
  x.y.z

This also affected many other locales:
for i in $(locale -a); do test $(LC_ALL=$i ./uniq -f1 in|wc -l)
  = $(LC_ALL=$i uniq -f1 in|wc -l) || echo $i ; done
...
en_GB.ISO8859-1
en_GB.ISO8859-15
en_GB.UTF-8
en_IE.UTF-8
en_NZ.ISO8859-1
en_NZ.ISO8859-15
en_NZ.UTF-8
en_US.ISO8859-1
en_US.ISO8859-15
en_US.UTF-8
...
2008-05-06 08:21:28 +02:00
Bo Borgerson
4d3bf408b9 base64: remove some unused/redundant getopt code
* src/base64.c (struct option long_option): Remove redundant help/version
option items.
(main): Remove unused 'q' from short options.

Signed-off-by: Bo Borgerson <gigabo@gmail.com>
2008-05-06 08:19:28 +02:00
Jim Meyering
2224ef83fe help2man: fix perl 5.10 problem properly
* man/help2man: Do pull LC_ALL via "use POSIX".
Instead, limit the importing of gettext-related symbols
to just those two we'll use: gettext and textdomain.
2008-05-06 00:35:28 +02:00
Jim Meyering
0b66c5776e help2man: avoid failure with Debian unstable's Perl 5.10.0
Avoid failure that produced this diagnostic:
Constant subroutine main::LC_ALL redefined at /.../Exporter.pm
* man/help2man: Don't include LC_ALL in the "use POSIX" list,
since Locale::gettext->import will get it.
2008-05-05 23:46:30 +02:00
Bo Borgerson
c64411a38a base64 module: adjust API so it's compatible with gnulib's
* gl/lib/base64.c (base64_decode_ctx): If no context structure was passed in,
treat newlines as garbage (this is the historical behavior).  Formerly
base64_decode.
(base64_decode_alloc_ctx): Formerly base64_decode_alloc.
* gl/lib/base64.h (base64_decode): Macro for four-argument calls.
(base64_decode_alloc): Likewise.
* src/base64.c (do_decode): Call base64_decode_ctx instead of base64_decode.

Signed-off-by: Bo Borgerson <gigabo@gmail.com>
2008-05-05 17:57:41 +02:00
Jim Meyering
fcd450ecb9 * tests/misc/tac: Set execute bit. 2008-05-05 13:53:36 +02:00
Jim Meyering
d701f6abb7 tac: avoid segfault for e.g., "echo > x; tac -r x x"
* src/tac.c (tac_seekable): Move local "regs" declaration out
to file scope, so its values aren't clobbered between calls.
Discovered by Cristian Cadar, Daniel Dunbar and Dawson Engler,
reported in http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/13501
* NEWS: Mention the bug fix.
* tests/Makefile.am (TESTS): Add misc/tac.
* tests/misc/tac: New file.  Test for the above.
2008-05-05 13:15:32 +02:00
Jim Meyering
a892af0d48 tests: avoid a "make check-root" failure when mcstransd is running
* tests/misc/chcon: Skip this test if mcstransd seems to be running.
2008-04-30 23:29:22 +02:00
Jim Meyering
e3171c43eb tests: avoid spurious "make check-root" failure
* README (Running tests as root): Also set PATH in suggested "sudo"
command.  This avoids failure of at least tests/cp/cp-a-selinux
when the default PATH does not contain /sbin.
* tests/cp/cp-a-selinux: Don't redirect stderr to /dev/null.
"mkfs" was failing due to /sbin not being in PATH.
2008-04-30 23:29:10 +02:00
Bo Borgerson
bbc49eb536 Add Daniel Dunbar's lcov instructions to HACKING
* HACKING: New section `Finding things to do', points to TODO file and
gives instructions on generating an html coverage report as provided by
Daniel Dunbar.
* TODO: Add item for improving test coverage.  Point back to HACKING.

Signed-off-by: Bo Borgerson <gigabo@gmail.com>
2008-04-30 16:09:33 +02:00
Jim Meyering
bbc0cb0f37 chcon, runcon: make --help print the bug-reporting address
* src/chcon.c (usage): Use emit_bug_reporting_address.
* src/runcon.c (usage): Likewise.
* tests/misc/help-version: Don't exempt chcon and runcon.
* NEWS: Mention this.
2008-04-29 14:55:38 +02:00
Jim Meyering
28f1b61e59 tests: don't hard-code coreutils list of tests/ SUBDIRS in bootstrap
* bootstrap: Extract the list from tests/Makefile.am, and die
when it is empty -- it will be, eventually.
2008-04-28 22:59:24 +02:00
Bo Borgerson
29a2fb3856 tests: remove references to tests/wc from bootstrap
* bootstrap: Don't try to initialize anything in tests/wc.

Signed-off-by: Bo Borgerson <gigabo@gmail.com>
2008-04-28 22:47:09 +02:00
Jim Meyering
ed30cd94e3 tests: slightly relax sc_cast_of_argument_to_free syntax check
* maint.mk (sc_cast_of_argument_to_free): Relax regexp slightly.
(sc_no_have_config_h): Add a comment.
2008-04-28 22:44:56 +02:00
Bo Borgerson
eef629eea1 tests: don't chmod after a failed chdir in cleanup
* tests/CuTmpdir.pm (chmod_tree): Don't chmod if chdir failed.

Signed-off-by: Bo Borgerson <gigabo@gmail.com>
2008-04-28 19:29:15 +02:00
Bo Borgerson
2f55920ffc Only cleanup test dirs from the process that created them.
* tests/CuTmpdir.pm (import): Use closure around current PID to avoid cleanup races.

Signed-off-by: Bo Borgerson <gigabo@gmail.com>
2008-04-28 17:28:58 +02:00
Jim Meyering
d6ec836387 move wc tests from own subdir into a single script
* configure.ac (AC_CONFIG_FILES): Remove wc/Makefile from the list.
* tests/Makefile.am (SUBDIRS): Remove wc from the list.
(TESTS): Add misc/wc.
* tests/misc/wc: New file, derived from tests/wc/Tests.pm.
* tests/wc/Test.pm: Remove file.
2008-04-27 21:31:33 +02:00
Jim Meyering
5a3b0c4805 tests: remove temporary log file upon catchable signal
* check.mk (am__check_pre): Add signal handler to remove $@-t.
2008-04-27 21:31:33 +02:00
Jim Meyering
972e2737ab tests: don't source envvar-check manually, test-lib.sh does it
* tests/cp/abuse: Remove ". $top_srcdir/tests/envvar-check".
* tests/cp/parent-perm: Likewise.
* tests/cp/special-f: Likewise.
* tests/ls/proc-selinux-segfault: Likewise.
* tests/misc/help-version: Likewise.
* tests/mkdir/selinux: Likewise.
* tests/mv/sticky-to-xpart: Likewise.
* tests/touch/now-owned-by-other: Likewise.
* tests/sample-test: Remove commented out suggestion.
2008-04-27 21:31:33 +02:00
Jim Meyering
816e56a3de tests: ensure at least one failure when $built_programs is empty
Before, this test and others would pass with empty $built_programs.
* tests/misc/help-version: Fail if built_programs is empty.
2008-04-27 21:31:33 +02:00
Jim Meyering
bbafdc3c8f tests: improve perl-based tempdir handling
Before, upon interrupt, directories would be left behind.
* tests/CuTmpdir.pm: Remove temporary directory on interrupt.
2008-04-27 21:31:32 +02:00
Jim Meyering
dfdb532fd3 tests: reorder some tests in the long list
* tests/Makefile.am (TESTS): Move some tests that use sleep
"up" in the list so that they don't delay even a little the
completion of "make check".  Also run a chmod test early.
2008-04-27 21:31:32 +02:00
Jim Meyering
53d8a2c412 tests: put root-only (usually skipped) tests at the end
* tests/Makefile.am (TESTS): Don't list root-only tests explicitly.
Instead, just use $(root_tests).
* tests/check.mk (vc_exe_in_TESTS): Now that root_tests are separate,
parse out the union of $(TESTS) and $(root_tests).
2008-04-27 21:31:32 +02:00
Jim Meyering
427f179542 tests: move another file (expensive) into test-lib.sh
* tests/expensive: Remove file.  Move contents into ...
* tests/test-lib.sh (expensive_): ...here.  New function.
* tests/du/fd-leak: Update caller to use the new function.
* tests/mv/leak-fd: Likewise.
* tests/rm/hash: Likewise.
* tests/tail-2/big-4gb: Likewise.
* tests/Makefile.am (EXTRA_DIST): Remove its name.
2008-04-27 21:31:32 +02:00
Jim Meyering
8dc387dba5 tests: cp/perm (usually not run) was failing on systems with SELinux
* tests/cp/perm: Use stat to get the permission string, not ls.
This test was run only when RUN_VERY_EXPENSIVE_TESTS=yes was set
in the environment.  It would fail on SELinux-enable systems
because ls-generated permission strings would not match, e.g.,
"test _-rw-r--r--+ = _-rw-r--r--" would fail.
2008-04-27 21:31:32 +02:00
Jim Meyering
cca6a8d7e5 tweak HACKING advice 2008-04-27 21:31:08 +02:00
Jim Meyering
6bbbd65d89 tests: do define built_programs
* tests/check.mk (built_programs): Define here, where it's used.
This definition was in now-removed tests/misc/Makefile.am.
2008-04-24 12:31:13 +02:00
Jim Meyering
d30ac3d321 tests: update commented-out examples in sample-test, too
* tests/sample-test: Use $top_srcdir/tests/SCRIPT_NAME, not
$top_srcdir/../SCRIPT_NAME here, too.
2008-04-23 21:33:24 +02:00
Ondřej Vašík
37370a584c tests: don't fail in a non-English locale
* tests/chmod/thru-dangling: Source lang-default.
* tests/cp/thru-dangling: Likewise.
* tests/misc/printf-surprise: Likewise.
2008-04-23 20:17:55 +02:00
Jim Meyering
8657cf19e2 tests: remove now-unused Makefile.am
* tests/misc/Makefile.am: Remove file.
2008-04-23 17:51:44 +02:00
Ondřej Vašík
1a5b6e3a50 id: do not print SELinux context when invoked with a USERNAME argument
* NEWS: Mention new behaviour.
* src/id.c (main): Do not print SELinux context when user is specified.
* tests/Makefile.am: Add the new test.
* tests/misc/id-context: New file.  Test for the fix.
Problem reported by Ronny Buchmann in http://bugzilla.redhat.com/443485.
2008-04-23 17:51:44 +02:00
Jim Meyering
0a4a938b6b id: do print the AFS-specific nameless group ID (called a PAG)
In 6.11, we mistakenly suppressed the printing of certain group IDs,
thinking they were useless AFS-specific artifacts.
This change reverts that, so now they are printed once again.
http://thread.gmane.org/gmane.org.fsf.announce/867/focus=13345
This also reverts the bug-fix that applied solely to the new code
used to avoid printing those IDs

Revert "id bug fix: don't point to potentially clobbered static storage"
This reverts commit f7d1c59c22.
Revert "Work around AFS bug: id and groups would print invalid group number."
This reverts commit b7a836c0a3.
Revert "* src/c99-to-c89.diff: Accommodate a C99-ism in id.c."
This reverts commit d44893c5db.
2008-04-23 15:29:11 +02:00
Jim Meyering
d9c1b8fd30 build: move a project-specific definition to cfg.mk
* cfg.mk (old_NEWS_hash): Define here, ...
* maint.mk: ... not here.
(update-NEWS-hash): Update comment.
Suggestion from Eric Blake.
2008-04-22 21:28:33 +02:00
Jim Meyering
0bc8813b1e Accommodate building on OS/2 (www.ecomstation.com Ecs v2 rc4)
* configure.ac: Filter out carriage returns in more places.
Reported by Elbert Pol, details here:
http://thread.gmane.org/gmane.org.fsf.announce/867/focus=13332
2008-04-22 10:52:37 +02:00
Jim Meyering
68466d44b1 guard against inserting a NEWS entry into a block for a prior release
Without a guard like this, it is far too easy to apply a patch
prepared against a preceding release, and not notice that a NEWS
entry is inserted into the wrong block.
* maint.mk (sc_immutable_NEWS): New rule.
(update-NEWS-hash): New rule to update the hard-coded hash.
2008-04-22 10:45:21 +02:00
Jim Meyering
79a98d9bc1 tests: ensure that all exec-$PERL lines are the same
* maint.mk (sc_perl_coreutils_test): New rule.
2008-04-22 09:33:25 +02:00
Jim Meyering
a6894d063c tests: skip (don't fail) rm/one-file-system when mount --bind fails
* tests/rm/one-file-system: Reported by Allen Hewes.
2008-04-21 14:48:19 +02:00
Jim Meyering
90bc2fe272 tests: convert umask-check to a function
* tests/test-lib.sh (working_umask_or_skip_): New function, from...
* tests/umask-check: ...here.  Remove file.
* tests/Makefile.am (EXTRA_DIST): Remove umask-check.
* tests/mkdir/perm: Use the function rather than sourcing the file.
* tests/cp/cp-parents: Likewise.
* tests/cp/parent-perm: Likewise.
Bruno Haible reported that parent-perm was failing to run umask-check.
2008-04-21 00:02:00 +02:00
Jim Meyering
c51900a6bd tests: adjust perl -I to use $top_srcdir/tests, not $srcdir/.. 2008-04-21 00:02:00 +02:00
Jim Meyering
b214b51ca0 tests: clean up root tests; adapt to new layout
* tests/Makefile.am (root_tests): New list.
(check-root): Add 'SUBDIRS='.
(root-hint): Point to README.
* Makefile.am (check-root): Add 'SUBDIRS=' here, too.
* maint.mk (sc_root_tests): Adapt rule to new syntax used
in tests/Makefile.am.
2008-04-21 00:02:00 +02:00
Jim Meyering
512e111a92 Revamp test-related Makefiles.
One side-effect of this change is that "make check" now works even if
you put "." early in your shell's search PATH (don't do that!).

Remove all test-related Makefile.am files, except those generated
by mk-script.  Instead, tests/Makefile.am now lists not only the
tests directly under tests/, but also those in tests/*/ that are
not generated by mk-script, e.g., cp/abuse, cp/acl, mv/i-1, etc.

A lot of these changes are like this:

-. $srcdir/../lang-default
+. $top_srcdir/tests/lang-default

-. $srcdir/../test-lib.sh
+. $top_srcdir/tests/test-lib.sh

* configure.ac (AC_CONFIG_FILES): Remove corresponding Makefiles.
* tests/check.mk (vc_exe_in_TESTS): Relax syntax requirements.
* tests/rwx-to-mode: Remove file.  Rewritten as...
* tests/test-lib.sh (rwx_to_mode_): ...this new function.
* tests/Makefile.am (EXTRA_DIST): Remove rwx-to-mode.
(SUBDIRS): Remove each dir with a removed Makefile.am.
(EXTRA_DIST): Add $(TESTS).
(TESTS): Add over 300 entries.
2008-04-21 00:01:51 +02:00
Jim Meyering
d25bf9dceb * tests/misc/Makefile.am (built_programs): Remove. Unused. 2008-04-20 23:19:07 +02:00
Jim Meyering
fdb7e5b44c Use "env" to invoke potential built-ins.
* tests/misc/pwd-unreadable-parent: Invoke pwd via "env -- pwd",
rather than via an absolute name.
* tests/touch/not-owner: Likewise for test.
* tests/chmod/setgid: Likewise.
2008-04-20 23:18:48 +02:00
Jim Meyering
b29e812e82 * .prev-version: Record previous version: 6.11. 2008-04-19 23:29:02 +02:00
621 changed files with 15022 additions and 10091 deletions

7
.gitattributes vendored Normal file
View File

@@ -0,0 +1,7 @@
*.texi* diff=texinfo
# Put something like the following e.g., in your ~/.gitconfig file
# # Include proper "function name" string in diffs of texinfo.
# # Derived from the regexp in emacs' lisp/add-log.el.
# [diff "texinfo"]
# funcname = "^@node[ \t][ \t]*\\([^,][^,]*\\)"

26
.gitignore vendored
View File

@@ -44,6 +44,7 @@ coreutils-*.tar.lzma.sig
gnulib-tests
lib/.cvsignore
lib/.gitignore
lib/arpa
lib/binary-io.h
lib/charset.alias
lib/configmake.h
@@ -52,6 +53,7 @@ lib/printf.c
lib/progname.c
lib/progname.h
lib/selinux
lib/uniwidth
m4/.cvsignore
m4/.gitignore
po/*.gmo
@@ -65,27 +67,7 @@ po/POTFILES
po/checksums
po/coreutils.pot
po/stamp-po
src/version.c
src/version.h
stamp-h1
tests/*/*.log
tests/cut/Makefile.am
tests/cut/cut-tests
tests/head/Makefile.am
tests/head/head-tests
tests/join/Makefile.am
tests/join/join-tests
tests/pr/Makefile.am
tests/pr/pr-tests
tests/sort/Makefile.am
tests/sort/sort-tests
tests/tac/Makefile.am
tests/tac/tac-tests
tests/tail/Makefile.am
tests/tail/tail-tests
tests/test/Makefile.am
tests/test/test-tests
tests/tr/Makefile.am
tests/tr/tr-tests
tests/uniq/Makefile.am
tests/uniq/uniq-tests
tests/wc/Makefile.am
tests/wc/wc-tests

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

View File

@@ -1,6 +1,6 @@
# Suppress valgrind diagnostics we don't care about.
# Copyright (C) 2003, 2004, 2006-2007 Free Software Foundation, Inc.
# Copyright (C) 2003, 2004, 2006-2008 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
@@ -90,3 +90,11 @@
fun:gobble_file
fun:main
}
{
utimensat-NULL
Memcheck:Param
utimensat(filename)
fun:futimens
fun:gl_futimens
fun:main
}

View File

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

View File

@@ -0,0 +1 @@
build-aux/cvsu

1
.x-sc_po_check Normal file
View File

@@ -0,0 +1 @@
^gl/

2
.x-sc_program_name Normal file
View File

@@ -0,0 +1,2 @@
gl/lib/randint.c
lib/euidaccess-stat.c

View File

@@ -1,6 +1 @@
ChangeLog
^TODO$
^lib/euidaccess-stat\.c$
^maint\.mk$
^doc/coreutils.texi$
^tests/misc/stty-invalid$

View File

@@ -0,0 +1,4 @@
src/system.h
tests/du/2g
old/fileutils/ChangeLog-1997
ChangeLog-2005

View File

@@ -1,2 +1 @@
^src/system\.h
ChangeLog

View File

@@ -1,30 +1,9 @@
^lib/at-func\.c$
^lib/bcopy\.c$
^lib/buffer-lcm\.c$
^lib/c-strtold\.c$
^lib/fnmatch_loop\.c$
^lib/full-read\.c$
^lib/imaxtostr\.c$
^lib/mempcpy\.c$
^lib/memset\.c$
^lib/offtostr\.c$
^lib/regcomp\.c$
^lib/regex_internal\.c$
^lib/regexec\.c$
^lib/safe-write\.c$
^lib/strtoll\.c$
^lib/strtoul\.c$
^lib/strtoull\.c$
^lib/strtoumax\.c$
^lib/umaxtostr\.c$
^lib/xstrtold\.c$
^lib/xstrtoul\.c$
^src/false\.c$
^src/lbracket\.c$
^src/ls-dir\.c$
^src/ls-ls\.c$
^src/ls-vdir\.c$
^src/rand-isaac\.c$
^src/tac-pipe\.c$
^src/uname-arch\.c$
^src/uname-uname\.c$

View File

@@ -0,0 +1,9 @@
^lib/buffer-lcm\.c$
^src/false\.c$
^src/lbracket\.c$
^src/ls-dir\.c$
^src/ls-ls\.c$
^src/ls-vdir\.c$
^src/tac-pipe\.c$
^src/uname-arch\.c$
^src/uname-uname\.c$

38
AUTHORS
View File

@@ -3,29 +3,29 @@ each followed by the name(s) of its author(s).
arch: David MacKenzie, Karel Zak
base64: Simon Josefsson
basename: FIXME unknown
cat: Torbjorn Granlund, Richard M. Stallman
basename: David MacKenzie
cat: Torbjörn Granlund, Richard M. Stallman
chcon: Russell Coker, Jim Meyering
chgrp: David MacKenzie, Jim Meyering
chmod: David MacKenzie, Jim Meyering
chown: David MacKenzie, Jim Meyering
chroot: Roland McGrath
cksum: Q. Frank Xia
comm: Richard Stallman, David MacKenzie
cp: Torbjorn Granlund, David MacKenzie, Jim Meyering
comm: Richard M. Stallman, David MacKenzie
cp: Torbjörn Granlund, David MacKenzie, Jim Meyering
csplit: Stuart Kemp, David MacKenzie
cut: David Ihnat, David MacKenzie, Jim Meyering
cut: David M. Ihnat, David MacKenzie, Jim Meyering
date: David MacKenzie
dd: Paul Rubin, David MacKenzie, Stuart Kemp
df: Torbjorn Granlund, David MacKenzie, Paul Eggert
dir: Richard Stallman, David MacKenzie
df: Torbjörn Granlund, David MacKenzie, Paul Eggert
dir: Richard M. Stallman, David MacKenzie
dircolors: H. Peter Anvin
dirname: David MacKenzie, Jim Meyering
du: Torbjorn Granlund, David MacKenzie, Paul Eggert, Jim Meyering
echo: FIXME unknown
du: Torbjörn Granlund, David MacKenzie, Paul Eggert, Jim Meyering
echo: Brian Fox, Chet Ramey
env: Richard Mlynarik, David MacKenzie
expand: David MacKenzie
expr: Mike Parker
expr: Mike Parker, James Youngman, Paul Eggert
factor: Paul Rubin
false: Jim Meyering
fmt: Ross Paterson
@@ -41,7 +41,7 @@ kill: Paul Eggert
link: Michael Stone
ln: Mike Parker, David MacKenzie
logname: FIXME: unknown
ls: Richard Stallman, David MacKenzie
ls: Richard M. Stallman, David MacKenzie
md5sum: Ulrich Drepper, Scott Miller, David Madore
mkdir: David MacKenzie
mkfifo: David MacKenzie
@@ -58,10 +58,10 @@ pinky: Joseph Arceneaux, David MacKenzie, Kaveh Ghazi
pr: Pete TerMaat, Roland Huebner
printenv: David MacKenzie, Richard Mlynarik
printf: David MacKenzie
ptx: F. Pinard
ptx: François Pinard
pwd: Jim Meyering
readlink: Dmitry V. Levin
rm: Paul Rubin, David MacKenzie, Richard Stallman, Jim Meyering
rm: Paul Rubin, David MacKenzie, Richard M. Stallman, Jim Meyering
rmdir: David MacKenzie
runcon: Russell Coker
seq: Ulrich Drepper
@@ -74,7 +74,7 @@ shred: Colin Plumb
shuf: Paul Eggert
sleep: Jim Meyering, Paul Eggert
sort: Mike Haertel, Paul Eggert
split: Torbjorn Granlund, Richard M. Stallman
split: Torbjörn Granlund, Richard M. Stallman
stat: Michael Meskes
stty: David MacKenzie
su: David MacKenzie
@@ -84,19 +84,25 @@ tac: Jay Lepreau, David MacKenzie
tail: Paul Rubin, David MacKenzie, Ian Lance Taylor, Jim Meyering
tee: Mike Parker, Richard M. Stallman, David MacKenzie
test: Kevin Braunsdorf, Matthew Bradburn
timeout: Pádraig Brady
touch: Paul Rubin, Arnold Robbins, Jim Kingdon, David MacKenzie, Randy Smith
tr: Jim Meyering
true: Jim Meyering
truncate: Pádraig Brady
tsort: Mark Kettenis
tty: David MacKenzie
uname: David MacKenzie
unexpand: David MacKenzie
uniq: Richard Stallman, David MacKenzie
uniq: Richard M. Stallman, David MacKenzie
unlink: Michael Stone
uptime: Joseph Arceneaux, David MacKenzie, Kaveh Ghazi
users: Joseph Arceneaux, David MacKenzie
vdir: Richard Stallman, David MacKenzie
vdir: Richard M. Stallman, David MacKenzie
wc: Paul Rubin, David MacKenzie
who: Joseph Arceneaux, David MacKenzie, Michael Stone
whoami: Richard Mlynarik
yes: David MacKenzie
;; Local Variables:
;; coding: utf-8
;; End:

View File

@@ -1,3 +1,8 @@
2008-12-16 Jim Meyering <meyering@redhat.com>
NB: ChangeLog files are no longer manually maintained.
See HACKING for details.
2008-02-07 Jim Meyering <meyering@redhat.com>
We *do* need two different version files.

180
HACKING
View File

@@ -26,11 +26,21 @@ That downloads the entire repository, including revision control history
dating back to 1991. The repository (the part you download, and which
resides in coreutils/.git) currently weighs in at about 30MB. So you
don't want to download it more often than necessary. Once downloaded,
you can get incremental updates by running this command from inside
your new coreutils/ directory:
you can get incremental updates by running one of these commands from
inside your new coreutils/ directory:
If you have made *no* changes:
git pull
If you *have* made changes and mistakenly committed them to "master",
do the following to put your changes on a private branch, "br", and
to restore master to its unmodified (relative-to-upstream) state:
git checkout -b br
git checkout master
git reset --hard origin
Then "git pull" should work.
*Before* you commit changes
===========================
@@ -64,7 +74,7 @@ Once your change is committed, you can create a proper patch that includes
a log message and authorship information as well as any permissions
changes. Use this command to save that single, most-recent change set:
git format-patch --stdout --signoff HEAD~1 > DIFF
git format-patch --stdout -1 > DIFF
The trouble with this approach is that you've just checked in a change
(remember, it's only local) on the "master" branch, and that's where new
@@ -180,9 +190,9 @@ It's easy to adjust:
edit your files # this can include running "git add NEW" or "git rm BAD"
git commit --amend -e -a
git format-patch --stdout --signoff HEAD~1 > your-branch.diff
git format-patch --stdout -1 > your-branch.diff
That replaces the most recent commit with the revised one.
That replaces the most recent change-set with the revised one.
@@ -206,6 +216,13 @@ line should be blank, and the remaining lines are usually ChangeLog-style
entries for all affected files. Omit the leading TABs that you're used
to seeing in a "real" ChangeLog file.
Try to make the summary line fit one of the following forms:
program_name: change-description
prog1, prog2: change-description
doc: change-description
tests: change-description
Use SPACE-only indentation in new files.
========================================
@@ -223,8 +240,12 @@ with --no-tabs) and put these lines at the end of the file:
Do not change TABs to spaces or vice versa in any existing file.
Send patches to bug-coreutils@gnu.org
=====================================
Send patches to the address listed in --help output
===================================================
Please follow the guidelines in the "Sending your patches." section of
git's own SubmittingPatches:
http://git.kernel.org/?p=git/git.git;a=blob;f=Documentation/SubmittingPatches
Add documentation
@@ -232,10 +253,39 @@ Add documentation
If you add a feature or change some user-visible aspect of a program,
document it. If you add an option, document it both in --help output
(i.e., in the usage function that generates the --help output) and in
doc/coreutils.texi. The man pages are generated from --help output, so
doc/*.texi. The man pages are generated from --help output, so
you shouldn't need to change anything under man/. User-visible changes
are usually documented in NEWS, too.
When writing prose (documentation, comments, log entries), use an
active voice, not a passive one. I.e., say "print the frobnozzle",
not "the frobnozzle will be printed".
Minor syntactic preferences
===========================
[I hesitate to write this one down, because it appears to be an
acquired taste, at least for native-English speakers. It seems odd
(if not truly backwards) to nearly anyone who doesn't have a strong
mathematics background and perhaps a streak of something odd in their
character ;-) ]
In writing arithmetic comparisons, use "<" and "<=" rather than
">" and ">=". For some justification, read this:
http://thread.gmane.org/gmane.comp.version-control.git/3903/focus=4126
const placement:
Write "Type const *var", not "const Type *var".
FIXME: dig up justification
Be nice to translators
======================
Don't change translatable strings if you can avoid it.
If you must rearrange individual lines (e.g., in multi-line --help
strings), extract and create new strings, rather than extracting
and moving into existing blocks. This avoids making unnecessary
work for translators.
Add tests
==========
@@ -243,7 +293,9 @@ Nearly every significant change must be accompanied by a test suite
addition that exercises it. If you fix a bug, add at least one test that
fails without the patch, but that succeeds once your patch is applied.
If you add a feature, add tests to exercise as much of the new code
as possible.
as possible. Note to run tests/misc/newtest in isolation you can do:
(cd tests && make check TESTS=misc/newtest VERBOSE=yes)
There are hundreds of tests in the tests/ directories. You can use
tests/sample-test as a template, or one of the various Perl-based ones
@@ -271,22 +323,28 @@ doc/Copyright/request-assign.changes:
http://git.sv.gnu.org/gitweb/?p=gnulib.git;a=blob;f=doc/Copyright/request-assign.changes;hb=HEAD
If you would like to assign past and future coreutils work,
If you would like to assign past and future contributions to a project,
you'd use doc/Copyright/request-assign.future:
http://git.sv.gnu.org/gitweb/?p=gnulib.git;a=blob;f=doc/Copyright/request-assign.future;hb=HEAD
You may make assignments for up to four projects at a time.
In case you're wondering why we bother with all of this, read this:
http://www.gnu.org/licenses/why-assign.html
Run "make syntax-check", or even "make distcheck"
================================================
Making either of those targets runs many integrity and
coreutils-specific policy-conformance tests. For example, the former
project-specific policy-conformance tests. For example, the former
ensures that you add no trailing blanks and no uses of certain deprecated
functions. The latter performs all "syntax-check" tests, and also
ensures that the build completes with no warnings when using a certain
set of gcc -W... options. Don't even bother running "make distcheck"
unless you have a very up to date installation including recent versions
of gcc and the linux kernel, and modern GNU tools.
unless you have a reasonably up to date installation including recent
versions of gcc and the linux kernel, and modern GNU tools.
Ensure that your changes are indented properly.
@@ -298,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
@@ -312,3 +413,56 @@ Miscellaneous useful git commands
* git rebase -i master: run this from on a branch, and it gives
you an interface with which you can reorder and modify arbitrary
change sets on that branch.
* if you "misplace" a change set, i.e., via git reset --hard ..., so that
it's no longer reachable by any branch, you can use "git fsck" to find
its SHA1 and then tag it or cherry-pick it onto an existing branch.
For example, run this:
git fsck --lost-found HEAD && cd .git/lost-found/commit \
&& for i in *; do git show $i|grep SOME_IDENTIFYING_STRING \
&& echo $i; done
The "git fsck ..." command creates the .git/lost-found/... hierarchy
listing all unreachable objects. Then the for loop
print SHA1s for commits that match via log or patch.
For example, say that found 556fbb57216b119155cdda824c98dc579b8121c8,
you could run "git show 556fbb57216b119" to examine the change set,
or "git checkout -b found 556fbb5721" to give it a branch name.
Finally, you might run "git checkout master && git cherry-pick 556fbb5721"
to put that change on the tip of "master".
-------------------------------------------
Finding things to do
====================
If you don't know where to start, check out the TODO file for projects
that look like they're at your skill-/interest-level. Another good
option is always to improve tests. You never know what you might
uncover when you improve test coverage, and even if you don't find
any bugs your contribution is sure to be appreciated.
A good way to quickly assess current test coverage is to use "lcov"
to generate HTML coverage reports. Follow these steps:
# configure with coverage information
./configure CFLAGS="-g -fprofile-arcs -ftest-coverage"
make
# run whatever tests you want, i.e.:
make check
# run lcov
lcov -t coreutils -q -d lib -b lib -o lib.lcov -c
lcov -t coreutils -q -d src -b src -o src.lcov -c
# generate HTML from the output
genhtml -p `pwd` -t coreutils -q --output-directory lcov-html *.lcov
Then just open the index.html file (in the generated lcov-html directory)
in your favorite web browser.
========================================================================
Copyright (C) 2009 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.2 or
any later version published by the Free Software Foundation; with no
Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
Texts. A copy of the license is included in the ``GNU Free
Documentation License'' file as part of this distribution.

View File

@@ -20,10 +20,13 @@ EXTRA_DIST = cfg.mk maint.mk \
.prev-version THANKS-to-translators THANKStt.in \
.version \
.vg-suppressions \
.x-po-check \
.x-sc_GPL_version \
.x-sc_file_system .x-sc_obsolete_symbols \
.x-sc_file_system \
.x-sc_obsolete_symbols \
.x-sc_po_check \
.x-sc_program_name \
.x-sc_prohibit_atoi_atof \
.x-sc_prohibit_stat_st_blocks \
.x-sc_prohibit_strcmp \
.x-sc_require_config_h \
.x-sc_space_tab .x-sc_sun_os_names \
@@ -57,7 +60,7 @@ ACLOCAL_AMFLAGS = -I m4
# Some tests always need root privileges, others need them only sometimes.
check-root:
cd tests && $(MAKE) $@
cd tests && $(MAKE) $@ SUBDIRS=
# Just prior to distribution, ...
# transform the automake-generated rule that runs `rm -f rm'.
@@ -99,8 +102,8 @@ MAINTAINERCLEANFILES = THANKS-to-translators
THANKS-to-translators: po/LINGUAS THANKStt.in
( \
cat $(srcdir)/THANKStt.in; \
for lang in `cat $(srcdir)/po/LINGUAS`; do \
echo http://www.iro.umontreal.ca/contrib/po/HTML/team-$$lang.html; \
for lang in `cat $(srcdir)/po/LINGUAS`; do \
echo http://translationproject.org/team/$$lang.html; \
done; \
) > $@-tmp && mv $@-tmp $@

245
NEWS
View File

@@ -1,5 +1,247 @@
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
Add extended attribute support available on certain filesystems like ext2
and XFS.
cp: Tries to copy xattrs when --preserve=xattr or --preserve=all specified
mv: Always tries to copy xattrs
install: Never copies xattrs
cp and mv accept a new option, --no-clobber (-n): silently refrain
from overwriting any existing destination file
dd accepts iflag=cio and oflag=cio to open the file in CIO (concurrent I/O)
mode where this feature is available.
install accepts a new option, --compare (-C): compare each pair of source
and destination files, and if the destination has identical content and
any specified owner, group, permissions, and possibly SELinux context, then
do not modify the destination at all.
ls --color now highlights hard linked files, too
stat -f recognizes the Lustre file system type
** Bug fixes
chgrp, chmod, chown --silent (--quiet, -f) no longer print some diagnostics
[bug introduced in coreutils-5.1]
cp uses much less memory in some situations
cp -a now correctly tries to preserve SELinux context (announced in 6.9.90),
doesn't inform about failure, unlike with --preserve=all
du --files0-from=FILE no longer reads all of FILE into RAM before
processing the first file name
seq 9223372036854775807 9223372036854775808 now prints only two numbers
on systems with extended long double support and good library support.
Even with this patch, on some systems, it still produces invalid output,
from 3 to at least 1026 lines long. [bug introduced in coreutils-6.11]
seq -w now accounts for a decimal point added to the last number
to correctly print all numbers to the same width.
wc --files0-from=FILE no longer reads all of FILE into RAM, before
processing the first file name, unless the list of names is known
to be small enough.
** Changes in behavior
cp and mv: the --reply={yes,no,query} option has been removed.
Using it has elicited a warning for the last three years.
dd: user specified offsets that are too big are handled better.
Previously, erroneous parameters to skip and seek could result
in redundant reading of the file with no warnings or errors.
du: -H (initially equivalent to --si) is now equivalent to
--dereference-args, and thus works as POSIX requires
shred: now does 3 overwrite passes by default rather than 25.
ls -l now marks SELinux-only files with the less obtrusive '.',
rather than '+'. A file with any other combination of MAC and ACL
is still marked with a '+'.
* Noteworthy changes in release 7.0 (2008-10-05) [beta]
** New programs
timeout: Run a command with bounded time.
truncate: Set the size of a file to a specified size.
** New features
chgrp, chmod, chown, chcon, du, rm: now all display linear performance,
even when operating on million-entry directories on ext3 and ext4 file
systems. Before, they would exhibit O(N^2) performance, due to linear
per-entry seek time cost when operating on entries in readdir order.
Rm was improved directly, while the others inherit the improvement
from the newer version of fts in gnulib.
comm now verifies that the inputs are in sorted order. This check can
be turned off with the --nocheck-order option.
comm accepts new option, --output-delimiter=STR, that allows specification
of an output delimiter other than the default single TAB.
cp and mv: the deprecated --reply=X option is now also undocumented.
dd accepts iflag=fullblock to make it accumulate full input blocks.
With this new option, after a short read, dd repeatedly calls read,
until it fills the incomplete block, reaches EOF, or encounters an error.
df accepts a new option --total, which produces a grand total of all
arguments after all arguments have been processed.
If the GNU MP library is available at configure time, factor and
expr support arbitrarily large numbers. Pollard's rho algorithm is
used to factor large numbers.
install accepts a new option --strip-program to specify the program used to
strip binaries.
ls now colorizes files with capabilities if libcap is available
ls -v now uses filevercmp function as sort predicate (instead of strverscmp)
md5sum now accepts the new option, --quiet, to suppress the printing of
'OK' messages. sha1sum, sha224sum, sha384sum, and sha512sum accept it, too.
sort accepts a new option, --files0-from=F, that specifies a file
containing a null-separated list of files to sort. This list is used
instead of filenames passed on the command-line to avoid problems with
maximum command-line (argv) length.
sort accepts a new option --batch-size=NMERGE, where NMERGE
represents the maximum number of inputs that will be merged at once.
When processing more than NMERGE inputs, sort uses temporary files.
sort accepts a new option --version-sort (-V, --sort=version),
specifying that ordering is to be based on filevercmp.
** Bug fixes
chcon --verbose now prints a newline after each message
od no longer suffers from platform bugs in printf(3). This is
probably most noticeable when using 'od -tfL' to print long doubles.
seq -0.1 0.1 2 now prints 2,0 when locale's decimal point is ",".
Before, it would mistakenly omit the final number in that example.
shuf honors the --zero-terminated (-z) option, even with --input-range=LO-HI
shuf --head-count is now correctly documented. The documentation
previously claimed it was called --head-lines.
** Improvements
Improved support for access control lists (ACLs): On MacOS X, Solaris 7..10,
HP-UX 11, Tru64, AIX, IRIX 6.5, and Cygwin, "ls -l" now displays the presence
of an ACL on a file via a '+' sign after the mode, and "cp -p" copies ACLs.
join has significantly better performance due to better memory management
ls now uses constant memory when not sorting and using one_per_line format,
no matter how many files are in a given directory
od now aligns fields across lines when printing multiple -t
specifiers, and no longer prints fields that resulted entirely from
padding the input out to the least common multiple width.
** Changes in behavior
stat's --context (-Z) option has always been a no-op.
Now it evokes a warning that it is obsolete and will be removed.
* Noteworthy changes in release 6.12 (2008-05-31) [stable]
** Bug fixes
chcon, runcon: --help output now includes the bug-reporting address
cp -p copies permissions more portably. For example, on MacOS X 10.5,
"cp -p some-fifo some-file" no longer fails while trying to copy the
permissions from the some-fifo argument.
id with no options now prints the SELinux context only when invoked
with no USERNAME argument.
id and groups once again print the AFS-specific nameless group-ID (PAG).
Printing of such large-numbered, kernel-only (not in /etc/group) group-IDs
was suppressed in 6.11 due to ignorance that they are useful.
uniq: avoid subtle field-skipping malfunction due to isblank misuse.
In some locales on some systems, isblank(240) (aka &nbsp) is nonzero.
On such systems, uniq --skip-fields=N would fail to skip the proper
number of fields for some inputs.
tac: avoid segfault with --regex (-r) and multiple files, e.g.,
"echo > x; tac -r x x". [bug present at least in textutils-1.8b, from 1992]
** Changes in behavior
install once again sets SELinux context, when possible
[it was deliberately disabled in 6.9.90]
* Noteworthy changes in release 6.11 (2008-04-19) [stable]
** Bug fixes
@@ -2180,8 +2422,7 @@ packages, see ./old/*/NEWS.
========================================================================
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 Free Software
Foundation, Inc.
Copyright (C) 2001-2009 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.2 or

30
README
View File

@@ -13,8 +13,9 @@ The programs that can be built with this package are:
link ln logname ls md5sum mkdir mkfifo mknod mktemp mv nice nl nohup
od paste pathchk pinky pr printenv printf ptx pwd readlink rm rmdir
runcon seq sha1sum sha224sum sha256sum sha384sum sha512sum shred shuf
sleep sort split stat stty su sum sync tac tail tee test touch tr true
tsort tty uname unexpand uniq unlink uptime users vdir wc who whoami yes
sleep sort split stat stty su sum sync tac tail tee test timeout touch tr
true truncate tsort tty uname unexpand uniq unlink uptime users vdir wc who
whoami yes
See the file NEWS for a list of major changes in the current release.
@@ -91,11 +92,15 @@ compiler, due to the use of declarations after non-declaration statements
in several files in src/. There is code in configure to find and, if
possible, enable an appropriate compiler. However, if configure doesn't
find a C99 compiler, it continues nonetheless, and your build will fail.
If that happens, simply apply the included patch using the following
If that happens, simply[*] apply the included patch using the following
command, and then run make again:
cd src && patch < c99-to-c89.diff
[*] however, as of coreutils-7.1, the "c99-to-c89.diff" file is no longer
maintained, so even if the patches still apply, the result will be an
incomplete conversion. It's been 10 years. Get a decent compiler! ;-)
***********************
HPUX 11.x build failure
@@ -145,7 +150,7 @@ I find that it is best to unpack and build as a non-privileged
user, and then to run the following command as that user in order
to run the privilege-requiring tests:
sudo env NON_ROOT_USERNAME=$USER make -k check-root
sudo env PATH="$PATH" NON_ROOT_USERNAME=$USER make -k check-root
If you can run the tests as root, please do so and report any
problems. We get much less test coverage in that mode, and it's
@@ -160,17 +165,13 @@ Reporting bugs:
IMPORTANT: if you take the time to report a test failure,
please be sure to include the output of running `make check'
in verbose mode for each failing test. For example,
if the test that fails is tests/mv/hard-link-1, then you
would run this command:
if the test that fails is tests/misc/df, then you would
run this command:
env VERBOSE=yes make check -C tests/mv TESTS=hard-link-1 >> log 2>&1
(cd tests && make check TESTS=misc/df VERBOSE=yes) >> log 2>&1
For some tests, you can get even more detail by including
DEBUG=yes in the environment:
env DEBUG=yes VERBOSE=yes make check -C tests/mv TESTS=hard-link-1 >> log 2>&1
and then include the contents of the file `log' in your bug report.
For some tests, you can get even more detail by adding DEBUG=yes.
Then include the contents of the file `log' in your bug report.
***************************************
@@ -230,8 +231,7 @@ the address on the last line of --help output.
========================================================================
Copyright (C) 1998, 2002, 2003, 2004, 2005, 2006 Free Software
Foundation, Inc.
Copyright (C) 1998, 2002-2009 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.2 or

View File

@@ -2,14 +2,15 @@
These notes intend to help people working on the checked-out sources.
These requirements do not apply when building from a distribution tarball.
See also HACKING for more detailed coreutils contribution guidlines.
* Requirements
We've opted to keep only the highest-level sources in the GIT repository.
This eases our maintenance burden, (fewer merges etc.), but imposes more
requirements on anyone wishing to build from the just-checked-out sources.
For example, you have to use the latest stable versions of the maintainer
tools we depend upon, including:
Specific tools and versions will be checked for and listed by the
bootstrap script shown below, and will include:
- Automake <http://www.gnu.org/software/automake/>
- Autoconf <http://www.gnu.org/software/autoconf/>
@@ -22,46 +23,44 @@ tools we depend upon, including:
- Rsync <http://samba.anu.edu.au/rsync/>
- Tar <http://www.gnu.org/software/tar/>
Valgrind <http://valgrind.org/> is also highly recommended, if
Valgrind supports your architecture.
Only building the initial full source tree will be a bit painful.
Later, a plain `git pull && make' should be sufficient.
* LZMA
- Valgrind
The coreutils build procedure can build distribution tarballs with the
LZMA compression scheme. This feature is so new that it is not
supported by the latest version of Automake. If you don't care about
building LZMA tarballs, you can manually remove the string "dist-lzma"
from configure.ac before bootstrapping.
Valgrind <http://valgrind.org/> is also highly recommended, if
Valgrind supports your architecture. See also README-valgrind.
If you do want to build LZMA tarballs, you'll need to make sure you
have the latest stable version of the LZMA Utils
<http://tukaani.org/lzma/>. Also, you'll need a version of
Automake that supports the dist-lzma feature, like automake-1.10.1.
- XZ utils (successor to LZMA)
This package's build procedure uses XZ to create a compressed
distribution tarball. Using this feature of Automake requires
version 1.10a or newer, as well as the xz program itself.
Make sure you have the latest version of the XZ Utils from
<http://tukaani.org/lzma/download>.
* First GIT checkout
You can get a copy of the source repository like this:
$ git clone git://git.sv.gnu.org/coreutils
$ git clone git://git.sv.gnu.org/coreutils
$ cd coreutils
The next step is to get other files needed to build, which are
extracted from other source packages:
The next step is to get and check other files needed to build,
which are extracted from other source packages:
$ ./bootstrap
$ ./bootstrap
And there you are! Just
$ ./configure
$ make
$ make check
$ ./configure #[--enable-gcc-warnings]
$ make
$ make check
At this point, there should be no difference between your local copy,
and the GIT master copy:
$ git diff
$ git diff
should output no difference.
@@ -69,7 +68,7 @@ Enjoy!
-----
Copyright (C) 2002-2007 Free Software Foundation, Inc.
Copyright (C) 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
@@ -83,3 +82,7 @@ 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/>.
Local Variables:
indent-tabs-mode: nil
End:

32
README-prereq Normal file
View File

@@ -0,0 +1,32 @@
Detailed below are concrete examples for
getting the prerequisites for particular systems.
- linux - fedora
This shows the steps for getting the required tools to build coreutils 7.0
on a Fedora 8 system. We try to use official packages where possible.
The 3 methods described for making these required packages available, should
help clarify build requirements on any linux system at least.
1. Make sure offical distro git package is installed
# yum install git
2. The distro autoconf is too old, but there is a newer one available
so we rebuild that and make it available to the full system:
# 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]
3. The latest released automake (1.10.1) was not new enough, so we download
and build automake-1.10a from its repository and make it available
just to coreutils:
# yum install help2man #required to build automake fully
$ git clone git://git.sv.gnu.org/automake.git
$ cd automake && ./configure --prefix=$HOME/coreutils/deps
$ make install
Now we can build coreutils as described in README-hacking
as long as $PATH starts with $HOME/coreutils/deps

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.

48
THANKS
View File

@@ -10,6 +10,7 @@ the bug-report mailing list (as seen on last line of e.g., cp --help).
A Costa agcosta@gis.net
Aaron Hawley ashawley@uvm.edu
Achim Blumensath blume@corona.oche.de
Adam Jimerson vendion@charter.net
Adam Klein aklein@debian.org
Adrian Bunk bunk@stusta.de
AIDA Shinra shinra@j10n.org
@@ -21,6 +22,9 @@ 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
Alexandre Duret-Lutz duret_g@epita.fr
Alexey Solovyov alekso@math.uu.se
@@ -32,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
@@ -57,6 +62,7 @@ Augey Mikus mikus@dqc.org
Aurelien Jarno aurel32@debian.org
Austin Donnelly Austin.Donnelly@cl.cam.ac.uk
Axel Kittenberger Anshil@gmx.net
Barry Kelly http://barrkel.blogspot.com/
Bauke Jan Douma bjdouma@xs4all.nl
Ben Elliston bje@air.net.au
Ben Harris bjh21@netbsd.org
@@ -78,12 +84,16 @@ Bob Proulx rwp@fc.hp.com
Branden Robinson branden@necrotic.deadbeast.net
Brendan O'Dea bod@compusol.com.au
Brian Kimball bfk@footbag.org
Brian M. Carlson sandals@crustytoothpaste.ath.cx
Brian Silverman bsilverman@conceptxdesign.com
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
Carlos Canau Carlos.Canau@relay.puug.pt
Charles Karney karney@pppl.gov
Charles Randall crandall@matchlogic.com
@@ -109,8 +119,9 @@ Cray-Cyber Project http://www.cray-cyber.org
Cristian Cadar cristic@stanford.edu
Cyril Bouthors cyril@bouthors.org
Dale Scheetz dwarf@polaris.net
Dameon G. Rogers dgr03@uark.edu
Dan Hagerty hag@gnu.ai.it.edu
Dan Jacobson http://www.geocities.com/jidani
Dan Jacobson jidanni@jidanni.org
Dan Pascu dan@services.iiruc.ro
Daniel Bergstrom noa@melody.se
Daniel Dunbar ddunbar@stanford.edu
@@ -121,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
@@ -128,9 +140,11 @@ 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
Denis Excoffier denis.excoffier@airbus.com
Dennis Henriksen opus@flamingo.osrl.dk
Dennis Smit ds@nerds-incorporated.org
Derek Clegg dclegg@next.com
@@ -155,6 +169,7 @@ Elbert Pol elbert.pol@gmail.com
Eli Zaretskii eliz@is.elta.co.il
Elias Pipping pipping@gentoo.org
Emile LeBlanc leblanc@math.toronto.edu
Erik Auerswald auerswal@unix-ag.uni-kl.de
Eric Backus ericb@lsid.hp.com
Eric Blake ebb9@byu.net
Eric G. Miller egm2@jps.net
@@ -180,6 +195,7 @@ Gabor Z. Papp gzp@gzp.org.hu
Gaël Quéri gqueri@mail.dotcom.fr
Galen Hazelwood galenh@micron.net
Gary Anderson ganderson@clark.net
Gary Johnson garyjohn@spk.agilent.com
Gary V. Vaughan gary@gnu.org
Gaute Hvoslef Kvalnes gaute@verdsveven.com
Geoff Collyer geoff at collyer.net
@@ -189,11 +205,13 @@ 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
Greg McGary gkm@gnu.org
Greg Metcalfe metcalfegreg@qwest.net
Greg Schafer gschafer@zip.com.au
Greg Troxel gdt@bbn.com
Greg Wooledge gawooledge@sherwin.com
@@ -208,6 +226,7 @@ Harald Dunkel harald.dunkel@t-online.de
Harry Liu rliu@lek.ugcs.caltech.edu
Harti Brandt brandt@fokus.fraunhofer.de
Harvey Eneman Harvey.Eneman@oracle.com
Heiko Marr h.marr@webmasters.de
Helen Faulkner helen_ml_faulkner@yahoo.co.uk
Herbert Xu herbert@gondor.apana.org.au
Holger Berger hberger@ess.nec.de
@@ -219,6 +238,7 @@ Ian Jackson ijackson@chiark.greenend.org.uk
Ian Lance Taylor ian@cygnus.com
Ian Turner vectro@pipeline.com
Iida Yosiaki iida@gnu.org
Ilya N. Golubev gin@mo.msk.ru
Ingo Saitz ingo@debian.org
Ivo Timmermans ivo@debian.org
James james@albion.glarp.com
@@ -228,19 +248,22 @@ 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
Jan Fedak J.Fedak@sh.cvut.cz
Jan Moringen jan.moringen@uni-bielefeld.de
Jan Nieuwenhuizen janneke@gnu.org
Janos Farkas chexum@shadow.banki.hu
Jarkko Hietaniemi jhi@epsilon.hut.fi
Jarod Wilson jwilson@redhat.com
Jean Charles Delepine delepine@u-picardie.fr
Jeff Moore jbm@mordor.com
Jeff Sheinberg jeff@bsrd.net
Jens Elkner elkner@imsgroup.de
Jens Schmidt jms@jsds.hamburg.com
Jeph Cowan jeph@ucar.edu
Jeremy Maitin-Shepard jbms@cmu.edu
Jerome Abela abela@hsc.fr
Jérôme Zago bug-coreutils-ml@agt-the-walker.net
@@ -270,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
@@ -343,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
@@ -356,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
@@ -379,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
@@ -392,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
@@ -408,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
@@ -429,9 +459,11 @@ Peter Moulder reiter@netspace.net.au
Peter O'Gorman bug-coreutils@mlists.thewrittenword.com
Peter Samuelson psamuels@sampo.creighton.edu
Peter Seebach seebs@taniemarie.solon.com
Petr Uzel petr.uzel@suse.cz
Petter Reinholdtsen pere@hungry.com
Phelippe Neveu pneveu@pcigeomatics.com
Phil Richards phil.richards@vf.vodafone.co.uk
Philip Rowlands phr@doc.ic.ac.uk
Philippe De Muyter phdm@macqel.be
Philippe Schnoebelen Philippe.Schnoebelen@imag.fr
Phillip Jones mouse@datastacks.com
@@ -439,6 +471,7 @@ Piergiorgio Sartor sartor@sony.de
Pieter Bowman bowman@math.utah.edu
Piotr Kwapulinski kwap@univ.gda.pl
Prashant TR tr@eth.net
Priit Jõerüüt jemm4jemm@yahoo.com
Rainer Orth ro@TechFak.Uni-Bielefeld.DE
Ralf W. Stephan stephan@tmt.de
Ralf Wildenhues Ralf.Wildenhues@gmx.de
@@ -466,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
@@ -492,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
@@ -509,8 +544,10 @@ Thomas Schwinge tschwinge@gnu.org
Thomas Wolff mined@towo.net
Tim J. Robbins tjr@FreeBSD.org
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
@@ -527,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
@@ -534,7 +572,9 @@ Uwe H. Steinfeld usteinfeld@gmx.net
Vesselin Atanasov vesselin@bgnet.bg
Vin Shelton acs@alumni.princeton.edu
Vineet Chadha chadha@acis.ufl.edu
Vitali Lovich vlovich@gmail.com
Vitaly A. Ostanin vyt@altlinux.org
Vito Caputo vcaputo@pengaru.com
Vlada Macek tuttle@bbs.fsik.cvut.cz
Volker Borchert bt@teknon.de
Volker Paul vpaul@dohle.com

48
TODO
View File

@@ -5,19 +5,30 @@ longer pertinent, please search the mailing list and post your intent
before embarking on a big project.
==================================================
Modify chmod so that it does not change an inode's st_ctime
when the selected operation would have no other effect.
First suggested by Hans Ecke <http://hans.ecke.ws> in
http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/2920
Discussed more recently on <http://bugs.debian.org/497514>.
document the following in coreutils.texi:
runcon
chcon
mktemp
[
pinky
uptime
Also document the SELinux changes.
comm: add an option, --output-delimiter=STR
Files to change: src/comm.c, ChangeLog, NEWS, doc/coreutils.texi,
Add a new file, tests/misc/comm (use another file in that directory as
a template), to exercise the new option. Suggestion from Dan Jacobson.
Suggestion from Paul Eggert:
More generally, there's not that much use for imaxtostr nowadays,
since the inttypes module and newer versions of gettext allow things
like _("truncating %s at %" PRIdMAX " bytes") to work portably.
I suspect that (if someone cares to take the time) we can remove
all instances of imaxtostr and umaxtostr in coreutils and gnulib.
cp --recursive: use fts and *at functions to perform directory traversals
in source and destination hierarchy rather than forming full file names.
The latter (current) approach fails unnecessarily when the names
become very long, and requires space and time that is quadratic in the
depth of the hierarchy. [Bo Borgerson is working on this]
printf:
Now that gnulib supports *printf("%a"), import one of the
@@ -29,9 +40,6 @@ renice: POSIX utility, needs implementing.
suggestion from Karl Berry (among others).
Bob Proulx is working on this.
install: add an option to specify the program used to strip binaries.
suggestion from Karl Berry
doc/coreutils.texi:
Address this comment: FIXME: mv's behavior in this case is system-dependent
Better still: fix the code so it's *not* system-dependent.
@@ -59,8 +67,6 @@ Should printf '\0123' print "\n3"?
printf: consider adapting builtins/printf.def from bash
df: add `--total' option, suggested here http://bugs.debian.org/186007
tail: don't use xlseek; it *exits*.
Instead, maybe use a macro and return nonzero.
@@ -96,9 +102,8 @@ sort: Investigate better sorting algorithms; see Knuth vol. 3.
5.3.1, who credits Lester Ford, Jr. and Selmer Johnson, American
Mathematical Monthly 66 (1959), 387-389.
cp --recursive: perform dir traversals in source and dest hierarchy rather
than forming full file names. The latter (current) approach fails
unnecessarily when the names become very long.
shred: Update shred as described here to conform to DoD 5220 rules:
http://lists.gnu.org/archive/html/bug-coreutils/2007-05/msg00075.html
Remove suspicious uses of alloca (ones that may allocate more than
about 4k)
@@ -106,6 +111,9 @@ Remove suspicious uses of alloca (ones that may allocate more than
Adapt these contribution guidelines for coreutils:
http://sources.redhat.com/automake/contribute.html
Improve test coverage.
See HACKING for instructions on generating an html test coverage report.
Find a program that has poor coverage and improve.
Changes expected to go in, someday.
======================================
@@ -120,9 +128,6 @@ Changes expected to go in, someday.
an implicit --NO-dereference-command-line-symlink-to-dir meaning.
Pointed out by Karl Berry.
A more efficient version of factor, and possibly one that
accepts inputs of size 2^64 and larger.
dd: consider adding an option to suppress `bytes/block read/written'
output to stderr. Suggested here:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=165045
@@ -152,6 +157,11 @@ remove all uses of the `register' keyword: Done. add a maint.mk rule
remove or adjust chown's --changes option, since it
can't always do what it currently says it does.
Support arbitrary-precision arithmetic in those tools for which it
makes sense. Factor and expr already support this via libgmp.
The "test" program is covered via its string-based comparison of
integers. To be converted: seq.
Adapt tools like wc, tr, fmt, etc. (most of the textutils) to be
multibyte aware. The problem is that I want to avoid duplicating
significant blocks of logic, yet I also want to incur only minimal
@@ -161,7 +171,7 @@ pr's use of nstrftime can make it malloc a very large (up to SIZE_MAX) buffer
-----
Copyright (C) 2002-2008 Free Software Foundation, Inc.
Copyright (C) 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

225
bootstrap
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
@@ -49,9 +49,12 @@ Options:
not to have been checked out.
--skip-po Do not download po files.
If the file bootstrap.conf exists in the current working directory, its
If the file $0.conf exists in the same directory as this script, its
contents are read as shell variables to configure the bootstrap.
For build prerequisites, environment variables like \$AUTOCONF and \$AMTAR
are honored.
Running without arguments will suffice in most cases.
"
}
@@ -146,7 +149,13 @@ copy=false
vc_ignore=auto
# Override the default configuration, if necessary.
test -r bootstrap.conf && . ./bootstrap.conf
# Make sure that bootstrap.conf is sourced from the current directory
# if we were invoked as "sh bootstrap".
case "$0" in
*/*) test -r "$0.conf" && . "$0.conf" ;;
*) test -r "$0.conf" && . ./"$0.conf" ;;
esac
if test "$vc_ignore" = auto; then
vc_ignore=
@@ -165,7 +174,7 @@ do
usage
exit;;
--gnulib-srcdir=*)
GNULIB_SRCDIR=`expr "$option" : '--gnulib-srcdir=\(.*\)'`;;
GNULIB_SRCDIR=`expr "X$option" : 'X--gnulib-srcdir=\(.*\)'`;;
--skip-po)
SKIP_PO=t;;
--force)
@@ -189,7 +198,7 @@ insert_sorted_if_absent() {
file=$1
str=$2
test -f $file || touch $file
echo "$str" | sort -u - $file | cmp -s - $file \
echo "$str" | sort -u - $file | cmp - $file > /dev/null \
|| echo "$str" | sort -u - $file -o $file \
|| exit 1
}
@@ -216,29 +225,161 @@ if test ! -d $build_aux; then
done
fi
# Note this deviates from the version comparison in automake
# in that it treats 1.5 < 1.5.0, and treats 1.4.4a < 1.4-p3a
# but this should suffice as we won't be specifying old
# version formats or redundant trailing .0 in bootstrap.conf.
# If we did want full compatibility then we should probably
# use m4_version_compare from autoconf.
sort_ver() { #sort -V is not generally available
ver1="$1"
ver2="$2"
#split on '.' and compare each component
i=1
while : ; do
p1=$(echo "$ver1" | cut -d. -f$i)
p2=$(echo "$ver2" | cut -d. -f$i)
if [ ! "$p1" ]; then
echo "$1 $2"
break
elif [ ! "$p2" ]; then
echo "$2 $1"
break
elif [ ! "$p1" = "$p2" ]; then
if [ "$p1" -gt "$p2" ] 2>/dev/null; then #numeric comparision
echo "$2 $1"
elif [ "$p2" -gt "$p1" ] 2>/dev/null; then #numeric comparision
echo "$1 $2"
else #numeric, then lexographic comparison
lp=$(printf "$p1\n$p2\n" | LANG=C sort -n | tail -n1)
if [ "$lp" = "$p2" ]; then
echo "$1 $2"
else
echo "$2 $1"
fi
fi
break
fi
i=$(($i+1))
done
}
get_version() {
app=$1
$app --version >/dev/null 2>&1 || return 1
$app --version 2>&1 |
sed -n 's/[^0-9.]*\([0-9]\{1,\}\.[.a-z0-9-]*\).*/\1/p
t done
d
:done
q'
}
check_versions() {
ret=0
while read app req_ver; do
# Honor $APP variables ($TAR, $AUTOCONF, etc.)
appvar=`echo $app | tr '[a-z]' '[A-Z]'`
test "$appvar" = TAR && appvar=AMTAR
eval "app=\${$appvar-$app}"
inst_ver=$(get_version $app)
if [ ! "$inst_ver" ]; then
echo "Error: '$app' not found" >&2
ret=1
elif [ ! "$req_ver" = "-" ]; then
latest_ver=$(sort_ver $req_ver $inst_ver | cut -d' ' -f2)
if [ ! "$latest_ver" = "$inst_ver" ]; then
echo "Error: '$app' version == $inst_ver is too old" >&2
echo " '$app' version >= $req_ver is required" >&2
ret=1
fi
fi
done
return $ret
}
print_versions() {
echo "Program Min_version"
echo "----------------------"
printf "$buildreq"
echo "----------------------"
#can't depend on column -t
}
if ! printf "$buildreq" | check_versions; then
test -f README-prereq &&
echo "Please see README-prereq for notes on obtaining these prerequisite programs:" >&2
echo
print_versions
exit 1
fi
echo "$0: Bootstrapping from checked-out $package sources..."
# See if we can use gnulib's git-merge-changelog merge driver.
if test -d .git && (git --version) >/dev/null 2>/dev/null ; then
if git config merge.merge-changelog.driver >/dev/null ; then
:
elif (git-merge-changelog --version) >/dev/null 2>/dev/null ; then
echo "initializing git-merge-changelog driver"
git config merge.merge-changelog.name 'GNU-style ChangeLog merge driver'
git config merge.merge-changelog.driver 'git-merge-changelog %O %A %B'
else
echo "consider installing git-merge-changelog from gnulib"
fi
fi
cleanup_gnulib() {
status=$?
rm -fr gnulib
exit $status
}
git_modules_config () {
GIT_CONFIG=.gitmodules git config "$@"
}
# Get gnulib files.
case ${GNULIB_SRCDIR--} in
-)
if [ ! -d gnulib ]; then
if git_modules_config submodule.gnulib.url >/dev/null; then
echo "$0: getting gnulib files..."
git submodule init || exit $?
git submodule update || exit $?
elif [ ! -d gnulib ]; then
echo "$0: getting gnulib files..."
trap cleanup_gnulib 1 2 13 15
git clone --depth 2 git://git.sv.gnu.org/gnulib ||
git clone --help|grep depth > /dev/null && depth='--depth 2' || depth=
git clone $depth git://git.sv.gnu.org/gnulib ||
cleanup_gnulib
trap - 1 2 13 15
fi
GNULIB_SRCDIR=gnulib
;;
*)
# Redirect the gnulib submodule to the directory on the command line
# if possible.
if test -d "$GNULIB_SRCDIR"/.git && \
git_modules_config submodule.gnulib.url >/dev/null; then
git submodule init
GNULIB_SRCDIR=`cd $GNULIB_SRCDIR && pwd`
git config --replace-all submodule.gnulib.url $GNULIB_SRCDIR
echo "$0: getting gnulib files..."
git submodule update || exit $?
GNULIB_SRCDIR=gnulib
fi
;;
esac
gnulib_tool=$GNULIB_SRCDIR/gnulib-tool
@@ -273,15 +414,15 @@ update_po_files() {
langs=`cd $ref_po_dir && echo *.po|sed 's/\.po//g'`
test "$langs" = '*' && langs=x
for po in `cd $ref_po_dir && echo *.po|sed 's/\.po//g'`; do
for po in $langs; do
case $po in x) continue;; esac
new_po="$ref_po_dir/$po.po"
cksum_file="$ref_po_dir/$po.s1"
if ! test -f "$cksum_file" ||
! test -f "$po_dir/$po.po" ||
! sha1sum -c --status "$cksum_file" < "$new_po" > /dev/null; then
! ${SHA1SUM-sha1sum} -c --status "$cksum_file" < "$new_po" > /dev/null; then
echo "updated $po_dir/$po.po..."
cp "$new_po" "$po_dir/$po.po" && sha1sum < "$new_po" > "$cksum_file"
cp "$new_po" "$po_dir/$po.po" && ${SHA1SUM-sha1sum} < "$new_po" > "$cksum_file"
fi
done
}
@@ -383,9 +524,13 @@ cp_mark_as_generated()
if test -z "$c1"; then
cmp -s "$cp_src" "$cp_dst" || {
# Copy the file first to get proper permissions if it
# doesn't already exist. Then overwrite the copy.
echo "$0: cp -f $cp_src $cp_dst" &&
rm -f "$cp_dst" &&
sed "s!$bt_regex/!!g" "$cp_src" > "$cp_dst"
cp "$cp_src" "$cp_dst-t" &&
sed "s!$bt_regex/!!g" "$cp_src" > "$cp_dst-t" &&
mv -f "$cp_dst-t" "$cp_dst"
}
else
# Copy the file first to get proper permissions if it
@@ -440,7 +585,7 @@ slurp() {
if test $file = Makefile.am; then
copied=$copied${sep}$gnulib_mk; sep=$nl
remove_intl='/^[^#].*\/intl/s/^/#/;'"s!$bt_regex/!!g"
sed "$remove_intl" $1/$dir/$file | cmp -s - $dir/$gnulib_mk || {
sed "$remove_intl" $1/$dir/$file | cmp - $dir/$gnulib_mk > /dev/null || {
echo "$0: Copying $1/$dir/$file to $dir/$gnulib_mk ..." &&
rm -f $dir/$gnulib_mk &&
sed "$remove_intl" $1/$dir/$file >$dir/$gnulib_mk
@@ -522,32 +667,12 @@ grep '^[ ]*AM_GNU_GETTEXT_VERSION(' configure.ac >/dev/null || \
with_gettext=no
if test $with_gettext = yes; then
echo "$0: (cd $bt2; autopoint) ..."
echo "$0: (cd $bt2; ${AUTOPOINT-autopoint}) ..."
cp configure.ac $bt2 &&
(cd $bt2 && autopoint && rm configure.ac) &&
(cd $bt2 && ${AUTOPOINT-autopoint} && rm configure.ac) &&
slurp $bt2 $bt || exit
rm -fr $bt $bt2 || exit
fi
# Coreutils is unusual in that it generates some of its test-related
# Makefile.am files. That must be done before invoking automake.
mam_template=tests/Makefile.am.in
if test -f $mam_template; then
PERL=perl
for tool in cut head join pr sort tac tail test tr uniq wc; do
m=tests/$tool/Makefile.am
t=${m}t
rm -f $m $t
sed -n '1,/^##test-files-begin/p' $mam_template > $t
echo "x = $tool" >> $t
srcdir=tests/$tool
$PERL -I$srcdir -w -- tests/mk-script $srcdir --list >> $t
sed -n '/^##test-files-end/,$p' $mam_template >> $t
chmod -w $t
mv $t $m
done
fi
rm -fr $bt $bt2 || exit
# Remove any dangling symlink matching "*.m4" or "*.[ch]" in some
# gnulib-populated directories. Such .m4 files would cause aclocal to fail.
@@ -561,20 +686,33 @@ 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 \
libtool \
'aclocal --force -I m4' \
'autoconf --force' \
'autoheader --force' \
'automake --add-missing --copy --force-missing';
"${ACLOCAL-aclocal} --force -I m4" \
"${AUTOCONF-autoconf} --force" \
"${AUTOHEADER-autoheader} --force" \
"$automake"
do
if test "$command" = libtool; then
grep '^[ ]*AM_PROG_LIBTOOL\>' configure.ac >/dev/null ||
continue
command='libtoolize -c -f'
use_libtool=0
# We'd like to use grep -E, to see if any of LT_INIT,
# AC_PROG_LIBTOOL, AM_PROG_LIBTOOL is used in configure.ac,
# but that's not portable enough (e.g., for Solaris).
grep '^[ ]*A[CM]_PROG_LIBTOOL' configure.ac >/dev/null \
&& use_libtool=1
grep '^[ ]*LT_INIT' configure.ac >/dev/null \
&& use_libtool=1
test $use_libtool = 0 \
&& continue
command="${LIBTOOLIZE-libtoolize} -c -f"
fi
echo "$0: $command ..."
$command || exit
@@ -630,7 +768,4 @@ m=gnulib-tests/gnulib.mk
sed 's,\.\./\.\.,..,g' $m > $m-t
mv -f $m-t $m
# Make tests executable.
chmod a+x gnulib-tests/test-*.sh
echo "$0: done. Now you can run './configure'."

View File

@@ -1,6 +1,6 @@
# Bootstrap configuration.
# Copyright (C) 2006-2008 Free Software Foundation, Inc.
# Copyright (C) 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
@@ -16,11 +16,11 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# We don't need these modules, even though gnulib-tool mistakenly
# includes them because of gettext and fchdir dependencies.
# We don't need these modules.
avoided_gnulib_modules='
--avoid=lock
--avoid=canonicalize-lgpl
--avoid=dummy
--avoid=lock
'
# These modules are obsolete and can probably be removed soon,
@@ -34,38 +34,53 @@ obsolete_gnulib_modules='
gnulib_modules="
$avoided_gnulib_modules
$obsolete_gnulib_modules
acl alloca announce-gen argmatch assert
acl alloca announce-gen argmatch
argv-iter
assert
autobuild
backupfile base64
c-strcase c-strtod
c-strtold calloc canon-host canonicalize chown cloexec
config-h configmake
closein closeout
crypto/md5 crypto/sha1
sha256 sha512
crypto/md5
crypto/sha1
crypto/sha256
crypto/sha512
cycle-check
d-ino d-type diacrit dirfd dirname dup2
error euidaccess exclude exitfail fchdir fcntl fcntl-safer fdl
file-type fileblocks filemode filenamecat fnmatch-gnu
file-type fileblocks filemode filenamecat filevercmp fnmatch-gnu
fopen-safer
fprintftime
fseeko
fsusage ftruncate
ftello
fts getdate getgroups gethrxtime
gendocs
getline getloadavg getndelim2 getopt getpagesize getpass-gnu
gettext gettime gettimeofday getugroups getusershell
git-version-gen
gitlog-to-changelog
gnu-make gnumakefile gnupload
group-member hard-locale hash hash-pjw host-os human idcache
ignore-value
inttostr inttypes isapipe
lchmod lchown lib-ignore linebuffer link-follow
long-options lstat malloc mbswidth memcasecmp mempcpy
long-options lstat malloc
manywarnings
mbrtowc
mbswidth
memcasecmp memcmp2 mempcpy
memrchr mgetgroups
mkancesdirs mkdir mkdir-p mkstemp mktime modechange
mountlist mpsort obstack pathmax perl physmem
posix-shell posixtm posixver putenv
posix-shell
posixtm
posixver
progname
propername
putenv
quote quotearg raise readlink areadlink-with-size
randint
randperm
@@ -77,9 +92,10 @@ gnulib_modules="
safe-read same
save-cwd savedir savewd
selinux-at
settime sig2str ssize_t stat-macros
settime sig2str sigaction ssize_t stat-macros
stat-time stdbool stdlib-safer stpcpy
stpncpy
strdup
strftime
strpbrk strtoimax strtoumax strverscmp sys_stat timespec tzset
unicodeio unistd-safer unlink-busy unlinkdir unlocked-io
@@ -88,9 +104,12 @@ gnulib_modules="
userspec utimecmp utimens
vasprintf-posix
vc-list-files
verify version-etc-fsf
verify version-etc-fsf verror
warnings
wcwidth winsz-ioctl winsz-termios write-any-file
xalloc xgetcwd xgethostname
xalloc
xfreopen
xgetcwd xgethostname
xmemcoll xnanosleep
xprintf
xprintf-posix
@@ -103,17 +122,27 @@ 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.
see_manual='"This is a proper name. See the gettext manual, section Names."'
see_manual=\'"$see_manual"\'
XGETTEXT_OPTIONS=$XGETTEXT_OPTIONS'\\\
--keyword=proper_name:1,'"$see_manual"'\\\
--keyword=proper_name_utf8:1,'"$see_manual"'\\\
'
# If "AM_GNU_GETTEXT(external" or "AM_GNU_GETTEXT([external]"
@@ -145,5 +174,21 @@ fi
gnulib_tool_option_extras="--tests-base=$bt/gnulib-tests --with-tests"
# Build prerequisites
buildreq="\
autoconf 2.61
automake 1.10a
autopoint -
bison -
gettext -
git 1.4.4
gperf -
gzip -
makeinfo -
perl 5.5
rsync -
tar -
"
# Automake requires that ChangeLog exist.
touch ChangeLog

View File

@@ -41,7 +41,7 @@ ENABLE_HARD_ERRORS = :
## We use GNU Make extensions (%-rules) inside GNU_MAKE checks,
## and we override check-TESTS.
AUTOMAKE_OPTIONS = -Wno-portability -Wno-override
AUTOMAKE_OPTIONS += -Wno-portability -Wno-override
# Restructured Text title and section.
am__rst_title = sed 's/.*/ & /;h;s/./=/g;p;x;p;g;p;s/.*//'
@@ -100,15 +100,20 @@ _dirname = \
# To be inserted before the command running the test. Creates the
# directory for the log if needed. Stores in $dir the directory
# containing $src, and passes TESTS_ENVIRONMENT.
# Save and restore TERM around use of TESTS_ENVIRONMENT,
# in case that unsets it.
am__check_pre = \
$(SH_E_WORKAROUND); \
tst=`echo "$$src" | sed 's|^.*/||'`; \
rm -f $@-t; \
trap 'st=$$?; rm -f '\''$(abs_builddir)/$@-t'\''; (exit $$st); exit $$st' \
1 2 13 15; \
$(mkdir_p) "$$(echo '$@'|$(_dirname))" || exit; \
if test -f "./$$src"; then dir=./; \
elif test -f "$$src"; then dir=; \
else dir="$(srcdir)/"; fi; \
$(TESTS_ENVIRONMENT) $(SHELL)
__SAVED_TERM=$$TERM; \
$(TESTS_ENVIRONMENT)
# To be appended to the command running the test. Handles the stdout
# and stderr redirection, and catch the exit status.
@@ -118,6 +123,7 @@ estatus=$$?; \
if test $$estatus -eq 177; then \
$(ENABLE_HARD_ERRORS) || estatus=1; \
fi; \
TERM=$$__SAVED_TERM; export TERM; \
$(am__tty_colors); \
xfailed=PASS; \
for xfail in : $(XFAIL_TESTS); do \
@@ -139,7 +145,7 @@ echo "$$res: $@ (exit: $$estatus)" | \
cat $@-t >>$@; \
rm $@-t
SUFFIXES = .html .log
SUFFIXES += .html .log
# From a test (with no extension) to a log file.
if GNU_MAKE
@@ -153,8 +159,9 @@ CHECK-FORCE:
DEPENDENCY = CHECK-FORCE
$(TEST_LOGS): $(DEPENDENCY)
@if test '$(DEPENDENCY)' = CHECK-FORCE; then \
dst=$@; \
exec $(MAKE) $(AM_MAKEFLAGS) DEPENDENCY='$(srcdir)'/$${dst%.log} $@;\
dst=$@; src=$${dst%.log}; \
test -x "$$src" || src='$(srcdir)'/$$src; \
exec $(MAKE) $(AM_MAKEFLAGS) DEPENDENCY="$$src" $@; \
else \
src='$(DEPENDENCY)'; \
$(am__check_pre) "$$dir$$src" $(am__check_post); \
@@ -206,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; \

158
cfg.mk
View File

@@ -1,5 +1,5 @@
# Customize maint.mk -*- makefile -*-
# 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
@@ -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
@@ -33,9 +36,162 @@ gpg_key_ID = B9AB9A16
# at the top of the file for each `make distcheck' run.
local-checks-to-skip = changelog-check strftime-check
local-checks-to-skip += patch-check
# The local directory containing the checked-out copy of gnulib used in this
# release. Used solely to get gnulib's SHA1 for the "announcement" target.
gnulib_dir = /gnulib
# Now that we have better (check.mk) tests, make this the default.
export VERBOSE = yes
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 '/^ +\| (O_\w*)$$/ and print $$1' \
$(dd); } | sort > $@.1
@{ echo O_NOFOLLOW; perl -nle '/{"[a-z]+",\s*(O_\w+)},/ and print $$1' \
$(dd); } | sort > $@.2
@diff -u $@.1 $@.2 || diff=1 || diff=; \
rm -f $@.1 $@.2; \
test "$$diff" \
&& { echo '$(ME): $(dd) has inconsistent O_ flag lists'>&2; \
exit 1; } || :
# Ensure that dd's definition of LONGEST_SYMBOL stays in sync
# with the strings from the two affected variables.
dd_c = $(srcdir)/src/dd.c
sc_dd_max_sym_length:
ifneq ($(wildcard $(dd_c)),)
@len=$$( (sed -n '/conversions\[\] =$$/,/^};/p' $(dd_c);\
sed -n '/flags\[\] =$$/,/^};/p' $(dd_c) ) \
|sed -n '/"/s/^[^"]*"\([^"]*\)".*/\1/p' \
| wc --max-line-length); \
max=$$(sed -n '/^#define LONGEST_SYMBOL /s///p' $(dd_c) \
|tr -d '"' | wc --max-line-length); \
if test "$$len" = "$$max"; then :; else \
echo 'dd.c: LONGEST_SYMBOL is not longest' 1>&2; \
exit 1; \
fi
endif
# Many m4 macros names once began with `jm_'.
# On 2004-04-13, they were all changed to start with gl_ instead.
# Make sure that none are inadvertently reintroduced.
sc_prohibit_jm_in_m4:
@grep -nE 'jm_[A-Z]' \
$$($(VC_LIST) m4 |grep '\.m4$$'; echo /dev/null) && \
{ echo '$(ME): do not use jm_ in m4 macro names' \
1>&2; exit 1; } || :
# Ensure that each root-requiring test is run via the "check-root" rule.
sc_root_tests:
@if test -d tests \
&& grep check-root tests/Makefile.am>/dev/null 2>&1; then \
t1=sc-root.expected; t2=sc-root.actual; \
grep -nl '^require_root_$$' \
$$($(VC_LIST) tests) |sed s,tests/,, |sort > $$t1; \
sed -n '/^root_tests =[ ]*\\$$/,/[^\]$$/p' \
$(srcdir)/tests/Makefile.am \
| sed 's/^ *//;/^root_tests =/d' \
| tr -s '\012\\' ' ' | fmt -1 | sort > $$t2; \
diff -u $$t1 $$t2 || diff=1 || diff=; \
rm -f $$t1 $$t2; \
test "$$diff" \
&& { echo 'tests/Makefile.am: missing check-root action'>&2; \
exit 1; } || :; \
fi
headers_with_interesting_macro_defs = \
exit.h \
fcntl_.h \
fnmatch_.h \
intprops.h \
inttypes_.h \
lchown.h \
openat.h \
stat-macros.h \
stdint_.h
# Create a list of regular expressions matching the names
# of macros that are guaranteed by parts of gnulib to be defined.
.re-defmac:
@(cd $(srcdir)/lib; \
for f in $(headers_with_interesting_macro_defs); do \
test -f $$f && \
sed -n '/^# *define \([^_ (][^ (]*\)[ (].*/s//\1/p' $$f; \
done; \
) | sort -u \
| grep -Ev 'ATTRIBUTE_NORETURN|SIZE_MAX' \
| sed 's/^/^# *define /' \
> $@-t
@mv $@-t $@
# Don't define macros that we already get from gnulib header files.
sc_always_defined_macros: .re-defmac
@if test -f $(srcdir)/src/system.h; then \
trap 'rc=$$?; rm -f .re-defmac; exit $$rc' 0 1 2 3 15; \
grep -f .re-defmac $$($(VC_LIST)) \
&& { echo '$(ME): define the above via some gnulib .h file' \
1>&2; exit 1; } || :; \
fi
# Create a list of regular expressions matching the names
# of files included from system.h. Exclude a couple.
.re-list:
@sed -n '/^# *include /s///p' $(srcdir)/src/system.h \
| grep -Ev 'sys/(param|file)\.h' \
| sed 's/ .*//;;s/^["<]/^# *include [<"]/;s/\.h[">]$$/\\.h[">]/' \
> $@-t
@mv $@-t $@
# Files in src/ should not include directly any of
# the headers already included via system.h.
sc_system_h_headers: .re-list
@if test -f $(srcdir)/src/system.h; then \
trap 'rc=$$?; rm -f .re-list; exit $$rc' 0 1 2 3 15; \
grep -nE -f .re-list \
$$($(VC_LIST) src | \
grep -Ev '((copy|system)\.h|parse-gram\.c)$$') \
&& { echo '$(ME): the above are already included via system.h'\
1>&2; exit 1; } || :; \
fi
sc_sun_os_names:
@grep -nEi \
'solaris[^[:alnum:]]*2\.(7|8|9|[1-9][0-9])|sunos[^[:alnum:]][6-9]' \
$$($(VC_LIST_EXCEPT)) && \
{ echo '$(ME): found misuse of Sun OS version numbers' 1>&2; \
exit 1; } || :
sc_tight_scope:
@$(MAKE) -C src $@
# Perl-based tests used to exec perl from a #!/bin/sh script.
# Now they all start with #!/usr/bin/perl and the portability
# infrastructure is in tests/Makefile.am. Make sure no old-style
# script sneaks back in.
sc_no_exec_perl_coreutils:
@if test -f $(srcdir)/tests/Coreutils.pm; then \
grep '^exec *\$$PERL.*MCoreutils' $$($(VC_LIST) tests) && \
{ echo 1>&2 '$(ME): found anachronistic Perl-based tests'; \
exit 1; } || :; \
fi
# Ensure that date's --help output stays in sync with the info
# documentation for GNU strftime. The only exception is %N,
# which date accepts but GNU strftime does not.
extract_char = sed 's/^[^%][^%]*%\(.\).*/\1/'
sc_strftime_check:
@if test -f $(srcdir)/src/date.c; then \
grep '^ %. ' $(srcdir)/src/date.c | sort \
| $(extract_char) > $@-src; \
{ echo N; \
info libc date calendar format | grep '^ `%.'\' \
| $(extract_char); } | sort > $@-info; \
diff -u $@-src $@-info || exit 1; \
rm -f $@-src $@-info; \
fi

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
@@ -18,7 +18,7 @@
dnl Written by Jim Meyering.
AC_PREREQ(2.61)
AC_PREREQ([2.61])
# Make inter-release version strings look like, e.g., v6.9-219-g58ddd, which
# indicates that it is built from the 219th delta (in _some_ repository)
@@ -27,13 +27,12 @@ AC_INIT([GNU coreutils],
m4_esyscmd([build-aux/git-version-gen .tarball-version]),
[bug-coreutils@gnu.org])
AC_CONFIG_SRCDIR(src/ls.c)
AC_CONFIG_SRCDIR([src/ls.c])
AC_CONFIG_AUX_DIR(build-aux)
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_HEADERS([lib/config.h:lib/config.hin])
AB_INIT()
AM_INIT_AUTOMAKE([1.10.1 dist-lzma])
AM_INIT_AUTOMAKE([1.10a dist-xz])
AC_PROG_CC_STDC
AM_PROG_CC_C_O
@@ -45,20 +44,82 @@ gl_EARLY
gl_INIT
coreutils_MACROS
AC_ARG_ENABLE([gcc-warnings],
[AS_HELP_STRING([--enable-gcc-warnings],
[turn on lots of GCC warnings (for developers)])],
[case $enableval in
yes|no) ;;
*) AC_MSG_ERROR([bad value $enableval for gcc-warnings option]) ;;
esac
gl_gcc_warnings=$enableval],
[gl_gcc_warnings=no]
)
if test "$gl_gcc_warnings" = yes; then
gl_WARN_ADD([-Werror], [WERROR_CFLAGS])
AC_SUBST([WERROR_CFLAGS])
# 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
optional_bin_progs=
AC_CHECK_FUNCS(uname,
AC_CHECK_FUNCS([uname],
gl_ADD_PROG([optional_bin_progs], [uname]))
AC_CHECK_FUNCS(chroot,
AC_CHECK_FUNCS([chroot],
gl_ADD_PROG([optional_bin_progs], [chroot]))
AC_CHECK_FUNCS(gethostid,
AC_CHECK_FUNCS([gethostid],
gl_ADD_PROG([optional_bin_progs], [hostid]))
gl_WINSIZE_IN_PTEM
AC_MSG_CHECKING(whether localtime caches TZ)
AC_CACHE_VAL(utils_cv_localtime_cache,
AC_MSG_CHECKING([whether localtime caches TZ])
AC_CACHE_VAL([utils_cv_localtime_cache],
[if test x$ac_cv_func_tzset = xyes; then
AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <time.h>
#if STDC_HEADERS
@@ -99,22 +160,22 @@ else
# since we can't invalidate the cache if we don't have tzset.
utils_cv_localtime_cache=no
fi])dnl
AC_MSG_RESULT($utils_cv_localtime_cache)
AC_MSG_RESULT([$utils_cv_localtime_cache])
if test $utils_cv_localtime_cache = yes; then
AC_DEFINE(LOCALTIME_CACHE, 1, [FIXME])
AC_DEFINE([LOCALTIME_CACHE], [1], [FIXME])
fi
# SCO-ODT-3.0 is reported to need -los to link programs using initgroups
AC_CHECK_FUNCS(initgroups)
AC_CHECK_FUNCS([initgroups])
if test $ac_cv_func_initgroups = no; then
AC_CHECK_LIB(os, initgroups)
AC_CHECK_LIB([os], [initgroups])
fi
AC_CHECK_FUNCS(syslog)
AC_CHECK_FUNCS([syslog])
if test $ac_cv_func_syslog = no; then
# syslog is not in the default libraries. See if it's in some other.
for lib in bsd socket inet; do
AC_CHECK_LIB($lib, syslog, [AC_DEFINE(HAVE_SYSLOG, 1, [FIXME])
AC_CHECK_LIB([$lib], [syslog], [AC_DEFINE([HAVE_SYSLOG], [1], [FIXME])
LIBS="$LIBS -l$lib"; break])
done
fi
@@ -148,29 +209,29 @@ AC_DEFUN([coreutils_DUMMY_1],
])
coreutils_DUMMY_1
AC_MSG_CHECKING(ut_host in struct utmp)
AC_CACHE_VAL(su_cv_func_ut_host_in_utmp,
AC_MSG_CHECKING([ut_host in struct utmp])
AC_CACHE_VAL([su_cv_func_ut_host_in_utmp],
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
#include <utmp.h>]], [[struct utmp ut; return !sizeof ut.ut_host;]])],
[su_cv_func_ut_host_in_utmp=yes],
[su_cv_func_ut_host_in_utmp=no])])
AC_MSG_RESULT($su_cv_func_ut_host_in_utmp)
AC_MSG_RESULT([$su_cv_func_ut_host_in_utmp])
if test $su_cv_func_ut_host_in_utmp = yes; then
have_ut_host=1
AC_DEFINE(HAVE_UT_HOST, 1, [FIXME])
AC_DEFINE([HAVE_UT_HOST], [1], [FIXME])
fi
if test -z "$have_ut_host"; then
AC_MSG_CHECKING(ut_host in struct utmpx)
AC_CACHE_VAL(su_cv_func_ut_host_in_utmpx,
AC_MSG_CHECKING([ut_host in struct utmpx])
AC_CACHE_VAL([su_cv_func_ut_host_in_utmpx],
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
#include <utmpx.h>]], [[struct utmpx ut; return !sizeof ut.ut_host;]])],
[su_cv_func_ut_host_in_utmpx=yes],
[su_cv_func_ut_host_in_utmpx=no])])
AC_MSG_RESULT($su_cv_func_ut_host_in_utmpx)
AC_MSG_RESULT([$su_cv_func_ut_host_in_utmpx])
if test $su_cv_func_ut_host_in_utmpx = yes; then
AC_DEFINE(HAVE_UTMPX_H, 1, [FIXME])
AC_DEFINE(HAVE_UT_HOST, 1, [FIXME])
AC_DEFINE([HAVE_UTMPX_H], [1], [FIXME])
AC_DEFINE([HAVE_UT_HOST], [1], [FIXME])
fi
fi
@@ -182,24 +243,24 @@ gl_HEADER_TIOCGWINSZ_NEEDS_SYS_IOCTL
if test $ac_cv_sys_posix_termios = yes; then
gl_ADD_PROG([optional_bin_progs], [stty])
AC_MSG_CHECKING(whether termios.h needs _XOPEN_SOURCE)
AC_CACHE_VAL(su_cv_sys_termios_needs_xopen_source,
[AC_EGREP_CPP(yes, [#include <termios.h>
AC_MSG_CHECKING([whether termios.h needs _XOPEN_SOURCE])
AC_CACHE_VAL([su_cv_sys_termios_needs_xopen_source],
[AC_EGREP_CPP([yes], [#include <termios.h>
#ifdef IUCLC
yes
#endif], su_cv_sys_termios_needs_xopen_source=no,
AC_EGREP_CPP(yes, [#define _XOPEN_SOURCE
AC_EGREP_CPP([yes], [#define _XOPEN_SOURCE
#include <termios.h>
#ifdef IUCLC
yes
#endif], su_cv_sys_termios_needs_xopen_source=yes,
su_cv_sys_termios_needs_xopen_source=no))])
AC_MSG_RESULT($su_cv_sys_termios_needs_xopen_source)
AC_MSG_RESULT([$su_cv_sys_termios_needs_xopen_source])
test $su_cv_sys_termios_needs_xopen_source = yes &&
AC_DEFINE(TERMIOS_NEEDS_XOPEN_SOURCE, 1, [FIXME])
AC_DEFINE([TERMIOS_NEEDS_XOPEN_SOURCE], [1], [FIXME])
AC_MSG_CHECKING(c_line in struct termios)
AC_CACHE_VAL(su_cv_sys_c_line_in_termios,
AC_MSG_CHECKING([c_line in struct termios])
AC_CACHE_VAL([su_cv_sys_c_line_in_termios],
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[#if TERMIOS_NEEDS_XOPEN_SOURCE
#define _XOPEN_SOURCE
#endif
@@ -207,9 +268,9 @@ yes
#include <termios.h>]], [[struct termios t; return !sizeof t.c_line;]])],
[su_cv_sys_c_line_in_termios=yes],
[su_cv_sys_c_line_in_termios=no])])
AC_MSG_RESULT($su_cv_sys_c_line_in_termios)
AC_MSG_RESULT([$su_cv_sys_c_line_in_termios])
test $su_cv_sys_c_line_in_termios = yes \
&& AC_DEFINE(HAVE_C_LINE, 1, [FIXME])
&& AC_DEFINE([HAVE_C_LINE], [1], [FIXME])
fi
# FIXME: note that this macro appears above, too.
@@ -220,8 +281,8 @@ gl_HEADER_TIOCGWINSZ_IN_TERMIOS_H
if test $gl_cv_sys_tiocgwinsz_needs_termios_h = no && \
test $gl_cv_sys_tiocgwinsz_needs_sys_ioctl_h = no; then
AC_MSG_CHECKING(TIOCGWINSZ in sys/pty.h)
AC_CACHE_VAL(su_cv_sys_tiocgwinsz_in_sys_pty_h,
AC_MSG_CHECKING([TIOCGWINSZ in sys/pty.h])
AC_CACHE_VAL([su_cv_sys_tiocgwinsz_in_sys_pty_h],
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
#ifdef WINSIZE_IN_PTEM
# include <sys/stream.h>
@@ -232,10 +293,10 @@ if test $gl_cv_sys_tiocgwinsz_needs_termios_h = no && \
#include <sys/pty.h>]], [[int x = TIOCGWINSZ;]])],
[su_cv_sys_tiocgwinsz_in_sys_pty_h=yes],
[su_cv_sys_tiocgwinsz_in_sys_pty_h=no])])
AC_MSG_RESULT($su_cv_sys_tiocgwinsz_in_sys_pty_h)
AC_MSG_RESULT([$su_cv_sys_tiocgwinsz_in_sys_pty_h])
test $su_cv_sys_tiocgwinsz_in_sys_pty_h = yes \
&& AC_DEFINE(GWINSZ_IN_SYS_PTY, 1,
&& AC_DEFINE([GWINSZ_IN_SYS_PTY], [1],
[Define if your system defines TIOCGWINSZ in sys/pty.h.])
fi
@@ -245,6 +306,7 @@ AC_CHECK_DECLS([strsignal, sys_siglist, _sys_siglist, __sys_siglist], , ,
#include <signal.h>])
cu_LIB_CHECK
cu_GMP
# Build df only if there's a point to it.
if test $gl_cv_list_mounted_fs = yes && test $gl_cv_fs_space = yes; then
@@ -259,7 +321,7 @@ mk="$srcdir/src/Makefile.am"
v=EXTRA_PROGRAMS
for gl_i in `sed -n '/^'$v' =/,/[[^\]]$/p' $mk \
| sed 's/^ *//;/^\$.*/d;/^'$v' =/d' \
| tr -s '\\012\\\\' ' '`; do
| tr -s '\\015\\012\\\\' ' '`; do
gl_ADD_PROG([optional_bin_progs], $gl_i)
done
@@ -310,10 +372,11 @@ case " $optional_bin_progs " in
*) INSTALL_SU=no ;;
esac
MAN=`echo "$optional_bin_progs "|sed 's/ /.1 /g;s/ $//'`
MAN=`echo "$optional_bin_progs "|sed 's/ /.1 /g;s/ $//'|tr -d '\\015\\012'`
# Change ginstall.1 to "install.h" in $MAN.
MAN=`for m in $MAN; do test $m = ginstall.1 && m=install.1; echo $m; done | tr '\012' ' '; echo`
MAN=`for m in $MAN; do test $m = ginstall.1 && m=install.1; echo $m; done \
| tr '\015\012' ' '; echo`
# Remove [.1, since writing a portable rule for it in man/Makefile.am
# is not practical. The sed LHS below uses the autoconf quadrigraph
@@ -325,6 +388,8 @@ AC_SUBST([OPTIONAL_BIN_PROGS])
NO_INSTALL_PROGS_DEFAULT=$no_install_progs_default
AC_SUBST([NO_INSTALL_PROGS_DEFAULT])
AM_CONDITIONAL([CROSS_COMPILING], [test "$cross_compiling" = yes])
# Arrange to rerun configure whenever the file, src/Makefile.am,
# containing the list of program names changes.
CONFIG_STATUS_DEPENDENCIES='$(top_srcdir)/src/Makefile.am'
@@ -334,6 +399,9 @@ AC_SUBST([CONFIG_STATUS_DEPENDENCIES])
AM_GNU_GETTEXT([external], [need-formatstring-macros])
AM_GNU_GETTEXT_VERSION([0.15])
# For a test of uniq: it uses the $LOCALE_FR envvar.
gt_LOCALE_FR
AC_CONFIG_FILES(
Makefile
doc/Makefile
@@ -343,33 +411,5 @@ AC_CONFIG_FILES(
src/Makefile
tests/Makefile
gnulib-tests/Makefile
tests/chgrp/Makefile
tests/chmod/Makefile
tests/chown/Makefile
tests/cp/Makefile
tests/cut/Makefile
tests/dd/Makefile
tests/du/Makefile
tests/head/Makefile
tests/install/Makefile
tests/join/Makefile
tests/ln/Makefile
tests/ls/Makefile
tests/misc/Makefile
tests/mkdir/Makefile
tests/mv/Makefile
tests/pr/Makefile
tests/readlink/Makefile
tests/rm/Makefile
tests/rmdir/Makefile
tests/sort/Makefile
tests/tac/Makefile
tests/tail-2/Makefile
tests/tail/Makefile
tests/test/Makefile
tests/touch/Makefile
tests/tr/Makefile
tests/uniq/Makefile
tests/wc/Makefile
)
AC_OUTPUT

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

@@ -1,6 +1,6 @@
# Make coreutils documentation. -*-Makefile-*-
# Copyright (C) 1995-1998, 2001-2007 Free Software Foundation, Inc.
# Copyright (C) 1995-1998, 2001-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,10 +29,13 @@ EXTRA_DIST = perm.texi getdate.texi constants.texi fdl.texi
# old systems.
AM_MAKEINFOFLAGS = --no-split
constants.texi: $(top_srcdir)/src/tail.c
constants.texi: $(top_srcdir)/src/tail.c $(top_srcdir)/src/shred.c
LC_ALL=C \
sed -n -e 's/^#define \(DEFAULT_MAX[_A-Z]*\) \(.*\)/@set \1 \2/p' \
$(top_srcdir)/src/tail.c > t-$@
LC_ALL=C \
sed -n -e 's/.*\(DEFAULT_PASSES\)[ =]* \([0-9]*\).*/@set SHRED_\1 \2/p'\
$(top_srcdir)/src/shred.c >> t-$@
mv t-$@ $@
MAINTAINERCLEANFILES = constants.texi
@@ -50,13 +53,14 @@ syntax_checks = \
sc-avoid-timezone \
sc-avoid-zeroes \
sc-exponent-grouping \
sc-lower-case-var \
sc-use-small-caps-NUL
.PHONY: $(syntax_checks) check-texinfo
# List words/regexps here that should not appear in the texinfo documentation.
check-texinfo: $(syntax_checks)
fail=0; \
@fail=0; \
grep '@url{' $(srcdir)/*.texi && fail=1; \
grep '\$$@"' $(srcdir)/*.texi && fail=1; \
grep -n '[^[:punct:]]@footnote' $(srcdir)/*.texi && fail=1; \
@@ -68,32 +72,50 @@ check-texinfo: $(syntax_checks)
$(srcdir)/*.texi 2> /dev/null || fail=1; }; \
$(EGREP) -i '$(_W)builtins?$(W_)' $(srcdir)/*.texi && fail=1; \
$(EGREP) -i '$(_W)path(name)?s?$(W_)' $(srcdir)/*.texi \
| $(EGREP) -v '@vindex PATH$$|@env[{]PATH[}]' && fail=1; \
| $(EGREP) -v 'search path|@vindex PATH$$|@env[{]PATH[}]' && fail=1; \
exit $$fail
# Use `time zone', not `timezone'.
sc-avoid-timezone:
$(EGREP) timezone $(srcdir)/*.texi && exit 1 || :
@$(EGREP) timezone $(srcdir)/*.texi && exit 1 || :
# Check for insufficient exponent grouping, e.g.,
# @math{2^64} should be @math{2^{64}}.
sc-exponent-grouping:
$(EGREP) '\{.*\^[0-9][0-9]' $(srcdir)/*.texi && exit 1 || :
@$(EGREP) '\{.*\^[0-9][0-9]' $(srcdir)/*.texi && exit 1 || :
# E.g., use @sc{nul}, not NUL.
sc-use-small-caps-NUL:
$(EGREP) '$(_W)NUL$(W_)' $(srcdir)/*.texi && exit 1 || :
@$(EGREP) '$(_W)NUL$(W_)' $(srcdir)/*.texi && exit 1 || :
# Say I/O, not IO.
sc-avoid-io:
$(EGREP) '$(_W)IO$(W_)' $(srcdir)/*.texi && exit 1 || :
@$(EGREP) '$(_W)IO$(W_)' $(srcdir)/*.texi && exit 1 || :
# I prefer nonzero over non-zero.
sc-avoid-non-zero:
$(EGREP) non-zero $(srcdir)/*.texi && exit 1 || :
@$(EGREP) non-zero $(srcdir)/*.texi && exit 1 || :
# Use `zeros', not `zeroes' (nothing wrong with `zeroes'. just be consistent).
sc-avoid-zeroes:
$(EGREP) -i '$(_W)zeroes$(W_)' $(srcdir)/*.texi && exit 1 || :
@$(EGREP) -i '$(_W)zeroes$(W_)' $(srcdir)/*.texi && exit 1 || :
# ME = $(subdir)/$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
ME = doc/Makefile
# The quantity inside @var{...} should not contain upper case letters.
# The leading backslash exemption is to permit in-macro uses like
# @var{\varName\} where the upper case letter is part of a parameter name.
find_upper_case_var = \
'/\@var{/ or next; \
while (/\@var{(.+?)}/g) \
{ \
$$v = $$1; \
$$v =~ /[A-Z]/ && $$v !~ /^\\/ and (print "$$ARGV:$$.:$$_"), $$m = 1 \
} \
END {$$m and (warn "$(ME): do not use upper case in \@var{...}\n"), exit 1}'
sc-lower-case-var:
@$(PERL) -e 1 2> /dev/null && \
$(PERL) -lne $(find_upper_case_var) $(srcdir)/*.texi
check: check-texinfo

File diff suppressed because it is too large Load Diff

View File

@@ -1,10 +1,10 @@
@c File mode bits
@c Copyright (C) 1994, 1996, 1999, 2000, 2001, 2003, 2004, 2005, 2006
@c Copyright (C) 1994, 1996, 1999-2001, 2003-2006, 2008
@c Free Software Foundation, Inc.
@c Permission is granted to copy, distribute and/or modify this document
@c under the terms of the GNU Free Documentation License, Version 1.2 or
@c under the terms of the GNU Free Documentation License, Version 1.3 or
@c any later version published by the Free Software Foundation; with no
@c Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
@c Texts. A copy of the license is included in the ``GNU Free

117
gl/lib/argv-iter.c Normal file
View File

@@ -0,0 +1,117 @@
/* Iterate over arguments from argv or --files0-from=FILE
Copyright (C) 2008 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/>. */
/* Written by Jim Meyering. */
#include <config.h>
#include "argv-iter.h"
#include <stdlib.h>
#include <string.h>
struct argv_iterator
{
/* Test FP to determine whether in read-mode or argv-mode. */
/* file-mode: fp records position */
FILE *fp;
size_t item_idx;
char *tok;
size_t buf_len;
/* argv-mode: record just argv and current pointer */
char **arg_list;
char **p;
};
struct argv_iterator *
argv_iter_init_argv (char **argv)
{
struct argv_iterator *ai = malloc (sizeof *ai);
if (!ai)
return NULL;
ai->fp = NULL;
ai->arg_list = argv;
ai->p = argv;
return ai;
}
/* Initialize to read from the stream, FP.
The input is expected to contain a list of NUL-delimited tokens. */
struct argv_iterator *
argv_iter_init_stream (FILE *fp)
{
struct argv_iterator *ai = malloc (sizeof *ai);
if (!ai)
return NULL;
ai->fp = fp;
ai->tok = NULL;
ai->buf_len = 0;
ai->item_idx = 0;
ai->arg_list = NULL;
return ai;
}
char *
argv_iter (struct argv_iterator *ai, enum argv_iter_err *err)
{
if (ai->fp)
{
ssize_t len = getdelim (&ai->tok, &ai->buf_len, '\0', ai->fp);
if (len < 0)
{
*err = feof (ai->fp) ? AI_ERR_EOF : AI_ERR_READ;
return NULL;
}
*err = AI_ERR_OK;
ai->item_idx++;
return ai->tok;
}
else
{
if (*(ai->p) == NULL)
{
*err = AI_ERR_EOF;
return NULL;
}
else
{
*err = AI_ERR_OK;
return *(ai->p++);
}
}
}
size_t
argv_iter_n_args (struct argv_iterator const *ai)
{
return ai->fp ? ai->item_idx : ai->p - ai->arg_list;
}
void
argv_iter_free (struct argv_iterator *ai)
{
if (ai->fp)
free (ai->tok);
free (ai);
}
/*
* Local variables:
* indent-tabs-mode: nil
* End:
*/

47
gl/lib/argv-iter.h Normal file
View File

@@ -0,0 +1,47 @@
/* Iterate over arguments from argv or --files0-from=FILE
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
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/>. */
#include <stdio.h>
#include <stdbool.h>
struct argv_iterator;
enum argv_iter_err;
#undef _ATTRIBUTE_NONNULL_
#if __GNUC__ == 3 && __GNUC_MINOR__ >= 3 || 3 < __GNUC__
# define _ATTRIBUTE_NONNULL_(m) __attribute__ ((__nonnull__ (m)))
#else
# define _ATTRIBUTE_NONNULL_(m)
#endif
enum argv_iter_err
{
AI_ERR_OK = 1,
AI_ERR_EOF,
AI_ERR_MEM,
AI_ERR_READ
};
struct argv_iterator *argv_iter_init_argv (char **argv)
_ATTRIBUTE_NONNULL_ (1);
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) _ATTRIBUTE_NONNULL_ (2);
size_t argv_iter_n_args (struct argv_iterator const *)
_ATTRIBUTE_NONNULL_ (1);
void argv_iter_free (struct argv_iterator *)
_ATTRIBUTE_NONNULL_ (1);

View File

@@ -1,558 +0,0 @@
/* base64.c -- Encode binary data using printable characters.
Copyright (C) 1999, 2000, 2001, 2004, 2005, 2006, 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/>. */
/* Written by Simon Josefsson. Partially adapted from GNU MailUtils
* (mailbox/filter_trans.c, as of 2004-11-28). Improved by review
* from Paul Eggert, Bruno Haible, and Stepan Kasal.
*
* See also RFC 3548 <http://www.ietf.org/rfc/rfc3548.txt>.
*
* Be careful with error checking. Here is how you would typically
* use these functions:
*
* bool ok = base64_decode_alloc (in, inlen, &out, &outlen);
* if (!ok)
* FAIL: input was not valid base64
* if (out == NULL)
* FAIL: memory allocation error
* OK: data in OUT/OUTLEN
*
* size_t outlen = base64_encode_alloc (in, inlen, &out);
* if (out == NULL && outlen == 0 && inlen != 0)
* FAIL: input too long
* if (out == NULL)
* FAIL: memory allocation error
* OK: data in OUT/OUTLEN.
*
*/
#include <config.h>
/* Get prototype. */
#include "base64.h"
/* Get malloc. */
#include <stdlib.h>
/* Get UCHAR_MAX. */
#include <limits.h>
#include <string.h>
/* C89 compliant way to cast 'char' to 'unsigned char'. */
static inline unsigned char
to_uchar (char ch)
{
return ch;
}
/* Base64 encode IN array of size INLEN into OUT array of size OUTLEN.
If OUTLEN is less than BASE64_LENGTH(INLEN), write as many bytes as
possible. If OUTLEN is larger than BASE64_LENGTH(INLEN), also zero
terminate the output buffer. */
void
base64_encode (const char *restrict in, size_t inlen,
char *restrict out, size_t outlen)
{
static const char b64str[64] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
while (inlen && outlen)
{
*out++ = b64str[(to_uchar (in[0]) >> 2) & 0x3f];
if (!--outlen)
break;
*out++ = b64str[((to_uchar (in[0]) << 4)
+ (--inlen ? to_uchar (in[1]) >> 4 : 0))
& 0x3f];
if (!--outlen)
break;
*out++ =
(inlen
? b64str[((to_uchar (in[1]) << 2)
+ (--inlen ? to_uchar (in[2]) >> 6 : 0))
& 0x3f]
: '=');
if (!--outlen)
break;
*out++ = inlen ? b64str[to_uchar (in[2]) & 0x3f] : '=';
if (!--outlen)
break;
if (inlen)
inlen--;
if (inlen)
in += 3;
}
if (outlen)
*out = '\0';
}
/* Allocate a buffer and store zero terminated base64 encoded data
from array IN of size INLEN, returning BASE64_LENGTH(INLEN), i.e.,
the length of the encoded data, excluding the terminating zero. On
return, the OUT variable will hold a pointer to newly allocated
memory that must be deallocated by the caller. If output string
length would overflow, 0 is returned and OUT is set to NULL. If
memory allocation failed, OUT is set to NULL, and the return value
indicates length of the requested memory block, i.e.,
BASE64_LENGTH(inlen) + 1. */
size_t
base64_encode_alloc (const char *in, size_t inlen, char **out)
{
size_t outlen = 1 + BASE64_LENGTH (inlen);
/* Check for overflow in outlen computation.
*
* If there is no overflow, outlen >= inlen.
*
* If the operation (inlen + 2) overflows then it yields at most +1, so
* outlen is 0.
*
* If the multiplication overflows, we lose at least half of the
* correct value, so the result is < ((inlen + 2) / 3) * 2, which is
* less than (inlen + 2) * 0.66667, which is less than inlen as soon as
* (inlen > 4).
*/
if (inlen > outlen)
{
*out = NULL;
return 0;
}
*out = malloc (outlen);
if (!*out)
return outlen;
base64_encode (in, inlen, *out, outlen);
return outlen - 1;
}
/* With this approach this file works independent of the charset used
(think EBCDIC). However, it does assume that the characters in the
Base64 alphabet (A-Za-z0-9+/) are encoded in 0..255. POSIX
1003.1-2001 require that char and unsigned char are 8-bit
quantities, though, taking care of that problem. But this may be a
potential problem on non-POSIX C99 platforms.
IBM C V6 for AIX mishandles "#define B64(x) ...'x'...", so use "_"
as the formal parameter rather than "x". */
#define B64(_) \
((_) == 'A' ? 0 \
: (_) == 'B' ? 1 \
: (_) == 'C' ? 2 \
: (_) == 'D' ? 3 \
: (_) == 'E' ? 4 \
: (_) == 'F' ? 5 \
: (_) == 'G' ? 6 \
: (_) == 'H' ? 7 \
: (_) == 'I' ? 8 \
: (_) == 'J' ? 9 \
: (_) == 'K' ? 10 \
: (_) == 'L' ? 11 \
: (_) == 'M' ? 12 \
: (_) == 'N' ? 13 \
: (_) == 'O' ? 14 \
: (_) == 'P' ? 15 \
: (_) == 'Q' ? 16 \
: (_) == 'R' ? 17 \
: (_) == 'S' ? 18 \
: (_) == 'T' ? 19 \
: (_) == 'U' ? 20 \
: (_) == 'V' ? 21 \
: (_) == 'W' ? 22 \
: (_) == 'X' ? 23 \
: (_) == 'Y' ? 24 \
: (_) == 'Z' ? 25 \
: (_) == 'a' ? 26 \
: (_) == 'b' ? 27 \
: (_) == 'c' ? 28 \
: (_) == 'd' ? 29 \
: (_) == 'e' ? 30 \
: (_) == 'f' ? 31 \
: (_) == 'g' ? 32 \
: (_) == 'h' ? 33 \
: (_) == 'i' ? 34 \
: (_) == 'j' ? 35 \
: (_) == 'k' ? 36 \
: (_) == 'l' ? 37 \
: (_) == 'm' ? 38 \
: (_) == 'n' ? 39 \
: (_) == 'o' ? 40 \
: (_) == 'p' ? 41 \
: (_) == 'q' ? 42 \
: (_) == 'r' ? 43 \
: (_) == 's' ? 44 \
: (_) == 't' ? 45 \
: (_) == 'u' ? 46 \
: (_) == 'v' ? 47 \
: (_) == 'w' ? 48 \
: (_) == 'x' ? 49 \
: (_) == 'y' ? 50 \
: (_) == 'z' ? 51 \
: (_) == '0' ? 52 \
: (_) == '1' ? 53 \
: (_) == '2' ? 54 \
: (_) == '3' ? 55 \
: (_) == '4' ? 56 \
: (_) == '5' ? 57 \
: (_) == '6' ? 58 \
: (_) == '7' ? 59 \
: (_) == '8' ? 60 \
: (_) == '9' ? 61 \
: (_) == '+' ? 62 \
: (_) == '/' ? 63 \
: -1)
static const signed char b64[0x100] = {
B64 (0), B64 (1), B64 (2), B64 (3),
B64 (4), B64 (5), B64 (6), B64 (7),
B64 (8), B64 (9), B64 (10), B64 (11),
B64 (12), B64 (13), B64 (14), B64 (15),
B64 (16), B64 (17), B64 (18), B64 (19),
B64 (20), B64 (21), B64 (22), B64 (23),
B64 (24), B64 (25), B64 (26), B64 (27),
B64 (28), B64 (29), B64 (30), B64 (31),
B64 (32), B64 (33), B64 (34), B64 (35),
B64 (36), B64 (37), B64 (38), B64 (39),
B64 (40), B64 (41), B64 (42), B64 (43),
B64 (44), B64 (45), B64 (46), B64 (47),
B64 (48), B64 (49), B64 (50), B64 (51),
B64 (52), B64 (53), B64 (54), B64 (55),
B64 (56), B64 (57), B64 (58), B64 (59),
B64 (60), B64 (61), B64 (62), B64 (63),
B64 (64), B64 (65), B64 (66), B64 (67),
B64 (68), B64 (69), B64 (70), B64 (71),
B64 (72), B64 (73), B64 (74), B64 (75),
B64 (76), B64 (77), B64 (78), B64 (79),
B64 (80), B64 (81), B64 (82), B64 (83),
B64 (84), B64 (85), B64 (86), B64 (87),
B64 (88), B64 (89), B64 (90), B64 (91),
B64 (92), B64 (93), B64 (94), B64 (95),
B64 (96), B64 (97), B64 (98), B64 (99),
B64 (100), B64 (101), B64 (102), B64 (103),
B64 (104), B64 (105), B64 (106), B64 (107),
B64 (108), B64 (109), B64 (110), B64 (111),
B64 (112), B64 (113), B64 (114), B64 (115),
B64 (116), B64 (117), B64 (118), B64 (119),
B64 (120), B64 (121), B64 (122), B64 (123),
B64 (124), B64 (125), B64 (126), B64 (127),
B64 (128), B64 (129), B64 (130), B64 (131),
B64 (132), B64 (133), B64 (134), B64 (135),
B64 (136), B64 (137), B64 (138), B64 (139),
B64 (140), B64 (141), B64 (142), B64 (143),
B64 (144), B64 (145), B64 (146), B64 (147),
B64 (148), B64 (149), B64 (150), B64 (151),
B64 (152), B64 (153), B64 (154), B64 (155),
B64 (156), B64 (157), B64 (158), B64 (159),
B64 (160), B64 (161), B64 (162), B64 (163),
B64 (164), B64 (165), B64 (166), B64 (167),
B64 (168), B64 (169), B64 (170), B64 (171),
B64 (172), B64 (173), B64 (174), B64 (175),
B64 (176), B64 (177), B64 (178), B64 (179),
B64 (180), B64 (181), B64 (182), B64 (183),
B64 (184), B64 (185), B64 (186), B64 (187),
B64 (188), B64 (189), B64 (190), B64 (191),
B64 (192), B64 (193), B64 (194), B64 (195),
B64 (196), B64 (197), B64 (198), B64 (199),
B64 (200), B64 (201), B64 (202), B64 (203),
B64 (204), B64 (205), B64 (206), B64 (207),
B64 (208), B64 (209), B64 (210), B64 (211),
B64 (212), B64 (213), B64 (214), B64 (215),
B64 (216), B64 (217), B64 (218), B64 (219),
B64 (220), B64 (221), B64 (222), B64 (223),
B64 (224), B64 (225), B64 (226), B64 (227),
B64 (228), B64 (229), B64 (230), B64 (231),
B64 (232), B64 (233), B64 (234), B64 (235),
B64 (236), B64 (237), B64 (238), B64 (239),
B64 (240), B64 (241), B64 (242), B64 (243),
B64 (244), B64 (245), B64 (246), B64 (247),
B64 (248), B64 (249), B64 (250), B64 (251),
B64 (252), B64 (253), B64 (254), B64 (255)
};
#if UCHAR_MAX == 255
# define uchar_in_range(c) true
#else
# define uchar_in_range(c) ((c) <= 255)
#endif
/* Return true if CH is a character from the Base64 alphabet, and
false otherwise. Note that '=' is padding and not considered to be
part of the alphabet. */
bool
isbase64 (char ch)
{
return uchar_in_range (to_uchar (ch)) && 0 <= b64[to_uchar (ch)];
}
/* Initialize decode-context buffer, CTX. */
void
base64_decode_ctx_init (struct base64_decode_context *ctx)
{
ctx->i = 0;
}
/* If CTX->i is 0 or 4, there are four or more bytes in [*IN..IN_END), and
none of those four is a newline, then return *IN. Otherwise, copy up to
4 - CTX->i non-newline bytes from that range into CTX->buf, starting at
index CTX->i and setting CTX->i to reflect the number of bytes copied,
and return CTX->buf. In either case, advance *IN to point to the byte
after the last one processed, and set *N_NON_NEWLINE to the number of
verified non-newline bytes accessible through the returned pointer. */
static inline char *
get_4 (struct base64_decode_context *ctx,
char const *restrict *in, char const *restrict in_end,
size_t *n_non_newline)
{
if (ctx->i == 4)
ctx->i = 0;
if (ctx->i == 0)
{
char const *t = *in;
if (4 <= in_end - *in && memchr (t, '\n', 4) == NULL)
{
/* This is the common case: no newline. */
*in += 4;
*n_non_newline = 4;
return (char *) t;
}
}
{
/* Copy non-newline bytes into BUF. */
char const *p = *in;
while (p < in_end)
{
char c = *p++;
if (c != '\n')
{
ctx->buf[ctx->i++] = c;
if (ctx->i == 4)
break;
}
}
*in = p;
*n_non_newline = ctx->i;
return ctx->buf;
}
}
#define return_false \
do \
{ \
*outp = out; \
return false; \
} \
while (false)
/* Decode up to four bytes of base64-encoded data, IN, of length INLEN
into the output buffer, *OUT, of size *OUTLEN bytes. Return true if
decoding is successful, false otherwise. If *OUTLEN is too small,
as many bytes as possible are written to *OUT. On return, advance
*OUT to point to the byte after the last one written, and decrement
*OUTLEN to reflect the number of bytes remaining in *OUT. */
static inline bool
decode_4 (char const *restrict in, size_t inlen,
char *restrict *outp, size_t *outleft)
{
char *out = *outp;
if (inlen < 2)
return false;
if (!isbase64 (in[0]) || !isbase64 (in[1]))
return false;
if (*outleft)
{
*out++ = ((b64[to_uchar (in[0])] << 2)
| (b64[to_uchar (in[1])] >> 4));
--*outleft;
}
if (inlen == 2)
return_false;
if (in[2] == '=')
{
if (inlen != 4)
return_false;
if (in[3] != '=')
return_false;
}
else
{
if (!isbase64 (in[2]))
return_false;
if (*outleft)
{
*out++ = (((b64[to_uchar (in[1])] << 4) & 0xf0)
| (b64[to_uchar (in[2])] >> 2));
--*outleft;
}
if (inlen == 3)
return_false;
if (in[3] == '=')
{
if (inlen != 4)
return_false;
}
else
{
if (!isbase64 (in[3]))
return_false;
if (*outleft)
{
*out++ = (((b64[to_uchar (in[2])] << 6) & 0xc0)
| b64[to_uchar (in[3])]);
--*outleft;
}
}
}
*outp = out;
return true;
}
/* Decode base64-encoded input array IN of length INLEN to output array
OUT that can hold *OUTLEN bytes. The input data may be interspersed
with newlines. Return true if decoding was successful, i.e. if the
input was valid base64 data, false otherwise. If *OUTLEN is too
small, as many bytes as possible will be written to OUT. On return,
*OUTLEN holds the length of decoded bytes in OUT. Note that as soon
as any non-alphabet, non-newline character is encountered, decoding
is stopped and false is returned. If INLEN is zero, then process
only whatever data is stored in CTX.
Initially, CTX must have been initialized via base64_decode_ctx_init.
Subsequent calls to this function must reuse whatever state is recorded
in that buffer. It is necessary for when a quadruple of base64 input
bytes spans two input buffers. */
bool
base64_decode (struct base64_decode_context *ctx,
const char *restrict in, size_t inlen,
char *restrict out, size_t *outlen)
{
size_t outleft = *outlen;
bool flush_ctx = inlen == 0;
while (true)
{
size_t outleft_save = outleft;
if (ctx->i == 0 && !flush_ctx)
{
while (true)
{
/* Save a copy of outleft, in case we need to re-parse this
block of four bytes. */
outleft_save = outleft;
if (!decode_4 (in, inlen, &out, &outleft))
break;
in += 4;
inlen -= 4;
}
}
if (inlen == 0 && !flush_ctx)
break;
/* Handle the common case of 72-byte wrapped lines.
This also handles any other multiple-of-4-byte wrapping. */
if (inlen && *in == '\n')
{
++in;
--inlen;
continue;
}
/* Restore OUT and OUTLEFT. */
out -= outleft_save - outleft;
outleft = outleft_save;
{
char const *in_end = in + inlen;
char const *non_nl = get_4 (ctx, &in, in_end, &inlen);
/* If the input is empty or consists solely of newlines (0 non-newlines),
then we're done. Likewise if there are fewer than 4 bytes when not
flushing context. */
if (inlen == 0 || (inlen < 4 && !flush_ctx))
{
inlen = 0;
break;
}
if (!decode_4 (non_nl, inlen, &out, &outleft))
break;
inlen = in_end - in;
}
}
*outlen -= outleft;
return inlen == 0;
}
/* Allocate an output buffer in *OUT, and decode the base64 encoded
data stored in IN of size INLEN to the *OUT buffer. On return, the
size of the decoded data is stored in *OUTLEN. OUTLEN may be NULL,
if the caller is not interested in the decoded length. *OUT may be
NULL to indicate an out of memory error, in which case *OUTLEN
contains the size of the memory block needed. The function returns
true on successful decoding and memory allocation errors. (Use the
*OUT and *OUTLEN parameters to differentiate between successful
decoding and memory error.) The function returns false if the
input was invalid, in which case *OUT is NULL and *OUTLEN is
undefined. */
bool
base64_decode_alloc (struct base64_decode_context *ctx,
const char *in, size_t inlen, char **out,
size_t *outlen)
{
/* This may allocate a few bytes too many, depending on input,
but it's not worth the extra CPU time to compute the exact size.
The exact size is 3 * inlen / 4, minus 1 if the input ends
with "=" and minus another 1 if the input ends with "==".
Dividing before multiplying avoids the possibility of overflow. */
size_t needlen = 3 * (inlen / 4) + 2;
*out = malloc (needlen);
if (!*out)
return true;
if (!base64_decode (ctx, in, inlen, *out, &needlen))
{
free (*out);
*out = NULL;
return false;
}
if (outlen)
*outlen = needlen;
return true;
}

View File

@@ -1,53 +0,0 @@
/* base64.h -- Encode binary data using printable characters.
Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.
Written by Simon Josefsson.
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/>. */
#ifndef BASE64_H
# define BASE64_H
/* Get size_t. */
# include <stddef.h>
/* Get bool. */
# include <stdbool.h>
/* This uses that the expression (n+(k-1))/k means the smallest
integer >= n/k, i.e., the ceiling of n/k. */
# define BASE64_LENGTH(inlen) ((((inlen) + 2) / 3) * 4)
struct base64_decode_context
{
unsigned int i;
char buf[4];
};
extern bool isbase64 (char ch);
extern void base64_encode (const char *restrict in, size_t inlen,
char *restrict out, size_t outlen);
extern size_t base64_encode_alloc (const char *in, size_t inlen, char **out);
extern void base64_decode_ctx_init (struct base64_decode_context *ctx);
extern bool base64_decode (struct base64_decode_context *ctx,
const char *restrict in, size_t inlen,
char *restrict out, size_t *outlen);
extern bool base64_decode_alloc (struct base64_decode_context *ctx,
const char *in, size_t inlen,
char **out, size_t *outlen);
#endif /* BASE64_H */

View File

@@ -1,6 +1,6 @@
/* mgetgroups.c -- return a list of the groups a user is in
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
@@ -33,16 +33,16 @@
#include "xalloc.h"
static void *
allocate_groupbuf (int size)
static GETGROUPS_T *
realloc_groupbuf (GETGROUPS_T *g, size_t num)
{
if (xalloc_oversized (size, sizeof (GETGROUPS_T)))
if (xalloc_oversized (num, sizeof (*g)))
{
errno = ENOMEM;
return NULL;
}
return malloc (size * sizeof (GETGROUPS_T));
return realloc (g, num * sizeof (*g));
}
/* Like getugroups, but store the result in malloc'd storage.
@@ -65,45 +65,27 @@ mgetgroups (char const *username, gid_t gid, GETGROUPS_T **groups)
performance characteristics.
In glibc 2.3.2, getgrouplist is buggy. If you pass a zero as the
size of the output buffer, getgrouplist will still write to the
length of the output buffer, getgrouplist will still write to the
buffer. Contrary to what some versions of the getgrouplist
manpage say, this doesn't happen with nonzero buffer sizes.
Therefore our usage here just avoids a zero sized buffer. */
if (username)
{
enum { N_GROUPS_INIT = 10 };
GETGROUPS_T smallbuf[N_GROUPS_INIT];
max_n_groups = N_GROUPS_INIT;
ng = getgrouplist (username, gid, smallbuf, &max_n_groups);
g = allocate_groupbuf (max_n_groups);
g = realloc_groupbuf (NULL, max_n_groups);
if (g == NULL)
return -1;
if (max_n_groups <= N_GROUPS_INIT)
{
/* smallbuf was big enough, so we already have our data */
memcpy (g, smallbuf, max_n_groups * sizeof *g);
*groups = g;
return max_n_groups;
}
while (1)
{
GETGROUPS_T *h;
/* getgrouplist updates max_n_groups to num required. */
ng = getgrouplist (username, gid, g, &max_n_groups);
if (0 <= ng)
{
*groups = g;
return ng;
}
/* When getgrouplist fails, it guarantees that
max_n_groups reflects the new number of groups. */
if (xalloc_oversized (max_n_groups, sizeof *h)
|| (h = realloc (g, max_n_groups * sizeof *h)) == NULL)
if ((h = realloc_groupbuf (g, max_n_groups)) == NULL)
{
int saved_errno = errno;
free (g);
@@ -111,6 +93,12 @@ mgetgroups (char const *username, gid_t gid, GETGROUPS_T **groups)
return -1;
}
g = h;
if (0 <= ng)
{
*groups = g;
return ng;
}
}
}
/* else no username, so fall through and use getgroups. */
@@ -125,7 +113,7 @@ mgetgroups (char const *username, gid_t gid, GETGROUPS_T **groups)
if (max_n_groups < 0)
max_n_groups = 5;
g = allocate_groupbuf (max_n_groups);
g = realloc_groupbuf (NULL, max_n_groups);
if (g == NULL)
return -1;

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,31 +0,0 @@
#ifndef SELINUX_CONTEXT_H
# define SELINUX_CONTEXT_H
# include <errno.h>
/* Some systems don't have ENOTSUP. */
# ifndef ENOTSUP
# ifdef ENOSYS
# define ENOTSUP ENOSYS
# else
/* Some systems don't have ENOSYS either. */
# define ENOTSUP EINVAL
# endif
# endif
typedef int context_t;
static inline context_t context_new (char const *s)
{ errno = ENOTSUP; return 0; }
static inline char *context_str (context_t con)
{ errno = ENOTSUP; return (void *) 0; }
static inline void context_free (context_t c) {}
static inline int context_user_set (context_t sc, char const *s)
{ errno = ENOTSUP; return -1; }
static inline int context_role_set (context_t sc, char const *s)
{ errno = ENOTSUP; return -1; }
static inline int context_range_set (context_t sc, char const *s)
{ errno = ENOTSUP; return -1; }
static inline int context_type_set (context_t sc, char const *s)
{ errno = ENOTSUP; return -1; }
#endif

View File

@@ -1,57 +0,0 @@
#ifndef SELINUX_SELINUX_H
# define SELINUX_SELINUX_H
# include <sys/types.h>
# include <errno.h>
/* Some systems don't have ENOTSUP. */
# ifndef ENOTSUP
# ifdef ENOSYS
# define ENOTSUP ENOSYS
# else
/* Some systems don't have ENOSYS either. */
# define ENOTSUP EINVAL
# endif
# endif
typedef unsigned short security_class_t;
# define security_context_t char*
# define is_selinux_enabled() 0
static inline int getcon (security_context_t *con) { errno = ENOTSUP; return -1; }
static inline void freecon (security_context_t con) {}
static inline int getfscreatecon (security_context_t *con)
{ errno = ENOTSUP; return -1; }
static inline int setfscreatecon (security_context_t con)
{ errno = ENOTSUP; return -1; }
static inline int matchpathcon (char const *s, mode_t m,
security_context_t *con)
{ errno = ENOTSUP; return -1; }
static inline int getfilecon (char const *s, security_context_t *con)
{ errno = ENOTSUP; return -1; }
static inline int lgetfilecon (char const *s, security_context_t *con)
{ errno = ENOTSUP; return -1; }
static inline int setfilecon (char const *s, security_context_t con)
{ errno = ENOTSUP; return -1; }
static inline int lsetfilecon (char const *s, security_context_t con)
{ errno = ENOTSUP; return -1; }
static inline int fsetfilecon (int fd, security_context_t con)
{ errno = ENOTSUP; return -1; }
static inline int security_check_context (security_context_t con)
{ errno = ENOTSUP; return -1; }
static inline int security_check_context_raw (security_context_t con)
{ errno = ENOTSUP; return -1; }
static inline int setexeccon (security_context_t con)
{ errno = ENOTSUP; return -1; }
static inline int security_compute_create (security_context_t scon,
security_context_t tcon,
security_class_t tclass,
security_context_t *newcon)
{ errno = ENOTSUP; return -1; }
static inline int matchpathcon_init_prefix (char const *path,
char const *prefix)
{ errno = ENOTSUP; return -1; }
#endif

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

@@ -1,550 +0,0 @@
/* sha256.c - Functions to compute SHA256 and SHA224 message digest of files or
memory blocks according to the NIST specification FIPS-180-2.
Copyright (C) 2005, 2006, 2008 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/>. */
/* Written by David Madore, considerably copypasting from
Scott G. Miller's sha1.c
*/
#include <config.h>
#include "sha256.h"
#include <stddef.h>
#include <string.h>
#if USE_UNLOCKED_IO
# include "unlocked-io.h"
#endif
#ifdef WORDS_BIGENDIAN
# define SWAP(n) (n)
#else
# define SWAP(n) \
(((n) << 24) | (((n) & 0xff00) << 8) | (((n) >> 8) & 0xff00) | ((n) >> 24))
#endif
#define BLOCKSIZE 4096
#if BLOCKSIZE % 64 != 0
# error "invalid BLOCKSIZE"
#endif
/* This array contains the bytes used to pad the buffer to the next
64-byte boundary. */
static const unsigned char fillbuf[64] = { 0x80, 0 /* , 0, 0, ... */ };
/*
Takes a pointer to a 256 bit block of data (eight 32 bit ints) and
intializes it to the start constants of the SHA256 algorithm. This
must be called before using hash in the call to sha256_hash
*/
void
sha256_init_ctx (struct sha256_ctx *ctx)
{
ctx->state[0] = 0x6a09e667UL;
ctx->state[1] = 0xbb67ae85UL;
ctx->state[2] = 0x3c6ef372UL;
ctx->state[3] = 0xa54ff53aUL;
ctx->state[4] = 0x510e527fUL;
ctx->state[5] = 0x9b05688cUL;
ctx->state[6] = 0x1f83d9abUL;
ctx->state[7] = 0x5be0cd19UL;
ctx->total[0] = ctx->total[1] = 0;
ctx->buflen = 0;
}
void
sha224_init_ctx (struct sha256_ctx *ctx)
{
ctx->state[0] = 0xc1059ed8UL;
ctx->state[1] = 0x367cd507UL;
ctx->state[2] = 0x3070dd17UL;
ctx->state[3] = 0xf70e5939UL;
ctx->state[4] = 0xffc00b31UL;
ctx->state[5] = 0x68581511UL;
ctx->state[6] = 0x64f98fa7UL;
ctx->state[7] = 0xbefa4fa4UL;
ctx->total[0] = ctx->total[1] = 0;
ctx->buflen = 0;
}
/* Copy the value from v into the memory location pointed to by *cp,
If your architecture allows unaligned access this is equivalent to
* (uint32_t *) cp = v */
static inline void
set_uint32 (char *cp, uint32_t v)
{
memcpy (cp, &v, sizeof v);
}
/* Put result from CTX in first 32 bytes following RESBUF. The result
must be in little endian byte order. */
void *
sha256_read_ctx (const struct sha256_ctx *ctx, void *resbuf)
{
int i;
char *r = resbuf;
for (i = 0; i < 8; i++)
set_uint32 (r + i * sizeof ctx->state[0], SWAP (ctx->state[i]));
return resbuf;
}
void *
sha224_read_ctx (const struct sha256_ctx *ctx, void *resbuf)
{
int i;
char *r = resbuf;
for (i = 0; i < 7; i++)
set_uint32 (r + i * sizeof ctx->state[0], SWAP (ctx->state[i]));
return resbuf;
}
/* Process the remaining bytes in the internal buffer and the usual
prolog according to the standard and write the result to RESBUF. */
static void
sha256_conclude_ctx (struct sha256_ctx *ctx)
{
/* Take yet unprocessed bytes into account. */
uint32_t bytes = ctx->buflen;
size_t size = (bytes < 56) ? 64 / 4 : 64 * 2 / 4;
/* Now count remaining bytes. */
ctx->total[0] += bytes;
if (ctx->total[0] < bytes)
++ctx->total[1];
/* Put the 64-bit file length in *bits* at the end of the buffer. */
ctx->buffer[size - 2] = SWAP ((ctx->total[1] << 3) | (ctx->total[0] >> 29));
ctx->buffer[size - 1] = SWAP (ctx->total[0] << 3);
memcpy (&((char *) ctx->buffer)[bytes], fillbuf, (size - 2) * 4 - bytes);
/* Process last bytes. */
sha256_process_block (ctx->buffer, size * 4, ctx);
}
void *
sha256_finish_ctx (struct sha256_ctx *ctx, void *resbuf)
{
sha256_conclude_ctx (ctx);
return sha256_read_ctx (ctx, resbuf);
}
void *
sha224_finish_ctx (struct sha256_ctx *ctx, void *resbuf)
{
sha256_conclude_ctx (ctx);
return sha224_read_ctx (ctx, resbuf);
}
/* Compute SHA256 message digest for bytes read from STREAM. The
resulting message digest number will be written into the 32 bytes
beginning at RESBLOCK. */
int
sha256_stream (FILE *stream, void *resblock)
{
struct sha256_ctx ctx;
char buffer[BLOCKSIZE + 72];
size_t sum;
/* Initialize the computation context. */
sha256_init_ctx (&ctx);
/* Iterate over full file contents. */
while (1)
{
/* We read the file in blocks of BLOCKSIZE bytes. One call of the
computation function processes the whole buffer so that with the
next round of the loop another block can be read. */
size_t n;
sum = 0;
/* Read block. Take care for partial reads. */
while (1)
{
n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream);
sum += n;
if (sum == BLOCKSIZE)
break;
if (n == 0)
{
/* Check for the error flag IFF N == 0, so that we don't
exit the loop after a partial read due to e.g., EAGAIN
or EWOULDBLOCK. */
if (ferror (stream))
return 1;
goto process_partial_block;
}
/* We've read at least one byte, so ignore errors. But always
check for EOF, since feof may be true even though N > 0.
Otherwise, we could end up calling fread after EOF. */
if (feof (stream))
goto process_partial_block;
}
/* Process buffer with BLOCKSIZE bytes. Note that
BLOCKSIZE % 64 == 0
*/
sha256_process_block (buffer, BLOCKSIZE, &ctx);
}
process_partial_block:;
/* Process any remaining bytes. */
if (sum > 0)
sha256_process_bytes (buffer, sum, &ctx);
/* Construct result in desired memory. */
sha256_finish_ctx (&ctx, resblock);
return 0;
}
/* FIXME: Avoid code duplication */
int
sha224_stream (FILE *stream, void *resblock)
{
struct sha256_ctx ctx;
char buffer[BLOCKSIZE + 72];
size_t sum;
/* Initialize the computation context. */
sha224_init_ctx (&ctx);
/* Iterate over full file contents. */
while (1)
{
/* We read the file in blocks of BLOCKSIZE bytes. One call of the
computation function processes the whole buffer so that with the
next round of the loop another block can be read. */
size_t n;
sum = 0;
/* Read block. Take care for partial reads. */
while (1)
{
n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream);
sum += n;
if (sum == BLOCKSIZE)
break;
if (n == 0)
{
/* Check for the error flag IFF N == 0, so that we don't
exit the loop after a partial read due to e.g., EAGAIN
or EWOULDBLOCK. */
if (ferror (stream))
return 1;
goto process_partial_block;
}
/* We've read at least one byte, so ignore errors. But always
check for EOF, since feof may be true even though N > 0.
Otherwise, we could end up calling fread after EOF. */
if (feof (stream))
goto process_partial_block;
}
/* Process buffer with BLOCKSIZE bytes. Note that
BLOCKSIZE % 64 == 0
*/
sha256_process_block (buffer, BLOCKSIZE, &ctx);
}
process_partial_block:;
/* Process any remaining bytes. */
if (sum > 0)
sha256_process_bytes (buffer, sum, &ctx);
/* Construct result in desired memory. */
sha224_finish_ctx (&ctx, resblock);
return 0;
}
/* Compute SHA512 message digest for LEN bytes beginning at BUFFER. The
result is always in little endian byte order, so that a byte-wise
output yields to the wanted ASCII representation of the message
digest. */
void *
sha256_buffer (const char *buffer, size_t len, void *resblock)
{
struct sha256_ctx ctx;
/* Initialize the computation context. */
sha256_init_ctx (&ctx);
/* Process whole buffer but last len % 64 bytes. */
sha256_process_bytes (buffer, len, &ctx);
/* Put result in desired memory area. */
return sha256_finish_ctx (&ctx, resblock);
}
void *
sha224_buffer (const char *buffer, size_t len, void *resblock)
{
struct sha256_ctx ctx;
/* Initialize the computation context. */
sha224_init_ctx (&ctx);
/* Process whole buffer but last len % 64 bytes. */
sha256_process_bytes (buffer, len, &ctx);
/* Put result in desired memory area. */
return sha224_finish_ctx (&ctx, resblock);
}
void
sha256_process_bytes (const void *buffer, size_t len, struct sha256_ctx *ctx)
{
/* When we already have some bits in our internal buffer concatenate
both inputs first. */
if (ctx->buflen != 0)
{
size_t left_over = ctx->buflen;
size_t add = 128 - left_over > len ? len : 128 - left_over;
memcpy (&((char *) ctx->buffer)[left_over], buffer, add);
ctx->buflen += add;
if (ctx->buflen > 64)
{
sha256_process_block (ctx->buffer, ctx->buflen & ~63, ctx);
ctx->buflen &= 63;
/* The regions in the following copy operation cannot overlap. */
memcpy (ctx->buffer,
&((char *) ctx->buffer)[(left_over + add) & ~63],
ctx->buflen);
}
buffer = (const char *) buffer + add;
len -= add;
}
/* Process available complete blocks. */
if (len >= 64)
{
#if !_STRING_ARCH_unaligned
# define alignof(type) offsetof (struct { char c; type x; }, x)
# define UNALIGNED_P(p) (((size_t) p) % alignof (uint32_t) != 0)
if (UNALIGNED_P (buffer))
while (len > 64)
{
sha256_process_block (memcpy (ctx->buffer, buffer, 64), 64, ctx);
buffer = (const char *) buffer + 64;
len -= 64;
}
else
#endif
{
sha256_process_block (buffer, len & ~63, ctx);
buffer = (const char *) buffer + (len & ~63);
len &= 63;
}
}
/* Move remaining bytes in internal buffer. */
if (len > 0)
{
size_t left_over = ctx->buflen;
memcpy (&((char *) ctx->buffer)[left_over], buffer, len);
left_over += len;
if (left_over >= 64)
{
sha256_process_block (ctx->buffer, 64, ctx);
left_over -= 64;
memcpy (ctx->buffer, &ctx->buffer[16], left_over);
}
ctx->buflen = left_over;
}
}
/* --- Code below is the primary difference between sha1.c and sha256.c --- */
/* SHA256 round constants */
#define K(I) sha256_round_constants[I]
static const uint32_t sha256_round_constants[64] = {
0x428a2f98UL, 0x71374491UL, 0xb5c0fbcfUL, 0xe9b5dba5UL,
0x3956c25bUL, 0x59f111f1UL, 0x923f82a4UL, 0xab1c5ed5UL,
0xd807aa98UL, 0x12835b01UL, 0x243185beUL, 0x550c7dc3UL,
0x72be5d74UL, 0x80deb1feUL, 0x9bdc06a7UL, 0xc19bf174UL,
0xe49b69c1UL, 0xefbe4786UL, 0x0fc19dc6UL, 0x240ca1ccUL,
0x2de92c6fUL, 0x4a7484aaUL, 0x5cb0a9dcUL, 0x76f988daUL,
0x983e5152UL, 0xa831c66dUL, 0xb00327c8UL, 0xbf597fc7UL,
0xc6e00bf3UL, 0xd5a79147UL, 0x06ca6351UL, 0x14292967UL,
0x27b70a85UL, 0x2e1b2138UL, 0x4d2c6dfcUL, 0x53380d13UL,
0x650a7354UL, 0x766a0abbUL, 0x81c2c92eUL, 0x92722c85UL,
0xa2bfe8a1UL, 0xa81a664bUL, 0xc24b8b70UL, 0xc76c51a3UL,
0xd192e819UL, 0xd6990624UL, 0xf40e3585UL, 0x106aa070UL,
0x19a4c116UL, 0x1e376c08UL, 0x2748774cUL, 0x34b0bcb5UL,
0x391c0cb3UL, 0x4ed8aa4aUL, 0x5b9cca4fUL, 0x682e6ff3UL,
0x748f82eeUL, 0x78a5636fUL, 0x84c87814UL, 0x8cc70208UL,
0x90befffaUL, 0xa4506cebUL, 0xbef9a3f7UL, 0xc67178f2UL,
};
/* Round functions. */
#define F2(A,B,C) ( ( A & B ) | ( C & ( A | B ) ) )
#define F1(E,F,G) ( G ^ ( E & ( F ^ G ) ) )
/* Process LEN bytes of BUFFER, accumulating context into CTX.
It is assumed that LEN % 64 == 0.
Most of this code comes from GnuPG's cipher/sha1.c. */
void
sha256_process_block (const void *buffer, size_t len, struct sha256_ctx *ctx)
{
const uint32_t *words = buffer;
size_t nwords = len / sizeof (uint32_t);
const uint32_t *endp = words + nwords;
uint32_t x[16];
uint32_t a = ctx->state[0];
uint32_t b = ctx->state[1];
uint32_t c = ctx->state[2];
uint32_t d = ctx->state[3];
uint32_t e = ctx->state[4];
uint32_t f = ctx->state[5];
uint32_t g = ctx->state[6];
uint32_t h = ctx->state[7];
/* First increment the byte count. FIPS PUB 180-2 specifies the possible
length of the file up to 2^64 bits. Here we only compute the
number of bytes. Do a double word increment. */
ctx->total[0] += len;
if (ctx->total[0] < len)
++ctx->total[1];
#define rol(x, n) (((x) << (n)) | ((x) >> (32 - (n))))
#define S0(x) (rol(x,25)^rol(x,14)^(x>>3))
#define S1(x) (rol(x,15)^rol(x,13)^(x>>10))
#define SS0(x) (rol(x,30)^rol(x,19)^rol(x,10))
#define SS1(x) (rol(x,26)^rol(x,21)^rol(x,7))
#define M(I) ( tm = S1(x[(I-2)&0x0f]) + x[(I-7)&0x0f] \
+ S0(x[(I-15)&0x0f]) + x[I&0x0f] \
, x[I&0x0f] = tm )
#define R(A,B,C,D,E,F,G,H,K,M) do { t0 = SS0(A) + F2(A,B,C); \
t1 = H + SS1(E) \
+ F1(E,F,G) \
+ K \
+ M; \
D += t1; H = t0 + t1; \
} while(0)
while (words < endp)
{
uint32_t tm;
uint32_t t0, t1;
int t;
/* FIXME: see sha1.c for a better implementation. */
for (t = 0; t < 16; t++)
{
x[t] = SWAP (*words);
words++;
}
R( a, b, c, d, e, f, g, h, K( 0), x[ 0] );
R( h, a, b, c, d, e, f, g, K( 1), x[ 1] );
R( g, h, a, b, c, d, e, f, K( 2), x[ 2] );
R( f, g, h, a, b, c, d, e, K( 3), x[ 3] );
R( e, f, g, h, a, b, c, d, K( 4), x[ 4] );
R( d, e, f, g, h, a, b, c, K( 5), x[ 5] );
R( c, d, e, f, g, h, a, b, K( 6), x[ 6] );
R( b, c, d, e, f, g, h, a, K( 7), x[ 7] );
R( a, b, c, d, e, f, g, h, K( 8), x[ 8] );
R( h, a, b, c, d, e, f, g, K( 9), x[ 9] );
R( g, h, a, b, c, d, e, f, K(10), x[10] );
R( f, g, h, a, b, c, d, e, K(11), x[11] );
R( e, f, g, h, a, b, c, d, K(12), x[12] );
R( d, e, f, g, h, a, b, c, K(13), x[13] );
R( c, d, e, f, g, h, a, b, K(14), x[14] );
R( b, c, d, e, f, g, h, a, K(15), x[15] );
R( a, b, c, d, e, f, g, h, K(16), M(16) );
R( h, a, b, c, d, e, f, g, K(17), M(17) );
R( g, h, a, b, c, d, e, f, K(18), M(18) );
R( f, g, h, a, b, c, d, e, K(19), M(19) );
R( e, f, g, h, a, b, c, d, K(20), M(20) );
R( d, e, f, g, h, a, b, c, K(21), M(21) );
R( c, d, e, f, g, h, a, b, K(22), M(22) );
R( b, c, d, e, f, g, h, a, K(23), M(23) );
R( a, b, c, d, e, f, g, h, K(24), M(24) );
R( h, a, b, c, d, e, f, g, K(25), M(25) );
R( g, h, a, b, c, d, e, f, K(26), M(26) );
R( f, g, h, a, b, c, d, e, K(27), M(27) );
R( e, f, g, h, a, b, c, d, K(28), M(28) );
R( d, e, f, g, h, a, b, c, K(29), M(29) );
R( c, d, e, f, g, h, a, b, K(30), M(30) );
R( b, c, d, e, f, g, h, a, K(31), M(31) );
R( a, b, c, d, e, f, g, h, K(32), M(32) );
R( h, a, b, c, d, e, f, g, K(33), M(33) );
R( g, h, a, b, c, d, e, f, K(34), M(34) );
R( f, g, h, a, b, c, d, e, K(35), M(35) );
R( e, f, g, h, a, b, c, d, K(36), M(36) );
R( d, e, f, g, h, a, b, c, K(37), M(37) );
R( c, d, e, f, g, h, a, b, K(38), M(38) );
R( b, c, d, e, f, g, h, a, K(39), M(39) );
R( a, b, c, d, e, f, g, h, K(40), M(40) );
R( h, a, b, c, d, e, f, g, K(41), M(41) );
R( g, h, a, b, c, d, e, f, K(42), M(42) );
R( f, g, h, a, b, c, d, e, K(43), M(43) );
R( e, f, g, h, a, b, c, d, K(44), M(44) );
R( d, e, f, g, h, a, b, c, K(45), M(45) );
R( c, d, e, f, g, h, a, b, K(46), M(46) );
R( b, c, d, e, f, g, h, a, K(47), M(47) );
R( a, b, c, d, e, f, g, h, K(48), M(48) );
R( h, a, b, c, d, e, f, g, K(49), M(49) );
R( g, h, a, b, c, d, e, f, K(50), M(50) );
R( f, g, h, a, b, c, d, e, K(51), M(51) );
R( e, f, g, h, a, b, c, d, K(52), M(52) );
R( d, e, f, g, h, a, b, c, K(53), M(53) );
R( c, d, e, f, g, h, a, b, K(54), M(54) );
R( b, c, d, e, f, g, h, a, K(55), M(55) );
R( a, b, c, d, e, f, g, h, K(56), M(56) );
R( h, a, b, c, d, e, f, g, K(57), M(57) );
R( g, h, a, b, c, d, e, f, K(58), M(58) );
R( f, g, h, a, b, c, d, e, K(59), M(59) );
R( e, f, g, h, a, b, c, d, K(60), M(60) );
R( d, e, f, g, h, a, b, c, K(61), M(61) );
R( c, d, e, f, g, h, a, b, K(62), M(62) );
R( b, c, d, e, f, g, h, a, K(63), M(63) );
a = ctx->state[0] += a;
b = ctx->state[1] += b;
c = ctx->state[2] += c;
d = ctx->state[3] += d;
e = ctx->state[4] += e;
f = ctx->state[5] += f;
g = ctx->state[6] += g;
h = ctx->state[7] += h;
}
}

View File

@@ -1,83 +0,0 @@
/* Declarations of functions and data types used for SHA256 and SHA224 sum
library functions.
Copyright (C) 2005, 2006, 2008 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/>. */
#ifndef SHA256_H
# define SHA256_H 1
# include <stdio.h>
# include <stdint.h>
/* Structure to save state of computation between the single steps. */
struct sha256_ctx
{
uint32_t state[8];
uint32_t total[2];
uint32_t buflen;
uint32_t buffer[32];
};
enum { SHA224_DIGEST_SIZE = 24 };
enum { SHA256_DIGEST_SIZE = 32 };
/* Initialize structure containing state of computation. */
extern void sha256_init_ctx (struct sha256_ctx *ctx);
extern void sha224_init_ctx (struct sha256_ctx *ctx);
/* Starting with the result of former calls of this function (or the
initialization function update the context for the next LEN bytes
starting at BUFFER.
It is necessary that LEN is a multiple of 64!!! */
extern void sha256_process_block (const void *buffer, size_t len,
struct sha256_ctx *ctx);
/* Starting with the result of former calls of this function (or the
initialization function update the context for the next LEN bytes
starting at BUFFER.
It is NOT required that LEN is a multiple of 64. */
extern void sha256_process_bytes (const void *buffer, size_t len,
struct sha256_ctx *ctx);
/* Process the remaining bytes in the buffer and put result from CTX
in first 32 (28) bytes following RESBUF. The result is always in little
endian byte order, so that a byte-wise output yields to the wanted
ASCII representation of the message digest. */
extern void *sha256_finish_ctx (struct sha256_ctx *ctx, void *resbuf);
extern void *sha224_finish_ctx (struct sha256_ctx *ctx, void *resbuf);
/* Put result from CTX in first 32 (28) bytes following RESBUF. The result is
always in little endian byte order, so that a byte-wise output yields
to the wanted ASCII representation of the message digest. */
extern void *sha256_read_ctx (const struct sha256_ctx *ctx, void *resbuf);
extern void *sha224_read_ctx (const struct sha256_ctx *ctx, void *resbuf);
/* Compute SHA256 (SHA224) message digest for bytes read from STREAM. The
resulting message digest number will be written into the 32 (28) bytes
beginning at RESBLOCK. */
extern int sha256_stream (FILE *stream, void *resblock);
extern int sha224_stream (FILE *stream, void *resblock);
/* Compute SHA256 (SHA224) message digest for LEN bytes beginning at BUFFER. The
result is always in little endian byte order, so that a byte-wise
output yields to the wanted ASCII representation of the message
digest. */
extern void *sha256_buffer (const char *buffer, size_t len, void *resblock);
extern void *sha224_buffer (const char *buffer, size_t len, void *resblock);
#endif

View File

@@ -1,600 +0,0 @@
/* sha512.c - Functions to compute SHA512 and SHA384 message digest of files or
memory blocks according to the NIST specification FIPS-180-2.
Copyright (C) 2005, 2006, 2008 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/>. */
/* Written by David Madore, considerably copypasting from
Scott G. Miller's sha1.c
*/
#include <config.h>
#include "sha512.h"
#include <stddef.h>
#include <string.h>
#if USE_UNLOCKED_IO
# include "unlocked-io.h"
#endif
#ifdef WORDS_BIGENDIAN
# define SWAP(n) (n)
#else
# define SWAP(n) \
u64or (u64or (u64or (u64shl (n, 56), \
u64shl (u64and (n, u64lo (0x0000ff00)), 40)), \
u64or (u64shl (u64and (n, u64lo (0x00ff0000)), 24), \
u64shl (u64and (n, u64lo (0xff000000)), 8))), \
u64or (u64or (u64and (u64shr (n, 8), u64lo (0xff000000)), \
u64and (u64shr (n, 24), u64lo (0x00ff0000))), \
u64or (u64and (u64shr (n, 40), u64lo (0x0000ff00)), \
u64shr (n, 56))))
#endif
#define BLOCKSIZE 4096
#if BLOCKSIZE % 128 != 0
# error "invalid BLOCKSIZE"
#endif
/* This array contains the bytes used to pad the buffer to the next
128-byte boundary. */
static const unsigned char fillbuf[128] = { 0x80, 0 /* , 0, 0, ... */ };
/*
Takes a pointer to a 512 bit block of data (eight 64 bit ints) and
intializes it to the start constants of the SHA512 algorithm. This
must be called before using hash in the call to sha512_hash
*/
void
sha512_init_ctx (struct sha512_ctx *ctx)
{
ctx->state[0] = u64hilo (0x6a09e667, 0xf3bcc908);
ctx->state[1] = u64hilo (0xbb67ae85, 0x84caa73b);
ctx->state[2] = u64hilo (0x3c6ef372, 0xfe94f82b);
ctx->state[3] = u64hilo (0xa54ff53a, 0x5f1d36f1);
ctx->state[4] = u64hilo (0x510e527f, 0xade682d1);
ctx->state[5] = u64hilo (0x9b05688c, 0x2b3e6c1f);
ctx->state[6] = u64hilo (0x1f83d9ab, 0xfb41bd6b);
ctx->state[7] = u64hilo (0x5be0cd19, 0x137e2179);
ctx->total[0] = ctx->total[1] = u64lo (0);
ctx->buflen = 0;
}
void
sha384_init_ctx (struct sha512_ctx *ctx)
{
ctx->state[0] = u64hilo (0xcbbb9d5d, 0xc1059ed8);
ctx->state[1] = u64hilo (0x629a292a, 0x367cd507);
ctx->state[2] = u64hilo (0x9159015a, 0x3070dd17);
ctx->state[3] = u64hilo (0x152fecd8, 0xf70e5939);
ctx->state[4] = u64hilo (0x67332667, 0xffc00b31);
ctx->state[5] = u64hilo (0x8eb44a87, 0x68581511);
ctx->state[6] = u64hilo (0xdb0c2e0d, 0x64f98fa7);
ctx->state[7] = u64hilo (0x47b5481d, 0xbefa4fa4);
ctx->total[0] = ctx->total[1] = u64lo (0);
ctx->buflen = 0;
}
/* Copy the value from V into the memory location pointed to by *CP,
If your architecture allows unaligned access, this is equivalent to
* (__typeof__ (v) *) cp = v */
static inline void
set_uint64 (char *cp, u64 v)
{
memcpy (cp, &v, sizeof v);
}
/* Put result from CTX in first 64 bytes following RESBUF.
The result must be in little endian byte order. */
void *
sha512_read_ctx (const struct sha512_ctx *ctx, void *resbuf)
{
int i;
char *r = resbuf;
for (i = 0; i < 8; i++)
set_uint64 (r + i * sizeof ctx->state[0], SWAP (ctx->state[i]));
return resbuf;
}
void *
sha384_read_ctx (const struct sha512_ctx *ctx, void *resbuf)
{
int i;
char *r = resbuf;
for (i = 0; i < 6; i++)
set_uint64 (r + i * sizeof ctx->state[0], SWAP (ctx->state[i]));
return resbuf;
}
/* Process the remaining bytes in the internal buffer and the usual
prolog according to the standard and write the result to RESBUF. */
static void
sha512_conclude_ctx (struct sha512_ctx *ctx)
{
/* Take yet unprocessed bytes into account. */
size_t bytes = ctx->buflen;
size_t size = (bytes < 112) ? 128 / 8 : 128 * 2 / 8;
/* Now count remaining bytes. */
ctx->total[0] = u64plus (ctx->total[0], u64lo (bytes));
if (u64lt (ctx->total[0], u64lo (bytes)))
ctx->total[1] = u64plus (ctx->total[1], u64lo (1));
/* Put the 64-bit file length in *bits* at the end of the buffer. */
ctx->buffer[size - 2] = SWAP (u64or (u64shl (ctx->total[1], 3),
u64shr (ctx->total[0], 61)));
ctx->buffer[size - 1] = SWAP (u64shl (ctx->total[0], 3));
memcpy (&((char *) ctx->buffer)[bytes], fillbuf, (size - 2) * 8 - bytes);
/* Process last bytes. */
sha512_process_block (ctx->buffer, size * 8, ctx);
}
void *
sha512_finish_ctx (struct sha512_ctx *ctx, void *resbuf)
{
sha512_conclude_ctx (ctx);
return sha512_read_ctx (ctx, resbuf);
}
void *
sha384_finish_ctx (struct sha512_ctx *ctx, void *resbuf)
{
sha512_conclude_ctx (ctx);
return sha384_read_ctx (ctx, resbuf);
}
/* Compute SHA512 message digest for bytes read from STREAM. The
resulting message digest number will be written into the 64 bytes
beginning at RESBLOCK. */
int
sha512_stream (FILE *stream, void *resblock)
{
struct sha512_ctx ctx;
char buffer[BLOCKSIZE + 72];
size_t sum;
/* Initialize the computation context. */
sha512_init_ctx (&ctx);
/* Iterate over full file contents. */
while (1)
{
/* We read the file in blocks of BLOCKSIZE bytes. One call of the
computation function processes the whole buffer so that with the
next round of the loop another block can be read. */
size_t n;
sum = 0;
/* Read block. Take care for partial reads. */
while (1)
{
n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream);
sum += n;
if (sum == BLOCKSIZE)
break;
if (n == 0)
{
/* Check for the error flag IFF N == 0, so that we don't
exit the loop after a partial read due to e.g., EAGAIN
or EWOULDBLOCK. */
if (ferror (stream))
return 1;
goto process_partial_block;
}
/* We've read at least one byte, so ignore errors. But always
check for EOF, since feof may be true even though N > 0.
Otherwise, we could end up calling fread after EOF. */
if (feof (stream))
goto process_partial_block;
}
/* Process buffer with BLOCKSIZE bytes. Note that
BLOCKSIZE % 128 == 0
*/
sha512_process_block (buffer, BLOCKSIZE, &ctx);
}
process_partial_block:;
/* Process any remaining bytes. */
if (sum > 0)
sha512_process_bytes (buffer, sum, &ctx);
/* Construct result in desired memory. */
sha512_finish_ctx (&ctx, resblock);
return 0;
}
/* FIXME: Avoid code duplication */
int
sha384_stream (FILE *stream, void *resblock)
{
struct sha512_ctx ctx;
char buffer[BLOCKSIZE + 72];
size_t sum;
/* Initialize the computation context. */
sha384_init_ctx (&ctx);
/* Iterate over full file contents. */
while (1)
{
/* We read the file in blocks of BLOCKSIZE bytes. One call of the
computation function processes the whole buffer so that with the
next round of the loop another block can be read. */
size_t n;
sum = 0;
/* Read block. Take care for partial reads. */
while (1)
{
n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream);
sum += n;
if (sum == BLOCKSIZE)
break;
if (n == 0)
{
/* Check for the error flag IFF N == 0, so that we don't
exit the loop after a partial read due to e.g., EAGAIN
or EWOULDBLOCK. */
if (ferror (stream))
return 1;
goto process_partial_block;
}
/* We've read at least one byte, so ignore errors. But always
check for EOF, since feof may be true even though N > 0.
Otherwise, we could end up calling fread after EOF. */
if (feof (stream))
goto process_partial_block;
}
/* Process buffer with BLOCKSIZE bytes. Note that
BLOCKSIZE % 128 == 0
*/
sha512_process_block (buffer, BLOCKSIZE, &ctx);
}
process_partial_block:;
/* Process any remaining bytes. */
if (sum > 0)
sha512_process_bytes (buffer, sum, &ctx);
/* Construct result in desired memory. */
sha384_finish_ctx (&ctx, resblock);
return 0;
}
/* Compute SHA512 message digest for LEN bytes beginning at BUFFER. The
result is always in little endian byte order, so that a byte-wise
output yields to the wanted ASCII representation of the message
digest. */
void *
sha512_buffer (const char *buffer, size_t len, void *resblock)
{
struct sha512_ctx ctx;
/* Initialize the computation context. */
sha512_init_ctx (&ctx);
/* Process whole buffer but last len % 128 bytes. */
sha512_process_bytes (buffer, len, &ctx);
/* Put result in desired memory area. */
return sha512_finish_ctx (&ctx, resblock);
}
void *
sha384_buffer (const char *buffer, size_t len, void *resblock)
{
struct sha512_ctx ctx;
/* Initialize the computation context. */
sha384_init_ctx (&ctx);
/* Process whole buffer but last len % 128 bytes. */
sha512_process_bytes (buffer, len, &ctx);
/* Put result in desired memory area. */
return sha384_finish_ctx (&ctx, resblock);
}
void
sha512_process_bytes (const void *buffer, size_t len, struct sha512_ctx *ctx)
{
/* When we already have some bits in our internal buffer concatenate
both inputs first. */
if (ctx->buflen != 0)
{
size_t left_over = ctx->buflen;
size_t add = 256 - left_over > len ? len : 256 - left_over;
memcpy (&((char *) ctx->buffer)[left_over], buffer, add);
ctx->buflen += add;
if (ctx->buflen > 128)
{
sha512_process_block (ctx->buffer, ctx->buflen & ~127, ctx);
ctx->buflen &= 127;
/* The regions in the following copy operation cannot overlap. */
memcpy (ctx->buffer,
&((char *) ctx->buffer)[(left_over + add) & ~127],
ctx->buflen);
}
buffer = (const char *) buffer + add;
len -= add;
}
/* Process available complete blocks. */
if (len >= 128)
{
#if !_STRING_ARCH_unaligned
# define alignof(type) offsetof (struct { char c; type x; }, x)
# define UNALIGNED_P(p) (((size_t) p) % alignof (u64) != 0)
if (UNALIGNED_P (buffer))
while (len > 128)
{
sha512_process_block (memcpy (ctx->buffer, buffer, 128), 128, ctx);
buffer = (const char *) buffer + 128;
len -= 128;
}
else
#endif
{
sha512_process_block (buffer, len & ~127, ctx);
buffer = (const char *) buffer + (len & ~127);
len &= 127;
}
}
/* Move remaining bytes in internal buffer. */
if (len > 0)
{
size_t left_over = ctx->buflen;
memcpy (&((char *) ctx->buffer)[left_over], buffer, len);
left_over += len;
if (left_over >= 128)
{
sha512_process_block (ctx->buffer, 128, ctx);
left_over -= 128;
memcpy (ctx->buffer, &ctx->buffer[16], left_over);
}
ctx->buflen = left_over;
}
}
/* --- Code below is the primary difference between sha1.c and sha512.c --- */
/* SHA512 round constants */
#define K(I) sha512_round_constants[I]
static u64 const sha512_round_constants[80] = {
u64init (0x428a2f98, 0xd728ae22), u64init (0x71374491, 0x23ef65cd),
u64init (0xb5c0fbcf, 0xec4d3b2f), u64init (0xe9b5dba5, 0x8189dbbc),
u64init (0x3956c25b, 0xf348b538), u64init (0x59f111f1, 0xb605d019),
u64init (0x923f82a4, 0xaf194f9b), u64init (0xab1c5ed5, 0xda6d8118),
u64init (0xd807aa98, 0xa3030242), u64init (0x12835b01, 0x45706fbe),
u64init (0x243185be, 0x4ee4b28c), u64init (0x550c7dc3, 0xd5ffb4e2),
u64init (0x72be5d74, 0xf27b896f), u64init (0x80deb1fe, 0x3b1696b1),
u64init (0x9bdc06a7, 0x25c71235), u64init (0xc19bf174, 0xcf692694),
u64init (0xe49b69c1, 0x9ef14ad2), u64init (0xefbe4786, 0x384f25e3),
u64init (0x0fc19dc6, 0x8b8cd5b5), u64init (0x240ca1cc, 0x77ac9c65),
u64init (0x2de92c6f, 0x592b0275), u64init (0x4a7484aa, 0x6ea6e483),
u64init (0x5cb0a9dc, 0xbd41fbd4), u64init (0x76f988da, 0x831153b5),
u64init (0x983e5152, 0xee66dfab), u64init (0xa831c66d, 0x2db43210),
u64init (0xb00327c8, 0x98fb213f), u64init (0xbf597fc7, 0xbeef0ee4),
u64init (0xc6e00bf3, 0x3da88fc2), u64init (0xd5a79147, 0x930aa725),
u64init (0x06ca6351, 0xe003826f), u64init (0x14292967, 0x0a0e6e70),
u64init (0x27b70a85, 0x46d22ffc), u64init (0x2e1b2138, 0x5c26c926),
u64init (0x4d2c6dfc, 0x5ac42aed), u64init (0x53380d13, 0x9d95b3df),
u64init (0x650a7354, 0x8baf63de), u64init (0x766a0abb, 0x3c77b2a8),
u64init (0x81c2c92e, 0x47edaee6), u64init (0x92722c85, 0x1482353b),
u64init (0xa2bfe8a1, 0x4cf10364), u64init (0xa81a664b, 0xbc423001),
u64init (0xc24b8b70, 0xd0f89791), u64init (0xc76c51a3, 0x0654be30),
u64init (0xd192e819, 0xd6ef5218), u64init (0xd6990624, 0x5565a910),
u64init (0xf40e3585, 0x5771202a), u64init (0x106aa070, 0x32bbd1b8),
u64init (0x19a4c116, 0xb8d2d0c8), u64init (0x1e376c08, 0x5141ab53),
u64init (0x2748774c, 0xdf8eeb99), u64init (0x34b0bcb5, 0xe19b48a8),
u64init (0x391c0cb3, 0xc5c95a63), u64init (0x4ed8aa4a, 0xe3418acb),
u64init (0x5b9cca4f, 0x7763e373), u64init (0x682e6ff3, 0xd6b2b8a3),
u64init (0x748f82ee, 0x5defb2fc), u64init (0x78a5636f, 0x43172f60),
u64init (0x84c87814, 0xa1f0ab72), u64init (0x8cc70208, 0x1a6439ec),
u64init (0x90befffa, 0x23631e28), u64init (0xa4506ceb, 0xde82bde9),
u64init (0xbef9a3f7, 0xb2c67915), u64init (0xc67178f2, 0xe372532b),
u64init (0xca273ece, 0xea26619c), u64init (0xd186b8c7, 0x21c0c207),
u64init (0xeada7dd6, 0xcde0eb1e), u64init (0xf57d4f7f, 0xee6ed178),
u64init (0x06f067aa, 0x72176fba), u64init (0x0a637dc5, 0xa2c898a6),
u64init (0x113f9804, 0xbef90dae), u64init (0x1b710b35, 0x131c471b),
u64init (0x28db77f5, 0x23047d84), u64init (0x32caab7b, 0x40c72493),
u64init (0x3c9ebe0a, 0x15c9bebc), u64init (0x431d67c4, 0x9c100d4c),
u64init (0x4cc5d4be, 0xcb3e42b6), u64init (0x597f299c, 0xfc657e2a),
u64init (0x5fcb6fab, 0x3ad6faec), u64init (0x6c44198c, 0x4a475817),
};
/* Round functions. */
#define F2(A, B, C) u64or (u64and (A, B), u64and (C, u64or (A, B)))
#define F1(E, F, G) u64xor (G, u64and (E, u64xor (F, G)))
/* Process LEN bytes of BUFFER, accumulating context into CTX.
It is assumed that LEN % 128 == 0.
Most of this code comes from GnuPG's cipher/sha1.c. */
void
sha512_process_block (const void *buffer, size_t len, struct sha512_ctx *ctx)
{
u64 const *words = buffer;
u64 const *endp = words + len / sizeof (u64);
u64 x[16];
u64 a = ctx->state[0];
u64 b = ctx->state[1];
u64 c = ctx->state[2];
u64 d = ctx->state[3];
u64 e = ctx->state[4];
u64 f = ctx->state[5];
u64 g = ctx->state[6];
u64 h = ctx->state[7];
/* First increment the byte count. FIPS PUB 180-2 specifies the possible
length of the file up to 2^128 bits. Here we only compute the
number of bytes. Do a double word increment. */
ctx->total[0] = u64plus (ctx->total[0], u64lo (len));
if (u64lt (ctx->total[0], u64lo (len)))
ctx->total[1] = u64plus (ctx->total[1], u64lo (1));
#define S0(x) u64xor (u64rol(x, 63), u64xor (u64rol (x, 56), u64shr (x, 7)))
#define S1(x) u64xor (u64rol (x, 45), u64xor (u64rol (x, 3), u64shr (x, 6)))
#define SS0(x) u64xor (u64rol (x, 36), u64xor (u64rol (x, 30), u64rol (x, 25)))
#define SS1(x) u64xor (u64rol(x, 50), u64xor (u64rol (x, 46), u64rol (x, 23)))
#define M(I) (x[(I) & 15] \
= u64plus (x[(I) & 15], \
u64plus (S1 (x[((I) - 2) & 15]), \
u64plus (x[((I) - 7) & 15], \
S0 (x[((I) - 15) & 15])))))
#define R(A, B, C, D, E, F, G, H, K, M) \
do \
{ \
u64 t0 = u64plus (SS0 (A), F2 (A, B, C)); \
u64 t1 = \
u64plus (H, u64plus (SS1 (E), \
u64plus (F1 (E, F, G), u64plus (K, M)))); \
D = u64plus (D, t1); \
H = u64plus (t0, t1); \
} \
while (0)
while (words < endp)
{
int t;
/* FIXME: see sha1.c for a better implementation. */
for (t = 0; t < 16; t++)
{
x[t] = SWAP (*words);
words++;
}
R( a, b, c, d, e, f, g, h, K( 0), x[ 0] );
R( h, a, b, c, d, e, f, g, K( 1), x[ 1] );
R( g, h, a, b, c, d, e, f, K( 2), x[ 2] );
R( f, g, h, a, b, c, d, e, K( 3), x[ 3] );
R( e, f, g, h, a, b, c, d, K( 4), x[ 4] );
R( d, e, f, g, h, a, b, c, K( 5), x[ 5] );
R( c, d, e, f, g, h, a, b, K( 6), x[ 6] );
R( b, c, d, e, f, g, h, a, K( 7), x[ 7] );
R( a, b, c, d, e, f, g, h, K( 8), x[ 8] );
R( h, a, b, c, d, e, f, g, K( 9), x[ 9] );
R( g, h, a, b, c, d, e, f, K(10), x[10] );
R( f, g, h, a, b, c, d, e, K(11), x[11] );
R( e, f, g, h, a, b, c, d, K(12), x[12] );
R( d, e, f, g, h, a, b, c, K(13), x[13] );
R( c, d, e, f, g, h, a, b, K(14), x[14] );
R( b, c, d, e, f, g, h, a, K(15), x[15] );
R( a, b, c, d, e, f, g, h, K(16), M(16) );
R( h, a, b, c, d, e, f, g, K(17), M(17) );
R( g, h, a, b, c, d, e, f, K(18), M(18) );
R( f, g, h, a, b, c, d, e, K(19), M(19) );
R( e, f, g, h, a, b, c, d, K(20), M(20) );
R( d, e, f, g, h, a, b, c, K(21), M(21) );
R( c, d, e, f, g, h, a, b, K(22), M(22) );
R( b, c, d, e, f, g, h, a, K(23), M(23) );
R( a, b, c, d, e, f, g, h, K(24), M(24) );
R( h, a, b, c, d, e, f, g, K(25), M(25) );
R( g, h, a, b, c, d, e, f, K(26), M(26) );
R( f, g, h, a, b, c, d, e, K(27), M(27) );
R( e, f, g, h, a, b, c, d, K(28), M(28) );
R( d, e, f, g, h, a, b, c, K(29), M(29) );
R( c, d, e, f, g, h, a, b, K(30), M(30) );
R( b, c, d, e, f, g, h, a, K(31), M(31) );
R( a, b, c, d, e, f, g, h, K(32), M(32) );
R( h, a, b, c, d, e, f, g, K(33), M(33) );
R( g, h, a, b, c, d, e, f, K(34), M(34) );
R( f, g, h, a, b, c, d, e, K(35), M(35) );
R( e, f, g, h, a, b, c, d, K(36), M(36) );
R( d, e, f, g, h, a, b, c, K(37), M(37) );
R( c, d, e, f, g, h, a, b, K(38), M(38) );
R( b, c, d, e, f, g, h, a, K(39), M(39) );
R( a, b, c, d, e, f, g, h, K(40), M(40) );
R( h, a, b, c, d, e, f, g, K(41), M(41) );
R( g, h, a, b, c, d, e, f, K(42), M(42) );
R( f, g, h, a, b, c, d, e, K(43), M(43) );
R( e, f, g, h, a, b, c, d, K(44), M(44) );
R( d, e, f, g, h, a, b, c, K(45), M(45) );
R( c, d, e, f, g, h, a, b, K(46), M(46) );
R( b, c, d, e, f, g, h, a, K(47), M(47) );
R( a, b, c, d, e, f, g, h, K(48), M(48) );
R( h, a, b, c, d, e, f, g, K(49), M(49) );
R( g, h, a, b, c, d, e, f, K(50), M(50) );
R( f, g, h, a, b, c, d, e, K(51), M(51) );
R( e, f, g, h, a, b, c, d, K(52), M(52) );
R( d, e, f, g, h, a, b, c, K(53), M(53) );
R( c, d, e, f, g, h, a, b, K(54), M(54) );
R( b, c, d, e, f, g, h, a, K(55), M(55) );
R( a, b, c, d, e, f, g, h, K(56), M(56) );
R( h, a, b, c, d, e, f, g, K(57), M(57) );
R( g, h, a, b, c, d, e, f, K(58), M(58) );
R( f, g, h, a, b, c, d, e, K(59), M(59) );
R( e, f, g, h, a, b, c, d, K(60), M(60) );
R( d, e, f, g, h, a, b, c, K(61), M(61) );
R( c, d, e, f, g, h, a, b, K(62), M(62) );
R( b, c, d, e, f, g, h, a, K(63), M(63) );
R( a, b, c, d, e, f, g, h, K(64), M(64) );
R( h, a, b, c, d, e, f, g, K(65), M(65) );
R( g, h, a, b, c, d, e, f, K(66), M(66) );
R( f, g, h, a, b, c, d, e, K(67), M(67) );
R( e, f, g, h, a, b, c, d, K(68), M(68) );
R( d, e, f, g, h, a, b, c, K(69), M(69) );
R( c, d, e, f, g, h, a, b, K(70), M(70) );
R( b, c, d, e, f, g, h, a, K(71), M(71) );
R( a, b, c, d, e, f, g, h, K(72), M(72) );
R( h, a, b, c, d, e, f, g, K(73), M(73) );
R( g, h, a, b, c, d, e, f, K(74), M(74) );
R( f, g, h, a, b, c, d, e, K(75), M(75) );
R( e, f, g, h, a, b, c, d, K(76), M(76) );
R( d, e, f, g, h, a, b, c, K(77), M(77) );
R( c, d, e, f, g, h, a, b, K(78), M(78) );
R( b, c, d, e, f, g, h, a, K(79), M(79) );
a = ctx->state[0] = u64plus (ctx->state[0], a);
b = ctx->state[1] = u64plus (ctx->state[1], b);
c = ctx->state[2] = u64plus (ctx->state[2], c);
d = ctx->state[3] = u64plus (ctx->state[3], d);
e = ctx->state[4] = u64plus (ctx->state[4], e);
f = ctx->state[5] = u64plus (ctx->state[5], f);
g = ctx->state[6] = u64plus (ctx->state[6], g);
h = ctx->state[7] = u64plus (ctx->state[7], h);
}
}

View File

@@ -1,87 +0,0 @@
/* Declarations of functions and data types used for SHA512 and SHA384 sum
library functions.
Copyright (C) 2005, 2006, 2008 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/>. */
#ifndef SHA512_H
# define SHA512_H 1
# include <stdio.h>
# include "u64.h"
/* Structure to save state of computation between the single steps. */
struct sha512_ctx
{
u64 state[8];
u64 total[2];
size_t buflen;
u64 buffer[32];
};
enum { SHA384_DIGEST_SIZE = 48 };
enum { SHA512_DIGEST_SIZE = 64 };
/* Initialize structure containing state of computation. */
extern void sha512_init_ctx (struct sha512_ctx *ctx);
extern void sha384_init_ctx (struct sha512_ctx *ctx);
/* Starting with the result of former calls of this function (or the
initialization function update the context for the next LEN bytes
starting at BUFFER.
It is necessary that LEN is a multiple of 128!!! */
extern void sha512_process_block (const void *buffer, size_t len,
struct sha512_ctx *ctx);
/* Starting with the result of former calls of this function (or the
initialization function update the context for the next LEN bytes
starting at BUFFER.
It is NOT required that LEN is a multiple of 128. */
extern void sha512_process_bytes (const void *buffer, size_t len,
struct sha512_ctx *ctx);
/* Process the remaining bytes in the buffer and put result from CTX
in first 64 (48) bytes following RESBUF. The result is always in little
endian byte order, so that a byte-wise output yields to the wanted
ASCII representation of the message digest. */
extern void *sha512_finish_ctx (struct sha512_ctx *ctx, void *resbuf);
extern void *sha384_finish_ctx (struct sha512_ctx *ctx, void *resbuf);
/* Put result from CTX in first 64 (48) bytes following RESBUF. The result is
always in little endian byte order, so that a byte-wise output yields
to the wanted ASCII representation of the message digest.
IMPORTANT: On some systems it is required that RESBUF is correctly
aligned for a 32 bits value. */
extern void *sha512_read_ctx (const struct sha512_ctx *ctx, void *resbuf);
extern void *sha384_read_ctx (const struct sha512_ctx *ctx, void *resbuf);
/* Compute SHA512 (SHA384) message digest for bytes read from STREAM. The
resulting message digest number will be written into the 64 (48) bytes
beginning at RESBLOCK. */
extern int sha512_stream (FILE *stream, void *resblock);
extern int sha384_stream (FILE *stream, void *resblock);
/* Compute SHA512 (SHA384) message digest for LEN bytes beginning at BUFFER. The
result is always in little endian byte order, so that a byte-wise
output yields to the wanted ASCII representation of the message
digest. */
extern void *sha512_buffer (const char *buffer, size_t len, void *resblock);
extern void *sha384_buffer (const char *buffer, size_t len, void *resblock);
#endif

View File

@@ -1,159 +0,0 @@
/* uint64_t-like operations that work even on hosts lacking uint64_t
Copyright (C) 2006 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 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/>. */
/* Written by Paul Eggert. */
#include <stddef.h>
#include <stdint.h>
/* Return X rotated left by N bits, where 0 < N < 64. */
#define u64rol(x, n) u64or (u64shl (x, n), u64shr (x, 64 - n))
#ifdef UINT64_MAX
/* Native implementations are trivial. See below for comments on what
these operations do. */
typedef uint64_t u64;
# define u64hilo(hi, lo) ((u64) (((u64) (hi) << 32) + (lo)))
# define u64init(hi, lo) u64hilo (hi, lo)
# define u64lo(x) ((u64) (x))
# define u64lt(x, y) ((x) < (y))
# define u64and(x, y) ((x) & (y))
# define u64or(x, y) ((x) | (y))
# define u64xor(x, y) ((x) ^ (y))
# define u64plus(x, y) ((x) + (y))
# define u64shl(x, n) ((x) << (n))
# define u64shr(x, n) ((x) >> (n))
#else
/* u64 is a 64-bit unsigned integer value.
u64init (HI, LO), is like u64hilo (HI, LO), but for use in
initializer contexts. */
# ifdef WORDS_BIGENDIAN
typedef struct { uint32_t hi, lo; } u64;
# define u64init(hi, lo) { hi, lo }
# else
typedef struct { uint32_t lo, hi; } u64;
# define u64init(hi, lo) { lo, hi }
# endif
/* Given the high and low-order 32-bit quantities HI and LO, return a u64
value representing (HI << 32) + LO. */
static inline u64
u64hilo (uint32_t hi, uint32_t lo)
{
u64 r;
r.hi = hi;
r.lo = lo;
return r;
}
/* Return a u64 value representing LO. */
static inline u64
u64lo (uint32_t lo)
{
u64 r;
r.hi = 0;
r.lo = lo;
return r;
}
/* Return X < Y. */
static inline int
u64lt (u64 x, u64 y)
{
return x.hi < y.hi || (x.hi == y.hi && x.lo < y.lo);
}
/* Return X & Y. */
static inline u64
u64and (u64 x, u64 y)
{
u64 r;
r.hi = x.hi & y.hi;
r.lo = x.lo & y.lo;
return r;
}
/* Return X | Y. */
static inline u64
u64or (u64 x, u64 y)
{
u64 r;
r.hi = x.hi | y.hi;
r.lo = x.lo | y.lo;
return r;
}
/* Return X ^ Y. */
static inline u64
u64xor (u64 x, u64 y)
{
u64 r;
r.hi = x.hi ^ y.hi;
r.lo = x.lo ^ y.lo;
return r;
}
/* Return X + Y. */
static inline u64
u64plus (u64 x, u64 y)
{
u64 r;
r.lo = x.lo + y.lo;
r.hi = x.hi + y.hi + (r.lo < x.lo);
return r;
}
/* Return X << N. */
static inline u64
u64shl (u64 x, int n)
{
u64 r;
if (n < 32)
{
r.hi = (x.hi << n) | (x.lo >> (32 - n));
r.lo = x.lo << n;
}
else
{
r.hi = x.lo << (n - 32);
r.lo = 0;
}
return r;
}
/* Return X >> N. */
static inline u64
u64shr (u64 x, int n)
{
u64 r;
if (n < 32)
{
r.hi = x.hi >> n;
r.lo = (x.hi << (32 - n)) | (x.lo >> n);
}
else
{
r.hi = 0;
r.lo = x.hi >> (n - 32);
}
return r;
}
#endif

41
gl/lib/xfreopen.c Normal file
View File

@@ -0,0 +1,41 @@
/* a wrapper for frepoen
Copyright (C) 2008 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/>. */
#include <config.h>
#include "xfreopen.h"
#include <errno.h>
#include "error.h"
#include "exitfail.h"
#include "quote.h"
#include "gettext.h"
#define _(msgid) gettext (msgid)
void
xfreopen (char const *filename, char const *mode, FILE *fp)
{
if (!freopen (filename, mode, fp))
{
char const *f = (filename ? filename
: (fp == stdin ? _("stdin")
: (fp == stdout ? _("stdout")
: (fp == stderr ? _("stderr")
: _("unknown stream")))));
error (exit_failure, errno, _("failed to reopen %s with mode %s"),
quote_n (0, f), quote_n (1, mode));
}
}

2
gl/lib/xfreopen.h Normal file
View File

@@ -0,0 +1,2 @@
#include <stdio.h>
void xfreopen (char const *filename, char const *mode, FILE *fp);

View File

@@ -1,4 +1,4 @@
#serial 2
#serial 3
dnl Copyright (C) 2007-2008 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -6,6 +6,6 @@ dnl with or without modifications, as long as this notice is preserved.
AC_DEFUN([gl_MGETGROUPS],
[
AC_CHECK_FUNCS(getgrouplist)
AC_CHECK_FUNCS([getgrouplist])
AC_LIBOBJ([mgetgroups])
])

View File

@@ -1,17 +0,0 @@
# serial 1 -*- Autoconf -*-
# Copyright (C) 2006, 2007 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# From Jim Meyering
# Provide <selinux/context.h>, if necessary.
AC_DEFUN([gl_HEADERS_SELINUX_CONTEXT_H],
[
# Check for <selinux/context.h>,
AC_CHECK_HEADERS([selinux/context.h],
[SELINUX_CONTEXT_H=],
[SELINUX_CONTEXT_H=selinux/context.h])
AC_SUBST([SELINUX_CONTEXT_H])
])

View File

@@ -1,17 +0,0 @@
# serial 1 -*- Autoconf -*-
# Copyright (C) 2006, 2007 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# From Jim Meyering
# Provide <selinux/selinux.h>, if necessary.
AC_DEFUN([gl_HEADERS_SELINUX_SELINUX_H],
[
# Check for <selinux/selinux.h>,
AC_CHECK_HEADERS([selinux/selinux.h],
[SELINUX_SELINUX_H=],
[SELINUX_SELINUX_H=selinux/selinux.h])
AC_SUBST([SELINUX_SELINUX_H])
])

View File

@@ -1,13 +0,0 @@
# sha256.m4 serial 2
dnl Copyright (C) 2005, 2008 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
AC_DEFUN([gl_SHA256],
[
AC_LIBOBJ([sha256])
dnl Prerequisites of lib/sha256.c.
AC_REQUIRE([AC_C_BIGENDIAN])
])

View File

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

24
gl/modules/argv-iter Normal file
View File

@@ -0,0 +1,24 @@
Description:
iterate through argv or a --files0-from=-specified file
Files:
lib/argv-iter.c
lib/argv-iter.h
Depends-on:
getdelim
stdbool
configure.ac:
Makefile.am:
lib_SOURCES += argv-iter.c argv-iter.h
Include:
"argv-iter.h"
License
GPL
Maintainer:
Jim Meyering

View File

@@ -0,0 +1,10 @@
Files:
tests/test-argv-iter.c
Depends-on:
configure.ac:
Makefile.am:
TESTS += test-argv-iter
check_PROGRAMS += test-argv-iter

View File

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

View File

@@ -13,12 +13,13 @@ configure.ac:
# For runcon.
AC_CHECK_HEADERS([selinux/flask.h])
AC_LIBOBJ([selinux-at])
ac_save_LIBS="$LIBS"
AC_SEARCH_LIBS(setfilecon, selinux,
gl_save_LIBS=$LIBS
LIB_SELINUX=
AC_SEARCH_LIBS([setfilecon], [selinux],
[test "$ac_cv_search_setfilecon" = "none required" ||
LIB_SELINUX=$ac_cv_search_setfilecon])
AC_SUBST(LIB_SELINUX)
LIBS="$ac_save_LIBS"
LIBS=$gl_save_LIBS
Makefile.am:

View File

@@ -1,56 +0,0 @@
Description:
SELinux-related headers for systems that lack them.
Files:
lib/se-context.in.h
lib/se-selinux.in.h
m4/selinux-context-h.m4
m4/selinux-selinux-h.m4
Depends-on:
configure.ac:
gl_HEADERS_SELINUX_SELINUX_H
gl_HEADERS_SELINUX_CONTEXT_H
Makefile.am:
lib_SOURCES += se-context.in.h se-selinux.in.h
BUILT_SOURCES += $(SELINUX_SELINUX_H)
selinux/selinux.h: se-selinux.in.h
mkdir -p selinux
cp $(srcdir)/se-selinux.in.h $@-t
chmod a-x $@-t
mv $@-t $@
MOSTLYCLEANFILES += selinux/selinux.h selinux/selinux.h-t
BUILT_SOURCES += $(SELINUX_CONTEXT_H)
selinux/context.h: se-context.in.h
mkdir -p selinux
cp $(srcdir)/se-context.in.h $@-t
chmod a-x $@-t
mv $@-t $@
MOSTLYCLEANFILES += selinux/context.h selinux/context.h-t
MOSTLYCLEANDIRS += selinux
Include:
#include <selinux/selinux.h>
#include <selinux/context.h>
License:
LGPL
Maintainer:
Jim Meyering
# lib/selinux-at.c
#
# # For runcon.
# AC_CHECK_HEADERS([selinux/flask.h])
#
# ac_save_LIBS="$LIBS"
# AC_SEARCH_LIBS(setfilecon, selinux,
# [test "$ac_cv_search_setfilecon" = "none required" ||
# LIB_SELINUX=$ac_cv_search_setfilecon])
# AC_SUBST(LIB_SELINUX)
# LIBS="$ac_save_LIBS"

View File

@@ -1,24 +0,0 @@
Description:
Compute SHA224 and SHA256 checksums.
Files:
lib/sha256.h
lib/sha256.c
m4/sha256.m4
Depends-on:
stdint
configure.ac:
gl_SHA256
Makefile.am:
Include:
"sha256.h"
License:
LGPLv2+
Maintainer:
Jim Meyering

View File

@@ -1,25 +0,0 @@
Description:
Compute SHA384 and SHA512 checksums.
Files:
lib/sha512.h
lib/sha512.c
m4/sha512.m4
lib/u64.h
Depends-on:
stdint
configure.ac:
gl_SHA512
Makefile.am:
Include:
"sha512.h"
License:
LGPLv2+
Maintainer:
Jim Meyering

25
gl/modules/xfreopen Normal file
View File

@@ -0,0 +1,25 @@
Description:
a wrapper for frepoen
Files:
lib/xfreopen.c
lib/xfreopen.h
Depends-on:
error
exitfail
quote
configure.ac:
Makefile.am:
lib_SOURCES += xfreopen.c xfreopen.h
Include:
"xfreopen.h"
License:
LGPL
Maintainer:
Jim Meyering

120
gl/tests/test-argv-iter.c Normal file
View File

@@ -0,0 +1,120 @@
/* Test argv iterator
Copyright (C) 2008 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/>. */
/* Written by Jim Meyering. */
#include <config.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#define ARRAY_CARDINALITY(Array) (sizeof (Array) / sizeof *(Array))
#define STREQ(s1, s2) ((strcmp (s1, s2) == 0))
#define ASSERT(expr) \
do \
{ \
if (!(expr)) \
{ \
fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
fflush (stderr); \
abort (); \
} \
} \
while (0)
#include "argv-iter.h"
static FILE *
write_nul_delimited_argv (char **argv)
{
FILE *fp = tmpfile ();
ASSERT (fp);
while (*argv)
{
size_t len = strlen (*argv) + 1;
ASSERT (fwrite (*argv, len, 1, fp) == 1);
argv++;
}
ASSERT (fflush (fp) == 0);
rewind (fp);
return fp;
}
int
main ()
{
/* set_program_name (argv[0]); placate overzealous "syntax-check" test. */
static char *av[][4] = {
{NULL},
{"1", NULL},
{"1", "2", NULL},
{"1", "2", "3", NULL}
};
int use_stream;
for (use_stream = 0; use_stream < 2; use_stream++)
{
size_t i;
for (i = 0; i < ARRAY_CARDINALITY (av); i++)
{
FILE *fp;
struct argv_iterator *ai;
size_t n_found = 0;
if (use_stream)
{
/* Generate an identical list to be read via FP. */
ASSERT ((fp = write_nul_delimited_argv (av[i])) != NULL);
ai = argv_iter_init_stream (fp);
}
else
{
fp = NULL;
ai = argv_iter_init_argv (av[i]);
}
ASSERT (ai);
while (1)
{
enum argv_iter_err ai_err;
char *s = argv_iter (ai, &ai_err);
ASSERT ((i == n_found) == (ai_err == AI_ERR_EOF));
ASSERT ((s == NULL) ^ (ai_err == AI_ERR_OK));
ASSERT (ai_err == AI_ERR_OK || ai_err == AI_ERR_EOF);
if (ai_err == AI_ERR_OK)
++n_found;
if (ai_err == AI_ERR_EOF)
break;
/* In stream mode, the strings are equal, but
in argv mode the actual pointers are equal. */
ASSERT (use_stream
? STREQ (s, av[i][n_found - 1])
: s == av[i][n_found - 1]);
}
ASSERT (argv_iter_n_args (ai) == i);
argv_iter_free (ai);
if (fp)
ASSERT (fclose (fp) == 0);
}
}
return 0;
}
/*
* Local variables:
* indent-tabs-mode: nil
* End:
*/

1
gnulib Submodule

Submodule gnulib added at 5a1286a9f8

View File

@@ -1 +1,6 @@
include gnulib.mk
TEST_LOGS = $(TESTS:=.log)
# Parallel replacement of Automake's check-TESTS target.
include $(top_srcdir)/build-aux/check.mk

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 = $(WARNING_CFLAGS) $(WERROR_CFLAGS)
AM_CFLAGS += $(WARN_CFLAGS) # $(WERROR_CFLAGS)
libcoreutils_a_SOURCES += \
buffer-lcm.c buffer-lcm.h \

View File

@@ -52,9 +52,9 @@ xmemxfrm (char *restrict dest, size_t destsize,
if (errno)
{
error (0, errno, _("string transformation failed"));
error (0, 0, _("Set LC_ALL='C' to work around the problem."));
error (0, 0, _("set LC_ALL='C' to work around the problem"));
error (exit_failure, 0,
_("The untransformed string was %s."),
_("the untransformed string was %s"),
quotearg_n_style_mem (0, locale_quoting_style, src, srcsize));
}

View File

@@ -1,7 +1,7 @@
# boottime.m4 serial 3
# boottime.m4 serial 4
# Determine whether this system has infrastructure for obtaining the boot time.
# Copyright (C) 1996, 2000, 2002, 2003, 2004, 2006 Free Software Foundation, Inc.
# Copyright (C) 1996, 2000, 2002-2004, 2006, 2008 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,14 +20,14 @@
* ----------------------------------------------------------
AC_DEFUN([GNULIB_BOOT_TIME],
[
AC_CHECK_FUNCS(sysctl)
AC_CHECK_HEADERS_ONCE(sys/param.h)
AC_CHECK_HEADERS(sys/sysctl.h, [], [],
AC_CHECK_FUNCS([sysctl])
AC_CHECK_HEADERS_ONCE([sys/param.h])
AC_CHECK_HEADERS([sys/sysctl.h], [], [],
[AC_INCLUDES_DEFAULT
[#if HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif]])
AC_CHECK_HEADERS_ONCE(utmp.h utmpx.h OS.h)
AC_CHECK_HEADERS_ONCE([utmp.h utmpx.h OS.h])
AC_CACHE_CHECK(
[whether we can get the system boot time],
[gnulib_cv_have_boot_time],
@@ -57,8 +57,8 @@ AC_DEFUN([GNULIB_BOOT_TIME],
please_tell_us_how_to_determine_boot_time_on_your_system
#endif
]])],
gnulib_cv_have_boot_time=yes,
gnulib_cv_have_boot_time=no)
[gnulib_cv_have_boot_time=yes],
[gnulib_cv_have_boot_time=no])
])
AS_IF([test $gnulib_cv_have_boot_time = yes], [$1], [$2])
])

View File

@@ -1,7 +1,7 @@
#serial 23
#serial 24
# Check declarations for this package.
dnl Copyright (C) 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006
dnl Copyright (C) 1997-2001, 2003-2006, 2008
dnl Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
@@ -16,7 +16,7 @@ AC_DEFUN([gl_CHECK_DECLS],
[
AC_REQUIRE([AC_HEADER_TIME])
AC_CHECK_HEADERS_ONCE(grp.h pwd.h)
AC_CHECK_HEADERS_ONCE([grp.h pwd.h])
headers='
#include <sys/types.h>

36
m4/gmp.m4 Normal file
View File

@@ -0,0 +1,36 @@
# Tests for GNU GMP (or any compatible replacement).
dnl Copyright (C) 2008 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
dnl Written by James Youngman.
dnl Check for libgmp. We avoid use of AC_CHECK_LIBS because we don't want to
dnl add this to $LIBS for all targets.
AC_DEFUN([cu_GMP],
[
LIB_GMP=
AC_SUBST([LIB_GMP])
AC_ARG_WITH([gmp],
AS_HELP_STRING([--without-gmp],
[do not use the GNU MP library for arbitrary precision
calculation (default: use it if available)]),
[cu_use_gmp=$withval],
[cu_use_gmp=auto])
if test $cu_use_gmp != no; then
cu_saved_libs=$LIBS
AC_SEARCH_LIBS([__gmpz_init], [gmp],
[test "$ac_cv_search___gmpz_init" = "none required" ||
{
LIB_GMP=$ac_cv_search___gmpz_init
AC_DEFINE([HAVE_GMP], [1],
[Define if you have GNU libgmp (or replacement)])
}])
LIBS=$cu_saved_libs
fi
])

View File

@@ -1,8 +1,8 @@
#serial 106 -*- autoconf -*-
#serial 109 -*- autoconf -*-
dnl Misc type-related macros for coreutils.
# Copyright (C) 1998, 2000-2007 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
@@ -22,7 +22,7 @@ dnl Misc type-related macros for coreutils.
AC_DEFUN([coreutils_MACROS],
[
AM_MISSING_PROG(HELP2MAN, help2man)
AC_SUBST(MAN)
AC_SUBST([MAN])
dnl This macro actually runs replacement code. See isc-posix.m4.
AC_REQUIRE([AC_ISC_POSIX])dnl
@@ -36,15 +36,21 @@ AC_DEFUN([coreutils_MACROS],
AC_REQUIRE([AC_FUNC_FSEEKO])
# By default, argmatch should fail calling usage (1).
AC_DEFINE(ARGMATCH_DIE, [usage (1)],
AC_DEFINE([ARGMATCH_DIE], [usage (1)],
[Define to the function xargmatch calls on failures.])
AC_DEFINE(ARGMATCH_DIE_DECL, [void usage ()],
AC_DEFINE([ARGMATCH_DIE_DECL], [void usage (int _e)],
[Define to the declaration of the xargmatch failure function.])
# used by ls
AC_REQUIRE([gl_CLOCK_TIME])
# used by shred
AC_CHECK_FUNCS_ONCE(directio)
AC_CHECK_FUNCS_ONCE([directio])
# Used by install.c.
AC_CHECK_FUNCS_ONCE([matchpathcon_init_prefix])
# Used by sort.c.
AC_CHECK_FUNCS_ONCE([nl_langinfo])
AC_CHECK_FUNCS_ONCE( \
endgrent \
@@ -73,24 +79,38 @@ AC_DEFUN([coreutils_MACROS],
[test "$ac_cv_search_fdatasync" = "none required" ||
LIB_FDATASYNC=$ac_cv_search_fdatasync])
AC_SUBST([LIB_FDATASYNC])
AC_CHECK_FUNCS(fdatasync)
AC_CHECK_FUNCS([fdatasync])
LIBS=$coreutils_saved_libs
# Check whether libcap is usable -- for ls --color support
AC_ARG_ENABLE([libcap],
AC_HELP_STRING([--disable-libcap], [disable libcap support]),
AC_MSG_WARN([libcap support disabled by user]),
[AC_CHECK_LIB([cap], [cap_get_file],
[AC_CHECK_HEADER([sys/capability.h],
[LIB_CAP=-lcap
AC_DEFINE([HAVE_CAP], [1], [libcap usability])],
[AC_MSG_WARN([header sys/capability.h was not found, support for libcap will not be built])]
)],
[AC_MSG_WARN([libcap library was not found or not usable, support for libcap will not be built])])
])
AC_SUBST([LIB_CAP])
# See if linking `seq' requires -lm.
# It does on nearly every system. The single exception (so far) is
# BeOS which has all the math functions in the normal runtime library
# and doesn't have a separate math library.
AC_SUBST(SEQ_LIBM)
AC_SUBST([SEQ_LIBM])
ac_seq_body='
static double x, y;
x = floor (x);
x = rint (x);
x = modf (x, &y);'
AC_TRY_LINK([#include <math.h>], $ac_seq_body, ,
AC_TRY_LINK([#include <math.h>], [$ac_seq_body], ,
[ac_seq_save_LIBS="$LIBS"
LIBS="$LIBS -lm"
AC_TRY_LINK([#include <math.h>], $ac_seq_body, SEQ_LIBM=-lm)
AC_TRY_LINK([#include <math.h>], [$ac_seq_body], [SEQ_LIBM=-lm])
LIBS="$ac_seq_save_LIBS"
])
@@ -113,7 +133,7 @@ AC_DEFUN([gl_CHECK_ALL_HEADERS],
syslog.h \
termios.h \
)
AC_CHECK_HEADERS(sys/sysctl.h, [], [],
AC_CHECK_HEADERS([sys/sysctl.h], [], [],
[AC_INCLUDES_DEFAULT
[#if HAVE_SYS_PARAM_H
#include <sys/param.h>
@@ -134,10 +154,9 @@ AC_DEFUN([gl_CHECK_ALL_TYPES],
AC_REQUIRE([AM_C_PROTOTYPES])
dnl Checks for typedefs, structures, and compiler characteristics.
AC_REQUIRE([AC_C_BIGENDIAN])
AC_REQUIRE([gl_BIGENDIAN])
AC_REQUIRE([AC_C_VOLATILE])
AC_REQUIRE([AC_C_INLINE])
AC_REQUIRE([AC_C_LONG_DOUBLE])
AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT])
AC_REQUIRE([gl_CHECK_ALL_HEADERS])
@@ -155,12 +174,12 @@ AC_DEFUN([gl_CHECK_ALL_TYPES],
AC_REQUIRE([AC_TYPE_PID_T])
AC_REQUIRE([AC_TYPE_SIZE_T])
AC_REQUIRE([AC_TYPE_UID_T])
AC_CHECK_TYPE(ino_t, unsigned long int)
AC_CHECK_TYPE([ino_t], [unsigned long int])
dnl This relies on the fact that Autoconf's implementation of
dnl AC_CHECK_TYPE checks includes unistd.h.
AC_CHECK_TYPE(major_t, unsigned int)
AC_CHECK_TYPE(minor_t, unsigned int)
AC_CHECK_TYPE([major_t], [unsigned int])
AC_CHECK_TYPE([minor_t], [unsigned int])
AC_REQUIRE([AC_HEADER_MAJOR])
])

View File

@@ -1,9 +1,9 @@
#serial 10
#serial 11
dnl Misc lib-related macros for coreutils.
# Copyright (C) 1993, 1994, 1995, 1996, 1997, 2000, 2001, 2003, 2004,
# 2005, 2006 Free Software Foundation, Inc.
# Copyright (C) 1993-1997, 2000-2001, 2003-2006, 2008
# 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,20 +24,20 @@ AC_DEFUN([cu_LIB_CHECK],
[
# Check for libypsec.a on Dolphin M88K machines.
AC_CHECK_LIB(ypsec, main)
AC_CHECK_LIB([ypsec], [main])
# m88k running dgux 5.4 needs this
AC_CHECK_LIB(ldgc, main)
AC_CHECK_LIB([ldgc], [main])
# The -lsun library is required for YP support on Irix-4.0.5 systems.
# m88k/svr3 DolphinOS systems using YP need -lypsec for id.
AC_SEARCH_LIBS(yp_match, [sun ypsec])
AC_SEARCH_LIBS([yp_match], [sun ypsec])
# SysV needs -lsec, older versions of Linux need -lshadow for
# shadow passwords. UnixWare 7 needs -lgen.
AC_SEARCH_LIBS(getspnam, [shadow sec gen])
AC_SEARCH_LIBS([getspnam], [shadow sec gen])
AC_CHECK_HEADERS(shadow.h)
AC_CHECK_HEADERS([shadow.h])
# Requirements for su.c.
shadow_includes="\
@@ -47,14 +47,14 @@ $ac_includes_default
#endif
"
AC_CHECK_MEMBERS([struct spwd.sp_pwdp],,,[$shadow_includes])
AC_CHECK_FUNCS(getspnam)
AC_CHECK_FUNCS([getspnam])
# SCO-ODT-3.0 is reported to need -lufc for crypt.
# NetBSD needs -lcrypt for crypt.
cu_saved_libs="$LIBS"
AC_SEARCH_LIBS(crypt, [ufc crypt],
AC_SEARCH_LIBS([crypt], [ufc crypt],
[test "$ac_cv_search_crypt" = "none required" ||
LIB_CRYPT="$ac_cv_search_crypt"])
LIBS="$cu_saved_libs"
AC_SUBST(LIB_CRYPT)
AC_SUBST([LIB_CRYPT])
])

View File

@@ -1,4 +1,4 @@
#serial 75
#serial 76
dnl We use gl_ for non Autoconf macros.
m4_pattern_forbid([^gl_[ABCDEFGHIJKLMNOPQRSTUVXYZ]])dnl
@@ -7,7 +7,7 @@ m4_pattern_forbid([^gl_[ABCDEFGHIJKLMNOPQRSTUVXYZ]])dnl
# directory of the coreutils package.
# Copyright (C) 1998, 2000, 2001, 2003-2008 Free Software Foundation, Inc.
# Copyright (C) 1998, 2000, 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 @@ AC_DEFUN([gl_PREREQ],
# handles that; see ../bootstrap.conf.
AC_REQUIRE([gl_EUIDACCESS_STAT])
AC_REQUIRE([gl_FD_REOPEN])
AC_REQUIRE([gl_FUNC_XATTR])
AC_REQUIRE([gl_FUNC_XFTS])
AC_REQUIRE([gl_MEMXFRM])
AC_REQUIRE([gl_STRINTCMP])

View File

@@ -1,7 +1,7 @@
# stat-prog.m4 serial 5
# stat-prog.m4 serial 6
# Record the prerequisites of src/stat.c from the coreutils package.
# Copyright (C) 2002, 2003, 2004, 2006 Free Software Foundation, Inc.
# Copyright (C) 2002-2004, 2006, 2008 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
@@ -68,7 +68,7 @@ AC_INCLUDES_DEFAULT
[$statvfs_includes],
[static statvfs s;
return (s.s_fsid ^ 0) == 0;])],
[AC_DEFINE([STRUCT_STATVFS_F_FSID_IS_INTEGER], 1,
[AC_DEFINE([STRUCT_STATVFS_F_FSID_IS_INTEGER], [1],
[Define to 1 if the f_fsid member of struct statvfs is an integer.])])
else
AC_CHECK_MEMBERS([struct statfs.f_namelen, struct statfs.f_type],,,
@@ -79,7 +79,7 @@ AC_INCLUDES_DEFAULT
[$statfs_includes],
[static statfs s;
return (s.s_fsid ^ 0) == 0;])],
[AC_DEFINE([STRUCT_STATFS_F_FSID_IS_INTEGER], 1,
[AC_DEFINE([STRUCT_STATFS_F_FSID_IS_INTEGER], [1],
[Define to 1 if the f_fsid member of struct statfs is an integer.])])
fi
fi

36
m4/xattr.m4 Normal file
View File

@@ -0,0 +1,36 @@
# xattr.m4 - check for Extended Attributes (Linux)
# Copyright (C) 2003, 2008-2009 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# Originally written by Andreas Gruenbacher.
# http://www.suse.de/~agruen/coreutils/5.91/coreutils-xattr.diff
AC_DEFUN([gl_FUNC_XATTR],
[
AC_ARG_ENABLE([xattr],
AC_HELP_STRING([--disable-xattr],
[do not support extended attributes]),
[use_xattr=$enableval], [use_xattr=yes])
if test "$use_xattr" = "yes"; then
AC_CHECK_HEADERS([attr/error_context.h attr/libattr.h])
if test $ac_cv_header_attr_libattr_h = yes \
&& test $ac_cv_header_attr_error_context_h = yes; then
use_xattr=1
else
use_xattr=0
fi
AC_DEFINE_UNQUOTED([USE_XATTR], [$use_xattr],
[Define if you want extended attribute support.])
xattr_saved_LIBS=$LIBS
AC_SEARCH_LIBS([attr_copy_file], [attr],
[test "$ac_cv_search_attr_copy_file" = "none required" ||
LIB_XATTR=$ac_cv_search_attr_copy_file])
AC_CHECK_FUNCS([attr_copy_file])
LIBS=$xattr_saved_LIBS
AC_SUBST([LIB_XATTR])
fi
])

675
maint.mk
View File

@@ -2,7 +2,7 @@
# This Makefile fragment tries to be general-purpose enough to be
# used by at least coreutils, idutils, CPPI, Bison, and Autoconf.
## Copyright (C) 2001-2008 Free Software Foundation, Inc.
## Copyright (C) 2001-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
@@ -31,7 +31,7 @@ GIT = git
VC = $(GIT)
VC-tag = git tag -s -m '$(VERSION)'
VC_LIST = build-aux/vc-list-files
VC_LIST = $(srcdir)/build-aux/vc-list-files
VC_LIST_EXCEPT = \
$(VC_LIST) | if test -f .x-$@; then grep -vEf .x-$@; else grep -v ChangeLog; fi
@@ -42,6 +42,7 @@ endif
PREV_VERSION := $(shell cat $(prev_version_file))
VERSION_REGEXP = $(subst .,\.,$(VERSION))
PREV_VERSION_REGEXP = $(subst .,\.,$(PREV_VERSION))
ifeq ($(VC),$(GIT))
this-vc-tag = v$(VERSION)
@@ -61,24 +62,25 @@ release_archive_dir ?= ../release
# Doing it here saves us from having to set LC_ALL elsewhere in this file.
export LC_ALL = C
## --------------- ##
## Sanity checks. ##
## --------------- ##
# Collect the names of rules starting with `sc_'.
syntax-check-rules := $(shell sed -n 's/^\(sc_[a-zA-Z0-9_-]*\):.*/\1/p' \
$(srcdir)/$(ME))
$(srcdir)/$(ME) $(srcdir)/cfg.mk)
.PHONY: $(syntax-check-rules)
local-checks-available = \
po-check copyright-check m4-check author_mark_check \
patch-check strftime-check $(syntax-check-rules) \
makefile_path_separator_check \
patch-check $(syntax-check-rules) \
makefile-check check-AUTHORS
.PHONY: $(local-checks-available)
# Arrange to print the name of each syntax-checking rule just before running it.
$(syntax-check-rules): %: %.m
$(patsubst %, %.m, $(syntax-check-rules)):
@echo $(patsubst sc_%.m, %, $@)
local-check := $(filter-out $(local-checks-to-skip), $(local-checks-available))
syntax-check: $(local-check)
@@ -93,6 +95,21 @@ syntax-check: $(local-check)
# exit 1; } || :
# FIXME: don't allow `#include .strings\.h' anywhere
# By default, _prohibit_regexp does not ignore case.
export ignore_case =
_ignore_case = $$(test -n "$$ignore_case" && echo -i || :)
# There are many rules below that prohibit constructs in this package.
# If the offending construct can be matched with a grep-E-style regexp,
# use this macro. The shell variables "re" and "msg" must be defined.
define _prohibit_regexp
dummy=; : so we do not need a semicolon before each use \
test "x$$re" != x || { echo '$(ME): re not defined' 1>&2; exit 1; }; \
test "x$$msg" != x || { echo '$(ME): msg not defined' 1>&2; exit 1; };\
grep $(_ignore_case) -nE "$$re" $$($(VC_LIST_EXCEPT)) && \
{ echo '$(ME): '"$$msg" 1>&2; exit 1; } || :
endef
sc_avoid_if_before_free:
@$(srcdir)/build-aux/useless-if-before-free \
$(useless_free_options) \
@@ -101,55 +118,75 @@ sc_avoid_if_before_free:
exit 1; } || :
sc_cast_of_argument_to_free:
@grep -nE '\<free \(\(' $$($(VC_LIST_EXCEPT)) && \
{ echo '$(ME): don'\''t cast free argument' 1>&2; \
exit 1; } || :
@re='\<free *\( *\(' msg='don'\''t cast free argument' \
$(_prohibit_regexp)
sc_cast_of_x_alloc_return_value:
@grep -nE '\*\) *x(m|c|re)alloc\>' $$($(VC_LIST_EXCEPT)) && \
{ echo '$(ME): don'\''t cast x*alloc return value' 1>&2; \
exit 1; } || :
@re='\*\) *x(m|c|re)alloc\>' \
msg='don'\''t cast x*alloc return value' \
$(_prohibit_regexp)
sc_cast_of_alloca_return_value:
@grep -nE '\*\) *alloca\>' $$($(VC_LIST_EXCEPT)) && \
{ echo '$(ME): don'\''t cast alloca return value' 1>&2; \
exit 1; } || :
@re='\*\) *alloca\>' msg='don'\''t cast alloca return value' \
$(_prohibit_regexp)
sc_space_tab:
@grep -n '[ ] ' $$($(VC_LIST_EXCEPT)) && \
{ echo '$(ME): found SPACE-TAB sequence; remove the SPACE' \
1>&2; exit 1; } || :
@re='[ ] ' msg='found SPACE-TAB sequence; remove the SPACE' \
$(_prohibit_regexp)
# Don't use *scanf or the old ato* functions in `real' code.
# They provide no error checking mechanism.
# Instead, use strto* functions.
sc_prohibit_atoi_atof:
@grep -nE '\<([fs]?scanf|ato([filq]|ll))\>' $$($(VC_LIST_EXCEPT)) && \
{ echo '$(ME): do not use *scan''f, ato''f, ato''i, ato''l, ato''ll, ato''q, or ss''canf' \
1>&2; exit 1; } || :
@re='\<([fs]?scanf|ato([filq]|ll)) *\(' \
msg='do not use *scan''f, ato''f, ato''i, ato''l, ato''ll or ato''q' \
$(_prohibit_regexp)
# Use STREQ rather than comparing strcmp == 0, or != 0.
sc_prohibit_strcmp:
@grep -nE '! *str''cmp \(|\<str''cmp \([^)]+\) *==' \
$$($(VC_LIST_EXCEPT)) && \
@grep -nE '! *str''cmp *\(|\<str''cmp *\([^)]+\) *==' \
$$($(VC_LIST_EXCEPT)) \
| grep -vE ':# *define STREQ\(' && \
{ echo '$(ME): use STREQ in place of the above uses of str''cmp' \
1>&2; exit 1; } || :
# 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; \
@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
sc_error_message_warn_fatal:
@grep -nEA2 '[^rp]error \(' $$($(VC_LIST_EXCEPT)) \
| grep -E '"Warning|"Fatal|"fatal' && \
{ echo '$(ME): use FATAL, WARNING or warning' 1>&2; \
exit 1; } || :
# Error messages should not start with a capital letter
sc_error_message_uppercase:
@grep -nEA2 '[^rp]error \(' $$($(VC_LIST_EXCEPT)) \
| grep -E '"[A-Z]' \
| grep -vE '"FATAL|"WARNING|"Java|"C#|PRIuMAX' && \
{ echo '$(ME): found capitalized error message' 1>&2; \
exit 1; } || :
# Error messages should not end with a period
sc_error_message_period:
@grep -nEA2 '[^rp]error \(' $$($(VC_LIST_EXCEPT)) \
| grep -E '[^."]\."' && \
{ echo '$(ME): found error message ending in period' 1>&2; \
exit 1; } || :
sc_file_system:
@grep -ni 'file''system' $$($(VC_LIST_EXCEPT)) && \
{ echo '$(ME): found use of "file''system";' \
'rewrite to use "file system"' 1>&2; \
exit 1; } || :
@re=file''system ignore_case=1 \
msg='found use of "file''system"; spell it "file system"' \
$(_prohibit_regexp)
sc_no_have_config_h:
# Don't use cpp tests of this symbol. All code assumes config.h is included.
sc_prohibit_have_config_h:
@grep -n '^# *if.*HAVE''_CONFIG_H' $$($(VC_LIST_EXCEPT)) && \
{ echo '$(ME): found use of HAVE''_CONFIG_H; remove' \
1>&2; exit 1; } || :
@@ -165,6 +202,25 @@ sc_require_config_h:
else :; \
fi
# You must include <config.h> before including any other header file.
sc_require_config_h_first:
@if $(VC_LIST_EXCEPT) | grep '\.c$$' > /dev/null; then \
fail=0; \
for i in $$($(VC_LIST_EXCEPT) | grep '\.c$$'); do \
grep '^# *include\>' $$i | sed 1q \
| grep '^# *include <config\.h>' > /dev/null \
|| { echo $$i; fail=1; }; \
done; \
test $$fail = 1 && \
{ echo '$(ME): the above files include some other header' \
'before <config.h>' 1>&2; exit 1; } || :; \
else :; \
fi
sc_prohibit_HAVE_MBRTOWC:
@re='\bHAVE_MBRTOWC\b' msg="do not use $$re; it is always defined" \
$(_prohibit_regexp)
# To use this "command" macro, you must first define two shell variables:
# h: the header, enclosed in <> or ""
# re: a regular expression that matches IFF something provided by $h is used.
@@ -226,11 +282,53 @@ sc_prohibit_root_dev_ino_without_use:
re='(\<ROOT_DEV_INO_(CHECK|WARN)\>|\<get_root_dev_ino *\()' \
$(_header_without_use)
# Prohibit the inclusion of c-ctype.h without an actual use.
ctype_re = isalnum|isalpha|isascii|isblank|iscntrl|isdigit|isgraph|islower\
|isprint|ispunct|isspace|isupper|isxdigit|tolower|toupper
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:
@grep -nE '\<(HAVE''_FCNTL_H|O''_NDELAY)\>' \
$$($(VC_LIST_EXCEPT)) && \
{ echo '$(ME): do not use HAVE''_FCNTL_H or O''_NDELAY' \
1>&2; exit 1; } || :
@re='\<(HAVE''_FCNTL_H|O''_NDELAY)\>' \
msg='do not use HAVE''_FCNTL_H or O'_NDELAY \
$(_prohibit_regexp)
# FIXME: warn about definitions of EXIT_FAILURE, EXIT_SUCCESS, STREQ
@@ -240,137 +338,43 @@ sc_changelog:
{ echo '$(ME): found unexpected prefix in a ChangeLog' 1>&2; \
exit 1; } || :
# Ensure that dd's definition of LONGEST_SYMBOL stays in sync
# with the strings from the two affected variables.
dd_c = $(srcdir)/src/dd.c
sc_dd_max_sym_length:
ifneq ($(wildcard $(dd_c)),)
@len=$$( (sed -n '/conversions\[\] =$$/,/^};/p' $(dd_c);\
sed -n '/flags\[\] =$$/,/^};/p' $(dd_c) ) \
|sed -n '/"/s/^[^"]*"\([^"]*\)".*/\1/p' \
| wc --max-line-length); \
max=$$(sed -n '/^#define LONGEST_SYMBOL /s///p' $(dd_c) \
|tr -d '"' | wc --max-line-length); \
if test "$$len" = "$$max"; then :; else \
echo 'dd.c: LONGEST_SYMBOL is not longest' 1>&2; \
exit 1; \
fi
endif
# Many m4 macros names once began with `jm_'.
# On 2004-04-13, they were all changed to start with gl_ instead.
# Make sure that none are inadvertently reintroduced.
sc_prohibit_jm_in_m4:
@grep -nE 'jm_[A-Z]' \
$$($(VC_LIST) m4 |grep '\.m4$$'; echo /dev/null) && \
{ echo '$(ME): do not use jm_ in m4 macro names' \
1>&2; exit 1; } || :
sc_root_tests:
@if test -d tests \
&& grep check-root tests/Makefile.am>/dev/null 2>&1; then \
t1=sc-root.expected; t2=sc-root.actual; \
grep -nl '^require_root_$$' \
$$($(VC_LIST) tests) |sed s,tests,., |sort > $$t1; \
sed -n 's, cd \([^ ]*\) .*MAKE..check TESTS=\(.*\),./\1/\2,p' \
$(srcdir)/tests/Makefile.am |sort > $$t2; \
diff -u $$t1 $$t2 || diff=1; \
rm -f $$t1 $$t2; \
test "$$diff" \
&& { echo 'tests/Makefile.am: missing check-root action'>&2; \
exit 1; } || :; \
fi
headers_with_interesting_macro_defs = \
exit.h \
fcntl_.h \
fnmatch_.h \
intprops.h \
inttypes_.h \
lchown.h \
openat.h \
stat-macros.h \
stdint_.h
# Create a list of regular expressions matching the names
# of macros that are guaranteed by parts of gnulib to be defined.
.re-defmac:
@(cd $(srcdir)/lib; \
for f in $(headers_with_interesting_macro_defs); do \
test -f $$f && \
sed -n '/^# *define \([^_ (][^ (]*\)[ (].*/s//\1/p' $$f; \
done; \
) | sort -u \
| grep -Ev 'ATTRIBUTE_NORETURN|SIZE_MAX' \
| sed 's/^/^# *define /' \
> $@-t
@mv $@-t $@
# Don't define macros that we already get from gnulib header files.
sc_always_defined_macros: .re-defmac
@if test -f $(srcdir)/src/system.h; then \
trap 'rc=$$?; rm -f .re-defmac; exit $$rc' 0 1 2 3 15; \
grep -f .re-defmac $$($(VC_LIST)) \
&& { echo '$(ME): define the above via some gnulib .h file' \
1>&2; exit 1; } || :; \
fi
# Create a list of regular expressions matching the names
# of files included from system.h. Exclude a couple.
.re-list:
@sed -n '/^# *include /s///p' $(srcdir)/src/system.h \
| grep -Ev 'sys/(param|file)\.h' \
| sed 's/ .*//;;s/^["<]/^# *include [<"]/;s/\.h[">]$$/\\.h[">]/' \
> $@-t
@mv $@-t $@
# Files in src/ should not include directly any of
# the headers already included via system.h.
sc_system_h_headers: .re-list
@if test -f $(srcdir)/src/system.h; then \
trap 'rc=$$?; rm -f .re-list; exit $$rc' 0 1 2 3 15; \
grep -nE -f .re-list \
$$($(VC_LIST) src | \
grep -Ev '((copy|system)\.h|parse-gram\.c)$$') \
&& { echo '$(ME): the above are already included via system.h'\
1>&2; exit 1; } || :; \
# Ensure that each .c file containing a "main" function also
# calls set_program_name.
sc_program_name:
@if $(VC_LIST_EXCEPT) | grep '\.c$$' > /dev/null; then \
files=$$(grep -l '^main *(' $$($(VC_LIST_EXCEPT) | grep '\.c$$')); \
grep -LE 'set_program_name *\(m?argv\[0\]\);' $$files \
| grep . && \
{ echo '$(ME): the above files do not call set_program_name' \
1>&2; exit 1; } || :; \
else :; \
fi
# Require that the final line of each test-lib.sh-using test be this one:
# (exit $fail); exit $fail
# Exit $fail
# Note: this test requires GNU grep's --label= option.
sc_require_test_exit_idiom:
@if test -f $(srcdir)/tests/test-lib.sh; then \
die=0; \
for i in $$(grep -l -F /../test-lib.sh $$($(VC_LIST) tests)); do \
tail -n1 $$i | grep '^(exit \$$fail); exit \$$fail$$' > /dev/null \
tail -n1 $$i | grep '^Exit \$$fail$$' > /dev/null \
&& : || { die=1; echo $$i; } \
done; \
test $$die = 1 && \
{ echo 1>&2 '$(ME): the final line in each of the above is not:'; \
echo 1>&2 '(exit $$fail); exit $$fail'; \
echo 1>&2 'Exit $$fail'; \
exit 1; } || :; \
fi
sc_sun_os_names:
@grep -nEi \
'solaris[^[:alnum:]]*2\.(7|8|9|[1-9][0-9])|sunos[^[:alnum:]][6-9]' \
$$($(VC_LIST_EXCEPT)) && \
{ echo '$(ME): found misuse of Sun OS version numbers' 1>&2; \
exit 1; } || :
sc_the_the:
@grep -ni '\<the ''the\>' $$($(VC_LIST_EXCEPT)) && \
{ echo '$(ME): found use of "the ''the";' 1>&2; \
exit 1; } || :
sc_tight_scope:
$(MAKE) -C src $@
@re='\<the ''the\>' \
ignore_case=1 msg='found use of "the ''the";' \
$(_prohibit_regexp)
sc_trailing_blank:
@grep -n '[ ]$$' $$($(VC_LIST_EXCEPT)) && \
{ echo '$(ME): found trailing blank(s)' \
1>&2; exit 1; } || :
@re='[ ]$$' \
msg='found trailing blank(s)' \
$(_prohibit_regexp)
# Match lines like the following, but where there is only one space
# between the options and the description:
@@ -380,7 +384,7 @@ sc_two_space_separator_in_usage:
@grep -nE '^ *(-[A-Za-z],)? $(longopt_re) [^ ].*\\$$' \
$$($(VC_LIST_EXCEPT)) && \
{ echo "$(ME): help2man requires at least two spaces between"; \
echo "$(ME): an option and its description"; \
echo "$(ME): an option and its description"; \
1>&2; exit 1; } || :
# Look for diagnostics that aren't marked for translation.
@@ -401,18 +405,99 @@ sc_useless_cpp_parens:
# Require the latest GPL.
sc_GPL_version:
@grep -n 'either ''version [^3]' $$($(VC_LIST_EXCEPT)) && \
{ echo '$(ME): GPL vN, N!=3' 1>&2; exit 1; } || :
@re='either ''version [^3]' msg='GPL vN, N!=3' \
$(_prohibit_regexp)
cvs_keywords = \
Author|Date|Header|Id|Name|Locker|Log|RCSfile|Revision|Source|State
sc_prohibit_cvs_keyword:
@re='\$$($(cvs_keywords))\$$' \
msg='do not use CVS keyword expansion' \
$(_prohibit_regexp)
# Make sure we don't use st_blocks. Use ST_NBLOCKS instead.
# This is a bit of a kludge, since it prevents use of the string
# even in comments, but for now it does the job with no false positives.
sc_prohibit_stat_st_blocks:
@re='[.>]st_blocks' msg='do not use st_blocks; use ST_NBLOCKS' \
$(_prohibit_regexp)
# Make sure we don't define any S_IS* macros in src/*.c files.
# They're already defined via gnulib's sys/stat.h replacement.
sc_prohibit_S_IS_definition:
@re='^ *# *define *S_IS' \
msg='do not define S_IS* macros; include <sys/stat.h>' \
$(_prohibit_regexp)
# Each program that uses proper_name_utf8 must link with
# one of the ICONV libraries.
sc_proper_name_utf8_requires_ICONV:
@progs=$$(grep -l 'proper_name_utf8 ''("' $$($(VC_LIST_EXCEPT)));\
if test "x$$progs" != x; then \
fail=0; \
for p in $$progs; do \
dir=$$(dirname "$$p"); \
base=$$(basename "$$p" .c); \
grep "$${base}_LDADD.*ICONV)" $$dir/Makefile.am > /dev/null \
|| { fail=1; echo 1>&2 "$(ME): $$p uses proper_name_utf8"; }; \
done; \
test $$fail = 1 && \
{ echo 1>&2 '$(ME): the above do not link with any ICONV library'; \
exit 1; } || :; \
fi
# Warn about "c0nst struct Foo const foo[]",
# but not about "char const *const foo" or "#define const const".
sc_redundant_const:
@re='\bconst\b[[:space:][:alnum:]]{2,}\bconst\b' \
msg='redundant "const" in declarations' \
$(_prohibit_regexp)
sc_const_long_option:
@grep '^ *static.*struct option ' $$($(VC_LIST_EXCEPT)) \
| grep -Ev 'const struct option|struct option const' && { \
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 - \
| sed 's/ .*//')
# Ensure that we don't accidentally insert an entry into an old NEWS block.
sc_immutable_NEWS:
@if test -f $(srcdir)/NEWS; then \
test "$(NEWS_hash)" = '$(old_NEWS_hash)' && : || \
{ echo '$(ME): you have modified old NEWS' 1>&2; exit 1; }; \
fi
# Update the hash stored above. Do this after each release and
# for any corrections to old entries.
update-NEWS-hash: NEWS
perl -pi -e 's/^(old_NEWS_hash = ).*/$${1}'"$(NEWS_hash)/" \
$(srcdir)/cfg.mk
epoch_date = 1970-01-01 00:00:00.000000000 +0000
# Ensure that the c99-to-c89 patch applies cleanly.
patch-check:
rm -rf src-c89 $@.1 $@.2
cp -a src src-c89
(cd src-c89; patch -p1 -V never --fuzz=0) < src/c99-to-c89.diff \
cp -a $(srcdir)/src src-c89
if test "x$(srcdir)" != x.; then \
cp -a src/* src-c89; \
dotfiles=`ls src/.[!.]* 2>/dev/null`; \
test -z "$$dotfiles" || cp -a src/.[!.]* src-c89; \
fi
(cd src-c89; patch -p1 -V never --fuzz=0) < $(srcdir)/src/c99-to-c89.diff \
> $@.1 2>&1
if test "$$REGEN_PATCH" = yes; then \
diff -upr src src-c89 | sed 's,src-c89/,src/,' \
| grep -v '^Only in' > new-diff || : ; fi
if test "$(REGEN_PATCH)" = yes; then \
diff -upr $(srcdir)/src src-c89 | sed 's,$(srcdir)/src-c89/,src/,' \
| grep -vE '^(Only in|File )' \
| perl -pe 's/^((?:\+\+\+|---) \S+\t).*/$${1}$(epoch_date)/;' \
-e 's/^ $$//' \
> new-diff || : ; fi
grep -v '^patching file ' $@.1 > $@.2 || :
msg=ok; test -s $@.2 && msg='fuzzy patch' || : ; \
rm -f src-c89/*.o || msg='rm failed'; \
@@ -421,29 +506,18 @@ patch-check:
test "$$msg" = ok && rm -rf src-c89 $@.1 $@.2 || echo "$$msg" 1>&2; \
test "$$msg" = ok
# Ensure that date's --help output stays in sync with the info
# documentation for GNU strftime. The only exception is %N,
# which date accepts but GNU strftime does not.
extract_char = sed 's/^[^%][^%]*%\(.\).*/\1/'
strftime-check:
if test -f $(srcdir)/src/date.c; then \
grep '^ %. ' $(srcdir)/src/date.c | sort \
| $(extract_char) > $@-src; \
{ echo N; \
info libc date calendar format | grep '^ `%.'\' \
| $(extract_char); } | sort > $@-info; \
diff -u $@-src $@-info || exit 1; \
rm -f $@-src $@-info; \
fi
check-AUTHORS:
$(MAKE) -C src $@
# Ensure that we use only the standard $(VAR) notation,
# not @...@ in Makefile.am, now that we can rely on automake
# to emit a definition for each substituted variable.
# We use perl rather than "grep -nE ..." to exempt a single
# use of an @...@-delimited variable name in src/Makefile.am.
makefile-check:
grep -nE '@[A-Z_0-9]+@' `find . -name Makefile.am` \
@perl -ne '/\@[A-Z_0-9]+\@/ && !/^cu_install_program =/' \
-e 'and (print "$$ARGV:$$.: $$_"), $$m=1; END {exit !$$m}' \
$$($(VC_LIST_EXCEPT) | grep -E '(^|/)Makefile\.am$$') \
&& { echo '$(ME): use $$(...), not @...@' 1>&2; exit 1; } || :
news-date-check: NEWS
@@ -465,22 +539,33 @@ changelog-check:
exit 1; \
fi
m4-check:
@grep -n 'AC_DEFUN([^[]' m4/*.m4 \
&& { echo '$(ME): quote the first arg to AC_DEFUN' 1>&2; \
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)$$') \
&& { echo '$(ME): quote the first arg to AC_DEF*' 1>&2; \
exit 1; } || :
fix_po_file_diag = \
'you have changed the set of files with translatable diagnostics;\n\
apply the above patch\n'
# Verify that all source files using _() are listed in po/POTFILES.in.
# FIXME: don't hard-code file names below; use a more general mechanism.
po-check:
if test -f po/POTFILES.in; then \
grep -E -v '^(#|$$)' po/POTFILES.in \
po_file = po/POTFILES.in
sc_po_check:
@if test -f $(po_file); then \
grep -E -v '^(#|$$)' $(po_file) \
| grep -v '^src/false\.c$$' | sort > $@-1; \
files=; \
for file in $$($(VC_LIST_EXCEPT)) lib/*.[ch]; do \
case $$file in \
djgpp/* | man/*) continue;; \
*/c99-to-c89.diff) continue;; \
*.?|*.??) ;; \
*) continue;; \
esac; \
case $$file in \
*.[ch]) \
@@ -491,34 +576,25 @@ po-check:
done; \
grep -E -l '\b(N?_|gettext *)\([^)"]*("|$$)' $$files \
| sort -u > $@-2; \
diff -u $@-1 $@-2 || exit 1; \
diff -u -L $(po_file) -L $(po_file) $@-1 $@-2 \
|| { printf '$(ME): '$(fix_po_file_diag) 1>&2; exit 1; }; \
rm -f $@-1 $@-2; \
fi
# In a definition of #define AUTHORS "... and ..." where the RHS contains
# the English word `and', the string must be marked with `N_ (...)' so that
# gettext recognizes it as a string requiring translation.
author_mark_check:
@grep -n '^# *define AUTHORS "[^"]* and ' src/*.c |grep -v ' N_ (' && \
{ echo '$(ME): enclose the above strings in N_ (...)' 1>&2; \
exit 1; } || :
# 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'
makefile_path_separator_check:
@grep -n 'PATH=.*:' `find $(srcdir) -name Makefile.am` \
# 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 -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; }; \
@@ -531,24 +607,24 @@ sample-test = tests/sample-test
texi = doc/$(PACKAGE).texi
# Make sure that the copyright date in $(v_etc_file) is up to date.
# Do the same for the $(sample-test) and the main doc/.texi file.
copyright-check:
@if test -f $(v_etc_file); then \
sc_copyright_check:
@if test -f $(v_etc_file); then \
grep 'enum { COPYRIGHT_YEAR = '$$(date +%Y)' };' $(v_etc_file) \
>/dev/null \
>/dev/null \
|| { echo 'out of date copyright in $(v_etc_file); update it' 1>&2; \
exit 1; }; \
exit 1; }; \
fi
@if test -f $(sample-test); then \
grep '# Copyright (C) '$$(date +%Y)' Free' $(sample-test) \
>/dev/null \
@if test -f $(sample-test); then \
grep '# Copyright (C) '$$(date +%Y)' Free' $(sample-test) \
>/dev/null \
|| { echo 'out of date copyright in $(sample-test); update it' 1>&2; \
exit 1; }; \
exit 1; }; \
fi
@if test -f $(texi); then \
grep 'Copyright @copyright{} .*'$$(date +%Y)' Free' $(texi) \
>/dev/null \
|| { echo 'out of date copyright in $(texi); update it' 1>&2; \
exit 1; }; \
@if test -f $(texi); then \
grep 'Copyright @copyright{} .*'$$(date +%Y)' Free' $(texi) \
>/dev/null \
|| { echo 'out of date copyright in $(texi); update it' 1>&2; \
exit 1; }; \
fi
vc-diff-check:
@@ -565,13 +641,14 @@ cvs-check: vc-diff-check
maintainer-distcheck:
$(MAKE) distcheck
$(MAKE) taint-distcheck
$(MAKE) my-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.
@@ -589,35 +666,77 @@ bin=bin-$$$$
write_loser = printf '\#!%s\necho $$0: bad path 1>&2; exit 1\n' '$(SHELL)'
# Use -Wformat -Werror to detect format-string/arg-list mismatches.
# Also, check for shadowing problems with -Wshadow, and for pointer
# arithmetic problems with -Wpointer-arith.
# These CFLAGS are pretty strict. If you build this target, you probably
# have to have a recent version of gcc and glibc headers.
# The for-loop below ensures that there is a bin/ directory full of all
# of the programs under test (except the few that are required for basic
# Makefile rules), all symlinked to the just-built "false" program.
# This is to ensure that if ever a test neglects to make PATH include
# the build srcdir, these always-failing programs will run.
# Otherwise, it is too easy to test the wrong programs.
# Note that "false" itself is a symlink to true, so it too will malfunction.
TMPDIR ?= /tmp
t=$(TMPDIR)/$(PACKAGE)/test
my-distcheck: $(local-check) check
-rm -rf $(t)
mkdir -p $(t)
GZIP=$(GZIP_ENV) $(AMTAR) -C $(t) -zxf $(distdir).tar.gz
cd $(t)/$(distdir) \
&& ./configure --disable-nls --prefix=$(t)/i \
&& $(MAKE) CFLAGS='$(warn_cflags)' \
AM_MAKEFLAGS='$(null_AM_MAKEFLAGS)' \
&& $(MAKE) dvi \
&& $(MAKE) install \
&& test -f $(mandir)/man1/ls.1 \
&& mkdir $(bin) \
&& ($(write_loser)) > $(bin)/loser \
&& chmod a+x $(bin)/loser \
&& for i in $(built_programs); do \
pfx=$(t)/i
# More than once, tainted build and source directory names would
# have caused at least one "make check" test to apply "chmod 700"
# to all directories under $HOME. Make sure it doesn't happen again.
tp := $(shell echo "$(TMPDIR)/$(PACKAGE)-$$$$")
t_prefix = $(tp)/a
t_taint = '$(t_prefix) b'
fake_home = $(tp)/home
# Ensure that tests run from tainted build and src dir names work,
# and don't affect anything in $HOME. Create witness files in $HOME,
# record their attributes, and build/test. Then ensure that the
# witnesses were not affected.
taint-distcheck: $(DIST_ARCHIVES)
test -d $(t_taint) && chmod -R 700 $(t_taint) || :
-rm -rf $(t_taint) $(fake_home)
mkdir -p $(t_prefix) $(t_taint) $(fake_home)
GZIP=$(GZIP_ENV) $(AMTAR) -C $(t_taint) -zxf $(distdir).tar.gz
mkfifo $(fake_home)/fifo
touch $(fake_home)/f
mkdir -p $(fake_home)/d/e
ls -lR $(fake_home) $(t_prefix) > $(tp)/.ls-before
cd $(t_taint)/$(distdir) \
&& ./configure \
&& $(MAKE) \
&& HOME=$(fake_home) $(MAKE) check \
&& ls -lR $(fake_home) $(t_prefix) > $(tp)/.ls-after \
&& diff $(tp)/.ls-before $(tp)/.ls-after \
&& test -d $(t_prefix)
rm -rf $(tp)
# Verify that a twisted use of --program-transform-name=PROGRAM works.
define install-transform-check
echo running install-transform-check \
&& rm -rf $(pfx) \
&& $(MAKE) program_transform_name='s/.*/zyx/' \
prefix=$(pfx) install \
&& test "$$(echo $(pfx)/bin/*)" = "$(pfx)/bin/zyx" \
&& test "$$(find $(pfx)/share/man -type f|sed 's,.*/,,;s,\..*,,')" = "zyx"
endef
# Install, then verify that all binaries and man pages are in place.
# Note that neither the binary, ginstall, nor the ].1 man page is installed.
define my-instcheck
$(MAKE) prefix=$(pfx) install \
&& test ! -f $(pfx)/bin/ginstall \
&& { fail=0; \
for i in $(built_programs); do \
test "$$i" = ginstall && i=install; \
for j in "$(pfx)/bin/$$i" \
"$(pfx)/share/man/man1/$$i.1"; do \
case $$j in *'[.1') continue;; esac; \
test -f "$$j" && : \
|| { echo "$$j not installed"; fail=1; }; \
done; \
done; \
test $$fail = 1 && exit 1 || :; \
}
endef
define coreutils-path-check
{ \
if test -f $(srcdir)/src/true.c; then \
fail=1; \
mkdir $(bin) \
&& ($(write_loser)) > $(bin)/loser \
&& chmod a+x $(bin)/loser \
&& for i in $(built_programs); do \
case $$i in \
rm|expr|basename|echo|sort|ls|tr);; \
cat|dirname|mv|wc);; \
@@ -625,20 +744,50 @@ my-distcheck: $(local-check) check
esac; \
done \
&& ln -sf ../src/true $(bin)/false \
&& PATH=`pwd`/$(bin):$$PATH $(MAKE) -C tests check \
&& $(MAKE) -C gnulib-tests check \
&& PATH=`pwd`/$(bin)$(PATH_SEPARATOR)$$PATH \
$(MAKE) -C tests check \
&& { test -d gnulib-tests \
&& $(MAKE) -C gnulib-tests check \
|| :; } \
&& rm -rf $(bin) \
&& fail=0; \
else \
fail=0; \
fi; \
test $$fail = 1 && exit 1 || :; \
}
endef
# Use -Wformat -Werror to detect format-string/arg-list mismatches.
# Also, check for shadowing problems with -Wshadow, and for pointer
# arithmetic problems with -Wpointer-arith.
# These CFLAGS are pretty strict. If you build this target, you probably
# have to have a recent version of gcc and glibc headers.
# The hard-linking for-loop below ensures that there is a bin/ directory
# full of all of the programs under test (except the ones that are required
# for basic Makefile rules), all symlinked to the just-built "false" program.
# This is to ensure that if ever a test neglects to make PATH include
# the build srcdir, these always-failing programs will run.
# Otherwise, it is too easy to test the wrong programs.
# Note that "false" itself is a symlink to true, so it too will malfunction.
my-distcheck: $(DIST_ARCHIVES) $(local-check)
$(MAKE) syntax-check
$(MAKE) check
-rm -rf $(t)
mkdir -p $(t)
GZIP=$(GZIP_ENV) $(AMTAR) -C $(t) -zxf $(distdir).tar.gz
cd $(t)/$(distdir) \
&& ./configure --disable-nls \
&& $(MAKE) CFLAGS='$(warn_cflags)' \
AM_MAKEFLAGS='$(null_AM_MAKEFLAGS)' \
&& $(MAKE) dvi \
&& $(install-transform-check) \
&& $(my-instcheck) \
&& $(coreutils-path-check) \
&& $(MAKE) distclean
(cd $(t) && mv $(distdir) $(distdir).old \
&& $(AMTAR) -zxf - ) < $(distdir).tar.gz
diff -ur $(t)/$(distdir).old $(t)/$(distdir)
if test -f $(srcdir)/src/c99-to-c89.diff; then \
cd $(t)/$(distdir) \
&& (cd src && patch -V never --fuzz=0 <c99-to-c89.diff) \
&& ./configure --disable-largefile \
CFLAGS='-Werror -ansi -Wno-long-long' \
&& $(MAKE); \
fi
-rm -rf $(t)
@echo "========================"; \
echo "$(distdir).tar.gz is ready for distribution"; \
@@ -670,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))
## ---------------- ##
@@ -692,6 +842,14 @@ emit_upload_commands:
@echo =====================================
@echo =====================================
noteworthy = * Noteworthy changes in release ?.? (????-??-??) [?]
define emit-commit-log
printf '%s\n' 'post-release administrivia' '' \
'* NEWS: Add header line for next release.' \
'* .prev-version: Record previous version.' \
'* cfg.mk (old_NEWS_hash): Auto-update.'
endef
.PHONY: alpha beta major
alpha beta major: $(local-check) writable-files
test $@ = major \
@@ -707,6 +865,17 @@ alpha beta major: $(local-check) writable-files
fi
$(MAKE) -s emit_upload_commands RELEASE_TYPE=$@
echo $(VERSION) > $(prev_version_file)
$(VC) commit -m \
'$(prev_version_file): Record previous version: $(VERSION).' \
$(prev_version_file)
$(MAKE) update-NEWS-hash
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

@@ -1,6 +1,6 @@
# Make coreutils man pages. -*-Makefile-*-
# Copyright (C) 2002-2008 Free Software Foundation, Inc.
# Copyright (C) 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
@@ -113,9 +113,11 @@ tac.1: $(common_dep) $(srcdir)/tac.x ../src/tac.c
tail.1: $(common_dep) $(srcdir)/tail.x ../src/tail.c
tee.1: $(common_dep) $(srcdir)/tee.x ../src/tee.c
test.1: $(common_dep) $(srcdir)/test.x ../src/test.c
timeout.1: $(common_dep) $(srcdir)/timeout.x ../src/timeout.c
touch.1: $(common_dep) $(srcdir)/touch.x ../src/touch.c
tr.1: $(common_dep) $(srcdir)/tr.x ../src/tr.c
true.1: $(common_dep) $(srcdir)/true.x ../src/true.c
truncate.1: $(common_dep) $(srcdir)/truncate.x ../src/truncate.c
tsort.1: $(common_dep) $(srcdir)/tsort.x ../src/tsort.c
tty.1: $(common_dep) $(srcdir)/tty.x ../src/tty.c
uname.1: $(common_dep) $(srcdir)/uname.x ../src/uname.c
@@ -130,6 +132,10 @@ who.1: $(common_dep) $(srcdir)/who.x ../src/who.c
whoami.1: $(common_dep) $(srcdir)/whoami.x ../src/whoami.c
yes.1: $(common_dep) $(srcdir)/yes.x ../src/yes.c
# This is required so that changes to e.g., emit_bug_reporting_address
# provoke regeneration of all $(MAN) files.
$(MAN): $(top_srcdir)/src/system.h
SUFFIXES = .x .1
# Ensure that help2man runs the ../src/ginstall binary as
@@ -150,16 +156,15 @@ 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/$@ > $@ \
&& chmod a-w $@ \
&& rm -rf $t ;; \
esac

View File

@@ -19,7 +19,7 @@ will match any files whose names end in
.BR .o .
Therefore, the command
.IP
.B du --exclude='*.o'
.B du --exclude=\(aq*.o\(aq
.PP
will skip all files and subdirectories ending in
.BR .o

View File

@@ -1,7 +1,7 @@
#!/usr/bin/perl -w
# Generate a short man page from --help and --version output.
# Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2008
# Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2008, 2009
# Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
@@ -34,7 +34,7 @@ my $have_gettext;
BEGIN {
eval {
require Locale::gettext;
Locale::gettext->import;
Locale::gettext->import (qw(gettext textdomain));
$have_gettext = 1;
};
@@ -134,7 +134,7 @@ die $help_info unless @ARGV == 1;
die "$this_program: no locale support (Locale::gettext required)\n"
unless $locale eq 'C' or $have_gettext;
# Set localisation of date and executable's ouput.
# Set localization of date and executable's output.
delete @ENV{qw(LANGUAGE LC_MESSAGES LANG)};
setlocale LC_ALL, $ENV{LC_ALL} = $locale;
@@ -368,7 +368,7 @@ s/^\./\x80/mg;
s/^'/\x81/mg;
s/\\/\x82/g;
my $PAT_BUGS = _('Report +bugs|Email +bug +reports +to');
my $PAT_BUGS = _('Report +(?:\w+ +)?bugs|Email +bug +reports +to');
my $PAT_AUTHOR = _('Written +by');
my $PAT_OPTIONS = _('Options');
my $PAT_EXAMPLES = _('Examples');
@@ -567,7 +567,7 @@ and
.B %s
programs are properly installed at your site, the command
.IP
.B info coreutils '%s invocation'
.B info coreutils \(aq%s invocation\(aq
.PP
should give you access to the complete manual.
EOT
@@ -607,6 +607,9 @@ for my $sect (@pre, (grep ! /^($filter)$/o, @include), @post)
# Convert some latin1 chars to troff equivalents
s/\xa0/\\ /g; # non-breaking space
$sect eq 'REPORTING BUGS'
and s/\n(.)/\n.br\n$1/g;
print;
}
}

View File

@@ -1,4 +1,4 @@
[NAME]
id \- print user identity
id \- print real and effective user and group IDs
[DESCRIPTION]
.\" Add any additional description here

6
man/timeout.x Normal file
View File

@@ -0,0 +1,6 @@
[NAME]
timeout \- run a command with a time limit
[DESCRIPTION]
.\" Add any additional description here
[SEE ALSO]
kill(1)

6
man/truncate.x Normal file
View File

@@ -0,0 +1,6 @@
[NAME]
truncate \- shrink or extend the size of a file to the specified size
[DESCRIPTION]
.\" Add any additional description here
[SEE ALSO]
dd(1), truncate(2), ftruncate(2)

View File

@@ -753,7 +753,7 @@ Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
2001, 2002, 2003 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.2 or
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with no
Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
Texts. A copy of the license is included in the ``GNU Free

View File

@@ -277,7 +277,7 @@ Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
2001, 2002, 2003 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.2 or
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with no
Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
Texts. A copy of the license is included in the ``GNU Free

View File

@@ -465,7 +465,7 @@ Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
2001, 2002, 2006 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.2 or
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with no
Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
Texts. A copy of the license is included in the ``GNU Free

View File

@@ -1,11 +1,11 @@
# List of files which contain translatable strings.
# Copyright (C) 1996-2008 Free Software Foundation, Inc.
# Copyright (C) 1996-2009 Free Software Foundation, Inc.
# These are nominally temporary...
lib/acl.c
lib/argmatch.c
lib/closein.c
lib/closeout.c
lib/copy-acl.c
lib/error.c
lib/euidaccess-stat.c
lib/file-type.c
@@ -19,10 +19,13 @@ lib/randread.c
lib/regcomp.c
lib/root-dev-ino.h
lib/rpmatch.c
lib/set-mode-acl.c
lib/unicodeio.c
lib/userspec.c
lib/verror.c
lib/version-etc.c
lib/xalloc-die.c
lib/xfreopen.c
lib/xfts.c
lib/xmemcoll.c
lib/xmemxfrm.c
@@ -60,6 +63,7 @@ src/factor.c
src/false.c
src/fmt.c
src/fold.c
src/getlimits.c
src/group-list.c
src/groups.c
src/head.c
@@ -83,6 +87,7 @@ src/nice.c
src/nl.c
src/nohup.c
src/od.c
src/operand2sig.c
src/paste.c
src/pathchk.c
src/pinky.c
@@ -114,9 +119,11 @@ src/tac.c
src/tail.c
src/tee.c
src/test.c
src/timeout.c
src/touch.c
src/tr.c
src/true.c
src/truncate.c
src/tsort.c
src/tty.c
src/uname.c

4
src/.gitignore vendored
View File

@@ -31,6 +31,7 @@ false
fmt
fold
fs.h
getlimits
ginstall
groups
head
@@ -39,6 +40,7 @@ hostname
id
join
kill
libver.a
link
ln
localedir.h
@@ -87,9 +89,11 @@ tac
tail
tee
test
timeout
touch
tr
true
truncate
tsort
tty
uname

View File

@@ -1,6 +1,6 @@
## Process this file with automake to produce Makefile.in -*-Makefile-*-
## Copyright (C) 1990, 1991, 1993-2008 Free Software Foundation, Inc.
## Copyright (C) 1990, 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
@@ -26,6 +26,8 @@ no_install__progs = \
build_if_possible__progs = \
chroot df hostid nice pinky stty su uname uptime users who
AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS)
EXTRA_PROGRAMS = \
$(no_install__progs) \
$(build_if_possible__progs) \
@@ -39,12 +41,12 @@ EXTRA_PROGRAMS = \
basename date dirname echo env expr factor false \
id kill logname pathchk printenv printf pwd \
runcon seq sleep tee \
test true tty whoami yes \
test timeout true truncate tty whoami yes \
base64
bin_PROGRAMS = $(OPTIONAL_BIN_PROGS)
noinst_PROGRAMS = setuidgid
noinst_PROGRAMS = setuidgid getlimits
noinst_HEADERS = \
chown-core.h \
@@ -54,6 +56,7 @@ noinst_HEADERS = \
fs.h \
group-list.h \
ls.h \
operand2sig.h \
prog-fprintf.h \
remove.h \
system.h \
@@ -68,12 +71,24 @@ CLEANFILES = $(SCRIPTS) su
AM_CPPFLAGS = -I$(top_srcdir)/lib
noinst_LIBRARIES = libver.a
nodist_libver_a_SOURCES = version.c version.h
# Sometimes, the expansion of $(LIBINTL) includes -lc which may
# include modules defining variables like `optind', so libcoreutils.a
# must precede $(LIBINTL) in order to ensure we use GNU getopt.
# But libcoreutils.a must also follow $(LIBINTL), since libintl uses
# replacement functions defined in libcoreutils.a.
LDADD = ../lib/libcoreutils.a $(LIBINTL) ../lib/libcoreutils.a
LDADD = libver.a ../lib/libcoreutils.a $(LIBINTL) ../lib/libcoreutils.a
cat_LDADD = $(LDADD)
df_LDADD = $(LDADD)
du_LDADD = $(LDADD)
getlimits_LDADD = $(LDADD)
ptx_LDADD = $(LDADD)
split_LDADD = $(LDADD)
timeout_LDADD = $(LDADD)
truncate_LDADD = $(LDADD)
# for eaccess in lib/euidaccess.c.
chcon_LDADD = $(LDADD) $(LIB_SELINUX)
@@ -92,15 +107,15 @@ __LDADD = $(LDADD) $(LIB_EACCESS)
# for clock_gettime and fdatasync
dd_LDADD = $(LDADD) $(LIB_GETHRXTIME) $(LIB_FDATASYNC)
dir_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME) $(LIB_SELINUX)
dir_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME) $(LIB_SELINUX) $(LIB_CAP)
id_LDADD = $(LDADD) $(LIB_SELINUX)
ls_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME) $(LIB_SELINUX)
ls_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME) $(LIB_SELINUX) $(LIB_CAP)
mktemp_LDADD = $(LDADD) $(LIB_GETHRXTIME)
pr_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME)
shred_LDADD = $(LDADD) $(LIB_GETHRXTIME) $(LIB_FDATASYNC)
shuf_LDADD = $(LDADD) $(LIB_GETHRXTIME)
tac_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME)
vdir_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME) $(LIB_SELINUX)
vdir_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME) $(LIB_SELINUX) $(LIB_CAP)
## If necessary, add -lm to resolve use of pow in lib/strtod.c.
sort_LDADD = $(LDADD) $(POW_LIB) $(LIB_GETHRXTIME)
@@ -120,6 +135,12 @@ seq_LDADD = $(LDADD) $(POW_LIB)
# and the `nanosleep' reference in lib/xnanosleep.c.
nanosec_libs = $(LDADD) $(POW_LIB) $(LIB_NANOSLEEP)
# for various GMP functions
expr_LDADD = $(LDADD) $(LIB_GMP)
# for various GMP functions
factor_LDADD = $(LDADD) $(LIB_GMP)
sleep_LDADD = $(nanosec_libs)
tail_LDADD = $(nanosec_libs)
@@ -131,12 +152,27 @@ su_LDADD = $(LDADD) $(LIB_CRYPT)
dir_LDADD += $(LIB_ACL)
ls_LDADD += $(LIB_ACL)
vdir_LDADD += $(LIB_ACL)
cp_LDADD += $(LIB_ACL)
mv_LDADD += $(LIB_ACL)
ginstall_LDADD += $(LIB_ACL)
cp_LDADD += $(LIB_ACL) $(LIB_XATTR)
mv_LDADD += $(LIB_ACL) $(LIB_XATTR)
ginstall_LDADD += $(LIB_ACL) $(LIB_XATTR)
stat_LDADD = $(LDADD) $(LIB_SELINUX)
# Append $(LIBICONV) to each program that uses proper_name_utf8.
cat_LDADD += $(LIBICONV)
cp_LDADD += $(LIBICONV)
df_LDADD += $(LIBICONV)
du_LDADD += $(LIBICONV)
getlimits_LDADD += $(LIBICONV)
ptx_LDADD += $(LIBICONV)
split_LDADD += $(LIBICONV)
timeout_LDADD += $(LIBICONV)
truncate_LDADD += $(LIBICONV)
# programs that use getaddrinfo (e.g., via canon_host)
pinky_LDADD = $(LDADD) $(GETADDRINFO_LIB)
who_LDADD = $(LDADD) $(GETADDRINFO_LIB)
$(PROGRAMS): ../lib/libcoreutils.a
# Get the release year from ../lib/version-etc.c.
@@ -204,7 +240,7 @@ copy_sources = copy.c cp-hash.c
# confusion with the `install' target. The install rule transforms `ginstall'
# to install before applying any user-specified name transformations.
transform = s/ginstall/install/; @program_transform_name@
transform = s/ginstall/install/; $(program_transform_name)
ginstall_SOURCES = install.c prog-fprintf.c $(copy_sources)
# This is for the '[' program. Automake transliterates '[' to '_'.
@@ -219,6 +255,8 @@ ln_SOURCES = ln.c
ls_SOURCES = ls.c ls-ls.c
chown_SOURCES = chown.c chown-core.c
chgrp_SOURCES = chgrp.c chown-core.c
kill_SOURCES = kill.c operand2sig.c
timeout_SOURCES = timeout.c operand2sig.c
mv_SOURCES = mv.c remove.c $(copy_sources)
rm_SOURCES = rm.c remove.c
@@ -242,6 +280,8 @@ sha384sum_CPPFLAGS = -DHASH_ALGO_SHA384=1 $(AM_CPPFLAGS)
sha512sum_SOURCES = md5sum.c
sha512sum_CPPFLAGS = -DHASH_ALGO_SHA512=1 $(AM_CPPFLAGS)
ginstall_CPPFLAGS = -DENABLE_MATCHPATHCON=1 $(AM_CPPFLAGS)
editpl = sed -e 's,@''PERL''@,$(PERL),g'
BUILT_SOURCES += dircolors.h
@@ -279,6 +319,22 @@ fs.h: stat.c extract-magic
@chmod a-w $@t
mv $@t $@
BUILT_SOURCES += version.c
version.c: Makefile
rm -f $@
printf '#include <config.h>\n' > $@t
printf 'char const *Version = "$(PACKAGE_VERSION)";\n' >> $@t
@chmod a-w $@t
mv $@t $@
BUILT_SOURCES += version.h
version.h: Makefile
rm -f $@
printf 'extern char const *Version;\n' > $@t
@chmod a-w $@t
mv $@t $@
DISTCLEANFILES = version.c version.h
MAINTAINERCLEANFILES = $(BUILT_SOURCES)
# Sort in traditional ASCII order, regardless of the current locale;
@@ -303,7 +359,7 @@ pm = progs-makefile
pr = progs-readme
# Ensure that the list of programs in README matches the list
# of programs we can build.
check: check-README check-misc check-duplicate-no-install
check: check-README check-duplicate-no-install
.PHONY: check-README
check-README:
rm -rf $(pr) $(pm)
@@ -326,8 +382,8 @@ au_dotdot = authors-dotdot
au_actual = authors-actual
.PHONY: check-AUTHORS
check-AUTHORS: $(all_programs)
rm -f $(au_actual) $(au_dotdot)
for i in `ls $(all_programs) | sed -e 's,$(EXEEXT)$$,,' \
@rm -f $(au_actual) $(au_dotdot)
@for i in `ls $(all_programs) | sed -e 's,$(EXEEXT)$$,,' \
| $(ASSORT) -u`; do \
test "$$i" = '[' && continue; \
exe=$$i; \
@@ -336,23 +392,12 @@ check-AUTHORS: $(all_programs)
elif test "$$i" = test; then \
exe='['; \
fi; \
./$$exe --version \
LC_ALL=en_US.UTF-8 ./$$exe --version \
| perl -0 -pi -e 's/,\n/, /gm' \
|sed -n '/Written by /{ s//'"$$i"': /; s/,* and /, /; s/\.$$//; p; }'; \
done > $(au_actual)
sed -n '/:/p' $(top_srcdir)/AUTHORS > $(au_dotdot)
diff $(au_actual) $(au_dotdot) && rm -f $(au_actual) $(au_dotdot)
# Make sure we don't define any S_IS* macros in src/*.c files.
# Not a big deal, but they're already defined via system.h.
#
# Also make sure we don't use st_blocks. Use ST_NBLOCKS instead.
# This is a bit of a kludge, since it prevents use of the string
# even in comments, but for now it does the job with no false positives.
.PHONY: check-misc
check-misc:
cd $(srcdir); grep '^# *define *S_IS' $(SOURCES) && exit 1 || :
cd $(srcdir); grep st_blocks $(SOURCES) && exit 1 || :
cd $(srcdir); grep '^# *define .*defined' $(SOURCES) && exit 1 || :
@sed -n '/^[^ ][^ ]*:/p' $(top_srcdir)/AUTHORS > $(au_dotdot)
@diff $(au_actual) $(au_dotdot) && rm -f $(au_actual) $(au_dotdot)
# Extract the list of authors from each file.
sed_filter = s/^ *//;s/N_ (//;s/^"//;s/")*$$//
@@ -360,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
( \
@@ -393,22 +437,35 @@ s2 = '/^\#define AUTHORS \\\\/{;n;$(sed_filter);p;q;}'
sc_tight_scope: $(all_programs)
@t=exceptions-$$$$; \
trap "s=$$?; rm -f $$t; exit $$s" 0 1 2 13 15; \
src=`for f in $(SOURCES); do \
test -f $$f && d= || d=$(srcdir)/; echo $$d$$f; done`; \
hdr=`for f in $(noinst_HEADERS); do \
test -f $$f && d= || d=$(srcdir)/; echo $$d$$f; done`; \
( printf 'main\nusage\n'; \
grep -h -A1 '^extern .*[^;]$$' $(SOURCES) \
grep -h -A1 '^extern .*[^;]$$' $$src \
| grep -vE '^(extern |--)' | sed 's/ .*//'; \
perl -ne '/^extern \S+ (\S*) \(/ and print "$$1\n"' \
$(noinst_HEADERS); \
perl -ne '/^extern \S+ (\S*) \(/ and print "$$1\n"' $$hdr; \
) | $(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; } || : ; \
( printf '^program_name$$\n'; \
sed -n 's/^extern int \([^ ][^ ]*\);$$/^\1$$/p' \
$(noinst_HEADERS) ) > $$t; \
perl -ne '/^extern .*?\**(\w+);/ and print "^$$1\$$\n"' \
$$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; } || :
# Use the just-built ./ginstall, when not cross-compiling.
if CROSS_COMPILING
cu_install_program = @INSTALL_PROGRAM@
else
cu_install_program = ./ginstall
endif
INSTALL_PROGRAM = $(cu_install_program)

View File

@@ -1,5 +1,5 @@
/* Base64 encode/decode strings or files.
Copyright (C) 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
Copyright (C) 2004-2008 Free Software Foundation, Inc.
This file is part of Base64.
@@ -35,24 +35,20 @@
/* The official name of this program (e.g., no `g' prefix). */
#define PROGRAM_NAME "base64"
#define AUTHOR "Simon Josefsson"
#define AUTHORS proper_name ("Simon Josefsson")
/* The invocation name of this program. */
char *program_name;
static const struct option long_options[] = {
static struct option const long_options[] =
{
{"decode", no_argument, 0, 'd'},
{"wrap", required_argument, 0, 'w'},
{"ignore-garbage", no_argument, 0, 'i'},
{"help", no_argument, 0, GETOPT_HELP_CHAR},
{"version", no_argument, 0, GETOPT_VERSION_CHAR},
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
{NULL, 0, NULL, 0}
};
static void
void
usage (int status)
{
if (status != EXIT_SUCCESS)
@@ -61,7 +57,7 @@ usage (int status)
else
{
printf (_("\
Usage: %s [OPTION] [FILE]\n\
Usage: %s [OPTION]... [FILE]\n\
Base64 encode or decode FILE, or standard input, to standard output.\n\
\n"), program_name);
fputs (_("\
@@ -218,12 +214,12 @@ do_decode (FILE *in, FILE *out, bool ignore_garbage)
However, when it processes the final input buffer, we want
to iterate it one additional time, but with an indicator
telling it to flush what is in CTX. */
for (k = 0; k < 1 + feof (in); k++)
for (k = 0; k < 1 + !!feof (in); k++)
{
if (k == 1 && ctx.i == 0)
break;
n = BLOCKSIZE;
ok = base64_decode (&ctx, inbuf, (k == 0 ? sum : 0), outbuf, &n);
ok = base64_decode_ctx (&ctx, inbuf, (k == 0 ? sum : 0), outbuf, &n);
if (fwrite (outbuf, 1, n, out) < n)
error (EXIT_FAILURE, errno, _("write error"));
@@ -242,22 +238,22 @@ main (int argc, char **argv)
FILE *input_fh;
const char *infile;
/* True if --decode has bene given and we should decode data. */
/* True if --decode has been given and we should decode data. */
bool decode = false;
/* True if we should ignore non-alphabetic characters. */
/* True if we should ignore non-base64-alphabetic characters. */
bool ignore_garbage = false;
/* Wrap encoded base64 data around the 76:th column, by default. */
uintmax_t wrap_column = 76;
initialize_main (&argc, &argv);
program_name = argv[0];
set_program_name (argv[0]);
setlocale (LC_ALL, "");
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
atexit (close_stdout);
while ((opt = getopt_long (argc, argv, "dqiw:", long_options, NULL)) != -1)
while ((opt = getopt_long (argc, argv, "diw:", long_options, NULL)) != -1)
switch (opt)
{
case 'd':
@@ -276,7 +272,7 @@ main (int argc, char **argv)
case_GETOPT_HELP_CHAR;
case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHOR);
case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
default:
usage (EXIT_FAILURE);

View File

@@ -1,5 +1,5 @@
/* basename -- strip directory and suffix from file names
Copyright (C) 1990-1997, 1999-2007 Free Software Foundation, Inc.
Copyright (C) 1990-1997, 1999-2008 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
@@ -37,10 +37,7 @@
/* The official name of this program (e.g., no `g' prefix). */
#define PROGRAM_NAME "basename"
#define AUTHORS "FIXME unknown"
/* The name this program was run with. */
char *program_name;
#define AUTHORS proper_name ("David MacKenzie")
void
usage (int status)
@@ -99,14 +96,14 @@ main (int argc, char **argv)
char *name;
initialize_main (&argc, &argv);
program_name = argv[0];
set_program_name (argv[0]);
setlocale (LC_ALL, "");
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
atexit (close_stdout);
parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE_NAME, VERSION,
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);

View File

@@ -1,25 +1,7 @@
--- src/id.c 2008-03-04 18:50:55.000000000 +0100
+++ src/id.c 2008-03-04 19:32:24.000000000 +0100
@@ -196,6 +196,7 @@ of a different user"));
error (EXIT_FAILURE, 0,
_("cannot print only names or real IDs in default format"));
+ {
char const *user_name;
if (argc - optind == 1)
{
@@ -239,6 +240,7 @@ of a different user"));
{
print_full_info (user_name);
}
+ }
putchar ('\n');
exit (ok ? EXIT_SUCCESS : EXIT_FAILURE);
diff -upr src/remove.c src/remove.c
--- src/remove.c 2007-07-23 12:56:20.000000000 +0200
+++ src/remove.c 2007-07-23 13:03:12.000000000 +0200
@@ -264,9 +264,10 @@ pop_dir (Dirstack_state *ds)
--- src/remove.c 1970-01-01 00:00:00.000000000 +0000
+++ src/remove.c 1970-01-01 00:00:00.000000000 +0000
@@ -262,9 +262,10 @@ pop_dir (Dirstack_state *ds)
{
size_t n_lengths = obstack_object_size (&ds->len_stack) / sizeof (size_t);
size_t *length = obstack_base (&ds->len_stack);
@@ -31,7 +13,7 @@ diff -upr src/remove.c src/remove.c
assert (top_len >= 2);
/* Pop the specified length of file name. */
@@ -424,10 +425,11 @@ AD_stack_top (Dirstack_state const *ds)
@@ -422,10 +423,11 @@ AD_stack_top (Dirstack_state const *ds)
static void
AD_stack_pop (Dirstack_state *ds)
{
@@ -44,7 +26,7 @@ diff -upr src/remove.c src/remove.c
if (top->unremovable)
hash_free (top->unremovable);
obstack_blank (&ds->Active_dir, -(int) sizeof (struct AD_ent));
@@ -836,14 +838,13 @@ prompt (int fd_cwd, Dirstack_state const
@@ -834,14 +836,13 @@ prompt (int fd_cwd, Dirstack_state const
{
int write_protected = 0;
int dirent_type = *pdirent_type;
@@ -60,7 +42,7 @@ diff -upr src/remove.c src/remove.c
if (!x->ignore_missing_files
&& ((x->interactive == RMI_ALWAYS) || x->stdin_tty)
&& dirent_type != DT_LNK)
@@ -891,6 +892,7 @@ prompt (int fd_cwd, Dirstack_state const
@@ -889,6 +890,7 @@ prompt (int fd_cwd, Dirstack_state const
break;
}
@@ -68,7 +50,7 @@ diff -upr src/remove.c src/remove.c
char const *quoted_name = quote (full_filename (filename));
if (write_protected < 0)
@@ -930,6 +932,7 @@ prompt (int fd_cwd, Dirstack_state const
@@ -928,6 +930,7 @@ prompt (int fd_cwd, Dirstack_state const
: _("%s: remove %s %s? ")),
program_name, file_type (sbuf), quoted_name);
}
@@ -76,7 +58,7 @@ diff -upr src/remove.c src/remove.c
if (!yesno ())
return RM_USER_DECLINED;
@@ -1549,6 +1552,7 @@ rm_1 (Dirstack_state *ds, char const *fi
@@ -1547,6 +1550,7 @@ rm_1 (Dirstack_state *ds, char const *fi
return RM_ERROR;
}
@@ -84,7 +66,7 @@ diff -upr src/remove.c src/remove.c
struct stat st;
cache_stat_init (&st);
cycle_check_init (&ds->cycle_check_state);
@@ -1571,6 +1575,7 @@ rm_1 (Dirstack_state *ds, char const *fi
@@ -1569,6 +1573,7 @@ rm_1 (Dirstack_state *ds, char const *fi
AD_push_initial (ds);
AD_INIT_OTHER_MEMBERS ();
@@ -92,7 +74,7 @@ diff -upr src/remove.c src/remove.c
enum RM_status status = remove_entry (AT_FDCWD, ds, filename,
DT_UNKNOWN, &st, x);
if (status == RM_NONEMPTY_DIR)
@@ -1589,6 +1594,8 @@ rm_1 (Dirstack_state *ds, char const *fi
@@ -1587,6 +1592,8 @@ rm_1 (Dirstack_state *ds, char const *fi
ds_clear (ds);
return status;
}
@@ -102,8 +84,8 @@ diff -upr src/remove.c src/remove.c
/* Remove all files and/or directories specified by N_FILES and FILE.
Apply the options in X. */
diff -upr src/rm.c src/rm.c
--- src/rm.c 2007-07-23 12:56:20.000000000 +0200
+++ src/rm.c 2007-07-23 13:03:12.000000000 +0200
--- src/rm.c 1970-01-01 00:00:00.000000000 +0000
+++ src/rm.c 1970-01-01 00:00:00.000000000 +0000
@@ -354,6 +354,7 @@ main (int argc, char **argv)
quote ("/"));
}
@@ -124,9 +106,9 @@ diff -upr src/rm.c src/rm.c
+ }
}
diff -upr src/seq.c src/seq.c
--- src/seq.c 2008-04-14 11:17:15.000000000 +0200
+++ src/seq.c 2008-04-14 11:26:57.000000000 +0200
@@ -166,6 +166,7 @@ scan_arg (const char *arg)
--- src/seq.c 1970-01-01 00:00:00.000000000 +0000
+++ src/seq.c 1970-01-01 00:00:00.000000000 +0000
@@ -163,6 +163,7 @@ scan_arg (const char *arg)
: (decimal_point == arg /* .# -> 0.# */
|| ! ISDIGIT (decimal_point[-1]))); /* -.# -> 0.# */
}
@@ -134,7 +116,7 @@ diff -upr src/seq.c src/seq.c
char const *e = strchr (arg, 'e');
if (! e)
e = strchr (arg, 'E');
@@ -174,6 +175,7 @@ scan_arg (const char *arg)
@@ -171,6 +172,7 @@ scan_arg (const char *arg)
long exponent = strtol (e + 1, NULL, 10);
ret.precision += exponent < 0 ? -exponent : 0;
}
@@ -142,7 +124,7 @@ diff -upr src/seq.c src/seq.c
}
return ret;
@@ -349,6 +351,7 @@ get_default_format (operand first, opera
@@ -346,6 +348,7 @@ get_default_format (operand first, opera
size_t last_width = last.width + (prec - last.precision);
if (last.precision && prec == 0)
last_width--; /* don't include space for '.' */
@@ -150,7 +132,7 @@ diff -upr src/seq.c src/seq.c
size_t width = MAX (first_width, last_width);
if (width <= INT_MAX)
{
@@ -356,6 +359,7 @@ get_default_format (operand first, opera
@@ -353,6 +356,7 @@ get_default_format (operand first, opera
sprintf (format_buf, "%%0%d.%dLf", w, prec);
return format_buf;
}
@@ -158,7 +140,7 @@ diff -upr src/seq.c src/seq.c
}
else
{
@@ -444,6 +448,7 @@ main (int argc, char **argv)
@@ -441,6 +445,7 @@ main (int argc, char **argv)
if (format_str)
{
validate_format (format_str);
@@ -166,7 +148,7 @@ diff -upr src/seq.c src/seq.c
char const *f = long_double_format (format_str, &layout);
if (! f)
{
@@ -451,6 +456,7 @@ main (int argc, char **argv)
@@ -448,6 +453,7 @@ main (int argc, char **argv)
usage (EXIT_FAILURE);
}
format_str = f;
@@ -175,9 +157,9 @@ diff -upr src/seq.c src/seq.c
last = scan_arg (argv[optind++]);
diff -upr src/shred.c src/shred.c
--- src/shred.c 2007-07-23 12:56:20.000000000 +0200
+++ src/shred.c 2007-07-23 13:03:12.000000000 +0200
@@ -461,7 +461,7 @@ dopass (int fd, char const *qname, off_t
--- src/shred.c 1970-01-01 00:00:00.000000000 +0000
+++ src/shred.c 1970-01-01 00:00:00.000000000 +0000
@@ -468,7 +468,7 @@ dopass (int fd, char const *qname, off_t
out. Thus, it shouldn't give up on bad blocks. This
code works because lim is always a multiple of
SECTOR_SIZE, except at the end. */

View File

@@ -1,5 +1,5 @@
/* cat -- concatenate files and print on the standard output.
Copyright (C) 88, 90, 91, 1995-2007 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
@@ -39,18 +39,14 @@
#include "full-write.h"
#include "quote.h"
#include "safe-read.h"
#include "xfreopen.h"
/* The official name of this program (e.g., no `g' prefix). */
#define PROGRAM_NAME "cat"
#define AUTHORS "Torbjorn Granlund", "Richard M. Stallman"
/* Undefine, to avoid warning about redefinition on some systems. */
#undef max
#define max(h,i) ((h) > (i) ? (h) : (i))
/* Name under which this program was invoked. */
char *program_name;
#define AUTHORS \
proper_name_utf8 ("Torbjorn Granlund", "Torbj\303\266rn Granlund"), \
proper_name ("Richard M. Stallman")
/* Name of input file. May be "-". */
static char const *infile;
@@ -91,7 +87,7 @@ usage (int status)
else
{
printf (_("\
Usage: %s [OPTION] [FILE]...\n\
Usage: %s [OPTION]... [FILE]...\n\
"),
program_name);
fputs (_("\
@@ -337,7 +333,7 @@ cat (
input_pending = true;
#endif
if (input_pending)
if (!input_pending)
write_pending (outbuf, &bpout);
/* Read more input into INBUF. */
@@ -563,7 +559,7 @@ main (int argc, char **argv)
};
initialize_main (&argc, &argv);
program_name = argv[0];
set_program_name (argv[0]);
setlocale (LC_ALL, "");
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
@@ -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,
@@ -665,7 +661,7 @@ main (int argc, char **argv)
{
file_open_mode |= O_BINARY;
if (O_BINARY && ! isatty (STDOUT_FILENO))
freopen (NULL, "wb", stdout);
xfreopen (NULL, "wb", stdout);
}
/* Check if any of the input files are the same as the output file. */
@@ -685,7 +681,7 @@ main (int argc, char **argv)
have_read_stdin = true;
input_desc = STDIN_FILENO;
if ((file_open_mode & O_BINARY) && ! isatty (STDIN_FILENO))
freopen (NULL, "rb", stdin);
xfreopen (NULL, "rb", stdin);
}
else
{
@@ -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

@@ -31,30 +31,9 @@
/* The official name of this program (e.g., no `g' prefix). */
#define PROGRAM_NAME "chcon"
#define AUTHORS "Russell Coker", "Jim Meyering"
enum Change_status
{
CH_NOT_APPLIED,
CH_SUCCEEDED,
CH_FAILED,
CH_NO_CHANGE_REQUESTED
};
enum Verbosity
{
/* Print a message for each file that is processed. */
V_high,
/* Print a message for each file whose attributes we change. */
V_changes_only,
/* Do not be verbose. This is the default. */
V_off
};
/* The name the program was run with. */
char *program_name;
#define AUTHORS \
proper_name ("Russell Coker"), \
proper_name ("Jim Meyering")
/* If nonzero, and the systems has support for it, change the context
of symbolic links rather than any files they point to. */
@@ -301,7 +280,7 @@ process_file (FTS *fts, FTSENT *ent)
if (ok)
{
if (verbose)
printf (_("changing security context of %s"),
printf (_("changing security context of %s\n"),
quote (file_full_name));
if (change_file_context (fts->fts_cwd_fd, file) != 0)
@@ -370,7 +349,6 @@ Usage: %s [OPTION]... CONTEXT FILE...\n\
Change the security context of each FILE to CONTEXT.\n\
With --reference, change the security context of each FILE to that of RFILE.\n\
\n\
-c, --changes like verbose but report only when a change is made\n\
-h, --no-dereference affect symbolic links instead of any referenced file\n\
"), stdout);
fputs (_("\
@@ -400,6 +378,7 @@ one takes effect.\n\
"), stdout);
fputs (HELP_OPTION_DESCRIPTION, stdout);
fputs (VERSION_OPTION_DESCRIPTION, stdout);
emit_bug_reporting_address ();
}
exit (status);
}
@@ -423,14 +402,14 @@ main (int argc, char **argv)
int optc;
initialize_main (&argc, &argv);
program_name = argv[0];
set_program_name (argv[0]);
setlocale (LC_ALL, "");
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
atexit (close_stdout);
while ((optc = getopt_long (argc, argv, "HLPRchvu:r:t:l:", long_options, NULL))
while ((optc = getopt_long (argc, argv, "HLPRhvu:r:t:l:", long_options, NULL))
!= -1)
{
switch (optc)

View File

@@ -1,5 +1,5 @@
/* chgrp -- change group ownership of files
Copyright (C) 89, 90, 91, 1995-2007 Free Software Foundation, Inc.
Copyright (C) 89, 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
@@ -34,15 +34,14 @@
/* The official name of this program (e.g., no `g' prefix). */
#define PROGRAM_NAME "chgrp"
#define AUTHORS "David MacKenzie", "Jim Meyering"
#define AUTHORS \
proper_name ("David MacKenzie"), \
proper_name ("Jim Meyering")
#if ! HAVE_ENDGRENT
# define endgrent() ((void) 0)
#endif
/* The name the program was run with. */
char *program_name;
/* The argument to the --reference option. Use the group ID of this file.
This file must exist. */
static char *reference_file;
@@ -182,7 +181,7 @@ main (int argc, char **argv)
int optc;
initialize_main (&argc, &argv);
program_name = argv[0];
set_program_name (argv[0]);
setlocale (LC_ALL, "");
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
@@ -303,6 +302,7 @@ main (int argc, char **argv)
quote ("/"));
}
bit_flags |= FTS_DEFER_STAT;
ok = chown_files (argv + optind, bit_flags,
(uid_t) -1, gid,
(uid_t) -1, (gid_t) -1, &chopt);

View File

@@ -1,5 +1,5 @@
/* chmod -- change permission modes of files
Copyright (C) 89, 90, 91, 1995-2008 Free Software Foundation, Inc.
Copyright (C) 89, 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
@@ -34,7 +34,9 @@
/* The official name of this program (e.g., no `g' prefix). */
#define PROGRAM_NAME "chmod"
#define AUTHORS "David MacKenzie", "Jim Meyering"
#define AUTHORS \
proper_name ("David MacKenzie"), \
proper_name ("Jim Meyering")
enum Change_status
{
@@ -56,9 +58,6 @@ enum Verbosity
V_off
};
/* The name the program was run with. */
char *program_name;
/* The desired change to the mode. */
static struct mode_change *change;
@@ -68,7 +67,7 @@ static mode_t umask_value;
/* If true, change the modes of directories recursively. */
static bool recurse;
/* If true, force silence (no error messages). */
/* If true, force silence (suppress most of error messages). */
static bool force_silent;
/* If true, diagnose surprises from naive misuses like "chmod -r file".
@@ -122,7 +121,7 @@ mode_changed (char const *file, mode_t old_mode, mode_t new_mode)
if (stat (file, &new_stats) != 0)
{
if (!force_silent)
if (! force_silent)
error (0, errno, _("getting new attributes of %s"), quote (file));
return false;
}
@@ -204,24 +203,29 @@ process_file (FTS *fts, FTSENT *ent)
fts_set (fts, ent, FTS_AGAIN);
return true;
}
error (0, ent->fts_errno, _("cannot access %s"), quote (file_full_name));
if (! force_silent)
error (0, ent->fts_errno, _("cannot access %s"),
quote (file_full_name));
ok = false;
break;
case FTS_ERR:
error (0, ent->fts_errno, _("%s"), quote (file_full_name));
if (! force_silent)
error (0, ent->fts_errno, _("%s"), quote (file_full_name));
ok = false;
break;
case FTS_DNR:
error (0, ent->fts_errno, _("cannot read directory %s"),
quote (file_full_name));
if (! force_silent)
error (0, ent->fts_errno, _("cannot read directory %s"),
quote (file_full_name));
ok = false;
break;
case FTS_SLNONE:
error (0, 0, _("cannot operate on dangling symlink %s"),
quote (file_full_name));
if (! force_silent)
error (0, 0, _("cannot operate on dangling symlink %s"),
quote (file_full_name));
ok = false;
default:
@@ -320,7 +324,8 @@ process_files (char **files, int bit_flags)
if (errno != 0)
{
/* FIXME: try to give a better message */
error (0, errno, _("fts_read failed"));
if (! force_silent)
error (0, errno, _("fts_read failed"));
ok = false;
}
break;
@@ -392,7 +397,7 @@ main (int argc, char **argv)
int c;
initialize_main (&argc, &argv);
program_name = argv[0];
set_program_name (argv[0]);
setlocale (LC_ALL, "");
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
@@ -529,7 +534,8 @@ main (int argc, char **argv)
root_dev_ino = NULL;
}
ok = process_files (argv + optind, FTS_COMFOLLOW | FTS_PHYSICAL);
ok = process_files (argv + optind,
FTS_COMFOLLOW | FTS_PHYSICAL | FTS_DEFER_STAT);
exit (ok ? EXIT_SUCCESS : EXIT_FAILURE);
}

View File

@@ -25,7 +25,6 @@
#include "system.h"
#include "chown-core.h"
#include "error.h"
#include "inttostr.h"
#include "quote.h"
#include "root-dev-ino.h"
#include "xfts.h"
@@ -297,18 +296,22 @@ change_file_owner (FTS *fts, FTSENT *ent,
fts_set (fts, ent, FTS_AGAIN);
return true;
}
error (0, ent->fts_errno, _("cannot access %s"), quote (file_full_name));
if (! chopt->force_silent)
error (0, ent->fts_errno, _("cannot access %s"),
quote (file_full_name));
ok = false;
break;
case FTS_ERR:
error (0, ent->fts_errno, _("%s"), quote (file_full_name));
if (! chopt->force_silent)
error (0, ent->fts_errno, _("%s"), quote (file_full_name));
ok = false;
break;
case FTS_DNR:
error (0, ent->fts_errno, _("cannot read directory %s"),
quote (file_full_name));
if (! chopt->force_silent)
error (0, ent->fts_errno, _("cannot read directory %s"),
quote (file_full_name));
ok = false;
break;
@@ -339,8 +342,9 @@ change_file_owner (FTS *fts, FTSENT *ent,
{
if (fstatat (fts->fts_cwd_fd, file, &stat_buf, 0) != 0)
{
error (0, errno, _("cannot dereference %s"),
quote (file_full_name));
if (! chopt->force_silent)
error (0, errno, _("cannot dereference %s"),
quote (file_full_name));
ok = false;
}
@@ -493,7 +497,8 @@ chown_files (char **files, int bit_flags,
if (errno != 0)
{
/* FIXME: try to give a better message */
error (0, errno, _("fts_read failed"));
if (! chopt->force_silent)
error (0, errno, _("fts_read failed"));
ok = false;
}
break;

View File

@@ -1,5 +1,5 @@
/* chown -- change user and group ownership of files
Copyright (C) 89, 90, 91, 1995-2007 Free Software Foundation, Inc.
Copyright (C) 89, 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
@@ -43,10 +43,9 @@
/* The official name of this program (e.g., no `g' prefix). */
#define PROGRAM_NAME "chown"
#define AUTHORS "David MacKenzie", "Jim Meyering"
/* The name the program was run with. */
char *program_name;
#define AUTHORS \
proper_name ("David MacKenzie"), \
proper_name ("Jim Meyering")
/* The argument to the --reference option. Use the owner and group IDs
of this file. This file must exist. */
@@ -184,7 +183,7 @@ main (int argc, char **argv)
int optc;
initialize_main (&argc, &argv);
program_name = argv[0];
set_program_name (argv[0]);
setlocale (LC_ALL, "");
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
@@ -313,7 +312,7 @@ main (int argc, char **argv)
empty string so that diagnostics say "ownership :GROUP"
rather than "group GROUP". */
if (!chopt.user_name && chopt.group_name)
chopt.user_name = "";
chopt.user_name = bad_cast ("");
optind++;
}
@@ -327,6 +326,7 @@ main (int argc, char **argv)
quote ("/"));
}
bit_flags |= FTS_DEFER_STAT;
ok = chown_files (argv + optind, bit_flags,
uid, gid,
required_uid, required_gid, &chopt);

View File

@@ -1,5 +1,6 @@
/* chroot -- run command or shell with special root directory
Copyright (C) 95, 96, 1997, 1999-2004, 2007 Free Software Foundation, Inc.
Copyright (C) 95, 96, 1997, 1999-2004, 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,10 +30,7 @@
/* The official name of this program (e.g., no `g' prefix). */
#define PROGRAM_NAME "chroot"
#define AUTHORS "Roland McGrath"
/* The name this program was run with, for error messages. */
char *program_name;
#define AUTHORS proper_name ("Roland McGrath")
void
usage (int status)
@@ -43,7 +41,7 @@ usage (int status)
else
{
printf (_("\
Usage: %s NEWROOT [COMMAND...]\n\
Usage: %s NEWROOT [COMMAND [ARG]...]\n\
or: %s OPTION\n\
"), program_name, program_name);
fputs (_("\
@@ -65,7 +63,7 @@ int
main (int argc, char **argv)
{
initialize_main (&argc, &argv);
program_name = argv[0];
set_program_name (argv[0]);
setlocale (LC_ALL, "");
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
@@ -73,7 +71,7 @@ main (int argc, char **argv)
initialize_exit_failure (EXIT_FAILURE);
atexit (close_stdout);
parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE_NAME, VERSION,
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);
@@ -85,7 +83,8 @@ main (int argc, char **argv)
}
if (chroot (argv[optind]) != 0)
error (EXIT_FAILURE, errno, _("cannot change root directory to %s"), argv[1]);
error (EXIT_FAILURE, errno, _("cannot change root directory to %s"),
argv[optind]);
if (chdir ("/"))
error (EXIT_FAILURE, errno, _("cannot chdir to root directory"));
@@ -95,9 +94,9 @@ main (int argc, char **argv)
/* No command. Run an interactive shell. */
char *shell = getenv ("SHELL");
if (shell == NULL)
shell = "/bin/sh";
shell = bad_cast ("/bin/sh");
argv[0] = shell;
argv[1] = "-i";
argv[1] = bad_cast ("-i");
argv[2] = NULL;
}
else

View File

@@ -1,5 +1,5 @@
/* cksum -- calculate and print POSIX checksums and sizes of files
Copyright (C) 92, 1995-2006 Free Software Foundation, Inc.
Copyright (C) 92, 1995-2006, 2008 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
@@ -37,12 +37,13 @@
/* The official name of this program (e.g., no `g' prefix). */
#define PROGRAM_NAME "cksum"
#define AUTHORS "Q. Frank Xia"
#define AUTHORS proper_name ("Q. Frank Xia")
#include <stdio.h>
#include <sys/types.h>
#include <stdint.h>
#include "system.h"
#include "xfreopen.h"
#ifdef CRCTAB
@@ -108,14 +109,10 @@ main (void)
# include <getopt.h>
# include "long-options.h"
# include "error.h"
# include "inttostr.h"
/* Number of bytes to read at once. */
# define BUFLEN (1 << 16)
/* The name this program was run with. */
char *program_name;
static uint_fast32_t const crctab[256] =
{
0x00000000,
@@ -196,7 +193,7 @@ cksum (const char *file, bool print_name)
fp = stdin;
have_read_stdin = true;
if (O_BINARY && ! isatty (STDIN_FILENO))
freopen (NULL, "rb", stdin);
xfreopen (NULL, "rb", stdin);
}
else
{
@@ -284,14 +281,14 @@ main (int argc, char **argv)
bool ok;
initialize_main (&argc, &argv);
program_name = argv[0];
set_program_name (argv[0]);
setlocale (LC_ALL, "");
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
atexit (close_stdout);
parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE, VERSION,
parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE, Version,
usage, AUTHORS, (char const *) NULL);
if (getopt_long (argc, argv, "", NULL, NULL) != -1)
usage (EXIT_FAILURE);

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