Compare commits

...

1278 Commits
v8.8 ... v8.22

Author SHA1 Message Date
Pádraig Brady
3384461026 version 8.22
* NEWS: Record release date.
2013-12-13 15:03:45 +00:00
Pádraig Brady
ee7512cf00 stat,tail: improve support for hostfs and smackfs
hostfs is provided by the Linux UML subsystem.
smackfs is provided by the Linux Smack security module.

* src/stat.c (human_fstype): Add new file system ID definitions.
* NEWS: Mention the improvement, and adjust for the fact that
SNFS is a remote file system.
2013-12-13 14:05:53 +00:00
Pádraig Brady
41e9a094ad tests: avoid unlikely deadlock in dd/no-allocate on some shells
* test/dd/no-allocate.sh: Use 'wait' to ensure we don't have
multiple writers to the fifo, which was seen to trigger
a very hard to reproduce deadlock with make -j20 on solaris.
Also avoid writing to the fifo with the shell; instead using dd.
(check_dd_seek_alloc): A new function refactored from the various
cases, which are now constructed from function parameters.
2013-12-13 02:29:03 +00:00
Pádraig Brady
10ffe43d68 tests: restrict cp --link inode comparisons to compatible systems
* tests/cp/link-deref.sh: On systems were cp can't determine if
gnulib linkat() emulation might create a symlink instead of a hardlink
to a symlink, copy.c will create a symlink to the symlink so that
it has more control over its metadata.  Also even if the system
supports this operation, the particular file system under test may not.
So avoid the hardlinked symlink verification in these cases.
This fixes a false failure on aix, solaris and freebsd.
2013-12-13 02:28:47 +00:00
Pádraig Brady
cbdb4d77d9 build: default to avoiding openssl system libraries
* configure.ac: Don't change the gnulib default of 'no' for
whether to link with openssl system libraries if available.
Distributions can explicitly enable this as their policy allows.
* NEWS: Adjust accordingly.
2013-12-13 02:28:11 +00:00
Tiger Lee
bf52066b96 doc: fix typo in numfmt invocation
* doc/coreutils.texi (numfmt invocation): s/nun/num/.
Fixes http://bugs.gnu.org/16122
2013-12-12 16:59:36 +00:00
Pádraig Brady
77a24724f6 tests: df/total-unprocessed: fix false failure with lofs
* tests/df/total-unprocessed.sh: Skip the test when we can't
determine the file system type as the exclusion filter is not
applied in that case.  "lofs" being ignored is effectively
an unknown file system type.
2013-12-11 14:15:33 +00:00
Pádraig Brady
b95aac3180 tests: avoid warnings due to new filefrag -v format
* tests/cp/sparse-fiemap.sh: Newer versions of filefrag output
more fields, in different orders, so handle that to avoid warnings.
2013-12-11 04:42:59 +00:00
Pádraig Brady
b9bb1b58fe build: update gnulib to fix a tests build failure
* gnulib: Update to incorporate a fix for building tests
with -Werror=old-style-declaration
2013-12-09 14:28:03 +00:00
Pádraig Brady
b6d1e842c1 tests: fix false failure due to xargs usage
* tests/readlink/multi.sh: Ensure there is a trailing delimeter
or xargs may (on AIX 7 at least) suppress the last argument.
2013-12-09 13:37:21 +00:00
Pádraig Brady
b1fb185db8 tests: fix false failure on systems without /dev/stdin
* tests/rm/interactive-once.sh: Ensure the expected output
matches with the output on systems without /dev/stdin (like AIX 7).
Also change some fail=1 to a more appropriate framework_failure_.
2013-12-09 13:14:38 +00:00
Pádraig Brady
4f63f275a3 build: update gnulib and improve --with-openssl configure help
* configure.ac: Use gl_SET_CRYPTO_CHECK_DEFAULT() to set the
coreutils default for --with-openssl early, so that the
help text can be provided in a standard and complete form.
* gnulib: Update to incorporate a build fix on platforms
with only some of md5 and sha* implemented by libcrypto.
2013-12-09 12:51:34 +00:00
Pádraig Brady
042780801c tests: fix false failure due to gdb inline function handling
Inline functions are awkward to breakpoint as mentioned at:
https://sourceware.org/bugzilla/show_bug.cgi?id=10738
The normal case here was for the breakpoint on the inline function
to fail, resulting in a 10s delay before skipping the test.
However on GCC 4.7.2 on ppc64 at least it was seen that
the test failed erroneously due to the breakpoint being successfully
set on an "out of line" function, but an inline function was
actually being called.

* tests/tail-2/inotify-race.sh: Switch to a line based breakpoint,
rather than a symbol base one, which avoids issues with breakpoints
on inline functions.  Also skip_ on the initial breakpoint check
in case the breakpoint is not traversed which would be the case
on remote file systems for example.
2013-12-09 09:28:29 +00:00
Pádraig Brady
402e8ecbc4 tail: use consistent diagnostics with and without inotify
* src/tail.c: With inotify, when a file is initially absent,
we fstat(-1) for that file spec, thus recording an errnum of EBADF,
which caused the "has become accessible" diagnostic to be issued,
when the file first appears.  Instead we avoid the fstat(-1) and
thus emit the more natural and consistent "has appeared" diagnostic.
* tests/tail-2/retry.sh: Use the new diagnostic which also causes
this test to pass on systems without inotify.
2013-12-09 09:26:17 +00:00
Bernhard Voelker
4a6189a0ea tests: avoid false df failure with nfs and lofs
* tests/df/total-unprocessed.sh: -t nfs and --local are
_not_ mutually exclusive on solaris, with lofs mounts.
2013-12-09 09:24:24 +00:00
Pádraig Brady
0917c0c345 tests: avoid problematic $(< file) shell construct
* tests/cp/link-deref.sh: This was seen to cause an issue
with dash v0.5.6 at least, so change to a simpler expression.
2013-12-07 19:41:55 +00:00
Pádraig Brady
970b2ddea2 tests: fix false failure on platforms using newfstatat
* tests/ls/stat-free-color.sh: Add newfstatat to the list
of syscalls to trace.  Also add all "stat" syscalls to the
list of syscalls that we verify that strace supports.
Also only create a single dangling symlink to check, since
we already only check for a single "stat" call.
Fixes http://bugs.gnu.org/16075 seen on AArch64
2013-12-07 19:29:01 +00:00
Pádraig Brady
47a977ca99 tests: avoid a false memory leak test failure
* tests/misc/shuf-reservoir.sh: Restrict the valgrind
"exit on leak" behavior to developer environments where
specific "lint" code is enabled to avoid inconsequential leaks.
2013-12-07 19:12:55 +00:00
Bernhard Voelker
b4f5dca24f tests: fix shuf test verifying that -i and -e can not be combined
Previously, the test triggered another error diagnostic:
  shuf: invalid input range ‘-e’
and therefore eclipsed the expected one:
  shuf: cannot combine -e and -i options

While at it, reindent a line with more than 80 characters, present
since the previous commit to silence sc_long_lines.

* tests/misc/shuf.sh: Pass a valid range to the -i option.
2013-12-06 20:24:38 +01:00
Paul Eggert
e1b753b3e3 shuf: --repeat, not --repetitions; default --head-count is infinity
Original problem reported by Philipp Thomas in
<http://bugs.gnu.org/16061>.
* NEWS: shuf --repeat, not shuf --repetitions.
* doc/coreutils.texi (shuf invocation):
* src/shuf.c (usage, long_opts, main):
* tests/misc/shuf.sh:
Likewise.  Also, the default head-count is infinity.
2013-12-06 09:55:55 -08:00
Bernhard Voelker
34582a1aed doc: clarify that df now generally processes special files correctly
Since v8.21-172-g33660b4, df not only treats symbolic link arguments
differently, as stated there, but now generally processes special file
arguments in a non-canonicalized form correctly:

  $ cd /dev && df-old sdb
  Filesystem     1K-blocks  Used Available Use% Mounted on
  devtmpfs         1014572    48   1014524   1% /dev

  $ cd /dev && df-new sdb
  Filesystem     1K-blocks    Used Available Use% Mounted on
  /dev/sdb        10190136 6039532   3609932  63% /home

Document df's new behavior.

* doc/coreutils.texi (df invocation): In the paragraph describing
df's behavior regarding special file arguments, relax the condition
for such special files from "... is an absolute name of ..." to
"... resolves to ...".
* NEWS (Bug fixes): Mention the new behavior also here.
2013-12-06 00:59:36 +01:00
Pádraig Brady
37e001d209 tests: fix false failure with disabled SELinux support
This could trigger on SELinux systems where we build --qithout-selinux
or where the SELinux development libraries are not installed.

* init.cfg (require_selinux_enforcing_): Call require_selinux_()
to determine if the current build supports SELinux.  This avoids
a false failure in tests/mkdir/selinux.sh where only mkdir would
determine that SELinux was disabled and thus ignore invalid contexts.
(require_selinux_): Refactor a little to distinguish whether it's
the build or the (file) system that doesn't support SELinux.
2013-12-05 00:27:11 +00:00
Pádraig Brady
0013de3e60 selinux: fix --context=CTX for cp and diagnose defaultcon() errors
* src/selinux.h (ignorable_ctx_err): A new function used
to determine if a warning should be given after a call
to defaultcon() or restorecon().
* src/cp.c (main): Fix the setfscreatecon() call to use
the argument passed by the user.
* src/mkdir.c (make_ancestor): Show all but "ignoreable" errors
from defaultcon() and restorecon().
* tests/misc/selinux.sh: Add a test run as root in selinux enforcing
mode, to ensure cp --context=invalid is honored and fails immediately.
2013-12-05 00:18:36 +00:00
Pádraig Brady
b53b0fd940 md5sum, sha*sum: use libcrypto where available
libcrypto is generally available and has well optimized
crypto hash routines particular to various systems.
For example, testing sha1sum with openssl-1.0.0j
on an i3-2310M, gives a performance boost of about 40%:

$ time sha1sum.old --tag ~/test.iso
SHA1 (/home/padraig/test.iso) = 3c27f7ed01965fd2b89e22128fd62dc51a3bef30
real    0m4.692s
user    0m4.499s
sys     0m0.162s

$ time sha1sum.new --tag ~/test.iso
SHA1 (/home/padraig/test.iso) = 3c27f7ed01965fd2b89e22128fd62dc51a3bef30
real    0m2.685s
user    0m2.512s
sys     0m0.170s

* configure.ac: By default, enable use of libcrypto if available.
* src/local.mk: Link with libcrypto.
* NEWS: Mention the md5sum and sha*sum improvements.
2013-12-04 13:18:56 +00:00
Pádraig Brady
2091f44993 df: handle bind mounts when processing device nodes
* src/df.c (get_disk): Use the same heuristic used in
get_point() to select the shortest file system mount point,
in an attempt to show the base mounted file system.
* NEWS: Mention the bug fix.
2013-12-04 13:17:17 +00:00
Pádraig Brady
33660b4973 df: dereference symlinks to disk device nodes
This is so the matching for the device is done on the canonical name
of the disk node, rather than on the path of the symlink.
In any case the user will generally want to use the symlink target.

* src/df.c (get_disk): Canonicalize the passed file,
before matching against the list of mounted file system devices.
Note we pass the original symlink name to the "file" output field,
as the symlink target is usually available through the "source" field.
* tests/df/df-symlink.sh: Test the dereferencing operation.
* tests/local.mk: Mention the new test.
* NEWS: Mention the fix.
Reported by Ondrej Oprala
2013-12-04 13:16:27 +00:00
Pádraig Brady
ec6928ddb5 build: update gnulib submodule to latest
Note tests/init.sh and bootstrap are still in sync with gnulib.

* gnulib: Sync two configure check fixes.
- Avoid generating core dumps from regex configure check
- Fix compile error in getcwd configure check
2013-12-04 13:06:45 +00:00
Pádraig Brady
fdf42f0127 build: update gnulib submodule to latest
Note tests/init.sh and bootstrap are still in sync with gnulib.

* gnulib: Sync many fixes/changes, including the base64
encoding speedup mentioned in commit v8.21-145-g9120845
Also included is support for enabling use of libcrypto hash routines
which are generally well optimized for particular systems.
2013-12-04 02:20:05 +00:00
Bernhard Voelker
f65a384160 maint: avoid '%s' quoting notation in diagnostic messages
Add a new rule to ensure the use of quote() instead of '%s' or `%s'
in format strings of diagnostics messages.

* cfg.mk (sc_prohibit_quotes_notation): Add rule.
* TODO: Remove the entry regarding the '%s' notation.
* src/mkfifo.c (main): Remove the offending and in this case even
duplicate quoting in the format string of the error diagnostic.
* src/mknod.c (main): Likewise.
* src/df.c (decode_output_arg): Change two invocations of error()
according to the above new rule.
* src/numfmt.c: Fix numerous wrong quote notations to fit the above
new rule, mostly in internal debugging diagnostic messages.
2013-12-03 10:03:51 +01:00
Pádraig Brady
30384428a4 doc: remove obsolete info on terminal alignment bugs
* doc/coreutils.texi (ls invocation): Remove the note about
OSX terminals not aligning properly as this is no longer the case.
Tested by: Philipp Thomas
2013-12-03 03:37:23 +00:00
Pádraig Brady
e20d2ea126 build: fix potential factor build failure on arm and powerpc
* src/longlong.h: Sync with the latest longlong.h from libgmp to:
- avoid arm asm when being compiled for the thumb instruction [sub]set
- avoid old powerpc assembly that is incompatible with newer GCC
- add arm64 optimized count_trailing_zeros()
- add sparc64 optimized add_ssaaaa() and umul_ppmm()
2013-11-29 15:23:54 +00:00
Bernhard Voelker
1b179421df tests: add a test for rm -r "/"
* tests/rm/r-root.sh: Add a non-root test.
* tests/local.mk (all_tests): Mention the test.
2013-11-29 13:22:03 +01:00
Bernhard Voelker
e11df57c3b maint: remove various FIXME comments
* src/extent-scan.c (extent_need_sync): Remove the FIXME comment about
removing the work around.  As discussed in [1], the needed FIEMAP fix
never made it into the Linux kernel.

* src/realpath.c (longopts): Remove the FIXME comment about deprecating
the --strip option as it's a valid alias for --no-symlinks option.
Also discussed in [1].

[1] http://lists.gnu.org/archive/html/coreutils/2013-11/msg00103.html
2013-11-29 13:08:44 +01:00
Bernhard Voelker
64520354bb df: remove long-obsolescent --megabytes option
This option has been undocumented for 12 years [1], and warned
about for a year [2].

[1] commit FILEUTILS-4_1_4-23-gd177203
[2] commit v8.17-43-g453ce92

* src/df.c (MEGABYTES_OPTION): Remove.
(long_options): Remove "megabytes" element.
(main): In the option parsing loop, remove the MEGABYTES_OPTION case.
* NEWS: Mention the change.
2013-11-29 13:07:47 +01:00
Pádraig Brady
142baf6740 build: fix selinux.c build failure on 32 bit
* src/selinux.c: Don't include the system "fts.h" as
that disallows _FILE_OFFSET_BITS=64 which gnulib auto enables
to support large files on 32 bit systems.  Instead include
our "xfts.h" which includes the less limited gnulib replacement,
and also a checked version of xfts_open().
(restorecon): Use the checked xfts_open() rather than the standard
fts_open().
Prompted by the continuous integration build failure at:
http://hydra.nixos.org/build/6934169
2013-11-28 02:29:00 +00:00
Pádraig Brady
7e39ef9f88 build: avoid more selinux build failures
Handle both newer selinux libraries with mode_to_security_class(),
and systems without selinux at all.  We could easily adjust
gnulib to provide the necessary stubs for use by this module,
but it's more efficient to just stub out the module completely,
when not using selinux.

* src/selinux.h: Define stubs for the two module functions,
when SELinux is not available.
* src/selinux.c: Exclude all logic in preference for the stubs
when selinux isn't used.  Also when newer selinux libs are used,
don't use our conflicting static version of mode_to_security_class().
m4/jm-macros.m4: Check for the system mode_to_security_class().
2013-11-27 20:59:23 +00:00
Pádraig Brady
1e16de1de4 build: avoid build failure on non selinux systems
* src/selinux.c: This module introduced in commit v8.21-159-gd8e27ab
doesn't need to include <selinux/flask.h>.  That header file
isn't catered for by gnulib, but is not needed as we're not
explicitly referencing any class IDs.
Prompted by the continuous integration build failure at:
http://hydra.nixos.org/build/6920020
2013-11-27 16:38:49 +00:00
Pádraig Brady
7958a4a4fe selinux: adjust utils to run restorecon with -Z
cp, mv, install, mkdir, mkfifo, mknod are adjusted so that:
 -Z no longer accepts an argument.
 -Z or --context without an argument do not warn without SELinux.
 --context with an argument will warn without SELinux.

* src/local.mk: Reference the new selinux module where required.
* src/system.h: Make the argument to --context optional.
* src/mkdir.c: Likewise.  Also handle the SMACK case for --context.
Note we currently silently ignore -Z with SMACK.
* src/mkfifo.c: Likewise.
* src/mknod.c: Likewise.
* src/install.c: Likewise.  Note install(1) by default already
set the context for target files to their system default,
albeit with an older method.  Use the -Z option to select between
the old and new context restoration behavior, and document
the differences and details for how context restoration
is done in new and old methods, with a view disabling the
old method entirely in future.
* src/cp.c: Make the argument to --context optional.
Note -Z implies --no-preserve=context.  I.E. -Z overrides
that aspect of -a no matter what order specified.
(struct cp_options): Document the context handling options.
(main): Check/adjust option combinations after all
options are processed, to both simplify processing
and to make handling independent of order of options
on the command line.  Also improve the diagnostics
from a failed call to setfscreatecon().
(set_process_security_ctx): A new function,
refactored to set the default context from the source file,
or with the type adjusted as per the system default for
the destination path.
(set_file_security_ctx): A new function refactored to
set the security context of an existing file, either based on
the process context or the default system context for a path.
(copy_internal): Use the refactored functions to simplify
error handling and consistently fail or warn as needed.
(copy_reg): Likewise.
(copy_internal): With --preserve=context, also copy
context from non regular files.  Note for directories this may
impact the copying of subsequent files to that directory?
(copy_attr): If we're handling SELinux explicitly,
then exclude to avoid the redudant copy with --preserve=context,
and the problematic copy with -Z.  Note SELinux attribute exclusion
also now honors cp -a --no-preserve=context.  Note there was a
very small window over 10 years ago, where attr_copy_file was
available, while attr_copy_check_permissions was not, so we
don't bother adding an explicit m4 check for the latter function.
* src/mv.c: Support --context, but don't allow specifying an argument.
* src/chcon.c: Adjust a comment to be specific to SELinux.
* src/runcon.c: Likewise.
* src/copy.c: Honor the context settings to "restorecon" as appropriate.
* src/copy.h: Add a new setting to select "restorecon" functionality.
* tests/mkdir/selinux.sh: s/-Z/--context=/
* tests/cp/cp-a-selinux.sh: Augment this test with cases
testing basic -Z functionality, and also test the various
invalid option combinations and option precedence.
* tests/mkdir/restorecon.sh: Add a new test for the
more involved mkdir -Z handling, since the directory changing
and non existent directories need to be specially handled.
Also check the similar but simpler handling of -Z by mk{nod,fifo}.
* tests/local.mk: Reference the new test.
* doc/coreutils.texi (cp invocation): Update as per interface changes.
(mv invocation): Likewise.
(install invocation): Likewise.
(mkfifo invocation): Likewise.
(mknod invocation): Likewise.
(mkdir invocation): Likewise.
* NEWS: Mention the new feature and change in behavior.
2013-11-27 14:19:32 +00:00
Daniel J Walsh
d8e27ab0be selinux: a new module implementing "restorecon" functionality
* src/selinux.c: A new module implementing "restorecon" functionality.
There are two main functions to adjust the type of the referenced
file system item.  defaultcon() will setup the process context so
that new items will have the required context without races.  This is
the preferred method.  For existing files, the equivalent restorecon()
is available which has two modes.  With the "local" parameter set to
false, restorecon() will adjust the type according to the system
configuration for that file, and set to true will update the context
as per the context for the current process (disregarding type).
* src/selinux.h: Likewise.
* po/POTFILES.in: Reference the new module.
2013-11-27 14:18:29 +00:00
Pádraig Brady
569b4edd18 shred: provide --remove methods to avoid excessive syncing
A sync operation is very often expensive.  For illustration
I timed the following python script which indicated that
each ext4 dir sync was taking about 2ms and 12ms, on an
SSD and traditional disk respectively.

  import os
  d=os.open(".", os.O_DIRECTORY|os.O_RDONLY)
  for i in range(1000):
     os.fdatasync(d)

So syncing for each character for each file can result
in significant delays.  Often this overhead is redundant,
as only the data is sensitive and not the file name.
Even if the names are sensitive, your file system may
employ synchronous metadata updates, which also makes
explicit syncing redundant.

* tests/misc/shred-remove.sh: Ensure all the new parameters
actually unlink the file.
* doc/coreutils.texi (shred invocation): Describe the new
parameters to the --remove option.
* src/shred.c (Usage): Likewise.
(main): Parse the new options.
(wipename): Inspect the new enum to see which of
the now optional tasks to perform.
* NEWS: Mention the new feature.
* THANKS.in: Add reporter Joseph D. Wagner
2013-11-27 01:43:12 +00:00
Pádraig Brady
ba6582e95c tail: improve inotify handling of symlinks
Previous behavior failed to read contents of a (re)appearing file,
when symlinked by tail's watched file.  Also we now diagnose other
edge cases when running in inotify mode, where an initially
missing or regular file changes to a symlink.

* src/tail.c (main): If any arg is a symlink, use polling mode.
(recheck): Diagnose the edge case where a symlink appears during
inotify processing.
* tests/tail-2/symlink.sh: Test the fix. Mention the edge cases.
* tests/local.mk: Reference the new test.
* NEWS: Mention the fix.
Reported by: Ondrej Oprala
2013-11-27 01:40:08 +00:00
Pádraig Brady
799e10f361 df: add --output=file to directly output specified arguments
* src/df.c (usage): Document the new 'file' --output field.
(get_dev): Add a new parameter to pass the specified
argument from the command line through.  Use '-' if a
command line parameter is not being used.
* doc/coreutils.texi (df invocation): Describe the new 'file' field.
* tests/df/df-output.sh: Adjust all fields test, and
add a specific test for --output=file.
* NEWS: Mention the new feature.
2013-11-27 01:39:11 +00:00
Pádraig Brady
c3523181bd timeout: avoid unlikely issues with --kill-after
* src/timeout.c (cleanup): When calling settimeout() from
this signal handler, ensure we don't call out to error()
or gettext(), which are not async-signal-safe.
Also reset the errno which may be cleared by settimeout().
2013-11-27 01:30:46 +00:00
Pádraig Brady
6b91f64ed9 tests: ensure factor tests can be regenerated
* tests/local.mk (factor-tests:) Add -f to the mv command that
replaces any existing generated tests.  This is required to avoid
prompts when root initially generates the tests, and they subsequently
need to be regenerated by a non root user.
2013-11-27 01:28:20 +00:00
Pádraig Brady
39e0c9ba5d sort: avoid issues when issuing diagnostics from child processes
* src/sort.c: (async_safe_die): A new limited version of error(),
that outputs fixed strings and unconverted errnos to stderr.
This is safe to call in the limited context of a signal handler,
or in this particular case, between the fork() and exec() of
a multithreaded process.
(move_fd_or_die): Use the async_safe_die() rather than error().
(maybe_create_temp): Likewise.
(open_temp): Likewise.
Fixes http://bugs.gnu.org/15970
2013-11-27 01:21:23 +00:00
Pádraig Brady
17bce8c63e doc: clarify the operation of ls -k
* src/ls.c (usage): Mention -k only changes the display
for disk usage (directory total, and ls -s), and imply
that it can be overridden (by --block-size, and -h).
* doc/coreutils.texi (block size): Mention that ls -k
handling is different to other utilities.
Addresses http://bugs.gnu.org/14525
2013-11-26 15:46:22 +00:00
John
ebea85b49c dircolors: add a new entry to colorize 'lz4' files
* src/dircolors.hin: Add entry for the speed optimized 'lz4' compressor.
2013-11-23 00:03:33 +00:00
Bernhard Voelker
2fa074ebd4 tests: enhance rm test regarding "." and ".."
Recent commit 2da7009d changed the error diagnostic of rm(1) trying
to remove "." or "..".  Enhance the corresponding test.

* tests/rm/r-4.sh: Ensure rm(1) outputs the expected error diagnostic.
2013-11-22 15:54:06 +01:00
Bernhard Voelker
eb8b45f443 maint: avoid perl warning in sc_check-AUTHORS
With newer perl, "make syntax-check" issues many warnings like:
  -i used with no filenames on the command line, reading from STDIN.

* cfg.mk (sc_check-AUTHORS): Remove the -i flag in the perl
invocation as it is reading from a pipe.
2013-11-21 12:11:01 +01:00
Bernhard Voelker
2da7009d70 doc: enhance diagnostic when rm skips "." or ".." arguments
The error diagnostic
  "rm: cannot remove directory: '.'"
does not give the user a hint for the reason.
Issue a clearer error message.

* src/remove.c (rm_fts): Enhance the error diagnostic in the above
case to emphasize that skipping is done deliberately.
In the corresponding comment, mention that POSIX mandates this
behavior.  Likewise in the subsequent comment for skipping "/".
* doc/coreutils.texi (rm invocation): In the paragraph describing
the above behavior, mention that POSIX mandates it.
2013-11-21 11:43:48 +01:00
Pádraig Brady
65f8a39d90 tests: fix false rm -I test failure when run as root
Fix a recent regression introduced in commit v8.21-127-g5ee7d8f

Also related to this is the recent query about root run `rm -I`
ignoring the mode bits of a file: https://bugzilla.redhat.com/1013171

* tests/rm/interactive-once.sh: Avoid the messages and
corresponding file presence checks with write protected files
when running as root.
2013-11-18 01:30:19 +00:00
Colin Leitner
4e37fc642f stty: add support for mark/space parity
This adds support for using a constant or "stick" parity bit.

* src/stty.c (usage): Mention the new flag.
* tests/misc/stty.sh: Adjust for the new flag.
* NEWS: Mention the improvement.
* docs/coreutils.texi (stty invocation): Mention the new flag.
2013-11-17 12:26:12 +00:00
Pádraig Brady
9120845375 base64: improve encoding I/O efficiency
Since the I/O overhead is significant to the relatively
simple processing done by this utility, use fputs() rather
than fputc() to output '\n'.
Time to process a 100MiB file was measured to
decrease from 0.417s to 0.383s, i.e. an 8% improvement.

Related to these changes, is a processing improvement in
gnulib, which increases throughput by 60% when processing
full buffers, which improves processing of a 100MiB file
with standard wrapped output, down to 0.256s.
http://git.sv.gnu.org/gitweb/?p=gnulib.git;a=commit;h=43fd1e7b

Also increase the encoding buffer size from 3 to 30KiB.
This was seen to give a further 8% improvement, taking
processing time down to 0.235s in the wrapped output case.
The decoding size buffer is not adjusted,
due to the noted caveat with --ignore-garbage.

* src/base64.c (BLOCKSIZE): Split into ENC_ and DEC_ variants,
with the former increased from 3KiB to 30KiB.
(wrap_write): Use the simpler fputc() rather than fputs()
to output the '\n' character.  Also check against EOF
rather than < 0 for errors.
(do_encode): Likewise.
* NEWS: Mention the large increase in performance, which
with the I/O improvements in coreutils and the processing
improvement in gnulib, amount to about a 60% throughput increase.
2013-11-11 23:30:39 +00:00
Pádraig Brady
90181a5926 shred: avoid data write pass with --size=0
* src/shred.c (dopass): Exit early to avoid redundant heap
allocation, and more importantly avoiding a file sync
when we're writting no data, as this can have side effects.
Also with --verbose, this avoids printing of "pass status"
which could be confusing as to whether data was actually written.
* tests/misc/shred-passes.sh: Ensure the status for data
passes are not written when not doing any data writes.
2013-11-08 13:39:35 +00:00
Pádraig Brady
c2eaef2f57 shred: increase I/O block size for periodic pattern case
* src/shred.c (dopass): In the periodic pattern case increase the
I/O block size from 12KiB to 60KiB (also a multiple of 3 and 4096).
* NEWS: Adjust accordingly.
2013-11-08 13:39:35 +00:00
Pádraig Brady
c93d5b4aa7 shred: fix direct I/O failures for last write to file
Since direct I/O is now enabled with commit v8.21-139-gebaf961
we must handle the case where we write an odd size at the
end of a file (with --exact), or we specify an odd --size that
is larger than 64KiB, or in the very unlikely case of a device
with an odd size.  This issue was present since direct I/O
support was first added in v5.3.0, but latent since v6.0.
Theoretically this could have also been an issue after that on
systems which didn't have alignment constraints, but did have
size constraints for direct I/O.

* src/shred.c (dopass): On the first pass for a file, always
retry a write that fails with EINVAL, so we handle direct I/O
failure at either the start or end of the file.  Adjust the comment
as the original case is out of date and implicitly handled
by this more general fix.
* tests/misc/shred-exact.sh: Add a test case.
* NEWS: Add a "bug fix" entry for shred since there are
two related issues now fixed.
2013-11-08 13:33:50 +00:00
Gian Piero Carrubba
bf6bf52dce cp: fix --link regarding the dereferencing of symbolic links
* src/copy.c (create_hard_link): Add a bool 'dereference' parameter,
and pass AT_SYMLINK_FOLLOW as 'flags' to linkat() when dereference
is true.
(should_dereference): Add new 'bool' function to determine if a
file should be dereferenced or not.
(copy_internal): Use the above new should_dereference() and remember
its return value in a new local bool 'dereference' variable.  Use that
in all three calls to create_hard_link().
* src/cp.c (main): after parsing the options, if x.dereference is
still DEFEF_UNDEFINED and the x.recursive is true, then only set
x.dereference to DEREF_NEVER iff --link was not specified.
* doc/coreutils.texi (cp invocation): Mention that cp(1) does not
follow symbolic links in the source when --link is specified.
Likewise in the description of the -R option when used together with
that option.
* tests/cp/same-file.sh: Adapt the expected results for the -fl,
the -bl and the -bfl tests.
* tests/cp/link-deref.sh: Add a new test.
* tests/local.mk (all_tests): Reference the above new test.
* NEWS (Changes in behavior): Mention the change.

This fixes http://bugs.gnu.org/15173

Co-authored-by: Bernhard Voelker <mail@bernhard-voelker.de>
2013-11-07 23:45:22 +01:00
Pádraig Brady
2c6736f92f shred: write larger chunks when possible
* src/shred.c (dopass): When not needing to write periodic patterns,
use a 64KiB block size to reduce the number of write system calls.
2013-11-06 17:43:13 +00:00
Pádraig Brady
ebaf961f3a shred: enable direct I/O when possible
Commit v5.92-1057-g43d487b introduced a regression
in coreutils 6.0 where it removed the page alignment
of the buffer to write, thus disabling direct I/O.
We want to use direct I/O when possible to avoid
impacting the page cache at least, as we know we don't
want to cache the data we're writing.

* src/shred.c (dopass): Allocate the buffer on the heap,
while using a more general calculation to allow to have
the output size independent from the fillpattern() size
constraint of a multiple of 3.  Also we dispense with the
union as it's no longer needed given we're aligning on
a page boundary and thus don't need to explicitly handle
uint32_t alignment.
2013-11-05 13:43:20 +00:00
Pádraig Brady
d60e04424d md5sum, sha*sum: improve help for --check related options
* src/md5sum.c (usage): s/three/four/ in the message pertaining
to the --check related options.  Also clarify that --strict
is just significant for the formatting of the checksum lines.
Also since we're changing both strings, move the --strict description
in with the description of the other options and order alphabetically.
* THANKS.in: Added reporter: Daniel Mach
2013-11-01 22:39:34 +00:00
Pádraig Brady
4d94e65d06 maint: simplify printing of md5sum file names
* src/md5sum.c (main): Add a comment as to why we continue
to escape names that do not have '\n' but do have '\\' chars.
(print_filename): Use the predetermined boolean to decide
whether to escape or not, so that in the common case we
can output the file name directly, rather than inspecting each char.
* tests/misc/md5sum.pl: Add case to show '\\' chars cause escaping.
* tests/misc/sha1sum.pl: Likewise.
2013-11-01 22:34:24 +00:00
Bernhard Voelker
979f59f77c build: fix dependencies of man/sha*sum.1
Although the above man pages depend on src/md5sum.c as a shared
source, the build of the man pages directly requires their own
executables to exist.

* man/local.mk (man/sha1sum.1): Change the dependency from
'src/md5sum' to 'src/sha1sum'.
(man/sha224sum.1): s/md5sum/sha224sum/
(man/sha256sum.1): s/md5sum/sha256sum/
(man/sha384sum.1): s/md5sum/sha384sum/
(man/sha512sum.1): s/md5sum/sha512sum/

Reported by Pádraig Brady in
http://lists.gnu.org/archive/html/coreutils/2013-11/msg00006.html
2013-11-01 18:59:43 +01:00
Mike Frysinger
c90b9e07e2 dircolors: add putty-256color terminal type
* src/dircolors.hin: Add putty-256color
Reported-by: Thomas D. <whissi@whissi.de>, via
http://bugs.gentoo.org/486786
Fixes http://bugs.gnu.org/15624
2013-10-15 23:57:38 +01:00
Pádraig Brady
15fca2a02e maint: update the instructions for building prerequisites
* README-prereq: Update as per the latest required versions
in bootstrap.conf.  Also add a missing cd command.
Reported by Aaron Davies
Fixes http://bugs.gnu.org/15612
2013-10-15 11:05:49 +01:00
Ondřej Vašík
743be23ed0 cp: correct error message for invalid arguments of '--no-preserve'
* src/cp.c (decode_preserve_arg):
Correct error message for invalid arguments of '--no-preserve'.
Reported by M.Vadkerti in http://bugzilla.redhat.com/1018206
Fixes http://bugs.gnu.org/15588
2013-10-11 17:07:37 +01:00
Pádraig Brady
bae9c38410 doc: clarify the example for cp --preserve=links
* doc/coreutils.texi (cp invocation): Give more detail about what's
happening in the example, explicitly calling out the --no-dereference
option required to make the -H and -L options significant.
Also mention the option order significance of the -H and -L options.
Fixes http://bugs.gnu.org/15579
2013-10-10 10:19:13 +01:00
Pádraig Brady
cba81e7b84 mktemp: fix incorrect exit status from previous commit
* src/mktemp.c (main): Use an exit() strategy consistent with the
previous clauses dealing with optional error messages to ensure
we exit with the correct status in all cases.
Prompted by the continuous integration build failure at:
http://hydra.nixos.org/build/6412979
2013-10-07 12:15:27 +01:00
Pádraig Brady
0c1d7917f1 mktemp: with --quiet, only suppress I/O errors
The reason for having a --quiet option is to
suppress only some subset of possible errors.
The most useful separation here is with usage/internal errors,
and errors due to file creation etc. (i.e. I/O errors).

* src/mktemp.c (main): Match the --help and info docs and
only suppress the file/dir creation error messages.
* tests/misc/mktemp.pl: Adjust accordingly.
2013-10-06 17:59:44 +01:00
Pádraig Brady
8e67c2dec1 mktemp: synchronize the -p option with docs
* src/mktemp.c (usage): Synchronize the -p option description with
the logic and info docs.  I.E. that -p is just an alias of --tmpdir.
Also for consistency treat --tmpdir='' the same with or without -t.
I.E. always ignore the --tmpdir option if the param is empty.
Fixes http://bugs.gnu.org/15425
2013-10-06 17:59:00 +01:00
Karl Berry
b72d08ef63 doc: expand the texinfo examples for the paste command
* doc/coreutils.texi (paste invocation): Move the synopsis to the top.
Provide examples for the different type of operations possible.
Add a specific common example to join consecutive lines with a space.
2013-10-06 16:48:09 +01:00
Sergio Durigan Junior
5ee7d8f55b rm: with -I, prompt before deleting a write protected file
This regression was introduced in commit v6.7-71-g0928c24

* src/rm.c (main): Make the -I option behave like --interactive=once.
* tests/rm/interactive-once.sh: Add cases for single and multiple files.
* NEWS: Mention the bug fix.
Fixes http://bugs.gnu.org/9308
2013-09-26 11:25:05 +01:00
Pádraig Brady
3414301f59 maint: move all id(1) tests to the same directory
* tests/misc/id-context.sh -> tests/id/context.sh
* tests/misc/id-setgid.sh -> tests/id/setgid.sh
* tests/misc/id-uid.sh -> tests/id/uid.sh
* tests/misc/id-zero.sh -> tests/id/zero.sh
* tests/local.mk: Reference the renamed tests
2013-09-22 04:15:34 +01:00
Pádraig Brady
587cc684dc tests: parameterize the "root" username
* tests/misc/chroot-credentials.sh: Don't assume uid 0
has the "root" name, nor any name for that matter.
2013-09-22 03:59:58 +01:00
Pádraig Brady
414666db15 maint: remove unused parameters to parse_user_spec()
* src/chown.c (main): Since "name" parameters to parse_user_spec()
are now optional, just pass NULL for those unused parameters.
* src/chroot.c (main): Likewise.
2013-09-22 03:41:46 +01:00
Pádraig Brady
7415d8d9f8 id: support specifying the user by user ID
* src/id.c (usage): Remove 'name' from the synopsis,
implying that one can also specify by user ID.
(main): Like chown(1), call parse_user_spec() to implement
user name or ID lookup with appropriate precedence.
* doc/coreutils.texi (id invocation): Mention that
a user ID is supported and how '+' affects lookup order.
* tests/misc/id-groups.sh: Remove test now subsumed into...
* tests/misc/id-uid.sh: New test covering new interface.
* tests/local.mk: Rename the test.
* NEWS: Mention the new feature.
Addresses http://bugs.gnu.org/15421
2013-09-22 03:27:17 +01:00
Pádraig Brady
f9992690f4 build: update gnulib submodule to latest; also bootstrap to latest
Notes tests/init.sh is still in sync with gnulib.

* bootstrap: Update to latest.
* gnulib: Sync many fixes/changes, including:
a fix for http://bugs.gnu.org/15066
and preparation for http://bugs.gnu.org/15421
2013-09-22 02:56:56 +01:00
Pádraig Brady
f4f4568d8c tests: avoid a failure when there isn't a name for all user IDs
* tests/misc/id-zero.sh: Don't check exit status when in -n mode.

Prompted by the continuous integration build failure at:
http://hydra.nixos.org/build/6196762
2013-09-22 02:51:37 +01:00
Bernhard Voelker
2a0d241f69 id: add -z, --zero option
* src/group-list.h (print_group_list): Add a parameter for the
delimiter of type char.
* src/group-list.c (print_group_list): Likewise, and use it instead
of a white space character to delimit the group entries.
* src/groups.c (main): Pass white space character to print_group_list().
* src/id.c (longopts):  Add array element for the new long option.
(usage): Document the new option.  While at it, fix the alignment
of the descriptions to match that of HELP_OPTION_DESCRIPTION.
(main): Define the bool flag opt_zero indicating the use of the
new option.  In the getopt_long loop, handle it.
Output an error diagnostic in the case the --zero option has been
specified together with the default format.
In the case of -gG, pass either a NUL or a white space character to
print_group_list() - depending on the above new flag.
Likewise change the printing of the final newline character: output
a NUL instead if the --zero option has been specified.
* doc/coreutils.texi (id invocation): Document the new option.
While at it, move the @exitstatus macro down after the macro
@primaryAndSupplementaryGroups in order to be consistent with
other texinfo documents.
(groups invocation): Move @exitstatus down after the macro
@primaryAndSupplementaryGroups here, too.
* tests/misc/id-zero.sh: Add new test exercising the new option.
* tests/local.mk (all_tests): Reference it.
* NEWS (New features): Mention the new option.
Fixes http://bugs.gnu.org/9987
2013-09-21 14:15:45 +02:00
Bernhard Voelker
b3578fc9ff maint: avoid patching help2man
Commit cde1ea0e separated the coreutils-specific patches from help2man.
Most changes had been made to accommodate to the coreutils style guide,
i.e., to avoid syntax-check failures like sc_long_lines.
Yet 2 changes had to be put into the patch help2man.diff.
But this added the dependency to patch(1) in distribution builds.
Incidentally, the 2 remaining parts of the patch can easily be
done outside of help2man.  Therefore, this commit partly reverts
the recent separation of help2man into 'help2man.in' and
'help2man.diff', and instead uses the original help2man script.

* man/help2man.in: Rename to ...
* man/help2man: ... this file.
* man/help2man.diff: Remove.
* man/local.mk (mandeps): Remove man/help2man.
(man/help2man): Remove recipe.
(.x.1): Add the --info-page option when calling help2man in order
to change the name of the texinfo manual from the default, "info PRG",
to "info coreutils 'PRG invocation'".
Furthermore, use an sed pattern to remove the sentence starting
with "For complete documentation".
* .gitignore (/man/help2man): Remove entry.
* .x-update-copyright: Replace the entries for the files
'man/help2man.diff' and 'man/help2man.in' by 'man/help2man'.
* cfg.mk (sc_long_lines): Instead of 'man/help2man.in', exempt
'man/help2man' from this test.
(sc_po_check): Likewise.
(sc_space_tab): Instead of 'man/help2man.diff', exempt 'man/help2man'
from this test.
(sc_trailing_blank): Likewise.
(sc_prohibit_tab_based_indentation): Instead of 'man/help2man.in' and
'man/help2man.diff', exempt 'man/help2man'.
* man/dummy-man: Recognize the option --info-page=... as no-op.
2013-09-12 08:02:22 +02:00
Bernhard Voelker
321933e14f maint: use help2man configured with --disable-nls
Prompted by the continuous integration build failure at:
http://hydra.nixos.org/build/6038769

The previously committed 'help2man' requires a Perl module
which does not seem to be installed everywhere - and which
is not needed for our purposes:

  Can't locate Locale/gettext.pm in @INC
  BEGIN failed--compilation aborted at ./man/help2man line 28.

This module was pulled in automatically by the default configure call.
Use the NLS-disabled version instead.

* man/help2man.in: Use help2man configured with the --disable-nls
option to avoid the dependency to the above Perl module.
* man/help2man.diff: Adapt the line numbers of the hunks in the
coreutils-specific patch for help2man to apply without fuzz.

Reported by Pádraig Brady.
2013-09-12 07:41:28 +02:00
Pádraig Brady
46f7e05291 build: fix corrupted patch causing bootstrap failures
The patch was corrupted in commit v8.21-50-g7b65f8e

* gl/modules/tempname.diff: Fix the offsets so that the patch
applies cleanly.  Note that this was only apparent with patch < 2.6.
With patch >= 2.6, patch will not indicate an error applying
the second hunk of the patch and silently ignore it.
I double checked that all patches now apply cleanly by adjusting
gnulib-tool to run patch with --fuzz=0 which might be advisable
going forward, even on a per project basis.
The silent ignoring of hunks by newer patch(1) has been reported.
Fixes http://bugs.gnu.org/15255
2013-09-10 12:00:34 +01:00
Bernhard Voelker
54a155a37e maint: update help2man to 1.43.3
Instead of diverging further from the upstream GNU help2man project
(http://www.gnu.org/software/help2man/), hold a copy of the original
script and keep track of our changes in a separate patch file.

The man pages created with the new version show the following,
non-invasive differences:
a) command options in the EXAMPLE sections are no longer in bold format,
b) file names are underlined now consistently.

* man/help2man: Rename to ...
* man/help2man.in: ... this file, and update content from the
upstream GNU help2man project.
* man/help2man.diff: Add patch file for help2man to remove the
sentence "For complete documentation ..." (see commit 5d4f09d8),
and to emit "info coreutils 'PROG invocation'" into the man
pages (77abf69a).
* man/local.mk (mandeps): Add help2man to the dependencies of
the man pages.
(man/help2man): Add rule to generate this script from the upstream
help2man.in file and the help2man.diff patch.
* .gitignore: Add man/help2man as it is no longer version controlled.
* cfg.mk (sc_long_lines): Exempt help2man.in from this check.
(sc_po_check): Likewise.
(sc_space_tab): Likewise.
(sc_trailing_blank): Exempt man/help2man.diff from this check.
(sc_prohibit_tab_based_indentation): Instead of help2man, now exempt
both help2man.in and help2man.diff from this test.
* .x-update-copyright: Add new file and add the above new help2man
files as well as the COPYING file.
2013-09-09 22:52:18 +02:00
FUJIWARA Katsunori
b86437e126 ls: fix possible incorrect exit status when recursing directories
If there is an error reading a directory that was referenced
through recursion, rather than directly on the command line,
then exit with the "less serious" exit code, rather than the
"serious" exit code reserved for command line arguments.
This issue was introduced in commit v5.2.1-1908-gb58dea5

* src/ls.c (print_dir): Ensure that the command_line_arg param
is false for directories being recursed into.
* NEWS: Mention the bug fix.
Fixes http://bugs.gnu.org/15249
2013-09-05 02:50:11 +01:00
Pádraig Brady
0603ff3784 maint: update out of date confusing comments
* src/copy.c (copy_internal): Change mention of the removed --reply=no
option, to the similar in this context --no-clobber.
* src/sort.c: SI and IEC suffixes can now be mixed when --human-numeric.
2013-09-01 18:44:04 +01:00
Pádraig Brady
167422f32a df: fix "blocks" translation in header
* src/df.c (get_header): Get the translation of "blocks" here,
rather than just marking the string for translation.
Fixes http://bugs.gnu.org/15054
2013-08-29 00:23:32 +01:00
Bernhard Voelker
4e9f5eb4e2 doc: clarify when seq ends
* doc/coreutils.texi (seq invocation): Add a sentence clarifying
that seq terminates when LAST becomes smaller than the current number
plus INCREMENT.
* src/seq.c (usage): Likewise.
Fixes http://bugs.gnu.org/15068
2013-08-10 17:19:06 +02:00
Bernhard Voelker
448030a2bf doc: use more modern file system type examples in df description
* doc/coreutils.texi (df invocation): In the example list of common
file system types, exchange the entries which are not so common
anymore (4.2, ufs, efs, hsfs, pcfs) by far more prominent ones
(ext2, ext3, ext4, xfs, btrfs, iso9660, ntfs, fat).
2013-08-07 20:12:37 +02:00
Filipus Klutiero
5d93df1b13 doc: fix typo in description of df
* doc/coreutils.texi (df invocation): s/pseude/pseudo/
* THANKS.in (Filipus Klutiero): Remove entry, now that it will be
automatically included in the generated THANKS file.
Fixes http://bugs.gnu.org/15041
2013-08-07 12:43:27 +02:00
Benno Schulenberg
da398ae5df doc: more semicolons instead of periods in option descriptions
Also slightly rephrase some descriptions for extra clarity, and
add more consistent indentation.

* src/df.c (usage): Semicolon, no final period.
* src/du.c (usage): Likewise, plus indentation and clarifying words.
* src/ls.c (usage): Semicolon, rephrasings, added parentheses for
clarity, indentation.
* src/rm.c (usage): Semicolons.
* src/tail.c (usage): Adjust -f description to prefer explanatory
language instead of option syntax.
2013-08-05 01:01:10 +01:00
Pádraig Brady
57b6bdff7e doc: clarify that uniq -d outputs a single entry per group
* src/uniq.c (usage): Clarify the -d option.
Fixes http://bugs.gnu.org/14996
2013-08-03 10:36:39 +01:00
Bernhard Voelker
dffaa8db2d maint: update copyright year number ranges of numfmt sources
Run "make update-copyright".

* src/numfmt.c: Update copyright year number range.  This file has
obviously been added to coreutils after and without the annual update.
* tests/misc/numfmt.pl: Likewise.
2013-08-02 08:31:36 +02:00
Benno Schulenberg
47b51db120 doc: use semicolon instead of period in option descriptions
Also do not end option descriptions with a period, properly indent
continuation lines, and make some tiny clarifications.

* src/du.c (usage): Lowercase after semicolon.
* src/ls.c (usage): Semicolons instead of periods, small rephrasing
and two hyphens for clarity, proper indentation.
* src/mktemp.c (usage): Semicolons and lowercase.
* src/od.c (usage): Semicolons.
* src/ptx.c (usage): Use the standard phrase, clarify default option.
* src/setuidgid.c (usage): Properly indent continuation line.
* src/split.c (usage): Semicolons, lowercase, no final period.
* src/stat.c (usage): Semicolons, lowercase.
* src/tail.c (usage): Proper indentation, one shorter rephrasing,
semicolons, no final periods.
* src/timeout.c (usage): Properly indent, semicolons, no final periods.
Fixes http://bugs.gnu.org/14976
2013-08-01 14:36:36 +01:00
Pádraig Brady
1127c8a009 doc: clarify that cp by default doesn't adjust existing file perms
* doc/coreutils.texi (cp invocation): Mention explicitly what
happens to permissions of existing files when -p is not specified.
Fixes http://bugs.gnu.org/14972
2013-08-01 13:56:38 +01:00
Bernhard Voelker
eea81b46cd tests: fix another test failure in test/du/inodes.sh
Prompted by the continuous integration build failure at:
http://hydra.nixos.org/build/5584121

du(1) uses the first file object of the two test files linked to the
same inode, 'd/f' and 'd/h', whatever the system returns first.
Use 'd/f' in both the expected and the actual output.

* test/du/inodes.sh: Change the expected output as described above
when returning the --all directory entries (without -l).  Also replace
the name of the hardlink 'd/h' by 'd/f' in the actual output.
2013-07-29 01:51:55 +02:00
Paul Eggert
cf821079b6 doc: fix typo
* doc/coreutils.texi (du invocation): @itemx -> @item.
2013-07-28 23:51:54 +02:00
Bernhard Voelker
9e52ebac57 maint: cleanup compare calls in test/du/inodes.sh
* test/du/inodes.sh: In the cases where compare() fails, that function
would show the unified diff automatically.  Therefore, remove the
excess "cat out".
In the cases where expecting an empty file, use compare() again
rather than the simpler "test -s" because possible error reports
will then include the file's content for the same reason as above.
2013-07-28 18:32:22 +02:00
Pádraig Brady
3ab87d254d maint: avoid clang static analysis issues in csplit
* src/csplit.c (find_lines): Assert that load_buffer() updates the
global buffers, thus "b" will be non NULL, thus suppressing subsequent
NULL pointer derefence warnings.
(process_regexp): Avoid a redundant assignment of the "line" pointer.
(process_line_count): Likewise.  Also reduce the "line" pointer scope.
2013-07-28 02:31:10 +01:00
Pádraig Brady
012fbb6371 tests: fix intermittent failure in test/du/inodes.sh
Prompted by the continuous integration build failure at:
http://hydra.nixos.org/build/5582213

* test/du/inodes.sh: Due to undefined order in returned directory
entries, the expected output might not match, so sort both expected
and actual output when returning --all directory entries.
Also use a simpler test for ensuring no errors are output.
2013-07-28 00:26:57 +01:00
Bernhard Voelker
333dc83d52 du: add --inodes option
This new option can be used to find directories with a huge
amount of files.  The GNU find utility has the printf format
"%h" which prints the number of entries in a directory, but
this is non-cumulative and doesn't handle hard links.

* src/du.c (struct duinfo): Add new member for counting inodes.
(duinfo_init): Initialize inodes member with Zero.
(duinfo_set): Set inodes counter to 1.
(duinfo_add): Sum up the 2 given inodes counters.
(opt_inodes): Add new boolean flag to remember if the --inodes
option has been specified.
(INODES_OPTION): Add new enum value to be used ...
(long_options): ... here.
(usage): Add description of the new option.
(print_size): Pass inodes counter or size to print_only_size,
depending on the inodes mode.
(process_file): Adapt threshold handling: with --inodes, print or
elide the entries according to the struct member inodes.
(main): Add a case for accepting the new INODES_OPTION.
Print a warning diagnostic when --inodes is used together with the
option --apparent-size or -b.
Reset the output_block_size to 1 ... and thus ignoring the
options -m and -k.
* tests/du/inodes.sh: Add a new test.
* tests/local.mk (all_tests): Mention it.
* doc/coreutils.texi (du invocation): Document the new option.
* NEWS: Mention the new option.
2013-07-27 14:25:28 +02:00
Ken Booth
2bdb74ec1a mv: replace empty directories in cross file system move
src/copy.c (copy_internal): Use rmdir() rather than unlink()
when the source is a directory, so that empty directories
are replaced in the destination as per POSIX.
* tests/mv/part-rename.sh: Augment with various combinations.
* NEWS: Mention the bug fix.
Fixes http://bugs.gnu.org/14763
2013-07-25 16:45:02 +01:00
Bernhard Voelker
68e5e88861 maint: use new gnulib function to free mount entries in du
* src/du.c (fill_mount_table): Use free_mount_entry() instead
of freeing struct members manually.
2013-07-22 14:42:08 +02:00
Bernhard Voelker
0c452fe97a maint: make some shell and perl scripts executable in 'tests/'
Some newer test scripts - partially ones from me - are not executable.
It does not seem to be a problem, but for consistency and to avoid
future problems on unusual platforms or shells change the permissions
by adding the executable bit.

* cfg.mk (sc_tests_executable): Add new syntax-check rule to ensure
that all test scripts are executable.
* tests/df/df-output.sh: Change file mode from 644 to 755.
* tests/du/threshold.sh: Likewise.
* tests/factor/run.sh: Likewise.
* tests/init.sh: Likewise.
* tests/misc/csplit-suppress-matched.pl: Likewise.
* tests/misc/numfmt.pl: Likewise.
* tests/tail-2/retry.sh: Likewise.
2013-07-22 01:07:52 +02:00
Rasmus Villemoes
c490a6ff2b rm: output number of arguments at the interactive prompt
Include the number of arguments which rm received in the "Remove all
arguments?" prompt.  This is useful in the, presumably, common case
where the arguments were not provided by hand, but instead were the
result of various shell expansions.  A simple, if somewhat contrived,
example (assuming rm is aliased to rm -I) could be:

  rm * .o

where the prompt "Remove 120 arguments?" is more likely to make
the user catch the problem.

* src/rm.c (main): Include correctly pluralized n_files
in the output message.  Also remove the now redudant "all".
* tests/rm/interactive-always.sh: Adjust to the new prompt.
* tests/rm/interactive-once.sh: Likewise.
2013-07-19 12:27:09 +01:00
Pádraig Brady
e6fc265b75 dd: make status=none suppress all diagnostics
* src/dd.c (STATUS_NONE): Simplify the enum so that
it's more general than just suppressing transfer counts.
Then test this in all locations where non fatal diagnostics
are output.
* tests/dd/misc.sh: Ensure the diagnostic about
being unable to skip past the end of input is suppressed.
* NEWS: Mention the change in behavior.
Fixes http://bugs.gnu.org/14897
2013-07-19 11:23:12 +01:00
Pádraig Brady
5fdb50825f head: avoid redundant allocations when reading empty files
* src/head.c (elide_tail_lines_file): For seekable empty files,
or seekable files where the current offset is after the
end of the file, return immediately.  Previously the short
circuit code could not be reached due to logic error.
Spotted by coverity.
2013-07-12 00:25:42 +01:00
Pádraig Brady
90e0e9bf58 maint: avoid a valgrind memory leak warning from pinky
Similarly to commit v8.21-84-g8d2da3f in src/uptime.c
avoid a "definitely lost" error from valgrind.  Note this
only happens with pinky when compiled without optimization,
in which case certain paths aren't eliminated casuing
valgrind to trigger the message.  Note also that coverity
flags this "resource leak" too.

* src/pinky.c (short_pinky): free utmp_buf for developer builds.
2013-07-12 00:24:13 +01:00
Anton Ovchinnikov
3ebc58cc43 df: reduce memory usage when filtering mount entries
Avoid Valgrind reports of "definitely lost" items
and while at it, free all discarded mount entries
to minimize the amount of memory used.

* src/df.c (filter_mount_list): Use the newly exported
free_mount_entry() from gnulib to free all mount entries
as they're discarded.
2013-07-11 13:44:24 +01:00
Pádraig Brady
27712763e3 build: update gnulib submodule to latest 2013-07-11 12:43:47 +01:00
Pádraig Brady
b45c5a7cf0 build: fix a build warning on 32 bit systems in shuf.c
Prompted by the continuous integration build failure at:
http://hydra.nixos.org/build/5508873

* src/shuf.c (write_random_numbers): Convert to an int type
that matches the prinft format spec.
2013-07-11 03:24:06 +01:00
Assaf Gordon
3a84293987 shuf: add --repetition to support repetition in output
main(): Process new option.  Replace input_numbers_option_used()
with a local variable.  Re-organize argument processing.
usage(): Describe the new option.
(write_random_numbers): A new function to generate a
permutation of the specified input range with repetition.
(write_random_lines): Likewise for stdin and --echo.
(write_permuted_numbers):  New function refactored from
write_permuted_output().
(write_permuted_lines): Likewise.
* tests/misc/shuf.sh: Add tests for --repetitions option.
* doc/coreutils.texi: Mention --repetitions, add examples.
* TODO: Mention an optimization to avoid needing to
read all of the input into memory with --repetitions.
* NEWS: Mention new shuf option.
2013-07-11 01:17:31 +01:00
Assaf Gordon
f3fa3b2990 tests: add more tests for shuf option combinations
* test/misc/shuf.sh: Add tests for erroneous conditions
like multiple '-o' and '--random-source'.
2013-07-11 01:17:30 +01:00
Pádraig Brady
75c090931c maint: adjust indentation in df.c
* src/df.c: Adjust indentation and spacing with has
gotten quite out of line in a couple of places.
2013-07-11 00:23:19 +01:00
Pádraig Brady
616fa9c7b3 df: fix mount list processing with unstatable mount dirs
* src/df.c (filter_mount_list): Initialize devlist->dev_num correctly
when unable to stat() a mount point.  This will avoid possible invalid
deduplication done on the list due to use of uninitialized memory.
* tests/df/skip-duplicates.sh: Ensure this code path is exercised.
Also refactor the test to be table driven.
* NEWS: Mention the bug fix.
2013-07-09 02:36:27 +01:00
Anton Ovchinnikov
8d2da3f58a maint: avoid a valgrind memory leak warning from uptime
* src/uptime.c (uptime): Free utmp_buf returned from read_utmp,
to avoid a "definitely lost" warning from valgrind.
2013-07-07 10:45:39 +01:00
Paul Eggert
c7dd45361c build: update gnulib submodule to latest 2013-07-06 17:28:07 -07:00
Pádraig Brady
37c9ce40f3 tests: fix "shuf unreadable" test to work when run as root
* tests/misc/shuf.sh: Restrict the test to the significant
case where we can't in fact read the "unreadable" file.
2013-07-05 02:43:22 +01:00
Pádraig Brady
31225e4f32 stat: ensure --context emits an "unrecognized option" diagnostic
* src/stat.c (long_options): Remove the "context" option as it's
no longer referenced since commit v8.5-65-g13f3237
2013-07-02 13:34:26 +01:00
Bernhard Voelker
64a212cb75 mkdir,mkfifo,mknod: give scontext-related variable a better scope
* src/mkdir.c (main): Move the variable ret and issuing the error
message into the body of the scontext-related if-block.
* src/mkfifo.c (main): Likewise.
* src/mknod.c (main): Likewise.
2013-07-02 11:54:49 +02:00
Pádraig Brady
5fb93f635b maint: refactor SMACK interface to a separate module
Consolidate all smack routines and checks in a module.
We replace and wrap the most commonly used smack routines,
which allows removing ifdefs throughout the code.

* gl/lib/smack.h: A new header containing the implementation
of the wrapped and replacement routines.  Note the is_smack_enabled()
routine should be optimized out at compile time when compiled
on a system without libsmack.
* gl/modules/smack: Describe the new module and move the
configure time code here from ...
* m4/jm-macros.m4: ... here.
* bootstrap.conf: Reference the new module.
* src/id.c: Use the routines without ifdefs where possible.
* src/ls.c: Likewise.
* src/mkdir.c: Likewise.
* src/mkfifo.c: Likewise.
* src/mknod.c: Likewise.
2013-07-02 09:47:32 +01:00
Pádraig Brady
b8a87eaf2d id: don't show SMACK errors unless -Z is specified
* src/id.c (main): Be consistent with the SELinux case,
and only show errors in getting the security context
when -Z is specified.
2013-07-02 09:47:16 +01:00
Jarkko Sakkinen
7d5976f668 mkdir,mkfifo,mknod: with -Z, create SMACK security context
Enable creation of SMACK security context with -Z command-line switch
if SMACK is enabled.

* mkdir.c (main): Set process security context to given SMACK label.
* mkfifo.c (main): Likewise.
* mknod.c (main): Likewise.
* src/local.mk: link mk{dir, fifo, nod} with libsmack.
* NEWS: Mention the new feature.
2013-07-01 14:33:05 +01:00
D. Hugh Redelmeier
1b90421a1b doc: fix details on the interaction of df with device nodes
* man/df.x: Don't say that a dev node is always on the root file system.
* doc/coreutils.texi (df invocation): Likewise.  Also state that the
device node to mounted file system interpretation is only done when
passed absolute paths to device nodes.
2013-06-27 12:36:59 +01:00
Jarkko Sakkinen
cd510a676d ls: with -Z, show SMACK security context
Enable showing of file SMACK security with '-Z' command-line switch
if SMACK is enabled.  Showing SMACK context of a file does not strictly
require SMACK to be enabled but this required to make choice whether to
show SELinux or SMACK security context.

* src/ls.c (getfilecon_cache): Retrieve SMACK context if available.
(gobble_file): Handle SMACK context similarly to SELinux context.
* src/local.mk: Link lsl with libsmack.
* NEWS: Mention the new feature.
* .mailmap: Merge the Author's 2 email addresses.
2013-06-24 21:00:14 +01:00
Pádraig Brady
bc70095df2 stdbuf: make it mandatory to specify a buffering option
This is consistent with the documented interface and
avoids any ambiguity in a user thinking that stdbuf without options
might reset to a "standard" buffering setup.

* src/stdbuf.c (set_libstdbuf_options): Indicate with the return value
whether any env variables were actually set.
(main): Fail unless some env variables were set.
* tests/misc/stdbuf.sh: Ensure this constraint is enforced.
* NEWS: Mention the small change in behavior.
2013-06-22 04:02:19 +01:00
Pádraig Brady
b235223926 doc: clarify that truncate --size represents bytes by default
* src/truncate.c (usage): Mention that --size is in bytes which
is by far the most common usage.
* doc/coreutils.texi (truncate invocation): Likewise. Also cross
reference the --io-blocks option.
Reported in http://bugs.gnu.org/14686
2013-06-22 03:09:01 +01:00
Jarkko Sakkinen
2bc0281352 id: adjust/restrict smack support to newer versions of libsmack
There was slight change to libsmack such that positive values are
reserved for returning length of the label for smack_new_label_from_*
functions.

* m4/jm-macros.m4: Set HAVE_SMACK when both smack_new_label_from_self()
and recently added smack_new_label_from_path() are present.
The latter's presence indicates the newer API of the former.
* src/id.c (main): Check that smack_new_label_from_self() < 0,
and not just non-zero.
2013-06-20 21:50:57 +01:00
Pádraig Brady
2bb800dd41 tests: use appropriate precision when printing float limits
* src/getlimits.c (print_float): Adjust to use the ftoastr module,
which uses the appropriate precision so that no info is lost.
* cfg.mk (sc_prohibit_continued_string_alpha_in_column_1): Exclude od.c
fixes http://bugs.gnu.org/14650
2013-06-18 16:18:56 +01:00
Pádraig Brady
84f497195c maint: update gitignore entries
* .gitignore: Exclude the generated doc/manual directory,
and also the src/fs-latest-magic.h file referenced in README-release.
2013-06-13 11:30:41 +01:00
Pádraig Brady
63eea601d8 doc: clarify the description of du --separate-dirs
* src/du.c (usage): Clarify that --separate-dirs doesn't exclude
all directories.
* doc/coreutils.texi (du invocation): Avoid implying that -S
excludes the size of any non directory entries for a directory.
Also don't mention st_size as it's dependent on --apparent-size.
Reported by C de-Avillez in <https://launchpad.net/bugs/1187044>
2013-06-12 15:12:24 +01:00
Eric Blake
74cd098d2e doc: mention prior stat change
For a file of size 1234 bytes, commit ca9aa759 had the side effect
of changing 'stat -c "%'s" file' from outputting "?s" to the nicer
"1,234", depending on locale.  This is worth mentioning in the NEWS.

Resolves part of http://bugs.gnu.org/14556.

* NEWS: Mention 8.7 improvement in stat.
* cfg.mk (old_NEWS_hash): Adjust accordingly.
2013-06-05 14:22:25 -06:00
Bernhard Voelker
61d74b6764 build: update gnulib submodule; also bootstrap to latest
Notes tests/init.sh is still in sync with gnulib.

* bootstrap: Update to latest.
* gnulib: Update avoiding gnulib-test failures.
2013-06-05 11:41:19 +02:00
Pádraig Brady
eadf835794 tests: avoid a race in tail --retry testing
Prompted by the continuous integration build failure at:
http://hydra.nixos.org/build/5221053

* tests/tail-2/retry.sh: Ensure the 'out' file is truncated,
as it's used to arbitrate the run order of commands.
Relying on the truncation in the background tail command
is racy because the truncation can occur after the fork
of the background shell and thus wait4lines would not wait
for output to occur in 'out', which would mean that the
'missing' file could be populated by the time tail(1)
gets to process it.
2013-06-03 14:31:37 +01:00
Andreas Mohr
e3a34e14f5 doc: mention 'UTC' in date --utc help
src/date.c (usage): Make -u apparent in searches for UTC.
2013-06-03 00:43:53 +01:00
Jim Meyering
51a8f70713 od: -wN, N>64K, avoid misbehavior on systems with 32-bit size_t
* src/od.c (PRINT_FIELDS): Declare "i" to be of type uintmax_t, so that
the numerator in the expression for "next_pad" does not overflow.
(print_named_ascii): Likewise.
(print_ascii): Likewise.
Bug introduced via commit v6.12-42-g20c0b87.
* tests/misc/od.pl: Exercise each of the three affected code paths.
* NEWS (Bug fixes): Mention it.
Reported by Rich Burridge.
2013-06-02 09:25:38 -07:00
Jim Meyering
aeaeb87c13 tests: head-c: avoid spurious failure with a 32-bit size_t
* tests/misc/head-c.sh: Don't try to elide 1 exabytes, since on
32-bit systems, that number is not representable as a size_t.
This command would fail on 32-bit systems, where SIZE_MAX < 1E:
  head --bytes=-E < /dev/null
Instead of "E", use $SSIZE_MAX.
For discussion, see http://bugs.gnu.org/13530
2013-06-01 20:44:47 -07:00
Jim Meyering
5a7f03c210 tests: avoid spurious failure when SIZE_MAX is 2^32-1
* tests/split/line-bytes.sh: Since we've limited virtual memory to
20MB, choose a smaller size, 1GiB (which is <= SIZE_MAX) rather than
1EiB, which is larger than SIZE_MAX on 32-bit systems.
I confirmed that this test still fails when the split.c-modifying
part of v8.21-58-gfec363c is backed out.
2013-05-27 15:02:50 -07:00
Jim Meyering
909a0561de tests: fix an ls test not to fail when user or group name contains SP
* tests/ls/block-size.sh (size_etc): The sed expression through which
we filtered the output of "ls -l ..." assumed that the user and group
name components of each line would not contain spaces.  Avoid the
problem by using -og instead of -l, thus not printing either of those
fields.  Adjust the sed expression accordingly.
2013-05-26 19:06:55 -07:00
Stefano Lattarini
ba60445f73 tests: numfmt: use the printf program, not the shell builtin
* tests/misc/numfmt.pl: Avoid a spurious failure when
/bin/sh is dash (as can happen on Debian systems).
2013-05-27 00:24:00 +01:00
Paul Eggert
23356b02f2 stat: tune for large-LDAP case
* src/stat.c (print_stat): Omit unnecessary calls to setpwent, setgrent.
Problem reported by Fridolín Pokorný in	<http://bugs.gnu.org/14462>.
2013-05-24 10:21:51 -07:00
Pádraig Brady
fec363cebf split: with --line-bytes only allocate memory as needed
* src/split.c (line_bytes_split): Rewrite to only buffer
when necessary.  I.E. only increase the buffer when we've
already lines output in a split and we encounter a line
larger than the input buffer size, in which case a hold
buffer will be increased in increments of the input buffer size.
(lines_rr): Use the more abstract xalloc_die() just like
we did in line_bytes_split(), rather than explicitly
printing the "memory exhausted" message and exiting.
* tests/split/line-bytes.sh: Add a new test for this
function which previously had no test coverage.
* tests/local.mk: Reference the new test.
* NEWS: Mention the improvement.
Fixes http://bugs.gnu.org/13537
2013-05-23 11:13:24 +01:00
Paul Eggert
478dade09a maint: port --enable-gcc-warnings to clang
* configure.ac: If clang, add -Wno-format-extra-args and
-Wno-tautological-constant-out-of-range-compare.
* gl/lib/rand-isaac.c (ind):
* gl/lib/randread.c (readisaac):
* src/ls.c (dev_ino_push, dev_ino_pop):
* src/sort.c (buffer_linelim):
* src/system.h (is_nul):
* src/tail.c (tail_forever_inotify):
Rewrite to avoid casts that clang dislikes.
It's good to avoid casts anyway.
* src/expr.c (integer_overflow): Declare only if it exists.
(die): Remove; unused.
* src/ls.c (dev_ino_push): New function, replacing ...
(DEV_INO_PUSH): ... this removed macro.  All uses changed.
(decode_switches): Rewrite "str"+i to &str[i].
2013-05-18 17:55:07 -07:00
Paul Eggert
e605e40acf build: update gnulib submodule to latest 2013-05-18 17:55:02 -07:00
Paul Eggert
c704573729 tests: don't assume expr was built with GMP
* tests/misc/cut-huge-range.sh (subtract_one): New string.
(CUT_MAX): Don't pass a too-large integer to 'expr'.
2013-05-18 16:29:57 -07:00
Pádraig Brady
bd001dcd4a doc: link to the list of rejected feature requests
* README: Update the email address best suited to discussing
feature requests, and also link to the list of previously
discussed and rejected requests.
2013-05-12 13:04:27 +01:00
Jim Meyering
7c0191e145 build: avoid new syntax-check failure
* po/POTFILES.in: Reflect renaming.
2013-05-12 04:39:36 +02:00
Paul Eggert
8a2d91492c maint: add FIXME comment 2013-05-11 19:22:54 -07:00
Paul Eggert
e7198a67b8 mkdir: don't assume umask equals POSIX default ACL mask
This fixes Bug#14371, reported by Killer Bassist.
* NEWS: Document this.
* src/mkdir.c (struct mkdir_options): Remove member ancestor_mode.
New member umask_value.  All uses changed.
* src/mkdir.c (make_ancestor): Fix umask assumption.
* src/mkdir.c, src/mkfifo.c, src/mknod.c (main):
Leave umask alone.  This requires invoking lchmod after creating
the file, which introduces a race condition, but this can't be
avoided on hosts with "POSIX" default ACLs, and there's no easy
way with network file systems to tell what kind of host the
directory is on.
* tests/local.mk (all_tests): Add tests/mkdir/p-acl.sh.
* tests/mkdir/p-acl.sh: New file.
2013-05-11 19:22:54 -07:00
Paul Eggert
7b65f8e928 build: update gnulib submodule to latest 2013-05-11 19:22:54 -07:00
Jarkko Sakkinen
ca181728ee id: with -Z, show SMACK security context
Adds an optional dependency on libsmack.

* m4/jm-macros.m4: Look for the smack library/header.
* src/id.c (main): Output the smack context if available.
* src/local.mk: Link with libsmack if available.
* NEWS: Mention the new feature.
2013-05-08 11:55:08 +01:00
Cojocaru Alexandru
465f9512b7 cut: improve performance, especially with --output-delimiter
Use a sentinel value that's checked implicitly, rather than
a bit array, to determine if an item should be output.

Benchmark results for this change are:

$ yes abcdfeg | head -n1MB > big-file

$ for c in orig sentinel; do
    src/cut-$c 2>/dev/null
    echo -ne "\n== $c =="
    time src/cut-$c -b1,3 big-file > /dev/null
  done
== orig ==
real    0m0.049s
user    0m0.044s
sys     0m0.005s

== sentinel ==
real    0m0.035s
user    0m0.032s
sys     0m0.002s

 ## Again with --output-delimiter ##
$ for c in orig sentinel; do
    src/cut-$c 2>/dev/null
    echo -ne "\n== $c =="
    time src/cut-$c -b1,3 --output-delimiter=: big-file > /dev/null
  done
== orig ==
real    0m0.106s
user    0m0.103s
sys     0m0.002s

== sentinel ==
real    0m0.055s
user    0m0.052s
sys     0m0.003s

eol_range_start: Removed. 'n-' is no longer treated specially,
and instead SIZE_MAX is set for the 'hi' limit, and tested implicitly.
complement_rp: Used to complement 'rp' when '--complement' is specified.
ADD_RANGE_PAIR: Macro renamed to 'add_range_pair' function.
* tests/misc/cut-huge-range.sh: Adjust to the SENTINEL value.
Also remove the overlapping range test as this is no longer
dependent on large ranges and also is already handled with
the EOL-subsumed-3 test in cut.pl.
2013-05-08 11:51:37 +01:00
Cojocaru Alexandru
b54b47f954 cut: fix handling of overlapping ranges
This issue was introduced in commit v8.21-43-g3e466ad

* src/cut.c (set_fields): Process all range pairs when merging.
* tests/misc/cut-huge-range.sh: Add a test for this edge case.
Also fix an issue where we could miss reported errors due
to truncation of the 'err' file.
2013-05-07 13:07:02 +01:00
Pádraig Brady
7fbe8f4686 doc: correct a URL to older textutils source
* doc/coreutils.texi (Putting the tools together): Adjust the
textutils-1.22 URL, and add a URL for newer sources.
2013-04-30 11:52:03 +01:00
Pádraig Brady
791919f6d9 cut: reduce CPU usage for the the common case
Ensure appropriate functions are inlined.  This was seen to
be required with gcc 4.6.0 with -O2 on x86_64 at least.
It was reported that gcc 4.8.0 did inline these functions though.

Also reinstate the bit vector for the common case,
to further improve performance.

Benchmark results for both aspects of this change are:

$ yes abcdfeg | head -n1MB > big-file
$ for c in orig inline inline-array; do
    src/cut-$c 2>/dev/null
    echo -ne "\n== $c =="
    time src/cut-$c -b1,3 big-file > /dev/null
  done

== orig ==
real    0m0.088s
user    0m0.081s
sys     0m0.007s

== inline ==
real    0m0.070s
user    0m0.060s
sys     0m0.009s

== inline-array ==
real    0m0.049s
user    0m0.044s
sys     0m0.005s

* src/cut.c (set_fields): Set up the printable_field bit vector
for performance, but only when it's appropriate.  I.E. not
when either --output-delimeter or huge ranges are specified.
(next_item): Ensure it's inlined and avoid unnecessary processing.
(print_kth): Ensure it's inlined and add a branch for the fast path.
Related to http://bugs.gnu.org/13127
2013-04-29 17:54:39 +01:00
Cojocaru Alexandru
ef9db5735a cut: reduce CPU overhead in determining item to output
print_kth() is the central function of cut used to
determine if an item is to be output or not,
so simplify it by moving some logic outside.
Benchmark results for this change are:

$ yes abcdfeg | head -n1MB > big-file
$ for c in orig split; do
    src/cut-$c 2>/dev/null
    echo -ne "\n== $c =="
    time src/cut-$c -b1,3 big-file > /dev/null
  done

== orig ==
real    0m0.111s
user    0m0.108s
sys     0m0.002s

== split ==
real    0m0.088s
user    0m0.081s
sys     0m0.007s

* src/cut.c (print_kth): Refactor a branch to outside the function.
Related to http://bugs.gnu.org/13127
2013-04-29 17:54:39 +01:00
Cojocaru Alexandru
3e466ad051 cut: make memory allocation independent of range width
The current implementation of cut, uses a bit array,
an array of `struct range_pair's, and (when --output-delimiter
is specified) a hash_table.  The new implementation will use
only an array of `struct range_pair's.
The old implementation is memory inefficient because:
 1. When -b with a big num is specified, it allocates a lot of
    memory for `printable_field'.
 2. When --output-delimiter is specified, it will allocate 31 buckets.
    Even if only a few ranges are specified.

Note CPU overhead is increased to determine if an item is to be printed,
as shown by:

$ yes abcdfeg | head -n1MB > big-file
$ for c in with-bitarray without-bitarray; do
    src/cut-$c 2>/dev/null
    echo -ne "\n== $c =="
    time src/cut-$c -b1,3 big-file > /dev/null
  done

== with-bitarray ==
real    0m0.084s
user    0m0.078s
sys     0m0.006s

== without-bitarray ==
real    0m0.111s
user    0m0.108s
sys     0m0.002s

Subsequent patches will reduce this overhead.

* src/cut.c (set_fields): Set and initialize RP
instead of printable_field.
* src/cut.c (is_range_start_index): Use CURRENT_RP rather than a hash.
* tests/misc/cut.pl: Check if `eol_range_start' is set correctly.
* tests/misc/cut-huge-range.sh: Rename from cut-huge-to-eol-range.sh,
and add a test to verify large amounts of mem aren't allocated.
Fixes http://bugs.gnu.org/13127
2013-04-29 17:54:27 +01:00
Pádraig Brady
e414ff4c4c stat,tail: improve support for snfs
The StorNext distributed file system was previously known as CVFS.

* src/stat.c (human_fstype): Add new file system ID definition.
* NEWS: Mention the improvement.
Fixes http://bugs.gnu.org/14251
2013-04-28 03:43:40 +01:00
Pádraig Brady
94f4f658f0 tests: fix usage of require_ulimit_
* init.cfg (require_ulimit_v_): Renamed from require_ulimit_
as this only checks for ulimit -v support.  Other uses of
ulimit -t and ulimit -n in tests shouldn't cause false failures
if not supported.
* cfg.mk (sc_prohibit_test_ulimit_without_require_): A new syntax check
to ensure that require_ulimit_v_() is used iff required.
* tests/misc/head-c.sh: Add missing call to require_ulimit_v_.
* tests/rm/many-dir-entries-vs-OOM.sh: Likewise.
* tests/split/r-chunk.sh: Remove non mandatory require_ulimit_ call.
* tests/misc/sort-merge-fdlimit.sh: Likewise.
* tests/cp/link-heap.sh: Adjust to renamed require_ulimit_v_.
* tests/dd/no-allocate.sh: Likewise.
* tests/misc/csplit-heap.sh: Likewise.
* tests/misc/cut-huge-to-eol-range.sh: Likewise.
* tests/misc/printf-surprise.sh: Likewise.
2013-04-25 11:13:48 +01:00
Jim Meyering
090294b0e4 scripts: tweak URLs in autotools-install
* scripts/autotools-install (tarballs): Use http:// URLs rather
than ftp:// ones.  The former are more likely to work, these days.
Update URLs to point to the latest versions.
2013-04-22 10:26:25 -07:00
Bernhard Voelker
8f97679836 tail: exit following by descriptor when no tailable file left
As a side effect of the previous commit which fixes 'tail -f --retry'
to wait for a file to appear, tail would not exit when the last file
appears untailable and gives up on this file.
This can happen, for example, when the argument file name appears
as directory.  Tail sets the 'ignore' flag of this file to true,
but instead of exiting the program, tail would continue the loop.

* src/tail.c (any_live_files): Change the function to return true
if any of the files is still tailable or if tail should continue to
try to check again.
(tail_forever): Change the condition to break the loop in the
"no files remaining" case, because now any_live_files() will care
about it, as mentioned above.
(parse_options): When --retry is used without any follow mode,
then reset reopen_inaccessible_files to false.
* tests/tail-2/retry.sh: Add test case.
2013-04-20 16:34:23 +02:00
Bernhard Voelker
d461bfd274 tail: let -f --retry wait for inaccessible files
The --retry option is indeed useful for both following modes
by name and by file descriptor.  The difference is that in the
latter case, it is effective only during the initial open.

As a regression of the implementation of the inotify support,
tail -f --retry would immediately exit if the given file is
inaccessible.

* src/tail.c (usage): Change the description of the --retry option:
remove the note that this option would mainly be useful when
following by name.
(main): Change diagnosing dubios uses of --retry option:
when the --retry option is used without following, then issue
a warning that this option is ignored; when it is used together
with --follow=descriptor, then issue a warning that it is only
effective for the initial open.
Disable inotify also in the case when the initial open in tail_file()
failed (which is the actual bug fix).
* init.cfg (retry_delay_): Pass excess arguments to the test function.
* tests/tail-2/retry.sh: Add new tests.
* tests/local.mk (all_tests): Mention it.
* doc/coreutils.texi (tail invocation): Enhance the documentation
of the --retry option.  Clarify the difference in tail's behavior
regarding the --retry option when combined with the following modes
name versus descriptor.
* NEWS (Bug fixes): Mention the fix.

Reported by Noel Morrison in:
http://lists.gnu.org/archive/html/coreutils/2013-04/msg00003.html
2013-04-20 16:33:06 +02:00
Pádraig Brady
1dd8a33169 tests: avoid false failures with non default groups
On OS X it was seen that the group ID used for new files,
are set to a that of the directory rather than the current user.
It's not currently understood when this happens, but it was confirmed
that ACLs, extended attributes and setgid bits are _not_ involved.

* init.cfg (skip_if_nondefault_group_): A new function to detect
and avoid this situation.  Document with links to the discussions
for hopefully future clarification.
* tests/install/install-C-root.sh: Use the new function.
* tests/install/install-C-selinux.sh: Likewise.
* tests/install/install-C.sh: Likewise.
2013-04-14 01:03:56 +01:00
Pádraig Brady
c8ac385299 doc: mention caveats with using install --compare
* doc/coreutils.texi (install invocation): Mention that install(1) may
not correctly determine the default user or permissions for installed
files, and so is best used with options specifying these attributes.
2013-04-14 01:03:41 +01:00
Pádraig Brady
1fe218888a head: with --bytes=-N only allocate memory as needed
* src/head.c (elide_tail_bytes_pipe): Don't use calloc as that
bypasses memory overcommit due to the zeroing requirement.
Also realloc rather than malloc the pointer array to avoid
dependence on overcommit entirely.
* tests/misc/head-c.sh: Add a test case.
Fixes http://bugs.gnu.org/13530
2013-04-14 01:01:21 +01:00
Ondrej Oprala
8901e010fa dd: avoid buffer allocations unless needed
* src/dd.c: Add new static global variable ibuf.
(alloc_ibuf, alloc_obuf): New functions factored from dd_copy().
(dd_copy): Call the new functions to allocate memory for
ibuf and obuf when necessary.
(skip): Likewise.
* tests/dd/no-allocate.sh: New test.
* tests/local.mk: Reference the test.
2013-04-14 01:00:45 +01:00
Assaf Gordon
4114c93af3 csplit: add the --suppress-matched option
With --suppress-matched, the lines that match the pattern will not be
printed in the output files.  I.E. the first line from the second
and subsequent splits will be suppressed.

* src/csplit.c: process_regexp(),process_line_count(): Don't output the
matched lines.  Since csplit includes "up to but not including" matched
lines in each split, the first line (in the next group) is the matched
line - so just skip it.
main(): Handle new option.
usage(): Mention new option.
* doc/coreutils.texi (csplit invocation): Mention new option, examples.
* tests/misc/csplit-suppress-matched.pl: New test script.
* tests/local.mk: Reference the new test.
* NEWS: Mention new feature.
2013-04-10 14:34:52 +01:00
Enrico Scholz
ec02161aef build: fix man page build failure with some permissions setups
Use the more portable 'chmod a-w', instead of the 'chmod -w' form.
The latter is not always supported.  Also its operation is
dependent on umask controlling the permissions bits for new files,
which is not the case in the presence of POSIX default ACLs for e.g.
In that case, chmod may print a warning like the following, and
exit with failure status:

chmod: man/hostid.1-t: new permissions are r--rw-r--, not r--r--r--

* man/local.mk: s/-w/a-w/
2013-04-07 11:53:17 +01:00
Pádraig Brady
e92d16f68a tests: avoid shared lib tests on unsupported platforms
* init.cfg (require_gcc_shared_): A new function to check
that we can build shared libraries in the particular manner
we use in our tests.
* tests/cp/nfs-removal-race.sh: Use require_gcc_shared_.
Then fail rather than skip, if the actual shared lib build fails.
* tests/df/no-mtab-status.sh: Likewise.
* tests/df/skip-duplicates.sh: Likewise.
* tests/ls/getxattr-speedup.sh: Likewise.
Reported in http://bugs.gnu.org/14024
2013-04-04 03:02:10 +01:00
Pádraig Brady
7abf99e190 tail: exit without reading input if would never output
* src/tail.c (main): If -n0 or -c0 were specified without -f,
then no data would ever be output, so exit without reading input.
* tests/tail-2/tail-n0f.sh: Augment the related test with this case.
2013-04-04 03:01:48 +01:00
Pádraig Brady
f7867e73ca shuf: exit without reading if would never output
* src/shuf.c (main): If -n0 specified then no data would ever be output,
so exit without reading input.
* tests/misc/shuf.sh: Augment the related test with this case.
2013-04-04 02:55:55 +01:00
Pádraig Brady
34023817cb doc: add details on ln --relative symlink resolution
* doc/coreutils.texi (ln invocation): Describe how symlinks are
resolved with --relative, and give an example showing the greater
control available through realpath(1).
* tests/ln/relative.sh: Add a test to demonstrate full symlink
resolution, in a case where it might not be wanted.
2013-04-04 02:46:52 +01:00
Rémy Lefevre
e52293aa7f ln: --relative: fix updating of existing symlinks
Don't dereference an existing symlink being replaced.
I.E. generate the symlink relative to the symlink's containing dir,
rather than to some arbitrary place it points to.

* src/ln.c (convert_abs_rel): Don't consider the final component
of the symlink name when canonicalizing, as we want to avoid
dereferencing the final component.
* tests/ln/relative.sh: Add a test case.
* NEWS: Mention the fix.
Resolves http://bugs.gnu.org/14116
2013-04-04 02:46:35 +01:00
Assaf Gordon
20d7bce0f7 shuf: use reservoir-sampling for large or unknown sized inputs
Reservoir sampling optimizes selecting K random lines from large or
unknown-sized input: http://en.wikipedia.org/wiki/Reservoir_sampling
Note this also avoids reading any input when -n0 is specified.

* src/shuf.c (main): Use reservoir-sampling when the number of output
lines is known, and the input size is large or unknown.
(input_size): A new function to get the input size for regular files.
(read_input_reservoir_sampling): New function to read lines from input,
keeping only K lines in memory, replacing lines with decreasing prob.
(write_permuted_output_reservoir): New function to output reservoir.
* tests/misc/shuf-reservoir.sh: An expensive_ test using valgrind to
exercise the reservoir-sampling code.
* tests/local.mk: Reference new test.
* NEWS: Mention the improvement.
2013-03-25 20:07:14 +00:00
Pádraig Brady
4c49dc823f stat,tail: improve support for efivarfs, exofs, f2fs and ubifs
* src/stat.c (human_fstype): Add new file system ID definitions.
* NEWS: Mention the improvement.
Fixes http://bugs.gnu.org/14020
2013-03-24 02:30:20 +00:00
Pádraig Brady
bb9197c406 maint: improve make src/fs-magic-compare
* README-release: fix the `make` command, and mention how
to get the latest results without requring running a
system with the latest kernel.
* src/local.mk (src/fs-latest-magic.h): A new target to
document how/where to place the latest magic header.
(src/fs-kernel-magic): Adjust to include separately
downloaded header if available.
(src/fs-magic): Undefine MANPAGER as it may impact the
ability to pipe the output of man(1).
(fs-magic-compare): Don't echo the commands run as they're
distracting from the output which needs to be examined.
2013-03-24 02:29:57 +00:00
Pádraig Brady
dc4fbb99a9 build: fix issues when building with GMP
* m4/gmp.m4 (cu_GMP): Add an extra check that gmp.h is available
which is required on one Mac OS X 10.5.8 system at least,
where the lib was available but the header wasn't.
Also enable our GMP code on systems where GMP is not in a separate lib.
2013-03-24 02:28:38 +00:00
Pádraig Brady
a24e4a01ca doc: clarify the printable characters output by od
* src/od.c (usage): Mention any printable character is output,
Not just ASCII.
* doc/coreutils.texi (od invocation): Further clarify that only
single byte characters are output (due to the alignment requirement).
Also mention the fact that 3 digit octal sequences are output
for non printable characters without a corresponding C escape.
Reported in http://bugs.gnu.org/13947
2013-03-22 16:18:45 +00:00
Pádraig Brady
3324282665 doc: clarify stat the meaning of --format="%t %T"
* src/stat.c (usage): Mention that the values are only
defined for character and block special files.
* doc/coreutils.texi (stat invocation): Likewise.
Also mention st_rdev.
Reported in http://bugs.gnu.org/13927
2013-03-22 08:58:30 +00:00
Pádraig Brady
2c2d0b3644 doc: mention numfmt as an alternative to sort -h
* doc/coreutils.texi (sort invocation): Mention that numfmt
can achieve the same results with a possibly more accurate sort.
2013-03-06 16:15:23 +00:00
Pádraig Brady
e57d5c2bf8 doc: remove a redundant numfmt heading from texinfo
* doc/coreutils.texi (detailmenu): Remove the redundant numfmt heading.
2013-03-06 16:15:23 +00:00
Pádraig Brady
78cd77c16f maint: ensure proper backslash quoting in texinfo macros
* doc/coreutils.texi (ambiguousGroupNote): Ensure '\' is escaped
appropriately within the macro.  This was verified to generate
a single '\' in both "info" and "pdf" outputs.
2013-03-06 16:15:22 +00:00
Torbjörn Granlund
9fe7c5b6eb build: fix factor build failure on aarch64
* src/longlong.h (__aarch64__): Make add_ssaaaa and sub_ddmmss work.
* NEWS: Mention the build fix.
Reported at https://bugzilla.redhat.com/917735
2013-03-04 18:09:49 +00:00
Assaf Gordon
0a16f9732d tests: don't skip all uniq tests when locale is missing
* tests/misc/uniq.pl: Previously, if LOCALE_FR was not defined, all
tests would be skipped. Modified to skip only the relevant test.
2013-02-28 23:35:45 +00:00
Assaf Gordon
374f569579 uniq: add the --group option
* src/uniq.c (usage): Summarize the new option,
and adjust the --all-repeated option to be more consistent.
(check_file): Merge the --group functionality into
the core loop for the default uniq operation since
it's very similar and can output lines immediately upon reading.
(main): Handle the new --group option and make it
mutually exclusive with other selection options.
* tests/misc/uniq.pl: Add tests.
* NEWS: Mention the new feature.
* doc/coreutils.texi (uniq invocation): Describe --group.
2013-02-28 18:20:30 +00:00
Pádraig Brady
8b6d3c5700 doc: move some info from all --help messages, online
* src/system.h (emit_ancillary_info): Link to the bug report email
addresses and general help URLs online rather than specifying directly.
This give us greater scope to present better info like describing
the difference between bug-coreutils@gnu.org and coreutils@gnu.org etc.
* tests/misc/help-version.sh: Remove the check for bug-coreutils@gnu.org
* tests/local.mk: Remove the no longer needed PACKAGE_BUGREPORT.
2013-02-28 11:03:01 +00:00
Assaf Gordon
8682142ff2 tests: add '--ignore-case' tests for uniq
* tests/misc/uniq.pl: add tests for --ignore-case.
2013-02-28 03:36:35 +00:00
Javier López
4c4f9e1173 dircolors: add a new entry to colorize 'arc' files
* src/dircolors.hin: Add an entry for arc.  Suggested in:
https://bugs.launchpad.net/ubuntu/+source/coreutils/+bug/1088131
2013-02-28 03:33:14 +00:00
Assaf Gordon
6eb51ce29e join: Add the -z, --zero-terminated option
* NEWS: Mention join's new option: --zero-terminated (-z).
* src/join.c: Add new option, --zero-terminated (-z), to make
join use the NUL byte as separator/delimiter rather than newline.
(get_line): Use readlinebuffer_delim in place of readlinebuffer.
(main): Handle the new option.
(usage): Describe new option the same way sort does.
* doc/coreutils.texi (join invocation): Describe the new option.
* tests/misc/join.pl: add tests for -z option.
2013-02-28 01:49:56 +00:00
Ondřej Vašík
551128ebd7 dircolors: add new entries to colorized archive formats
* src/dircolors.hin:  Add .cab, .alz, .lzo, .lrz, .t7z, .tzo, .lha
to colorized archives.
Suggested by Ville Skyttä in https://bugzilla.redhat.com/868510
2013-02-28 01:21:50 +00:00
Ondrej Oprala
3a20f68885 install: cleanup properly if the strip program failed for any reason
* src/install.c (strip): Indicate failure with a return code instead
of terminating the program.
(install_file_in_file): Handle strip's return code and unlink the
created file if necessary.
* tests/install/strip-program.sh: Add a test to cover the changes.
* NEWS (Bug fixes): Mention the fix.
Reported by John Reiser in http://bugzilla.redhat.com/632444.
2013-02-22 21:31:32 +01:00
Joachim Schmitz
6229654741 copy: ensure the correct root ID is checked on all platforms
* src/copy.c (copy_reg): Check ROOT_UID rather than 0,
which is significant on HP-NonStop.
2013-02-20 04:05:30 +00:00
Pádraig Brady
31861f663a maint: cleanup up various uses of __attribute__
* src/cfg.mk (sc_prohibit-gl-attributes): Disallow the __attribute()
form without trailing underscores as that is not elided where required.
Also ensure we use gnulib macros rather than defining our own.
* src/system.h: Remove gnulib provided macros.
* src/chown-core.c: Likewise.
* src/chroot.c: Likewise.
* src/copy.c: Likewise.
* src/csplit.c: Likewise.
* src/dd.c: Likewise.
* src/expr.c: Likewise.
* src/extent-scan.c: Likewise.
* src/factor.c: Likewise.
* src/ls.c: Likewise.
* src/od.c: Likewise.
* src/paste.c: Likewise.
* src/ptx.c: Likewise.
* src/sort.c: Likewise.
* src/stat.c: Likewise.
* src/stty.c: Likewise.
* src/system.h: Likewise.
* src/tac.c: Likewise.
* src/test.c: Likewise.
* src/tsort.c: Likewise.
2013-02-20 04:04:25 +00:00
Joachim Schmitz
04b035670d build: fix numfmt build error on compilers without __attribute
* src/numfmt.c (): Use the more standard _GL_ATTRIBUTE_PURE
which is elided where required.
Reported in http://bugs.gnu.org/10305
2013-02-20 04:04:25 +00:00
Pádraig Brady
b469fa044a tests: avoid false failures on file systems with smaller NAME_MAX
* tests/du/long-from-unreadable.sh: This test requires a NAME_MAX
of at least 200, so skip the test otherwise.
* tests/rm/deep-2.sh: Likewise.
Reported by C de-Avillez with ecryptfs where NAME_MAX = 143.
2013-02-20 04:04:00 +00:00
Stefano Lattarini
5bff307bdb maint: choose editor in the commit-msg git hook the same way git does
Git honours the GIT_EDITOR environment variable, the "core.editor" Git
configuration variable, and the EDITOR environment variable (in that
order, and defaulting to "vi" if none of them is set) to decide which
editor should be invoked for the user when he has to or want to edit
his commit message.

However, our commit-msg hook, when invoking an editor on behalf of the
user to allow him to fix a non-policy-complaint commit message, only
honoured the EDITOR environment variable.  To avoid potential annoying
inconsistencies, we should really use the same logic used by Git in the
selection of the editor.  Luckily, we don't have to duplicate this
logic (that would be brittle in the long term), as we can rely on the
"git var" command, designed exactly to be used in situations like this.

* scripts/git-hooks ($editor): Adjust definition.
2013-02-18 01:28:49 +00:00
Stefano Lattarini
bf7b0e0358 maint: don't reset PATH in the commit-msg git hook
I have a custom 'editor' script in ~/bin, and a system-provided
'editor' program in /usr/bin (on Debian, this is a link set up the
"debian alternatives" subsystem).  My '$EDITOR' and '$GIT_EDITOR'
variables are set simply to 'editor' (no absolute path), which I
expect should point to my 'editor' script, since ~/bin precedes
/usr/bin in my PATH definition.  But the 'commit-msg' hook used in
coreutils unconditionally resets its PATH to '/bin:/usr/bin', which
causes it to call the "wrong" editor (the one in /usr/bin, not the
one in ~/bin) when it makes me update a botched commit message.

* scripts/git-hooks: Don't reset $ENV{PATH} to '/bin:/usr/bin',
which was only done to avoid failure when enabling Perl's taint
checking.
2013-02-18 01:27:47 +00:00
Bernhard Voelker
c53c5e2395 maint: prevent trailing period at first line of a commit message
* scripts/git-hooks/commit-msg (bad_first_line): Return an error
message if the first line of a commit message ends with a period.
2013-02-14 23:19:57 +01:00
Pádraig Brady
44715883e1 maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2013-02-14 16:23:45 +00:00
Pádraig Brady
1cb8e6392c version 8.21
* NEWS: Record release date.
2013-02-14 15:52:18 +00:00
Pádraig Brady
4f03385e9b tests: avoid non portable sed use of \t
* tests/du/threshold.sh: use `cut` rather than
sed to avoid using the non portable \t which
fails on sed on openbsd 5 at least.
Also remove a redundant call to `tr` and avoid
explicit setting of LANG=C which is done globally.
2013-02-14 14:49:31 +00:00
Pádraig Brady
3025644443 build: avoid link failure in devmsg() on older linkers
On linkers that don't remove unused functions,
there will be a reference to a missing dev_debug symbol
in the devmsg() function.  So for now ...

* src/system.h: ... move devmsg() from here ...
* src/numfmt.c: ... to here, and document future cleanup.
* src/factor.c: Likewise.
2013-02-14 03:24:46 +00:00
Assaf Gordon
fff11aca4f numfmt: fix strtol() return code handling
src/numfmt.c (parse_format_string): On some systems, strtol() returns
EINVAL if no conversion was performed.  So only handle ERANGE here,
and handle other format errors directly.
2013-02-13 22:20:10 +00:00
Bernhard Voelker
54cdb0e88b maint: avoid running check-root tests in gnulib
* tests/local.mk (check-root): Restrict to SUBDIRS=. as traversing
into gnulib-tests induces a false failure.
2013-02-11 10:30:04 +00:00
Pádraig Brady
6c1a3b0a29 doc: improve the numfmt man page format
* src/numfmt.c (usage): Keep a single space between the "K = 1000",
so that it's not displayed on a separate line.  Also place ','
between each unit entry to improve readability.
2013-02-11 10:24:26 +00:00
Benno Schulenberg
b5f45b640c doc: standardize helptext of numfmt and slice into single options
* src/numfmt.c (usage): Correct synopsis and make command description
clearer.  Start option descriptions with lowercase letter; use
semicolon instead of period where needed; indent continuation lines;
gettextize single options for ease of translation and maintenance;
sort options alphabetically.
* doc/coreutils.texi (numfmt invocation): Sort numfmt options
alphabetically.  Enforce double-blank-after-period style.

This addresses http://bugs.gnu.org/13681.
Improved-by: Bernhard Voelker
2013-02-10 23:00:54 +01:00
Pádraig Brady
3309e880fb maint: consolidate developer debug messages
Both factor and numfmt recently introduced debug messages
for developers, enabled by --verbose and ---devdebug respectively.
There were a few issues though:
 1. They used different mechanisms to enable these messages.
 2. factor used --verbose which might be needed for something else
 3. They used different methods to output the messages,
    and numfmt used error() which added an unwanted newline
 4. numfmt marked all these messages for translation and factor
    marked a couple.  We really don't need these translated.
So we fix the above issues here while renaming the enabling
option for both commands to ---debug (still undocumented).

* src/factor.c (verbose): Rename to dev_debug and change from int to
bool as it's just a toggle flag.
(long_options): Rename --verbose to ---debug.
* src/system.h (devmsg): A new inline function to output a message
if enabled by a global dev_debug variable in the compilation unit.
* src/numfmt.c: Use devmsg() rather than error().
Also remove the translation tags from these messages.
Also change debug flag to bool from int.
* tests/misc/numfmt.pl: Adjust for the ---devdebug to ---debug change.
* cfg.mk (sc_marked_devdiagnostics): Add a syntax check to ensure
translations are not added to devmsg calls.

Reported by Göran Uddeborg in http://bugs.gnu.org/13665
2013-02-10 20:30:53 +00:00
Pádraig Brady
71ab11eac1 tests: tail-2/inotify-rotate: fix a false failure on NFS
* tests/tail-2/inotify-rotate.sh: Avoid a subshell with bash,
which in turn causes the `kill` to be ineffective to the tail
processes (as the SIGTERM is sent to the subshell which doesn't
propagate the signal on to its children).  On NFS the test
cleanup will then fail as there will be .nfs files maintained
in the directory for the files still opened by the tail processes.
Reported by Bernhard Voelker.
2013-02-10 05:05:38 +00:00
Pádraig Brady
54deb54db9 tests: skip numfmt grouping tests on some systems
* tests/misc/numfmt.pl: When the system locale grouping doesn't
match our expected format for grouping 1234 in the fr_FR locale,
reset the locale to 'C' so as to skip all locale tests.
2013-02-10 05:04:09 +00:00
Jim Meyering
1f1f41db85 tests: avoid actual/expected mismatch due to changed diagnostic
* tests/cp/fail-perm.sh: Adjust expected diagnostic to match
just-changed cp diagnostic.
* tests/ln/hard-to-sym.sh: Likewise.
* .mailmap: Also map my new address.
2013-02-07 20:02:45 +01:00
Pádraig Brady
786db9ef54 build: update gnulib submodule; also bootstrap to latest
Notes tests/init.sh is still in sync with gnulib

* bootstrap: update to latest
* gnulib: update avoiding secure_getenv and subsequent patches
as these are reported to fail on FreeBSD at least.
2013-02-07 16:47:45 +00:00
Benno Schulenberg
a1ee5cd714 maint: improve error messages upon failed read, write, access, close
Note we use "failed to {access,close}" for those single operations,
and "error {read,writ}ing" for those partial operation failures.

* src/copy.c: Improve error messages for failing read, write and close.
* src/cp.c: Improve error messages for failing access.
* src/dd.c: Improve error messages for failing read, write and open.
* src/head.c: Improve error message for failing close.
* src/install.c: Improve error messages for failing access.
* src/ln.c: Likewise.
* src/mv.c: Likewise.
* src/touch.c: Improve error message for failing close.
* src/truncate.c: Likewise.
2013-02-06 15:57:34 +00:00
Assaf Gordon
6a404ec165 doc: fix a numfmt help section typo
* src/numfmt.c (usage): Change erroneous "G" to "M".
2013-02-05 16:16:19 +00:00
Ondřej Vašík
4b84062d66 stty: add support for DTR/DSR hardware control flow
Originally requested in Red Hat bugzilla #445213.

* src/stty.c (mode_info): Add support for DTR/DSR hardware flow control,
if available.
* doc/coreutils.texi: Document it.
* tests/misc/stty.sh: Add it to the list of serial options to avoid.
* NEWS: Mention the improvement.
2013-02-05 16:05:54 +00:00
Pádraig Brady
51b3ba842d numfmt: correct a printf format
Prompted by the continuous integration build failure at:
http://hydra.nixos.org/build/4010493

* src/numfmt.c (parse_format_string): Correct both sign and size of
a printf format, which only gives a warning on 32 bit builds.
2013-02-05 15:49:42 +00:00
Assaf Gordon
8a303a8963 numfmt: a new command to format numbers
* AUTHORS: Add my name.
* NEWS: Mention the new program.
* README: Reference the new program.
* src/numfmt.c: New file.
* src/.gitignore: Ignore the new binary.
* build-aux/gen-lists-of-programs.sh: Update.
* scripts/git-hooks/commit-msg: Allow numfmt: commit prefix.
* po/POTFILES.in: Add new c file.
* tests/misc/numfmt.pl: A new test file giving >93% coverage.
* tests/local.mk: Reference the new test.
* man/.gitignore: Ignore the new man page.
* man/local.mk: Reference the new man page.
* man/numfmt.x: A new template.
* doc/coreutils.texi: Document the new command.
2013-02-04 23:40:32 +00:00
Pádraig Brady
be7932e863 cut: fix a segfault with disjoint open ended ranges
Fixes the issue introduced in unreleased commit v8.20-60-gec48bea.

* src/cut.c (set_fields): Don't access the bit array if
we've an open ended range that's outside any finite range.
* tests/misc/cut.pl: Add tests for this case.
Reported by Marcel Böhme in http://bugs.gnu.org/13627
2013-02-04 13:55:01 +00:00
Paul Eggert
d57ebc45ba doc: say how to tac char-by-char
This fixes Bug#12115, reported by Reuben Thomas.
* doc/coreutils.texi (tac invocation): Document how to reverse a
file character by character.  Break out MS-DOS into a separate
section, like 'cat' does.
2013-02-01 13:33:21 -08:00
Bernhard Voelker
f25519d688 df: do not treat rootfs specially
Like any other pseudo file system, df should show rootfs only
when the -a option is specified, i.e. specifying -trootfs alone
is not sufficient.  As the rootfs entry is now elided by the
general deduplication in filter_mount_list (commit v8.20-103-gbb116d3),
all other references to rootfs can be removed again.

* src/df.c (show_rootfs): Remove global variable.
(ROOTFS): Remove constant.
(filter_mount_list): Remove case to handle rootfs specially.
(main): In the case for handling the -t option, remove setting
of the show_rootfs variable.
* tests/df/skip-rootfs.sh: Adapt the test case "df -t rootfs":
the rootfs file system must not be printed (because no -a).
* doc/coreutils.texi (df invocation): Correct the documentation
about eliding mount entries: it is not the first occurrence of
the the device which wins, but now rather the entry with the
shortest mount point name.  Also adapt the description about
eliding pseudo file system types like rootfs.
* NEWS (Changes in behavior): Adapt entry.
2013-01-28 14:56:44 +01:00
Ondrej Oprala
bb116d35bf df: prefer fullpath entries when deduplicating
* src/df.c (struct devlist): Add a new element for storing
pointers to mount_entry structures.
(devlist_head, dev_examined): Remove.
(filter_mount_list): Add new function to filter out the rootfs
entry (unless -trootfs is specified), and duplicities. The
function favors entries with a '/' character in me_devname
or those with the shortest me_mountdir string, if multiple
entries fulfill the first condition.
Use struct devlist to build up a list of entries already known,
and finally rebuild the global mount_list.
(get_all_entries): Call the above new function unless the -a
option is specified.
(get_dev): Remove the code for skipping rootfs and duplicities.
* tests/df/skip-duplicates.sh: Add test cases.

Co-authored-by: Bernhard Voelker <mail@bernhard-voelker.de>
2013-01-27 18:43:58 +01:00
Stephan Krempel
f8c0258d46 timeout: ensure a blocked SIGALRM from the parent is unblocked
* src/timeout.c (unblock_signal): A new function to unblock a
specified signal, or warn if not possible.
(set_timeout): Ensure SIGALRM is unblocked before we setup the timer.
* tests/misc/timeout-blocked.pl: A new test for the issue.
* tests/local.mk: Reference the new test.
* NEWS: Mention the fix.
Fixes: http://bugs.gnu.org/13535
2013-01-26 02:38:52 +00:00
Pádraig Brady
2238ab5741 seq: fix to always honor the step value
* src/seq.c (main): With 3 positive integer args we were
checking the end value was == "1", rather than the step value.
* tests/misc/seq.pl: Add tests for this case.
Reported by Marcel Böhme in http://bugs.gnu.org/13525
2013-01-26 02:37:13 +00:00
Pádraig Brady
326e5855bc seq: fix misaligment with -w when no precision for start value
* src/seq.c (get_default_format): Also account for the case where '.'
is auto added to the start value, which is significant when the
number sequence narrows.
* tests/misc/seq.pl: Add two new tests for the failing cases.
* NEWS: Mention the fix.
Fixes http://bugs.gnu.org/13394
2013-01-26 02:35:58 +00:00
Pádraig Brady
d302aed182 cut: fix -f to work with the -d$'\n' edge case
* src/cut.c (cut_fields): Handle the edge case where '\n' is
the delimiter, which could be used for example to suppress
the last line if it doesn't contain a '\n'.
* test/misc/cut.pl: Add tests for this edge case.
2013-01-26 02:31:59 +00:00
Pádraig Brady
51ce0bf844 cut: with -f, process each line independently
Previously line N+1 was inspected before line N was fully output,
which causes output ordering issues at the terminal or delays
from intermittent sources like tail -f.

* src/cut.c (cut_fields): Adjust so that we record the
previous output character so we can use that info to
determine wether to output a '\n' or not.
* tests/misc/cut.pl: Add tests to ensure existing
functionality isn't broken.
* NEWS: Mention the fix.
Fixes bug http://bugs.gnu.org/13498
2013-01-26 02:31:53 +00:00
Paul Eggert
a46d8d02f2 build: update gnulib submodule to latest
* bootstrap.conf (gnulib_modules): Add statat.
The fstatat module was split in two, and we need both halves.
2013-01-23 20:06:41 -08:00
Pádraig Brady
ae29897e70 doc: fix an example in the od man page
* man/od.x: s/-w 16/-w16/ as -w takes an optional
parameter and so the space is significant.
2013-01-24 01:38:17 +00:00
Bernhard Voelker
ec68354dc6 doc: fix order of du options in usage and texinfo manual
* src/du.c (usage): Bring options into alphabetical order.
* doc/coreutils.texi (du invocation): Likewise.
Furthermore, use the @itemx macro for the long options
--max-depth and --threshold instead of @item.
2013-01-23 06:42:51 +01:00
Bernhard Voelker
4eaadb4743 maint: define usage note about mandatory args centrally
Each program with at least one long option which is marked as
'required_argument' and which has also a short option for that
option, should print a note about mandatory arguments.
Define that well-known note centrally and use it rather than
literal printf/fputs, and add it where it was missing.

* src/system.h (emit_mandatory_arg_note): Add new function.

* src/cp.c (usage): Use it rather than literal printf/fputs.
* src/csplit.c, src/cut.c, src/date.c, src/df.c, src/du.c:
* src/expand.c, src/fmt.c, src/fold.c, src/head.c, src/install.c:
* src/kill.c, src/ln.c, src/ls.c, src/mkdir.c, src/mkfifo.c:
* src/mknod.c, src/mv.c, src/nl.c, src/od.c, src/paste.c:
* src/pr.c, src/ptx.c, src/shred.c, src/shuf.c, src/sort.c:
* src/split.c, src/stdbuf.c, src/tac.c, src/tail.c, src/timeout.c:
* src/touch.c, src/truncate.c, src/unexpand.c, src/uniq.c:
Likewise.

* src/base64.c (usage): Add call of the above new function
because at least one long option has a required argument.
* src/basename.c, src/chcon.c, src/date.c, src/env.c:
* src/nice.c, src/runcon.c, src/seq.c, src/stat.c, src/stty.c:
Likewise.
2013-01-23 01:03:38 +01:00
Jakob Truelsen
f8afbb424c du: add -t SIZE, --threshold=SIZE option
* src/du.c (opt_threshold): Add variable to hold the value of
the --threshold option specified by the user.
(long_options): Add a required_argument entry for the new
--threshold option.
(usage): Add --threshold option.
(process_file): Elide printing the entry if its size does not
meet the value specified by the --threshold option.
(main): In the argument parsing loop, add a case for the new
-t option. Convert the given argument by permitting the
well-known suffixes for megabyte, gigabytes, etc.
Handle the special case "-0": give an error as this value is
not permitted.
* doc/coreutils.texi (du invocation): Add documentation for the
above new option.
* tests/du/threshold.sh: Add new test to exercise the new option.
* tests/local.mk (all_tests): Mention the above test.

Co-authored-by: Bernhard Voelker <mail@bernhard-voelker.de>
2013-01-21 11:38:54 +01:00
Bernhard Voelker
40b2770a22 tests: remove test case du/slink
This test tried to ensure that not all symlinks (across all
file system types) have Zero size and refers to a change
in system.h from 2002-08-31 (commit SH-UTILS-2_0_15-55-g62808a7).
The test used to do this by working on symlinks to long file
names.  This assumption is dependant on the underlying file
system, and in some environments like XEN does not even work
on file systems known to work otherwise.

The test for dereferencing and no-dereferencing symlinks is
already covered by other tests (du/deref.sh, du/deref-args.sh,
and du/no-deref.sh).  Therefore, remove it.

* tests/du/slink.sh: Remove file.
* tests/local.mk (all_tests): Remove the above test.

Discussed in:
http://lists.gnu.org/archive/html/coreutils/2013-01/msg00053.html
2013-01-20 23:47:32 +01:00
Bernhard Voelker
165343bca6 maint: fix alphabetical order in .gitignore
Since commit v8.20-67-g0f525b6, .gitignore sometimes
showed up as changed because the entries "*.gcda" and
"*.gcno" had not been in alphabetical order.

* .gitignore: Exchange the entries "*.gcda" and "*.gcno".
2013-01-20 23:45:37 +01:00
Benno Schulenberg
e27bfd101d uptime: gettextize an overlooked string, and normalize another
* src/uptime.c: Add calls to gettext() and select_plural().
2013-01-12 13:36:29 +00:00
Benno Schulenberg
119d9f7ed7 doc: make a --help text fragment identical to three others
* src/ln.c (usage): Move a newline to the next text fragment, so
the preceding fragment about backup methods becomes the same as
the ones for cp, mv, and install.  A bit easier for translators.
2013-01-10 20:32:33 +00:00
Pádraig Brady
05382299cd factor: apply a more general fix to enable correct assembly
In addition to the previous 64 bit guards we've placed in longlong.h
there are additional _LP64 guards required for mips with -mcpu >= 3,
to avoid a build failure (http://bugs.gnu.org/13353) and on sparc
with -mcpu >= v9 in 32 bit mode where for example,
`factor 2123123123123123123123` would go into an infinite loop.

Since factor.c currently operates on uintmax_t, we restrict the use
of the assembly in longlong.h to when 'long' has the same width, to
provide a more general guard for this code.

* src/factor.c: Restrict the use of longlong.h assembly code,
to when the width of intmax_t == long.
* src/longlong.h: Remove the previous _LP64 guards to avoid
divergence from GMP's longlong.h
* NEWS: Adjust the info on build and runtime fixes.
2013-01-07 02:11:36 +00:00
Paul Eggert
1248cc816c doc: sync parse-datetime from gnulib
* doc/coreutils.texi (Top): Sync from gnulib parse-datetime.texi menu.
2013-01-06 07:37:12 -08:00
Karl Berry
9d26258174 doc: avoid @sc in texinfo; it is unnecessary
* doc/coreutils.texi: avoid @sc and use explicit capitals.
* doc/local.mk (sc-use-small-caps-NUL): Remove, as no longer applicable.
2013-01-06 12:45:47 +00:00
Karl Berry
f403973391 doc: remove stale pr news in the manual
* coreutils.texi (pr invocation): remove list of ancient news
items; the main documentation already covers what is needed.
2013-01-04 18:17:55 +00:00
Jim Meyering
77da73c754 maint: update all copyright year number ranges
Run "make update-copyright", but then also run this,
  perl -pi -e 's/2\d\d\d-//' tests/sample-test
to make that one script use the single most recent year number.
2013-01-01 04:51:20 +01:00
Jim Meyering
a4838da139 build: update gnulib submodule to latest 2013-01-01 03:54:41 +01:00
Jim Meyering
a4d3a44d27 maint: adjust NEWS entry wording
* NEWS: Adjust wording in a few entries.
2012-12-31 15:05:55 +01:00
Pádraig Brady
850aa613e6 doc: improve od --help and man page
* src/od.c: Redorder the information output by --help
to ease interpretation and so that appropriate sections
are generated by help2man.
* doc/coreutils.texi (od invocation): Fix an incorrect
reference to @var{n}, which should be @var{bytes}.
* man/od.x: Add an "Examples" section, and move the
default od format to there, and add a commonly required
format to generate hexdumps.
Reported by Akim Demaille in http://bugs.gnu.org/13280.
2012-12-27 13:42:07 +00:00
Mike Frysinger
b6b24ad49d factor: disable x86_64 assembly code for x32 builds
The current x86_64 asm code does not work for x32 (__ILP32__) ABIs,
so disable it.  Note simply deleting the q suffix is not enough.

* src/longlong.h: Restrict x86_64 assembly to _LP64 targets,
which is consistent with other checks in longlong.h and
avoids this code on x32.
* NEWS: Mention the build fix.
2012-12-21 15:57:50 +00:00
Pádraig Brady
dd44ccef0d tests: avoid false positive valgrind failures
* init.cfg (require_valgrind_): Check the `true` program,
which will check more valgrind failure cases as now
detailed in the function comments.
2012-12-21 15:57:25 +00:00
Pádraig Brady
8220a17c93 dd: fix a printf format mismatch in an error message
* src/dd.c (dd_copy): To print an off_t portably we need
to use PRIdMAX and cast to intmax_t, otherwise there
could be a mismatch between say a 32 bit off_t
and uintmax_t.  This was flagged by -Wformat on
a 64 bit host when compiling with CFLAGS=-m32.
2012-12-21 15:57:04 +00:00
Pádraig Brady
76f606a954 seq: fix newline output when -s specified
This regression was introduced in commit v8.19-132-g3786fb6.

* src/seq.c (seq_fast): Don't use puts() to output the first number,
and instead insert it into the buffer as for other numbers.
Also output the terminator unconditionally.
* tests/misc/seq.pl: Add some basic tests for the -s option.
* NEWS: Mention the fix.
* THANKS.in: Reported by Philipp Gortan.
2012-12-21 15:55:19 +00:00
Bernhard Voelker
0568f72d2a tests: add tests for basename's --zero option
The -z option has been introduced in commit v8.15-60-ga3eb71a,
i.e. in coreutils-8.16.  Time to add some tests for it.

* tests/misc/basename.pl: Add tests exercising the -z option.
In the foreach loop to append a newline to the end of each
expected 'OUT' string, skip the -z tests.
2012-12-20 16:38:56 +01:00
Assaf Gordon
c388053e14 doc: tweak 'lcov' in HACKING
* HACKING: In the paragraph about creating coverage statistics,
use the correct -b (--base-directory) parameter.
2012-12-20 11:42:27 +01:00
Pádraig Brady
e5345f1915 maint: rewrap a long line noticed by make syntax-check
* configure.ac: Wrap the recently introduced long line.
2012-12-19 11:44:28 +00:00
Pádraig Brady
f9bf96bfa7 doc: clarify when dd iflag=fullblock is useful
* doc/coreutils.texi (dd invocation): Explain that iflag=fullblock
ensures that count= will count blocks rather than reads, and
reference that in both the count= and iflag=fullblock descriptions.
Suggested by John Reiser.
2012-12-19 11:38:04 +00:00
Pádraig Brady
751a4c4d03 tests: avoid a race in timeout-group.sh
* tests/misc/timeout-group.sh: The kernel might possibly delay
signal propagation to timeout.cmd long enough, that it exits
normally without running the signal handler (as sleep will
be in the same process group and so get the signal too).
So avoid this by explicitly checking that the signal handler
is called, which should always happen under normal circumstances.
Reported by Stefano Lattarini on linux-2.6.30-2-686 and bash-4.2.36.
2012-12-19 11:32:07 +00:00
Pádraig Brady
82b1728c4b build: avoid --enable-gcc-warnings on GCC <= 4.5
* configure.ac: Only enable warnings automatically when
on GCC >= 4.6 (and when building from a git checkout)
as that was the first GCC version to support fine-grained
control of warnings, allowing them to be adjusted around
certain code sections.  gnulib relies on this for certain
warnings, so avoid auto enabling this option lest we trigger
build failures on now over two year old compilers.
Reported by Zartaj Majeed with GCC 4.5.3 on cygwin.
2012-12-19 11:30:42 +00:00
Zartaj Majeed
6cedbca7f9 build: fix cygwin build issues
* doc/local.mk (doc/constants.texi): Ensure the doc directory
is present which is needed when doing a non source dir build,
when the doc/constants.texi target is built before other doc targets.
* src/local.mk: Add $(EXEEXT) to the make-prime-list calls.
2012-12-19 11:29:12 +00:00
Pádraig Brady
478d0183bc maint: consistently use @dots{} in coreutils.texi
* doc/coreutils.texi: s/\.\.\./@dots{}/ except in code and examples.
2012-12-17 21:42:46 +00:00
Pádraig Brady
a05a326b0c readlink: support multiple command line arguments
This allows efficient processing of multiple files,
while also increasing compatibility with BSD's readlink(1).
We also add the -z, --zero option to delimit output items
with the NUL character which disambiguates output in the
presence of '\n' characters.

* src/readlink.c (usage): Add the --zero description,
and also adjust the description of --no-newline accordingly.
(main): Handle the -z option and iterate over multiple arguments.
Also as in commit v8.15-24-g9d46b25 we use fputs() and putchar()
rather than printf() for performance reasons.
* doc/coreutils.texi (readlink invocation): Document the
new --zero option, adjust the --no-newline description, and
tweak the general info to indicate multiple files are supported.
* tests/readlink/multi.sh: A new test for the new functionality.
* tests/local.mk: Reference the new test.
* man/readlink.x: Adjust the summary and also reference realpath.
* NEWS: Mention the improvement.
* THANKS.in: Suggested by Aaron Davies.
2012-12-17 21:08:16 +00:00
Assaf Gordon
0f525b6f94 maint: update gitignore entries
* .gitignore: ignore GCC coverage data files.
2012-12-15 00:53:54 +00:00
Assaf Gordon
e9870faf99 doc: mention "git stash" in HACKING
* HACKING: In the paragraph about switching branches, mention
"git stash" as a way to continue while preserving uncommitted
changes.
2012-12-15 00:20:15 +01:00
Bernhard Voelker
c321f7450f tail,stat: improve support for the ceph file system
Teach tail -f that it must use polling on ceph file systems, and
let stat -f --format=%T report the file system type name, "ceph".
Website: http://ceph.com/

* src/stat.c (human_fstype): Add a case: ceph, 0x00C36400, remote.
* NEWS (Improvements): Mention it.
* THANKS.in: Update.
Reported by Konrad Wróblewski in http://bugs.gnu.org/13172.
2012-12-15 00:15:25 +01:00
Bernhard Voelker
9c506806fa maint: fix typos found by misspellings
* doc/coreutils.texi (df invocation): s/occurence/occurrence/.
* tests/df/skip-rootfs.sh: s/supressed/suppressed/
2012-12-14 10:45:21 +01:00
Jim Meyering
4f62d2fe28 tests: add test case and note that last week's cut change is a bug fix
* tests/misc/cut-huge-to-eol-range.sh: New test, showing that
the change in v8.20-51-g7d03466 is a bug fix after all.
* tests/local.mk (all_tests): Add it.
* NEWS (Bug fixes): Mention it.
2012-12-09 15:08:36 -08:00
Bernhard Voelker
62543570d7 cp: fix --no-preserve=mode to not exit 1
cp --no-preserve=mode exited 1 unconditionally.  Furthermore,
the tests which would have detected this error - namely
link-preserve.sh and reserve-mode.sh - failed to test
cp's exit code.

* src/copy.c (copy_reg): In the case x->explicit_no_preserve_mode,
do only set return_val to false iff the previous set_acl ()
failed.
* tests/cp/link-preserve.sh: Check cp's exit code.
* tests/cp/link-symlink.sh: Likewise.
* tests/cp/preserve-mode.sh: Likewise.
* NEWS: Mention the fix.

Bug introduced in commit v8.19-145-g24ebca6.

Reported by Florian Pritz in http://bugs.gnu.org/13119.
2012-12-08 19:09:19 +01:00
Ondrej Oprala
10d35b438e df: do not print duplicate entries and rootfs by default
* src/df.c (struct devlist): Add new struct for storing already-
examined device numbers.
(devlist_head): Add new store of the above type.
(show_rootfs): Add new global boolean to not skip rootfs.
(dev_examined): Add new function to check if the device has
already been traversed.
(get_dev): Filter out rootfs unless "-t rootfs" or the -a
option is specified. Filter out duplicate entries by calling
the above new dev_examined unless the -a option is specified.
(main): Set the show_rootfs variable appropriately when the -t
option is specified for rootfs. Free device list (guarded by
IF_LINT).
* tests/df/skip-duplicates.sh: Add test to exercise the skipping
of duplicate entries.
* tests/df/skip-rootfs.sh: Add test to exercise the skipping
of the rootfs pseudo file system.
* tests/local.mk: Add the above new tests.
* NEWS (Changes in behavior): Mention the changes.
* doc/coreutils.texi (df invocation): Document df's behavior about
skipping rootfs and duplicate entries.

Co-authored-by: Bernhard Voelker.
2012-12-07 21:13:38 +01:00
Cojocaru Alexandru
ec48beadfa cut: avoid a redundant heap allocation
* src/cut.c (set_fields): Don't allocate memory for
`printable_field' if there are no finite ranges.
This is achieved by keeping max_range_endpoint as 0 when
there are no finite ranges.  max_range_endpoint is then
used throughout the code to guard against allocation of,
and access to the bit array.
The extra allocation was introduced via commit v8.10-3-g2e636af.
2012-12-06 18:29:23 +00:00
Pádraig Brady
00743a1f6e maint: fix a referenced coreutils version in a test comment
* tests/misc/cut.pl: This particular bug existed up to v8.10.
2012-12-06 18:28:46 +00:00
Bernhard Voelker
43a6ccf023 tests: fix regex to match "-" in ipcent field in df/total-verify.sh
The regular expression failed to match for file systems that
do not provide inode statistics, e.g. VFAT or CIFS (depending
on the underlying peer file system).

* tests/df/total-verify.sh: Fix the regular expression to match
a dash in the ipcent field again.

Reported by Assaf Gordon in http://bugs.gnu.org/13099.
Bug introduced in commit v8.20-18-gdae8d22.
2012-12-06 11:15:34 +01:00
Assaf Gordon
eac397efff maint: adjust HACKING instructions to run a single test
* HACKING: Adjust as per the recent changes introduced
when switching to non recursive make.
2012-12-06 09:58:55 +00:00
Pádraig Brady
64b8751813 tests: cut.pl: adjust for changed diagnostic
* tests/misc/cut.pl: Since we now output the more
complete error message irrespective of running
in a multi-byte locale or not, adjust the test accordingly.
2012-12-06 09:37:17 +00:00
Cojocaru Alexandru
dd3193cd95 cut: improve error reporting
* src/cut.c (main): Treat a NUL delimiter (-d '') consistently
with non NUL delimiters, and disallow such a delimiter option,
unless a field is also specified.
(set_fields): Provide a more accurate error message when
a given list is invalid.
* tests/misc/cut.pl: Add a test case.
2012-12-06 09:37:16 +00:00
Pádraig Brady
df9065e552 maint: adjust instructions to run a single test
* README: Adjust as per the recent changes introduced
when switching to non recursive make.
2012-12-06 09:35:41 +00:00
Bernhard Voelker
7b4c56b4c6 maint: remove now auto-added entry from THANKS.in
The syntax-check sc_THANKS_in_duplicates complained about
that excess entry.

* THANKS.in (Colin Watson): Remove entry, now that it will be
automatically included in the generated THANKS file.
2012-12-05 11:47:18 +01:00
Pádraig Brady
2bf0c52d5b maint: remove a redundant odd sized alloc from factor.c
* src/factor.c (mp_factor_init): Init the pointers with NULL,
which xrealloc (or realloc) handles fine.
2012-12-04 12:30:05 +00:00
Colin Watson
7d034663e4 factor: fix infinite loop on 32 bit powerpc
Both Debian and Ubuntu builds of coreutils 8.20 hang while running the
test suite on powerpc, which is reproducible using 'factor 122'.

This turns out to be somewhat related to http://bugs.gnu.org/12754,
but not quite the same.  uintmax_t is 64 bits, but the cntlzw
instruction takes 32-bit operands, and the cntlzd option is only
available on 64-bit hardware.

* src/longlong.h: Add an _LP64 check around the PPC64 code,
so that this falls back to the C implementations.
* NEWS: Mention the fix.
2012-12-04 12:28:42 +00:00
Jim Meyering
06aeeecb3f cut: do not print extraneous delimiters in some unusual cases
When printing output delimiters, and when a to-EOL range subsumes
at least one other range, cut would mistakenly print delimiters for
the subsumed range.  This bug was probably introduced via commit
v5.2.1-639-g847e066.
* src/cut.c (set_fields): Ignore any range that is subsumed by a
to-EOL range.  Also, move two declarations down.
* tests/misc/cut.pl: Add tests to exercise this.
* NEWS (Bug fixes): Mention it.
Reported by Marcel Böhme in http://bugs.gnu.org/12966
2012-11-24 15:23:31 -08:00
Jim Meyering
1b874511b6 cut: treat -b2-,3- like -b2-, not like -b3-
* src/cut.c (set_fields): When two right-open-ended ranges are
specified, don't blindly let the latter one take precedence over
the former.  Instead, use the union of the ranges.
* tests/misc/cut.pl: Add tests to exercise this.
* NEWS (Bug fixes): Mention it.
Reported by Marcel Böhme in http://bugs.gnu.org/12966
Thanks to Berhard Voelker for catching log and NEWS typos.
2012-11-24 15:23:28 -08:00
Bernhard Voelker
6f374d7c42 doc: cp: clarify behavior of the --preserve=xattr option
* doc/coreutils.texi (cp invocation): Enhance documentation
of the --preserve=xattr option regarding the preservation
of ACLs, SELinux contexts and capabilities: the user may
notice this only when not specifying --preserve=mode
and --preserve=context, too, i.e., otherwise, these attributes
are preserved anyway.
2012-11-24 18:51:12 +01:00
Pádraig Brady
63d456ce77 doc: update info cross reference to bash
* doc/coreutils.texi (tee invocation): Reference
the bash manual rather than bashref, as the latter
is more likely to work on newer systems.
2012-11-24 15:45:41 +00:00
Pádraig Brady
e83db8484a tests: use sub-second timeouts to speed up a timeout test
* tests/misc/timeout.sh: Take advantage of recent support for
sub-second timeouts to decrease runtime from about 6s to 2s.
2012-11-24 15:43:08 +00:00
Pádraig Brady
61d66690a5 doc: clarify that renice is needed to adjust niceness
* doc/coreutils.texi (nice invocation): Ensure there is no
ambiguity in the summary in relation to nice being able
to adjust the niceness of an existing process.
Reference the renice command.
* man/nice.x: Reference renice (1)
2012-11-24 15:38:16 +00:00
Pádraig Brady
fac673a577 tests: accept EEXIST from rm -d
* tests/rm/d-2.sh: EEXIST is a valid error on some systems.
Reported by Michael Felt on AIX 6.1
2012-11-24 15:29:56 +00:00
Pádraig Brady
dd68ddc654 tests: don't rely on sed -i being available
* tests/df/df-output.sh: sed --in-place is not generally available.
Also add a couple of simplifications from Bernhard Voelker.
Removing all spaces, rather than just leading spaces, suffices.
Searching for ' --output' in unadjusted df --help, suffices.
2012-11-24 15:27:21 +00:00
Pádraig Brady
64d4a2807d seq: ensure correct output width for scientific notation input
* src/seq.c (scan_arg): Calculate the width more accurately
for numbers specified using scientific notation.
* tests/misc/seq.pl: Add tests for cases that were mishandled.
* NEWS: Mention the fix.
* THANKS.in: Reported by Marcel Böhme.
Fixes http://bugs.gnu.org/12959
2012-11-24 15:25:19 +00:00
Bernhard Voelker
ce48a81bce df: reorder default field list of --output option
As the inodes information is usually not so much of interest,
and some file systems including btrfs do not even provide it,
reading of the full df --output is easier when the block
statistic fields come just left of the last field, the mount
point.

* src/df.c (all_args_string): Move the inodes fields before
the block fields.
(usage): Likewise.
* tests/df/df-output.sh: Likewise.
* doc/coreutils.texi (df invocation): Likewise.  Additionally,
explicitly mention the default order of the --output option.
2012-11-22 15:40:54 +01:00
Paul Eggert
177815716e install: fix security race
* NEWS: Document this.
2012-11-20 18:10:54 -08:00
Paul Eggert
505fb47dc1 install: fix security race
* src/copy.c (copy_internal): Use DST_MODE_BITS, not SRC_MODE.
See Bernhard R. Link in <http://bugs.gnu.org/12947> and in
<http://bugs.debian.org/598018>.
2012-11-20 13:17:16 -08:00
Bernhard Voelker
8041e6b62c nl: remove deprecated --page-increment option
The above option has been deprecated since coreutils-7.5
by commit v7.4-129-g718b279.

* src/nl.c (PAGE_INCREMENT_OPTION_DEPRECATED): Remove enum.
(longopts): Remove "page-increment" entry.
(main): Remove PAGE_INCREMENT_OPTION_DEPRECATED case.
* NEWS (Changes in behavior): Mention the change.

Reported by Marcel Böhme in <http://bugs.gnu.org/12940>.
2012-11-20 11:06:46 +01:00
Bernhard Voelker
df062312bf doc: remove already implemented items from TODO
* TODO (renice): The renice program is part of util-linux for
years now. Remove entry.
(dd): The option status=none has been implemented in commit
v8.19-143-g7331ab5. Remove entry.
2012-11-19 23:23:28 +01:00
Bernhard Voelker
1482f730b4 cut: do not accept the invalid range 0-
The command "echo 12345 | cut -b 0-" prints an empty line while
it should fail with "fields and positions are numbered from 1".

* src/cut.c (set_fields): Add a diagnostic for the invalid open
range which starts with Zero, i.e., the range 0-.
* tests/misc/cut.pl: Add tests to ensure the range 0- fails for
fields (-f) and for positions (-b, -c).
* NEWS: Mention the fix.

Reported by Marcel Böhme in <http://bugs.gnu.org/12903>.
2012-11-19 00:08:38 +01:00
Daniel Schepler
6a5843d92f build: fix compilation failure on x32
* src/factor.c [HAVE_ATTRIBUTE_MODE]: Fix typo in #if test:
s/HAVE_LONG_LONG/HAVE_LONG_LONG_INT/.  Otherwise, factor.c would
elicit assembler errors on x32: it was incorrectly defining DItype
to long instead of long long.  Patch and report in
http://bugs.debian.org/693337;  Mike Stone notified upstream.
2012-11-18 13:32:02 -08:00
Jim Meyering
89b53dfd83 maint: reenable accidentally-disabled cppi-check syntax-check rule
* cfg.mk (exclude_file_name_regexp--sc_preprocessor_indentation): Fix
typo that disabled the sc_preprocessor_indentation syntax-check rule
by exempting all files.  s/__ll/_ll/  The typo was introduced in
commit v8.19-157-g759ebcb.
2012-11-18 10:15:48 -08:00
Jim Meyering
e2e3f1ad07 maint: correct indentation of W_TYPE_SIZE-defining cpp directives
* src/factor.c: Indent cpp directives to reflect their nesting.
2012-11-18 10:15:47 -08:00
Jim Meyering
47046dac39 maint: avoid i686-specific syntax-check failure
* cfg.mk (_gl_TS_unmarked_extern_vars): Define.
2012-11-18 10:15:47 -08:00
Paul Eggert
42ba783720 doc: explain why dd is called "dd"
* doc/coreutils.texi (dd invocation): Mention JCL.
2012-11-17 08:24:16 -08:00
Paul Eggert
39b2616517 factor: tidy up primes.h again
See Stefano Lattarini in <http://bugs.gnu.org/12899>.
* src/local.mk (BUILT_SOURCES): Put $(top_srcdir)/src/primes.h here
(MAINTAINERCLEANFILES): ... instead of here.
2012-11-16 16:52:10 -08:00
Paul Eggert
e0f3b6e823 factor: cleanup for primes.h
* .gitignore: Add src/primes.h back, since it's no longer
in the repository.
2012-11-13 07:43:29 -08:00
Jim Meyering
7b4df77dbe maint: avoid unnecessary #include to fix syntax-check failure
* src/factor.c: Remove unneeded #inclusion of"verify.h".
It's already included via system.h.
2012-11-13 07:03:01 +01:00
Paul Eggert
0cc5ae88cf factor: improve primes.h change
This follows suggestions by Jim Meyering in
<http://bugs.gnu.org/12841#34>.
* src/make-prime-list.c (print_wide_uint): Change "nested" argument
to "nesting", and use it to avoid outputting lines that are too long.
* src/primes.h: Remove from git.  This can be generated by a
maintainer.  It's nicer to do so on a host with at least 128-bit
arithmetic.
2012-11-12 21:11:01 -08:00
Paul Eggert
f16e251dae factor: maintainer builds primes.h, not builder
With this change, the maintainer builds primes.h and it is part of
the tarball.  primes.h's contents are not architecture-specific.
* .gitignore: Remove /src/primes.h.
* src/factor.c: Include verify.h.
(W): New constant.  Verify that uintmax_t lacks holes
and that W is no wider than the integers used to generate primes.h.
* src/local.mk (EXTRA_DIST): Add src/primes.h.
(BUILT_SOURCES, CLEANFILES): Remove src/primes.h.
($(top_srcdir)/src/primes.h): Rename from src/primes.h.
Do not depend on src/make-prime-list.  Instead, use sub-make to
build, so that we build primes.h only if it does not exist.
* src/make-prime-list.c: Include <limits.h>, for ULONG_MAX.
(wide_uint): Define to uintmax_t or unsigned __int128 if not #defined.
(struct prime, binvert, process_prime): Use it instead of uintmax_t.
(print_wide_uint): New function.  This generates the proper pinv
value regardless of the width of uintmax_t on the target, so long
as the width doesn't exceed that of the width of wide_uint on the
maintainer host that generated src/primes.h.
(output_primes): Use it.  Output WIDE_UINT_BITS, too.  Let the
target compute its own lim, since its uintmax_t may be narrower
than ours.
(SZ): Remove.
* src/primes.h: New file, generated with 128-bit integers and usable
on any host where uintmax_t's width is no greater than 128 bits.
2012-11-12 08:32:31 -08:00
Paul Eggert
0d664d227c factor: port to systems with rpl_malloc
* src/make-prime-list.c (malloc): Undef.  This fixes a problem on
AIX 8.20 reported by Michael Felt in <http://bugs.gnu.org/12841>.
2012-11-12 08:32:31 -08:00
Bernhard Voelker
cd4139df89 tests: fix factor's tests to use coreutil's own sha1sum
The test used the shasum utility which seems to belong to the
perl package. On SLES-10.4, perl doesn't include this yet:

  + seq 0 10000000
  + factor
  + shasum -c --status exp
  ./tests/factor/t00.sh: line 30: shasum: command not found
  + Exit 1

It is better to use our own stuff anyway.

* tests/factor/run.sh: s/shasum/sha1sum/. Additionally, add
sha1sum to the print_ver_ call.
2012-11-09 14:50:23 +00:00
Benno Schulenberg
2aeb77bf0f doc: chcon: add descriptions for three undocumented options
These were missed in this related change v8.14-104-g44e20cd

* src/chcon.c (usage): Mention the two --preserve-root options.
* doc/coreutils.texi (chcon invocation): Plus the --dereferece option.
2012-11-09 13:16:36 +00:00
Benno Schulenberg
51e7c777f8 doc: with cp -n, option -f is not redundant but ignored
* src/cp.c (usage): Replace "redundant" with "ignored".
* doc/coreutils.texi (cp invocation): Likewise.
2012-11-09 13:16:36 +00:00
Paul Eggert
a395b637a6 df: port the new df test to POSIX sed, larger file systems
* tests/df/df-output.sh: For the test "df -B1K --output=size",
do not assume that the file system size fits in 9 bytes; it
might be larger than that, so omit leading space.  Also, use
portable 'sed' commands: POSIX says sed commands inside { } should
all end in newline.
2012-11-09 01:11:45 -08:00
Bernhard Voelker
e73bb23f4f df: add a test for the --output option
* tests/df/df-output.sh: Add a test case.
* tests/local.mk (all_tests): Mention the test.
* cfg.mk (sc_file_system): Exempt the test from this syntax-check.
2012-11-08 16:12:07 +00:00
Bernhard Voelker
ae3c2b4620 df: document the new --output option
* src/df.c (usage): Add a short description of --output and its
available field names for use in the optional argument.
* doc/coreutils.texi (df invocation): Add the new option with more
details and a few examples.
* NEWS (New features): Mention the new option.
(Changes in behvaior): Mention the new placeholder for fields
in the "total" line.
2012-11-08 16:12:02 +00:00
Bernhard Voelker
dae8d223b6 df: add --output to select which fields to display
This supports changing the order of the fields displayed,
and also allows the simultaneous display of inode and block fields.

src/df.c (get_dev): Factor out calling get_header to ...
(main): ... here.  Call print_table only if file_systems_processed.

src/df.c (Displayable fields): Rename DEV_FIELD to SOURCE_FIELD.
Rename TYPE_FIELD to FSTYPE_FIELD.  Rename FREE_FIELD to AVAIL_FIELD.
Rename MNT_FIELD to TARGET_FIELD.

* src/df.c (display_field_t): Turn loose enum definition of the
displayable fields into a typedef.  Add the inode fields ITOTAL_FIELD,
IUSED_FIELD, IAVAIL_FIELD, IPCENT_FIELD.
(field_data_t): Define structure to hold the display field, the
caption, the width and the alignment for each field of the above
type.
(field_data): Add array the values of field data for each display
field.
(headers, alignments, widths): Remove arrays.
(columns): Add a pointer to the storage for the array of the actual
output columns, i.e., fields.
(ncolumns): Add counter for the current output columns.
(alloc_table_row): Allocate the dynamic ncolumns value of strings.
(print_table): Loop over ncolumns instead of constant NFIELDS.  Rename
loop variable 'field' to 'col' to avoid ambiguity with the 'field'
element in the columns structure.  Adjust the condition for printing
the last column by comparing with the column number instead of the
field name (TARGET_FIELD).  Use the width and the alignment stored in
the columns data.
(alloc_field): Add new function to allocate a field in the columns
array.
(get_field_list): Add new function to fill the array of output columns
for each mode.
(get_header): Loop over ncolumns instead of constant NFIELDS.  Rename
the loop variable 'field' to 'col' to avoid ambiguity with the 'field'
element in the columns structure.  Remove the code for continuing the
loop if the current column is the file system type and print_type is not
active (which is now impossible).  Store the cell in the columns store
along with the new width.
(get_dev): Loop over ncolumns instead of the constant NFIELDS.  Rename
the loop variable 'field' to 'col' to avoid ambiguity with the 'field'
element in the columns structure; move the definition down to where it
is used first.  Add cases for the inode fields ITOTAL_FIELD,
IUSED_FIELD, IAVAIL_FIELD and IPCENT_FIELD.  Store the cell in the
columns store along with the new width.
(main): Use new get_field_list function to fill the list of output
columns.

* src/df.c (print_table): Instead of fputs()ing directly, apply
ambsalign on the last field, too.  Use the new MBA_NO_RIGHT_PAD flag
for this.

* src/df.c (TOTAL_OPTION): Add new enum value.
(long_options): Use it for the "total" option instead of 'c'.
(main): Likewise.

* src/df.c (get_dev): Remove condition to copy the fstype into the
FSTYPE_FIELD - based on whether print_type is non-Null.  Since the
introduction of get_field_list(), there are only fields added to
the columns array which have to be added.

* src/df.c (get_dev): Guard the summing up of the values for the
grand total: only do it if we have to print the total and if the
current invocation is not for processing it.

* src/df.c (main): Pass a hyphen "-" for the mount point name
to get_dev.
(get_dev): As the mount_point is now always there,
remove the condition and the else case for the TARGET_FIELD.
Instead, simply copy the mount_point.
All cells are now always present.  Therefore, add an assertion
statement if one was not.  Furthermore, hide the problematic
characters unconditionally.
(print_table): Remove the skipping of empty cells.
* tests/df/total-verify.sh: Accommodate to the new "-" in the
target field of the summary line.
* NEWS: Mention the change in behavior.

* src/df.c (field_type_t): Add new typedef of 3 enums to distinguish
between block, inode and other fields.
(field_data_t): Add field_type member of the above new type.
(field_data): Add default values for the above field_type,
indicating whether a field contains block values, inode values
or other, generic values.
(field_values_t): Add this struct to store the field values, used
by and factored out from get_dev to be able to define such a struct
for both the inode and the block values.
(get_field_values): Add this function to obtain the block values
and the inode values from the file system usage, used by and
factored out from get_dev.
(add_to_grand_total): Add this function to sum the values of the
current mount point up for the grand total, used by and factored
out from get_dev.
(get_dev): Move the definition of the variables fsu, buf, pct and
cell down to where they are used first to give them a better scope.
Factor out input_units, output_units, total, available,
negate_available, available_to_root, used and negate_used into the
above struct field_values_t.
Factor out the mapping of the fsu values to the above variables
into above function get_field_values.
Factor out the summing up of the grand total values into the
above function add_to_grand_total.
Define block_values and inode_values of the new type and call the
new get_field_values to fill them from the fsu values.
Call the above function add_to_grand_total for summing up the
values for the grand total.
Inside the loop over all fields, define a variable 'v' to point
to either the block_values or the inode_values, depending on the
current field's field_type.  Change the code in the cases
TOTAL_FIELD/ITOTAL_FIELD, USED_FIELD/IUSED_FIELD, AVAIL_FIELD/
IAVAIL_FIELD and PCENT_FIELD/IPCENT_FIELD to use the field values
where 'v' is pointing to, i.e., either the block_values or the
inode_values.

* src/df.c (main): Remove setting of grand_fsu.fsu_blocks in the
inode_format case as this is no longer needed and would lead to
wrong results once when mixed block/inode fields will be used.

* src/df.c (main): Cleanup the code at the end regarding
file_systems_processed to make the code clearer.

* src/df.c (inode_format): Remove variable.
(main): Remove initialization of the above variable.
In getopts loop, directly set the header_mode to INODES_MODE
instead of using the above variable.  Afterwards, remove the
mapping to INODES_MODE as it is already set.

* src/df.c (posix_format): Move variable ...
(main): ... to here.

* src/df.c (print_table): Enhance the comment about 2-line format
in cases where the SOURCE_FIELD exceeds 20 chars, as such
behavior has been removed long ago by commit v8.10-40-g99679ff.

* src/df.c (Display modes): Add OUTPUT_MODE, remove unused NMODES.
(display_field_t): Remove unnecessary NFIELDS.
(field_data_t): Add member 'arg' for the field name in the --output
argument.  Add member 'used' to remember if a field is already used
in the columns array.
(field_data): Add values for the above new members arg and used.
(all_args_string): Add variable which represents the argument for
the --output option which includes all fields.
(OUTPUT_OPTION): Add enum to identify the long --output option.
(long_options): Add optional-argument --output option.
(alloc_field): Assert that the field is not already used.
Mark the field as used.
(decode_output_arg): Add function to parse the comma-separated
field list passed to the --output option in order to add the
appropriate fields to the columns array.
(get_field_list): Add case for the new OUTPUT_MODE to add all
available fields to columns in the case the --output option
has been passed without any values.  Use the comma-separated
field list form to pass to decode_output_arg to keep the field
header mapping for the OUTPUT_MODE only on one place.
(main): Define format string msg_mut_excl to be used in the
following checks whether the use of --output and the other
option is mutually exclusive.
In the getopt_long loop, add a check to the case for the -i option
to issue an error message when it is used together with --output;
Likewise for -T and -P.
Add a new case for OUTPUT_OPTION, together with similar checks as
above and eventually passing the optarg to decode_output_arg.
After the getopt_long loop, consider the OUTPUT_MODE case in order
not to run into -h or -P mode.

* src/df.c (get_dev): Also xstrdup the dev_name, and free it
afterwards to silence a valgrind warning about definitely lost
memory.
(main): Free the columns store to silence valgrind, guarded by
the IF_LINT macro.

* src/df.c (main): Pass "total" as the mount point to get_dev if
the SOURCE_FIELD is not among the columns to output.
* tests/df/df-output.sh: Change the test to ensure the content of
the target field of the grand total line: if the source field is
present, then the target should be "-", else the target field should
be "target".
* NEWS (Changes in behavior): Enhance the exiting NEWS entry.
* doc/coreutils.texi (df invocation): Document the content of the
source and target field in the grand total line.

* src/df.c (main): Add another condition to the need_fs_type
parameter of read_file_system_list whether the FSTYPE_FIELD is
used or not.

* src/df.c (get_header): Indicate the block size used,
in the "size" header, when using --output without -h.
* tests/df/df-output.sh: Adjust for, and add an extra test for,
the new behavior.
2012-11-08 16:11:48 +00:00
Bernhard Voelker
801cd6216b maint: fix factor's test file name pattern in .gitignore
* .gitignore: Adapt the entry for the files generated during
the factor tests (see v8.20-9-g1cace4a).
2012-11-05 23:19:01 +00:00
Ángel González
de2397fece timeout: add --preserve-status to always propagate the exit status
It's useful for commands that support running for an indeterminite
amount of time, to not return a specific timeout exit status (124),
and instead let the command handle the timeout signal and return
a status for the work done so far.

* doc/coreutils.texi (timeout invocation): Describe the new option.
* src/timeout.c (preserve_status): A new global boolean to
enable the --preserve-status behavior.
(usage): Describe the new option.
(main): Don't return EXIT_TIMEOUT of preserve_status is set.
* tests/misc/timeout.sh: Add a test for the new option.
2012-11-04 01:48:14 +00:00
Pádraig Brady
8096ec6641 maint: fix the error message from sc_check-I18N-AUTHORS
* cfk.mk (sc_check-I18N-AUTHORS): Fix the quoting so
you don't get a 'command not found' error.
2012-11-04 00:57:55 +00:00
Pádraig Brady
da1329e715 build: avoid build failure on some HPPA systems
* src/longlong.h: Restrict some HPPA assembly variants to PA RISC V2.0.
Note we also avoid this assembly for ilp32 runtimes, since even though
the assembly is accepted there, it's not safe as the context can get
clobbered between the 'add' and 'add,dc'.
This fixes a compile failure with newer HPPA systems with default
GCC CPU options.
Reported by John David Anglin
2012-11-04 00:49:04 +00:00
Pádraig Brady
6108baa47e build: don't assume uintmax_t is 64 bits
This was not seen to be an issue in practise,
but to make the code more robust, don't assume
uintmax_t is 64 bits.

* src/factor.c (W_TYPE_SIZE): Define based on integer limits.
* src/make-prime-list.c (output_primes): Define format width
based on integer limits.
2012-11-04 00:49:04 +00:00
Pádraig Brady
1411022cf2 build: don't rely on support for '%j' printf format
* src/factor.c (print_uintmaxes): Replace with PRIuMAX.
* src/join.c (check_order): Likewise.
* cfg.mk (sc_check-j-printf-format): Add a syntax-check rule
to flag new cases of this.
2012-11-04 00:49:04 +00:00
Pádraig Brady
5e9401800b build: don't rely on support for '%*j' printf format
* src/make-prime-list.c: Hardcode the uintmax_t width
to 16 hex digits (64 bit), to avoid this compile issue
on HPUS systems at least.
2012-11-04 00:49:04 +00:00
Bernhard Voelker
ad5eeacc67 tests: fix syntax error in setuidgid_has_perm_
An invalid sed expression lead to the following error:
  + sed -n 'ls/.* //p'
  sed: -e expression #1, char 2: extra characters after command
Use "one" instead of "el".
Bug introduced in v8.19-111-g51a4b04.

* init.cfg (setuidgid_has_perm_): s/ls/1s/.
* NEWS (Build-related): Mention the fix.
2012-11-01 17:37:58 +00:00
Bernhard Voelker
1cace4a832 tests: shorten factor's inordinately-long test file names
Besides what the subject says, this commit moves the test data
for the factor tests from tests/local.mk into the directory
tests/factor/ where it belongs.

* tests/local.mk (EXTRA_DIST): Add new tests/factor/create-test.sh.
(p,q,t1,t2) Factor out the factor-related magic numbers.
(factor_tests): Rename the test names to t{00..36}.sh. Factor out
the triples of test data.
($(factor_tests)): Add dependency to new
tests/factor/create-factor.sh.
Call that script to generate the test scripts.
* tests/factor/run.sh: Turn this script into a template, and
therefore remove it's executable permission bit.
Add template variables START, END and CKSUM, replacing the code
to split the test data from the test script's file name.
Use the new template variables in the call to seq and for
creating the exp file.
* tests/factor/create-test.sh: Add new script to create the
test scripts from the template tests/factor/run.sh.
Use test data and magic numbers factored out from the above
files. Let the script also change the __TEMPLATE__ line in
run.sh to make clear that the test scripts are generated.
* cfg.mk (sc_tests_list_consistency): Exempt the new test.
(exclude_file_name_regexp--sc_prohibit_test_backticks):
Likewise.

Improved-by: Stefano Lattarini
Improved by: Jim Meyering
2012-10-27 17:39:17 +02:00
Stefano Lattarini
48536bfe8f build: man page generation: degrade gracefully when perl is lacking
Since commit v8.19-118-g57da212, our 'dist-hook' rule tweaked the
distributed Makefile.in to make each man page 'man/foo.1' depend
on the corresponding source 'src/foo.c' rather than the corresponding
program 'src/foo'.  That was done to accommodate systems without
perl, which cannot run help2man to regenerate the manpage after
its corresponding program has been built.

This seems a right and proper graceful degradation, in that the
man pages dependencies are still 100% correct in a git checkout,
while being more lax but "more portable" in a distribution tarball.
Alas, that is not the case in practice, as it turns out the tweaked
Makefile makes the building of man pages unreliable and potentially
incorrect!

In fact, assume that instead of the correct a dependency:

    man/ls.1: src/ls

we have the laxer one:

    man/ls.1: src/ls.c

and think of what happens if a user modifies, say, 'src/ls.c', and then
runs "make -j4" to rebuild everything.  The make process will see that
it has to rebuild the man page 'man/ls.1' (because its prerequisite
'src/ls.c' has changed), but won't see that it has to rebuild 'src/ls'
*before* re-running 'help2man' to generate that man page; so, if
'man/ls.1' is rebuilt before 'src/ls' (which can happen with concurrent
make), our user will get either a build error (if 'src/ls' did non
exist) or, worse, a man page with an up-to-date timestamp but an
out-of-date content.  And what's even worse in all of this is that
this problem will be present also for users who have perl installed:
this is not a "graceful degradation" at all!

In our situation, the best and simplest way to implement a graceful
degradation it to keep the correct dependencies for man pages (that
is, "man/ls.1: src/ls"), and if perl is not present, just generate
dummy man pages reporting that built-time issue and redirecting the
user back to either the info documentation or the '--help' output.

As a consequence of this change, we also stop distributing man pages,
since they will now be generated unconditionally.

* Makefile.am (do-not-require-help2man): Remove.
(dist-hook): Don't depend on it.
* man/local.mk: Remove an obsolete comment.
(EXTRA_DIST): Stop distributing generated man pages.
($(EXTRA_MANS)): This no longer needs to depend on $(all_programs).
(MAINTAINERCLEANFILES): $(ALL_MANS) Do not list it here, and ...
(CLEANFILES): ... list it here, instead.
(.x.1): Instead of warning if perl is missing, but then trying to run
'help2man' unconditionally, simply run ...
(run_help2man): ... the command referenced by this new variable, that
expands to a proper invocation of 'help2man' if perl is present, and
to an invocation of a shell script generating a dummy manpage if it
is not.
(EXTRA_DIST): Distribute that shell script.
* man/dummy-man: New shell script.
* NEWS (Build-related): Mention this.
Fixes coreutils http://bugs.gnu.org/12715.
2012-10-26 12:04:12 +02:00
Jim Meyering
74da4c8047 maint: tweak sc_check-I18N-AUTHORS
* cfg.mk (sc_check-I18N-AUTHORS): Remove unnecessary subshell;
add a self-explanatory diagnostic.
2012-10-25 18:35:34 +02:00
Jim Meyering
77179e4abe maint: remove an obsolete test comment
* tests/du/bind-mount-dir-cycle.sh: Remove obsolete comment
spotted by Gilles Espinasse.
2012-10-25 14:19:55 +02:00
Pádraig Brady
0e32941315 pr: fix -n to pad consistently and not crash
* src/pr.c: Replace the code to truncate the most significant
digits of line numbers, with much simpler string manipulation
that supports arbitrary widths.  Before this, specifying a
width >= 32 to -n would result in a divide by zero error.
Also remove the inconsistent padding with zeros and spaces, which
would result in zero padding for widths 12 and 15.
* tests/pr/pr-tests.pl: Added a test to ensure no zero padding,
and also a test for the divide by zero case.
* NEWS: Mentioned the fix
Reported by Ondrej Oprala
2012-10-25 13:01:13 +01:00
Pádraig Brady
88a6201917 build: ensure factor links the iconv library
* src/local.mk (src_factor_LDADD): Append $(LIBICONV).
* crg.mk (sc_check-I18N-AUTHORS): A new syntax check rule
to ensure we add LIBICONV where appropriate.
* THANKS.in: Add the reporter.
Reported by Christian Jullien
Syntax check suggested by Jim Meyering
2012-10-25 12:47:16 +01:00
Pádraig Brady
c83c48411d maint: refactor tests/misc/pr.pl into tests/pr/pr-tests.pl
* tests/misc/pr.pl: Refactor this test into ...
* tests/pr/pr-tests.pl: ... here.
* tests/local.mk: Remove the reference to the removed test
Improved by Jim Meyering
2012-10-25 11:10:27 +01:00
Mike Frysinger
9517680ed3 build: do not redefine _FORTIFY_SOURCE
When _FORTIFY_SOURCE is defined by the compiler or via flags, as
it is on Gentoo, do not override it.  Otherwise we get many
redefinition warnings.

* configure.ac (FORTIFY_SOURCE): Check if _FORTIFY_SOURCE is defined.
This addresses http://bugs.gnu.org/12714
2012-10-24 18:03:36 +02:00
Pádraig Brady
7ab9b4e443 maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2012-10-23 17:27:19 +01:00
Pádraig Brady
bd3640f35e version 8.20
* NEWS: Record release date.
2012-10-23 16:48:48 +01:00
Jim Meyering
b8778bb186 factor: add comments
* src/factor.c (is_square): Use active voice in comment, not passive.
(factor): Add function-describing comment.
(mp_factor): Likewise.
2012-10-23 14:24:02 +02:00
Pádraig Brady
22ba81b252 build: avoid warnings about unused variables and macros
src/factor.c (__GMP_DECLSPEC): Move back from longlong.h
to treat consistently with other stub macros.
(__GMP_GNUC_PREREQ): Reference to avoid -Wunused-macros warning.
(__GMP_DECLSPEC): Likewise.
(ASSERT): Likewise.
(__clz_tab): Likewise.
(factor_using_division): Mark a variable as unused.
(mulredc): Likewise.
(mulredc2): Likewise.
(divexact_21): Likewise.
2012-10-23 13:03:09 +01:00
Pádraig Brady
0bf808356e build: avoid compile warnings in factor.c on some systems
* src/factor.c (factor_using_pollard_rho2): On some systems
(like sparc) we need to promote all addmod2() parameters
to uintmax_t to avoid warnings.
2012-10-23 13:03:08 +01:00
Pádraig Brady
585c987367 build: avoid build failure on some sparc systems
* src/longlong.h: Restrict some sparc assembly variants
to sparc V9. This was seen to be an issue with newer
sparc systems with default gcc CPU options.
2012-10-23 13:03:08 +01:00
Pádraig Brady
15794eab5a tests: correctly restrict factor test without GMP
* tests/misc/factor.pl: Correct the precedence and
regular expression in the command to check for GMP.
2012-10-23 13:03:08 +01:00
Jim Meyering
0aeaa506ad doc: NEWS: the cp bug affects mv and install, too
* NEWS (Bug fixes): Note that the copy-induced corruption but affects
mv (sometimes) and install, too.  Pointed out by Bernhard Voelker.
2012-10-21 14:52:50 +02:00
Benno Schulenberg
3131cd9c5a doc: remove a stray parenthesis from 'cp --force' description
* doc/coreutils.texi (cp invocation): Remove Cheshire Cat.
2012-10-19 12:13:49 +02:00
Jim Meyering
5a6d2f699c build: update gnulib submodule to latest 2012-10-17 18:17:56 +02:00
Jim Meyering
64aef5fb9a cp: avoid data-corrupting free-memory-read
* src/extent-scan.c (extent_scan_read): Reset our last_ei
pointer whenever the parent buffer might have just been freed.
* tests/cp/fiemap-extent-FMR.sh: New test.
* tests/local.mk (all_tests): Add it.
* NEWS (Bug fixes): Mention it.
Reported by Mike Gerth in http://bugs.gnu.org/12656, and with
help from Alan Curry.  Bug introduced in commit v8.10-60-g18f5a85.
2012-10-17 18:17:56 +02:00
Nikolas Kallis
c528f13136 doc: improve HACKING guidelines
* HACKING: Add "cd coreutils" after the git clone command.
Copyright-paperwork-exempt: Yes
2012-10-13 20:26:06 +02:00
Pádraig Brady
024a1d572c factor: fix integer validation and GMP fallback
In the recent factor rewrite, the GMP code
wasn't actually used; just an error was printed
on integer overflow.  While fixing that it was noticed
that correct input validation wasn't done in all cases
when falling back to the GMP code.

* src/factor.c (print_factors) Fallback to GMP on overflow.
(strto2uintmax): Scan the string for invalid characters,
so that case can be detected independently of overflow.
Return an error when an empty string is passed.
Also allow leading spaces and '+' in input numbers.
* tests/misc/factor.pl: Ensure the GMP code is exercised
when compiled in. Also add a test to verify leading
spaces and '+' are allowed.
2012-10-09 00:07:35 +01:00
Pádraig Brady
cf9cd8958b build: support older GMP versions
The new factor code introduced usage of mpz_inits() and
mpz_clears(), which are only available since GMP >= 5,
and will result in a compile error when missing.

* m4/gmp.m4 (cu_GMP): Define HAVE_DECL_MPZ_INITS appropriately.
* src/factor (mpz_inits): New function, defined where missing.
(mpz_clears): Likewise.
2012-10-08 23:40:08 +01:00
Jim Meyering
231e40a6ba maint: avoid warning from gcc's -Wunused-macros
On some systems, -Wunused-macros would warn about two macros:
src/factor.c:148:0: warning: macro "__clz_tab" is not used
src/factor.c:126:0: warning: macro "UHWtype" is not used
* src/factor.c: Add a use to placate gcc.
2012-10-07 10:41:39 +02:00
Jim Meyering
f947735d3c build: avoid link failure when strerror is replaced
When building the new make-prime-list program on a system for which
strerror is defined to rpl_strerror, we'd get a link failure.
The problem is that we're including <config.h> for some definitions,
but do not want the rpl_ ones, since this particular program must
not be linked against gnulib (aka libcoreutils.a).  This did not
arise on Fedora 17 or 18, but did on Debian wheezy/sid.
* src/make-prime-list.c (strerror): #undef.
Build failure introduced by commit v8.19-152-gcf67e4c.
2012-10-05 22:35:27 +02:00
Jim Meyering
06b7ed8051 factor: 25% speed-up, on output
* src/factor.c (print_factors_single): Use fputs and umaxtostr
rather than printf with "%ju".  This reduced the time required
to compute and print the factors of the first 10^7 integers from
over 8 seconds to 5.75s.  Run this command:
seq $((10**7)) | env time factor > /dev/null
2012-10-04 22:09:00 +02:00
Jim Meyering
759ebcb57d factor: merge with preexisting factor; integrate tests; avoid warnings
* src/factor.c: Renamed from factor-ng.c, with the following changes:
Adjust copyright header to be consistent with others.
Use xmalloc and xrealloc, to avoid segv upon OOM.
Switch back to using readtokens to handle input.
Diagnose invalid inputs.
s/fprintf+exit/error/
(print_factors): Add comments.
(strto2uintmax): Return strtol_error, not int.
(read_item): Remove, no longer used.
(main): Use atexit(close_stdout) so that we don't ignore failed write.
* cfg.mk: Exempt src/longlong.h from several tests.
Exempt run.sh from the test-list-consistency test.
Exempt make-prime-list.c from numerous tests, since we won't
be making it conform: it must not link with libcoreutils.a.
Exempt factor-ng.c from the no-upper-case error message test.
* AUTHORS (factor): Add Torbjörn and Niels.
* tests/local.mk (factor_tests): Encode the 37 tests.
($(factor_tests)): Rule to generate a test script for each test.
* tests/factor/run.sh: New script, marked as very expensive.
* .gitignore: Ignore new generated files.
* src/local.mk (src/primes.h): New rule.
(noinst_PROGRAMS): Add make-prime-list.
(noinst_HEADERS): Add longlong.h.
Remove all wheel-related rules and files.
* src/wheel-gen.pl: Remove file.

maint: mark set-but-not-used variables with ATTRIBUTE_UNUSED
* src/factor-ng.c (redcify, prime_p, isqrt2): Mark them, so we
don't have to disable -Wunused-but-set-variable.

maint: use __builtin_expect only if __GNUC__
* src/factor-ng.c (LIKELY, UNLIKELY) [__GNUC__]: Add #ifdef guard.

build: avoid warning about unused macro
* src/factor-ng.c (__GMP_DECLSPEC): Don't define here
* src/longlong.h (__GMP_DECLSPEC): Define if not already defined.
2012-10-04 22:06:40 +02:00
Niels Möller
49f5c21fff factor: more improvements
* src/factor-ng.c: Import some improvements from
http://gmplib.org:8000/factoring
Co-authored-by: Torbjörn Granlund <tg@gmplib.org>
2012-10-04 22:03:14 +02:00
Torbjörn Granlund
a38890b27f factor: new much-improved implementation; not yet integrated
* src/factor-ng.c: New file, from nt-factor.
* src/longlong.h: New file.
* NEWS (Improvements): Mention the upcoming improvements.
Co-authored-by: Niels Möller
2012-10-04 21:34:24 +02:00
Jim Meyering
d836ea7340 maint: make-prime-list: syntax conventions; be robust for large N
* src/make-prime-list.c: Insert spaces before parens.
(main): Abort if the 8-delta value ever exceeds 255.
2012-10-04 21:33:06 +02:00
Jim Meyering
c6369e9004 maint: make-prime-list: do not ignore write failure
Even though this is just a helper program that is run solely to create
primes.h, it should not ignore a write failure.  Normally we would
simply call atexit (close_stdout), but we cannot do that from this
helper program, since it must be built before the generated header,
primes.h.  If we were to make the linking of make-prime-list depend
on libcoreutils.a, that would add all lib/*.o files to the list
of dependents of $(BUILT_HEADERS).  Then, since there is currently no
provision to ensure that a file like lib/stdio.h (another built header)
is built before the first lib/*.o file that also includes <stdio.h>,
some lib/*.o files would be built before lib/stdio.h and some after.
The former would provoke link failures due to undefined rpl_* functions.
* src/make-prime-list.c: Include <errno.h>.
(fclose): Undef, so that a definition to rpl_fclose does not
cause a link failure.
(main): Per the above, in this exceptional case, we check for fclose
and ferror failure manually, and don't worry about the ferror-only
failure case in which errno may not be relevant.
2012-10-04 21:33:06 +02:00
Jim Meyering
cf67e4cc90 maint: make-prime-list: avoid -Wsuggest-attribute=const warning
* src/make-prime-list.c: Include <config.h>.
(binvert): Add _GL_ATTRIBUTE_CONST.
2012-10-04 21:33:05 +02:00
Torbjörn Granlund
1fb5db95aa factor: prepare for the new factor program
* src/make-prime-list.c: New file, from nt-factor.
Co-authored-by: Niels Möller <nisse@lysator.liu.se>
2012-10-04 21:33:05 +02:00
Jim Meyering
852930e88a build: remove redundant dependency: $(PROGRAMS): lib/libcoreutils.a
* src/local.mk: Remove the above dependency.
A soon-to-be-added new program, make-prime-list, must not depend
on that, since it is used to create a BUILT_SOURCES file.
That dependency is already handled via the ..._LD_ADD variables,
and so that redundant dependency has so far been harmless.
2012-10-03 19:06:37 +02:00
Jim Meyering
fc20096ecb du: avoid abort on systems for which ->me_type is not malloc'd
On some systems (notably, BSD-based, like at least OpenBSD 4.9),
the me_type member does not come from the heap.
* src/du.c (fill_mount_table): Free the ->me_type member only
when it was malloc'd, i.e., when ->me_type_malloced is nonzero.
Bug introduced via commit v8.19-2-gcf7e1b5.
Reported as http://bugs.gnu.org/12542.
2012-09-30 14:34:20 +02:00
Jim Meyering
6072039fa4 doc: same correction, but now in texinfo documentation
* doc/coreutils.texi (nice invocation): s/nicenesses/niceness values/
2012-09-29 14:56:13 +02:00
Jim Meyering
0d4efc3713 doc: correct an old bit of ugliness in nice --help output
* src/nice.c (usage): s/Nicenesses/Niceness values/
2012-09-28 18:42:05 +02:00
Pádraig Brady
b212af4301 doc: disambiguate the niceness explanation in nice --help
* src/nice.c (usage): Specify the entity (process) that
that relative terms are referring to.
* THANKS: Update.
Reported-by: David Diggles
2012-09-28 17:26:41 +01:00
Ondrej Oprala
24ebca61a3 cp: fix the --no-preserve=mode option
The --no-preserve=mode option did not do what its name implies:
it would mistakenly preserve permission mode bits.
* NEWS: Mention the fix.
* TODO: Remove an entry.
* src/copy.c (copy_reg): Add a condition to properly
handle the --no-preserve=mode option for files
(copy_internal): Add a condition to properly handle the
--no-preserve=mode option for directories.
* src/copy.h (struct cp_options): Add a new boolean.
* src/cp.c (cp_option_init,decode_preserve_arg): Set the
new boolean value according to specified options.
* src/install.c (struct cp_options): Initialize the new boolean.
* src/mv.c (struct cp_options): Initialize the new boolean.
* tests/cp/preserve-mode.sh: Add a new test.
* tests/cp/link-preserve.sh (-a --no-preserve=mode): Adjust the
expected perms: now, --no-preserve=mode overrides the --preserve=mode
that is inherent in -a, as it should.
* tests/local.mk: Add the new test to the list.
2012-09-28 12:21:02 +02:00
Pádraig Brady
64be8b40f4 timeout: handle signals more transparently
This was originally attempted in commit v8.12-117-g5a647a0,
but reverted before release because of the unreliability
of disabling core dumps using setrlimit() on Linux kernels.
This new version instead uses prctl() where available to
more reliably disable core dumps for the timeout process.

* m4/jm-macros.m4: Define HAVE_SETRLIMIT and HAVE_PRCTL.
* src/timeout.c (disable_core_dumps): A new function
that disables coredumps using prctl or setrlimit if available.
(main): If the child exited with a signal and we can
disable core dumps, then raise that signal to the timeout
process itself, so that callers may also see the signal status.
Also print a message indicating when the monitored command
dumped core, as that information is lost in the signal
propagation through timeout.
2012-09-24 15:46:51 +01:00
Pozsár Balázs
7331ab55fc dd: new option, status=none to suppress output statistics
* src/dd.c (STATUS_NONE): A new bitmask combining all STATUS_
options, thus used to suppress all informational output.
(struct symbol_value statuses): Expose the "none" option,
corresponding to the STATUS_NONE bitmask above.
(print_stats): Return early if STATUS_NONE is specified.
Also move the call to gethrxtime() down so that it's only
called when needed.
(usage): Describe the new options.
* doc/coreutils.texi (dd invocation): Likewise.
* NEWS: Mention the new feature.
* tests/dd/misc.sh: Ensure the new option works.
2012-09-24 15:14:23 +01:00
Jim Meyering
2dad87f641 tail,stat: improve support for vmhgfs
Teach tail -f that it must use polling on vmhgfs file systems, and
let stat -f --format=%T report the file system type name, "vmhgfs".
* src/stat.c (human_fstype): Add a case: vmhgfs, 0xbacbacbc, remote.
* NEWS (Improvements): Mention it.
* THANKS.in: Update.
Reported by Daniel Tschinder in http://bugs.gnu.org/12461.
2012-09-23 09:17:46 +02:00
Jim Meyering
958bef88f9 build: move non-recursive-gnulib-prefix-hack to gnulib; update
I've moved the non-recursive-gnulib-prefix-hack module to
gnulib, with two small improvements, so remove it from here
and update gnulib to the latest.
* gl/build-aux/prefix-gnulib-mk: Remove file.
* gl/m4/non-recursive-gnulib-prefix-hack.m4: Remove file.
* gl/modules/non-recursive-gnulib-prefix-hack: Remove file.
* gnulib: Update to latest.
2012-09-20 17:47:32 +02:00
Jim Meyering
ba034fc449 rm: be even more careful when using a replacement errno value
* src/remove.c (excise): The change in commit v8.19-107-gccbd3f3 made
the "rm -rf D" (for unreadable dir, D) diagnostic worse on Solaris 10:
  -rm: cannot remove 'D': Permission denied
  +rm: cannot remove 'D': File exists
That happened because unlinkat would fail with EEXIST there, given
an unreadable directory, which made the two tests, tests/rm/unread2
and tests/rm/unreadable fail.  Accommodate the EEXIST case, too.
2012-09-19 09:44:22 +02:00
Jim Meyering
0bb0c2c00e maint: fix a comment typo
* cfg.mk: Fix comment typo: s/recursive/non-recursive/ make
2012-09-19 07:52:25 +02:00
Jim Meyering
87af2e0922 tests: cp/link-heap: avoid new failure on rawhide
* tests/cp/link-heap.sh: Increase virtual memory limit by 2000KiB --
from 20,000 to 22,000 KiB -- to avoid a new failure on rawhide.
2012-09-18 23:05:42 +02:00
Jim Meyering
9228b861cc maint: make the tight-scope syntax-check rule work again
* cfg.mk: Configure a few variable to make the tight-scope rule work.
* gnulib: Update submodule to latest.
2012-09-18 17:14:05 +02:00
Benno Schulenberg
627412847e dd: remove references to the word BLOCKS from help and texi docs
The renaming from BLOCKS to N was done in v8.15-38-g140eca1,
and documentation for N was added again in v8.17-26-g4f2e9d5
without noticing that.  Now, finally remove the word BLOCKS
from the documentation.

* src/dd.c (usage): Remove the word BLOCKS.
* doc/coreutils.texi (dd invocation): Likewise.

Improved by: Bernhard Voelker <mail@bernhard-voelker.de>
2012-09-18 17:14:05 +02:00
Jim Meyering
b2635cb1ef doc: NEWS: mention the conversion to non-recursive make
* NEWS (Build-related): Mention the non-recursive make improvement.
Improved by: Pádraig Brady
2012-09-18 17:13:19 +02:00
Pádraig Brady
a04ddb8dd3 ls: fix coloring of dangling symlinks in default listing mode
When listing a directory containing dangling symlinks,
and not outputting a long format listing, and orphaned links
are set to no coloring in LS_COLORS, then the symlinks
would get no color rather than reverting to the standard
symlink color.  The issue was introduced in v8.13-19-g84457c4

* src/ls.c (print_color_indicator): Use the standard method
to check if coloring is specified for orphaned symlinks.
The existing method would consider 'or=00' or 'or=0' as significant
in LS_COLORS. Even 'or=' was significant as in that case the
string='or=' and the length=0.  Also apply the same change
for missing symlinks for consistency.
(gobble_file): Remove the simulation of linkok, which is only
tested in print_color_indicator() which now handles this directly
by keying on the LS_COLORS values correctly.
* tests/misc/ls-misc.pl: Add a test case.
* THANKS: Add the reporter.
* NEWS: Mention the fix.
Reported-by: David Matei
2012-09-16 11:41:50 +01:00
Jim Meyering
c5ccf29bbf doc: update seq description
* doc/coreutils.texi (seq invocation): Update an example and mention
that with the new constraints, seq can print arbitrarily large numbers.
2012-09-15 08:09:18 +02:00
Pádraig Brady
3786fb6de3 seq: enable the fast integer printing code in more cases
* src/seq.c (main): Adjust the initial arbitrary precision
seq_fast enablement checks to be more maintainable, and
a little more general, by allowing single character
separators to use seq_fast.
Also check again after the number arguments are processed,
to see if we can still use seq_fast, which while not
allowing arbitarly large integers, it will handle
integers of the form 10E10 etc.
(seq_fast): Use a specified separator character,
rather than hardcoding '\n'.
2012-09-14 23:22:55 +01:00
Jim Meyering
cb5ff9de6c build: do not rely on automake's AM_TESTS_ENVIRONMENT
* tests/local.mk (TESTS_ENVIRONMENT): Rename from AM_TESTS_ENVIRONMENT,
since it is not honored in automake-1.11.3 after all.
This reverts commit v8.19-38-g34c9c8f.  For now, I'll leave
the following commit that made bootstrap.conf require 1.11.2.
Prompted by a report of test failure from Pádraig Brady.
2012-09-14 20:15:11 +02:00
Jim Meyering
f2d8d34999 build: don't prefix the RHS of "GPERF = ..." with "lib/"
* gl/build-aux/prefix-gnulib-mk (prefix_assignment): Exempt
the RHS of a "GPERF = ..." assignment from lib/ prefixing.
2012-09-14 18:42:50 +02:00
Jim Meyering
77f89d014b seq: 70x faster for non-negative whole numbers and incr==1
Handle non-negative whole numbers robustly and efficiently when
the increment is 1 and when no format-changing option is specified.
On the correctness front, for very large numbers, seq now works fine:

    $ b=1000000000000000000000000000
    $ src/seq ${b}09 ${b}11
    100000000000000000000000000009
    100000000000000000000000000010
    100000000000000000000000000011

while the old one would infloop, printing garbage:

    $ seq ${b}09 ${b}11 | head -2
    99999999999999999997315645440
    99999999999999999997315645440

The new code is much more efficient, too:
Old vs new: 55.81s vs 0.82s

  $ env time --f=%e seq $((10**8)) > /dev/null
  55.81
  $ env time --f=%e src/seq $((10**8)) > /dev/null
  0.82

* seq.c (incr): New function, inspired by the one in cat.c.
(cmp, seq_fast): New functions, inspired by code in nt-factor
by Torbjörn Granlund and Niels Möller.
(trim_leading_zeros): New function, without which cmp would malfunction.
(all_digits_p): New function.
(main): Hoist the format_str-vs-equal_width check to precede first
treatment of operands, and insert code to call seq_fast when possible.
* NEWS (Bug fixes): Mention the correctness fix.
(Improvements): Mention the speed-up.
* tests/misc/seq.pl: Exercise the new code.

Improved by: Bernhard Voelker.
http://thread.gmane.org/gmane.comp.gnu.coreutils.general/3340
2012-09-14 13:34:51 +02:00
Jim Meyering
0b4abe7b42 tests: reenable "make -C tests ..." commands
The README-documented way to run individual tests was invalidated
by the conversion of tests/ to non-recursive make.  Add a GNUmakefile
shim to reenable that usage.
* tests/GNUmakefile: New file, so that "make -C tests ..." works
like it did before the conversion of tests/ to non-recursive build.
Reported by Bernhard Voelker.
* Makefile.am (EXTRA_DIST): Add it.
* cfg.mk (sc_prohibit_tab_based_indentation): Also exempt any
GNUmakefile from this syntax-check.
2012-09-14 10:20:03 +02:00
Stefano Lattarini
8d4924f107 build: fixup: correctly recognize if perl is missing
* configure.ac: Here, by adding a missing '*' to the wildcard in
a 'case' construct over the contents of $PERL.  Introduced in
commit v8.19-41-g00f5ba1.
2012-09-12 20:52:18 +02:00
Bernhard Voelker
a11cba5372 maint: mbsalign.h: fix typo from previous comment edit
* gl/lib/mbsalign.h: Fix comment typo.
2012-09-12 16:41:56 +01:00
Jim Meyering
8a0e1bce04 build: build lib/ using non-recursive make
* bootstrap.conf (gnulib_modules): Use the new module.
(bootstrap_post_import_hook): Invoke prefix-gnulib-mk.
* configure.ac (AC_CONFIG_FILES): Remove lib/Makefile.
* lib/Makefile.am: Renamed...
* lib/local.mk: ...to this.
* src/local.mk (CLEANFILES): Append, don't set.
(noinst_LIBRARIES): Likewise.
(AM_CPPFLAGS): Don't set this here.
* Makefile.am (AM_CPPFLAGS): Define here instead.
(noinst_LIBRARIES, CLEANFILES, MOSTLYCLEANDIRS, MOSTLYCLEANFILES):
Initialize here, so we can append to them from each included local.mk
(SUBDIRS): Remove "lib".
2012-09-11 11:23:17 +02:00
Jim Meyering
ada994274c build: handle @ALLOCA@-vs-non-recursive make problems
Here is a good reason to avoid alloca with non-recursive make.  These:

    $ grep @ALLOCA lib/gnulib.mk
    lib_libcoreutils_a_LIBADD += lib/@ALLOCA@
    lib_libcoreutils_a_DEPENDENCIES += lib/@ALLOCA@

would lead to this, when @ALLOCA@ expands to the empty string,
which is essentially "always", now:

    $ grep ' lib/$' Makefile
    lib_libcoreutils_a_LIBADD = $(gl_LIBOBJS) lib/
    lib_libcoreutils_a_DEPENDENCIES = $(gl_LIBOBJS) lib/

Tell the prefix-adding script not to add a prefix when the word it's
prefixing is "@ALLOCA@".  That is fine for most cases, but what about
when the expansion of @ALLOCA@ is nonempty?

* build-aux/prefix-gnulib-mk (prefix_word): Exclude @ALLOCA@.
* gl/m4/non-recursive-gnulib-prefix-hack.m4: Prefix non-empty
$ALLOCA with "lib/".  FIXME: I'm not sure this is required,
now that we...
Use AC_CONFIG_LIBOBJ_DIR([lib]).
Without using AC_CONFIG_LIBOBJ_DIR([lib]), automake (not autoconf)
would complain of failure to find aclocal.c, due to the use of
AC_LIBSOURCES(alloca.c).
2012-09-11 11:23:16 +02:00
Jim Meyering
640fb7a108 build: new module to convert lib/ to non-recursive make
* gl/modules/non-recursive-gnulib-prefix-hack: New module.
* gl/m4/non-recursive-gnulib-prefix-hack.m4:
(gl_NON_RECURSIVE_GNULIB_PREFIX_HACK): This is the snippet
that this module inserts near the end of configure.
* gl/build-aux/prefix-gnulib-mk: New script, from bison.
Changes from the code in bison:
(prefix_assignment): Split a long line.
(prefix): Add trailing slashes to avoid a single false match.
Prefix imaxtostr.c and the other *tostr.c file names manually.
Also, use $prefix in place of hard-coded "lib/".
2012-09-11 11:23:00 +02:00
Bernhard Voelker
40e8affc16 maint: gen-lists-of-programs.sh: fix typo from previous comment edit
* build-aux/gen-lists-of-programs.sh: Fix comment typo.
2012-09-11 08:53:56 +02:00
Pádraig Brady
6cf9c59b16 maint: add more control flags to mbsalign
* gl/lib/mbsalign.h: Add MBA_UNIBYTE_ONLY (to allow
faster processing).  Also add MBA_NO_LEFT_PAD, MBA_NO_RIGHT_PAD
to give greater control of padding, useful with the first
or last fields on a line.
* gl/lib/mbsalign.c (mbsalign): Implement the new flags.
* gl/tests/test-mbsalign.c (main): Test combinations
of the new flags.
2012-09-11 03:23:42 +01:00
Jim Meyering
4fdd1cc597 maint: allow per-directory CFLAGS settings with non-recursive make
* src/local.mk (AM_CFLAGS): Don't use $(WARN_CFLAGS) here.
* cfg.mk (src_CFLAGS, lib_CFLAGS, gnulib-tests_CFLAGS): Define here
instead.
(AM_CFLAGS): Augment using the above.
* configure.ac: Note that the configure-time option,
--enable-gcc-warnings now functions only when using GNU make.
Well, currently it does still work in gnulib-tests, but that should
soon be fixed.
Improved-by: Stefano Lattarini
2012-09-10 16:55:25 +02:00
Jim Meyering
d9bc0d0d22 maint: gen-lists-of-programs.sh: improve comments
* build-aux/gen-lists-of-programs.sh: Improve comments.
2012-09-10 16:33:56 +02:00
Jim Meyering
57da212a95 build: do not require help2man at build-from-tarball time
But do retain full dependencies when building from a git clone.
We do this by converting the full dependency (of the .1 file on
the binary we run with --help) into a dependency on the .c file.
* Makefile.am (do-not-require-help2man): New rule.
(dist-hook): depend on it.
2012-09-10 09:32:50 +02:00
Jim Meyering
e571cfd9c7 build: fix a minor man-page generation dependency error
* man/local.mk (man/dir.1): Depend on src/dir, not src/ls.
2012-09-10 09:25:31 +02:00
Jim Meyering
c424de16b1 maint: move the last coreutils-specific files from lib/ to gl/
Convert the few remaining coreutils-specific files in lib/ to
gnulib-style modules under gl/, removing their corresponding .m4
files, since the information recorded in those files is better
stored in module-description file in gl/modules/.
* bootstrap.conf (gnulib_modules): Add new modules:
fd-reopen, buffer-lcm, xfts, strnumcmp.
* gl/lib/buffer-lcm.c: Renamed from the file in lib/.
* gl/lib/buffer-lcm.h: Likewise.
* gl/lib/fd-reopen.c: Likewise.
* gl/lib/fd-reopen.h: Likewise.
* gl/lib/strintcmp.c: Likewise.
* gl/lib/strnumcmp-in.h: Likewise.
* gl/lib/strnumcmp.c: Likewise.
* gl/lib/strnumcmp.h: Likewise.
* gl/lib/xfts.c: Likewise.
* gl/lib/xfts.h: Likewise.
* gl/modules/buffer-lcm: New module-description file.
* gl/modules/fd-reopen: Likewise.
* gl/modules/strnumcmp: Likewise.
* gl/modules/xfts: Likewise.
* m4/fd-reopen.m4: Remove, no longer needed.
* m4/strnumcmp.m4: Likewise.
* m4/xfts.m4: Likewise.
* m4/prereq.m4: Do not AC_REQUIRE the m4 functions from
our just-removed m4/*.m4 files.
2012-09-10 08:58:03 +02:00
Jim Meyering
07fcfe36ce maint: move gl/m4/root-dev-ino.m4 contents into its module definition
We can get the same effect using the modules file.
* gl/m4/root-dev-ino.m4: Remove file.
* gl/modules/root-dev-ino (Depends-on): Add lstat.
(Files): Remove m4/root-dev-ino.m4.
(Makefile.am) [lib_SOURCES]: Add root-dev-ino.c and root-dev-ino.h.
(configure.ac): Remove reference to gl_ROOT_DEV_INO.
2012-09-10 08:56:45 +02:00
Jim Meyering
e6b99c7386 maint: adjust ChangeLog to correct Author
* build-aux/git-log-fix: Add an entry to correct the Author:
of v8.19-111-g51a4b04.  It should be Ondrej Oprala, not me.
2012-09-08 15:13:01 +02:00
Jim Meyering
65672bf109 factor: NEWS and tests
* NEWS (Bug fixes): Mention it.
* tests/misc/factor.pl: Add five of Torbjörn's tests.
2012-09-07 11:04:41 +02:00
Torbjörn Granlund
6c13e72c79 factor: don't ever declare composites to be prime
The multiple-precision factoring code (with HAVE_GMP) was copied from
a now-obsolete version of GMP that did not pass proper arguments to
the mpz_probab_prime_p function.  It makes that code perform no more
than 3 Miller-Rabin tests only, which is not sufficient.

A Miller-Rabin test will detect composites with at least a probability
of 3/4.  For a uniform random composite, the probability will actually
be much higher.

Or put another way, of the N-3 possible Miller-Rabin tests for checking
the composite N, there is no number N for which more than (N-3)/4 of the
tests will fail to detect the number as a composite.  For most numbers N
the number of "false witnesses" will be much, much lower.

Problem numbers are of the form N=pq, p,q prime and (p-1)/(q-1) = s,
where s is a small integer.  (There are other problem forms too,
involving 3 or more prime factors.)  When s = 2, we get the 3/4 factor.

It is easy to find numbers of that form that cause coreutils' factor to
fail:

  465658903
  2242724851
  6635692801
  17709149503
  17754345703
  20889169003
  42743470771
  54890944111
  72047131003
  85862644003
  98275842811
  114654168091
  117225546301
  ...

There are 9008992 composites of the form with s=2 below 2^64.  With 3
Miller-Rabin tests, one would expect about 9008992/64 = 140766 to be
invalidly recognized as primes in that range.

* src/factor.c (MR_REPS): Define to 25.
(factor_using_pollard_rho): Use MR_REPS, not 3.
(print_factors_multi): Likewise.
* THANKS.in: Remove my name, now that it will be automatically
included in the generated THANKS file.
2012-09-07 11:04:41 +02:00
Jim Meyering
51a4b04954 tests: improve checks for setuidgid-using root-only tests
* init.cfg (setuidgid_has_perm_): New function.
(require_root_): Use it.
Improved-by: Bernhard Voelker
* NEWS (Build-related): Mention the improvement.
2012-09-07 11:03:24 +02:00
Eric Blake
47fd706a75 build: default to --enable-gcc-warnings for git tree
Anyone developing on coreutils can be assumed to have a new enough
environment, such that enabling gcc warnings by default will be
useful.  Tarballs still default to no warnings, and the defaults
can still be overridden with --disable-gcc-warnings.

* configure.ac (gl_gcc_warnings): Set default based on environment.
Suggested by Bernhard Voelker.
2012-09-06 10:03:47 -06:00
Pádraig Brady
a514bc402c nproc: disallow non option command line parameters
* src/nproc.c (main): Error if any non option parameters.
* NEWS: Mention the change in behavior.
2012-09-06 10:46:35 +01:00
Jim Meyering
97b786a33d tail,stat: add support for VZFS
* src/stat.c (human_fstype): Add a case: vzfs, 0x565A4653 (local).
Reported by Jens Rosenboom in http://bugs.gnu.org/12356
* NEWS (Improvement): Mention it.
2012-09-06 08:31:26 +02:00
Jim Meyering
ccbd3f3b29 rm: be more careful when using a replacement errno value
* src/remove.c (excise): Tighten the test for when we defer to an
old errno value: instead of relying solely on an FTS_DNR (unreadable
directory) failure, also test current and replacement errno values.
This change would also have solved the problem addressed by commit
v8.19-106-g57dd067.  For more info, see http://bugs.gnu.org/12339#113
2012-09-05 17:31:00 +02:00
Jim Meyering
57dd06703c rm: avoid bogus diagnostic for a slash-decorated symlink-to-dir
These commands would evoke an invalid diagnostic:
    $ mkdir d && ln -s d s && env rm -r s/
    rm: cannot remove 's': Too many levels of symbolic links
remove.c was stripping trailing slashes from "s/" before passing
the name to "rm".  But a trailing slash may change the semantics,
and thus should not be stripped.
* src/remove.c (rm_fts): Do not strip trailing slashes.
* tests/rm/v-slash.sh: Adapt to new expected output.
* gnulib: Update to latest, for an improved fts.c that merely
normalizes trailing slashes.
Reported by Paul Eggert in discussion of http://bugs.gnu.org/12339
2012-09-05 12:10:38 +02:00
Jim Meyering
d5719921a8 tests: depend on the programs we're testing
* tests/local.mk ($(TEST_LOGS)): Depend on $(PROGRAMS), so that
tests are rerun when any program is rebuilt.  Technically, we could
specify precisely which few programs are dependents of each test,
but that can come later, if deemed worth the trouble and maintenance
burden.  Also, there is the issue of the primary program(s) being
tested (i.e., those itemized via print_ver_) versus those that are
tested incidentally: for example, nearly every test exercises "rm"
when its clean-up code removes files.
2012-09-05 08:48:30 +02:00
Stefano Lattarini
eb27c9e478 maint: fix a spurious syntax-check failure
* cfg.mk (exclude_file_name_regexp--sc_file_system): Exempt
'init.cfg', not 'tests/init.cfg'.
2012-09-05 08:48:29 +02:00
Stefano Lattarini
303d074357 tests: more resilient about tainted absolute srcdir path
* tests/init.cfg (stty_reversible_init_): Quote '$abs_top_srcdir'
properly.
(fiemap_capable_): Quote '$abs_srcdir' properly.
(require_dirent_d_type_): Likewise.
2012-09-05 08:48:29 +02:00
Stefano Lattarini
9e6d411e26 maint: fix syntax checks 'sc_root_tests'
* cfg.mk: Don't work by trying to parse the (now gone) file
'tests/Makefile.am'; rather, use the contents of the make variable,
$(all_root_tests), introduced few commits ago.
Fix a few unrelated cosmetic issues while at it.
2012-09-05 08:48:29 +02:00
Stefano Lattarini
212eff2575 maint: avoid a spurious syntax-check error
* cfg.mk (exclude_file_name_regexp--sc_prohibit_test_backticks): Exempt
'tests/local.mk' rather than 'tests/Makefile.am'.
2012-09-05 08:48:29 +02:00
Stefano Lattarini
c30bff07d8 maint: vc_exe_in_TESTS should actually be a syntax check
Because it requires the presence of the '.git' directory, that is,
can be run only for maintainers working from checked-out sources.

* tests/local.mk (vc_exe_in_TESTS): Rename and move ...
* cfg.mk (sc_tests_list_consistency): ... here, with minor adjustments.
2012-09-05 08:48:29 +02:00
Stefano Lattarini
dd223558dc build: remove two now-useless convenience targets
* src/local.mk (built_programs.list, all_programs.list): These.
2012-09-05 08:48:29 +02:00
Stefano Lattarini
65e1165ed4 tests: put test-suite.log back in 'tests/'
* tests/local.mk (TEST_SUITE_LOGS): Define to 'tests/test-suite.log'.
2012-09-05 08:48:29 +02:00
Stefano Lattarini
21b5147fd8 build: don't use recursive make for tests/ subdirectory
* Makefile.am (SUBDIRS): Remove 'tests'.
(include): The '$(top_srcdir)/tests/local.mk' file.
(check-root): Remove this convenience target, it's no longer needed
now that the "real" check-root target once in 'tests/Makefile' will
land in the top-level makefile.
* configure.ac (AC_CONFIG_FILES): Remove 'tests/Makefile'.
* tests/Makefile.am: Rename ...
* tests/local.mk: ... like this, with a lot of adjustments.
* tests/init.cfg: Move ...
* init.cfg: ... here.  This is necessary, for a limitation of the
gnulib-provided 'tests/init.sh', which unconditionally look for
'init.cfg' in the $(srcdir) directory.
* tests/*/*.sh: Adjust: expect init.sh to be in '$srcdir/tests',
not in '$srcdir', and extend $PATH with './src', not with '../src'.
* tests/Coreutils.pm: Adjust similarly.
* tests/pr/pr-tests.pl ($pfx): Likewise.
2012-09-05 08:48:29 +02:00
Stefano Lattarini
24fb6d91b6 maint: list of names of built programs available in the Makefiles
This is just a preparatory refactoring in view of future changes.

* configure.ac (AC_SUBST): New 'built_programs'.
* tests/Makefile.am (AM_TESTS_ENVIRONMENT): Simply define the exported
variable 'built_programs' to the expansion of the '$(built_programs)'
AC_SUBST'd make variable.
(.built-programs): Remove this now-unneeded convenience target.
(CLEANFILES, check_DATA): Delete, no longer needed.
2012-09-05 08:48:29 +02:00
Stefano Lattarini
84f5176fcd maint: remove anachronistic syntax-check
* cfg.mk (sc_no_exec_perl_coreutils): This.  Our new testsuite
layout (perl tests having '.pl' suffix, shell tests having '.sh'
suffix) makes it basically impossible to run into the issue this
check guarded against.
2012-09-05 08:48:28 +02:00
Stefano Lattarini
f3e48aeb6c maint: remove duplicated declaration of the 'sc_check-AUTHORS' target
* cfg.mk: Here.
2012-09-05 08:48:28 +02:00
Stefano Lattarini
85d0a65ffb tests: remove the unused 'root-hint' target
* tests/Makefile.am (root-hint): Here.  The interested user can see
the reasons why some tests are skipped by looking at the messages
they display on the console; here's an excerpt:

    ...
    PASS: misc/id-groups.sh
    id-setgid.sh: skipped test: must be run as root
    SKIP: misc/id-setgid.sh
    PASS: misc/md5sum.pl
    ...
    PASS: df/total-verify.sh
    2g.sh: skipped test: very expensive: disabled by default
    SKIP: du/2g.sh
    ...

Clear enough, and more specific and precise that a generic "some tests
might need to be run as root" message.  And if that user is interested
in making those tests run anyway, he'll just take a look to the README
files to look for info.  So there's no reason to pollute the stdout
with another "hint" that is subsumed by those messages, and that might
go unnoticed anyway.

Moreover, and possibly more importantly, that hint wasn't being
displayed anyway, even before this change!  That's because the
'root-hint' target was listed as prerequisite for the 'check-recursive'
target, which however was not a dependency of the 'check' target in
'tests/Makefile.am', because that file contains no $(SUBDIRS)
definition.
2012-09-05 08:48:28 +02:00
Stefano Lattarini
e8f9c131ba tests: use suffix, not exec-bit, to tell which files are tests
* tests/Makefile.am (vc_exe_in_TESTS): Adjust to look, in the 'tests/'
subdirectory, for files that have one of the extensions listed in
$(TEST_EXTENSIONS), rather than for executable files.
2012-09-05 08:48:28 +02:00
Stefano Lattarini
995cd3fa66 maint: make vc_exe_in_TESTS also work in VPATH builds
* tests/Makefile.am (vc_exe_in_TESTS): It is easy to adjust this
recipe to also work in VPATH setups, also thanks to modifications
done by previous changes.
2012-09-05 08:48:28 +02:00
Stefano Lattarini
86e69b1b62 maint: remove useless dependency for vc_exe_in_TESTS
* tests/Makefile.am (vc_exe_in_TESTS): No need to depend on Makefile:
this target is .PHONY, so it is always run anyway.
2012-09-05 08:48:28 +02:00
Stefano Lattarini
50dfe1f389 maint: avoid parsing of Makefile.am from vc_exe_in_TESTS
* tests/Makefile.am (TESTS): Rename ...
(all_tests): ... like this, so that we'll still be able to know the
complete list of our tests even if the user overrides TESTS from the
command line (which he's allowed to do by the test harness API).
(root_tests): Rename ...
(all_root_tests): ... like this, for similar reasons.
(TESTS, root_tests): Redefine their defaults to to $(all_tests) and
$(all_root_tests) respectively.
(vc_exe_in_TESTS): It can now safely use $(all_tests) to get the
complete list of test cases according to the Makefile, instead of
having to resort to "parsing" of Makefile.am.
(EXTRA_DIST): Use $(all_tests), not $(TESTS).
(v_, w_): Delete, no longer needed.
2012-09-05 08:48:28 +02:00
Stefano Lattarini
cd97af8ee0 build: use 'check-local' to extend the 'check' target
* tests/Makefile.am (check-local): Here, by making this depend
on 'vc_exe_in_TESTS' ...
(check): ... rather than making this depend on them.  While the old
usage worked, it relied on an implementation detail rather than on
documented behavior.
* src/local.mk (check-local): Similarly, make this depend on
'check-README' and 'check-duplicate-no-install' ...
(check): ... rather than on this.
2012-09-05 08:48:28 +02:00
Stefano Lattarini
d263b0e252 scripts: autotools-install: allow user-specified make program
* scripts/autotools-install: Honor $MAKE.  This might be useful
on systems where the make implementation available in $PATH
by default is limited (Solaris) or broken (HP-UX).
2012-09-02 20:05:39 +02:00
Stefano Lattarini
1952f44a74 scripts: autotools-install: style and portability fixes
* scripts/autotools-install: Here.
2012-09-02 19:27:47 +02:00
Benno Schulenberg
e7a02cb588 touch: line up long option in --help text
* src/touch.c (usage): Indent --time=... to line up with all of the
other long options.
2012-09-02 13:51:10 +02:00
Jim Meyering
135664d25e maint: disable sc_proper_name_utf8_requires_ICONV test
It would still pass, but would print many diagnostics like this:
  Can't open src/Makefile.am: No such file or directory.
* cfg.mk (local-checks-to-skip): Temporarily disable a test.
This test will need to be adapted to work with a non-recursive
build set-up, in which there is no Makefile.am alongside each program.
Reported by Bernhard Voelker.
2012-09-02 13:46:59 +02:00
Jim Meyering
9850c74b1f maint: accommodate upcoming, expanded list of warnings from gnulib
* configure.ac: Disable a new gcc warning, -Wsuggest-attribute=format,
since it triggers on copy.c (which I'm not inclined to adjust) and
factor.c's use of vfprintf which would appear to require a change
to stdio.h.
2012-09-02 13:42:39 +02:00
Stefano Lattarini
c9cd19b3e8 maint: fix build_programs definition not to use "make -C src ..."
* dist-check.mk (built_programs): There's no need to issue recursive
make calls in 'src/' to define this (in fact, that works no longer
now that 'src/Makefile.am' is gone).  Simply define this to the sorted
contents of $(bin_PROGRAMS), with the 'src/' prefix and the $(EXEEXT)
suffix (if any) removed.  Reported by Jim Meyering.
2012-09-01 21:28:13 +02:00
Jim Meyering
6a6257a96a build: restore handling of space-tainted build directory name
* man/local.mk: With commit v8.19-84-g08cf455, man page creation
would fail when using a build directory name containing e.g.,
spaces.
2012-09-01 21:28:13 +02:00
Jim Meyering
11d63860bd build: make each man/prog.1 depend on src/prog, not src/prog.c
* man/local.mk: Creating a prog.1 man page requires running
src/prog --help.
List the exceptions, e.g., install.1 depends on src/ginstall
and arch.1 depends on src/uname.
2012-09-01 21:28:13 +02:00
Jim Meyering
552dbe400e maint: check-programs-vs-x: avoid a new syntax-check failure
* cfg.mk (check-programs-vs-x): The new variable,
$(all-progs-but-lbracket) contains libstdbuf.so, and it does
not have a corresponding .x file, so exempt it.
2012-09-01 21:28:12 +02:00
Jim Meyering
e0f95e5b0e maint: avoid distcheck failure by properly cleaning $(ALL_MANS)
* man/local.mk (distclean-local): Remove $(ALL_MANS) when doing
a VPATH build.  If it's not done, generated manpages can be left
around in the build directory after a "make distclean", causing
failures in "make distcheck".
2012-09-01 21:28:12 +02:00
Stefano Lattarini
5b335a256e maint: port manpages generation to VPATH builds
* man/local.mk (.x.1): Use '$(MKDIR_P)' rather than bare 'mkdir'
where appropriate.  Reported by Jim Meyering.
2012-09-01 21:28:12 +02:00
Jim Meyering
246fc2ba8d build: fix VPATH issues in C compilation
* src/local.mk (AM_CPPFLAGS): Add 'src' to the directories that
are searched for #include'd files.
2012-09-01 21:28:12 +02:00
Stefano Lattarini
e6bd4e7913 maint: simplify declaration of "libexec" programs
* configure.ac: No need to use 'gl_ADD_PROG' and an indirection
variable '$optional_pkglib_progs' to declare the 'libstdbuf.so'
"libexec" program; the decision to whether compile that program
is not up to the user, but it only and simply depends on whether
the 'stdbuf' "bin" program is to be built or not.
2012-09-01 21:28:12 +02:00
Stefano Lattarini
10e7c73a6b build: $(mandeps): new, to factor out man pages dependencies
* man/local.mk (mandpep): Rename ...
(mandeps): ... like this.  Make $(ALL_MANS) depend on its
content.  List 'src/system.h' in here, instead of making
$(ALL_MANS) depend on it explicitly.
(man/*.1): No need to list $(mandep) among the dependencies
any longer.
2012-09-01 21:28:12 +02:00
Stefano Lattarini
dc82d7c340 build: enhance man pages cleaning and dependencies
* man/local.mk: All of the manpages should depend on 'src/system.h',
and all of them should be cleaned by "make maintainer-clean", that
is, added to MAINTAINERCLEANFILES.  Make it be so.
Some minor cosmetic tweakings and reorderings while at it.
2012-09-01 21:28:12 +02:00
Stefano Lattarini
98954ce2aa build: simplify: get rid of yet some more indirection variables
* configure.ac: Adjust and improve few comments.
(MAN): Rename ...
(man1_MANS): ... to this.
Ensure it isn't initialized in all Makefiles (which would lead
to spurious errors), by calling AM_SUBST_NOTMAKE on it.
Also call AM_SUBST_NOTMAKE on 'EXTRA_MANS', for consistency.
* man/local.mk (man1_MANS): Simply define to '@man1_MANS@'.
2012-09-01 21:28:12 +02:00
Stefano Lattarini
7ac3e4502e build: rename dist_man1_MANS -> man1_MANS
And list $(man1_MANS) directly in $(EXTRA_DIST) instead.
This is similar to what is done for $(EXTRA_MANS), thus
improving consistency and readability.

* man/local.mk (dist_man1_MANS): Rename ...
(man1_MANS): ... like this.
(EXTRA_DIST): Add its contents.
* cfg.mk (check-x-vs-1): Fix a botched comment.
2012-09-01 21:28:12 +02:00
Stefano Lattarini
f3244dcab6 build: one less unneeded make variable
* man/local.mk (man_aux): This was used only once, so inline its
expansion at its sole point of use ...
(EXTRA_DIST): ... here.
2012-09-01 21:28:12 +02:00
Stefano Lattarini
59da6f1e6f build: simplify and make more portable to non-GNU make
The AC_SUBST'd variable '$(NO_INSTALL_PROGS_DEFAULT)' is only used in
makefile expressions expanding the list of manual pages that are not
built by default (but might need to be when a distribution tarball
is created). Such expressions exploited a feature of make variable
expansion -- namely, $(VAR:%=dir/%.x) -- that, while seemingly quite
portable in practice, is not POSIX-conforming, and could break on
lesser vendor make implementations.  So kill two birds with one stone,
by getting rid of the $(NO_INSTALL_PROGS_DEFAULT) intermediate variable
and improving makefile portability in the process.

While at it, we also clean up some other minor naming inconsistency
and useless indirection.

* configure.ac (NO_INSTALL_PROGS_DEFAULT): Don't define or AC_SUBST
anymore; instead ...
(EXTRA_MANS): ... define and AC_SUBST these.
* man/local.mk (extra_man_1): Rename ...
(EXTRA_MANS): ... like this, explicitly making clear it's AC_SUBST'd.
(extra_man_x): It's used only once, no need to define it; just inline
its only expansion where needed.
(EXTRA_DIST): Adjust.
(ALL_MANS): New, union of $(EXTRA_MANS) and $(dist_man1_MANS).
* cfg.mk (check-x-vs-1, sc_option_desc_uppercase): Rely on $(ALL_MANS)
rather than on $(NO_INSTALL_PROGS_DEFAULT) and $(dist_man1_MANS).
2012-09-01 21:28:12 +02:00
Stefano Lattarini
380d9da0b0 build: simplify: get rid of some indirection variables
The code deciding which coreutils programs to build (depending on
defaults, system capabilities, and user requests) is overly complex
and rather confusing.  Let's begin simplifying it by removing some
non-strictly-necessary indirection variables.

* configure.ac: Adjust and improve few comments.
(OPTIONAL_BIN_PROGS, OPTIONAL_PKGLIB_PROGS): Rename ...
(bin_PROGRAMS, pkglibexec_PROGRAMS): ... like these, respectively.
Ensure they aren't initialized in all Makefiles (which would lead
to spurious errors), by calling AM_SUBST_NOTMAKE on them.
* src/local.mk: Adjust and improve few comments.
(bin_PROGRAMS, pkglibexec_PROGRAMS): Simply define
to the corresponding '@substitution@'.
2012-09-01 21:28:12 +02:00
Stefano Lattarini
f49744040d maint: update gitignore entries
* src/.gitignore: Here, adding the '.dirstamp' file generated
by the C compilation rules.
2012-09-01 21:28:12 +02:00
Stefano Lattarini
5efbe9b686 maint: fix one stray reference to src/Makefile.am
* build-aux/gen-lists-of-programs.sh: In heading comments here.
2012-09-01 21:28:12 +02:00
Stefano Lattarini
14956a20db maint: fix and simplify maintainer checks
Some of them can be simplified after the previous changes, some
of them have been downright broken by them, and need fixing.

* src/local.mk: Adjust some comments.
(EXTRA_DIST): Avoid SPACE-TAB sequences.
(src/dircolors.h, src/fs.h src/fs-is-local.h): Avoid 8-SPACES
indentation.
(_sc_check-AUTHORS): Move ...
* cfg.mk (sc_check-AUTHORS): ... here (superseding the old rule
with the same name, that was just a recursive invocation to it).
Adjust the paths of the invoked coreutils programs, to account
for the fact that this rule now runs in the top-level build dir,
not in the 'src/' subdir.  Other minor cosmetic adjustments.
(ALL_RECURSIVE_TARGETS): Remove 'sc_option_desc_uppercase' and
'sc_man_file_correlation', since they no longer entail any
recursive make invocation.
(sc_option_desc_uppercase): Remove dependency from $(all_programs):
it isn't actually needed.
(check-programs-vs-x): Likewise.  Also, fix heading comments to
truly reflect what this check does.
(all-progs-but-lbracket): Strip the 'src/' prefix from each entry
in the list of programs; this avoids a spurious failure in the
'check-programs-vs-x' recipe.
(.PHONY): No need to list targets 'sc_man_file_correlation' and
'sc_option_desc_uppercase': they are automatically declared phony
by 'maint.mk', being recognized as syntax checks.
2012-09-01 21:28:12 +02:00
Stefano Lattarini
3c070d01e4 maint: remove unused target 'install-root'
It was unneeded and broken since the removal of 'su' from GNU
coreutils, in commit v8.17-16-g928dd73 of 2012-06-06, "su: remove
program (util-linux is now the best source for it)".

* Makefile.am (install-root): Remove.
(ALL_RECURSIVE_TARGETS): Update.
2012-09-01 21:28:12 +02:00
Stefano Lattarini
9f84233103 maint: improve remake rules for maintainers
This is a follow up on today's commit v8.19-60-g4f2e62b".

* Makefile.am ($(top_srcdir)/m4/cu-progs.m4,
$(srcdir)/src/cu-progs.mk): New, generate these files from the
'build-aux/gen-lists-of-programs.sh', the same way it's done
from the bootstrap script.
* bootstrap.conf (bootstrap_post_import_hook): Add comment about
the necessity to keep those new rules synced with the commands
here.  Enhance those commands so to that the generated files are
set read-only.
2012-09-01 21:27:46 +02:00
Stefano Lattarini
08466b8f89 build: fix generation of manpages for programs not built by default
* src/local.mk (dist-hook): Don't use this to ensure all the
programs, even the ones disabled by default or by the user, are
built (doing so is required to ensure the distributed manpages
are properly built).  This would build those programs too late
anyway, causing errors like:

    $ make dist
    make  dist-xz am__post_remove_distdir='@:'
    make[1]: Entering directory `~/src/coreutils'
      GEN      man/arch.1
    help2man: can't get '--help' info from man/arch.td/arch
    make[1]: *** [man/arch.1] Error 127
    make[1]: Leaving directory `~/src/coreutils'
    make: *** [dist] Error 2

Instead, ...
* man/local.mk (extra_man_x, extra_man_1): define these ...
($(extra_man_1)): ... and make this depend on $(all_programs).
(EXTRA_DIST): Adjust.
Adjust some comments as well.
2012-09-01 21:25:13 +02:00
Stefano Lattarini
5e60e0d37e build: don't use recursive make to build the 'src' subdirectory
* Makefile.am (SUBDIRS): Remove 'src'.  Ensure '.' is listed before
'tests' and 'gnulib-tests'.
(dist-hook): Adjust: we must now tweak the top-level Makefile.in
in $(distdir), not the one in the 'src/' subdir (which is gone).
(include): The '$(top_srcdir)/src/local.mk' file.
* build-aux/gen-lists-of-programs.sh: Adjust the generation of the
automake input fragment.
* tests/Makefile.am (.built-programs): Adjust.
* cfg.mk (all_programs): Remove this convenience rule; it's no
longer needed, now that we can rely directly on the contents of
$(all_programs).
(sc_option_desc_uppercase, check-programs-vs-x:): Adjust lists
of prerequisites accordingly.
(all-progs-but-lbracket): Simplify definition accordingly.
* configure.ac ($OPTIONAL_BIN_PROGS): Adjust definition.
($OPTIONAL_PKGLIB_PROGS): Likewise.
($NO_INSTALL_PROGS_DEFAULT): Tweak definition, for consistency.
(AC_CONFIG_FILES): Remove 'src/Makefile'.
* src/Makefile.am: Rename ...
* src/local.mk: ... like this, with a lot of adjustments.  In
addition ...
(all_programs): ... remove this now-unneeded convenience target.
2012-09-01 21:25:13 +02:00
Stefano Lattarini
4f2e62ba9f build: refactor how lists of coreutils programs are defined
This is in preparation of future changes.  Still, this patch
leaves the build system in a better shape; true, with more
indirections, but also with less convoluted and brittle hacks.

Unfortunately, this commit also makes some rebuild rules
incomplete; that will son be fixed by follow-up patches.

* build-aux/gen-lists-of-programs.sh: New, generates autoconf
and automake input fragments that define "lists" of all coreutils
programs, with further distinctions about how and when these
programs should be built (by default; if the system is capable
enough; only if the user asks for them explicitly).  This is
useful to avoid duplicating the definitions of these lists among
several files (at least 'configure.ac' 'src/Makefile.am'); such
duplication had proved a source of inconsistencies and bugs in
the past.  And the pre-existing way to avoid such duplication,
as implemented in 'configure.ac' before this patch, was overly
complex and brittle.
* Makefile.am (EXTRA_DIST): Distribute the new script.
* bootstrap.conf (bootstrap_post_import_hook): Run the new script
to generate 'm4/cu-progs.m4' and 'src/cu-progs.mk'.
* .gitignore: Ignore those files.
* configure.ac: Include 'm4/cu-progs.m4', and decidedly simplify
most of the program lists definition and processing accordingly.
* src/Makefile.am: Similarly include 'src/cu-progs.mk', containing
definition of variables $(default__progs), $(no_install__progs)
and $(build_if_possible__progs).  Accordingly ...
(no_install__progs, build_if_possible__progs): ... remove.
(EXTRA_DIST): Adjust definition.
Adjust a comment.
2012-09-01 21:25:13 +02:00
Stefano Lattarini
1aaa8af929 maint: add our 'bootstrap_post_import_hook' function
This is in preparation of future changes.

* bootstrap.conf (bootstrap_post_import_hook): New, will be executed
by bootstrap after gnulib-tool but before the autotools.
Move creation of dummy ChangeLog into it.
2012-09-01 21:25:13 +02:00
Eric Blake
314457b2ae build: work with new glibc when not optimizing
Starting with glibc 2.15, the system headers refuse to compile
unconditional use of FORTIFY_SOURCE if optimization is disabled
but -Werror is in effect.

* configure.ac (FORTIFY_SOURCE): Make conditional.
2012-08-31 13:50:53 -07:00
Jim Meyering
1e4300e926 scripts: fix the Signed-off-by:-prohibiting hook to actually work
* scripts/git-hooks/commit-msg: Fix new test: we're searching a
multi-line buffer, so add the //m modifier.
2012-08-31 13:09:27 +02:00
Stefano Lattarini
badfa5bd0c maint: make required gettext version consistent
* bootstrap.conf ($buildreq): Require gettext >= 0.18.1, consistently
with the call to AM_GNU_GETTEXT_VERSION in configure.ac.
2012-08-31 12:34:15 +02:00
Stefano Lattarini
375b3c0df2 maint: get rid of obsolete script 'cvsu'
It was useful only back when coreutils used CVS as its version
control system.

* build-aux/cvsu: Delete.
* Makefile.am (EXTRA_DIST): Remove it.
* cfg.mk: Remove the two exemptions for this removed file.
2012-08-31 12:23:24 +02:00
Stefano Lattarini
4adf4d2511 build: don't use '$<' in non-suffix rules
* src/Makefile.am (fs-def): Here: it's not portable to some non-GNU
make implementations.
2012-08-31 12:22:10 +02:00
Stefano Lattarini
3099883156 maint: more uses of $(ASSORT)
* src/Makefile.am (fs-kernel-magic, fs-magic): Here, instead of
inlining its expansion "LC_ALL=C sort".
2012-08-31 12:22:09 +02:00
Stefano Lattarini
59b5eb428f maint: remove unused variable in src/Makefile.am
* src/Makefile.am (editpl): This.
2012-08-31 12:22:09 +02:00
Stefano Lattarini
c1269eee5c build: don't use foo_LDADD if there's no foo program
For example, instead of factoring out the extra linker flags needed
by 'cp', 'mv' ind 'install' into a '$(copy_LDADD)' variable, factor
them out in a '$(copy_ldadd)' variable.

Partly a minor cleanup, partly a preparation for future changes.

* src/Makefile.am (copy_LDADD): Rename ...
(copy_ldadd): ... like this.
(remove_LDADD): Rename ...
(remove_ldadd): ... like this.
All uses adjusted.  Some comments updated.
2012-08-31 12:22:09 +02:00
Stefano Lattarini
a159d594fa build: some refactorings in cfg.mk
Partly a minor cleanup, partly a preparation for future changes.

* Makefile.am (all_programs): Rename ...
(all-progs-but-lbracket): ... like this, and re-define it to expand
at make time rather than only at recipe time (i.e., using $(shell ...)
instead of `...`).
(check-programs-vs-x): Adjust.
2012-08-31 12:22:09 +02:00
Stefano Lattarini
a11502a98c build: move definition of 'all_programs' in cfg.mk
* Makefile.am: Move definition of target 'all_programs' from here ...
* cfg.mk: ... to here, which is the only file where it is used.
2012-08-31 12:22:09 +02:00
Jim Meyering
56661fd87a build: reenable just-moved/broken syntax-check rule
* cfg.mk (sc_option_desc_uppercase): Now that this rule lives in cfg.mk,
we must search man/*.1, not "*.1".
Reported by Bernhard Voelker.
2012-08-31 12:08:49 +02:00
Stefano Lattarini
a7c0ed0892 maint: fixup: don't try to distribute a now-removed file
* tests/Makefile.am (EXTRA_DIST): Drop 'check.mk', which has been
removed (being merged into 'tests/Makefile.am') by recent changes.
2012-08-31 11:56:26 +02:00
Erik Auerswald
dc1f1f3c73 doc: escape double quotes in autotools-install --help
* scripts/autotools-install: Fix --help so that we actually print
the double quotes around "make check", in two places.
2012-08-31 11:01:58 +02:00
Jim Meyering
c1495a1107 scripts: add autotools-install, for those stuck with outdated tools
* scripts/autotools-install: New script, so you can always build
from git-cloned sources, even when they require bleeding edge
m4, autoconf, automake, etc.
2012-08-31 10:56:07 +02:00
Bernhard Voelker
c1c92bcb29 build: fix syntax-check rules broken by test-added .sh/pl suffixes
* cfg.mk: We exempt a few test files that would otherwise trigger
false-positive matches in syntax-check rules.  The recent change
that added a .sh or .pl suffix to each test script made it so
some of the exclusion regexps would no longer match.
Include the required \.sh suffix in each such regexp, too.
2012-08-31 10:16:18 +02:00
Stefano Lattarini
4af32c62fa tests: get rid of the 'shell-or-perl' auxiliary script
It's now easier and faster to simply run the perl ans shell test
scripts directly with the appropriate interpreter and options.

* tests/shell-or-perl: Delete.
* tests/Makefile.am (EXTRA_DIST): Remove it.
(SH_LOG_COMPILER): Re-define to invoke the correct shell.
(PL_LOG_COMPILER): Re-define to invoke the correct perl
interpreter ...
(TESTSUITE_PERL_OPTIONS): ... with the correct options.
(XPL_LOG_COMPILER): Use those options instead of inlining
their expansion.
(LOG_COMPILER): Delete, no longer needed.
2012-08-30 18:55:59 +02:00
Stefano Lattarini
9eb4c31eb7 tests: add .sh and .pl suffixes to shell and perl tests, respectively
Not only this shrinks the size of the generated Makefile (from > 6300
lines to ~3000), but will allow further simplifications in future
changes.

* tests/Makefile.am (TEST_EXTENSIONS): Add '.sh' and '.pl'.
(PL_LOG_COMPILER, SH_LOG_COMPILER): New, still defined simply to
$(LOG_COMPILER) for the time being.
(TESTS, root_tests): Adjust as described.
* All tests: Rename as described.
2012-08-30 18:55:59 +02:00
Stefano Lattarini
00f5ba15dd tests: detect missing perl at configure runtime
* configure.ac (AM_CONDITIONAL): Set the conditional 'HAVE_PERL' to
true if the configure-time checks (as run by gl_PERL) have been able
to find a working perl.
* tests/no-perl: New script, report a diagnostic about "missing perl"
and exit with status 77.
* tests/Makefile.am (EXTRA_DIST): Distribute it.
(TESTSUITE_PERL): New, define to '$(PERL)' if a perl interpreter has
been found at configure time (i.e., if the 'HAVE_PERL' automake
conditional is true), and to '$(srcdir)/no-perl' otherwise.
(LOG_COMPILER): Use $(TESTSUITE_PERL) instead of $(PERL).
(XPL_LOG_COMPILER): Likewise.
* tests/shell-or-perl: Simplify: no need to actually check whether
perl is working.
2012-08-30 18:55:59 +02:00
Stefano Lattarini
e44178c590 tests: avoid use of '-T' in shebang line to enable perl taint mode
* tests/rm/fail-eperm: Rename ...
* tests/rm/fail-eperm.xpl: ... like this
* tests/Makefile.am (TESTS): Adjust.
(TEST_EXTENSIONS): New, list '.xpl'.
(XPL_TEST_LOGS): New, run a perl test in tainted mode.
* tests/shell-or-perl: Simplify this script: we no longer need to
parse the shebang line and adjust the flags in the perl invocation
accordingly.
2012-08-30 18:55:59 +02:00
Stefano Lattarini
8381e35e24 build: require Automake >= 1.11.2
Now that we use AM_TESTS_ENVIRONMENT, we must require
Automake >= 1.11.2.
* configure.ac (AM_INIT_AUTOMAKE): Bump version requirement to 1.11.2.
* bootstrap.conf ($buildreq): Likewise.
2012-08-30 18:55:54 +02:00
Stefano Lattarini
34c9c8f70f tests: prefer AM_TESTS_ENVIRONMENT over TESTS_ENVIRONMENT
The latter should be reserved for user overrides.

* tests/Makefile.am (TESTS_ENVIRONMENT): Rename ...
(AM_TESTS_ENVIRONMENT): ... like this.
2012-08-30 16:54:09 +02:00
Stefano Lattarini
cddadbcd80 tests: merge tests/check.mk into tests/Makefile.am
The separation has become unnecessary after all the ancient
'tests/*/Makefile.am' makefiles have been merged into the
"more-top-level" one 'tests/Makefile.am'.

* tests/check.mk: Merge ...
* tests/Makefile.am: ... in here.  Some comments tweaking while
at it.
2012-08-30 16:53:59 +02:00
Stefano Lattarini
4837ecd7e8 build: enable the 'subdir-objects' Automake option globally
This is not strictly required now (it will be once we make more
parts of the coreutils build system non-recursive), but enabling
it early helps to ensure that we don't unwittingly introduce any
incompatibility or subtle breakage later.

* configure.ac (AM_INIT_AUTOMAKE): Add  'subdir-objects'.
2012-08-30 16:05:19 +02:00
Stefano Lattarini
fb6b70e337 maint: update gitignore entries
* doc/.gitinore: Here, adding the '.dirstamp' file generated by
the Texinfo rules.
2012-08-30 15:22:00 +02:00
Jim Meyering
a13ffec338 build: factor out a little more re list of *.texi files
We may well want to switch from checking all *.texi to
checking only version-controlled .texi files, so encapsulate
this concept in one place.

* doc/local.mk (doc_srcdir): Delete.  Use this instead:
(texi_files): Define.  All usages adjusted.
2012-08-30 15:22:00 +02:00
Stefano Lattarini
408abf8586 maint: adjust syntax check 'sc_option_desc_uppercase'
* cfg.mk (sc_option_desc_uppercase): Here, by grafting the 'man/'
prefix to the manpages obtained from $(NO_INSTALL_PROGS_DEFAULT)
and listed as prerequisites for this rule.
2012-08-30 15:22:00 +02:00
Stefano Lattarini
63bf5a3d42 maint: adjust syntax check 'check-x-vs-1'
* cfg.mk (check-x-vs-1): Here, by stripping 'man/' prefix from
$(dist_man1_MANS) entries before comparing them with the list of
expected programs.
2012-08-30 15:22:00 +02:00
Stefano Lattarini
b842b88381 maint: move man-related syntax checks in cfg.mk
This is more natural, now that the top-level Makefile has access to
all the variables and rules once defined only in 'man/Makefile.am'

* man/local.mk (all_programs, sc_option_desc_uppercase,
sc_man_file_correlation check-x-vs-1, check-programs-vs-x): Move
from here ...
* cfg.mk: ... to here.  Adjust some comments in the process.
2012-08-30 15:22:00 +02:00
Stefano Lattarini
44547edd7c build: don't use recursive make to build the 'man' subdirectory
* Makefile.am: Include 'man/local.mk'.
(SUBDIRS): Remove 'man'.
* configure.ac ($MAN): Adjust so that each of its entries has a leading
'man/' component.
(AC_CONFIG_FILES): Remove 'man/Makefile'.
* man/Makefile.am: Rename ...
* man/local.mk: ... like this.  With further adjustments: each 'foo.1'
target renamed like 'man/foo.1', each '../src/foo.c' dependency as
'src/foo.c', and each '$(srcdir)' usage as '$(srcdir)/man'.  Also ...
(mandep): Adjust, removing the leading '../' component.
Several whitespace adjustments while at it.
(ASSORT): Remove, it's already defined in the top-level Makefile.am.
* cfg.mk (sc_option_desc_uppercase, sc_man_file_correlation): Remove
the associated recipes, they are now directly available from the
included 'man/local.mk'.  Actually, the other changes in this commit
have made these recipes instable and not completely correct, but that
will be fixed in later changes.
2012-08-30 15:22:00 +02:00
Stefano Lattarini
34e2473f41 build: rework some recipes in man/Makefile.am, for future changes
This change is merely required to make future changes easier.

In particular, since we are going to merge the contents of
'man/Makefile.am' into the top-level Makefile, we need to avoid
conflicts with the rules and variables in 'dist-check.mk', and
to prepare for changes in the value of the '$*' variable as used
in the recipe of the '.x -> .1' suffix rule.

* man/Makefile.am (t, mapped_name): Delete, inlining their use ...
(.1.x): ... in the recipe of this suffix rule.  Other adjustments
to prepare to changes in the value of the '$*' automatic variable.
While at it, made more resilient about unlikely but possible failure.
Adjust and reorder few comments.
2012-08-30 15:22:00 +02:00
Stefano Lattarini
b10412567f build: provide convenience target 'all_programs' also at top-level
This will be mostly useful in future changes.

* Makefile.am (all_programs): New, simply work by delegating to
the same-named target in the 'src/' subdirectory.
* cfg.mk (sc_option_desc_uppercase): Take advantage of it.
(sc_man_file_correlation): Likewise.
2012-08-30 15:22:00 +02:00
Stefano Lattarini
c81ac64ce7 build: make a rule less dependent on exact source tree layout
This is mostly a preparatory change in view of future ones.

* man/Makefile.am (.x.1): Use '$(abs_top_builddir)/src' to access
the 'src' directory.
2012-08-30 15:22:00 +02:00
Stefano Lattarini
a5493c59d6 build: rely on VPATH capabilities in man/Makefile
* man/Makefile.am: In all the 'foo.1' targets, no need to depend
explicitly on '$(srcdir)/foo.x': the '.x.1' suffix rule takes care
of that automatically.
2012-08-30 15:22:00 +02:00
Stefano Lattarini
2e255f4951 maint: typofix: s/it's/its/
* man/Makefile.am: Here.
2012-08-30 15:22:00 +02:00
Stefano Lattarini
b94e30af66 build: rename common_dep -> mandep in man/Makefile
This is mostly a preparatory refactoring in view of future changes.

* man/Makefile.am (common_dep): Rename ...
(mandep): ... like this.
All usages adjusted.
2012-08-30 15:21:59 +02:00
Stefano Lattarini
9669de8688 build: fix a stray usage of uninitialized $(ME)
* man/Makefile.am (sc_option_desc_uppercase): Here.
2012-08-30 15:21:59 +02:00
Stefano Lattarini
0f54e9761f build: add an explanatory comment
* man/Makefile.am (EXTRA_DIST): Describe portability issues of the
idiom we now use.  Reformat the definition a little while at it.
2012-08-30 15:21:59 +02:00
Stefano Lattarini
60b01f9f02 maint: simplify definition of $MAN in configure.ac
* configure.ac: Here, by making less use of 'sed' and 'tr' munging,
and relying on a smarter and simpler shell loop instead.
2012-08-30 15:21:59 +02:00
Stefano Lattarini
7e85a52be4 build: don't define $(SUFFIXES) explicitly
* man/Makefile.am (SUFFIXES): Remove definition: Automake is smart
enough to extract the list of suffixes from the '.x.1' suffix rule
automatically.
2012-08-30 15:21:59 +02:00
Stefano Lattarini
f56980b99c build: don't use recursive make to build the 'doc' subdirectory
* doc/Makefile.am: Rename ...
* doc/local.mk: ... like this.  With further adjustments ...
(info_TEXINFOS): Prepend 'doc/' to all '*.texi' files listed in
here.
(coreutils_TEXINFOS): Likewise, and rename ...
(doc_coreutils_TEXINFOS): ... like this.
(constants.texi): Rename ...
(doc/constants.texi): ... like this.  Adjust the recipe to avoid
spurious errors.
(MAINTAINERCLEANFILES): Adjust, and extend with '+=' rather than
setting it with '='.
(ME): Delete.
(find_upper_case_var): Use '$@', not '$(ME)', in error messages.
* Makefile.am: Include 'doc/local.mk'.
(SUBDIRS): Remove 'doc'.
* configure.ac (AC_CONFIG_FILES): Remove 'doc/Makefile'.
2012-08-30 15:21:59 +02:00
Stefano Lattarini
d1b490c10d build: use 'check-local' to extend the 'check' target
* doc/Makefile.am (check-local): Here, by making this depend
on 'check-texinfo' ...
(check): ... rather than this.  While the old usage worked, it
did so for an implementation detail rather than a documented
behaviour, so relying on that was riskier a "unclean".
2012-08-30 15:21:59 +02:00
Stefano Lattarini
08d428c2d3 build: prefer '$(top_srcdir)/doc' over '$(srcdir)' in doc Makefile
This is just a preparatory refactoring that will become useful in
a future change (in which the doc/Makefile.am makefile will be merged
with the top-level one).

* doc/Makefile.am (doc_srcdir): New, define to '$(top_srcdir)/doc'.
Use it throughout instead of "bare" '$(srcdir)'.
2012-08-30 15:21:59 +02:00
Stefano Lattarini
e8c41cf753 build: add extra *.texi files to coreutils_TEXINFOS, not EXTRA_DIST
* doc/Makefile.am (coreutils_TEXINFO): List them here, instead of ...
(EXTRA_DIST): ... listing them here.  This ensures the rebuild rules
will be more faithful.
($(DVIS), $(INFO_DEPS)): No need to depend on $(EXTRA_DIST) now.
2012-08-30 15:21:59 +02:00
Stefano Lattarini
4b12790386 maint: slightly improve .gitignore
* .gitignore: Ignore '.deps' only when it's a directory.
Ignore '*.trs' only if they are in a subdirectory of the
'tests/' directory.
2012-08-30 15:21:59 +02:00
Stefano Lattarini
a48da7137a build: don't abuse Automake internals (with its 'check-am' rule)
* tests/check.mk (check-am): Remove; obtain the same effect by moving
its dependency '.built-programs' ...
(check_DATA): ... to this variable.
2012-08-30 15:21:59 +02:00
Jim Meyering
19baf1679d scripts: git commit message hook: prohibit use of "Signed-off-by:"
* scripts/git-hooks/commit-msg: Reject a commit log message that
contains "Signed-off-by:".
2012-08-30 13:12:44 +02:00
Stefano Lattarini
812dfda461 tests: remove useless defn of REPLACE_GETCWD from TESTS_ENVIRONMENT
It's last use had been removed in commit v8.12-3-g3ed91fc of 2011-04-28,
"tests: remove useless test: misc/pwd-unreadable-parent".

* tests/check.mk (TESTS_ENVIRONMENT): Adjust.

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
2012-08-30 11:16:26 +02:00
Nick Alcock
43f17f39e7 tests: fix misc/sort-exit-early to skip if root
* tests/misc/sort-exit-early: skip_if_root_ as this test
requires an unwritable input and an unreadable output.
2012-08-30 02:26:15 +01:00
Jim Meyering
c9888e0deb tail,stat: improve support for ZFS
This change enables tail -f to use inotify and lets
stat -f --format=%T report the file system type name, "zfs".
* src/stat.c (human_fstype): Add a case: zfs, 0x2fc12fc1.
* NEWS (Improvements): Mention it.
* THANKS.in: Update.
Reported by Raimonds Miltins in http://bugs.gnu.org/12301.
2012-08-29 09:42:33 +02:00
Jim Meyering
58afeebe08 build: update gnulib submodule to latest 2012-08-26 22:47:57 +02:00
Jim Meyering
26db95ca47 maint: stop using @acronym{...} in texinfo sources
* doc/coreutils.texi: Remove all uses of @acronym{...},
per recommendation by Karl Berry.
* doc/perm.texi: Likewise.
* cfg.mk (local-checks-to-skip): Remove exemption, enabling
the @acronym{-prohibiting syntax-check rule.
2012-08-26 22:47:04 +02:00
Jim Meyering
9766362d07 tests: don't require @acronym{...} around POSIX
* doc/Makefile.am (check-texinfo): Remove POSIX-checking part.
2012-08-26 22:46:54 +02:00
Nguyễn Thái Ngọc Duy
87e71b2d77 df: allow translators to reorder "1K-blocks" header
* src/df.c (get_header): Mark two "%s-%s" strings for translation
and give translators a hint what each is for.
2012-08-26 22:39:12 +02:00
Ondrej Oprala
c9f4c32322 md5sum, sha*sum: add --tag to output a format indicating the algorithm
The format used is the BSD traditional format which looks like:
MD5 (/dev/null) = d41d8cd98f00b204e9800998ecf8427e

* NEWS: Add new feature info.
* doc/coreutils.texi (md5sum invocation): Add detailed information
about the new --tag option.
* src/md5sum.c: Add the new --tag option for BSD-style output.
(bsd_split_3): Add ESCAPED_FILENAME parameter.
(print_filename): New function refactored from main().
(filename_unescape): New function refactored from split_3().
* tests/misc/md5sum-bsd: Add tests for the new feature.
2012-08-24 15:56:26 +01:00
Rob Day
dd22da8e95 rm: fix the new --dir (-d) option to work with -i
* src/remove.c (prompt): Hoist the computation of is_empty, since we'll
need it slightly earlier.
Before, this function would arrange to fail with EISDIR when processing
a directory without --recursive (-r).  Adjust the condition to exempt
an empty directory when --dir has been specified.
Improve comments.
* tests/rm/d-3: New file, to ensure that rm -d -i dir works.
* tests/Makefile.am (TESTS): Add it.
* NEWS (Bug fixes): Mention it.
* THANKS.in: Update.
Reported by Michael Price in http://bugs.gnu.org/12260
2012-08-23 20:53:04 +02:00
Bernhard Voelker
fadf9c5257 tests: correct print_ver_ arguments and add a rule to enforce this
We use print_ver_ to run "PROG --version" for each program under
test.  Some tests have been derived from others, while the
argument(s) to print_ver_ have not been adapted.
Add a new cfg.mk rule to prohibit this.

* cfg.mk (sc_prohibit_test_calls_print_ver_with_irrelevant_argument):
New rule, to prohibit a test script from calling print_env_ for a
program not actually used by that test.
* tests/chown/basic: s/\(print_ver_\) chgrp/\1 chown/
* tests/cp/acl: s/\(print_ver_\) mv/\1 cp/
* tests/cp/capability: s/\(print_ver_\) ls/\1 cp/
* tests/cp/cp-parents: s/(print_ver_\) mv/\1 cp/
* tests/du/bind-mount-dir-cycle: s/(print_ver_\) rm/\1 du/
* tests/misc/wc-parallel: s/(print_ver_\) md5sum/\1 wc/
2012-08-22 15:45:01 +02:00
Ondrej Oprala
cf7e1b5b8f du: handle bind-mounted directory cycles gracefully
Before this change, a directory cycle induced by a bind mount
would be treated as a fatal error, i.e., probable disk corruption.
However, such cycles are relatively common, and can be detected
efficiently, so now du emits a descriptive warning and arranges
to exit nonzero.

* NEWS (Bug fixes): Mention it.
* src/du.c: Include "mountlist.h".
(di_mnt): New global set.
(di_files): Rename global from di_set, now that there are two.
(fill_mount_table): New function.
(hash_ins): Add DI_SET parameter.
(process_file): Look up each dir dev/ino pair in the new set.
(main): Allocate, initialize, and free the new set.
* tests/du/bind-mount-dir-cycle: Add a test for the fix.
* tests/Makefile.am (TESTS): Add it.
* THANKS.in: Update.
This implements the proposal in http://bugs.gnu.org/11844.
Originally reported in http://bugs.debian.org/563254 by Alan Jenkins
and more recently as http://bugzilla.redhat.com/836557

Improved by: Jim Meyering
2012-08-21 19:49:36 +02:00
Jim Meyering
fe5b5eed94 maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2012-08-20 08:26:57 +02:00
Jim Meyering
76ea9b1ada version 8.19
* NEWS: Record release date.
2012-08-20 08:13:02 +02:00
Paul Eggert
aa1ec87f52 tests: port df/no-mtab-status to Solaris
* tests/df/no-mtab-status: Include <mntent.h> in test program, so
that the getmntent hack compilation fails on Solaris, as it
should, since it's not compatible with Solaris.  Reported by
Stefano Lattarini in <http://bugs.gnu.org/12225>.
2012-08-19 22:31:39 +02:00
Jim Meyering
e44943a25e tests: avoid split/filter test failure on very low-mem system
* tests/split/filter: Use xz -1 when compressing, to minimize
memory usage.  Otherwise, xz could fail due to insufficient
virtual memory on a system with very little free memory.
2012-08-19 17:34:04 +02:00
Jim Meyering
46444af9e4 tests: trigger the sort -u free-memory-read bug
* tests/misc/sort-u-FMR: New file.
* tests/Makefile.am (TESTS): Add it.
* tests/misc/sort: Add the test here, too.
* NEWS (Bug fixes): Mention it.
2012-08-18 08:03:55 +02:00
Jim Meyering
b8104e47ca tests: wrap the valgrind-requiring assertion in a function
* tests/init.cfg (require_valgrind_): New function...
* tests/misc/sort-stale-thread-mem: ...extracted from here.
2012-08-18 07:39:49 +02:00
Paul Eggert
574b7c7dbe sort: simpler fix for sort -u data-loss bug, and for a FMR bug
This also fixes a free-memory-read (FMR) bug: when fillbuf's realloc
of buf->buf frees the buffer into which saved_line.text points,
the processing of that just-read longer line includes comparison
against the saved line in freed memory.
* src/sort.c (overlap): Remove.
(fillbuf): Do not try to copy saved lines, as that is too risky
in the presence of parallelism, reallocated buffers, etc.
(sort): Invalidate any saved line before sorting a new batch.
2012-08-18 07:39:29 +02:00
Jim Meyering
eb3f5b3b3d sort: sort --unique (-u) could cause data loss
sort -u could omit one or more lines of expected output.
This bug arose because sort recorded the most recently printed line via
reference, and if you were unlucky, the storage for that line would be
reused (overwritten) as additional input was read into memory.  If you
were doubly unlucky, the new value of the "saved" line would not only
match the very next line, but if that next line were also the first in
a series of identical, not-yet-printed lines, then the corrupted "saved"
line value would result in the omission of all matching lines.

* src/sort.c (saved_line): New static/global, renamed and moved from...
(write_unique): ...here.  Old name was "saved", which was too generic
for its new role as file-scoped global.
(fillbuf): With --unique, when we're about to read into a buffer that
overlaps the saved "preceding" line (saved_line), copy the line's .text
member to a realloc'd-as-needed temporary buffer and adjust the line's
key-defining members if they're set.
(overlap): New function.
* tests/misc/sort: New tests.
* NEWS (Bug fixes): Mention it.
* THANKS.in: Update.
Bug introduced via commit v8.5-89-g9face83.
Reported by Rasmus Borup Hansen in
http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/23173/focus=24647
2012-08-17 09:52:19 +02:00
Jim Meyering
0c98bfa359 tests: reverse args in Coreutils.pm-invoked diff, for consistency
* tests/Coreutils.pm (_compare_files): Reverse diff arguments so
that we invoke diff -c $expected $actual, which is consistent with
how init.sh-using tests invoke "compare exp out".
2012-08-16 20:14:03 +02:00
Jim Meyering
1e987a9966 maint: correct a stale comment in sort.c
* src/sort.c (fillbuf): Fix comment typo.  x2nrealloc no longer
doubles the size of its input buffer.
2012-08-16 20:13:59 +02:00
Jim Meyering
f1a03de07f maint: fix comment grammar to placate make syntax-check
* src/remove.c (rm_fts): s/can not/cannot/
2012-08-16 19:25:40 +02:00
Krzysztof Goj
fdc2da7165 rm: new option --dir (-d) to remove empty directories
Add new option to rm (-d/--dir), which allows removal of
empty directories, while still safely disallowing removal
of non-empty ones.

This improves compatibility with Mac OS X and BSD systems,
which honor the -d option.

* src/remove.c (rm_fts): Remove empty directories when requested.
* src/remove.h (rm_options) [remove_empty_directories]: New member.
* src/rm.c (long_opts, usage, main): Update usage and option parsing.
(rm_option_init): Initialize the new member.
* src/mv.c (rm_option_init): Initialize the new member.
* tests/rm/d-1: New test case - successfully delete empty dir.
* tests/rm/d-2: New test case - refuse to delete nonempty dir.
* tests/Makefile.am (TESTS): Add them.
2012-08-14 18:54:16 +02:00
Bernhard Voelker
46afefaaa8 df: fail when the mount list is required but cannot be read
* src/df.c (main): Add conditions to fail when the mount list cannot
be read: this includes the cases when a file name argument is given
and any of -a, -l, -t or -x is used.
* doc/coreutils.texi: Document the additional error conditions.
* tests/df/no-mtab-status: Add a new test.
* tests/Makefile.am: Reference the new test.
* NEWS: Mention the fix.
2012-08-14 11:34:54 +02:00
Jim Meyering
a07dfa9064 maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2012-08-12 10:07:32 +02:00
Jim Meyering
7e96482b47 version 8.18
* NEWS: Record release date.
2012-08-12 09:37:42 +02:00
Pádraig Brady
433de5ebbd tests: fix validation of local file systems
* tests/init.cfg (require_mount_list_): A new function
to ensure we can read the list of file systems.
(require_local_dir_): Call the above function, as otherwise
the check is invalid.
* tests/df/total-unprocessed: Ensure df can read the
list of mounted file systems so that --local can be honored.
2012-08-08 17:46:58 +01:00
Jim Meyering
1bacb4bca6 build: update gnulib submodule to latest 2012-08-06 16:02:39 +02:00
Jim Meyering
47583adced tests: printf-surprise: avoid unwarranted failure on FreeBSD 9.0
* tests/misc/printf-surprise: A VM size of 10,000KiB was too
little in which to run "env printf ..." on FreeBSD 9.0-p3.
Increase it to 15,000.
2012-08-06 16:02:28 +02:00
Jim Meyering
f1b85e3ca7 build: avoid sort link failure on Solaris 10
* src/Makefile.am (sort_LDADD): Sort uses euidaccess, which may require
whatever library configure deemed necessary to resolve the eaccess
function, but no one told sort to link with that library.
(sort_LDADD): Add $(LIB_EACCESS).
2012-08-05 10:05:13 +02:00
Bernhard Voelker
3b8139e85f df: fix exit code and error messages with --total
When the combination of the file system options with given files or
devices does not lead to output, "df --total" would exit successfully
although it should not.

Examples:
  $ df --total --type=xfs /          # when / is not an XFS file system
  $ df --total --local -t nfs  DIR   # nfs is remote per se ...
  $ df --total -t qwerty /dev/sdb5   # typo in file system type

Furthermore, "df --total" would not print the error message "no file
systems processed" when the file argument does not exist or is otherwise
not accessible.

Example:
  $ df --total __not_exist__

These 2 bugs are present since --total was added by commit
v6.12-166-gea2887b.

* src/df.c (get_dev): Do not set file_systems_processed to true when
force_fsu is true, i.e. when the row for the "total" line is processed.
(main): Don't print totals unless we've processed a file system.
Also only print the "no FS processed" message if there was no
preceding diagnostic.
* tests/df/total-unprocessed: Add a new test.
* tests/Makefile.am: Reference the new test.
* NEWS: Mention the fix.

Improved-by: Jim Meyering
2012-08-04 17:30:07 +01:00
Jim Meyering
cbd1cffa3e truncate: don't leak a file descriptor with --ref=PIPE
* src/truncate.c (main): For a user who makes the mistake of
using a non-seekable file as a reference for the desired length,
truncate would open that file, attempt to seek to its end, but
upon seek failure would neglect to close the file descriptor.
Close the file descriptor even when lseek fails.
In addition, ignore failure to close that reference FD, since as
long as the lseek succeeds, a close failure doesn't matter.
Coverity spotted the potential FD leak.

Improved-by: Pádraig Brady.
2012-08-04 12:27:20 +02:00
Jim Meyering
4bee223d96 tests: avoid FP ulimit failure with valgrind-wrapped tools
* tests/init.cfg (require_ulimit_): Raise VM limit from 10MiB to
20MiB, to accommodate overhead of a valgrind-wrapped date program.
Also declare this function's local variables "local".
2012-08-04 12:03:06 +02:00
Jim Meyering
4abec7ef9a split: plug nominal leaks
* src/split.c (lines_rr) [IF_LINT]: Plug a harmless leak.
(main) [IF_LINT]: Free a usually-small (~70KB) buffer
just before exit, mainly to take this off the radar of
leak-detecting tools.

Improved-by: Pádraig Brady.
2012-08-04 11:32:01 +02:00
Jim Meyering
e11a2cf319 tail: avoid rare error-path FD leak
* src/tail.c (tail_forever): Close FD to avoid leak after a
failed fstat.
2012-08-03 14:54:01 +02:00
Jim Meyering
74a1c05875 maint: refresh stale local gnulib patch files
We carry local adjustments for a few gnulib modules via the
patches in gl/.  Nearly all of those patches had become stale
due to evolution of the originals in gnulib.

To refresh them, first make sure you have no local changes in gl/
or in the gnulib submodule, then run "make refresh-gnulib-patches".
2012-07-27 12:15:32 +02:00
Jim Meyering
a6e8e3a3e1 tail: avoid misleading diagnostic upon fstat failure
* src/tail.c (check_fspec): Save fstat-induced errno *before*
calling close_fd, not after.  Otherwise, the close could well
clobber the global errno, making tail print an invalid diagnostic.
This could happen only with tail -f, and even then, only when
a valid file descriptor were to provoke fstat failure.
2012-07-25 19:00:22 +02:00
Pádraig Brady
d75e93cb76 tests: add a test for a previously fixed output format bug in join
Add a test and NEWS entry for a bug inadvertently fixed in
a refactoring in commit v8.9-32-gd4db0cb

* tests/misc/join (v2-format): Add a new test.
* THANKS.in: Add the reporter.
* NEWS: Mention the old bug.
* cfg.mk (old_NEWS_hash): Update.

Reported-by: Jean-Pierre Tosoni
2012-07-23 09:54:18 +01:00
Pádraig Brady
f93d5985a2 doc: mention gethostid(3) in hostid(1)
* man/hostid.x: Add gethostid(3) to SEE ALSO section.
Addresses http://bugs.gnu.org/12023
2012-07-22 13:01:03 +01:00
Erik Auerswald
3ca80461c2 doc: mention uniq(1) in sort(1) man-page and vice versa
* man/sort.x: Add SEE ALSO section with entry uniq(1).
* man/uniq.x: Add sort(1) to SEE ALSO section.
2012-07-22 10:59:36 +02:00
Jim Meyering
7308099bbc maint: stzncpy: restrict pointer parameters
* src/system.h (stzncpy): Add "restrict" attribute to each pointer
parameter and note in the comment that the buffers must not overlap.
2012-07-21 12:08:31 +02:00
Joachim Schmitz
f24bf0448e maint: rm: remove two more unused static inline functions
* src/remove.c (cache_stat_ok, is_nondir_lstat): Remove unused
functions.
2012-07-20 17:31:40 +02:00
Jim Meyering
f173180a96 maint: adjust exemption to track renamed test script
* cfg.mk (exclude_file_name_regexp--sc_file_system): Sync this
exemption regexp to match renamed tests/df/df-P.  This avoids
a "make syntax-check" failure.
2012-07-20 15:10:14 +02:00
Joachim Schmitz
05364ffe0d maint: rm: remove unused static-inlined functions
* src/remove.c (cache_statted, is_dir_lstat): Remove unused
static-inlined functions.
* THANKS.in: Remove my name from this list, now that (with this
commit) it is included automatically.
Copyright-paperwork-exempt: Yes
2012-07-20 15:05:38 +02:00
Andrew D Warshall
4fcef6991d tests: fiemap-perf: avoid a false failure on ext2
* tests/cp/fiemap-perf: Skip the test on ext2 file systems,
as we do for ext3.  Also skip the test if we can't create
a 1TiB file, which might not be supported on certain file systems.

Signed-off-by: Pádraig Brady <P@draigBrady.com>
2012-07-18 17:22:27 +01:00
Pádraig Brady
2f90a1b191 maint: move two df tests from tests/misc to tests/df
* test/Makefile.am: Reference the moved tests.
2012-07-16 02:51:41 +01:00
Pádraig Brady
3ed70fd559 df: don't output control characters in a mount point name
It's awkward to read and problematic for scripts when
control characters like '\n' are output.

Note other fields are already handled with mbsalign,
which converts non printable chars to the replacement char.
A caveat to note with that, is the replacement char takes
a place in the field and so possibly truncates the field
if it was the widest field in the records.

Note a more general replacement function, that
handles all printable, or non white space characters,
would require more sophisticated support for various
encodings, and the complexity vs benefit was not
deemed beneficial enough at present.
Perhaps in future a more general replacement function
could be shared between the various utilities.

Note <space> is unaffected in any field,
which could impact scripts processing the output.
However any of the number fields at least could have
spaces considering `LANG=fr_FR df -B\'1`, so it's
probably best to leave spaces, which also allows
scripts to handle mount points with spaces without change.

* src/df.c (hide_problematic_chars): Replace control chars with '?'.
* tests/df/problematic-chars: Add a new root only test.
* tests/Makefile.am: Reference the new test.
* NEWS: Mention the fix.
2012-07-16 02:48:31 +01:00
Jim Meyering
ac00d23e1a pinky,who: fix bug in latest change
* src/system.h (stzncpy): New function.
* src/pinky.c (print_entry): Use stzncpy, not stpncpy.
The latter does not NUL-terminate.  I assumed that strncpy was
the only function with such a horrible API.  Today I learned that
stpncpy also may not NUL-terminate its result.
The bugs were introduced in commit v8.17-48-gf79263d.
* src/who.c (print_user): Likewise.
Thanks to Erik Auerswald for spotting my error.
2012-07-15 19:11:45 +02:00
Jim Meyering
e380221333 build: update gnulib submodule to latest 2012-07-15 15:34:45 +02:00
Jim Meyering
f79263da4d maint: remove unwarranted uses of strncpy
* src/pinky.c (print_entry): Remove unwarranted uses of strncpy.
Instead, use stpcpy and stpncpy.
* src/who.c (print_user): Likewise.
* cfg.mk: Remove strncpy exemptions.
2012-07-15 13:43:49 +02:00
Jim Meyering
3c2973b86e build: shred.c: avoid i686-specific gcc -Wstrict-overflow warning
* src/shred.c: Avoid gcc -Wstrict-overflow warning.
Addresses http://bugs.gnu.org/11927
2012-07-15 11:39:01 +02:00
Bruno Haible
5733f8f982 doc: clarify meaning of '-parodd' in stty help
* src/stty.c (usage): Disambiguate explanation of -parodd.
* THANKS.in: Add reporter.
Reported by Michael Stummvoll
2012-07-13 15:06:10 +01:00
Pádraig Brady
8523a37c85 doc: mention the improved sort memory allocation
* NEWS: Mention the improvement.
2012-07-12 23:56:42 +01:00
Stefano Lattarini
3900871c3a doc: fix errors and warnings with Texinfo 5
Or rather, with the development version 4.13.90, which will eventually
become Texinfo 5.0.

* doc/coreutils.texi: Use '@item' instead of '@itemx' in several places,
as Texinfo 5 refuses to process an '@itemx' that is not preceded by an
'@item'.  Ensure that node extended names in menus and sectioning are
consistent, and that ordering and presence of nodes in menus and in the
actual text are consistent as well.

Fixes http://bugs.gnu.org/11828
2012-07-12 15:08:34 +01:00
Bernhard Voelker
453ce92f6f df: warn if soon-to-be-removed --megabyte option is used
* src/df.c (MEGABYTES_OPTION): Add enum and mark it for removal
in August 2013.
(long_options): Use MEGABYTES_OPTION for --megabytes option.
(main): Add a case for it and issue a deprecation warning if
the long form is used.  Document the short -m option to
exist only for BSD compatibility.
2012-07-11 20:30:21 +02:00
Paul Eggert
c2f590dc9a sort: by default, do not exceed 3/4 of physical memory
* src/sort.c (default_sort_size): Do not exceed 3/4 of total memory.
See Jeff Janes's bug report in
<http://lists.gnu.org/archive/html/coreutils/2012-06/msg00018.html>.
2012-07-10 16:16:33 -07:00
Pádraig Brady
d569dbe587 tests: sort-merge-fdlimit: reduce the limit by one
* tests/misc/sort-merge-fdlimit: As a consequence of commit
v8.17-34-g59daf05, we can reduce the descriptor limit by one.
2012-07-06 10:41:50 +01:00
Paul Eggert
71df4e29ed doc: document leap seconds better
* doc/coreutils.texi (touch invocation, Time conversion specifiers)
(Options for date, Examples of date): Index "leap seconds" and
improve their documentation a bit.
2012-07-05 23:13:13 +00:00
Paul Eggert
50ad993505 doc: fix spacing
* doc/coreutils.texi: Use right amount of spacing after punctuation.
2012-07-05 23:13:12 +00:00
Jim Meyering
cc322ddd16 date: fails to diagnose invalid input
date -d "$(printf '\xb0')" would print 00:00:00 with today's date
rather than diagnosing the invalid input.  Now it reports this:
date: invalid date '\260'
* gnulib: Update submodule to latest for fixed parse-datetime.y.
* tests/misc/date [invalid-high-bit-set]: New test.
* NEWS (Bug fixes): Mention it.
* bootstrap, tests/init.sh: Also update to latest.
Reported by Peter Evans in http://bugs.gnu.org/11843
2012-07-04 13:32:24 +02:00
Jim Meyering
74427c76d7 maint: add syntax-check rule to help avoid misuse of EXIT_FAILURE
* cfg.mk (sc_some_programs_must_avoid_exit_failure): New rule,
to help us avoid using EXIT_FAILURE in programs like sort, ls, nohup,
timeout, env, etc. that use different exit codes in many cases.
2012-07-03 20:14:56 +02:00
Jim Meyering
fc895b0772 maint: fix minor bugs in helper program, setuidgid
* src/setuidgid.c (main): Fix two error-before-usage calls not to exit.
Exit with status SETUIDGID_FAILURE (not EXIT_FAILURE) consistently.
2012-07-03 20:13:09 +02:00
Paul Eggert
f3bd32bae2 sort: fix exit-status typo
* src/sort.c (stream_open): EXIT_FAILURE -> SORT_FAILURE.
Suggested by Pádraig Brady in <http://bugs.gnu.org/11816#34>.
2012-07-02 16:46:59 -07:00
Paul Eggert
59daf05b75 sort: simplify -o handling to avoid fdopen, assert
* src/sort.c (outfd): Remove.  All uses replaced by STDOUT_FILENO.
(stream_open): When writing, use stdout rather than fdopen.
(move_fd_or_die): Renamed from dup2_or_die, with the added functionality
of closing its first argument.  All uses changed.
(avoid_trashing_input): Special case for !outfile no longer needed.
(check_output): Arrange for standard output to go to the file,
rather than storing the fd in outfd.
2012-07-02 16:46:59 -07:00
Pádraig Brady
44fbd3fd86 sort: avoid redundant processing with inaccessible inputs or output
* src/sort.c (check_inputs): A new function to verify all inputs
are accessible before further processing.
(check_output): A new function to open or create a specified
output file, before futher processing.
(stream_open): Adjust to truncating the previously opened
output file rather than opening directly.
(avoid_trashing_input): Optimize to stat the output file
descriptor, rather than the file name.
(main): Call the new functions to check accessibility of
inputs and output, before processing starts.
* tests/misc/sort: Adjust to the changed error message.
* tests/misc/sort-merge-fdlimit: Account for the earlier opened
file descriptor of the specified output file.
* tests/misc/sort-exit-early: A new test to exercise the improvements.
* tests/Makefile.am: Reference the new test.
* NEWS: Mention the improvement.

Suggested-by: Bernhard Voelker
2012-07-02 21:14:29 +02:00
Pádraig Brady
8285c2aca0 maint: sc_prohibit_fail_0: update a stale comment
* cfg.mk (sc_prohibit_fail_0): Following on from
commit v8.0-79-g71c2f88, update the comment to match.
2012-07-02 20:41:40 +02:00
Pádraig Brady
f0cb202d55 maint: avoid a -Wunsed-but-set warning on some systems
* src/stty.c (main): Mark speed_was_set as possibly unused,
as is the case when CIBAUD is undefined (on ppc64 GNU/Linux
for example).
Reported-by: Stefano Lattarini
2012-07-02 12:34:16 +02:00
Jim Meyering
fdfac0d159 maint: avoid false-positive syntax-check failure due to fail=0 in .texi
* cfg.mk (exclude_file_name_regexp--sc_prohibit_fail_0): Exempt
all .texi files.
2012-06-30 18:29:38 +02:00
Jim Meyering
b0d8d32429 stat,tail: recognize new file system type: aufs
* src/stat.c (human_fstype) [__linux__]: Add a 'case' for the new
remote file system type: aufs (0x61756673).
* NEWS (New features): Mention stat -f.
(Bug fixes): Mention it for tail -f.
Reported by Michael Mol in http://bugs.gnu.org/11823
2012-06-30 18:20:07 +02:00
Jim Meyering
5f6c22fcee doc: improve sample backup script
* doc/coreutils.texi (cp invocation): Make the backup script exit
with an accurate reflection of any failure.
Also, add --preserve=all.

Improved-by: Bernhard Voelker
2012-06-30 11:00:32 +02:00
Pádraig Brady
5958bb44c4 maint: avoid a static analysis warning in csplit
The Canalyze static code analyzer correctly surmised
that there is a use-after-free bug in free_buffer()
at the line "struct line *n = l->next", if that
function is called multiple times.

This is not a runtime issue since a list of lines
will not be present in the !lines_found case.

* src/csplit.c (free_buffer): Set list head to NULL so
that this function can be called multiple times.
(load_buffer): Remove a redundant call to free_buffer().

Reported-by: Xu Zhongxing
2012-06-26 11:27:32 +01:00
Bernhard Voelker
4f2e9d5038 doc: document multiplier for dd number options like count=N
* src/dd.c (usage): Add "N" to the description of multipliers.
* doc/coreutils.texi (dd invocation): Likewise.
2012-06-22 12:16:04 +01:00
Pádraig Brady
ae5846448f split: ensure output doesn't overwrite input
* src/split.c (create): Check if output file is the
same inode as the input file.
* tests/split/guard-input: New test case.
* tests/Makefile.am: Reference new test case.
* NEWS: Mention the fix.

Improved-by: Jim Meyering
Reported-by: François Pinard
2012-06-22 11:34:21 +01:00
Pádraig Brady
30a604e631 maint: refactor common mode bits used to create files
* src/system.h (MODE_RW_UGO): The new refactored define (666).
* src/mkfifo.c: Use the new define.
* src/mknod.c: Likewise.
* src/split.c: Likewise.
* src/system.h: Likewise.
* src/touch.c: Likewise.
* src/truncate.c: Likewise.

Suggested-by: Jim Meyering
2012-06-22 11:17:38 +01:00
Pádraig Brady
4cfca3916d maint: suppress echoing of sc_THANKS_in_duplicates implementation
* cfg.mk (sc_THANKS_in_duplicates): Suppress the echoing of these
commands run during `make syntax-check`
2012-06-22 10:56:25 +01:00
Bernhard Voelker
daab10d9f5 maint: sort: style adjustment to help clarify size determination
* src/sort.c (default_sort_size): Move physmem code "down" to first use.
2012-06-20 08:12:17 +02:00
Jim Meyering
5c2181c870 stty: portability: accommodate CIL
* src/stty.c (main): Declare locals "mode" and "new_mode" to be static
to ensure that each is initialized to zero, *including* all padding.
While gcc clears padding of a local automatic initialized to "{ 0, }",
CIL does not, and the C99 standard is not clear on this issue.
Reported by Edward Schwartz.  See http://bugs.gnu.org/11675 for details.
2012-06-12 16:32:12 +02:00
Sami Kerola
07595ed856 maint: remove su testing artifact
* tests/misc/help-version: Remove expected su exit code.
2012-06-10 22:22:39 +02:00
Jim Meyering
f378f1c51c build: update gnulib to latest; correct comment grammar
* tests/misc/help-version: Fix comment grammar:
s/all these/all of these/
* gl/lib/tempname.c.diff: Likewise.
2012-06-10 22:02:26 +02:00
Jim Meyering
e106212d90 maint: migrate strncpy-prohibiting rule to gnulib
* cfg.mk (sc_prohibit_strncpy): Remove rule.
Now it's in gnulib.
2012-06-10 22:02:26 +02:00
Jim Meyering
5b9206c1a8 maint: prohibit use of strncpy
* cfg.mk (sc_prohibit_strncpy): New syntax-check rule.
Exempt pinky.c and who.c, at least for now.
2012-06-10 22:02:26 +02:00
Jim Meyering
928dd73762 su: remove program (util-linux is now the best source for it)
* README: Omit "su" from list of programs.
* src/su.c: Remove file.
* src/Makefile.am: Remove su-related rules and variables.
* tests/misc/su-fail: Remove test.
* tests/Makefile.am (TESTS): Remove misc/su-fail.
* tests/misc/invalid-opt: Remove su-related code.
* src/.gitignore: Remove su.
* man/su.x: Remove file.
* man/Makefile.am (su.1): Remove rule.
* po/POTFILES.in: Remove su.c from the list.
* TODO: Remove ancient entry.
* NEWS (Changes in behavior): Mention it.
* doc/coreutils.texi: Remove su-related description.
* AUTHORS: Remove su.
* m4/lib-check.m4 (cu_LIB_CHECK): Remove file/macro.
* configure.ac: Remove su-related code and sole use of cu_LIB_CHECK.
* scripts/git-hooks/commit-msg: Remove su from this list, too.
2012-06-06 22:33:08 +02:00
Jim Meyering
7b6ce030cc maint: detect a new type of duplicate in THANKS.in
* cfg.mk (sc_THANKS_in_duplicates): New rule.
2012-06-06 15:10:59 +02:00
Jim Meyering
020851e467 maint: mark new diagnostic for translation
* src/head.c (elide_tail_lines_seekable): Mark new diagnostic.
I will look at the results of "make syntax-check", I will look...
2012-06-05 22:41:06 +02:00
Jim Meyering
295ee521bc head: with --lines=-N (-n-N) reset file pointer on seekable input
* src/head.c (elide_tail_lines_seekable): Reset file pointer
after printing up to an end-relative line-counted offset.
Anoop Sharma reported the problem and suggested the fix.
* tests/misc/head-pos: Add coverage via a very similar, existing test.
Also add coverage for a previously untested block of code.
* tests/misc/head-elide-tail ($READ_BUFSIZE): Update to 8192, to
match the value of BUFSIZ I see today on Fedora 17/x86_64 (unrelated
to this fix).
* NEWS (Bug fixes): Mention it.

Improved-by: Pádraig Brady
2012-06-05 19:55:26 +02:00
Jim Meyering
5fdd5c6310 stat,tail: recognize new file system type: panfs
* src/stat.c (human_fstype) [__linux__]: Add a 'case' for the new
remote file system type: panfs (0xAAD7AAEA).
* NEWS (New features): Mention stat -f.
(Bug fixes): Mention it for tail -f.
Reported by Travis Gummels in http://bugzilla.redhat.com/827199
2012-06-01 09:15:37 +02:00
Jim Meyering
58184f6861 maint: fix typos in test comments and old ChangeLog files
Culprits identified and fixed automatically using these commands:
git ls-files|misspellings -f -|perl -nl \
  -e '/^(.*?)\[(\d+)\]: (\w+) -> "(.*?)"$/ or next;' \
  -e '($file,$n,$l,$r)=($1,$2,$3,$4); $q="'\''"; $r=~s/$q/$q\\$q$q/g;'\
  -e 'print "sed -i $q${n}s!$l!$r!$q $file"' | bash
using http://github.com/lyda/misspell-check
* old/fileutils/ChangeLog: Fix typos.
* old/textutils/ChangeLog: Likewise.
* tests/misc/truncate-fail-diag: Likewise.
2012-05-31 09:37:46 +02:00
Pádraig Brady
2ab72e3a43 cksum: line-buffer the printed checksums
This utility was inadvertently omitted from commit v8.0-34-g710fe41
* src/cksum.c (main): Set stdout to line buffered mode, to ensure
parallel running instances don't intersperse their output.
* NEWS: Mention the fix.
* THANKS.in: Add Anoop.
Reported by Anoop Sharma.
2012-05-28 02:50:11 +01:00
Jim Meyering
785234bc17 maint: remove comment that suggested to remove support for mktemp -V
* src/mktemp.c (main): Don't suggest to remove support for -V, an
undocumented alias for --version, since that would introduce a
gratuitous incompatibility with the original mktemp program.
2012-05-21 17:01:54 +02:00
Mike Frysinger
974848a486 dircolors: add st/st-256color terminal types
See http://st.suckless.org/
* src/dircolors.hin: Add st and st-256color.
Reported-by: Jeroen Roovers <jer@gentoo.org>, via
Mike Frysinger <vapier@gentoo.org> in http://bugs.gnu.org/11498
2012-05-21 17:01:20 +02:00
Jim Meyering
b663bc8eb0 id,groups: use gidtostr/uidtostr to avoid casts
* src/id.c (gidtostr, uidtostr): Define macros.
(gidtostr_ptr, uidtostr_ptr): Define safer functions.
Use gidtostr and uidtostr to print GID and UID without
need/risk of casts.
* src/group-list.c: Likewise.
2012-05-20 17:29:32 +02:00
Jim Meyering
2e9f5ca4eb tests: use $AWK, not awk
* tests/cp/sparse-fiemap: Don't hard-code "awk".  Use $AWK.
* tests/init.cfg: Likewise.
* tests/misc/sort-rand: Likewise.
2012-05-16 07:46:51 +02:00
Jim Meyering
e2bd5cda0a maint: tell xgettext that fputs arg "93% of..." is not a C format string
* src/fmt.c (usage): Add a comment to tell
xgettext that the "% o" in fputs argument string of "...93% of..."
is not a C format string.  Reported by Toomas Soome, Göran Uddeborg,
Petr Pisar, Primoz PETERLIN and Chusslove Illich via
http://bugs.gnu.org/11470
2012-05-16 07:39:09 +02:00
Jim Meyering
1ab163ec07 maint: add assertions to placate static analysis tools
A static analysis tool (http://labs.oracle.com/projects/parfait/)
produced some false positive diagnostics.  Add assertions to help
it understand that the code is correct.
* src/stty.c: Include <assert.h>.
(display_changed): Add an assertion to placate parfait.
(display_all): Likewise.
* src/sort.c: Include <assert.h>.
(main): Add an assertion to placate parfait.
* src/fmt.c: Include <assert.h>.
(get_paragraph): Add an assertion to placate parfait.
2012-05-16 07:36:26 +02:00
Pádraig Brady
0863f018f0 stat: report the correct block size for file system usage
struct statfs has the f_frsize member since Linux 2.6,
so use that rather than f_bsize which can be different.
Note the related df change mentioned in NEWS is handled
in gnulib by using statvfs() rather than statfs()
on Linux > 2.6.36 (where statvfs doesn't hang) and the
same method as stat for Linux 2.6 kernels earlier than that.
stat(1) doesn't use statvfs() on GNU/Linux as the f_type
member isn't available there.
Note the change to not use statvfs() on GNU/Linux was introduced
in gnulib commit eda39b8 16-08-2003.

* m4/stat-prog.m4 (cu_PREREQ_STAT_PROG): Check for the f_frsize
member in the statfs structure.
* src/stat.c: Use (struct statfs).f_frsize if available.
* NEWS (Bug fixes): Mention this stat fix, and the related df fix
coming in the next gnulib update.
* THANKS.in: Add Nikolaus.

Reported and Tested by Nikolaus Rath
2012-05-16 00:21:25 +01:00
Jim Meyering
6124a3842d ls: color each symlink-to-relative-name in / properly
In order for ls --color to color each symlink, it must form the name
of each referent and then stat it to see if the link is dangling, to
a directory, to a file, etc.  When the symlink is to a relative name,
ls must concatenate the starting directory name and that relative name.
When, in addition, the starting directory was "/" or "/some-name",
the result was ill-formed, and the subsequent stat would usually fail,
making the caller color it as a dangling symlink.
* src/ls.c (make_link_name): Don't botch the case in which
dir_name(NAME) == "/" and LINKNAME is relative.
* tests/ls/root-rel-symlink-color: New file.  Test for the above.
* tests/Makefile.am (TESTS): Add it.
* NEWS (Bug fixes): Mention it.
Reported by Mike Frysinger in http://bugs.gnu.org/11453
Bug introduced by commit v8.16-23-gbcb9078.
2012-05-12 16:19:38 +02:00
Jim Meyering
e438a0e858 maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2012-05-10 19:43:00 +02:00
Jim Meyering
e9024b7d89 version 8.17
* NEWS: Record release date.
2012-05-10 19:16:52 +02:00
Jim Meyering
3a696dee72 tests: misc/tty-eof: increase timeout to avoid unwarranted failure
* tests/misc/tty-eof: Increase timeout from 1s to 10s, to avoid
unwarranted failure under heavy load.
* tests/Makefile.am (TESTS): Move misc/tty-eof "up" to nearer the
beginning of the list (from near the middle) so that it is started
earlier in parallel test runs.  Otherwise, it would frequently be
among the last two tests to complete.
2012-05-10 17:09:42 +02:00
Jim Meyering
e121071489 stat,tail: recognize new FS types: bdevfs, inodefs, qnx6
* src/stat.c (human_fstype) [__linux__]: Add 'case's for these local
file system types: bdevfs (0x62646576), inodefs (0x42494E4D),
qnx6 (0x68191122).
Now that the kernel has a name for S_MAGIC_BINFMTFS, use
theirs in place of our S_MAGIC_BINFMT_MISC.
* NEWS (New features): Mention it.
2012-05-10 16:00:34 +02:00
Jim Meyering
53276320df scripts: encourage use of shorter "bugs.gnu.org" in bug URLs
* scripts/git-hooks/commit-msg: Also ding debbugs.gnu.org URLs.
2012-05-10 11:02:46 +02:00
Paul Eggert
9d308df132 maint: handle file sizes more reliably
Problem reported by Samuel Thibault in <http://bugs.gnu.org/11424>.
* NEWS: Document this.
* src/dd.c (skip): Handle skipping past EOF on shared or typed
memory objects the same way as with regular files.
(dd_copy): It's OK to truncate shared memory objects.
* src/du.c (duinfo_add): Check for overflow.
(print_only_size): Report overflow.
(process_file): Ignore negative file sizes in the --apparent-size case.
* src/od.c (skip): Fix comment about st_size.
* src/split.c (main):
* src/truncate.c (do_ftruncate, main):
On files where st_size is not portable, fall back on using lseek
with SEEK_END to determine the size.  Although strictly speaking
POSIX says the behavior is implementation-defined, in practice
if lseek returns a nonnegative value it's a reasonable one to
use for the file size.
* src/system.h (usable_st_size): Symlinks have reliable st_size too.
* tests/misc/truncate-dir-fail: Don't assume that getting the size
of a dir is not allowed, as it's now allowed on many platforms,
e.g., GNU/Linux.
2012-05-10 11:02:42 +02:00
Paul Eggert
2c436decf8 stat: don't report negative file size as huge positive number
* src/stat.c (print_stat): Use out_int, not out_uint for stat.st_size.
* NEWS (Bug fixes): Mention it.
2012-05-09 23:32:24 -07:00
Jim Meyering
a6f94fcebc split: avoid apparent infloop when splitting /dev/zero w/-n on the Hurd
* src/split.c (main): Use stat.st_size only for regular files.
Samuel Thibault reported in http://bugs.gnu.org/11424 that the
/dev/zero-splitting tests would appear to infloop on GNU/Hurd,
because /dev/zero's st_size is LONG_MAX.  It was only a problem
when using the --number (-n) option.
* NEWS (Bug fixes): Mention it.
This bug was introduced with the --number option, via
commit v8.7-25-gbe10739
2012-05-08 18:32:58 +02:00
Jim Meyering
30071b2f5c build: update gnulib submodule to latest; also bootstrap and init.sh
* bootstrap: Update from gnulib.
* tests/init.sh: Likewise.
2012-05-08 15:47:46 +02:00
Pádraig Brady
be2dabef95 doc: clarify dd conv=sparse usage with devices
* doc/coreutils.texi (dd invocation): Clarify that NUL blocks
are not copied for devices either, and give examples of where
it might be useful.
2012-05-08 14:12:48 +01:00
Jim Meyering
452dc6b5ef maint: new function: usable_st_size 2012-05-08 10:34:31 +02:00
Kevin Lyda
aa078afcf9 maint: fix common spelling errors
These were identified using: https://github.com/lyda/misspell-check
executed like: git ls-files | misspellings -f -

* src/cat.c: Correct a spelling error.
* src/comm.c: Likewise.
* src/expr.c: Likewise.
* src/pr.c: Likewise.
* src/tac.c: Likewise.
* src/test.c: Likewise.
* src/ChangeLog-2005: Likewise.
* src/ChangeLog-2007: Likewise.
* src/NEWS: Likewise.
* src/doc/coreutils.texi: Likewise.
* src/lib/ChangeLog-2007: Likewise.
* src/man/help2man: Likewise.
* src/old/fileutils/ChangeLog-1997: Likewise.
* src/old/fileutils/NEWS: Likewise.
* src/old/sh-utils/ChangeLog.0: Likewise.
* src/old/textutils/ChangeLog: Likewise.
* src/tests/misc/comm: Likewise.
* src/tests/misc/uniq: Likewise.
* src/tests/mv/dir2dir: Likewise.
* src/cfg.mk (old_NEWS_hash): update with `make update-NEWS-hash`
2012-05-08 02:18:39 +01:00
Jim Meyering
fedebc59a0 tests: avoid LD_PRELOAD lookup error for dlsym
* tests/cp/nfs-removal-race: Link with -ldl.
2012-05-07 22:01:20 +02:00
Jim Meyering
ee9e43460f cp: handle a race condition more sensibly
* src/copy.c (copy_reg): In a narrow race (stat sees dest, yet
open-without-O_CREAT fails with ENOENT), retry the open with O_CREAT.
* tests/cp/nfs-removal-race: New file.
* tests/Makefile.am (TESTS): Add it.
* NEWS (Bug fixes): Mention it.
Reported by Philipp Thomas and Neil F. Brown in
http://bugs.gnu.org/11100
2012-05-07 13:39:48 +02:00
Jim Meyering
3468d26884 doc: NEWS: note when the id/groups bug was introduced
* NEWS (Bug fixes): Note the first affected release.
The id bug was introduced by commit v8.0-112-g719a95a.
2012-05-07 09:51:07 +02:00
Jim Meyering
bdc99991d3 build: update gnulib submodule to latest 2012-05-04 12:13:36 +02:00
Jim Meyering
c999133e53 maint: rely on gnulib's new sys_resource module
* bootstrap.conf (gnulib_modules): Add sys_resource.
* src/sort.c: Remove #if HAVE_SYS_RESOURCE_H guard around inclusion
of <sys/resource.h> and move the inclusion "up" into the alphabetized
list of its peers.  This also avoids a failure of the
sc_prohibit_always_true_header_tests syntax-check rule.
* m4/jm-macros.m4 (gl_CHECK_ALL_HEADERS): Remove sys/resource.h.
2012-05-04 12:13:26 +02:00
Pádraig Brady
15f1d0c9aa cp,mv,install: provide POSIX_FADV_SEQUENTIAL hint to input
This was inadvertently omitted from v8.5-104-g47076e3,
and gives the same 5% speedup when copying from an SSD.

* src/copy.c (copy_internal): Apply the FADVISE_SEQUENTIAL hint.
2012-05-02 18:41:53 +01:00
Jim Meyering
e744f4b7b7 maint: prohibit an operator at end of line
Many coding standards, including GNU's, advocate that when
splitting a line near a binary operator, one should put the
operator at the beginning of the continued line, rather than
at the end of the preceding one.  This is for readability:
such operators are relatively important to readability, and
they are more apparent at the beginning of a line than
at the varying-column end of line,
* cfg.mk (sc_prohibit_operator_at_end_of_line): New rule.
Exempt test.c and head.c.
2012-05-02 10:31:53 +02:00
Jim Meyering
57e0a882ef maint: adjust comments to avoid FP match on binary-operator-at-EOL
* src/ls.c (print_long_format): Reformat comment to avoid "=="
at end of line.
Also, "sortkey" is not a word: s/sortkey/sort key/.
* src/ioblksize.h: Likewise, for "|" from a shell snippet.
* src/runcon.c: Likewise, for "|" in grammar-like usage.
2012-05-02 10:31:53 +02:00
Jim Meyering
b8a6996e25 maint: with split lines, don't leave an operator at end of line
* src/copy.c (copy_reg): Split an expression before a binary operator,
not after it.
* src/cut.c (set_fields): Likewise.
* src/id.c (main): Likewise.
* src/install.c (setdefaultfilecon): Likewise.
* src/join.c (ignore_case): Likewise.
* src/pr.c (cols_ready_to_print, init_parameters, print_page): Likewise.
* src/stty.c (set_window_size): Likewise.
* src/wc.c (SUPPORT_OLD_MBRTOWC): Likewise.
* src/who.c (scan_entries): Likewise.
* src/test.c (binary_operator): Join a split line.
* src/extent-scan.c (extent_scan_read): Move an ">" from end of line
to beginning of the following.
Likewise for two other expressions.
2012-05-02 10:31:47 +02:00
Pádraig Brady
a18ba2f10a cat,cp,mv,install,split: Set the minimum IO block size used to 64KiB
* NEWS: Mention the change in behavior.
* src/ioblksize.h: Add updated test results and
increase value from 32KiB to 64KiB.
2012-04-30 11:14:31 +01:00
Jim Meyering
c83f723267 id: -Zn/-Zr: avoid an invalid diagnostic
* src/id.c (main): Using -Z with -r or -n would fail with "id: cannot
print only names or real IDs in default format", in spite of that "-Z",
which specifies a non-default format.  Now, it succeeds and ignores
the -n or -r option.  The error was that the test for default_format
was not updated when I added the new --context (-Z) option in
commit v6.9-33-g5320d0f.
2012-04-27 23:01:21 +02:00
Jim Meyering
c8b8279d2b id: don't call getcon unnecessarily
* src/id.c (main): Invocations like "id" and "id -G" would call getcon
to determine the current security context even though that result would
not be used.  Similarly, when POSIXLY_CORRECT is set.  Rearrange
conditionals and hoist the POSIXLY_CORRECT test so that we call
getcon only when necessary.
2012-04-27 23:00:55 +02:00
Jim Meyering
a6719d9f72 maint: id: minor factorization
* src/id.c (main): Factor out uses of "argc - optind".
Move option-consistency checks to precede the potential getcon call.
2012-04-27 22:50:42 +02:00
Jim Meyering
032a549481 id,groups: with no user name, print only real and/or effective IDs,
... i.e., don't use the getpw* functions.

Before this change, running groups or id with no user name argument
would include a group name or ID from /etc/passwd.  Thus, under unusual
circumstances (default group is changed, but has not taken effect for a
given session), those programs could print a name or ID that is neither
real nor effective.

To demonstrate, run this:

    echo 'for i in 1 2; do id -G; sleep 1.5; done' \
      |su -s /bin/sh ftp - &
    sleep 1; perl -pi -e 's/^(ftp\d+):(\d+)/$1:9876/' /etc/passwd

Those id -G commands printed the following:

    50
    50 9876

With this change, they print this:

    50
    50

Similarly, running those programs set-GID could make them
print one ID too many.

* src/group-list.c (print_group_list): When username is NULL, pass
egid, not getpwuid(ruid)->pw_gid), to xgetgroups, per the API
requirements of xgetgroups callee, mgetgroups.
When not using the password database, don't call getpwuid.
* NEWS (Bug fixes): Mention it.
* tests/misc/id-setgid: New file.
* tests/Makefile.am (TESTS): Add it.
(root_tests): It's a root-only test, so add it here, too.
Originally reported by Brynnen Owen as http://bugs.gnu.org/7320.
Raised again by Marc Mengel in http://bugzilla.redhat.com/816708.
2012-04-27 19:54:03 +02:00
Stefano Lattarini
8f6c5d4327 maint: sync up required autoconf version in bootstrap.conf
* bootstrap.conf ($buildreq): Require autoconf 2.64, not 2.62.  This is
consistent with what is required by AC_PREREQ in configure.ac.
2012-04-22 23:41:05 +01:00
Jim Meyering
6539e15620 doc: fix a grammar nit
* doc/coreutils.texi (split invocation): s/are/is/ in "P or Q are".
2012-04-19 19:39:54 +02:00
Bernhard Voelker
fdf0a44967 tests: factor out expensive "pairs" code of misc/stty
* tests/Makefile.am (TESTS): Add misc/stty-pairs.
* tests/init.cfg (stty_reversible_init_): New function.
(stty_reversible_query_): New function.
* tests/misc/stty: Factor out expensive "pairs" code into new test.
Use new stty_reversible_* functions instead of evaluating static
REV_* variables.
* tests/misc/stty-pairs: Add new test.  Code added from misc/stty.
Mark this as an expensive test.  Skip 'parenb' and 'cread' options,
as these tests are known to fail.  Like in misc/stty, also use
the new stty_reversible_* functions.
2012-04-19 19:31:48 +02:00
Bernhard Voelker
26996738e4 tests: add iutf8 option to misc/stty
* tests/misc/stty: Add iutf8 to the list of REV_* options.
That option has been implemented in commit v5.2.1-193-g733e79e.
2012-04-19 19:27:16 +02:00
Jim Meyering
219b894de4 maint: tac: use memcpy, not strcpy
* src/tac.c (main): Use memcpy, not strcpy, since we know the length.
2012-04-19 13:10:36 +02:00
Jim Meyering
bcb9078e38 maint: ls: use stpncpy/stpcpy, not strncpy/strcpy
* src/ls.c (gobble_file): Move a decl "down".
(make_link_name): Do not hard-code '/'.  Use IS_ABSOLUTE_FILE_NAME
and dir_len instead.
Use stpcpy/stpncpy in place of strncpy/strcpy.
2012-04-19 13:10:36 +02:00
Jim Meyering
280aa28c4d maint: modernize/clean-up a small function in ls.c
* src/ls.c (make_link_name): Adjust comment style to refer to VARIABLE
names, not 'variable'.
Move each of two declarations "down" to first use.
Compare pointer to NULL, not to 0.
Don't reuse local, "linkbuf" for a different purpose.
2012-04-19 13:10:36 +02:00
Jim Meyering
e50751d845 doc: tweak README-hacking
* README-hacking: Don't say "...on your hard drive".
That is unnecessary, and now, borderline anachronistic.
2012-04-19 13:10:36 +02:00
Jim Meyering
2bb1876c9a doc: use @xref{... only at start of a sentence
* doc/coreutils.texi: Correct many misuses of @xref.
2012-04-17 09:24:22 +02:00
Jim Meyering
31f19d681f maint: replace a use of strcpy in chmod.c with memcpy
* src/chmod.c (main): Use memcpy rather than strcpy,
since we already have the length handy.
2012-04-16 15:12:02 +02:00
Karl Berry
4c13a6d743 doc: remove a little direntry redundancy
* doc/coreutils.texi (Basics direntry): Remove 3rd "Common options."
2012-04-14 10:06:38 +02:00
Bruce Korb
0092d5d88b fmt: accept new --goal=WIDTH (-g) option
Accept -g for BSD/Plan9 compatibility.
* NEWS (New features): Mention it.
* tests/fmt/goal-option: New test.
* tests/fmt/long-line: Rename from tests/fmt-long-line.
* tests/fmt/base: Rename from tests/misc/fmt.
* doc/coreutils.texi: Document it.
* src/fmt.c (main): Accept the new option
(check_for_goals): new function to implement the operands
Based on BSD's and Plan-9's fmt programs.
2012-04-12 22:46:51 +02:00
Pádraig Brady
3d53e7fe1c cp: change --attributes-only to not truncate existing files
* src/copy.c (copy_reg): Don't truncate an existing file,
to support copying attributes between existing files.
The original use case only considered creating new files,
and it would be a very unusual use case to be relying
on the truncating behavior.
* doc/coreutils.texi (cp invocation): Mention the non
truncating behavior.
* tests/cp/attr-existing: A new test to ensure O_TRUNC skipped.
* tests/Makefile.am: Reference the new test.
* NEWS: Mention the change in behavior.
2012-04-12 18:35:17 +01:00
Andreas Schwab
7e0ef7c035 tests: avoid unnecessary subshells in misc/stty
* tests/misc/stty: Don't waste a subshell to perform this:
eval rev=\$REV_$opt.  Fix rev1,rev2 assignments similarly.
2012-04-04 16:09:49 +02:00
Jim Meyering
9cf086f318 build: update gnulib submodule to latest 2012-04-04 14:30:18 +02:00
Jim Meyering
89779e8497 tests: correct reversed args to "compare"
* tests/misc/sort-discrim: Correct reversed args to "compare".
This nit was masked by a bug in maint.mk that effectively disabled
many of the syntax-check rules.
2012-04-04 14:30:18 +02:00
Jim Meyering
e82602833d tests: new syntax-check rule to prohibit use of ... in tests/
* cfg.mk (sc_prohibit_test_backticks): New rule.  Exempt 3 files.
2012-04-04 12:34:22 +02:00
Jim Meyering
33230a19ca tests: remove nearly all remaining backticks
* tests/rm/isatty: Remove now-unneeded "# `" line.
* tests/misc/ls-time: Likewise.
* tests/misc/date-sec: Remove stray "`" in comment.
* tests/du/long-sloop: Likewise.
* tests/mv/part-symlink: Replace multi-line `...` by $(...).
* tests/mv/sticky-to-xpart: Likewise.
* tests/rm/fail-2eperm: Likewise.
* tests/ls/nameless-uid: Likewise.
* tests/cp/perm: Likewise.
* tests/cp/preserve-gid: Likewise.
* tests/cp/same-file: Likewise.
2012-04-04 12:22:24 +02:00
Jim Meyering
b1e9cb9cd2 tests: use perl's qx!...! rather than ...
* tests/misc/expr: As above.
* tests/misc/ls-misc: Likewise.
* tests/misc/pwd-long: Likewise.
* tests/misc/uniq: Likewise.
2012-04-04 12:22:24 +02:00
Jim Meyering
e43d30eab3 tests: convert nearly all ... expressions to $(...)
Exempt init.sh because it runs before we're assured to have a
shell that groks $(...).  Exempt *.mk because "$" would have to
be doubled, and besides, any `...` expression in a .mk file is
almost certainly evaluated before init.sh is run.  Finally, also
exempt the perl-based tests, because perl's `...` cannot be
converted to $(...).  Do that by running this command:

git grep -l '`.*`' tests \
  | grep -Ev 'init\.sh|\.mk$' | xargs grep -Lw perl \
  | xargs perl -pi -e 's/`(.*?)`/\$($1)/g'

One minor fix-up change was required after that, due to how
quoting differs:
diff --git a/tests/chmod/equals b/tests/chmod/equals
-    expected_perms=$(eval 'echo \$expected_'$dest)
+    expected_perms=$(eval 'echo $expected_'$dest)

Another was to make these required quoting adjustments:
diff --git a/tests/misc/stty b/tests/misc/stty
...
-  rev=$(eval echo "\\\$REV_$opt")
+  rev=$(eval echo "\$REV_$opt")
...
-      rev1=$(eval echo "\\\$REV_$opt1")
-      rev2=$(eval echo "\\\$REV_$opt2")
+      rev1=$(eval echo "\$REV_$opt1")
+      rev2=$(eval echo "\$REV_$opt2")

Also, transform two files that were needlessly excluded above:
(both use perl, but are mostly bourne shell)

  perl -pi -e 's/`(.*?)`/\$($1)/g' \
    tests/du/long-from-unreadable tests/init.cfg
2012-04-04 12:20:56 +02:00
Jim Meyering
64ecea53d9 tests: convert one ... expression manually
* tests/ls/stat-vs-dirent: Manually convert `(...)` to $(...),
to avoid automatically producing an invalid result.
2012-04-03 22:17:28 +02:00
Jim Meyering
64cf1033cc tests: fix quoting bug in misc/nohup
* tests/misc/nohup: Fix invalid quoting.
2012-04-03 22:17:28 +02:00
Jim Meyering
5e1f5c5739 doc: identify/refer to source of each fixed bug in log and in NEWS
* HACKING (Commit log requirements): Describe our policy: when you
fix a bug, put the "git describe" string of the bug-introducing commit
in your commit log and put the "fixed-in-release version number"
in the NEWS blurb.
2012-04-03 16:14:32 +02:00
Jim Meyering
0f35329876 tests: avoid spurious misc/expr failure on AIX 6.1
* tests/misc/expr: Avoid spurious failure on AIX 6.1 due to
differing regexp diagnostic.  Reported by Michael Felt.
2012-04-03 08:24:20 +02:00
Paul Eggert
ef44086db0 chmod: undo previous change
It's not portable; see <http://bugs.gnu.org/11108#17>.
* src/chmod.c, NEWS: Undo previous change.
2012-03-28 13:26:58 -07:00
Paul Eggert
5911eff83e chmod: fix symlink race condition
* NEWS: Document this.
* src/chmod.c (process_file): Don't follow symlink if we
think the file is not a symlink.
2012-03-28 11:05:25 -07:00
Jim Meyering
1a1c46afe2 tests: remove temporary skip for sort-stale-thread-mem failure
* tests/misc/sort-stale-thread-mem: Invoke framework_failure_, now,
hoping that valgrind is fixed (or we add exclusions) before the
next release.
2012-03-26 20:56:44 +02:00
Jim Meyering
911ffaaf30 maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2012-03-26 14:15:35 +02:00
Jim Meyering
9566c5851a version 8.16
* NEWS: Record release date.
2012-03-26 14:06:43 +02:00
Jim Meyering
cd65eb9798 tests: work around F17-valgrind sort-stale-thread-mem failure
* tests/misc/sort-stale-thread-mem: Skip upon known failure.
2012-03-26 13:52:58 +02:00
Jim Meyering
a4d14d3533 doc: use $(...), not ... in documentation and comments
* doc/coreutils.texi (dircolors invocation, Examples of expr):
(shred invocation, seq invocation): Use $(...), not `...`.
* src/mv.c (do_move): Likewise, in a comment.
2012-03-26 07:38:37 +02:00
Jim Meyering
488172c499 tests: skip ls/stat-free-color on XFS, rather than always failing
* tests/init.cfg (require_dirent_d_type_): Manually skip when
"." is an xfs file system.
2012-03-23 18:39:11 +01:00
Jim Meyering
4b101ccd17 tests: skip part of dd/sparse on some file systems
* tests/dd/sparse: The last two parts of this test would fail due to
the underlying file system at least on Solaris 10 with NFS.  That file
system would report that a 3MiB file was occupying <= 1KiB of space
for nearly 50 seconds after creation.
Improved-by: Bernhard Voelker
2012-03-23 12:47:52 +01:00
Pádraig Brady
a04110e568 maint: avoid a doc syntax check failure
Prompted by the continuous integration build failure at:
http://hydra.nixos.org/build/2315847

* doc/coreutils.texi (ln invocation): s/path/file name/
2012-03-22 21:25:39 +00:00
Harald Hoyer
15b8318e93 ln: add the --relative option
With the "--relative --symbolic" options, ln computes the relative
symbolic link for the user.

So, ln works just as cp, but creates relative symbolic links instead
of copying the file.

I miss this feature since the beginning of using ln.

$ tree ./
/
`-- usr
    |-- bin
    `-- lib
        `-- foo
            `-- foo

4 directories, 1 file

$ ln -s -v --relative usr/lib/foo/foo usr/bin/foo
‘usr/bin/foo’ -> ‘../lib/foo/foo’

$ tree ./
/
`-- usr
    |-- bin
    |   `-- foo -> ../lib/foo/foo
    `-- lib
        `-- foo
            `-- foo

4 directories, 2 files

$ ln -s -v --relative usr/bin/foo usr/lib/foo/link-to-foo
‘usr/lib/foo/link-to-foo’ -> ‘foo’

$ tree ./
/
`-- usr
    |-- bin
    |   `-- foo -> ../lib/foo/foo
    `-- lib
        `-- foo
            |-- link-to-foo -> foo
            `-- foo

4 directories, 3 files

* src/Makefile.am: Reference the relpath module.
* src/ln.c (usage): Mention the new option.
(do_link): Call the relative conversion if specified.
(convert_abs_rel): Perform the relative conversion
using the relpath module.
* tests/ln/relative: Add a new test.
* tests/Makefile.am: Reference the new test.
* doc/coreutils.texi: Document the new feature.
* NEWS: Mention the new feature.
2012-03-22 20:51:20 +00:00
Pádraig Brady
b1428e3152 maint: refactor relpath() from realpath for use by ln
* src/relpath.c: Refactored from realpath.c and adjusted
to support returning the relative path rather than just
printing to stdout.
* src/relpath.h: Export the relpath function.
* src/Makefile.am: Reference the refactored relpath module.
* po/POTFILES.in: Likewise.
* src/realpath.c: Adjust to the refactored relpath module.
2012-03-22 20:34:57 +00:00
Pádraig Brady
049f1dbe68 maint: ensure PATH_MAX is set correctly
This reverts part of commit v8.12-103-g54cbe6e.

* src/system.h: Include gnulib's pathmax.h to honor
system specific limits, and then we set PATH_MAX only if needed.
Note pathmax.h no longer uses pathconf ("/", _PC_PATH_MAX).
Note I didn't reinstate the comments about limits.h inclusion
order, because pathmax.h includes limits.h anyway.
2012-03-22 12:12:26 +00:00
Jim Meyering
1b1d656b2d build: add numerous gnulib modules, mostly for improved portability
* bootstrap.conf (gnulib_modules): Add numerous modules for
improved portability.  Reported by Eric Blake in
http://thread.gmane.org/gmane.comp.gnu.coreutils.general/2426/focus=2489
* po/POTFILES.in: Add new files.
2012-03-21 22:00:17 +01:00
Jim Meyering
1fcb4ba932 build: update gnulib submodule to latest 2012-03-21 22:00:17 +01:00
Jim Meyering
ee7740c300 maint: use more modern fseeko, rather than fseek
* src/tac.c (temp_stream): Use fseeko, not fseek, on principle:
use the more modern interface.  In general it is better to avoid
fseek due to its ABI-imposed 4GiB limit on the "offset", here its
use was fine because the offset was always 0.  Using fseeko also
has the advantage of not triggering a GNULIB_POSIXCHECK warning.
Reported by Eric Blake in
http://thread.gmane.org/gmane.comp.gnu.coreutils.general/2426/focus=2489
2012-03-21 22:00:17 +01:00
Eric Blake
89bf03c9a1 build: speed up configure for releases
Since most users won't be building with GNULIB_POSIXCHECK defined in
CFLAGS, and since we can make ./configure 10% (several seconds!) faster
by omitting the framework for a posix check, this patch makes it so
that the framework is omitted by default, while still giving
instructions for maintainers to re-enable it.

It's been a while since we've used GNULIB_POSIXCHECK; see this email:
https://lists.gnu.org/archive/html/coreutils/2012-03/msg00126.html
Some of those failures are because we are intentionally avoiding
specific gnulib modules (that is, we have chosen not to use things
like fprintf-posix), but until we work with gnulib to avoid particular
warnings, wiring up an automatic GNULIB_POSIXCHECK to happen during
'make my-distcheck' is not feasible.

* configure.ac (gl_ASSERT_NO_GNULIB_POSIXCHECK): Conditionally
define, according to whether $GNULIB_POSIXCHECK is in environment.
2012-03-20 13:33:04 -06:00
Jim Meyering
56673dbe8a tests: avoid spurious misc/factor failure on OpenBSD 5.1
* tests/misc/factor: Map OpenBSD 5.1's "unknown option" to our
expected "invalid option".  Reported by Bruno Haible.
2012-03-20 17:34:28 +01:00
Jim Meyering
cbedb8aa21 maint: remove now-superfluous coreutils-path-check rule
* dist-check.mk (coreutils-path-check): Now that we set PATH in
TESTS_ENVIRONMENT, it seems like overkill to make "distcheck"
rerun all tests just to check this.
(my-distcheck): Remove sole use.
2012-03-20 17:34:26 +01:00
Eric Blake
a6342a320e doc: clarify current realpath --relative-base behavior
For compatibility with MacOS relpath(1), as seen here:

http://opensource.apple.com/source/bootstrap_cmds/\
bootstrap_cmds-79/relpath.tproj/relpath.c

we implemented 'realpath --relative-base=dir1 --relative-to=dir2 file'
in the same way as 'relpath -d dir1 dir2 file'.  This can result
in --relative-base rendering --relative-to as a no-op if dir1 is a
child of dir2.  Document this.

* doc/coreutils.texi (realpath invocation): Mention restriction.
2012-03-20 10:13:13 -06:00
Pádraig Brady
d42f3a4d41 tests: avoid spurious dd/sparse failure
* tests/dd/sparse: Allow for greater variation in sparse-block counts.
Reported by Nelson H. F. Beebe and Bruno Haible.
2012-03-20 10:30:39 +00:00
Pádraig Brady
eb7ef0148a tests: fix sort-discrim to work without GMP
* tests/misc/sort-discrim: The expr limit is intmax_t without GMP.
2012-03-17 09:39:13 +00:00
Pádraig Brady
ae7b1c383f tests: avoid an ls-time false positive on Solaris 10
* tests/misc/ls-time: Force a ctime update as updating
the atime doesn't update ctime on tmpfs on Solaris 10.
2012-03-16 14:41:51 +00:00
Eric Blake
be17e3b98a realpath: optimize --relative-base usage
There is no need to recompute for every path being visited whether
the base is a prefix of the relative location.

* src/realpath.c (relpath): Hoist base check...
(main): ...here.
Based on a suggestion by Pádraig Brady.
2012-03-15 13:28:19 -06:00
Eric Blake
9f5aa48501 realpath: let --relative-to default to --relative-base
Most of the time, if someone wants to filter which paths are
relative while leaving all others absolute, they also want to
to the filtering based on the same --relative-to directory.
Make this easier to specify.

* src/realpath.c (main): Convert error to default.
* doc/coreutils.texi (realpath invocation): Document this.
* tests/misc/realpath: Adjust test to match.
* NEWS: Document it.
2012-03-15 12:24:05 -06:00
Eric Blake
61167bae9f tests: cover more realpath scenarios
'realpath --relative-base --relative-to' is identical to
--relative-base=--relative-to, so the test wasn't covering what
it claimed.  Expose recent fixes for handling of // on systems
where // is distinct, and for --relative-base=/.  Add test that
exposes our design decision that --relative-base that is not a
prefix of --relative-to is a no-op (if we later change behavior,
we will also have to change that part of the test).

* tests/misc/realpath: Fix typo. Add some tests.
2012-03-15 10:28:42 -06:00
Eric Blake
5e264bf248 realpath: fix problems with root handling
When --relative-base is /, all other paths should be treated as
relative (except for // where it matters).

Also, on platforms like Cygwin where / and // are distinct, realpath
was incorrectly collapsing // into /.  http://debbugs.gnu.org/10472.

* src/realpath.c (path_prefix, path_common_prefix): Treat /
and // as having no common match.
(relpath): Allow for no match even without --relative-base.
* NEWS: Document this.
2012-03-15 10:28:40 -06:00
Eric Blake
a84286ce7a test: expose recent gnulib canonicalize bug
https://lists.gnu.org/archive/html/bug-gnulib/2012-02/msg00038.html
detailed a couple of bugs in gnulib's canonicalize that were visible
through coreutils' readlink, but only on systems where // is distinct
from /.  This particular test assumes the POSIX fix which requires
canonicalization of a symlink containing just slashes to behave as
if slashes separating the symlink from the rest of the name are
elided (see http://austingroupbugs.net/view.php?id=541), as that is
the only useful (and current) behavior on Cygwin.  That is,

ln -s / root
ls root/dev

must list the contents of /dev, not //dev.

* tests/misc/readlink-root: New test.
* tests/Makefile.am (TESTS): Run it.
2012-03-14 09:23:40 -06:00
Paul Eggert
0dd13c463d tests: new discriminator-based test for sort -n and -h
* tests/Makefile.am (TESTS): Add misc/sort-discrim.
* tests/misc/sort-discrim: New file, which tests a discriminator-based
implementation of 'sort'.  Coreutils doesn't use this implementation
yet, but the test is useful anyway.

Co-authored-by: Drew Kutilek <dkutilek@ucla.edu>
Co-authored-by: James Wendt <jwendt@cs.ucla.edu>
2012-03-13 23:23:07 -07:00
Jérémy Compostella
57c929da8b dirname: support more than one argument
* src/dirname.c (main): Handle new -z option and manage more than one
  argument.
* doc/coreutils.texi (dirname invocation): Mention it.
* NEWS (New features): Mention it.
* tests/misc/dirname: Add a two arguments test.
2012-03-10 19:53:06 +00:00
Jérémy Compostella
7480e2db29 split: support an arbitrary number of split files by default
* src/split.c (next_file_name): If `suffix_auto' is true and the first
suffix character is 'z', generate a new file file name adding `z' to
the prefix and increasing the suffix length by one.
(set_suffix_length): Disable auto suffix width in various cases.
* tests/split/suffix-auto-length: Test it.
* doc/coreutils.texi (split invocation): Mention it.
* NEWS (Improvements): Likewise.
2012-03-10 19:36:13 +00:00
Jérémy Compostella
94c21417fe doc: add missing documentation for basename -z
doc/coreutils.texi (basename invocation): Add -z option documentation.
2012-03-09 15:27:48 +00:00
Bernhard Voelker
73f9879ce2 maint: fix a version number typo in NEWS
* NEWS: s/8.14/8.15/
2012-03-09 12:44:30 +00:00
Paul Eggert
8931cdbfda chmod: add notations +40, 00440, etc.
* NEWS: Document this.
* doc/perm.texi (Operator Numeric Modes): New section.
(Numeric Modes, Directory Setuid and Setgid): Document new behavior.
* src/chmod.c (usage): Document new behavior.
(main): Support new options -0, -1, etc.
* tests/chmod/setgid: Test these new features.
2012-03-08 19:01:26 -08:00
Paul Eggert
9076b28464 build: update gnulib submodule to latest 2012-03-08 19:01:26 -08:00
Jim Meyering
f7f398a1d9 du: fix -x: don't ignore non-directory arguments
Surprise!  "du -x non-DIR" would print nothing.
Note that the problem arises only when processing a non-directory
specified on the command line.  Not surprisingly, "du -x" still
works as expected for any directory argument.

When performing its same-file-system check, du may skip an entry
only if it is at fts_level 1 or greater.  Command-line arguments
are at fts_level == 0 (FTS_ROOTLEVEL).

* src/du.c (process_file): Don't use the top-level FTS->fts_dev
when testing for --one-file-system (-x).  It happens to be valid
for directories, but it is always 0 for a non-directory.
* tests/du/one-file-system: Add tests for this.
* NEWS (Bug fixes): Mention it.
Reported by Daniel Stavrovski in http://bugs.gnu.org/10967.
Introduced by commit v8.14-95-gcfe1040.
2012-03-08 13:04:09 +01:00
Jim Meyering
c1d07237a8 maint: use an optimal-for-coreutils xz compression setting
* cfg.mk: Set XZ_OPT = -8e (determined empirically).
This sacrifices 8 KiB of compressed tarball size for a 32-MiB
decrease in the memory required during decompression.  I.e.,
using -9e would shave off only 8 KiB from the tar.xz file, yet
would force every decompression process to use 32 MiB more memory.
2012-03-07 21:08:26 +01:00
Jérémy Compostella
a3eb71a98f basename: support more than one argument
* src/basename.c (perform_basename): New function refactored from
main() that performs the basename work on a STRING, optionally
removes a trailing SUFFIX and outputs the result.
(main): Handle new options.
* doc/coreutils.texi (basename invocation): Mention new options.
* test/misc/basename: Add new options test cases.
* NEWS (New features): Mention it.
2012-03-07 12:59:00 +00:00
Pádraig Brady
4b4a465798 maint: refactor copy to use is_nul()
* src/dd.c: Move is_nul() from here to ...
* src/system.h: ... here
* src/copy.c (sparse_copy): Adjust to use the refactored is_nul()
2012-03-06 23:43:21 +00:00
Pádraig Brady
8195165839 tests: work around a block alignment issue in dd/sparse
Prompted by the continuous integration build failure at:
http://hydra.nixos.org/build/2188210 (which uses XFS).

* tests/dd/sparse (alloc_equal): Add a block allocation
comparison function that accounts for variations due
to alignment.
2012-03-02 10:57:56 +00:00
Rodrigo Campos
4724cd8fe8 doc: timeout: document the exit status when run with "-s KILL"
* src/timeout.c (usage): Document the exit status for this case,
in --help and thus in the man page.  Word so that it covers
both the -s9 and -k options.
* doc/coreutils.texi (timeout invocation): Document the exit
status for this case.
2012-02-29 15:41:15 +00:00
Bernhard Voelker
409a7cc7ea tests: compile and link shared object with $CC to make LD_PRELOAD work
* tests/ls/getxattr-speedup: Compile and link in one step with $CC.
If the shared object file is created by ld (binutils), then the
destructor print_call_count() may not run (seen on OpenSuSE 12.1).
See http://lists.opensuse.org/opensuse/2012-02/msg01342.html
Thanks to Cristian Rodríguez.
2012-02-29 10:01:50 +01:00
Roman Rybalko
4e776faa84 dd: add support for the conv=sparse option
Notes:
  Small seeks are not coalesced to larger ones,
  like is done in cache_round() for example.

  conv= is used rather then oflag= for FreeBSD compatibility.

* src/dd.c (final_op_was_seek): A new global boolean to flag
whether the final "write" was converted to a seek.
(usage): Describe the new conf=sparse option.
(iwrite): Convert a write of a NUL block to a seek if requested.
(do_copy): Initialize the output buffer to have a sentinel,
to allow for efficient testing for NUL output blocks.
If the last block in the file was converted to a seek,
then convert back to a write so the size is updated.
* NEWS: Mention the new feature.
* tests/dd/sparse: A new test for the feature.
* tests/Makefile.am: Reference the new test.
2012-02-29 00:17:56 +00:00
Jérémy Compostella
697d00c321 doc: fix a wrong option reference in split invocation
* doc/coreutils.texi (split invocation): replace `-r' reference with
`-nr/n'.
2012-02-27 00:55:24 +00:00
Jim Meyering
72addfcac9 tests: fix help-version on cygwin, where $EXEEXT is nonempty
* tests/misc/help-version: Remove the $EXEEXT suffix from each
program name before comparing with a literal.
2012-02-26 09:48:48 +01:00
Bernhard Voelker
f19747455e tests: remove unnecessary use of -lc
* tests/ls/getxattr-speedup: Remove unneeded use of -lc.
2012-02-26 09:37:31 +01:00
Paul Eggert
a507ed6ede sort: default to physmem/8, not physmem/16
* src/sort.c (default_sort_size): Don't divide advice by 2.
Just divide the hard limits by 2.  This matches the comments.
Reported by Rogier Wolff in http://bugs.gnu.org/10877
2012-02-25 10:34:57 -08:00
Jim Meyering
4624581d53 doc: clarify a comment in system.h
* src/system.h (STRNCMP_LIT): Clarify comment.
Suggested by Bruno Haible.
2012-02-24 12:22:52 +01:00
Jérémy Compostella
69fed0dfec split: add the --additional-suffix option
Add the --additional-suffix option, to append an
additional static suffix to output file names.

* src/split.c (next_file_name): Append suffix to output file names.
(main): Handle new --additional-suffix option.
* NEWS (New features): Mention it.
* doc/coreutils.texi (split invocation): Mention it.
* tests/split/additional-suffix: New file. Test --additional-suffix.
* tests/Makefile.am (TESTS): Add it.
Requested by Peng Yu, in bug 6554
2012-02-20 13:30:26 +00:00
Pádraig Brady
7f48aa570d ls: adjust errnos indicating device non support for xattrs
* src/ls.c (errno_unsupported): Remove EBUSY, as this caters for
the case where ACLs can't be accessed because the _file_ is locked.
http://lists.gnu.org/archive/html/bug-coreutils/2005-06/msg00191.html
Also ENOENT is not safe to include as you get that if the _file_
is removed between the stat() and subsequent querying of xattrs.
2012-02-20 12:41:21 +00:00
Jérémy Compostella
933989eca6 tests: ls/getxattr-speedup: include <sys/types.h> for older headers
Modern <stdio.h> provides ssize_t, but the one from Debian's
libc6-dev 2.11.2-10 apparently does not.
* tests/ls/getxattr-speedup: Also include <sys/types.h>.
2012-02-19 18:43:53 +01:00
Jérémy Compostella
2fe737e595 doc: fix file names in split --filter=command example
* doc/coreutils.texi (split invocation): Output file names should be
prefixed with `big-' not `big-x'.
2012-02-18 19:31:22 +00:00
Jim Meyering
b29db67676 tests: test for ls speed-up
* tests/ls/getxattr-speedup: New test.
* tests/Makefile.am (TESTS): Add it.
Improved-by: Bernhard Voelker
2012-02-18 13:55:06 +01:00
Jim Meyering
8ca2b9659d ls: cache ACL- and CAP-querying syscall failures
Like the optimization to avoid always-failing getfilecon calls,
this change avoids always-failing queries for whether a file has
a nontrivial ACL and for whether a file has certain "capabilities".
When such a query fails for one file (indicating no support), we know it
will always fail that way for the affected device.  With this change, we
have thus eliminated nearly all failing-unsupported getxattr syscalls.
* src/ls.c (has_capability) [!HAVE_CAP]: Set errno to ENOTSUP.
(errno_unsupported): Expand the list of E* errno values to match
that of lib/acl-internal.h's ACL_NOT_WELL_SUPPORTED macro.
(file_has_acl_cache, has_capability_cache): New functions.
(gobble_file): Use them in place of non-caching ones.
* NEWS (Improvements): Mention it.
Suggested by Sven Breuner in
http://thread.gmane.org/gmane.comp.gnu.coreutils.general/2187
While eliminating most getfilecon calls saved about 33%,
eliminating these other calls can save almost all of the
remaining ~67% cost, on some remote file systems.
2012-02-18 10:26:10 +01:00
Jim Meyering
9f237a03c0 ls: optimize for when getfilecon would often fail (~33% perf. gain)
On systems or file systems without SELinux support, all getfilecon
and lgetfilecon calls would fail due to lack of support.  We can non-
invasively cache such failure (on most recently accessed device) and
avoid the vast majority of the failing underlying getxattr syscalls.
* src/ls.c (errno_unsupported): New function.
(selinux_challenged_device): New file-scoped global.
(getfilecon_cache, lgetfilecon_cache): New error-caching wrapper
functions.
(gobble_file): Use the caching wrappers, for when many *getfilecon
calls would fail with ENOTSUP or EOPNOTSUPP.
Suggested by Sven Breuner in
http://thread.gmane.org/gmane.comp.gnu.coreutils.general/2187
Improved-by: Pádraig Brady.
2012-02-18 10:26:10 +01:00
Jérémy Compostella
d55d3dd588 split: support optional start value for --numeric-suffixes
Allow changing the --numeric-suffixes start number
from the default of 0.

* src/split.c (next_file_name): Initialize the suffix index
and the output filename according to start value.
(main): Check that the suffix length is large enough for the
numerical suffix start value.
* doc/coreutils.texi (split invocation): Mention it.
* NEWS (New features): Mention it.
* tests/split/numeric: New file. Test --numeric-suffixes[=FROM].
* tests/Makefile.am (TESTS): Reference the new test.
2012-02-18 02:09:32 +00:00
Pádraig Brady
557b3b2a35 doc: fix a typo about seek_bytes in NEWS
* NEWS: s/count_bytes/seek_bytes/2
2012-02-17 11:28:01 +00:00
Bernhard Voelker
bf5ba002c2 doc: improve 'rm -f' description
* doc/coreutils.texi (rm invocation): Mention that the -f option also
silences the message for missing operands, which is useful in scripts
e.g., for "rm -f $file_list" when $file_list is empty.
* src/rm.c (usage):  Likewise.
Reported by Jérémy Magrin in http://bugs.gnu.org/10819
2012-02-16 14:54:49 +01:00
Pádraig Brady
4bb5dbcfef dd: fix issues in the count_bytes and seek_bytes flags change
These edge cases were missed in the previous commit 140eca15c.

* src/dd.c (main): Include the bytes slop when truncating
without further I/O.  Don't invalidate the whole file cache
in the case where 0 < count < ibs.
* tests/dd/bytes: Change to using the independent truncate
command to generate the file for comparison.  Remove a redundant
test case and replace with one testing the truncation only logic.
2012-02-13 21:58:21 +00:00
Jérémy Compostella
140eca15c4 dd: add count_bytes, skip_bytes and seek_bytes flags
dd now accepts the count_bytes and skip_bytes input flag and the
seek_bytes output flag, to more easily allow processing portions of a
file.

* src/dd.c (scanargs): Compute skip_records and skip_bytes when
'skip_bytes' iflag is used. Compute max_records and max_bytes when
'count_bytes' iflag is used. Compute seek_records and seek_bytes
when 'seek_bytes' oflag is used.
(skip_via_lseek): Use new 'bytes' parameter and handle potential
'records' equals to zero. Update the bytes parameter when called with
'fdesc' equal to STDOUT_FILENO. Update the header comments.
(dd_copy): Skip accordingly to skip_records AND skip_bytes. Count
accordingly to max_records AND max_bytes. Seek on output accordingly
to seek_records AND seek_bytes.
* NEWS (New features): Mention it.
* doc/coreutils.texi (dd invocation): Detail new flags and behaviors.
* tests/dd/bytes: New file. Tests for these new flags.
* tests/Makefile.am (TESTS): Add it.
2012-02-12 17:34:28 +00:00
Jim Meyering
da2b32e7af build: correct @@-,length values in last hunk of regcomp.c.diff
* gl/lib/regcomp.c.diff: Correct invalid hunk lengths (s/1/7/g)
in the last hunk's @@-line.
2012-02-12 14:37:00 +01:00
Jim Meyering
e57a547bc0 build: update gnulib, bootstrap, gl/lib/regcomp.c.diff
* gnulib: Update submodule to latest.
* bootstrap: Update from gnulib.
* gl/lib/regcomp.c.diff: Adapt to gnulib changes.
2012-02-12 12:21:56 +01:00
Jim Meyering
b01355a1dc mv: "mv A B" would sometimes succeed, yet A would remain, ...
But only when both A and B were hard links to the same symlink.
* src/copy.c (same_file_ok): Handle another special case: the one
in which we are moving a symlink onto a hard link to itself.
In this case, we must explicitly tell the caller to unlink the
source file.  Otherwise, at least the linux-3.x kernel rename
function would do nothing, as mandated by POSIX 2008.
* tests/mv/symlink-onto-hardlink-to-self: New test.
* tests/Makefile.am (TESTS): Add it.
* NEWS (Bug fixes): Mention it.
Reported by Bernhard Voelker in http://bugs.gnu.org/10686
2012-02-12 12:21:53 +01:00
Jérémy Compostella
31eeead938 maint: add braces as requested by HACKING coding standard
* src/dd.c (dd_copy): Braces were missing for this do/while statement.
2012-02-06 01:34:20 +00:00
Pádraig Brady
02551d8a62 doc: clarify --help output for some optional arguments
* src/pr.c (usage): Fix the -S description to indicate
that the argument is optional for the short option.
* doc/coreutils.texi (pr invocation): Likewise.
* src/od.c (usage): Fix the -S description to indicate
that the argument is required for the short option.
Clarify -w takes an argument and that it is optional.
2012-01-31 12:53:45 +00:00
Jim Meyering
447b5d9320 maint: sort: remove the last uses of "'%s'" in diagnostics
* src/sort.c (key_warnings): Use quote (quote_n, since there are two)
rather than literal single quotes ('%s') in diagnostic.
2012-01-30 20:43:58 +01:00
Jim Meyering
d1b0155d80 mv: allow moving symlink onto same-inode dest with >= 2 hard links
Normally, mv detects a few subtle cases in which proceeding with a
same-file rename would, with very high probability, cause data loss.
Here, we have found a corner case in which one of these same-inode
tests makes mv refuse to perform a useful operation.  Permit that
corner case.
* src/copy.c (same_file_ok): Detect/exempt this case.
* tests/mv/symlink-onto-hardlink: New test.
* tests/Makefile.am (TESTS): Add it.
* NEWS (Bug fixes): Mention it.
Initially reported by: Matt McCutchen in http://bugs.gnu.org/6960.
Raised again by Anders Kaseorg due to http://bugs.debian.org/654596.
Improved-by: Paul Eggert.
2012-01-30 20:43:07 +01:00
Jim Meyering
67ebdb9f20 build: update gnulib, for syntax-check vs canonicalize fix 2012-01-30 08:36:25 +01:00
Jim Meyering
d7878454cd maint: use single copyright year range
Run "make update-copyright".
2012-01-27 11:35:24 +01:00
Jim Meyering
3068c84765 maint: make copyright statements more consistent; update gnulib
* cfg.mk (update-copyright-env): Add UPDATE_COPYRIGHT_FORCE=1
to rejoin some split lines, and UPDATE_COPYRIGHT_USE_INTERVALS=2
to make update-copyright use only one year range.
* gnulib: Update to latest, for newer update-copyright script.
2012-01-27 11:33:19 +01:00
Jim Meyering
2a90c5a125 maint: fix copyright in old fileutils ChangeLog
* old/fileutils/ChangeLog-1997: Insert omitted "Free Software" in
the name of the copyright holder.  Compress year range.
2012-01-27 11:32:24 +01:00
Pádraig Brady
d955282324 maint: remove some redundant automake _SOURCES
* src/Makefile.am: Remove auto generated entries.
2012-01-26 00:02:37 +00:00
Pádraig Brady
14a1e3ea83 maint: cleanup an extraneous version output in a test
* test/misc/stdbuf: Fixup the minor copy & paste issue
introduced in commit ff7f0ff8
2012-01-25 23:16:17 +00:00
Pádraig Brady
9d46b25ded realpath: avoid the use of printf
This was seen to give an 11% performance improvement.

* src/realpath.c (relpath): Avoid using printf.
(process_path): Likewise.
2012-01-25 19:51:43 +00:00
Pádraig Brady
c5cb291939 maint: use the standard require_perl_ function
* tests/cp/sparse-fiemap: Don't use a separate check.
2012-01-25 18:19:55 +00:00
Pádraig Brady
11af4b31b6 realpath: remove extraneous '/' for --relative-to edge cases
* src/realpath.c (path_common_prefix): Be consistent and
always include a leading '/' in the count returned.
(relpath): Account for the change in path_common_prefix()
and avoid outputting extra '/' chars in relative paths that
span the root dir.
* tests/misc/realpath: Add the two reported cases.
Reported by Mike Frysinger
2012-01-25 18:01:52 +00:00
Jim Meyering
e9a2555826 build: update gnulib to latest, for test warning fixes
See http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/29810
for details.
2012-01-23 17:59:57 +01:00
Jim Meyering
dec02bb98e tests: remove crufty test=test_name code from old tests
Before init.sh and similar, we would set test=test_name, and then
construct temporary file names using $test.  Now that each
init.sh-using test is in its own directory, that practice is unwelcome.
Remove bad examples.
* tests/rm/f-1: Per above.
* tests/rm/i-1: Likewise.
* tests/rm/interactive-always: Likewise.
* tests/rm/interactive-once: Likewise.
* tests/rm/ir-1: Likewise.
* tests/rm/r-1: Likewise.
2012-01-23 14:42:10 +01:00
Paul Eggert
80bc8651fd maint: quote 'like this' or "like this", not `like this'
* doc/coreutils.texi (Formatting the file names):
coreutils now quotes 'like this'.
* man/help2man:
* src/timeout.c (usage): Quote 'like this' in diagnostics.
* HACKING, Makefile.am, NEWS, README, README-hacking, TODO, cfg.mk:
* doc/Makefile.am, doc/coreutils.texi, m4/jm-macros.m4:
* man/Makefile.am, man/help2man, src/Makefile.am, src/copy.h:
* src/extract-magic, src/ls.c, src/pinky.c, src/pr.c, src/sort.c:
* src/split.c, src/timeout.c, src/who.c, tests/dd/skip-seek-past-file:
* tests/pr/pr-tests: Quote 'like this' in commentary.
* cfg.mk (old_NEWS_hash): Update due to changed old NEWS.
2012-01-22 15:26:38 -08:00
Pádraig Brady
132d005515 stat: clarify the description of the %o stat format
* src/stat.c (usage):  Indicate this is a transfer size
suggestion, rather than some persistent block size.
* doc/coreutils.texi (stat invocation): Likewise.
2012-01-20 14:22:56 +00:00
Jim Meyering
fd0b040fa5 doc: tweak an @uref so its alt reference text renders in info
* doc/coreutils.texi (Opening the software toolbox): Remove commas
from @uref argument, so the alternate text renders properly in info.
Reported by Reuben Thomas.
2012-01-14 21:47:41 +01:00
Pádraig Brady
3c8e42957e maint: fix minor whitespace issues
The previous commit introduced a couple of spacing issues,
luckily one of which caused a test to fail.

* src/stat.c (default_format): Add a space so times are aligned.
* src/tr.c (string2_extentd): Remove an extraneous space.
2012-01-11 15:32:09 +00:00
Jim Meyering
d3227eeb90 maint: adjust formatting of certain continued strings
Add a rule to ding any source file that has a continued string
with a word in the first column of the following line.
Those tend to trigger malfunction in tools that try to map an
arbitrary line number to an enclosing function name.  Of course,
very many strings do precisely this, *when they are part of the
usage function*.  So we exempt the body of each usage function.
* src/dircolors.c (main): Separate a long, continued string
into two separately-quoted parts.
* src/od.c (decode_one_format): Likewise.
(decode_one_format, main): Move a space from end of
preceding line to the beginning of the continued line.
* src/tr.c (unquote, string2_extend, validate): Likewise.
* src/seq.c (main): Split in two and use string concatenation.
* src/stat.c (default_format): Use a mix of techniques.
* cfg.mk (sc_prohibit_continued_string_alpha_in_column_1): New rule.
Exempt three files in src: system.h, od.c, printf.c.
2012-01-11 09:27:50 +01:00
Jim Meyering
bfe711db1c maint: straggler *.[ch] files: convert more `...' to '...'
The preceding commands ignored .[ch] files in lib/ and gl/.
This is what I should have been doing from the start:

  git grep -l '`.*'\' $(g ls-files |grep '\.[ch]$') \
    | xargs perl -pi -e 's/`(.+?'\'')/'\''$1/'
2012-01-09 22:38:24 +01:00
Jim Meyering
3ba8b04426 maint: src/*.[ch]: convert more `...' to '...'
Run this (twice):
  git grep -E -l '`.+'\' src/*.[ch] \
    |xargs perl -pi -e 's/`(.+?'\'')/'\''$1/'
2012-01-09 21:51:59 +01:00
Jim Meyering
a517386f1b maint: src/*.c: change remaining quotes (without embedded spaces)
Run this (twice):
  git grep -E -l '`[^ ]+'\' src/*.c \
    |xargs perl -pi -e 's/`([^ ]+'\'')/'\''$1/'
2012-01-09 21:50:08 +01:00
Jim Meyering
9af0dced5a maint: convert `...' to '...' in --help output
All affected lines end with \ or \n\, so run this command
until it produces no new changes (4 times):
  git grep -E -l '`[^ ]+'\''.*\\' src \
    |xargs perl -pi -e 's/`([^ ]+'\''.*\\)/'\''$1/'
2012-01-09 21:50:08 +01:00
Jim Meyering
36b9a1b6ac maint: adjust quoting: emit '...', not `...' in diagnostics
* src/csplit.c (parse_repeat_count, extract_regexp): As above.
* src/date.c (main): Likewise.
* src/ls.c (decode_switches): Likewise.
* src/od.c (decode_one_format, main): Likewise.
* src/pathchk.c (no_leading_hyphen): Likewise.
* src/pr.c (main, getoptarg): Likewise.
* src/rm.c (diagnose_leading_hyphen): Likewise.
* src/sort.c (key_warnings, incompatible_options, main): Likewise.
* src/stat.c (print_esc_char): Print '\x', not `\x' in diagnostic.
* src/test.c (main): Likewise.
* src/touch.c (main): Likewise.
* src/tr.c (build_spec_list, validate, append_range): Likewise.
* tests/misc/mktemp: This is an unusual case, since the affected
string contains only the ` of an `...' string.  So we change
the long ` to a lone '.
* tests/pr/pr-tests: Manual quote adapting fix-up.
* tests/ln/hard-to-sym: Likewise.
* tests/split/suffix-length: Likewise.
* tests/mv/part-fail: Likewise.
* tests/misc/chcon: Likewise.
* tests/misc/stat-printf: Likewise.
2012-01-09 21:50:08 +01:00
Jim Meyering
ae2b0d2ddc tests: more automated quote adjustment
Relax initial regexp to match more instances, but add a
filter to avoid some invalid conversions.  Run this:

git grep -l "\`[^']*'" tests | xargs perl -pi -e '$q=q"'\''";' \
  -e '$q="$q\\$q$q"; /(= ?\`|\`expr|\`echo|\Q$q\E)/ and next;' \
  -e ' s/\`([^'\''"]*?'\'')/'\''$1/g'
The last disjunct in the above (...) filter is to exempt
any line that contains this string: '\''
With quoting like that, converting a ` to ' is likely to cause trouble,
so we'll handle those manually.  Here are three examples where
the exemption is required:

  *': `link-to-dir/'\'': hard link not allowed for directory'*) ;;
  printf 'creating file `%s'\''\n' $f
  'mv: inter-device move failed: `%s'\'' to `%s'\'';'\
2012-01-09 21:50:08 +01:00
Jim Meyering
dd0e4c5621 tests: change `...' to '...' on lines not matching /[=\$]/
Exempt lines with '$' or '=', since those are prone to improper
conversion.  Run this:
  git grep -l "\`[^']*'" tests \
   |xargs perl -pi -e '/[=\$]/ and next;s/\`([^'\''"]*?'\'')/'\''$1/g'
2012-01-09 21:50:08 +01:00
Jim Meyering
50610144b0 tests: adjust \`...' quoting to '...' to adapt to latest gnulib
Run this:
  git grep -l "\\\\\`[^']*'" tests \
    |xargs perl -pi -e 's/\\\`(.*?'\'')/'\''$1/g
2012-01-09 21:50:08 +01:00
Jim Meyering
68a959262a build: update gnulib submodule to latest (quoting change)
This pulls in changes to the quote and quotearg modules that
render quoted strings in diagnostics.  `Old' vs 'new'.
2012-01-09 21:50:07 +01:00
Jim Meyering
84e742fab4 maint: prep for global quoting changes: handle irregular cases manually
* src/chroot.c (usage): Change ``...'' to '...', and describe the
default more accurately (also adding quotes): s,/bin/sh,'/bin/sh -i',
* src/join.c (usage): Change ` ...'' ' to "...''".
* src/fmt.c (isopen): Change `' to '` in list of bytes, so that
a subsequent change can safely perform the `...' to '...' conversion.
* src/truncate.c (main): Tweak quoting in comments to use '...',
not `...`, for consistency with the rest of comments in coreutils.
2012-01-09 21:49:51 +01:00
Jim Meyering
8ac05f82a2 maint: update quoting of "Try `prog --help'" to "Try 'prog --help'"
Automatically adjust both the source (now in only one place)
and all tests that expect the resulting output via this:

git grep -l 'Try.*--help' src/system.h tests \
  | xargs perl -pi -e 's/Try \\?`(\S+ --help)/Try '\''$1/'
2012-01-07 17:18:14 +01:00
Jim Meyering
101d1203c6 maint: use new emit_try_help in place of equivalent fprintf
Run this command:
  perl -0777 -pi -e \
   's/fprintf \(stderr, _\("Try `%s --help.*\n.*;/emit_try_help ();/m'\
     src/*.c
2012-01-07 16:54:26 +01:00
Jim Meyering
22af6d9752 maint: factor out all `Try --help'-emitting statements
* src/system.h (emit_try_help): New function.
2012-01-07 16:42:41 +01:00
Jim Meyering
1df91bd6b9 maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2012-01-06 18:29:53 +01:00
Jim Meyering
b26c2cd3d7 version 8.15
* NEWS: Record release date.
2012-01-06 18:05:54 +01:00
Jim Meyering
ce0e4459c4 scripts: allow one-line summary to start with "[Vv]ersion \d"
* scripts/git-hooks/commit-msg: Do not reject the commit log
message generated by our automated release-and-tag process.
(bad_first_line): New function, extracted from...
(check_msg): ... here.  Use it.
2012-01-06 17:51:52 +01:00
Jim Meyering
59cb41ecd7 build: update gnulib submodule to latest 2012-01-06 14:16:15 +01:00
Jim Meyering
e8fb9b0169 tests: adjust quoting in expected output to match new gnulib policy
* tests/misc/xstrtol: Use '...' to match new quoting in most places.
However, leave `9x' to match the sole comparison against output
from the quote function, which still uses `...'.
* tests/misc/sort-merge: Likewise, though here I had to leave
`...'-quoted output to match output from four tests.
* tests/pr/pr-tests: Convert a single `...' to '...'.
* gnulib: Update submodule to latest.
2012-01-06 11:00:36 +01:00
Jim Meyering
847446ac84 maint: adjust ChangeLog to reflect earlier df request
* build-aux/git-log-fix: Credit early reporter.
* THANKS.in: Add a name.
2012-01-06 10:14:19 +01:00
Pádraig Brady
c84c362207 tests: avoid stty icanon issues on some platforms
* tests/misc/stty: Exclude 'icanon' for the list to check,
as it's problematic on ppc*|sparc* platforms.
2012-01-05 15:31:50 +00:00
Pádraig Brady
45354d58de tests: avoid ulimit issue on bash 3.2 on OS X
* tests/misc/sort-continue: Perform the glob before
the ulimit, as it was seen to make the glob fail
on bash 3.2 on Mac OS X 10.6.8 at least.
2012-01-05 15:13:34 +00:00
Pádraig Brady
512662fb30 tests: avoid a false positive due to overflow on Linux/HPPA
* tests/misc/timeout-parameters: Verify that the timer doesn't
fire immediately in the problematic range, and avoid overflow
checks in that case.
* man/timeout.x: Mention the possible bug.

Reported by Bruno Haible
2012-01-05 15:12:16 +00:00
Jim Meyering
101a30a2a0 tests: adjust setfacl usage to accommodate Solaris 10
* cfg.mk (sc_prohibit_short_facl_mode_spec): New rule.
* tests/cp/acl: Extend setfacl mode spec to have length 3.
* tests/ls/slink-acl: Likewise.
* tests/mv/acl: Likewise.
Report and analysis by Bruno Haible.
2012-01-05 11:48:35 +01:00
Bruno Haible
931e0f2a70 split: avoid failure due to leftover 'errno' value
* src/split.c (lines_chunk_split): Fix logic bug that led to
unwarranted failure of "split -n l/2 /dev/zero" on NetBSD 5.1.
The same would happen when splitting a growing file, where
open/lseek-end gives one size, but by the time we read, there
is more data available.
(bytes_chunk_extract): Likewise.
* NEWS (Bug fixes): Mention this.
* tests/split/l-chunk: The latter case was not exercised.
Add code to do that.
Bug introduced with the chunk-selecting feature in v8.7-25-gbe10739.

Co-authored-by: Jim Meyering <meyering@redhat.com>
2012-01-05 11:46:48 +01:00
Jim Meyering
4d3e398a74 doc: README: recommend GNU make to run tests on IRIX 6.5 and Solaris 9
* README: Document vendor "make check" failure on those two systems.
Reported by Bruno Haible.
2012-01-05 08:10:29 +01:00
Jim Meyering
d015505528 maint: ignore *.trs files, lib/getopt.h and build-aux/test-driver
* .gitignore: Also ignore automake's new .trs files and its
build-aux/test-driver, as well as lib/getopt.h.
2012-01-04 20:25:38 +01:00
Jim Meyering
2403b1caa5 doc: adjust NEWS
* NEWS (New programs): Move this small section to the top.
(df): Reword entry, from Pádraig Brady.
2012-01-03 17:34:31 +01:00
Jim Meyering
1e18d8416f df: work around long-named /dev/disk/by-uuid/... symlinks
On systems with recent kernel/tools, a symlink from /etc/mtab to
/proc/mounts, and a by-UUID mount (i.e., soon, nearly everyone),
you will see something like the following when running "df -hT":
(this has been truncated to fit in a width-limited ChangeLog file)

Filesystem                                             Type      Siz...
rootfs                                                 rootfs     11G
udev                                                   devtmpfs  3.8G
tmpfs                                                  tmpfs     774M
/dev/disk/by-uuid/828fc648-9f30-43d8-a0b1-f7096a2edb66 ext4       11G
tmpfs                                                  tmpfs     1.6G
/dev/sda2                                              ext3      494M
/dev/sda5                                              ext4       12G
/dev/sda6                                              ext4      9.9G

Contrast that with what we're used to seeing (modulo the
two entries mounted on "/", which is a separate problem):

Filesystem     Type      Size  Used Avail Use% Mounted on
rootfs         rootfs     11G  1.9G  8.0G  19% /
udev           devtmpfs  3.8G     0  3.8G   0% /dev
tmpfs          tmpfs     774M  376K  774M   1% /run
/dev/sda3      ext4       11G  1.9G  8.0G  19% /
tmpfs          tmpfs     1.6G  8.0K  1.6G   1% /run/shm
/dev/sda2      ext3      494M   78M  392M  17% /boot
/dev/sda5      ext4       12G  7.6G  3.7G  68% /usr
/dev/sda6      ext4      9.9G  6.6G  2.8G  71% /var

When that long /dev/disk/by-uuid/... name is merely a symlink
to a much shorter (and often more useful) device name like
"/dev/sda3", and when it's part of a listing of all file systems,
I would much prefer to see only the latter.  Similarly, when using
an encrypted root file system, you would see a name like
/dev/mapper/luks-828fc648-9f30-43d8-a0b1-f7196a2edb66 pointing
to say, /dev/dm-0, I prefer the shorter name.

I.e., if I explicitly run
"df -hT /dev/disk/by-uuid/828fc648-9f30-43d8-a0b1-f7096a2edb66",
then, it's fine -- and expected -- to print to the long name.
It was explicitly given.  However, with no non-option argument,
df should print the shorter name.  Note that performing this
translation at a lower level (via a change to gnulib's mountlist.c)
would make it impossible to distinguish those two cases.

* src/df.c: Include "canonicalize.h".
(get_dev): Add a parameter, telling when we're in process-all-
mount-points mode; update all callers.  When true, resolve
UUID-suffixed symlinks.
* NEWS (Changes in behavior): Mention it.
Reported by Dan Jacobson in http://bugs.gnu.org/10363
2012-01-03 16:55:58 +01:00
Jim Meyering
520b69ce36 tests: adjust realpath test to avoid "make distcheck" failure
* tests/misc/realpath: Quote lhs of test ... = ..., so that
when $PWD contains a space (like it does via "make distcheck"),
the test does not fail
2012-01-03 12:58:37 +01:00
Pádraig Brady
77ea441f79 realpath: a new program to print the resolved path
This program is compatible with other realpath(1)
implementations, and also incorporates relpath like support,
through the --relative options.  The relpath support
was suggested by Peng Yu, who also provided an initial
implemenation of that functionality.

* AUTHORS: Add my name.
* NEWS: Mention the new command.
* README: Likewise.
* doc/coreutils.texi (realpath invocation): Add realpath info.
* man/Makefile.am (realpath.1): Add dependency.
* man/realpath.x: New template.
* man/.gitignore: Ignore generated man page.
* po/POTFILES.in: Add src/realpath.c.
* src/.gitignore: Exclude realpath.
* src/Makefile.am (EXTRA_PROGRAMS): Add realpath.
* src/realpath.c: New file.
* scripts/git-hooks/commit-msg: Add realpath to the list of prefixes.
* tests/Makefile.am (TESTS): Add misc/realpath.
* tests/misc/realpath: New file.
2012-01-03 11:36:32 +00:00
Pádraig Brady
76352c770e build: update gnulib for canonicalize_filename_mode improvements
This is required for the new realpath command.
2012-01-03 11:34:42 +00:00
Jim Meyering
3a189ae0ce build: tail: avoid type/format mismatch warning from gcc
Without this change, gcc's -Werror=format would complain that
the '%lx' format requires 'long unsigned int', not 'int'.
* src/tail.c (fremote): Use a temporary variable.
2012-01-02 22:35:36 +01:00
Jim Meyering
794e52b7bd tests: also print chmod's --version
* tests/rm/many-dir-entries-vs-OOM: This test also exercises chmod.
2012-01-01 18:40:54 +01:00
Jim Meyering
5111aa4296 maint: update all copyright year number ranges
Run "make update-copyright".
2012-01-01 10:04:06 +01:00
Jim Meyering
75a21e6248 tests: change copyright year from 2011 to 2012 in sample-test
This file is special.  We don't want to use a range,
but merely the current year number.
* tests/sample-test: s/2011/2012/
2012-01-01 10:03:50 +01:00
Jim Meyering
76fd122a85 tests: fix a missing-dependency problem
* tests/check.mk (.built-programs): Depend on src/Makefile.am,
so that when we add a program, this file is updated, and the new
program is tested via misc/help-version.  Spotted by Pádraig Brady.
2011-12-31 12:30:46 +01:00
Jim Meyering
9be9d120f0 build: avoid spurious test.c warning with -Wsuggest-attribute=pure
* src/test.c: Add pragma to suppress gcc-4.6.2's warning that
"advance" might be candidate for attribute 'pure'.
2011-12-30 22:48:38 +01:00
Jim Meyering
6e00315bf2 tail: avoid theoretically undefined behavior
* src/tail.c (start_lines): Do not form potentially-invalid address.
Use safe_read's return value as a pointer offset only after
ensuring that it is not SAFE_READ_ERROR (size_t)(-1).
Spotted by coverity.
Also, move declaration of "p" to be closer to first use.
2011-12-28 18:53:32 +01:00
Jim Meyering
3e7a1473ae tests: also unset _STDBUF_E, _STDBUF_I and _STDBUF_O
* tests/envvar-check (vars): Add these to the list of envvars we
ignore: _STDBUF_E, _STDBUF_I, _STDBUF_O, used by libstdbuf.
2011-12-28 18:01:01 +01:00
Pádraig Brady
44e20cda07 doc: homologize ch{con,grp,mod,own} option descriptions
* src/chgrp.c (usage): Group associated options together,
to aid users.  Also minimize the differences between
individual messages across these four commands, to
aid translators.
* src/chmod.c: Likewise.
* src/chown.c: Likewise.
* src/chcon.c (usage): Likewise.  Document the
--dereference option.

Suggested by Paul Eggert and Jari Aalto
2011-12-26 22:19:46 +00:00
Jim Meyering
b1230020dc stat,tail: recognize new FS type: pipefs
* src/stat.c (human_fstype) [S_MAGIC_PIPEFS]: New case.
* NEWS (Bug fixes): Mention this.
2011-12-26 16:37:55 +01:00
Jim Meyering
b2a6fb0ac9 doc: stat: clarify that %t and %T expand to the file system type
* src/stat.c (usage): Mention "file system type", not just "type"
for %t and %T.  Do not capitalize the first letter of each description.
2011-12-24 12:03:18 +01:00
Jim Meyering
9c54c0a1d0 tail: with -f, use polling when a file is on an FS of unknown type
Before, we would use inotify in that case, which would work as long
as updates were taking place locally, but not at all when remote.
Move hard-coded list of known remote FS types into a more
maintainable table in stat.c, alongside the list of FS
names and magic numbers.  Generate a new is_local_fs_type function.
* src/Makefile.am (fs-is-local.h): New rule, generated file.
* src/extract-magic: Revamp to parse local/remote keyword after
each magic number in src/stat.c's case statements.
Accept new --local option.
* src/.gitignore: Ignore the generated fs-is-local.h.
* src/tail.c [HAVE_INOTIFY]: Include fs-is-local.h.
(fremote) [HAVE_INOTIFY]: Use the new function in place of
the switch stmt with hard-coded list of FS types.
Emit a warning when processing a file on a file system of unknown type.
* NEWS (Changes in behavior): Mention it.
Suggested by Sven Breuner.
2011-12-23 22:39:14 +01:00
Jim Meyering
6e3299fcdb doc: update README-release with process to check for new FS magic
* README-release: Run the Makefile rule that checks for new file
system magic numbers.
2011-12-22 10:15:51 +01:00
Jim Meyering
8965297092 tail,stat: add support for FhGFS
* src/stat.c (human_fstype): Add a case: fhgfs, 0x19830326.
* src/tail.c (fremote): Add S_MAGIC_FHGFS.
* NEWS (Bug fixes): Update the entry for GPFS to mention FhGFS, too.
Reported by Sven Breuner.
2011-12-22 09:36:31 +01:00
Jim Meyering
ed71262bc2 doc: improve factor example
* doc/coreutils.texi (factor invocation): Adjust example to use $(...)
consistently, not a mix of `...` and $(...).  Separate the computation
of the product and the actual factorization, so the timing of the
latter doesn't include the cost of the former.
2011-12-20 14:39:57 +01:00
Jim Meyering
f797c04415 build: remove now-useless code from bootstrap.conf
* bootstrap.conf (bootstrap_epilogue): Remove now-unnecessary,
snippet that edited gnulib-tests/gnulib.mk.  This snippet was
rendered unnecessary by commit v8.14-73-g5bf2c0e.
2011-12-17 17:26:00 +01:00
Jim Meyering
e71f0d9df3 build: merge in bootstrap changes from gnulib
* bootstrap: Pull in the combination of gnulib's "bootstrap: detect
tools required by gnulib-tool" patch and the related fix.
2011-12-17 16:38:23 +01:00
Paul Eggert
cfe1040c09 du: -x should not count files in other file systems
This fixes Bug#10293, which I guess was introduced in commit
95c948b06a dated 2003-10-02.
* NEWS: Document fix.
* src/du.c (process_file): Don't count files in different file
systems if -x is given.
* tests/du/one-file-system: Test for this bug.
2011-12-14 18:04:05 -08:00
Paul Eggert
021a066409 doc: document 'touch' and timestamps better
* doc/coreutils.texi (touch invocation): Explain file timestamps
better.  Problem reported by Nelson H.F. Beebe (Bug#7999).
2011-12-12 16:57:33 -08:00
Jim Meyering
a3fee8b6af ls: give a more useful diagnostic for a bogus --time-style arg
* src/ls.c (decode_switches): Replace our use of XARGMATCH
with open-coded version so that we can give a better diagnostic.
* tests/ls/time-style-diag: New file.
* tests/Makefile.am (TESTS): Add it.
Reported by Dan Jacobson in http://bugs.gnu.org/10253
with suggestions from Eric Blake and Paul Eggert.
2011-12-12 12:19:55 +01:00
Jim Meyering
da4793e949 maint: remove a misleading comment from shred.c
* src/shred.c: Remove obsolete TODO comment.  The first two and the
last item were done, adding --recursive (-r) is neither necessary
nor appropriate, and I don't want to add --interactive.  I don't
see a need for the others.  Prompted by comments from Amr Ali.
2011-12-09 20:18:29 +01:00
Jim Meyering
c592a00f8f ls: be responsive to interrupts when color-listing large directories
Starting with commit adc30a83, when using --color, ls inhibited
interrupts to avoid corrupting the state of an output terminal.
However, for very large directories, that inhibition rendered ls
uninterruptible for too long, including a potentially long period
even before any output is generated.
* src/ls.c: Two phases of processing are time-consuming enough that
they can provoke this: the readdir loop and the printing loop.  The
printing was supposed to be covered by a call to process_signals in
(print_name_with_quoting): ... but that call was mistakenly guarded
by a condition that might be false for many or even all files being
processed.  Call process_signals unconditionally.
(print_dir): Also call process_signals in the readdir loop.
* NEWS (Bug fixes): Mention it.
Reported by Arkadiusz Miśkiewicz in http://bugs.gnu.org/10243
Co-authored-by: Eric Blake <eblake@redhat.com>
2011-12-08 12:17:54 +01:00
Paul Eggert
6eb3cf234f ln: clarify usage of -L, -n, -T
* src/ln.c (usage): Use clearer wording to describe the -L, -n,
and -T options (Bug#9896).
2011-12-05 14:39:51 -08:00
Paul Eggert
db38db4836 maint: don't assume GNU make \# syntax (fix previous)
* src/Makefile.am (fs_normalize_perl_subst, fs-magic, fs-kernel-magic):
Undo previous patch; it missed a \#.
(fs_normalize_perl_subst): Use \043 rather than \#.
\043 is portable to all ASCIIish platforms, whereas \# is portable
only to platforms that are compatible with GNU make (and are
incompatible with POSIX make).  Porting this to EBCDIC is left as
an exercise for the reader....
2011-12-05 14:04:37 -08:00
Jim Meyering
d72e8dff04 maint: sort, stat: remove unused parameters
* src/sort.c (struct thread_args) [is_lo_child]: Remove member.
(sortlines): Remove unused parameter, "is_lo_child".  Update callers.
* src/stat.c (out_epoch_sec): Mark unused parameter.
(do_statfs, do_stat): Remove unused parameter, "terse". Update callers.
2011-12-05 22:49:34 +01:00
Paul Eggert
787592587d maint: don't assume GNU make \# syntax
* src/Makefile.am (fs_normalize_perl_subst): Don't make unportable
assumption about \# in the right hand side of a macro definition.
This works with GNU make, but not with POSIX make.
Problem reported by Basavaraj B (Bug#10220).
(fs-magic, fs-kernel-magic): Do the #-substitution here instead.
2011-12-05 13:30:15 -08:00
Jim Meyering
63098ee582 od,test: address warnings from gcc's -Wjump-misses-init
* src/test.c (unary_operator): gcc reported that initializations
in two case statements were skipped.  Enclose in braces.
* src/od.c (decode_one_format): Likewise.
2011-12-04 10:31:03 +01:00
Jim Meyering
bea7b10489 maint: remove redundant usage declarations (-Wredundant-decls)
* src/csplit.c (usage): Remove declaration.
* src/ls.c (usage): Likewise.
* src/pr.c (usage): Likewise.
2011-12-04 10:27:52 +01:00
Jim Meyering
79c5fcc681 maint: add missing ":" after "License" in local gnulib module files
This avoids spurious diagnostics when running our "bootstrap" script.
* gl/modules/heap: Append colon after "License".
* gl/modules/randint: Likewise.
* gl/modules/randperm: Likewise.
* gl/modules/randread: Likewise.
Reported by Stefano Lattarini.  Diagnosed by Bruno Haible.
2011-12-03 14:04:23 +01:00
Eric Blake
01fc9e146c doc: fix list of GNU extension date formats
I didn't check how long these were documented as GNU extensions,
nor when they were added by POSIX; but since they are all part
of POSIX 2008, we no longer need call them out as extensions.

The next version of POSIX will standardize %s:
http://austingroupbugs.net/view.php?id=169
but as that is not out yet, I didn't change %s.

* doc/coreutils.texi (Time conversion specifiers): %R and %z are
now POSIX.
(Date conversion specifiers): Likewise for %F, %g, %G.
2011-12-01 12:13:02 -07:00
Bernhard Voelker
8df7652cfa tests: adjust PATH to generally include /sbin and /usr/sbin
Commit 5eeaca94 added /sbin to the PATH for tests using mkfs. For other
tests, e.g. tests/cp-fiemap-perf using filefrag, we need /usr/sbin also.
Add both directories generally for the tests, "since many of us always
augment our PATH with all of the sbin paths all of the time anyway" (Bob
in http://lists.gnu.org/archive/html/coreutils/2011-11/msg00107.html).
The previous commit is hereby obsolete.
* tests/init.cfg (sanitize_path_): Add /sbin and /usr/sbin to PATH
unless already included. Needed for tests using admin tools like mkfs
and filefrag on systems where the user's environment does not have
these directories in the PATH.
* tests/init.cfg (require_mkfs_PATH_): Remove obsolete function.
* tests/cp/cp-a-selinux: Remove require_mkfs_PATH_ call.
* tests/cp/cp-mv-enotsup-xattr: Likewise.
* tests/cp/sparse-fiemap: Likewise.
* tests/mkdir/writable-under-readonly: Likewise.
* tests/rm/read-only: Likewise.
2011-12-01 09:07:13 +01:00
Eric Blake
92b7b7708e build: simplify warnings based on last gnulib update
We no longer need to exclude this warning.

* configure.ac (WARN_CFLAGS): Gnulib dropped
-Wunsuffixed-float-constants, as non-portable.
2011-11-29 16:16:45 -07:00
Eric Blake
20dfc04204 build: update gnulib for syntax-check improvement
Commit 5b3e538 proved useful enough to migrate to gnulib after
enhancing it to be more generic, which in turn pointed out that
commit a2c811db missed an offender.

* gnulib: Update to latest.
* cfg.mk (sc_prohibit_reversed_compare_failure): Delete, now that
gnulib provides it.
* tests/ls/dangle: Fix last offender.
2011-11-29 16:10:40 -07:00
Jim Meyering
1a85d4a05a build: update gnulib to fix build failure with --enable-gcc-warnings 2011-11-29 14:51:15 +01:00
Jim Meyering
73a9acd6e8 build: enable -Wsuggest-attribute=pure|const in lib/,...
but not in gnulib-tests/.
* configure.ac (GNULIB_WARN_CFLAGS): Do not exclude
-Wsuggest-attribute=pure|const, thus enabling these two warning
options in lib/, since gnulib now toes the line.
Continue to disable them in gnulib-tests/, since some programs
there trigger these suggestions and are not worth fixing.
2011-11-28 10:29:01 +01:00
Jim Meyering
1e676ec844 build: update gnulib for const+pure attributes 2011-11-28 10:29:01 +01:00
Jim Meyering
5b3e538b7f tests: add a syntax check for last week's global change
Last week I made a global change, commit a2c811db, `tests: use
"compare exp out", not "compare out exp"', but forgot to add a
corresponding syntax check rule.  Without that, it is far too
easy to add a new test or to merge in an old one that would
be non-conforming.  Obviously this is only a heuristic, since
it relies on the expected-output file to have a name that starts
with "exp".
* cfg.mk (sc_prohibit_reversed_compare_failure): Prohibit use of
compare with reversed arguments.
2011-11-27 21:13:18 +01:00
Jim Meyering
040bc8b50f maint: update comment gcc-4.6.2 still botches -Wsuggest-attribute=pure
* configure.ac: Update the comment on which gcc versions still must
not use -Wsuggest-attribute=pure option: still required on post-
Fedora 16 rawhide's 4.6.2 20111027.
2011-11-27 13:52:11 +01:00
Jim Meyering
3e26551096 maint: bootstrap: run autopoint and libtoolize *before* gnulib-tool
* bootstrap (AUTOPOINT, AUTORECONF): Factor out definitions.
Run autopoint and libtoolize *before* gnulib-tool.
After it, run an abbreviated autoreconf, rather than a loop around
all tools.
* bootstrap.conf (gnulib_tool_option_extras): Add both --symlink
and --makefile-name=gnulib.mk.  Remove stray use of $bt.
* lib/Makefile.am: Initialize all of the following so that
generated code in gnulib.mk may use += to append to those variables:
AM_CFLAGS, AM_CPPFLAGS, BUILT_SOURCES, CLEANFILES, EXTRA_DIST,
MAINTAINERCLEANFILES, MOSTLYCLEANDIRS, MOSTLYCLEANFILES, SUFFIXES,
noinst_LIBRARIES.
2011-11-24 22:18:29 +01:00
Jim Meyering
5bf2c0eed3 maint: bootstrap: remove some now-unneeded code
This bootstrap script arose back when gnulib-tool was young.
Since then, it has seen improvements that render much of this
script unnecessary.  In particular, it can now make symlinks
to the files it uses.  Also, I no longer see as much value in
marking files as read-only via comments.
* bootstrap (slirp, bt_mark_as_generated): Remove.
2011-11-24 22:18:29 +01:00
Jim Meyering
2d9ddc4aef maint: use gnulib's gettext-h, not the gettext module
* bootstrap.conf (gnulib_modules): Use gnulib's gettext-h, not the
gettext module.  Not only is gettext-h far smaller (it has far fewer
dependencies than the gnulib module), but it does not suffer from
the problem with the gettext module whereby it adds a -I.../intl
option to compilation flags.  That can provoke warnings, since we
don't have such a directory.  We used to work around that via a
hack in bootstrap, but that was ugly and inefficient.
2011-11-24 22:18:29 +01:00
Jim Meyering
729cfdb578 maint: append many lib/ and m4/ names to .gitignore 2011-11-24 22:18:29 +01:00
Jim Meyering
b7fbf82d9b build: update gnulib submodule to latest for fixed stdalign test 2011-11-24 22:18:29 +01:00
Jim Meyering
0fd74a564e scripts: commit-msg: tweak 72-column test to avoid a false-positive
* scripts/git-hooks/commit-msg: Don't warn about a line that is
longer than 72 if it is a comment.  Git-generated comments would
occasionally trigger this.
2011-11-23 09:05:08 +01:00
Jim Meyering
3d213a17fa build: update gnulib and tests/init.sh
* gnulib: Update.
* tests/init.sh: Update from gnulib.
2011-11-23 08:56:56 +01:00
Jim Meyering
da38f12d6f build: --enable-gcc-warnings: disable some new warnings
* configure.ac: Disable some new warning options pulled in via
an update to gnulib's manywarnings module: -Wformat-nonliteral,
-Wunsuffixed-float-constants, -Wdouble-promotion.
2011-11-23 08:56:48 +01:00
Jim Meyering
a2c811db42 tests: use "compare exp out", not "compare out exp"
Likewise, when an empty file is expected, use "compare /dev/null out",
not "compare out /dev/null". I.e., specify the expected/desired contents
via the first file name.  Prompted by a suggestion from Bruno Haible
in http://thread.gmane.org/gmane.comp.gnu.grep.bugs/4020/focus=29154

Run these commands:

    git grep -l -E 'compare [^ ]+ exp' \
      |xargs perl -pi -e 's/(compare) (\S+) (exp\S*)/$1 $3 $2/'
    git grep -l -E 'compare [^ ]+ /dev/null' \
      |xargs perl -pi -e 's/(compare) (\S+) (\/dev\/null)/$1 $3 $2/'

* tests/chgrp/no-x: As above.
* tests/chmod/no-x: Likewise.
* tests/chmod/silent: Likewise.
* tests/chmod/thru-dangling: Likewise.
* tests/chown/basic: Likewise.
* tests/chown/deref: Likewise.
* tests/chown/preserve-root: Likewise.
* tests/cp/abuse: Likewise.
* tests/cp/backup-is-src: Likewise.
* tests/cp/cp-a-selinux: Likewise.
* tests/cp/cp-mv-enotsup-xattr: Likewise.
* tests/cp/fail-perm: Likewise.
* tests/cp/into-self: Likewise.
* tests/cp/proc-zero-len: Likewise.
* tests/cp/src-base-dot: Likewise.
* tests/cp/thru-dangling: Likewise.
* tests/dd/reblock: Likewise.
* tests/dd/unblock-sync: Likewise.
* tests/du/2g: Likewise.
* tests/du/8gb: Likewise.
* tests/du/basic: Likewise.
* tests/du/bigtime: Likewise.
* tests/du/deref-args: Likewise.
* tests/du/exclude: Likewise.
* tests/du/files0-from-dir: Likewise.
* tests/du/hard-link: Likewise.
* tests/du/inacc-dest: Likewise.
* tests/du/inacc-dir: Likewise.
* tests/du/long-sloop: Likewise.
* tests/du/max-depth: Likewise.
* tests/du/move-dir-while-traversing: Likewise.
* tests/du/no-deref: Likewise.
* tests/du/no-x: Likewise.
* tests/du/one-file-system: Likewise.
* tests/du/slash: Likewise.
* tests/du/trailing-slash: Likewise.
* tests/install/strip-program: Likewise.
* tests/ln/hard-backup: Likewise.
* tests/ls/block-size: Likewise.
* tests/ls/color-clear-to-eol: Likewise.
* tests/ls/color-dtype-dir: Likewise.
* tests/ls/color-norm: Likewise.
* tests/ls/dangle: Likewise.
* tests/ls/dired: Likewise.
* tests/ls/file-type: Likewise.
* tests/ls/follow-slink: Likewise.
* tests/ls/infloop: Likewise.
* tests/ls/m-option: Likewise.
* tests/ls/no-arg: Likewise.
* tests/ls/recursive: Likewise.
* tests/ls/rt-1: Likewise.
* tests/ls/stat-dtype: Likewise.
* tests/ls/stat-failed: Likewise.
* tests/ls/stat-free-symlinks: Likewise.
* tests/ls/x-option: Likewise.
* tests/misc/arch: Likewise.
* tests/misc/cat-buf: Likewise.
* tests/misc/cat-proc: Likewise.
* tests/misc/chcon: Likewise.
* tests/misc/csplit: Likewise.
* tests/misc/df-P: Likewise.
* tests/misc/fmt-long-line: Likewise.
* tests/misc/groups-dash: Likewise.
* tests/misc/groups-version: Likewise.
* tests/misc/head-pos: Likewise.
* tests/misc/nl: Likewise.
* tests/misc/od-N: Likewise.
* tests/misc/od-multiple-t: Likewise.
* tests/misc/od-x8: Likewise.
* tests/misc/printf: Likewise.
* tests/misc/printf-hex: Likewise.
* tests/misc/pwd-option: Likewise.
* tests/misc/readlink-fp-loop: Likewise.
* tests/misc/runcon-no-reorder: Likewise.
* tests/misc/seq-long-double: Likewise.
* tests/misc/sort-NaN-infloop: Likewise.
* tests/misc/sort-benchmark-random: Likewise.
* tests/misc/sort-debug-keys: Likewise.
* tests/misc/sort-float: Likewise.
* tests/misc/sort-merge-fdlimit: Likewise.
* tests/misc/sort-unique-segv: Likewise.
* tests/misc/stat-hyphen: Likewise.
* tests/misc/stat-slash: Likewise.
* tests/misc/stdbuf: Likewise.
* tests/misc/sum-sysv: Likewise.
* tests/misc/tac-2-nonseekable: Likewise.
* tests/misc/tac-continue: Likewise.
* tests/misc/tr-case-class: Likewise.
* tests/misc/truncate-fail-diag: Likewise.
* tests/misc/wc-files0: Likewise.
* tests/mkdir/selinux: Likewise.
* tests/mv/backup-dir: Likewise.
* tests/mv/backup-is-src: Likewise.
* tests/mv/diag: Likewise.
* tests/mv/dir2dir: Likewise.
* tests/mv/dup-source: Likewise.
* tests/mv/force: Likewise.
* tests/mv/hard-verbose: Likewise.
* tests/mv/i-link-no: Likewise.
* tests/mv/into-self: Likewise.
* tests/mv/into-self-2: Likewise.
* tests/mv/into-self-3: Likewise.
* tests/mv/mv-special-1: Likewise.
* tests/mv/part-fail: Likewise.
* tests/mv/perm-1: Likewise.
* tests/mv/sticky-to-xpart: Likewise.
* tests/mv/trailing-slash: Likewise.
* tests/rm/rm1: Likewise.
* tests/rm/rm2: Likewise.
* tests/rm/cycle: Likewise.
* tests/rm/dir-no-w: Likewise.
* tests/rm/dir-nonrecur: Likewise.
* tests/rm/fail-2eperm: Likewise.
* tests/rm/fail-eacces: Likewise.
* tests/rm/i-never: Likewise.
* tests/rm/inaccessible: Likewise.
* tests/rm/interactive-always: Likewise.
* tests/rm/interactive-once: Likewise.
* tests/rm/isatty: Likewise.
* tests/rm/one-file-system: Likewise.
* tests/rm/rm3: Likewise.
* tests/rm/rm5: Likewise.
* tests/rm/unread2: Likewise.
* tests/rm/v-slash: Likewise.
* tests/sample-test: Likewise.
* tests/split/b-chunk: Likewise.
* tests/split/fail: Likewise.
* tests/split/l-chunk: Likewise.
* tests/split/lines: Likewise.
* tests/split/r-chunk: Likewise.
* tests/split/suffix-length: Likewise.
* tests/tail-2/big-4gb: Likewise.
* tests/tail-2/follow-name: Likewise.
* tests/tail-2/follow-stdin: Likewise.
* tests/tail-2/pipe-f: Likewise.
* tests/tail-2/pipe-f2: Likewise.
* tests/tail-2/start-middle: Likewise.
* tests/touch/60-seconds: Likewise.
* tests/touch/fail-diag: Likewise.
* tests/touch/not-owner: Likewise.
* tests/touch/relative: Likewise.
2011-11-22 10:35:03 +01:00
Jim Meyering
9d98634b39 tests: use compare, not "diff", in a few stray tests
* tests/install/basic-1: Use compare, not diff.
* tests/mkdir/p-v: Likewise.
* tests/mv/part-fail: Likewise.
* tests/rm/rm1: Likewise.
* tests/rm/rm2: Likewise.
* tests/touch/not-owner: Likewise.
2011-11-22 10:34:43 +01:00
Jim Meyering
ad10c145ff maint: revert "build: update gnulib submodule to latest"
Don't update to latest from gnulib just yet.
This reverts commit 173f4d9bd6.
In particular, manywarnings is too aggressive.
2011-11-20 23:58:13 +01:00
Jim Meyering
173f4d9bd6 build: update gnulib submodule to latest 2011-11-20 23:38:03 +01:00
Jim Meyering
67b442f2aa maint: make generated THANKS file read-only
* Makefile.am (THANKS): Make generated file read-only.
2011-11-20 23:30:25 +01:00
Jim Meyering
054567f5a7 doc: clarify ln's --help output
* src/ln.c (usage): Use TARGET, not "source" in description.
Reported by Michael J Daniel in http://bugs.gnu.org/9896.
2011-11-20 23:30:25 +01:00
Paul Eggert
71b7ddcdd5 port to GNU hosts, where getuid and friends can fail
* src/groups.c (main):
* src/install.c (need_copy):
* src/su.c (log_su):
* src/test.c (unary_operator):
* src/whoami.c (main):
Don't assume that getuid and friends always succeed.
This fixes the same problem that we recently fixed with 'id'.
2011-11-20 14:09:53 -08:00
Jim Meyering
8ffc159611 maint: avoid gitlog-to-changelog diagnostic about unused entries
* build-aux/git-log-fix: Comment out two unused entries.
Each of those two entries does indicate an error in a commit log,
but precedes the cut-off date, so has an actual VC'd ChangeLog entry.
I.e., gitlog-to-changelog generates ChangeLog entries since 2008-02,
and these two predate that.
* ChangeLog-2008: Make the indicated correction.
2011-11-20 15:34:59 +01:00
Erik Auerswald
5d39ad6419 ln: fix position of --backup values description
* src/ln.c (usage): A paragraph describing interactions of -s
with -L and -P somehow snuck in between the description of the
--backup option and the values used to control it. Fix this by
moving the value description up.
2011-11-20 08:46:30 +01:00
Jim Meyering
1c5ca5c05b scripts: rewrite git commit-msg hook in Perl
* scripts/git-hooks/commit-msg: Rewrite in perl.
This is still a work in progress in that it hard-codes coreutils-
specific program names and policies that should be easy to selectively
enable or disable without modifying the script.
2011-11-18 15:38:18 +01:00
Eric Blake
c0582b9df7 sort: clarify wording on -k syntax
* src/sort.c (usage): Use KEYDEF instead of POS, and call out the
specific OPTS that can occur in KEYDEF.
Based on a report by Lars Noodén, http://bugs.gnu.org/10019
2011-11-16 10:25:47 -07:00
Paul Eggert
8f512f9bdb id: fix bug when euid != ruid
* src/id.c (main): Report an error if no args are given and getuid
fails, because print_full_info needs ruid.  Redo code so that
getuid and friends are invoked only when needed; this makes the
code easier to follow, and is how I found the above bug.
2011-11-15 13:24:02 -08:00
Ruediger Meier
e36e6f2c6e ls: another reword of generic size note
* src/system.h (emit_size_note): Use "unit" rather than "suffix",
and move multiplication to example instead of in suffix list.
See additional discussion in Bug#9939.
2011-11-15 11:55:23 -07:00
Eric Blake
97842f0b97 id: tweak comment
* src/id.c (main): Replace confusing use of "etc.".
2011-11-15 11:48:51 -07:00
Paul Eggert
47e511a1d0 id: handle (uid_t) -1 more portably
* src/id.c (GETID_MAY_FAIL): Remove.
(main): Check for nonzero errno, rather than having a compile-time
GETID_MAY_FAIL guess.  Suggested by Roland McGrath in
<http://debbugs.gnu.org/cgi/bugreport.cgi?bug=10021#47>.
Also, the old code was incorrect if uid_t was narrower than int.
(print_full_info): Remove unnecessary cast to -1.
2011-11-15 09:31:21 -08:00
Paul Eggert
7db79cc4f8 id: undo previous commit, which was done by mistake
* src/id.c (GETID_MAY_FAIL, main, print_full_info): Undo previous change.
2011-11-15 08:41:35 -08:00
Paul Eggert
06ca3797ac doc: update for ISO/IEC 80000-13
* doc/coreutils.texi (Block size): IEC 60027-2 has been superseded
by ISO/IEC 80000-13, so prefer the newer standard but also mention
the old.  The new standard specifies Zi and Yi, so they are no
longer GNU extensions.  Fix stale URL to BIPM.

2011-11-14  Paul Eggert  <eggert@cs.ucla.edu>

id: handle (uid_t) -1 more portably
* src/id.c (GETID_MAY_FAIL): Remove.
(main): Check for negative return values, not for -1.
The old code was incorrect if uid_t was narrower than int,
regardless of whether we were on a GNU or a POSIX platform.
The new code is simpler and doesn't need GETID_MAY_FAIL.
(print_full_info): Remove unnecessary cast to -1.
2011-11-15 08:23:23 -08:00
Ludovic Courtès
40324ca8b2 id: fail when getuid, getgid, etc. fail, e.g., on GNU/Hurd
POSIX-conforming getuid, geteuid, etc. functions cannot fail,
but on GNU/Hurd systems and some others, they may.
* src/id.c (main) [__GNU__]: Detect and diagnose any such failure.
* tests/id/gnu-zero-uids: New file.
* tests/Makefile.am (TESTS): Add it to the list.
* tests/init.cfg (require_gnu_): New function.
2011-11-14 09:52:42 +01:00
Nix
b8b6dd27a6 tests: avoid rare fp failure in du/move-dir-while-traversing
* tests/du/move-dir-while-traversing: Boost the mkdir iteration count
yet again.
2011-11-13 20:02:55 +01:00
Jim Meyering
47052ddbfa maint: adjust git hook to allow "copy: ..." on line 1 of commit message
* scripts/git-hooks/commit-msg: Add "copy" to the list of valid
command-name-like summary line prefixes.
2011-11-13 20:02:55 +01:00
Jim Meyering
5f47550b16 maint: id, groups: use conforming diagnostics
* src/groups.c (main): Don't capitalize the first word of diagnostic.
* src/id.c (main): Likewise.
Reported by Ludovic Courtès.
2011-11-13 10:46:40 +01:00
Jim Meyering
ac9581d80c maint: avoid new syntax-check failure due to indentation with TABs
* cfg.mk (tbi_2): Exempt pre-applypatch, since it too is from git.
2011-11-13 10:40:05 +01:00
Jim Meyering
4df39704b8 maint: install customized git hooks to keep commit logs consistent
* bootstrap.conf (buildreq): Copy (with backup) coreutils-supplied
git hooks into .git/hooks, to help keep commit logs normalized.
2011-11-12 22:49:58 +01:00
Jim Meyering
7bd653dada maint: add rule to ensure that our commit hook copies are up to date
* Makefile.am (check-git-hook-script-sync): New rule -- not used
anywhere, because it depends on having very recent git.
* scripts/git-hooks/pre-applypatch: New file.
2011-11-12 22:23:09 +01:00
Jim Meyering
635bcd0d19 maint: sync pre-commit script with git's
* scripts/git-hooks/pre-commit (allownonascii): Remove double quotes
around $(...) construct, to make this file identical to git's
sample hook script.
2011-11-12 14:00:18 +01:00
Jim Meyering
b64afe0605 build: update gnulib for fstatat cross-compile improvement 2011-11-12 13:32:30 +01:00
Jim Meyering
ceae907fb8 maint: adjust the URL that will appear in the generated announcement
* cfg.mk (url_dir_list): Use this http://ftp.gnu.org/gnu/$(PACKAGE)
for the first link listed in the generated announcement.
announce-gen now provides the faster mirror link automatically.
2011-11-12 10:22:55 +01:00
Jim Meyering
f8245e96cd ls: plug a per-argument leak
Using ls -l on an SELinux-enabled system would leak one SELinux
context string per non-empty-directory command-line argument.
* src/ls.c (free_ent): New function, factored out of...
(clear_files): ...here.  Use it.
(extract_dirs_from_files): Call free_ent (f), rather than simply
free (f->name).  The latter failed to free the possibly-malloc'd
linkname and scontext members, and thus could leak one of those
strings per command-line argument.
* THANKS.in: Update.
* NEWS (Bug fixes): Mention it.
Reported by Juraj Marko in http://bugzilla.redhat.com/751974.
2011-11-12 10:22:55 +01:00
Paul Eggert
91a5badc7b * tests/misc/sort-continue: Port to Fedora 15.
Redirect with the shell command, not in a separate 'exec'.
Without this patch, Fedora 15 x86-64 /bin/sh (i.e., Bash 4.2.10)
complained about running out of file descriptors in the shell.
2011-11-12 00:20:33 -08:00
Paul Eggert
4ea3e6dee1 * tests/ls/block-size: Make it executable. 2011-11-12 00:11:22 -08:00
Paul Eggert
50e5d024ba * src/system.h (emit_size_note): Reword for clarity.
See discussion in Bug#9939.
2011-11-11 23:37:04 -08:00
Paul Eggert
448718c123 ls: -k no longer affects -l's file sizes
This fixes an incompatibility with POSIX 2008 and with BSD.
Problem reported by Abdallah Clark (Bug#9939)
via Alan Curry (Bug#10016).
* NEWS: Document this.
* doc/coreutils.texi (General output formatting): Document the
new -k behavior, and --kibibytes.
* src/ls.c (file_human_output_opts): New static var.
(long_options, usage): Add --kibibytes.
(decode_switches, gobble_file, print_long_format):
Implement the new -k behavior.
* tests/ls/block-size: New file.
* tests/Makefile.am (TESTS): Add it.
2011-11-11 23:21:50 -08:00
Eric Blake
1d9fe527a0 doc: fix typo in sort description
* doc/coreutils.texi (sort invocation): Fix typo.
2011-11-08 12:11:39 -07:00
Jim Meyering
9aac54cdd8 build: update gnulib for more openat changes 2011-11-05 20:57:19 +01:00
Jim Meyering
ee1d9396fc build: do use fstatat and unlinkat modules, now that they're separate
* bootstrap.conf (gnulib_modules): Add fstatat and unlinkat.
2011-11-04 20:44:34 +01:00
Jim Meyering
d973e8a434 build: update gnulib to pull in openat module separation changes
No semantic change.
2011-11-04 19:48:20 +01:00
Pádraig Brady
6603e37c1f tests: avoid signal issues in timeout-group
These issues were seen on an OpenSuse 10.3 system
(kernel 2.6.22.5 x86_64, glibc 2.6.1-18, bash updated to 4.2),
and also on a 64 bit SLES system with a 2.6.16 kernel.
Both systems had 2 CPUs.

There were two issues seen.  1. Occasionally the
timeout.cmd shell script would block SIGINT until
the sleep command exited.  2. Much less frequently the
signal handler in the timeout command itself was ignored,
causing SIGALRM to kill the process.

* tests/misc/timeout-group: Detect the above two cases,
and skip rather than fail.  Note only issue 2. causes
a failure unless skipped, but we skip for case 1. also,
for diagnostic purposes.
2011-11-03 18:36:28 +00:00
Pádraig Brady
aa6448b8d5 tests: fix a race in timeout-group
This could cause a false failure, or even
an infinite loop in rare circumstances.

* tests/misc/timeout-group: Increase the timeouts
passed to the timeout command, so that they're
effectively not used.  Instead the command termination
is triggered by the kill commands when everything
is in the correct state.

Reported by Bernhard Voelker.
2011-11-03 18:36:28 +00:00
Jim Meyering
d84d8764cc build: adapt to gnulib's recent openat/fchmodat separation
* gnulib: Update to latest, pulling in the openat/fchmodat separation.
* bootstrap.conf (gnulib_modules): Add fchmodat, now that gnulib
has moved it into its own module.
2011-11-02 11:58:10 +01:00
Jim Meyering
2b5ef2dd9d maint: fix git-log typos when generating ChangeLog
* gnulib: Update to latest, for new gitlog-to-changelog.
* Makefile.am (gen-ChangeLog): Use its new --amend=F option.
* build-aux/git-log-fix: New file, with ChangeLog fixes.
2011-11-02 09:12:32 +01:00
Jim Meyering
ba4b05c94c stat: avoid compilation failure with gnulib's new alignof
* src/stat.c: Include <stdalign.h>, not "alignof.h" for alignof use.
2011-11-02 09:12:32 +01:00
Jim Meyering
e6ac01c7a1 scripts: reject references to long-form bug URLs
* scripts/git-hooks/commit-msg: Require the normalized/shortened
form of bugzilla.redhat.com and bugs.gnu.org bug URLs.
2011-11-02 08:40:01 +01:00
Pádraig Brady
5128605918 doc: date: mention that the hardware clock might not be set
* doc/coreutils.texi (Setting the time): Reorganize slightly
and mention that the hardware clock might need to be explicitly
updated by the user as is the case on Fedora 16 currently.
See http://bugzilla.redhat.com/749516
2011-11-01 22:02:55 +00:00
Jim Meyering
65527e1c1a build: adapt to gnulib's recent openat/fchownat separation
* bootstrap.conf (gnulib_modules): Add fchownat, now that gnulib
has moved it into its own module.
* gnulib: Update to latest.
2011-11-01 11:49:56 +01:00
Jim Meyering
8ad8306327 build: update gnulib for GNUmakefile fix 2011-10-30 22:38:47 +01:00
Jim Meyering
50424fe2a5 maint: avoid new "make syntax-check" failure due to stdalign definition
* gl/modules/randread (Depends-on): Add stdalign.
* gl/lib/randread.c: Include <stdalign.h>, so we can ...
[!_STRING_ARCH_unaligned]: remove definition of stdalign.
2011-10-30 22:38:47 +01:00
Jim Meyering
53f48c7b0e tests: update gnulib to latest to avoid FP DST-related test failure
Otherwise, "make check" would fail after e.g., a CEST-to-CST
daylight savings transition.
See http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/28825
2011-10-30 18:19:19 +01:00
Jim Meyering
f15673fecb tests: doc: fix stale comment in new rm/many-dir-entries-vs-OOM 2011-10-30 11:51:45 +01:00
Jim Meyering
f013fe07ab tests: don't make tail's pipe-f2 test take the full 10 seconds
* tests/tail-2/pipe-f2: Don't always wait 10 seconds.
Before, this test would always wait 10 seconds.
Now, it stops early when it detects that tail -f has written output.
BTW, the race condition that prompted changing the timeout from 1 second
to 10 was that tail -f could be killed by the timeout before producing
any output.
2011-10-29 08:32:11 +02:00
Jim Meyering
2f1384b7e4 date: reinstate the --iso-8601 (-I) option
We deprecated and undocumented the --iso-8601 (-I) option mostly
because date could not parse that particular format.  Now that
it can, it's time to restore the documentation.
* src/date.c (usage): Document it.
* doc/coreutils.texi (Options for date): Reinstate documentation.
Reported by Hubert Depesz Lubaczewski in http://bugs.gnu.org/7444.
2011-10-27 22:02:26 +02:00
Jim Meyering
e8f703c000 build: avoid bootstrap failure when using patch-2.5.8
* gl/modules/tempname.diff: Regenerate to correct bogus offsets
and adjust for 1-line offset.  Eric Blake reported that this
patch failed to apply when using patch-2.5.8.
Note that it applies fine using patch-2.6.1.
2011-10-27 19:04:45 +02:00
Jim Meyering
22f3b2e960 build: do not remove definition of ENODATA, after all
* src/system.h (ENODATA): Restore definition.
gnulib defines it only on native Windows systems, so removing our
definition would have provoked build failure on systems that use it,
like FreeBSD.  Reported by Bruno Haible in
http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/28739/focus=28795
* gnulib: Update to latest, to get new ENODATA-exempting maint.mk rule.
2011-10-25 12:31:49 +02:00
Eric Blake
5bb6316bd7 doc: NEWS: correct "bug introduced in ..." version number
* NEWS: s/7.0/8.0/
2011-10-24 16:20:34 +02:00
Jim Meyering
f8ae6440eb rm: update gnulib to get an fts fix for Cygwin+NWFS/NcFsd file systems
* NEWS (Bug fixes): Mention it.
As far as we know, this fix affects only Cygwin with NWFS or NcFsd
file systems.  See these:
http://git.sv.gnu.org/cgit/gnulib.git/commit/?id=71f13422f3e634
http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/28739
http://cygwin.com/ml/cygwin/2011-10/msg00365.html
* src/system.h (ENODATA): Remove fall-back definition, now that
gnulib provides one.  Caught by the sc_prohibit_always-defined_macros
syntax-check rule.
Also remove now-irrelevant "Don't use bcopy..." comment.
2011-10-24 10:46:42 +02:00
Jim Meyering
2ade806cf5 maint: add git hook scripts
We find it worthwhile to use consistent commit summary prefixes.
To that end, the commit-msg script requires that all commits I make
start with "$P: " (where $P is one of ~100 programs in coreutils)
or one of a few other words, like gnulib tests maint doc build.
It allows more than one word, so e.g., "cat tail head: " would also
be accepted.  Pádraig Brady wrote the initial version, with its
72-column and blank-if-present second line checks.
The pre-commit script is the same as the git-supplied sample script,
modulo a bug fix and the "exec 1>&2" redirection.
* scripts/git-hooks/commit-msg: New file.
* scripts/git-hooks/pre-commit: New file.
* scripts/git-hooks/applypatch-msg: New file.  Verbatim from .sample.
* cfg.mk: Exempt two of the new scripts from the no-leading-TABs check,
since they're nearly verbatim from git, and we want to stay in sync.
Exempt the commit-msg script from the no-"fail=0" check.
2011-10-23 11:44:40 +02:00
Martial Bornet
d191bfe8a6 tail: with -f, use nanosleep (not inotify) on a GPFS file system
Because tail's fremote function did not designate GPFS as
a remote file system type, tail -f would mistakenly attempt
to use inotify, which cannot work with a remote file system.
* src/tail.c (fremote): List GPFS as a remote file system type.
* NEWS (Bug fixes): Mention it.
Reported in http://bugs.debian.org/646022.
2011-10-21 09:03:30 +02:00
Mike Frysinger
f5b498c09a build: include man-pages for non-default progs
At the moment, things like man/arch.1 are not included in the tarball.
This makes perl a requirement if you want to build/install the arch
helper.

* man/Makefile.am (EXTRA_DIST): Add $(NO_INSTALL_PROGS_DEFAULT:%=%.1).
2011-10-20 16:05:32 +01:00
Jim Meyering
e6fb579f41 maint: tac: prefer "failed to" diagnostic over "cannot"
* src/tac.c: Change wording in diagnostic: "failed to open" seems
clearer than "cannot open".
2011-10-19 09:31:52 +02:00
Jim Meyering
1bb97e2aa1 tac: do not let failed allocation cause immediate exit
* src/tac.c (temp_stream): Don't exit immediately upon failed heap
allocation, here.  That would inhibit processing of any additional
command-line arguments.
2011-10-19 09:31:52 +02:00
Jim Meyering
d96c2069d9 tac: use only one temporary file, with multiple nonseekable inputs
* src/tac.c (temp_stream): New function, factored out of...
(copy_to_temp): ...here.
(tac_nonseekable): Don't free or fclose, now that we reuse the file.
Suggested by Ambrose Feinstein.
* THANKS.in: Update.
2011-10-19 09:31:30 +02:00
Paul Eggert
385634c8dd maint: make tac.c slightly cleaner
* src/tac.c (copy_to_temp): Now that the template string tacXXXXXX
is used in only one place, don't bother using a separate variable.
Also, using three unconditional assignments seems slightly clearer.
2011-10-18 07:43:58 +02:00
Jim Meyering
866844826c tac: don't leak a file descriptor for each non-seekable input
* src/tac.c (tac_nonseekable): Call fclose and free tmp_file after
each successful call to copy_to_temp.
2011-10-17 17:44:54 +02:00
Jim Meyering
537f9da37f tac: don't misbehave with multiple non-seekable inputs
* src/tac.c (copy_to_temp): Do not reuse the template buffer.
Instead, scribble only on a freshly-xstrdup'd copy each time.
Free that buffer both here, upon failure, and ...
(tac_nonseekable): ...free the buffer in caller, upon success.
* tests/misc/tac-2-nonseekable: New file.
* tests/Makefile.am (TESTS): Add it.
* NEWS (Bug fixes): Mention it.
Reported by Ambrose Feinstein in http://debbugs.gnu.org/9762.
2011-10-17 17:44:54 +02:00
Jim Meyering
60cd4c271d maint: tac: remove sole use of sprintf in favor of filenamecat
* src/tac.c: Include filenamecat.h.
(copy_to_temp): Use filenamecat rather than xmalloc and sprintf.
Move some declarations "down" to point of initialization.
2011-10-17 17:44:49 +02:00
Pádraig Brady
ead96f9ede maint: speed up make check (vc_exe_in_TESTS)
* tests/check.mk (vc_exe_in_TESTS): The main change is to
not start a sed process for each file under tests/,
which was taking around 2.5s on a 2.1GHz i3-2310M.
Also adjust the rule to no longer use temporary files.
2011-10-17 11:56:10 +01:00
Jim Meyering
563bb94068 maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2011-10-12 11:57:25 +02:00
Jim Meyering
7b68a43111 version 8.14
* NEWS: Record release date.
2011-10-12 11:45:24 +02:00
Pádraig Brady
2629776078 tests: avoid a false failure on systems without inotify
* tests/tail-2/follow-name: Exclude the inotify warning
from the comparison.
Reported by Bruno Haible.
2011-10-12 10:56:04 +02:00
Jim Meyering
3fb0f4aaf2 build: update gnulib to latest to fix MacOS X 10.5 test link failure
Details here:
http://thread.gmane.org/gmane.comp.gnu.coreutils.general/1726/focus=1743
2011-10-09 19:05:03 +02:00
Jim Meyering
d12ca9764b rm: do not resort to stat'ing very long names even on deficient systems
This change affects only systems that have neither *at function support
nor the /proc/self/fd support required to emulate those *at functions.
* src/remove.c (write_protected_non_symlink): Call faccessat
unconditionally.  Thus we no longer need euidaccess_stat, which was
the sole function used here to operate on a full relative file name.
Remove full_name parameter and update caller.
* lib/euidaccess-stat.h: Remove file.
* lib/euidaccess-stat.c: Likewise.
* m4/euidaccess-stat.m4: Likewise.
* po/POTFILES.in: Remove lib/euidaccess-stat.c.
* m4/prereq.m4 (gl_PREREQ): Don't require gl_EUIDACCESS_STAT.
Prompted by a report from Bruno Haible that the rm/deep-2
test was failing on HP-UX 11.31.
See http://thread.gmane.org/gmane.comp.gnu.coreutils.general/1748
2011-10-09 19:04:35 +02:00
Jim Meyering
c977d5de8d tests: skip rather than failing when perl is not available
* tests/df/total-verify: Use require_perl_, so that this test is
skipped when perl is not available.
* tests/rm/deep-2: Likewise, and fix wording in a comment.
Reported by Bruno Haible.
2011-10-09 10:00:12 +02:00
Jim Meyering
bb1c6912f2 tests: avoid tail-2/F-vs-missing failure on NFS
* tests/tail-2/F-vs-missing: This test would fail about 80% of the
time on linux/powerpc when run in an NFS-mounted directory.
Reported by Bruno Haible in
http://thread.gmane.org/gmane.comp.gnu.coreutils.general/1726/focus=1727
2011-10-08 19:57:21 +02:00
Jim Meyering
11cb50ee6d tests: avoid ls/slink-acl test failure on Solaris 10
* tests/ls/slink-acl: Use setfacl's "-m user::r" option rather than
less-portable "-m m::r".  The latter did not work with Solaris 10's
version of setfacl.  Reported by Bruno Haible in
http://thread.gmane.org/gmane.comp.gnu.coreutils.general/1726/focus=1737
2011-10-08 17:57:01 +02:00
Jim Meyering
fc4c062ffa tests: avoid false-positive failures on linux/sparc64
* tests/init.cfg (require_strace_): Detect a version of strace
that fails on linux/sparc64 for 64-bit executables.  Report and
most of the suggested fix from Bruno Haible:
http://thread.gmane.org/gmane.comp.gnu.coreutils.general/1726/focus=1728
2011-10-08 17:11:10 +02:00
Bernhard Voelker
43a987e179 build: let bootstrap resort to wget for downloading .po files
* bootstrap (download_po_files): Fallback to wget when downloading
the .po files via rsync failed.  This is necessary to bootstrap behind
a strict firewall.
2011-10-06 09:05:26 +02:00
Jim Meyering
e1fc300b59 doc: clean up NEWS
* NEWS: Mention when the sort -g infloop bug was introduced and
alphabetize entries.  Clarify a sentence in the pwd-improvement entry.
2011-10-05 23:26:29 +02:00
Jim Meyering
5f567ce4bd tests: add a test to exercise today's ls-lL-vs-ACL bug
* tests/ls/slink-acl: New file.
* tests/Makefile.am (TESTS): Add it.
* tests/init.cfg (require_setfacl_): New function.
* gnulib: Update to latest, for file-has-acl changes.
* NEWS (Bug fixes): Mention it.
See http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/28538.  This
":>k; setfacl -m m::r k; ln -s k s; ls -Log s" should print e.g.,
    -rw-r-----+ 1 0 Oct  5 19:22 s
With the ls from coreutils-8.13, it would print this (with "." or
nothing in place of the "+"):
    -rw-r-----. 1 0 Oct  5 19:22 s
2011-10-05 23:26:21 +02:00
Jim Meyering
88873501cf build: don't use automake's obsolete AM_C_PROTOTYPES macro
* m4/jm-macros.m4 (gl_CHECK_ALL_TYPES): Remove use of AM_C_PROTOTYPES,
now that automake rejects it.
2011-10-03 11:01:44 +02:00
Jim Meyering
d588c8100c maint: clean up m4 syntax
* m4/jm-macros.m4 (coreutils_MACROS, gl_CHECK_ALL_HEADERS):
Remove unnecessary backslashes and add quotes around multi-line
argument lists.
2011-10-01 19:48:17 +02:00
Markus Duft
07498748d2 build: use getgr*_nomembers functions on Interix
Interix provides faster replacements for getgr{gid,nam,ent} where
group member information is not fetched from domain controllers.
This makes 'id' usable on domain controlled interix boxes.
* m4/jm-macros.m4: Check for _nomembers functions.
* src/system.h: Redefine function to _nomembers when available.
2011-10-01 19:17:26 +02:00
Markus Duft
7289f12588 build: accommodate missing setgroups on Interix
Add a dummy, non-functional, always-successful replacement setgroups
function, to keep the original code untouched and simple.
 * src/chroot.c (setgroups) [! HAVE_SETGROUPS]: Define.
2011-10-01 19:17:21 +02:00
Jim Meyering
e1c589ecd5 build: stop distributing gzip'd releases; xz is enough
* configure.ac (AM_INIT_AUTOMAKE): Add no-dist-gzip.
* NEWS (Build-related): Mention that we're dropping .tar.gz.
2011-10-01 17:50:32 +02:00
Jim Meyering
28460826d3 build: update gnulib submodule to latest 2011-10-01 17:50:32 +02:00
Pádraig Brady
f215f7fe06 doc: mention the recent ls -L "argetm" fix in NEWS
* NEWS: Mention the bug fix
2011-10-01 02:35:32 +01:00
Pádraig Brady
84457c491e ls: fix output of dangling symlinks colored as target
This is related to commit b7f2b51c, 2010-01-01,
"ls: fix color of broken symlinks colored as target"
which didn't handle the --dereference case.
The simplest way to reproduce the resultant
erroneous "argetm" is as follows:

 $ ln -s /no-such dangle
 $ env LS_COLORS=ln=target ls --dereference --color
 ls: cannot access dangle: No such file or directory
 argetmdangle

This is also an issue with the `tree` utility,
reported here: http://bugs.debian.org/586765

* src/ls.c (print_color_indicator): Move the handling
of 'ln=target' in $LS_COLORS (color_symlink_as_referent == true)
to a higher scope, to handle all cases where type == C_LINK.
* tests/misc/ls-misc: Add a test case for the specific issue,
and 2 further test cases to verify other code paths in this area.

Reported by Jason Glassey.
2011-10-01 02:15:12 +01:00
Jim Meyering
4f38e9f249 ls: avoid reading beyond end of color indicator
At first this looked like a buffer overrun, since there was no test
to ensure that the buffer length was 6.  However, since the LS_COLORS
string is NUL-terminated and since settings within it are separated by
":" there was neither the risk of reading beyond end of buffer nor risk
of a false-positive match.
* src/ls.c (print_color_indicator): Use color_symlink_as_referent
rather than manually comparing against "target" again.
* src/system.h (STRNCMP_LIT): Correct description in comment.
2011-09-30 22:03:47 +02:00
Jim Meyering
bec8920923 tests: update gnulib to latest, to fix test link failure 2011-09-28 11:00:13 +02:00
Jim Meyering
57ee5493d9 sort: avoid a NaN-induced infloop
These commands would fail to terminate:
    yes -- -nan | head -156903 | sort -g > /dev/null
    echo nan > F; sort -m -g F F
That can happen with any strtold implementation that includes
uninitialized data in its return value.  The problem arises in the
mergefps function when bubble-sorting the two or more lines, each
from one of the input streams being merged: compare(a,b) returns 64,
yet compare(b,a) also returns a positive value.  With a broken
comparison function like that, the bubble sort never terminates.
Why do the long-double bit strings corresponding to two identical
"nan" strings not compare equal?  Because some parts of the result
are uninitialized and thus depend on the state of the stack.
For more details, see http://bugs.gnu.org/9612.
* src/sort.c (nan_compare): New function.
(general_numcompare): Use it rather than bare memcmp.
Reported by Aaron Denney in http://bugs.debian.org/642557.
* NEWS (Bug fixes): Mention it.
* tests/misc/sort-NaN-infloop: New file.
* tests/Makefile.am (TESTS): Add it.
2011-09-27 16:49:51 +02:00
Jim Meyering
1d0a7ed7d5 build: update gnulib submodule to latest 2011-09-24 13:18:30 +02:00
Jim Meyering
081e262daf maint: avoid new syntax-check failure
Pulling in the latest gnulib triggered a new false-positive
syntax-check failure.
* cfg.mk (exclude_file_name_regexp--sc_prohibit_always-defined_macros):
Exempt remove.c; its definitions of DT_UNKNOWN, DT_DIR and DT_LNK are
harmless.
2011-09-24 13:17:22 +02:00
Bernhard Voelker
eb6f977ff5 tests: mention new check-expensive/check-very-expensive in test logs
* tests/init.cfg: (very_expensive_): Mention toplevel make target,
check-very-expensive.
(expensive_): Likewise for check-expensive.
2011-09-24 13:17:22 +02:00
Bernhard Voelker
57db1fc2a9 tests: introduce make targets check-expensive and check-very-expensive
* Makefile.am: add shortcuts to run (very) expensive tests.
Use "make check-expensive" to run tests with RUN_EXPENSIVE_TESTS=yes,
use "make check-very-expensive" to run tests with both
RUN_EXPENSIVE_TESTS=yes and RUN_VERY_EXPENSIVE_TESTS=yes.
Non-expensive tests are included in all cases.
2011-09-24 13:17:21 +02:00
Pádraig Brady
80a1aca0d2 timeout: handle implicitly created threads
On some systems like glibc on GNU/kFreeBSD, a thread is
implicitly created when timer_settime() is used.
This breaks our scheme to ignore signals we've
sent ourselves.

* src/timeout.c (send_sig): Change the scheme used to
ignore signals we've sent ourselves, to a more robust
but perhaps limited scheme of ignoring all signals of
a certain type after we've sent that signal to the job.
* NEWS: Mention the change in behavior.
2011-09-22 12:01:05 +01:00
Bruno Haible
a4fa14849a tests: init.sh: support any non-GNU diff
* tests/init.sh (compare): If "diff -c" is supported but "diff -u" is
not, use "diff -c".  Useful on AIX 6.1, HP-UX 11.31, OSF/1 5.1,
Solaris 8.
2011-09-19 19:24:46 +02:00
Jim Meyering
9bb92a4db1 gnulib: update for getcwd fix on systems without openat
This fixes a bug in pwd and all getcwd-using applications (for some
uses: df, readlink, stat) when run from a directory whose absolute name
contains more than PATH_MAX / 3 components.  For more details, see
http://git.sv.gnu.org/cgit/gnulib.git/commit/?id=f6fe351fc534ae1
* gnulib: Update.
* NEWS (Improvements): Mention it.
2011-09-19 17:25:43 +02:00
Reuben Thomas
f2fb24809c md5sum: clarify what is meant by binary/text flag.
src/md5sum.c: Clarify that we are talking about input mode.
        doc/coreutils.texi: Ditto.
2011-09-19 10:55:37 +02:00
Jim Meyering
6c93cd4512 tests: cp-parents: don't let a failing chmod go unnoticed
* tests/cp/cp-parents: If somehow a chmod set-up command failed,
subsequent tests would fail in a harder-to-diagnose manner.
2011-09-19 10:53:45 +02:00
Paul Eggert
e92b0dbc13 randread: add FIXME comment for RDRAND
* gl/lib/randread.c: Add a FIXME comment suggesting how to improve
performance by using the RDRAND hardware instruction.
2011-09-17 08:54:26 -07:00
Pádraig Brady
7da844cc86 md5sum: handle BSD reversed format checksums
* src/md5sum.c (split_3): Detect and handle BSD reversed
format checksums.
* tests/misc/md5sum-bsd: Add a new test.
* tests/Makefile.am: Reference new test.
* NEWS: Mention the improvement
Suggested by Rimas Kudelis.
2011-09-16 19:09:26 +01:00
Eric Blake
b98e41cc74 doc: improve description of join's -a option
* src/join.c (usage): Mention that -a adds to the overall output,
rather than replacing the default output.
* THANKS: Update.
Reported by Tomas Volka.
2011-09-14 07:46:09 -06:00
Jim Meyering
3f456c54bb build: avoid unwarranted failure w/gcc-4.6.1 and --enable-gcc-warnings
* configure.ac (gl_GCC_VERSION_IFELSE): Define new macro.
(WERROR_CFLAGS): With --enable-gcc-warnings, use it to
add -Wsuggest-attribute=pure only with gcc 4.7 or newer.
2011-09-12 19:07:00 +02:00
Jim Meyering
82e86b4831 doc: fix typo in test script comment
* tests/d_type-check: Fix typo in comment.
2011-09-08 22:03:17 +02:00
Jim Meyering
1888629627 maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2011-09-08 17:23:21 +02:00
Jim Meyering
c7fca77515 version 8.13
* NEWS: Record release date.
2011-09-08 17:04:42 +02:00
Jim Meyering
032bbff2da build: update gnulib submodule to latest 2011-09-08 15:49:42 +02:00
Jim Meyering
5581bf28e3 stat: avoid compilation failure on AIX 7.x
* src/stat.c (USE_STATVFS): Adjust definition so that it is enabled
also on AIX 7.x systems that provide statvfs64 and no statvfs.
[USE_STATVFS && ! STAT_STATVFS && STAT_STATVFS64] (STATFS): Define
to statvfs64 in that precise case.
* m4/stat-prog.m4 (cu_PREREQ_STAT_PROG): Adjust the condition
here to match the new one in stat.c, to keep them in sync.
Reported by Bruno Haible.  For details, see
http://article.gmane.org/gmane.comp.gnu.coreutils.general/1668
2011-09-08 12:16:17 +02:00
Bernhard Voelker
5eeaca942a tests: adjust PATH to include /sbin for mkfs-using tests
* tests/init.cfg (require_mkfs_PATH_): New function to test whether mkfs
is in PATH, otherwise adding /sbin to PATH.  Needed for distributions
(OpenSuSE, Solaris) in which sudo does not include /sbin in PATH.
* tests/cp/cp-a-selinux: Use require_mkfs_PATH_.
* tests/cp/cp-mv-enotsup-xattr: Likewise.
* tests/cp/sparse-fiemap: Likewise.
* tests/mkdir/writable-under-readonly: Likewise.
* tests/rm/read-only: Likewise.
2011-09-07 18:00:55 +02:00
Jim Meyering
f85ca2c876 tests: avoid false-positive "make check" failure when perl is missing
* doc/Makefile.am (sc-lower-case-var): Skip this test when $(PERL)
is not usable.  Reported by Bruno Haible.
2011-09-07 18:00:55 +02:00
Jim Meyering
ac5739d317 cp: update gnulib to get support for NFSv4 ACLs
* NEWS (Improvements): Mention the cp-vs-NFSv4-ACL improvement we
have inherited via gnulib.  For details, see
http://article.gmane.org/gmane.comp.lib.gnulib.bugs/28100
and the following messages in that thread.
* gnulib: Update to latest, for numerous ACL-related improvements.
2011-09-07 17:59:46 +02:00
Bruno Haible
0cefe58092 tests: init.sh: work also with any non-GNU diff that supports -u
* tests/init.sh: Relax check for diff -u support.
Rather than checking for GNU diff via --version, simply check
for support for -u itself.  Useful at least on OpenBSD 4.9.
2011-09-02 14:08:40 +02:00
Jim Meyering
7490145dd0 tests: remove require-perl script; use function instead
* tests/require-perl: Remove file.
* tests/Makefile.am (EXTRA_DIST): Remove it from this list.
* tests/init.cfg (require_perl_): New function.
* tests/misc/pwd-long: Use the new function, not the file.
* tests/ls/nameless-uid: Likewise.
* tests/misc/sum-sysv: Likewise.
2011-09-02 14:08:40 +02:00
Jim Meyering
d8945c8d8f tests: cut: exercise distro-added multibyte code paths
* tests/misc/cut: Repeat each test using a multibyte locale,
if the configure-time test found such a locale.
Adjust the tests so that they also accept a slightly
different diagnostic that is specific to the MB-patched cut.
2011-09-02 14:08:40 +02:00
Pádraig Brady
832c85e3f7 doc: describe test control variables
* HACKING (Add tests): Mention the variables and default values.
* README-release (Pre-release testing): Mention that setting
the SHELL variable may be required.
Suggested by Bruno Haible.
2011-09-02 11:41:23 +01:00
Pádraig Brady
3d2e55d508 timeout: fixup previous warning fix
* src/timeout.c (settimeout): Fix the previous commit
to test errno rather than the return value.
2011-09-01 15:50:08 +01:00
Pádraig Brady
37784220dd tests: split/l-chunk: avoid a portability issue
* tests/split/l-chunk: Don't use the `test "$var"`
idiom to test that var is set to something as
that's not supported by all shells.
The new style matches the usage is the rest of
the test in any case.
Reported by Bruno Haible on AIX 6.1 and 7.1
2011-09-01 15:43:25 +01:00
Jim Meyering
551cbda027 tests: pwd-long: diagnose failure earlier
Without this change, we'd get use-of-uninit value warnings
and harder-to-diagnose failure down the road.
* tests/misc/pwd-long (normalize_to_cwd_relative): Diagnose stat
failure.  This failed on AIX 6.1 and 7.1.  Reported by Bruno Haible.
2011-09-01 16:36:23 +02:00
Jim Meyering
af5f2d741b tests: printf-surprise: avoid false-positive failure
* tests/misc/printf-surprise: Also accept a strerror-style string
after the usual 'printf: write error:' diagnostic prefix.
Otherwise, this test would fail on HP-UX 11.
Reported by Bruno Haible.
2011-09-01 16:36:23 +02:00
Bernhard Voelker
44f7444987 tests: improve message in 'require_membership_in_two_groups_' function
* tests/init.cfg (require_membership_in_two_groups_): Add quotes
around the suggested groups for the COREUTILS_GROUPS variable.
2011-09-01 16:36:23 +02:00
Jim Meyering
ac54e1e4d2 tests: misc/printf: accommodate alternate behavior
* tests/misc/printf: Avoid false positive failure on MacOS X 10.5
due to a slightly differing diagnostic.  Reported by Bruno Haible.
2011-09-01 16:36:23 +02:00
Jim Meyering
a8c7983629 tests: invoke via "env printf", rather than using an absolute name
* tests/misc/printf: This results in more concise diagnostics.
2011-09-01 16:36:23 +02:00
Pádraig Brady
38e3a90e4b timeout: suppress a redundant warning on some systems
* src/timeout.c (settimeout): Don't warn about ENOSYS
which is returned on OpenBSD 4.9 at least.
Reported by Bruno Haible
2011-09-01 15:30:18 +01:00
Pádraig Brady
197cd0994d stdbuf: fix helper lib identification on some platforms
* src/stdbuf.c (main): Pass the path of `stdbuf` rather than
the command it's running to the search function.  This is
significant on platforms without /proc/self/exe
Reported by Bruno Haible
2011-09-01 15:27:58 +01:00
Pádraig Brady
0d89a42bff build: avoid the use of strsignal() in split
... which is not available on some platforms,
and the replacement currently requires linking
with threading libraries.
* src/split.c (closeout): Remove the call to strsignal()
which is largely redundant anyway as sig2str()
is already used to map number to name in the error.
Reported by Bruno Haible on AIX 6.1 and 7.1
2011-09-01 15:20:55 +01:00
Jim Meyering
df9cd0a426 date: support parsing of ISO-8601-with-"T" dates
Thanks to an improvement in gnulib's parse-datetime module,
commands like this now succeed (output manually indented):
    $ ./date -u -d 2004-02-29T16:21:42.33+07:00 +%FT%T.%N%z
		   2004-02-29T09:21:42.330000000+0000
* tests/misc/date: Add a test to exercise the new-in-gnulib
parsing of ISO8601-with-"T" dates.
* NEWS (New features): Mention it.
* gnulib: Update, to pull in this parse-datetime improvement.
2011-08-31 20:00:19 +02:00
Pádraig Brady
683ee76ad2 build: heap.c: make possible gnulib candidate c89 compatible
* gl/lib/heap.c: Move declaration to the top of scope.
Reported by Rob McMahon and Wolfgang Steinwender
in relation to "Sun WorkShop 6 update 2 C 5.3 Patch 111679-12
2003/05/18" and "GCC 2.95.3" respectively.
2011-08-30 15:09:23 +01:00
Pádraig Brady
24a1a8c473 timeout: revert signal propagation enhancement
This effectively reverts the unreleased commit 5a647a05

* src/timeout.c (main): Don't propagate signals from the monitored
process, as on Linux /proc/sys/kernel/core_pattern could still
handle them and cause false reports against `timeout`
2011-08-25 11:35:31 +01:00
Jim Meyering
6a2751d59d maint: rename a test
Lesson: do not include details like "4 million" in a file name.
* tests/rm/many-dir-entries-vs-OOM: Renamed from ...
* tests/rm/4-million-entry-dir: ...this.
* tests/Makefile.am (TESTS): Reflect renaming.
2011-08-24 10:50:28 +02:00
Jim Meyering
ebc63d33ea tests: adjust the new, very expensive rm test to be less expensive
* tests/rm/4-million-entry-dir: Create only 200,000 files, rather
than 4 million.  The latter was overkill, and was too likely to
fail due to inode exhaustion.  Not everyone is using btrfs yet.
Now that this test doesn't take so long, label it as merely
"expensive", rather than "very expensive".  Thanks to
Bernhard Voelker for pointing out the risk of inode exhaustion.
2011-08-24 10:50:15 +02:00
Pádraig Brady
1f93c96339 pr: fix so that LAST_PAGE is honored with -T
Ever since the LAST_PAGE functionality was added
in commit ed0923a1, 1996-12-05,
"Apply big patch (patch-20) from Roland Huebner"
it was ignored when -t or -T were specified or
when -l <= 10.

* src/pr.c (print_page): Increment the current page here.
(print_header): Don't increment the current page here.
* tests/pr/pr-tests: Add a test case.
* NEWS: Mention the fix

Reported at http://debbugs.gnu.org/cgi/bugreport.cgi?bug=9347
2011-08-24 00:21:17 +01:00
Erik Auerswald
423b079f53 doc: correct typo in yesterday's NEWS entry: 30GB -> 30MB
* NEWS: s/30GB/30MB/
2011-08-20 08:12:31 +02:00
Jim Meyering
0ba576979a rm, du, chmod, chown, chgrp: use much less memory for large directories
For details, see the gnulib commit,
http://git.sv.gnu.org/cgit/gnulib.git/commit/?id=47cb657e
* tests/rm/4-million-entry-dir: New test.
* tests/Makefile.am (TESTS): Add it.
* NEWS (Bug fixes): Mention it.
* gnulib: Update to latest to get the required fts fixes.
2011-08-19 18:21:06 +02:00
Bernhard Voelker
036a9c6909 maint: remove empty statement after jump label
* src/head.c (elide_tail_bytes_pipe): Remove the empty statement, ";"
after a jump label; it is needed only when a declaration follows.
* src/kill.c (main): Likewise.
* src/od.c (main): Likewise.
* src/paste.c (collapse_escapes): Likewise.
* src/printf.c (print_formatted): Likewise.
2011-08-13 11:21:01 +02:00
Paul Eggert
faf5fbeb36 pathchk: port to hosts where mbstate_t is replaced
This problem was discovered when trying to build git coreutils on
Solaris 8 sparcv9 with Sun C 5.8: the 3rd argument to mbrlen was
of type int * (a pointer to the gnulib replacement mbstate_t) but
the system mbrlen wants the system mbstate_t *.
* bootstrap.conf (gnulib_modules): Add mbrlen.
* src/pathchk.c (mbrlen, mbstate_t) [!(HAVE_MBRLEN && HAVE_MBSTATE_T)]:
Remove macros, which are wrong now that gnulib supplies
replacements for mbstate_t and mbrlen.
2011-08-12 01:15:37 -07:00
Paul Eggert
4a1527908b bootstrap: use latest gnulib bootstrap, gettext
* bootstrap: Sync from gnulib.  This removes an obsolescent
gettext.m4 patch, along with some other changes that do not
seem to affect coreutils.
* bootstrap.conf (gnulib_modules): Use gettext, not gettext-h.
Current gnulib gettext seems to work without needing special hacking.
* configure.ac (AM_GNU_GETTEXT_VERSION): Now 0.18.1, not 0.17.
* gnulib: Update to latest.
2011-08-11 18:38:19 -07:00
Jim Meyering
dce1da2b57 maint: use gnulib's new largefile modulue
* bootstrap.conf (gnulib_modules): Add largefile.
This is useful to Mac OS X 10.5 users if/when configure
is generated using autoconf prior to v2.68-80-gdb2f2e0.
* gnulib: Update to latest.
2011-08-11 15:27:21 +02:00
Jim Meyering
4cf9eb5282 tests: avoid lack-of-support du test failure on HP-UX 11.31
* tests/du/inaccessible-cwd: Skip this test on systems like HP-UX 11.31
that lack both the *at functions and the /proc/self/fd-based support
we might have used to emulate them.  Reported by Bruno Haible in
http://debbugs.gnu.org/8846
2011-08-08 10:12:38 +02:00
Jim Meyering
7055579067 join: with --check-order print offending file name, line number and data
* src/join (g_names): New global (was main's "names").
(main): Update all uses of "names".
(line_no[2]): New globals.
(get_line): Increment after reading each line.
(check_order): Print the standard "file name:line_no: " prefix
as well as the offending line when reporting disorder.
Here is a sample old/new comparison:
  -join: file 1 is not in sorted order
  +join: in:4: is not sorted: contents-of-line-4
* tests/misc/join: Change the two affected tests to expect
the new diagnostic.
Add new tests for more coverage: mismatch in file 2,
two diagnostics, zero-length out-of-order line.
* NEWS (Improvements): Mention it.
Suggested by David Gast in http://debbugs.gnu.org/9236
2011-08-08 10:12:38 +02:00
Jim Meyering
005534907c maint: use xcalloc rather than xmalloc+memset (no semantic change)
* src/join.c (init_linep): Use xcalloc, not xmalloc+memset.
2011-08-08 10:12:38 +02:00
Jim Meyering
149499925e maint: add copyright notice to init.cfg
* tests/init.cfg: Add copyright.  Suggested by Stefano Lattarini.
2011-08-08 10:11:48 +02:00
Jim Meyering
0b27edfe1d maint: prevent accidental future use of the old shell function name
This is especially important for an error-handling shell function
like this that is actually called only rarely.
* cfg.mk (sc_prohibit_framework_failure): New rule, to prevent
use of the old name.
2011-08-08 10:11:48 +02:00
Stefano Lattarini
554caaf6ff tests: complete the renaming framework_failure -> framework_failure_
These changes were mostly mechanical, made by running the
following command:

  git grep -lw framework_failure | grep -v ChangeLog \
    | xargs perl -pi -e 's/\b(framework_failure)\b/${1}_/'

and then editing init.cfg and `tests/cp/cp-a-selinux' by hand.

* tests/init.cfg (framework_failure): Remove, `framework_failure_'
from init.sh should be used instead in the tests.
Remove now-obsolete "FIXME" comment.
(is_local_dir_, require_strace_, require_membership_in_two_groups_,
require_sparse_support_, skip_if_mcstransd_is_running_,
mkfifo_or_skip_) Use `framework_failure_', not `framework_failure'.
* Many test scripts: Likewise.
2011-08-08 10:11:48 +02:00
Paul Eggert
8e2767a3f0 mktemp: stir in enough entropy (Bug#6683)
* gl/lib/tempname.c.diff (gen_tempname_len):
Use x_suffix_len bytes' worth of entropy, not 8 bytes.
2011-08-08 00:30:55 -07:00
Stefano Lattarini
bbcf3abc2c tests: remove obsolete 'error_' shell function
* tests/init.cfg (framework_failure, getlimits_): Use 'fatal_'
instead of 'error_'.
(error_): Delete, it's not used anymore (and one is anyway
advised to use 'fatal_' instead).
Update heading comments.
* tests/shell-or-perl (error_): Renamed ...
(fatal_): ... to this, for consistency.  Also, add a useful
comment.
2011-08-04 18:07:52 +02:00
Pádraig Brady
7eaff0fea3 doc: mention the new mirroring behavior of cp -au
* NEWS: Mention the change in behavior.
* doc/coreutils.texi (cp invocation): Likewise.
2011-07-31 13:08:47 +01:00
Jim Meyering
e24c711cbc maint: accommodate old-NEWS update
* cfg.mk (old_NEWS_hash): Update, to accommodate 6.12 addition.
Without this change, "make syntax-check" would fail.
2011-07-31 11:23:58 +02:00
Paul Eggert
c88f6f22c7 * NEWS: Say that 6.12 preserved ns-resolution timestamps. 2011-07-31 00:27:38 -07:00
Jim Meyering
e9ced81139 build: require gnulib's fclose module
* bootstrap.conf (gnulib_modules): Explicitly use the fclose module.
This is required, now that gnulib's close module no longer depends
on fclose.  Without this module, we would be exposed to fclose bugs
affecting at least glibc 2.13 and FreeBSD.
Reported by Bernhard Voelker.  Suggested by Eric Blake.
2011-07-29 15:23:02 +02:00
Jim Meyering
0be1ae6620 build: update gnulib, for "make syntax-check" fix
Without the recent maint.mk fix, "make syntax-check"
would fail like this:

    src/dd.c:# define SA_RESETHAND 0
    src/ls.c:# define SA_RESTART 0
    src/timeout.c:# define SA_RESTART 0
    maint.mk: define the above via some gnulib .h file
    make: *** [sc_prohibit_always-defined_macros] Error 1
2011-07-29 08:07:30 +02:00
Ivan Sichmann Freitas
6ab90b53f6 doc: add a vim indentation example
HACKING: add a vim example showing how to configure it to follow GNU
indentation in coreutils source files.
2011-07-27 13:51:15 +01:00
Pádraig Brady
42300faaa9 maint: copy: refactor hard link creation
* src/copy.c (create_hard_link): A new function refactored
from existing code.
(copy_internal): Call the new function from all 3 locations
that create hard links.
* tests/cp/same-file: Amend to match the adjusted diagnostic.
2011-07-27 13:32:32 +01:00
Pádraig Brady
2aea1828a1 tests: cp/preserve-link: test all relevant paths
* tests/cp/preserve-link: Add test cases for when a missing
link in the destination tree is encountered first and second.
Also add cases for old and new separate files in the destination
tree, both to make the clobbering behavior explicit, and to
test any changes in this area in future.
2011-07-27 09:36:59 +01:00
Jim Meyering
b2bb19b4b3 doc: mention cp's dir-permissions fix
* NEWS (Bug fixes): Mention yesterday's dir-permissions fix.
2011-07-26 09:24:31 +02:00
Jim Meyering
5f35396395 maint: use consistent style in C and test scripts
* src/copy.c (copy_internal): Adjust formatting style to conform with
guidelines in HACKING: put braces around two one-line "else" blocks.
* tests/cp/existing-perm-dir: Use $(...), not `...`, and
stat rather than ls+cut to get the mode string.
mode=$(stat --p=%A dst/dir)
2011-07-26 09:01:44 +02:00
Paul Eggert
e772bddde8 cp: don't mishandle existing dir dest permissions (Bug#9170)
* src/copy.c (copy_internal): If we don't create the directory,
then we cannot have omitted permissions.  Problem and trivial
fix reported by Eric Lammerts.
* tests/Makefile.am (TESTS): Add cp/existing-perm-dir.
* tests/cp/existing-perm-dir: New file.
2011-07-25 14:04:51 -07:00
Jim Meyering
f28a09810b cp -up: preserve all hard links
* src/copy.c (copy_internal): With --update (-u), this function would
return early once it found that the destination is not older than the
source, *without* recording the source-dev/ino--to--dest_name mapping.
That mapping is required in order to preserve src hard links in the
destination tree, so when using cp with --update and --preserve=links
(perhaps via -p or -a), cp could fail to preserve one hard link
per inode when at least one of the hard-linked names already exists
in the destination tree.
Reported by Odd Harry Mannsverk in http://debbugs.gnu.org/8419.
* tests/cp/preserve-link: New file.  Exercise the flaw/fix.
* tests/Makefile.am (TESTS): Add it.
* NEWS (Bug fixes): Mention it.
2011-07-25 14:15:44 +02:00
Pádraig Brady
aeb5222a6d timeout: support sub-second timeouts
* src/timeout.c (settimeout): A new function to convert
from a floating point duration and call alarm() or
timer_settime() if that's available.
(parse_duration): Return a double rather than unsigned int.
(usage): Mention floating point is supported.
(main): Pass the double to settimeout() rather than
calling alarm() directly with the parsed int.
(cleanup): Likewise.
* doc/coreutils.texi (timeout invocation): Say floating point timeouts
now supported, and mention the caveat with resolution.
* bootstrap.conf: Include the timer-time gnulib module.
* tests/misc/timeout-parameters: Add a test with nanoseconds.
* NEWS: Mention the improvement.
2011-07-25 12:00:26 +01:00
Jim Meyering
42c4ba6ceb build: update gnulib to fix a build warning/error in a test program 2011-07-25 08:26:21 +02:00
Jim Meyering
c29cb31b7f df: support partitions larger than 4 TiB on MacOS >= 10.5 & AIX >=5.2
This change derives from improvements to gnulib's fsusage module.
* NEWS (Improvements): df now supports disk partitions larger than
4 TiB on MacOS X 10.5 or newer and on AIX 5.2 or newer.
Alphabetize entries.
* gnulib: Update to latest.
2011-07-24 22:58:36 +02:00
Paul Eggert
339613b6bd dd, shred: use fdatasync only if declared
* m4/jm-macros.m4 (coreutils_MACROS): Use fdatasync only if declared.
MacOS X 10.7 has an fdatasync that is not declared, and is rumored to
be ineffective.  (Bug#9141)
2011-07-22 13:41:19 -07:00
Mike Frysinger
f603b2d228 dircolors: add screen.Eterm terminal type
* src/dircolors.hin: Add screen.Eterm.
Reported by Kfir Lavi
2011-07-20 14:14:25 +01:00
Pádraig Brady
f3b473c579 maint: remove a redundant call to gl_CLOCK_TIME
* m4/jm-macros.m4: Remove gl_CLOCK_TIME as it's already
done by the gettime gnulib module.
2011-07-20 11:38:50 +01:00
Pádraig Brady
65a0483fb5 unexpand: fix misalignment when spaces span a tabstop
The following dropped the space from the first field
  printf "1234567  \t1\n" | unexpand -a
Note POSIX says that spaces should not precede tabs.
Also a single trailing space should not be converted
if the next field starts with non blank characters.
So we enforce those rules too, with this change.

* src/unexpand.c (unexpand): Implement as per POSIX rules.
* tests/misc/unexpand: Add tests, and adjust existing
tests as per POSIX rules.
* NEWS: Mention the fix.
Reported by Hallvard B Furuseth
2011-07-20 10:38:46 +01:00
Paul Eggert
dc7284ef72 * NEWS: Mention fix for Bug#9098. 2011-07-17 12:52:55 -07:00
Paul Eggert
7e576fc403 timeout: add regression test (Bug#9098)
* tests/misc/timeout: Check that 'timeout' is not confused when
starting off with a child.
2011-07-17 12:52:55 -07:00
Paul Eggert
240a633756 timeout: treat seconds counts like 'sleep' does
Treat fractions as a request to round up to the next representable
value, and treat out-of-range values as maximal ones.  This is
consistent with how "sleep" works.  And this way, "timeout
999999999999999999d FOO" and "timeout 4.5 foo" are more likely to
do what the user wants.
* src/timeout.c: Include c-strtod.h and xstrtod.h, not xstrtol.h.
(apply_time_suffix): Change it to the way sleep.c's time_suffix
does things.  Maybe this function (identical in both programs,
other than its name) should be moved to a library?
(parse_duration): Return a maximal value on overflow.  Return
unsigned int, not unsigned long.  Allow fractions, which round
up to the next integer value.
* tests/misc/timeout-parameters: Adjust tests to match new behavior.
Add a very large number.
2011-07-16 12:10:45 -07:00
Paul Eggert
2d9b49789f Fix capiTalization in comments. 2011-07-16 12:10:45 -07:00
Paul Eggert
8f1629f0ad * src/timeout.c (main): Use waitpid, not wait (Bug#9098).
Reported by Andreas Schwab.

* src/timeout.c (SA_RESTART): Define to 0 if not defined.
2011-07-16 12:10:45 -07:00
Paul Eggert
8d8f5f1028 timeout: port to NonStop (Bug#9077)
* src/timeout.c (SA_RESTART): Define to	0 if not defined.
(main): Don't assume signal handling uses SA_RESTART.
2011-07-16 12:10:44 -07:00
Paul Eggert
84185eda59 ls: port to NonStop (Bug#9076)
* src/ls.c (SA_RESTART): Define to 0 if not defined.
2011-07-16 12:10:44 -07:00
Paul Eggert
efec1600c9 dd: port to NonStop (Bug#9076)
* src/dd.c (SA_RESETHAND): Define to 0 if not defined.
2011-07-16 12:10:44 -07:00
Paul Eggert
837e1f5519 csplit: don't prematurely terminate cleanup (Bug#9076)
* src/csplit.c (interrupt_handler): Reset signal to SIG_DFL
after deleting the files, so that a second interrupt won't
prematurely terminate cleanup.
(main): Don't use SA_NODEFER | SA_RESETHAND, as that might
allow premature termination of cleanup.  Also, this ports better
to platforms like NonStop, which don't ahve SA_RESETHAND.
2011-07-15 16:03:57 -07:00
Paul Eggert
750fadd5d3 * src/dd.c: Remove obsolete comments re POSIX. 2011-07-15 15:56:34 -07:00
Pádraig Brady
63613d4935 build: avoid a st_blksize compile failure on some systems
* src/stat.c (print_stat): Use ST_BLKSIZE() rather than
accessing st_blksize directly, which is not present on
NonStop at least.  Reported by Joachim Schmitz.
2011-07-15 16:23:28 +01:00
Pádraig Brady
4f71710c42 build: avoid a fiemap compile failure on some systems
* src/fiemap.h (struct fiemap): Adjust the previous change
to the fiemap_extents array, which would also require changes
to the sizeof calculations in extent_scan_read().
Instead, only declare the fiemap_extents zero length array
on linux, which is the only platform that references this member.
This avoids a compilation failure on systems that don't support
this non standard construct.  We don't use the equivalent C99
flexible array construct so as to have maximum portability.
* src/extent-scan.c: Cleanup. Remove a redundant #ifndef.
2011-07-15 10:55:04 +01:00
Paul Eggert
feb0b08c0d * src/fiemap.h (struct fiemap.fm_extents): Change size to 1.
This is for portability to non-GCC C89 and C99 compilers.
Original problem, on NonStop, reported by Joachim Schmitz in
<http://debbugs.gnu.org/cgi/bugreport.cgi?bug=9077>.
2011-07-14 22:08:04 -07:00
Bernhard Voelker
be6120b5cc maint: fix warning 'possible use of "=" where "==" was intended'
* src/mktemp.c: maint: avoid warning by using the comma operator
rather than an always-true conditional (as suggested by Eric Blake).
Reported by Joachim Schmitz in http://debbugs.gnu.org/9064.
2011-07-14 11:56:23 +01:00
Benoît Knecht
acdf4e99e6 doc: describe the file permissions set by mktemp
* src/mktemp.c (usage): As above, for --help.
Reported by Jordi Pujol in http://bugs.debian.org/551093.
Wording improvments from Eric Blake.
2011-07-13 15:12:28 +01:00
Benoît Knecht
2c558fd0d3 doc: note the order in which wc counts are printed
This information has already been added to the Texinfo manual, but was
missing from the --help output.

* src/wc.c (usage): As above, for --help.
Reported by Vincent Lefevre in http://bugs.debian.org/395430.
2011-07-13 10:16:03 +01:00
Jim Meyering
7700751c5f build: update gnulib submodule to latest 2011-07-12 15:40:53 +02:00
Eric Blake
bf0771a1c5 build: list makeinfo 4.13 as a build-from-git requirement
* bootstrap.conf (buildreq): List 4.13 as minimum makeinfo version.
Prompted by Joachim Schmitz's report in http://debbugs.gnu.org/9050.
2011-07-12 15:40:45 +02:00
Benoît Knecht
6cafe09c33 dircolors: highlight .webm multimedia files
* src/dircolors.hin: Add .webm multimedia files.
Suggested by Josh Triplett in http://bugs.debian.org/582403.
2011-07-11 10:13:29 +02:00
Jim Meyering
f8f1c8111e maint: add syntax-check rule to prohibit "."-terminated "SEE ALSO"
* cfg.mk (sc_prohibit_man_see_also_period): Prohibit a period at
the end of the first line after a "SEE ALSO" marker in man/*.x.
With this, we shouldn't have to make any more changes like those
in today's commit, f2dabd68.
2011-07-08 21:55:00 +02:00
Pádraig Brady
af1ffdff17 doc: list all new file system types recognized by stat -f
NEWS (Improvements): Mention the MQUEUE and PSTOREFS
file systems, recognized as of commit 171e1b98.
2011-07-08 16:01:27 +01:00
Benoît Knecht
f2dabd6806 doc: don't terminate SEE ALSO sections with a period
man-pages(7) explicitly says about SEE ALSO sections: "Do not terminate
this with a period." This is also in line with all the other man pages
in coreutils.

* man/cat.x: Remove period at the end of the SEE ALSO section.
* man/tac.x: Likewise.
2011-07-08 15:28:16 +01:00
Pádraig Brady
5a647a05e2 timeout: handle signals more transparently
* m4/jm-macros.m4: Define HAVE_SETRLIMIT.
* src/timeout.c: If the child exited with a signal,
raise that signal to the timeout process itself,
so that callers may also see the signal status.
Use setrlimit to disable core dumps for the timeout
process, which would be generated by some signals.
2011-07-08 15:11:27 +01:00
Pádraig Brady
4d90d29899 timeout: support cascaded timeouts
* src/timeout.c (cleanup): Send signals directly to the child
in case it has started its own process group (like a cascaded
timeout command would for example).
* test/misc/timeout-group: Add a test case.
* NEWS: Mention the fix.
2011-07-08 13:54:08 +01:00
Pádraig Brady
4496c94091 timeout: add --foreground to support interactive commands
Or more accurately, commands not started from the shell prompt,
that are interactive, or need to receive Ctrl-C etc. from the terminal.

* doc/coreutils.texi (timeout invocation): Document --foreground.
* src/timeout.c (main): Set the foreground flag and don't create
a separate group.
(cleanup): Only send a signal directly to the monitored command
when the foreground flag is set.
(usage): Describe --foreground.
* tests/misc/timeout-group: Add a new test.
* tests/Makefile.am: Reference new test.
NEWS: Mention the new option.

Reported by Shay Shimony
Analysis by Alan Curry
Fix suggested by Paul Eggert
2011-07-08 11:23:08 +01:00
Benoît Knecht
28a7fb52bc doc: note that cp -l creates _hard_ links
This fact was already noted in the Texinfo manual, but not in the
output of --help.
* src/cp.c (usage): As above, for --help.
Reported by Jari Aalto in http://bugs.debian.org/294327.
2011-07-08 12:15:00 +02:00
Jim Meyering
b358f1f2a3 tests: exercise md5sum's new --strict option
* tests/misc/md5sum: Exercise new --strict option.
2011-07-07 16:42:47 +02:00
Patrick Schoenfeld
33171d049a md5sum, sha1sum, etc: accept new option: --strict
Use this new option with --check when the input is expected to
consist solely of checksum lines.  With only --check, an invalid
line evokes a warning, but the program can still exit successfully.
With --strict, any invalid line makes the program exit non-zero.

* src/md5sum.c (strict, STRICT_OPTION): Declare/define.
(long_options): Add "strict".
(usage): Describe --strict.
(digest_check): Count improperly_formatted lines, too, and use
that number and the global "strict" to determine the return value.
(main): Handle STRICT_OPTION.
Reject --strict without --check.
* doc/coreutils.texi: Describe it.
* NEWS (New features): Mention it.
2011-07-07 16:42:47 +02:00
Benoît Knecht
88bdce982a doc: note date's %k, %l are space-padded and equivalent to %_H and %_I
* src/date.c (usage): As above, for --help.
* doc/coreutils.texi (Time conversion specifiers): Likewise.
Reported by Britton Leo Kerin in http://bugs.debian.org/115833.
2011-07-07 14:01:50 +02:00
Jim Meyering
473b4fc1e8 stat: recognize GPFS as a file system type
* src/stat.c (human_fstype) [S_MAGIC_GPFS]: Add a case,
to handle GPFS_SUPER_MAGIC/0x47504653.  Prompted by this discussion:
http://thread.gmane.org/gmane.comp.sysutils.autoconf.general/14007
* NEWS (Improvements): Mention it.
2011-07-07 13:58:22 +02:00
Jim Meyering
84d048002e maint: use "const" and "pure" function attributes where possible
* configure.ac (WARN_CFLAGS): Add -Wsuggest-attribute=const,
-Wsuggest-attribute=pure and -Wsuggest-attribute=noreturn.
(GNULIB_WARN_CFLAGS): But do not add them here... yet.
* src/chown-core.h (chopt_free, uid_to_name): Add function attribute(s).
* src/copy.c (is_ancestor, valid_options): Likewise.
* src/copy.h (chown_failure_ok): Likewise.
* src/dd.c (operand_matches, operand_is): Likewise.
* src/df.c (selected_fstype, excluded_fstype): Likewise.
* src/expr.c (null looks_like_integer): Likewise.
* src/md5sum.c (hex_digits): Likewise.
* src/od.c (get_lcm): Likewise.
* src/pathchk.c (component_start, component_len): Likewise.
* src/pinky.c (count_ampersands): Likewise.
* src/pr.c (cols_ready_to_print): Likewise.
* src/ptx.c (search_table): Likewise.
* src/sort.c (find_unit_order): Likewise.
* src/stty.c (mode_type_flag, string_to_baud, baud_to_value): Likewise.
* src/system.h (gcd, lcm): Likewise.
* src/tr.c (is_char_class_member, look_up_char_class): Likewise.
(star_digits_closebracket): Likewise.
* src/uniq.c (find_field): Likewise.
* src/wc.c (compute_number_width): Likewise.
* lib/xfts.h (cycle_warning_required): Likewise.
* gl/lib/randint.h (randint_get_source): Likewise.
* gl/lib/randperm.c (ceil_lg): Likewise.
* gl/lib/randperm.h (randperm_bound): Likewise.
* lib/strnumcmp.h (strintcmp): Likewise.
2011-07-02 12:35:06 +02:00
Jim Meyering
76d8e9abe1 buffer_lcm: declare with _GL_ATTRIBUTE_CONST
* lib/buffer-lcm.h (buffer_lcm): Use _GL_ATTRIBUTE_CONST.
* lib/buffer-lcm.c: Include <config.h>.
2011-07-02 12:35:06 +02:00
Pádraig Brady
e7734b4a66 doc: detail the effect of disabling input buffering with stdbuf
* docs/coreutils.texi (stdbuf invocation): Expand on the different
reasons for disabling buffering on input and output.
2011-07-01 22:47:54 +01:00
Bruno Haible
0c87ba4693 doc: mention the restrictions for stdbuf more prominently
* doc/coreutils.texi (stdbuf invocation): List the contraints
on the command being controlled, up front.
2011-07-01 22:44:19 +01:00
Jim Meyering
10ec91d84a doc: improve ls --help grammar
* src/ls.c (usage): Improve grammar.
Reported by Peng Yu.
2011-06-25 14:54:49 +02:00
Jim Meyering
18839ad9c1 doc: clarify an improvement from coreutils-7.0
* NEWS (7.0 Improvements): Mention the command: "ls -1U".
* cfg.mk (old_NEWS_hash): Update.
2011-06-25 07:59:13 +02:00
Jim Meyering
54cbe6e643 maint: don't use gnulib's pathmax module; define PATH_MAX if needed
* bootstrap.conf (gnulib_modules): Remove pathmax.
* src/system.h: Don't include "pathmax.h".
(PATH_MAX) [!PATH_MAX]: Define to 8192.  Defining it to a constant
is preferable to using a definition from pathmax.h that might expand
to pathconf ("/", _PC_PATH_MAX). Prompted by discussion leading to:
http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/27183/focus=27269
2011-06-25 07:59:13 +02:00
Jim Meyering
5f4a1cda67 build: bootstrap: remove obsolete gettext-related file exclusions
* bootstrap.conf: Don't bother to exclude gettext/intl-related
.m4 files.  That exclusion is no longer necessary.
2011-06-25 07:59:13 +02:00
Pádraig Brady
171e1b9815 stat: recognize MQUEUE and PSTOREFS file systems
* src/stat.c (human_fstype): Add magic numbers for
PSTOREFS and MQUEUE.
2011-06-24 13:30:57 +01:00
Bernhard Voelker
376b19410e tests: stat-free-color: do not count stat calls before main
* tests/ls/stat-free-color: The system may perform additional stat
calls upon loading (seen on OpenSuSE-11.4).  Count only the number
of stat calls compared to --help.
This also reduces back to "1" the number of expected calls,
effectively reverting part of 2011-06-01 commit, ccf2d9a4.
2011-06-22 16:06:52 +02:00
Bernhard Voelker
6301c72b6f tests: cp/sparse-fiemap: use "head -n99" in place of "head -99"
* tests/cp/sparse-fiemap: Use "head -n99" in place of "head -99".
The latter is officially obsolete.
2011-06-21 14:37:53 +02:00
Jim Meyering
1d919fbb7f tests: init.sh: use "sed 1q" in place of "head -1"
* tests/init.sh (warn_): Use "sed 1q" in place of "head -1".
The latter is officially obsolete but more portable than "head -n1".
Reported by Bernhard Voelker.
2011-06-20 10:01:43 +02:00
Jim Meyering
ea7c77df7f maint: update THANKS.in
* THANKS.in: Remove Stefano's name.
2011-06-20 09:53:24 +02:00
Bernhard Voelker
b970f0a505 tests: improve init.sh by removing w2_
* tests/init.sh (w2_): Remove, moving contents into...
(warn_): ...here.  Call self from subshell when IFS must be changed.
2011-06-20 09:53:20 +02:00
Stefano Lattarini
2f60384d6a tests: avoid extra forks in the testsuite
* tests/shell-or-perl: Prefer the `read' builtin over `grep' to
look at the shebang line of test scripts.  Since `read' is a
special builtin, it might abort the whole program upon failures,
so add extra sanity checks, verifying that the test script exists
and is readable, before trying to read from it.
2011-06-19 21:57:43 +02:00
Stefano Lattarini
a51c6e0356 tests: make test runner a script, not a shell function
This change implements a more correct and idiomatic use of the
features of the Automake-provided 'parallel-tests' harness.
Moreover, this change is required in order for the testsuite to
continue to work with the new testsuite harness that is planned
to be introduced in Automake 1.12 (which, as of the writing date,
is still under development and in alpha state).

* tests/shell-or-perl: New auxiliary script.
* tests/Makefile.am (EXTRA_DIST): Distribute it.
* tests/check.mk (TESTS_ENVIRONMENT): Remove definition of the
`shell_or_perl_' shell function, whose code has been moved in
the new script above (with a few improvements and extensions).
Do not use it to run the test scripts.
(LOG_COMPILER): New, properly invoking `shell-or-perl'.
2011-06-19 21:57:43 +02:00
Jim Meyering
e23f179557 stdbuf: fix automake variable name to work with cutting edge automake
* src/Makefile.am (pkglibexec_PROGRAMS): Rename from pkglib_PROGRAMS.
The latter is invalid.  Without this change, automake
v1.11-373-g9ca6326 and newer (on master) would fail with this:
`pkglibdir' is not a legitimate directory for `PROGRAMS'
This changes the default installation directory of libstdbuf.so from
$prefix/lib/coreutils/ to
$prefix/libexec/coreutils/
* src/stdbuf.c (set_LD_PRELOAD): Search in PKGLIBEXECDIR, not PKGLIBDIR,
since that's where we install libstdbuf.so.
Do not search in "", the system default search path.
2011-06-19 21:57:43 +02:00
Pádraig Brady
24b3c8b160 maint: avoid a false positive syntax check
* cfg.mk (sc_strftime_check): Skip the check when there
is no info to compare against.
Reported by Stefano Lattarini
2011-06-19 11:49:57 +01:00
James Youngman
c8392b368e maint: typo: insert omitted word in test comment
* tests/misc/sort-spinlock-abuse: Fix typo:
s/"very expensive" are/"very expensive" tests are/
2011-06-19 09:16:20 +02:00
Stefano Lattarini
51e9f0308e maint: fix typo in comment in configure.ac
* configure.ac ($MAN): Fix typo in explanatory comment.
2011-06-18 19:37:36 +02:00
Jim Meyering
4c3c2c795e tests: sort-debug-keys: fix a bug with translated diagnostics
Ensure that English diagnostics are emitted even when using
French sorting rules.
* tests/misc/sort-debug-keys: Unset LC_ALL and set LC_COLLATE,
LC_CTYPE and LC_NUMERIC to the fr_FR.UTF-8 locale, while setting
LC_MESSAGES=C.  Reported by Stefano Lattarini.
2011-06-18 08:34:07 +02:00
Pádraig Brady
f0e8f13ead maint: remove duplicate names from THANKS
* .mailmap: Merge email addresses
* THANKS.in: Remove a duplicate name
Reported by Stefano Lattarini
2011-06-17 22:48:22 +01:00
Jim Meyering
23ddefd3d1 maint: use modules/tempname.diff file, not a replacement; update gnulib
Using a .diff is much more maintainable.  Otherwise, changes in
the gnulib module description file may not be noticed and merged
promptly and may even result in subtle errors.  Luckily, this time,
the failure to propagate gnulib's changes to modules/tempname resulted
only in an obvious link failure.
* gl/modules/tempname: Remove file.
* gl/modules/tempname.diff: Use a .diff file instead.
* gnulib: Update submodule to latest.
2011-06-17 12:11:03 +02:00
Jim Meyering
7df26ae6fe tests: avoid sort-spinlock-abuse false positive under heavy load
* tests/misc/sort-spinlock-abuse: Classify as "very expensive" to
avoid unwarranted failure once and for all.
2011-06-17 12:11:03 +02:00
Jim Meyering
2e580ca741 tests: remove skip_test_ function; use new skip_ instead
* tests/init.cfg (skip_test_): Remove function.
Use skip_ in place of skip_test_ everywhere else.
* cfg.mk (sc_prohibit_skip_): Remove rule.
* tests/**: Use skip_, not skip_test_, everywhere.
2011-06-17 09:17:37 +02:00
Jim Meyering
13672ec321 tests: make init.sh's warn_ emit to both the tty and the log file
* tests/init.sh (warn_): When $stderr_fileno_ != 2,
emit the diagnostic to both the tty and the log file.
2011-06-17 09:17:30 +02:00
Jim Meyering
7f8d9892fb tests: use printf, not echo in init.sh's warn_ function
* tests/init.sh (warn_): Use printf, not echo.  The latter would
misbehave when given strings containing a backslash or starting
with e.g., -n.  James Youngman suggested setting IFS.
2011-06-17 08:54:08 +02:00
Jim Meyering
6b687452d8 tests: accommodate HP-UX and ksh-derived shells
Running "make check" normally prints a diagnostic to the outermost
stderr (usually a tty) to explain why a test is skipped.  It did this
by redirecting FD 9 to stderr (via "exec 9>&2") before invoking the
shell script.  Shell scripts write skip-explanation to FD 9 via
init.sh's skip_ function.  However, with ksh and HP-UX's /bin/sh,
the effects of "exec 9>&2" are canceled upon fork-and-exec, so we
would get a "Bad file number" diagnostic and no skip explanation on
those systems.
* tests/check.mk (TESTS_ENVIRONMENT): Redirect more portably, via
"$(SHELL) 9>&2", rather than the prior "exec 9>&2; $(SHELL) ..."
Actually, we use "shell_or_perl_ 9>&2", to make this effective
also for the perl-based tests.
* tests/init.sh (stderr_fileno_): Update the advice in comments.
See http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/22488
for lots of discussion.  Stefano Lattarini suggested the solution
of putting "9>&2" after the command.  Reported by Bruno Haible.
2011-06-14 11:05:05 +02:00
Jim Meyering
ef6e57b24b init.sh: sync from gnulib
* tests/init.sh: Sync recent changes from gnulib.
2011-06-13 18:34:03 +02:00
Jim Meyering
83e424e731 maint: revert previous commit
Revert "init.sh: accommodate shells for which 1>&$stderr_fileno_ fails"
This reverts commit 6fb9aeedd1.
That change did not solve the problem.  For details, see
http://debbugs.gnu.org/cgi/bugreport.cgi?bug=8846#74
2011-06-13 18:34:03 +02:00
Jim Meyering
6fb9aeedd1 init.sh: accommodate shells for which 1>&$stderr_fileno_ fails
* tests/init.sh (warn_): Use eval to work around a bug in some shells,
like those of Solaris 10 and HP-UX 11.11.
Improved by Stefano Lattarini.
2011-06-13 12:42:18 +02:00
Jim Meyering
2f5c2a25ed doc: add NEWS items for recent gnulib fixes
* NEWS (Improvements): Mention the new HP-UX 11.11 ACL support.
(Build-related): Mention the cc/HP-UX 11.11 build fix.
2011-06-13 12:39:23 +02:00
Jim Meyering
cd94370f74 tests: avoid sort-spinlock-abuse false positive under heavy load
* tests/misc/sort-spinlock-abuse: This test would frequently fail
when run on a system under heavy load.  Increase duration and limit.
2011-06-13 12:39:22 +02:00
James Youngman
5a3879ad03 maint: use stat-size module from gnulib
* gnulib: Update to latest.
* src/system.h: Definitions of ST_* macros have moved into the
gnulib module stat-size (specifically, the header file
stat-size.h), so remove them from here.
* src/truncate.c: Include stat-size.h.
* src/stat.c: Likewise.
* src/shred.c: Likewise.
* src/ls.c: Likewise.
* src/du.c: Likewise.
* src/ioblksize.h: New file.  Move definition of io_blksize out of
system.h so that system.h does not have to include stat-size.h.
* src/cat.c: Include ioblksize.h.
* src/split.c: Likewise.
* src/copy.c: Include both stat-size.h and ioblksize.h.
* src/Makefile.am (noinst_HEADERS): Add ioblksize.h.
2011-06-13 12:39:22 +02:00
Pádraig Brady
e4feb5c03b tests: avoid a false failure on HPUX systems
* tests/dd/nocache: Relax the test, as the system
may return various errors from posix_fadvise().
HPUX 11.31 returns ENOTTY for example.
Reported by Bruno Haible
2011-06-13 11:36:06 +01:00
Jim Meyering
7c77c93dc5 tests: inotify-rotate: avoid false positive under heavy load
* tests/tail-2/inotify-rotate: Increase timeout from 10s to 40s
to avoid load-induced false positive.
2011-06-11 13:54:12 +02:00
Pádraig Brady
869202a18c maint: remove unneeded includes
Remove unneeded includes as reported by:
http://code.google.com/p/include-what-you-use/

* src/cp-hash.c: Remove unused include.
* src/dd.c: Likewise.
* src/du.c: Likewise.
* src/head.c: Likewise.
* src/kill.c: Likewise.
* src/ls.c: Likewise.
* src/stdbuf.c: Likewise.
* src/timeout.c: Likewise.
* src/truncate.c: Likewise.
2011-06-09 15:19:46 +01:00
Pádraig Brady
77d41d2e20 doc: add examples to date --help
* src/date.c (usage): Add examples for TZ handling,
and "seconds since epoch" parsing, neither of which
was mentioned in the man page until now.
* THANKS.in: Add Rick.
Suggested by Rick Stanley.
2011-06-09 15:07:42 +01:00
Jim Meyering
c2b25223c1 build: require at least 2-year old autoconf-2.64 (was 2.62)
* configure.ac: Require autoconf-2.64, which is nearly two years old.
* src/system.h (emit_ancillary_info): Use PACKAGE_URL, now that we
require autoconf-2.64.
2011-06-04 10:57:01 +02:00
Jim Meyering
b7332b889e maint: remove now-spurious curly braces
* src/chown-core.c (restricted_chown): Remove FIXME comment and
superfluous curly braces.
2011-06-04 10:56:56 +02:00
Jim Meyering
ccf2d9a482 tests: stat-free-color: accommodate stat of /selinux on rawhide
* tests/ls/stat-free-color: This test recently began to fail on
rawhide because dynamic library start-up code now stats "/selinux",
making the total number of calls 2 rather than the prior 1.
Create two more dangling symlinks, so that any erroneous stat-
or lstat-calling code will get at least those three.
2011-06-01 16:12:04 +02:00
Marek Polacek
cc8ee4d351 yes.c: do not use exit after error
I think it would be better to exit through the error() and not
to call the exit() after the error().  This way we can get rid of
one function call (and curly brackets).

* src/yes.c (main): Exit through the error(), remove exit() call
after error().
2011-06-01 08:05:29 -06:00
Jim Meyering
e7b4bf4b57 tail: fix an inconsequential bug spotted by coverity
* src/tail.c (start_bytes): Increase *READ_POS (not READ_POS)
by the number of bytes read.  This is a real bug that happens
to have no consequence in practice.  First, this code is exercised
only when tailing-forever a non-regular file by bytes, and with a
start-relative offset, e.g., "mkfifo f; tail -f -c +3 f", but even
then, the invalid READ_POS value does not influence how tail works.
It is stored in the File_spec.size member, but that member is not
used at all in tail_forever_inotify, and in tail_forever, it is
used only when the File_spec refers to a regular file.
2011-06-01 13:49:04 +02:00
Paul Eggert
c1716a1ebf * doc/coreutils.texi (sort invocation): I/0 -> I/O (sr#107504) 2011-05-31 09:59:22 -07:00
Jim Meyering
5c557690d8 maint: remove unnecessary gnulib .diff file
* gl/modules/getloadavg.diff: Remove file.  It stopped being
useful back in February.
* Makefile.am (EXTRA_DIST): Remove it.
2011-05-29 14:37:41 +02:00
Jim Meyering
d4aca64b53 maint: placate -Wsign-compare when it's non-invasive
* src/stdbuf.c: Declare loop index to be unsigned.
2011-05-29 12:16:11 +02:00
Jim Meyering
31bbcc7abf ls: placate gcc-4.7.0's -Wstrict-overflow
* src/ls.c (enum parse_state): Define.
(parse_ls_color): Use enum names in place of constants,
thus avoiding the offending -1.
2011-05-28 22:10:00 +02:00
Jim Meyering
d0a9750e08 maint: remove useless (off_t) cast of lseek arg
* src/wc.c (wc): Remove unnecessary cast.
* src/head.c (elide_tail_bytes_file, elide_tail_lines_file): Likewise.
* src/tac.c (tac_seekable, tac_file): Likewise.
2011-05-28 13:52:17 +02:00
Jim Meyering
963d809ae9 tests: move tests/misc/split-* into tests/split/...
* tests/split/suffix-length: Rename from tests/misc/split-a.
* tests/split/b-chunk: Rename from misc/split-bchunk.
* tests/split/fail: Rename from tests/misc/split-fail.
* tests/split/lines: Rename from tests/misc/split-l.
* tests/split/l-chunk: Rename from tests/misc/split-lchunk.
* tests/split/r-chunk: Rename from tests/misc/split-rchunk.
* tests/Makefile.am (TESTS): Reflect renaming.
2011-05-28 13:52:17 +02:00
Pádraig Brady
54a49f22ae chown,chgrp: output the original ownership in -v messages
* src/chown-core.c (describe_change): Output the
original owner if possible.
(user_group_str): Handle the case when neither
owner or group are passed.
* NEWS: Mention the change in behavior.
2011-05-27 23:21:46 +01:00
Pádraig Brady
6b282e7510 chown,chgrp: output the correct ownership in -v messages
* src/chown_core.c (describe_change): Accept the ownership of
the original file and output that when not changing.
This is significant when --from is specified as then
the original and specified ownership may be different.
(user_group_str): A new helper function refactored from
describe_change().
(change_file_owner): Pass the original user and group
strings to describe_change().
* test/chown/basic: Add a test case.
* NEWS: Mention the fix.
2011-05-27 22:37:46 +01:00
Pádraig Brady
8a26bccb46 maint: fix a -Wstrict-overflow build failure with gcc 4.5
* src/ls.c (print_color_indicator): Avoid the warning by
not decrementing the integer.
2011-05-27 00:39:55 +01:00
Jim Meyering
ad756440fb build: --enable-gcc-warnings: enable -Wstrict-overflow in src/
* configure.ac (WARN_CFLAGS): Don't turn off -Wstrict-overflow.
(GNULIB_WARN_CFLAGS): Remove -Wstrict-overflow from the list of
warning options used in lib/.
Normally I find that -Wstrict-overflow produces too many false
positives, but considering that it warns of the bug reported in
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33498, I now think
it is worthwhile.  The lesser of two evils.
Thanks to Daniel Veillard for showing me the gcc bug report.
2011-05-26 22:13:54 +02:00
Jim Meyering
419b6c9d42 maint: accommodate gcc's -Wstrict-overflow option
* src/factor.c (factor_using_pollard_rho): Change type of "i"
to unsigned to avoid warning from gcc's -Wstrict-overflow.
* src/expr.c: Use an unsigned intermediate.
* src/dircolors.c (main): Reorder operations to avoid the risk of
pointer overflow.
* src/tr.c (squeeze_filter): Change NOT_A_CHAR from an anonymous
"enum" to an "int", to avoid this warning:
tr.c:1624:10: error: assuming signed overflow does not occur when
  simplifying conditional to constant [-Werror=strict-overflow]
* src/pr.c (main): Make index "i" unsigned.
2011-05-26 22:13:37 +02:00
Jim Meyering
d7e2365203 maint: enforce cpp indentation policy
* cfg.mk (sc_preprocessor_indentation): New test, from libvirt.
Exempt 3 files from new cppi test.
* gl/lib/randread.c: Adjust cpp indentation to comply.
* src/extent-scan.c (extent_need_sync): Likewise.
2011-05-26 22:10:46 +02:00
Jim Meyering
3f98fe3155 maint: env.c: remove unnecessary use of strchr
* src/env.c (main): Remove excess (and confusing to static analyzers)
use of strchr.
2011-05-26 22:10:46 +02:00
Jim Meyering
a042bba6c7 shred: placate coverity and fix a comment
* src/shred.c (incname): Add an assertion to tell static analyzers
that we know this particular use of strchr never returns NULL.
Finish incomplete sentence in function-describing comment.
2011-05-26 22:10:46 +02:00
Pádraig Brady
41139da2e7 maint: split: remove --filter specific code from other paths
* src/split.c (lines_chunk_split): Don't use ignore_error() which
is redundant and confusing when not running with --filter.
(lines_rr): Likewise.
(ofile_open): Likewise. Add a comment to clarify that
filters aren't restarted under file descriptor pressure.
2011-05-26 00:28:14 +01:00
Pádraig Brady
bfffa90947 split: diagnose when --filter is used with a chunk number
* src/split.c (main): Exit with a diagnostic if --filter
is specified along with a specific chunk number.
* test/split/filter: Ensure this combination fails.
2011-05-26 00:23:11 +01:00
Pádraig Brady
6eec064597 split: exit when we can no longer write to a --filter
* src/split.c (bytes_split): Stop reading when we
can no longer write to a child process.
(lines_rr): Likewise.
(lines_bytes_split): No change is made here since
input is bounded by the original file size.
* test/split/filter: Add test cases.
2011-05-26 00:12:05 +01:00
Pádraig Brady
5908e29e82 split: return success even if a --filter exits
src/split.c (main): Don't unblock SIGPIPE before cleanup,
as then any pending signals will be sent and cause
the main split process to exit with a non zero status (141).
* test/split/filter: Add a test for this case.
2011-05-26 00:10:32 +01:00
Pádraig Brady
d92849fe5a split: fix an edge case where -n l/... creates an extra file
* src/split.c (lines_bytes_chunk): Handle the edge case
where the file is truncated as we read.
* tests/misc/split-lchunk: Cleanup; no functional change.
2011-05-25 23:04:58 +01:00
Bernhard Voelker
e89c998a9e chmod: output the original mode in verbose mode
* src/chmod.c (describe_change): Pass in the original mode,
and output this in the messages.
* tests/chmod/c-option: Adjust as per the new message.
* THANKS.in: Remove the now auto-generated name.
* NEWS: Mention the change in behavior.

Signed-off-by: Pádraig Brady <P@draigBrady.com>
2011-05-25 23:04:12 +01:00
Jim Meyering
bf9d4f1317 tests: ls/stat-free-color: fix unwarranted failure on a 32-bit system
* tests/ls/stat-free-color: Also check for stat64 and lstat64 syscalls.
This fixes a test failure reported by Stefano Lattarini.
2011-05-25 08:27:34 +02:00
Jim Meyering
56a88e9522 maint: accommodate gnulib's newer tight_scope rule
* cfg.mk: Include via "-include", to accommodate new tight-scope rule.
(sc_check-AUTHORS): Change the name of the rule in src/Makefile.am
to _sc_check-AUTHORS, so it doesn't conflict with this one when
this file is included into the sub-make's context.
* src/Makefile.am (_sc_check-AUTHORS): Rename from sc_check-AUTHORS.
* gnulib: Update to latest.
2011-05-25 08:26:14 +02:00
Jim Meyering
484df12639 doc: make README-hacking slightly more generic
* README-hacking: Remove a reference to "coreutils".
2011-05-25 08:26:14 +02:00
Jim Meyering
dac67b8cc2 touch: placate static analyzers: no NULL-deref is possible
* src/touch.c (main): Avoid even the hint of possibility that
we'd dereference NULL upon localtime failure.  Coverity reported
the potential, but it appears not to be possible, since posixtime
rejects any time for which the subsequent localtime would return NULL.
See http://thread.gmane.org/gmane.comp.gnu.coreutils.general/1253
2011-05-25 08:25:54 +02:00
Pádraig Brady
7d44751f0e split: fix cases where -n l/... creates extraneous files
* src/split.c (lines_chunk_split): Ensure that data is only
written to stdout when k specified.  Also ensure that
extra files are not created when there is more data available
than reported in the file size.
* tests/misc/split-lchunk: Verify that split -n l/k/n doesn't
generate any files, and that -n l/n always generates n files.
* NEWS: Mention the fix.
2011-05-24 16:29:48 +01:00
Stéphane Raimbault
9ead32a9be doc: add a missing space in timeout --help
* src/timeout.c (usage): Add a space to be consistent
with other uses of "(the default)" in the documentation.

Signed-off-by: Pádraig Brady <P@draigBrady.com>
2011-05-24 16:17:02 +01:00
Pádraig Brady
64ceb14984 doc: improve tail -f vs. inotify description and advice
* doc/coreutils.texi (tail invocation): Adjust, and add an example.
2011-05-24 12:04:54 +02:00
Jim Meyering
0a8d30534b maint: avoid trivial syntax-check failure
* doc/coreutils.texi (tail invocation): Use @var{n}, not @var{N}.
2011-05-23 20:03:58 +02:00
Karl Berry
ac9c5330df maint: README-hacking clarifications
* README-hacking: Small getting-started clarifications.
2011-05-23 19:07:25 +02:00
Jim Meyering
acbfebeb8d doc: describe how kernel inotify support affects tail -f
* doc/coreutils.texi (tail invocation) [-f]: Mention how inotify
kernel support makes a difference.
Prompted by http://bugzilla.redhat.com/662900
2011-05-23 16:09:52 +02:00
Jim Meyering
d61f5a1c16 tests: fix typo in tac-continue
* tests/misc/tac-continue: Fix typo in usually-skipped test:
s/mkfifo_or_skip/mkfifo_or_skip_/ (i.e., append "_").
This test is usually skipped, because I'm probably the only
one to set the FULL_PARTITION_TMPDIR envvar, and recently the
one I'd been using ceased to exist, so this test was skipped
even for me.  Good argument for making this a root-only test
and creating a full partition just for this test case.
2011-05-22 17:10:31 +02:00
Jim Meyering
12c5386a30 doc: fix a formatting nit in od's texinfo documentation
* doc/coreutils.texi (od invocation): Typesetting of "bytes" was wrong.
Fix it via s/@code/@var/ so it's consistent.
2011-05-22 09:11:19 +02:00
Ivan Sichmann Freitas
485a454576 maint: fix comment typos in df.c
* src/df.c: s/Optain/Obtain/
2011-05-21 10:39:48 +02:00
Jim Meyering
cb4a0e31e2 maint: correct typos involving misuse of "a" and "an"
* NEWS: "an misleading"
* src/expr.c: "a integer
* src/ptx.c (find_occurs_in_text): "a end"
* src/shred.c (do_wipefd): "a infinite"
* src/sort.c (SUBTHREAD_LINES_HEURISTIC): "an dual-core"
(compare_random): "an checksum"
* cfg.mk (old_NEWS_hash): Update, since the typo was in old news.
2011-05-19 21:36:33 +02:00
Pádraig Brady
beaa949313 printf: fix an out-of-bounds memory access
* src/printf.c (STRTOX): Don't access memory after a
string containing a single quote character.
* tests/misc/printf: Add tests for various combinations
of single quote characters combined with a numeric format.
* THANKS.in: Add bug reporter.
* NEWS: Mention the fix.

Reported-by: Paul Marinescu <paul.marinescu@imperial.ac.uk>
2011-05-18 07:33:04 +01:00
Pádraig Brady
50ca38e523 doc: mention that ls time ordering is newest first
* src/ls.c (usage): Add the "newest first" info to
the -t and -c options
2011-05-17 07:51:44 +01:00
Pádraig Brady
5116103826 tests: refactor more tests to use mkfifo_or_skip_
* tests/cp/existing-perm-race: s/mkfifo/mkfifo_or_skip_/
* tests/cp/file-perm-race: Likewise.
* tests/cp/parent-perm-race: Likewise.
* tests/cp/special-f: Likewise.
* tests/dd/reblock: Likewise.
* tests/ls/file-type: Likewise.
* tests/misc/cat-buf: Likewise.
* tests/misc/mknod: Likewise.
* tests/misc/printf-surprise: Likewise.
* tests/misc/selinux: Likewise.
* tests/misc/sort-spinlock-abuse: Likewise.
* tests/misc/stdbuf: Likewise.
* tests/misc/tac-continue: Likewise.
* tests/init.cfg: Improve the error message when skipping.
2011-05-14 10:41:29 +01:00
Pádraig Brady
27873f1deb shuf: use memory more efficiently when returning a subset
* gl/lib/randperm.c (randperm_new): When the number of items
to return H, is much smaller than the total number of items N,
use a hash to represent the sparse permutations of the set N.
This is currently enabled for N > 128K and N/H > 32.
* tests/misc/shuf: Ensure shuf can quickly return 2 numbers
from a large range.
* gl/modules/randperm: Depend on hash.
* NEWS: Mention the change.
2011-05-14 10:30:12 +01:00
Jim Meyering
9d152a1ed7 maint: avoid syntax-check failure due to long line
* tests/du/bigtime (future_time): Split long line.
2011-05-13 23:37:23 +02:00
Jim Meyering
76f49e601e maint: add new syntax-check rule to prohibit use of skip_
* cfg.mk (sc_prohibit_skip_): New rule.
* tests/init.cfg (skip_test_): Add a comment.
2011-05-13 18:57:31 +02:00
Jim Meyering
89d542f3d8 tests: use skip_test_, not skip_
skip_test_ emits its diagnostic both to FD 9 (tty), and to
FD 2 (usually the log file), whereas init.sh's skip_ emits
only to FD 9.  Without that, the log is slightly less useful.
* tests/cp/fiemap-2: Use skip_test_, not skip_.
* tests/cp/fiemap-perf: Likewise.
* tests/du/bigtime: Likewise.
* tests/du/files0-from-dir: Likewise.
* tests/du/move-dir-while-traversing: Likewise.
* tests/init.sh: Likewise.
* tests/misc/sort-stale-thread-mem: Likewise.
* tests/misc/stat-nanoseconds: Likewise.
* tests/mv/i-3: Likewise.
* tests/mv/sticky-to-xpart: Likewise.
* tests/split/filter: Likewise.
Prompted by a report from Pádraig Brady.
2011-05-13 18:38:52 +02:00
Jim Meyering
a085b6fc6c ls: allow stat-free use of --color
Even on a system with d_type support, the default use of --color
makes ls stat every file in order to be able to honor settings like
EXEC, STICKY, ORPHAN, SETUID, etc., because those settings require
information that is not provided by dirent.d_type.  However, if
for a potentially large performance gain, you are willing to disable
those settings, you can now make ls --color give type-related coloring
and perform no stat calls at all (other than the unavoidable call-per-
command-line argument).  Before this change, even with all of those
attributes disabled, ls --color would still stat every directory.
Now, we're down to the minimum of one stat call per command-line arg.
* src/ls.c (gobble_file): With --color, don't stat a
non-command-line-specified directory when no directory-coloring
attribute is enabled.
* tests/init.cfg (require_dirent_d_type_): New function.
* tests/d_type-check: New script, mostly from Pádraig Brady.
* tests/Makefile.am (EXTRA_DIST): Add it.
* tests/ls/stat-free-color: New test.
* tests/Makefile.am (TESTS): Add it.
* doc/coreutils.texi (General output formatting): Describe how
to use dircolors to make ls --color refrain from calling stat
on a d_type-enabled file system.
Prompted by a query from Josef Bacik.
2011-05-13 18:28:43 +02:00
Jim Meyering
6bc73ee56e maint: use <unistd.h>, not "group-member.h"
gnulib's group-member module now ensures that the group_member
function is declared in <unistd.h>, just like it is glibc.
* lib/euidaccess-stat.c: Remove inclusion of "group-member.h".
* src/chgrp.c: Likewise.
2011-05-12 08:23:52 +02:00
Jim Meyering
eec0e6d2e4 build: update gnulib submodule to latest 2011-05-12 08:23:52 +02:00
Jim Meyering
9418e01abe maint: remove syntax-checking sc_tight_scope rule
* src/Makefile.am (sc_tight_scope): Remove rule.
Now it's provided via gnulib's maint.mk.
* cfg.mk (sc_tight_scope): Likewise.
2011-05-11 17:20:33 +02:00
Jim Meyering
2141543a37 maint: tail: mark a global variable as static
* src/tail.c [HAVE_INOTIFY] (inotify_wd_mask): Declare static.
2011-05-11 17:17:53 +02:00
Pádraig Brady
73fd918bd0 maint: remove -Wmissing-field-initializers workarounds
* configure.ac: Rather than disabling -Wmissing-field-initializers,
use the fact that gnulib now disables it automatically when required
(on versions of GCC older than 4.7).
* src/system.h: Remove the no longer needed DECLARE_ZEROED_AGGREGATE.
* src/ls.c: Likewise.
* src/pathchk.c: Likewise.
* src/shred.c: Likewise.
* src/stty.c: Likewise.
* src/wc.c: Likewise.
2011-05-08 17:38:37 +01:00
Jim Meyering
3c8ff029d4 tests: don't fail the split --filter=CMD test if xz is not available
* tests/split/filter: Skip if xz is not installed.
2011-05-07 07:48:00 +02:00
Jim Meyering
09baf2287e doc: document split's new --filter=CMD option
* doc/coreutils.texi (split invocation): Describe --filter=CMD.
* NEWS (New feature): Mention it.
2011-05-06 22:54:51 +02:00
Jim Meyering
2644e288e4 tests: test split's new --filter=CMD option
* tests/Makefile.am (TESTS): Add split/filter.
* tests/split/filter: New file.
2011-05-06 22:54:51 +02:00
Karl Heuer
a09d9e5bad split: accept new output --filter=CMD option
* src/split.c: Include <signal.h>, <sys/wait.h> and "sig2str.h".
(FILTER_OPTION): New anonymous enum member.
(filter_command, filter_pid): New globals.
(open_pipes, open_pipes_alloc, n_open_pipes): Likewise.
(oldblocked, newblocked): Likewise.
(longopts): Add "filter".
(usage): Document --filter.
(create): Extend to create a pipe and fork "sh -c CMD".
(closeout): Adapt to close a pipe and wait for child process.
(cwrite): Call closeout, not just close.
(lines_chunk_split): FIXME
(bytes_chunk_extract): FIXME
(opid, ofile_open, lines_rr, main): FIXME
(ignorable): New function, to encapsulate EPIPE test.
2011-05-06 22:54:51 +02:00
Jim Meyering
a1f21327eb build: update gnulib submodule to latest 2011-05-06 17:05:49 +02:00
Pádraig Brady
ebce7bfb1b sort: fix a contradictory --debug warning
* src/sort.c (key_warn): `sort -k2,1n --debug` would output
warnings about being both "zero width" and "spanning multiple fields".
Suppress the latter one.
* tests/misc/sort-debug-warn: Add a couple of test cases.
2011-05-06 08:07:46 +01:00
Pádraig Brady
9aeffd3fe5 df: fix crash in mem exhaustion edge case
* src/df.c (print_table): Don't try to output NULL
if ambsalign() can't allocate memory.  Instead just
output the unaligned text.
2011-05-05 16:32:14 +01:00
Jim Meyering
719dcc7f01 maint: remove use of gnulib's obsolete strtol module
* bootstrap.conf (gnulib_modules): Remove now-obsolete "strtol".
Remove use of $obsolete_gnulib_modules: unused since commit edc69f91.
2011-05-03 10:25:32 +02:00
Jim Meyering
73243f181d maint: remove unnecessary listing of update-copyright in Makefile.am
* Makefile.am (changelog_etc): Don't list update-copyright here.
It is automatically included via gnulib-tool-generated lib/gnulib.mk.
2011-05-03 10:25:32 +02:00
Jim Meyering
9d282141ba doc: remove a name from THANKS.in that is derived from git log
* THANKS.in: Remove a now-duplicate name.
2011-05-03 10:25:32 +02:00
Jim Meyering
47ef7504da copy: fix my typo
* src/copy.c (copy_reg): Fix my typo (mis-applied patch).
The patch by Jeff Liu was fine, but I mis-applied it
and introduced a compilation error in commit efa479c1.

2011-05-03  Jim Meyering  <meyering@redhat.com>
2011-05-03 10:24:18 +02:00
Jim Meyering
4b28ff7f32 build: avoid bootstrap failure when $GZIP is set
Running "GZIP=-9 ./bootstrap" would fail right away, because the
tool-version-checking code would treat the upper-cased program name
as an environment variable name and if that has a value use the
result as the application name.  That works fine for automake,
autoconf, etc. but not for gzip.
* bootstrap (check_versions): Do not treat $GZIP as a program name.
If defined at all, it is supposed to list gzip options.
Reported by Alan Curry in http://debbugs.gnu.org/8609
2011-05-03 10:15:13 +02:00
Jeff Liu
efa479c1e5 copy: correct misuse of quote in diagnostic
* src/copy.c (copy_reg): Multiple uses of quote (s) in an
argument list is erroneous.  Use quote_n, instead.
2011-05-03 10:15:13 +02:00
Jim Meyering
b83d289685 maint: adjust split.c formatting to conform
* src/split.c (usage): Correct indentation.
(ofile_open): Likewise.
(create): "char *name", not "char* name".
(struct of_info) [ofile]: Similar.
(parse_chunk): Add spaces around "+".
2011-04-30 12:20:56 +02:00
Eric Blake
c1effb1f2b build: update to latest gnulib
* gnulib: Update to latest.
* bootstrap.conf (gnulib_modules): Add xgetgroups.
2011-04-29 11:03:33 +02:00
Jim Meyering
d78ccd5949 tests: distribute new file, CuSkip.pm
Without this, most perl-based tests would fail in "make distcheck".
* tests/Makefile.am (EXTRA_DIST): Add CuSkip.pm
2011-04-29 11:03:33 +02:00
Jim Meyering
3ed91fc8b9 tests: remove useless test: misc/pwd-unreadable-parent
* tests/Makefile.am (TESTS): Remove misc/pwd-unreadable-parent.
This test was misleading and useless (was always skipped).
Inspired by a report from Bruno Haible: http://debbugs.gnu.org/8570
* tests/misc/pwd-unreadable-parent: Remove file.
2011-04-28 22:45:34 +02:00
Jim Meyering
1560848265 tests: write skip explanation from perl scripts also to outer stderr
* tests/CuSkip.pm (skip): New file/module/function, to help
the perl test scripts "skip" a test consistently, emitting
a diagnostic both into the log file and into the outermost
stderr stream that is more likely to be seen by a human.
* tests/check.mk (TESTS_ENVIRONMENT): Add -MCuSkip.
* tests/misc/date-next-dow: Use CuSkip::skip in place of warn+exit-77.
* tests/misc/tty-eof: Likewise.
* tests/misc/uniq: Likewise.
* tests/rm/fail-eperm: Likewise.
* tests/misc/md5sum-newline: Likewise.  Also, s/program_name/ME/.
* tests/misc/ls-misc (setuid_setup, main): Likewise.
* tests/misc/pwd-long: Likewise, and add -I"$abs_srcdir" -MCuSkip
to the $PERL invocation command.
Inspired by a request from Bruno Haible regarding misc/tty-eof:
http://debbugs.gnu.org/8570
2011-04-28 22:43:56 +02:00
Jim Meyering
e3f814a773 post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2011-04-26 16:18:02 +02:00
Jim Meyering
8c6a1d1281 version 8.12
* NEWS: Record release date.
2011-04-26 16:00:50 +02:00
Jim Meyering
74e5ad9cf7 maint: tweak sc_tight_scope rule
* src/Makefile.am (sc_tight_scope): Remove useless quotes,
change 1>&2 to >&2, and combine a few short lines.
2011-04-26 09:27:49 +02:00
Jim Meyering
740516cd12 dd: work around compilation failure on AIX 5.1 and 5.2
* src/dd.c (O_NOCACHE): Undefine.  This symbol is defined
via AIX's <fcntl.h>, yet used as an enum name in dd.c.
Reported by Gary V. Vaughan in http://debbugs.gnu.org/8555
* NEWS (Portability): Mention this.
2011-04-26 09:27:44 +02:00
Jim Meyering
d891fe81f7 maint: move two small functions, so we can remove a fwd decl
* src/dd.c (cleanup, quit): Move the definition of quit to follow the
definition of process_signals, so we can remove the declaration of
the latter.
2011-04-26 09:02:44 +02:00
Jim Meyering
512825f9ba maint: change some leading 8-space sequences to TABs in a Makefile.am
src/Makefile.am (fs-magic, fs-kernel-magic): Change some leading
8-space sequences to TABs.
2011-04-25 14:43:22 +02:00
Jim Meyering
bd6cea345c stat: recognize V9FS and ECRYPTFS file systems
* src/stat.c (human_fstype): Add magic numbers for V9FS and ECRYPTFS.
2011-04-25 14:40:45 +02:00
Jim Meyering
61de57cd23 tail --follow=name no longer implies --retry
* src/tail.c (tail_forever_inotify): Just as without inotify,
tail --follow=name now terminates when the last tailed-by-name file
is unlinked or moved aside.  This bug was introduced on 2009-06-15
via commit ae494d4b, "tail: use inotify if it is available".
Reported by Tim Underwood in
http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/22286
* NEWS (Bug fixes): Mention this.
* tests/tail-2/follow-name: Test for this.
* tests/Makefile.am (TESTS): Add it.
2011-04-25 10:59:15 +02:00
Jeff Liu
32eb31999f copy: include both src and dest names in clone failure diagnostic
* src/copy.c (copy_reg): Upon btrfs clone failure, print not just
the destination file name, but also the source file name.
That may be useful upon failure of a cross-device clone attempt.
2011-04-25 10:58:57 +02:00
Jim Meyering
0e6c96e68c tests: tail-2/pipe-f2: avoid false-positive failure
Otherwise, this would fail (albeit rarely) on a "make -j24 check" run.
* tests/tail-2/pipe-f2: Increase timeout from 1 second to 10,
to avoid false positive failure.
2011-04-25 10:58:09 +02:00
Jim Meyering
768b8a0662 maint: explicitly list full-read and full-write module names
* bootstrap.conf (gnulib_modules): Include full-read and full-write
explicitly.  Before, we'd get them via safe-read, but with newer
gnulib, that is no longer enough: link failure due to undefined
references to full_write.
2011-04-25 10:57:58 +02:00
Jim Meyering
249d9a3ca4 doc: tail/inotify does use --sleep-interval=S, with --pid=P
* doc/coreutils.texi (tail invocation): Mention it.
* src/tail.c (usage): Likewise.
(tail_forever_inotify): Clarify comment.
2011-04-25 10:55:27 +02:00
Alan Curry
302cfcaeab tests: sparse-fiemap: adjust syntax to accommodate older awk
* tests/cp/sparse-fiemap: Parenthesize ternary expression used
as an argument to awk's printf.  Otherwise, gawk 3.0.1 and the
one from debian stable's original-awk would get a syntax error.
Reported by Dennis Clarke.

Copyright note: tiny change
2011-04-22 11:10:32 +02:00
Jim Meyering
8c0b1de42c tests: sparse-fiemap: with root/ext3, do not create an ext4 FS
* tests/cp/sparse-fiemap: When this test was run as root on an ext3
file system, (ext3 had known problems), it would trickily create and
mount a loopback ext4 file system and use that instead.  However, due
to a bug in 2.6.39-rc1..rc3, this loopback test (when run in another
loopback FS) exposed a bug with 1k-blocksize ext4 whereby non-NUL
data would be read from a hole.  For details, see this:
http://thread.gmane.org/gmane.comp.file-systems.ext4/24495
2011-04-21 21:01:13 +02:00
Jim Meyering
223e3832eb tests: sparse-fiemap: report more detail upon failure; ignore an FP
* tests/cp/sparse-fiemap: Fail right away with details, when cmp fails.
When extent maps are found to differ, display them and merely warn.
2011-04-21 18:39:02 +02:00
Jim Meyering
18a474d755 copy: use FIEMAP (extent_copy) only for apparently-sparse files,
to avoid the expense of extent_copy's unconditional use of
FIEMAP_FLAG_SYNC.
* src/copy.c (copy_reg): Do not attempt extent_copy on a file
that appears to have no holes.
* NEWS (Changes in behavior): Document this.  At first I labeled this
as a bug fix, but that would be inaccurate, considering there is no
documentation of FIEMAP semantics, nor even consensus among kernel
FS developers.  Here's hoping SEEK_HOLE/SEEK_DATA support will soon
make it into the linux kernel.
2011-04-20 18:48:48 +02:00
Jim Meyering
846d826096 copy: factor out a tiny sparse-testing function
* src/copy.c (HAVE_STRUCT_STAT_ST_BLOCKS): Define to 0 if undefined,
so we can use it in the return expression, here:
(is_probably_sparse): New function, factored out of...
(copy_reg): ...here.  Use the new function.
2011-04-20 18:48:48 +02:00
Jim Meyering
bef4fa1e1a copy: do not treat unwritten extents specially: avoid XFS/ext4 data loss
* src/copy.c (extent_copy): Do not treat "unwritten extents" specially.
Otherwise, with a release-candidate 2.6.39-rc3 kernel, XFS or ext4,
when using gold as your linker, and if you forget to run "make check",
you could end up installing files full of zeros instead of the expected
binaries.  For a lot of discussion, see
http://thread.gmane.org/gmane.comp.file-systems.xfs.general/37895
* tests/cp/fiemap-empty: Disable this test.
2011-04-20 18:48:38 +02:00
Jim Meyering
9bcd045f81 copy: always use FIEMAP_FLAG_SYNC, for now
* src/extent-scan.c (extent_need_sync): Always return true,
to make the sole caller always use FIEMAP_FLAG_SYNC.
This will doubtless have an undesirable performance impact,
but we'll mitigate that shortly, by using extent_copy only on
files with holes.
2011-04-20 17:11:15 +02:00
Jim Meyering
48306b83be tests: remove spurious syntax from a perl snippet
* tests/cp/sparse-fiemap: Remove spurious BEGIN {...} block.
2011-04-20 09:46:27 +02:00
Ondřej Vašík
9f688b8363 dircolors: add .ear, .war, .sar, for Java jar-like archives
* src/dircolors.hin: Add .ear, .war, .sar, for Java jar-like archives
Suggested by Ville Skyttä in https://bugzilla.redhat.com/616497.
2011-04-17 11:21:13 +02:00
Jim Meyering
5995ed0b38 post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2011-04-13 21:32:49 +02:00
Jim Meyering
8dc5394183 version 8.11
* NEWS: Record release date.
2011-04-13 21:13:50 +02:00
Pádraig Brady
ace9ef2a94 maint: mention dd's new partial read warning in NEWS
* NEWS: Mention the new feature, from commits e1788d9e and 194c1e89
2011-04-13 15:38:36 +01:00
Pádraig Brady
403e8e3b89 tests: fix a false positive fiemap test on some file systems
* tests/filefrag-extent-compare: Don't check the length of the
last extent, as this was seen to vary on XFS, where it leaves
trailing blocks allocated for performance reasons.
* tests/cp/fiemap-empty: Though not seen as an issue in practise,
try to avoid possible issues with the allocator in file systems,
by requesting to allocate a power of 2.
2011-04-13 11:18:48 +01:00
Pádraig Brady
501ce81b6a maint: correct kernel version in test comment 2011-04-12 11:30:33 +01:00
Jim Meyering
53ee267945 maint: remove unnecessary inclusion of <stdio.h>
* src/extent-scan.c: Don't include <stdio.h>.  It was not used.
2011-04-12 12:14:26 +02:00
Jim Meyering
ce0f286cce build: update gnulib submodule to latest 2011-04-11 14:33:23 +02:00
Jim Meyering
1487204385 cfg.mk: remove useless semicolon and backslash
* cfg.mk (sc_NEWS_two_empty_lines): Remove semicolon and backslash.
2011-04-11 14:32:56 +02:00
Jim Meyering
4db3c6b5ea doc: tweak NEWS
* NEWS: Slightly obfuscate a line to avoid a false-positive
doubled-word ("is-is") match.
Fix a grammar error in news for 8.2.
* cfg.mk (old_NEWS_hash): Resync.
2011-04-11 14:32:56 +02:00
Jim Meyering
b80e2c7c25 maint: install: remove support for --preserve_context ("_", not "-")
* src/install.c: Its use has elicited a warning for two years.
Use --preserve-context instead.
* NEWS (changes in behavior): Mention this.
2011-04-11 14:32:56 +02:00
Jim Meyering
9288068ff8 maint: reorder install.c to eliminate declarations of static functions
* src/install.c: Remove static function declarations.
2011-04-11 14:32:56 +02:00
Jim Meyering
e6f4c34167 maint: rename variables for clarity...
and to avoid a false-positive "TO to" in new doubled word check.
* src/install.c (change_timestamps): Rename parameters for
readability.  Make the comment match the code.
2011-04-11 14:32:55 +02:00
Jim Meyering
b2dfc3b5e5 maint: remove doubled words in comments, e.g., s/to to/to/
* tests/ls/color-norm: s/to to/to/
* gl/lib/mbsalign.h (mbs_align_t): s/or or/or/
* src/extent-scan.c (extent_scan_read): s/the the/the/
* src/libstdbuf.c: s/the the/the/
* tests/misc/stdbuf: s/on on/on/
* ChangeLog-2005: s/for\n\tfor /for\n\t/
2011-04-11 14:32:55 +02:00
Pádraig Brady
80be785c95 maint: misc typo fixes
* src/fiemap.h: s/can not/cannot/
* NEWS: s/in/is/
* doc/coreutils.texi: Remove spurious "and".
s/effect/affect/
Use matched ``...'' quotes.
2011-04-11 11:13:14 +02:00
Pádraig Brady
324571ea4a maint: correct kernel version in NEWS
* NEWS: Adjust to match commit 1c3654cb, 2011-04-02,
"copy: require fiemap sync also for 2.6.38 kernels"
2011-04-07 00:23:00 +01:00
Pádraig Brady
18f5a8537c copy: handle mergeable extents across fiemap scans
* extent-scan.h (extent_scan_free): Init the pointer to NULL,
and reset the count to 0, so that we can realloc the buffer.
* src/extent-scan.c (extent_scan_init): Likewise.
(extent_scan_read): Loop over multiple fiemap scans, so we handle
mergeable extents that span across fiemap scan boundaries.  Once
we have enough unique extents, return so as to minimize memory use.
2011-04-06 23:15:19 +01:00
Pádraig Brady
8b2bedadb5 copy: fix an unlikely memory leak when a fiemap copy fails
* src/copy.c (extent_copy): Free the extents array when
sparse_copy() fails.
2011-04-06 23:08:54 +01:00
Jim Meyering
a71537366e tests: avoid spurious parallel failure due to temporary disk full
Running the new fiemap-empty test uses 600MB of disk space via
fallocate, and in so doing caused failure in unrelated tests that
were running in parallel on a small file system.  Rather than
simply running fallocate (which allocates the space, inducing
disk full when it fails), skip the test if there is less than
800MB of free space, as computed via stat and awk.
* tests/init.cfg (require_file_system_bytes_free_): New function.
* tests/cp/fiemap-empty: Use it.
2011-04-04 18:21:32 +02:00
Jim Meyering
4e23ca47ac tests: don't ever leave a backgrounded "sleep 10m" process
* tests/misc/help-version: Sleep only ~30s, not 10m.
The latter was a problem when somehow that sleep process would
hang around and thereby prevent (for up to 10m) a normal unmount
of the temporary partition in which I'd run the tests.
2011-04-04 18:21:32 +02:00
Jim Meyering
aec3e1e107 tests: preserve-gid: don't chown temporary PATH dir to a nameless UID
* tests/cp/preserve-gid: Simply chmod a+rx instead.
That is safer, in case the nameless UID actually has an account,
and might take advantage of root running a program in a directory
under its control
2011-04-04 18:21:32 +02:00
Jim Meyering
40f71538b6 tests: preserve-gid: remove useless use of "env"
* tests/cp/preserve-gid: Remove useless use of "env".
2011-04-04 18:21:32 +02:00
Jim Meyering
1bc76356d2 tests: convert common root-build test failure to a "skip"
* tests/mv/sticky-to-xpart: Skip rather than failing this test
when run as root and the binaries are not accessible by "nobody".
2011-04-04 18:21:31 +02:00
Jim Meyering
6227c8e8de tests: minor improvement of sc_tight_scope rule
* src/Makefile.am (sc_tight_scope): Adjust rule to use an eval-based
trap-setting for-loop rather than 4x hard-coded 128+N constants.
Also catch SIGQUIT (3).  Tweak comments.
2011-04-04 18:21:31 +02:00
Eric Blake
8d0b79afa5 docs: mention POSIX 2008
* doc/coreutils.texi (Standards conformance): Give value of
_POSIX2_VERSION matching the _POSIX_C_SOURCE of POSIX 2008.
2011-04-04 09:45:28 -06:00
Jim Meyering
03583f8d64 maint: prohibit direct use of strncmp: prefer STREQ_LEN, STRNCMP_LIT
* cfg.mk (sc_prohibit_strncmp): New rule, mostly from libvirt.
* src/system.h (STREQ_LEN, STRPREFIX, STRNCMP_LIT): Define.
* src/df.c (get_dev, get_point): Convert.
* src/extent-scan.c (extent_need_sync): Likewise.
* src/ls.c (is_colored, decode_switches): Likewise.
(parse_ls_color, (print_color_indicator): Likewise.
* src/md5sum.c (split_3): Likewise.
* src/split.c (main, emit_ancillary_info): Likewise.
* src/tr.c (look_up_char_class): Likewise.
* src/uname.c (main): Likewise.
* src/who.c (scan_entries): Likewise.
2011-04-03 21:55:27 +02:00
Jim Meyering
1c3654cb1f copy: require fiemap sync also for 2.6.38 kernels
* src/extent-scan.c (extent_need_sync): Require sync also for 2.6.38.
Without this, part of the cp/fiemap-empty test would fail both on
F15-to-be (2.6.38.1-6.fc15.x86_64) and rawhide.  For details, see
http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/22190
2011-04-03 12:16:27 +02:00
Jim Meyering
45b332f7ab cp: always detect copy-into-self: avoid infloop w/large PATH_MAX
When running the erroneous command, cp -rl A D D, and depending on the
structure of directories A and D and the file system type (because that
changes order of dir. entry traversal), cp would sometimes fail to
detect that D was being copied into D, and would create D/D/D/D/D/...
until it hit PATH_MAX or exhausted some resource.
I noticed this via the occasional failure of the cp/into-self test
when run using a ZFS file system.  It is occasional because the bug
is dependent on the order in which directory entries are traversed,
and that is apparently indeterminate with ZFS.
Technically, with the current recursive implementation, there is no
risk of an infinite loop, due to stack limitations, but with an
eventual fts-based implementation, it might have iterated until
disk space or inodes are exhausted.
* src/copy.c (copy_dir): Avoid copy-into-self interminable loop on
systems with large PATH_MAX.  On other systems, diagnose the copy-into-
self error consistently.  Handle the parameter,
first_dir_created_per_command_line_arg, correctly when there are two
or more sub-directories.
2011-04-02 16:14:47 +02:00
Jim Meyering
e08b3e7c08 maint: fix a comment typo
* tests/cp/fiemap-empty: Correct typo in comment.  Add "FIXME".
2011-04-02 14:22:55 +02:00
Pádraig Brady
bfdb6b585b copy: process empty extents more efficiently
* src/copy.c (extent_copy): Treat an allocated but empty extent
much like a hole.  I.E. don't read data we know is going to be NUL.
Also we convert the empty extent to a hole only when SPARSE_ALWAYS
so that the source and dest have the same allocation.  This will
be improved soon, when we use fallocate() to do the allocation.
* tests/cp/fiemap-empty: A new test for efficiency and correctness
of copying empty extents.
* tests/Makefile.am: Reference the new test.
* NEWS: Mention the change in behavior.
2011-04-01 15:04:18 +01:00
Pádraig Brady
b56b53bd70 copy: protect against overlapping extents
* src/extent-scan.c (extent_scan_read): Add a more stringent check
for OFF_T overflow, to ensure subsequent code is immune.
Detect overlapping extents and adjust, so as files always copied.
Detection using a single scan with fallback to a standard copy
was thought too expensive in memory or time.
* NEWS: Mention the fix
2011-04-01 14:42:46 +01:00
Pádraig Brady
594292a1d8 copy: link rather than copy symlinks, when --link used
This bug was introduced in commit ca9e212c, 2009-09-24,
"cp, mv: use linkat to guarantee semantics", which
inadvertently disabled the creation of hardlinks to symlinks.
However rather than implementing the intention of that commit
and relying on gnulib linkat emulation, we'll revert to the
previous emulation as that maintains ownership and timestamps.

* src/copy.c (copy_internal): Use our existing hardlink to
symlink emulation when link() might dereference the symlink.
Also ensure that we copy the timestamps of the original symlink
when we use the emulation.
* tests/cp/link-symlink: Add a test to ensure timestamps copied.
* tests/Makefile.am: Reference the new test.
* NEWS: Mention the fix.
Reported by Ruediger Meier
2011-04-01 14:17:27 +01:00
Jim Meyering
0ec711b5c4 tests: inotify-rotate: avoid race condition with overloaded disk
* tests/tail-2/inotify-rotate: Wait 50% longer for grep to succeed.
Without this change, this test would fail consistently when using
"make -j25 check" with F15 in a virtio- and spinning-rust-backed
virtual machine.
2011-03-31 18:58:38 +02:00
Pádraig Brady
f69876e558 copy: with fiemap copy, only sync when needed
* src/extent-scan.h (struct extent_scan): Add the fm_flags member to
pass to the fiemap scan.
* src/extent-scan.c (extent_need_sync): A new function used to
detect Linux kernels before 2.6.38.
(extent_scan_init): Add FIEMAP_FLAG_SYNC when needed.
* tests/cp/sparse-fiemap: Adjust comment.
* NEWS: Mention the change in behavior.
Indirectly suggested by Mike Frysinger
2011-03-31 16:46:42 +01:00
Mathieu Bridon
17a7e45927 tests: avoid unwarranted failure in mock-simulated non-SELinux env.
* tests/init.cfg (require_selinux_): Skip the test also when
/proc/filesystems does not list selinuxfs.
Add comments.
* cfg.mk (exclude_file_name_regexp--sc_file_system): Exempt
tests/init.cfg, with its use of /proc/filesystems.
Based on the patch by Mathieu Bridon in http://debbugs.gnu.org/8359.
More discussion in http://bugzilla.redhat.com/573111
2011-03-28 12:00:12 +02:00
Jim Meyering
fde07ff436 maint: correct formatting style in a header
* src/find-mount-point.h: Move "*" to where it belongs.
Move "const", too.
* src/find-mount-point.c: Move "const" to conform.
* src/Makefile.am (sc_tight_scope): Allow `*'s before the function name.
Use perl's -l option and drop the \n after (and quotes around) $1.
2011-03-28 11:51:35 +02:00
Pádraig Brady
99679fff62 df: fix alignment of columns
* src/df.c (alloc_table_row): A new function to allocate storage
for a row of strings.
(print_table): A new function to interate over all stored strings in
the table, and apply alignment honoring the max width of each column.
(get_header): Renamed from print_header, and adjusted accordingly.
(get_dev): Renamed from show_dev.  Also we no longer wrap longer
device names over two lines, which can be an unexpected issue for
scripts parsing the output from df.
(get_disk): s/show_/get_/
(get_point): Likewise.
(get_entry): Likewise.
(get_all_entries): Likewise.
* NEWS: Mention the change.
2011-03-23 16:44:49 +00:00
Jim Meyering
437fcf713c build: update gnulib submodule to latest 2011-03-22 07:13:59 +01:00
Jim Meyering
b3f6b33e4b tests: exercise tests new "==" operator
* tests/misc/test: Exercise the new operator.
* NEWS (Changes in behavior): Mention it.
2011-03-22 07:13:59 +01:00
David A. Wheeler
3f31ec950b test: accept "==" as a synonym for "="
Make GNU coreutils' test recognize "==" as a synonym for "=".
This is already the case in GNU coreutils' expr, bash, ksh,
busybox ash, FreeBSD-current /bin/sh and /bin/test, and
OpenBSD's /bin/sh.

Before, env test a '==' a would fail with this diagnostic:
"test: ==: binary operator expected".  Now, it succeeds.
* src/test.c: Accept "==" as a synonym for "=".
* doc/coreutils.texi (String tests): Document it.
Reported as http://debbugs.gnu.org/8263
Also see http://austingroupbugs.net/view.php?id=375
2011-03-22 07:12:01 +01:00
Jim Meyering
2a3a094e0d tests: fix a bug in the cp/preserve-gid test
* tests/cp/preserve-gid: Ensure that every process under test uses
the cp binary we've just built.  Before this fix, with a restrictive
umask or build-dir permissions, the UID-changing tests would end up
using whatever cp happened to be available through $PATH
Analysis by arbogast.cedric@gmail.com in http://debbugs.gnu.org/8292.
2011-03-21 07:37:20 +01:00
Paul Eggert
c20d0e17c3 bootstrap: do not exclude m4/message.m4
* bootstrap.conf (excluded_files): Don't exclude m4/lcmessage.m4,
as it's needed with the latest gnulib.
2011-03-20 12:25:26 -07:00
Jim Meyering
8e5292dfb8 maint: remove a name from THANKS.in that is derived from git log
The names in THANKS are generated from two sources: the hard-coded
list, THANKS.in, and the names of committers from the git log.
When a contributor on the hard-coded list commits a change,
we remove their now-redundant name from THANKS.in.
* THANKS.in: Remove a now-duplicate name.
2011-03-20 16:05:23 +01:00
Pádraig Brady
7a804b9af4 tests: fix the sparse-fiemap test
* tests/filefrag-extent-compare: Merge adjacent extents in
each list before processing, so we correctly account for
split extents in either list.
* tests/cp/sparse-fiemap: Remove the explicit syncing,
which was only changing the way extents were arranged,
and thus working around the extent comparison issue
that was seen on ext4 loop back.
2011-03-19 23:58:49 +00:00
Jim Meyering
4f591fdd0b sort: avoid memory pressure of 130MB/thread when reading from pipe
* src/sort.c (INPUT_FILE_SIZE_GUESS): Decrease initial allocation
factor used to size buffer used when reading a non-regular file.
For motivation, see discussion here:
http://thread.gmane.org/gmane.comp.gnu.coreutils.general/878/focus=887
2011-03-16 16:30:02 +01:00
Jim Meyering
8e4e1d484f maint: stop using .x-sc_* files to list syntax-check exemptions
Instead, use the brand new mechanism with which you merely use a
variable (derived from the rule name) defined in cfg.mk to an ERE
matching the exempted file names.
* gnulib: Update to latest, to get maint.mk that implements this.
* Makefile.am (syntax_check_exceptions): Remove variable.
(EXTRA_DIST): Remove use of the variable.
* cfg.mk (sc_x_sc_dist_check): Remove rule, no longer useful.
(exclude_file_name_regexp--sc_space_tab): Define variable.
(exclude_file_name_regexp--sc_bindtextdomain): Likewise.
(exclude_file_name_regexp--sc_unmarked_diagnostics): Likewise.
(exclude_file_name_regexp--sc_error_message_uppercase): Likewise.
(exclude_file_name_regexp--sc_trailing_blank): Likewise.
(exclude_file_name_regexp--sc_system_h_headers): Likewise.
(exclude_file_name_regexp--sc_require_config_h_first): Likewise.
(exclude_file_name_regexp--sc_require_config_h): Likewise.
(exclude_file_name_regexp--sc_po_check): Likewise.
(exclude_file_name_regexp--sc_prohibit_always-defined_macros): Likewise.
(exclude_file_name_regexp--sc_prohibit_empty_lines_at_EOF): Likewise.
(exclude_file_name_regexp--sc_program_name): Likewise.
(exclude_file_name_regexp--sc_file_system): Likewise.
(exclude_file_name_regexp--sc_prohibit_always_true_header_tests):
Likewise.
(exclude_file_name_regexp--sc_prohibit_fail_0): Likewise.
(exclude_file_name_regexp--sc_prohibit_atoi_atof): Likewise.
(exclude_file_name_regexp--sc_prohibit_tab_based_indentation): Likewise.
(exclude_file_name_regexp--sc_prohibit_stat_st_blocks): Likewise.
* configure.ac [whether localtime caches TZ]: Use return 0/1, not
exit (0/1) to avoid triggering a sc_prohibit_magic_number_exit failure.
* .x-sc_GPL_version: Remove file.
* .x-sc_bindtextdomain: Likewise.
* .x-sc_error_message_uppercase: Likewise.
* .x-sc_file_system: Likewise.
* .x-sc_obsolete_symbols: Likewise.
* .x-sc_po_check: Likewise.
* .x-sc_program_name: Likewise.
* .x-sc_prohibit_always-defined_macros: Likewise.
* .x-sc_prohibit_always_true_header_tests: Likewise.
* .x-sc_prohibit_atoi_atof: Likewise.
* .x-sc_prohibit_empty_lines_at_EOF: Likewise.
* .x-sc_prohibit_fail_0: Likewise.
* .x-sc_prohibit_magic_number_exit: Likewise.
* .x-sc_prohibit_stat_st_blocks: Likewise.
* .x-sc_prohibit_strcmp: Likewise.
* .x-sc_prohibit_tab_based_indentation: Likewise.
* .x-sc_require_config_h: Likewise.
* .x-sc_require_config_h_first: Likewise.
* .x-sc_space_tab (config): Likewise.
* .x-sc_sun_os_names: Likewise.
* .x-sc_system_h_headers: Likewise.
* .x-sc_trailing_blank: Likewise.
* .x-sc_unmarked_diagnostics: Likewise.
* .x-sc_useless_cpp_parens: Likewise.
2011-03-16 12:22:22 +01:00
Pádraig Brady
0ddfd54b08 maint: use wcswidth from gnulib
* gl/lib/mbsalign.c (rpl_wcswidth): Remove this in favor
of the equivalent wcswidth replacement in gnulib.
* bootstrap.conf: Depend on the wcswidth module.
Suggested by Bruno Haible.
2011-03-13 23:55:17 +00:00
Jim Meyering
56e8714e2b touch: update to latest gnulib to fix Solaris 10 touch segfault
* gnulib: Update to latest, to address http://debbugs.gnu.org/8230.
When built on Solaris 9 and run on Solaris 10, touch would segfault.
Reported by Ben Walton.
* bootstrap: Update from gnulib.
* tests/init.sh: Likewise.
* NEWS (Bug fixes): Mention this.
2011-03-13 18:41:44 +01:00
Jim Meyering
e0245ae0ae sort: spawn fewer threads for small inputs
* src/sort.c (SUBTHREAD_LINES_HEURISTIC): Do not spawn a new thread
for every 4 lines.  Increase this from 4 to 128K.  128K lines seems
appropriate for a 5-year-old dual-core laptop, but it is too low for
some common combinations of short lines and/or newer systems.
* NEWS (Bug fixes): Mention it.
2011-03-13 18:13:17 +01:00
Pádraig Brady
3ed0384c41 copy: merge similar extents before processing
* src/extent-scan.c (extent_scan_read):  Merge adjacent extents
that vary only in size, so that we may process them more efficiently.
This will be especially useful when we introduce fallocate()
so that we don't reproduce fragmentation in the destination.
2011-03-11 00:50:10 +00:00
Paul Eggert
194c1e89a4 dd: avoid or diagnose some problems with short reads
* src/dd.c (warn_partial_read): New static var.
(iread): Diagnose partial reads if needed.
(iwrite): Don't diagnose them here; not needed any more.
(scanargs): Determine whether partial reads should be diagnosted.
2011-03-05 16:06:34 -08:00
Pádraig Brady
5bf48c1186 maint: fix dd nocache test to be independent of current stdin
* tests/dd/nocache: Don't assume stdin is a pipe
2011-03-05 09:53:00 +00:00
Pádraig Brady
5f3115535b dd: add a flag to discard cached data
* src/dd.c (FFS_MASK): A new macro (Find First Set) refactored
from the following enum as it's now used twice.
(usage): Mention the new 'nocache' flag.
(cache_round): A new function to help ignore requests
to drop cache, that are less than page_size.
(invalidate_cache): A new function to call posix_fadvise()
with the appropriate offset and length.  Note we don't
use fdadvise() so we can detect errors when count=0.
(dd_copy): Call invalidate_cache() for the portions read.
(iwrite): Likewise for the portions written.
(main): Call invalidate_cache for page_size slop or
for full file when count=0.
* cfg.mk (sc_dd_O_FLAGS): Adjust to pass.
* doc/coreutils.texi (dd invocation): Describe the 'nocache' flag,
and give some examples of how it can be used.
* tests/dd/nocache: A new test.
* tests/Makefile.am: Reference the new test.
* NEWS: Mention the new feature.
2011-03-05 02:33:53 +00:00
Pádraig Brady
433a7c614f doc: clarify that dd bs= can immediately output short reads
* doc/coreutils.texi (dd invocation): Clarify that bs= can
cause parital reads to be immediately written to output.
* src/dd.c (usage): Hint that bs= can cause partial writes.
See http://debbugs.gnu.org/cgi/bugreport.cgi?bug=8171
2011-03-05 02:21:45 +00:00
Pádraig Brady
7525860fb9 doc: group dd conv= options that are actually flags
* src/dd.c (usage): Move 'sync' up with other data transformation
options.  Having it alongside 'fsync' and 'fdatasync' is
particularly confusing.  Also the double line description of
the 'sync' option, serves as a visual break from the "flag"
type options that follow.
* doc/coreutils.texi (dd invocation):  Apply the same grouping
as above, by splitting the "conv=" table in two.
2011-03-05 02:01:16 +00:00
Pádraig Brady
e1788d9ed9 dd: warn when we disable oflag=direct not at EOF
An alternative to this is to auto enable iflag=fullblock
when oflag=direct and bs= is specified.
It was thought better though, to warn about the specific issue,
and give full control of dd's options to the user.

* src/dd.c (iwrite): Warn, when we write after having
disabled O_DIRECT.
See https://bugzilla.redhat.com/show_bug.cgi?id=614605
2011-03-05 01:48:55 +00:00
Jim Meyering
caaf2899f6 du: don't infloop for --files0-from=DIR
* src/du.c (main): Fail on AI_ERR_READ error, rather than merely
diagnosing and continuing.  Based on a patch by Stefan Vargyas.
Also move the handling of AI_ERR_EOF into the case stmt.
Do not report ferror/fclose(stdin) failure when we've
already diagnosed e.g., failure to read the DIR, above.
Bug introduced by 2008-11-24 commit 031e2fb5, "du: read and
process --files0-from= input a name at a time,".
* src/wc.c: Handle read failure as with du: do not exit
immediately, but rather go on to print any total and to clean-up.
As above, move the handling of AI_ERR_EOF into the case stmt.
* tests/du/files0-from-dir: New file, to test both du and wc.
* tests/Makefile.am (TESTS): Add it.
* NEWS (Bug fixes): Mention it.
2011-03-03 09:05:44 +01:00
Jim Meyering
7cfd12c78e wc: avoid NULL dereference on out-of-memory error
* src/wc.c (main): Diagnose failed argv_iter_init_* failure,
rather than falling through and dereferencing NULL.
Bug introduced by 2008-11-25 commit c2e56e0d,
"wc: read and process --files0-from= input a name at a time,".
* NEWS (Bug fixes): Mention it.
2011-03-03 09:01:17 +01:00
Pádraig Brady
a132e03507 tests: without filefrag, only skip part of sparse-fiemap
* tests/cp/sparse-fiemap: Move the PERL check to the top,
since we don't test anything without it.  In the loop,
don't use skip_test_ as it exits the test completely.
2011-02-25 07:30:09 +00:00
Gilles Espinasse
269665866d maint: replace spaces with tab in tests/Makefile.am
* tests/Makefile.am: Replace spaces with tabs for consistency
2011-02-19 23:09:09 +00:00
Jim Meyering
2895f44e89 stdbuf: avoid even the appearance of a possible use-after-free
There was an execution path by which "libstdbuf" could be used after
being freed, but that would happen only if there were no libstdbuf.so
alongside the stdbuf program and there had been an installation error
leading to absence of the file, PKGLIBDIR/libstdbuf.so.
* src/stdbuf.c (set_LD_PRELOAD): Rearrange loop to make it perfectly
clear that there is no possibility of use-after-free.
Steve Grubb reported this possible use-after-free of "libstdbuf".
2011-02-18 23:31:29 +01:00
Gilles Espinasse
e6067bcb04 tests: correct racy sparse-to-pipe test
* tests/cp/sparse-to-pipe: Wait for backgrounded "cat" to complete
before comparing the results.
2011-02-18 13:52:21 +01:00
Paul Eggert
43066fe2ca uptime: omit unnecessary #if
* src/uptime.c (print_uptime): Omit unnecessary "#if defined
HAVE_GETLOADAVG || defined C_GETLOADAVG".  This #if is always
true, and removing it will help us simplify the gnulib getloadavg
module.
2011-02-14 21:05:55 -08:00
Pádraig Brady
0f56019db8 tests: support more file systems in the cp fiemap tests
* tests/cp/sparse-fiemap: Check for fiemap support against a file
rather than a directory to enable tests on BTRFS for example.
Explicity disable the test on ext3 or file systems where we
can't determine the type.
* tests/cp/fiemap-perf: Likewise.  Also disable the test on older
BTRFS (like in Fedora 14), where extents are returned for holes.
* tests/init.cfg: Comment that BTRFS only supports fiemap
for regular files.
2011-02-15 00:02:29 +00:00
Pádraig Brady
275c831a3c copy: adjust fiemap handling of sparse files
Don't depend on heuristics to detect sparse files
if fiemap is available.  Also don't scan for new
holes unless --sparse=always has been specified.

* src/copy.c (extent_copy): Pass the user specified
sparse mode, and handle as described above.
2011-02-11 00:13:31 +00:00
Pádraig Brady
6f95025c9d copy: suppress redundant lseeks when using fiemap
* src/copy.c (extent_copy): Suppress redundant lseek()s in both
the source and dest files, when there is no hole between extents.
2011-02-11 00:13:31 +00:00
Jim Meyering
15571e0c8f tests: fix bug in preceding check.mk change
* tests/check.mk (.built-programs): Run cd'd submake in a subshell
so the redirected output ends up in the current directory, not ../src.
2011-02-10 10:01:23 +01:00
Jim Meyering
c91b2a3c3b tests: print "python missing:..." diagnostic where more will see it
* tests/init.cfg (fiemap_capable_): Print with warn_, so that the
diagnostic shows up alongside the corresponding SKIP message.
2011-02-10 08:57:12 +01:00
Jim Meyering
ee6c466ba8 tests: avoid gross inefficiency in "make test"
Do not run a sub-make to set up the environment for each
and every test script.  Instead, run it just once and store
the result in a file.
* tests/check.mk (built_programs): Remove definition.
(.built-programs): New rule to create the temporary file.
(CLEANFILES): Arrange to remove it.
(TESTS_ENVIRONMENT): Simply cat .built-programs, rather than
running the sub-make.
* .gitignore: Ignore it.
2011-02-10 08:50:14 +01:00
Pádraig Brady
5c3fd50a75 test: improve the cp fiemap tests
* tests/cp/fiemap-2: Enable the fiemap check for files, which
will enable the test for files on ext3.
* tests/cp/fiemap-perf: Comment why we're not enabling for ext3.
* tests/cp/sparse-fiemap: Ditto.  Also sync the files before
doing a fiemap which was needed for ext4 loop back at least.
Add a comment that FIEMAP_FLAG_SYNC is ineffective, thus
requiring the explicit syncs.
* tests/fiemap-capable: A new python script to determine
if a specified path supports fiemap.
* tests/init.cfg (fiemap_capable_): Use the new python script.
* tests/Makefile.am (EXTRA_DIST): Include the new python script.
2011-02-08 22:46:25 +00:00
Jim Meyering
480c0dc9e7 tests: randread-tests: use macro.h not "#define ASSERT..."
* gl/modules/randread-tests (Files): Add tests/macros.h
* gl/tests/test-rand-isaac.c: Remove now-unneeded #include directives.
(ASSERT): Remove definition.
Instead, include "macros.h".
Prompted by suggestions from Bruno Haible.
2011-02-08 08:30:19 +01:00
Jim Meyering
beaf631292 maint: move di-set and ino-map modules from ./gl to gnulib
* gl/lib/di-set.c: Remove file.
* gl/lib/di-set.h: Likewise.
* gl/lib/ino-map.c: Likewise.
* gl/lib/ino-map.h: Likewise.
* gl/modules/di-set: Likewise.
* gl/modules/di-set-tests: Likewise.
* gl/modules/ino-map: Likewise.
* gl/modules/ino-map-tests: Likewise.
* gl/tests/test-di-set.c: Likewise.
* gl/tests/test-ino-map.c: Likewise.
* gnulib: Update to latest, now that these two modules are there.
2011-02-07 16:24:14 +01:00
Jim Meyering
b9fc790ddc di-set: provide a lookup method
This is required for patch, and hence is about to move to gnulib.
* gl/lib/di-set.c (di_set_lookup): New function.
* gl/lib/di-set.h: Declare it.
* gl/tests/test-di-set.c (main): Exercise it.

The bug was introduced on 2004-12-04 via commit 7380cf79.
2011-02-07 15:50:44 +01:00
Jim Meyering
2e636af1ef cut: don't segfault for large unbounded range
* src/cut.c (set_fields): When computing the maximum range endpoint,
take into consideration the start of any unbounded range, like "999-".
* NEWS (Bug fixes): Mention it.
* tests/misc/cut (big-unbounded-b,c,f): Add tests.
Reported by Paul Marinescu in http://debbugs.gnu.org/7993
The bug was introduced on 2004-12-04 via commit 7380cf79.
2011-02-07 09:25:51 +01:00
Jim Meyering
9f61806875 copy: don't let a failed lseek go undiagnosed
Upon failed lseek, sparse_copy_finalize would mistakenly return true.
Admittedly, that is very unlikely, since that particular lseek
is attempted only if the preceding call to sparse_copy induced
a hole at EOF (via lseek on the destination FD).  However, now
that sparse_copy has an output parameter, N_READ, there is no
longer any reason to call lseek (fd, 0, SEEK_CUR), so...
* src/copy.c (sparse_copy_finalize): Remove the function.
(copy_reg): Call ftruncate with n_read, rather than
sparse_copy_finalize with its now-unnecessary lseek.
Lasse Collin spotted the bug in sparse_copy_finalize.
2011-02-05 22:40:57 +01:00
Jim Meyering
661413d8c3 post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2011-02-04 18:19:36 +01:00
Jim Meyering
ca637bff0e version 8.10
* NEWS: Record release date.
2011-02-04 18:08:12 +01:00
Jim Meyering
d5fa424a9c cp: avoid spurious failure on any non-linux kernel
* src/extent-scan.c (extent_scan_read) [!linux]: Always set
scan->initial_scan_failed so caller knows not to report the failure.
2011-02-04 15:01:39 +01:00
Jim Meyering
ee74c7d36d tests: skip mv/i-3 on FreeBSD to avoid spurious failure
* tests/mv/i-3: Skip when uname -s reports FreeBSD.
2011-02-04 14:59:03 +01:00
Pádraig Brady
d846bc8bab sort: fix --debug key highlighting when key start after key end
This case was overlooked in commit bdde34f9, 2010-08-05,
"sort: tune and refactor --debug code, and fix minor underlining bug"

* src/sort.c (debug_key):  Don't adjust the key end when
it's before the key start.
* tests/misc/sort-debug-keys: Add a test case.
2011-02-03 10:19:34 +00:00
Jim Meyering
4e9ab7d3d8 tests: correct part of fiemap-perf
* tests/cp/fiemap-perf: Correct erroneous added test.
Since nonexistent names were used, the final test ended up
being "test =", which would always "succeed".
2011-02-02 12:02:22 +01:00
Jim Meyering
78ee2953bf build: update gnulib submodule to latest 2011-02-02 09:40:55 +01:00
Pádraig Brady
84e5274f7e cp: fix the buffer size used when writing zeros
* src/copy.c (write_zeros): This bug caused 4 or 8 bytes to
be written at a time which is very inefficient.  One could
trigger the issue with `cp --sparse=never sparse non-sparse`
on a file system that supports fiemap.
2011-01-31 23:21:04 +00:00
Jim Meyering
f8f57dd76b cp: always initialize extent_copy's output parameter
* src/copy.c (extent_copy): Otherwise it would be used uninitialized.
2011-01-31 20:55:34 +01:00
Jim Meyering
43d739e99c tests: exercise a rarely-used corner of copy.c
* tests/cp/sparse-to-pipe: New test.
* tests/Makefile.am (TESTS): Add it.
2011-01-31 18:26:06 +01:00
Jim Meyering
cc0645fc64 cp: fix copying a sparse file to a pipe
The recent FIEMAP-related changes made it so the unusual case of
copying a sparse file to a non-regular destination (e.g., a pipe)
would erroneously write one byte too many to that destination.
That happened because extent_copy assumed that it could use lseek
to obtain the number of bytes written to the output file descriptor.
That was valid only for regular files.
* src/copy.c (sparse_copy): Add a parameter, to be used by extent_copy,
but not by reg_copy.  Adjust callers.
(extent_copy): Maintain new local, dest_pos, using new arg, n_read.
Don't call lseek on dest_fd; use new var, dest_pos, instead.
(copy_reg): Add unused arg.
2011-01-31 18:26:06 +01:00
Jim Meyering
96a93f9480 tests: gfs2 also supports FIEMAP
* tests/init.cfg (fiemap_capable_): Add gfs2.
Clarify comment.
2011-01-31 15:20:29 +01:00
Jim Meyering
aeed6c1d89 maint: remove unused inclusion of "fiemap.h"
* src/copy.c: Don't include "fiemap.h".
2011-01-31 15:17:12 +01:00
Jim Meyering
3aae01fa9b tests: factor fiemap-related predicate into init.cfg
* tests/init.cfg (fiemap_capable_): New function.
* tests/cp/fiemap-perf: Use it.
* tests/cp/sparse-fiemap: Likewise.
* tests/cp/fiemap-2: Likewise.
2011-01-31 14:44:15 +01:00
Jim Meyering
31dc21f693 maint: update copyright year lists in new files
* src/extent-scan.h: Update copyright year list.
* src/extent-scan.c: Likewise.
* tests/cp/sparse-fiemap: Likewise.
2011-01-31 13:42:49 +01:00
Jim Meyering
08b7bce540 tests: modernize sparse-fiemap test
* tests/cp/sparse-fiemap: Use print_ver_, not open-coded VERBOSE test.
2011-01-31 13:40:26 +01:00
Jim Meyering
040b00ef19 tests: remove duplicate fiemap-perf test
* tests/cp/fiemap-perf: Copy block-comparing code from sparse-fiemap.
* tests/cp/sparse-fiemap: The same test was here, alongside a much
more involved test.  Remove it, now that it is in its own file.
2011-01-31 13:35:55 +01:00
Jim Meyering
5b11cd0179 doc: NEWS: mention cp's improvement
* NEWS (New Features): cp now copies sparse files efficiently.
2011-01-30 21:30:35 +01:00
Jim Meyering
199355e234 build: update gnulib submodule to latest 2011-01-30 20:44:12 +01:00
Jim Meyering
fc3c8e3cdd copy, tee: assume EINTR is always defined: remove #ifdefs
Don't use "#ifdef EINTR".  dd.c has been doing that since 2004.
* src/copy.c (sparse_copy): Remove #ifdef...#endif around EINTR use.
* src/tee.c (tee_files): Remove #ifdef...#endif around EINTR use.
If we need it, add something like this in system.h:
/* When EINTR is not defined, define it to an improbable value
   so that each use does not have to be #ifdef'd.  */
 #ifndef EINTR
 # define EINTR 999988
 #endif
2011-01-30 20:44:12 +01:00
Jim Meyering
54602c76a0 tests: cp/fiemap: exercise previously-failing parts
* tests/cp/fiemap-2: New test.
* tests/Makefile.am (TESTS): Add it.
2011-01-30 20:44:12 +01:00
Jim Meyering
0f91b6174e copy: make extent_copy use sparse_copy, rather than its own code
* src/copy.c (extent_copy): Before this change, extent_copy would fail
to create holes, thus breaking --sparse=auto and --sparse=always.
I.e., copying a large enough file of all zeros, cp --sparse=always
should introduce a hole, but with extent_copy, it would not.
2011-01-30 20:44:12 +01:00
Jim Meyering
8da69cbf30 copy: remove obsolete comment
* src/copy.c (sparse_copy): Remove now-obsolete comment about
how we used to work around lack of ftruncate.  Combine nested
if conditions into one.
2011-01-30 20:44:12 +01:00
Jim Meyering
82c7f192bd copy: factor sparse-copying code into its own function, because
we're going to have to use it from within extent_copy, too.
* src/copy.c (sparse_copy): New function, factored out of...
(copy_reg): ...here.
Remove now-unused locals.
2011-01-30 20:44:12 +01:00
Jim Meyering
f5743a6f20 fiemap copy: avoid leak-on-error
* src/copy.c (extent_copy): Don't leak an extent_scan buffer on
failed lseek, read, or write.
2011-01-30 20:44:12 +01:00
Jim Meyering
3953f7523e fiemap copy: avoid a performance hit due to very small buffer
* src/copy.c (extent_copy): Don't let what should have been a
temporary reduction of buf_size (to handle a short ext_len) become
permanent and thus impact the performance of all further iterations.
2011-01-30 20:44:12 +01:00
Jim Meyering
cfbeeafd4a fiemap copy: simplify post-loop logic; improve comments
* src/copy.c (extent_copy): Avoid duplication in post-loop
extend-to-desired-length code.
2011-01-30 20:44:11 +01:00
Jim Meyering
f4473df430 fiemap copy: rename some locals
(extent_copy): Rename locals: s/*ext_logical/*ext_start/
2011-01-30 20:44:11 +01:00
Jim Meyering
72b86ad4e8 tests: ensure that FIEMAP-enabled cp copies a sparse file efficiently
* tests/cp/fiemap-perf: New file.
* tests/Makefile.am (TESTS): Add it.
2011-01-30 20:44:11 +01:00
Jim Meyering
790a4654ae copy: don't allocate a separate buffer just for extent-based copy
* src/copy.c (copy_reg): Move use of extent_scan to just *after*
we allocate the main copying buffer, so we can...
(extent_scan): Take a new parameter, BUF, and use that rather
than allocating a private buffer.  Update caller.
2011-01-30 20:44:11 +01:00
Jim Meyering
ce3c73dddd copy: tweak variable name; improve a comment
* src/copy.c (copy_reg): Rename a variable to make more sense from
caller's perspective: s/require_normal_copy/normal_copy_required/.
This is an output-only variable, and the original name could make
it look like an input (or i&o) variable.
2011-01-30 20:44:11 +01:00
Jim Meyering
0497a86f70 copy: call extent_copy also when make_holes is false, ...
so that we benefit from using extents also when reading a sparse
input file with --sparse=never.
* src/copy.c (copy_reg): Remove erroneous test of "make_holes"
so that we call extent_copy also when make_holes is false.
Otherwise, what's the point of that parameter?
2011-01-30 20:44:11 +01:00
Jim Meyering
8ecb0c76c3 copy: remove else-after-goto and adjust indentation
* src/copy.c (copy_reg): Remove useless else-after-goto.
2011-01-30 20:44:11 +01:00
Jim Meyering
50040d07e1 extent-scan: adjust naming and formatting
* src/extent-scan.h [struct extent_scan]: Rename member:
s/hit_last_extent/hit_final_extent/.  "final" is clearer,
since "last" can be interpreted as "preceding".
Rename extent-scan functions to start with extent_scan_.
* src/Makefile.am (copy_sources): Also distribute extent-scan.h.
* src/extent-scan.c: Don't include error.h or quote.h.  Neither is used.
* src/copy.c: shorten a comment to fit in 80 columns
* src/extent-scan.c, src/extent-scan.h: Correct formatting.
2011-01-30 20:44:11 +01:00
Jim Meyering
0b9f65dc01 fiemap copy: don't let write failure go unreported; adjust style, etc.
* src/copy.c (write_zeros): Add comments.
(extent_copy): Move decls of "ok" and "i" down to scope where used.
Adjust comments.
Rename local: s/holes_len/hole_size/
Print a diagnostic upon failure to write zeros.
2011-01-30 20:44:11 +01:00
jeff.liu
2db1433eab fiemap copy: add extent-scan.[ch], avoid a double-free and reorganize
Changes:
========
1. fix write_zeros() per Jim's comments.
2. remove char const *fname from struct extent_scan.
3. change the signature of open_extent_scan() from
"void open_extent_scan(struct extent_scan **scan)" to
"void open_extent_scan(struct extent_scan *scan)" to avoid having
to malloc the extent_scan variable; instead save it on the stack.
4. move close_extent_scan() from a function defined in extent-scan.c
to extent-scan.h as a macro definition, but it does nothing for now,
since initial extent scan defined at stack.
5. add a macro "free_extents_info()" defined at extent-scan.h to
release the memory allocated to extent info which should be called
combine with get_extents_info(), it just one line, so IMHO, define
it as macro should be ok.

* src/extent-scan.c: New file; functions to read "extents".
* src/extent-scan.h: Header file of extent-scan.c.
* src/Makefile.am: Reference it and link it to copy_source.
* src/copy.c: Use the new functions and avoid double-free.
2011-01-30 20:44:11 +01:00
Jim Meyering
f3e78eeff2 build: distribute new test script, filefrag-extent-compare
* tests/Makefile.am (EXTRA_DIST): Add filefrag-extent-compare.
2011-01-30 20:44:11 +01:00
Jim Meyering
a50ca679a1 build: distribute new file, fiemap.h
* src/Makefile.am (noinst_HEADERS): Add fiemap.h.
2011-01-30 20:44:11 +01:00
Jie Liu
d232c1cc20 copy.c: add FIEMAP_FLAG_SYNC to fiemap ioctl
* src/copy.c (fiemap_copy): Force kernel to sync the source
file before mapping.
2011-01-30 20:44:11 +01:00
Jim Meyering
6c81b97a58 fiemap.h: include <stdint.h>, not <linux/types.h>
* src/fiemap.h: Include stdint.h, not linux/types.h,
now that this file uses only portable type names.
2011-01-30 20:44:11 +01:00
Paul Eggert
a40a8fe1e5 copy.c: ensure proper alignment of fiemap buffer
* src/copy.c (fiemap_copy): Ensure that our fiemap buffer
is large enough and well-aligned.
Replace "0LL" with equivalent "0" as 3rd argument to lseek.
2011-01-30 20:44:11 +01:00
Jim Meyering
3058ffa501 copy.c: adjust comments, tweak semantics
* src/copy.c (fiemap_copy): Rename from fiemap_copy_ok.
Add/improve comments.
Remove local, "fail".
(fiemap_copy): Do not require caller to set
"normal_copy_required" before calling fiemap_copy.
Report ioctl failure if it's the 2nd or subsequent call.
2011-01-30 20:44:11 +01:00
Jim Meyering
d6fad2aa33 tests: relax the root-tests cross-check
* cfg.mk (sc_root_tests): Allow spaces before "require_root_",
now that tests/cp/sparse-fiemap has a conditional use.
2011-01-30 20:44:11 +01:00
Jim Meyering
5106653c26 tests: accommodate varying filefrag -v "flags" output
* tests/cp/sparse-fiemap: Accommodate values other than "eof"
in the "flags" column of filefrag -v output
2011-01-30 20:44:10 +01:00
Jim Meyering
dc05bc7ee2 tests: exercise more of the new FIEMAP copying code
* tests/cp/sparse-fiemap: Ensure that a file with many extents
(more than fit in copy.c's internal buffer) is copied properly.
Don't require root access if current partition is btrfs or xfs.
Use init.sh, not test-lib.sh.
* tests/filefrag-extent-compare: New file.
2011-01-30 20:44:10 +01:00
Jie Liu
f1a6f220f5 tests: add a new test for FIEMAP-copy
* tests/cp/sparse-fiemap: Add a new test for FIEMAP-copy against a
loopbacked ext4 partition.
* tests/Makefile.am (sparse-fiemap): Reference the new test.
2011-01-30 20:44:10 +01:00
Jie Liu
dff2b95e4f cp: copy sparse files efficiently using the FIEMAP ioctl
* src/fiemap.h: Add fiemap.h for fiemap ioctl(2) support.  Copied
from linux's include/linux/fiemap.h, with minor formatting changes.
* src/copy.c (copy_reg): Now, when `cp' is invoked with --sparse=[WHEN],
we will try to do FIEMAP-copy if the underlying file system
supports it, and fall back to a normal copy if it fails.
2011-01-30 20:44:10 +01:00
Pádraig Brady
38cdb01a32 doc: add alternatives for field processing not supported by cut
* doc/coreutils.texi (cut invocation): Remove the tr -s '[:blank:]'
example, as it doesn't handle leading and trailing blanks.  Add `awk`
examples for common field processing operations often asked about.
Also document a `join` hack, to achieve the same thing.  Note the
join options are ordered so as to be compatible with other systems.
2011-01-29 23:48:36 +00:00
Pádraig Brady
877ca5bf85 join: don't report disorder against an empty file
This allows one to use join as a field extractor like:
  join -a1 -o 1.3,1.1 - /dev/null

* src/join.c (join): Don't flag unpairable lines when
one of the files is empty.
* tests/misc/join: Add a new test for empty input, and adjust
a previous test that was only checking against empty input.
* doc/coreutils.texi (join invocation): Document the change.
* NEWS: Likewise.
2011-01-29 23:39:16 +00:00
Pádraig Brady
32626bde6d join: ensure --header skips the order check with empty files
* src/join.c: Skip the header even if one of the files is empty.
* tests/misc/join: Add a test case.
* NEWS: Mention the fix
2011-01-29 23:33:25 +00:00
Pádraig Brady
d4db0cb182 join: add -o 'auto' to output a constant number of fields per line
Lines with a different number of fields than the first line,
will be truncated or padded.

* src/join.c (prfields): A new function refactored from prjoin(),
to output all but the join field.
(prjoin): Don't swap line1 and line2 when line1 is blank
so that the padding is applied to the right place.
(main): Handle the -o 'auto' option.
* tests/misc/join: Add 6 new cases to test the auto format.
* NEWS: Mention the change in behavior.
Suggestion from Assaf Gordon
2011-01-29 23:08:31 +00:00
Jim Meyering
68a734d66b tests: remove obsolete uses of "$$" in temporary file names
Those were useful when tests might have been run in the same
directory and in parallel.  Now, each test is run in a newly-
created empty directory.
* tests/cp/backup-1: Remove obsolete uses of "$$".
* tests/cp/same-file: Likewise.
* tests/dd/misc: Likewise.
* tests/mv/part-symlink: Likewise.
* tests/mv/to-symlink: Likewise.
* tests/touch/fail-diag: Likewise.
2011-01-28 23:19:45 +01:00
Jim Meyering
034e496e98 tests: don't hide all trace of the vc_exe_in_TESTS test
There was a non-negligible delay after running a single test.
Now, you'll know why when you see this test's name.
* tests/check.mk (vc_exe_in_TESTS): Don't @-hide commands.
Use $(AM_V_GEN) instead.
2011-01-26 08:38:56 +01:00
Andreas Schwab
d255e40c37 tests: minor correction
* tests/du/move-dir-while-traversing: Ignoring SIGTSTP is enough;
don't also attempt to ignore SIGSTOP, it cannot be handled or ignored.
Spotted by Andreas Schwab.
2011-01-25 18:29:10 +01:00
Jim Meyering
56699864f6 tests: avoid FP failure due to suspension
* tests/du/move-dir-while-traversing: Prohibit suspension,
to avoid false-positive failure.
2011-01-25 12:41:47 +01:00
Jim Meyering
5c501f6fba tests: avoid rare FP failure in new du test
* tests/du/move-dir-while-traversing: Create an even larger tree
to avoid a false-positive failure due to du terminating before
the rename is triggered.
2011-01-25 12:41:42 +01:00
Jim Meyering
15ea577af7 split: avoid a new, spurious warning from gcc-4.6.0
* src/split.c (lines_rr) [IF_LINT]: Initialize files, now that
rawhide's gcc-4.6.0 would otherwise warn about use-uninitialized.
2011-01-24 10:02:22 +01:00
Jim Meyering
8264fc615a tail: avoid new diagnostic when applying -f to a pipe on linux-2.3.38
* src/tail.c (fremote): Do not print a diagnostic when
fstatfs (pipe_FD, &buf) fails, as it now does on linux-2.3.38.
This avoids the spurious failure of tests/misc/tail's f-pipe-1
test, when running in input-from-pipe mode.
2011-01-24 10:02:19 +01:00
Jim Meyering
4afbba7bac doc: fix wording in warning about potential conflict with built-in
* doc/coreutils.texi (mayConflictWithShellBuiltIn): Fix wording.
2011-01-21 22:25:11 +01:00
Paul Eggert
4f92531819 manual: document floating point better
* doc/coreutils.texi (Floating point): New section.
(od invocation, tail invocation, sort invocation, printf invocation):
(sleep invocation, seq invocation): Refer and defer to it.  See
<http://lists.gnu.org/archive/html/bug-coreutils/2011-01/msg00031.html>.
2011-01-21 10:59:52 -08:00
Jim Meyering
e0c6272ac3 build: update gnulib submodule to latest
The previous gnulib submodule reference was *still* to a
non-public commit.  My submodule had a stray commit, so
the reference was always to a local merge commit.
Reported by Rob Vermaas.
2011-01-20 10:50:24 +01:00
Jim Meyering
6344402389 build: update gnulib submodule to latest
The previous gnulib submodule reference was to a non-public commit.
Reported by Rob Vermaas.
2011-01-20 10:07:08 +01:00
Jim Meyering
948828b208 maint: use slightly more efficient process in README-release
* README-release: Run cheaper root-only tests first.
Use half of processing units (not just 1) for the expensive tests.
2011-01-19 08:35:36 +01:00
Jim Meyering
7e72d4fe9d tests: avoid FP failure in new du test
* tests/du/move-dir-while-traversing: Create a larger tree to
avoid a false-positive failure due to du terminating before
the rename is triggered.
2011-01-18 22:32:33 +01:00
Jim Meyering
5c75d1da85 build: update gnulib submodule to latest 2011-01-18 21:07:57 +01:00
Jim Meyering
34ece0b0a1 doc: update NEWS
* NEWS: Note when the uniq bug was introduced.
It was mine, commit 1d9b3de9, "uniq: remove redundant test".
2011-01-18 09:45:00 +01:00
Jim Meyering
0f9cf6b545 doc: show how to shred more efficiently
* doc/coreutils.texi (shred invocation): Give an example showing how
to invoke shred in single-pass mode, and warn that -n0 --zero may
be inadequate.
2011-01-17 19:16:43 +01:00
Jim Meyering
bdaef0686f uniq: replace a wasteful loop with simple calculation
* src/uniq.c (find_field): Remove the byte-skipping loop altogether.
Instead, perform the simple calculation.  This results in a 10%
performance improvement for large byte offsets.
2011-01-17 19:07:58 +01:00
Jim Meyering
1f0653066c tests: add a test for today's uniq bug
* tests/misc/uniq-perf: New file.
* tests/Makefile.am (TESTS): Add it.
2011-01-17 19:07:58 +01:00
Sami Kerola
aa9f02bc30 uniq: don't continue field processing after end of line
* NEWS (Bug fixes): Mention it.
* src/uniq.c (find_field): Stop processing loop when end of line
is reached.  Before this fix, 'uniq -f 10000000000 /etc/passwd'
would run for a very long time.
2011-01-17 19:07:58 +01:00
Ondřej Vašík
442b068ac1 doc: specify how tr, echo, printf treat octal numbers
* doc/coreutils.texi (tr's Character sets): Document how a 9-bit
octal value is interpreted.  tr does not ignore the ninth bit.
(echo invocation, printf invocation): Document that any ninth
bit in \OOO is ignored. (http://debbugs.gnu.org/7574)
2011-01-15 11:49:31 +01:00
Pádraig Brady
eab97b3075 maint: refactor to use read-file from gnulib
* bootstrap.conf: Add the read-file module
* src/ptx.c: Replace the original code which would
needlessly read SIZE_MAX bytes of files larger than this.
* src/shuf.c: Replace the original code.
2011-01-14 18:06:41 +00:00
Pádraig Brady
e1aaf8903d maint: trivial system header file cleanups
* src/system.h: Note where it should be included, and
make ordering check portable to GLIBC > 2
* src/copy.c: Move <sys/ioctl.h> along with other system headers
as is done elsewhere.
* src/install.c: Move <sys/wait.h> along with other system headers
as is done elsewhere.
* src/ptx.c: Include <regex.h> rather than "regex.h" as
is done elsewhere.  Note <regex.h> is kept after "system.h"
as per commit dba300a0.
2011-01-13 17:28:36 +00:00
Jim Meyering
d95e3c8ceb doc: clean up HACKING guidelines
* HACKING: Remove mention of "indent-tabs-mode: nil", since
we've remove all of those directives.  No longer needed.
Remove dated (pre-emacs-23) reference regarding WhiteSpace mode.
2011-01-12 21:21:26 +01:00
Paul Eggert
11d864b36d gnulib: Also use dtoastr and ldtoastr modules.
This adjusts to the recent splitting of the ftoastr module into 3
<http://lists.gnu.org/archive/html/bug-gnulib/2011-01/msg00199.html>.
* bootstrap.conf (gnulib_modules): Add dtoastr, ldtoastr,
as coreutils needs all 3 modules now.
2011-01-11 18:10:03 -08:00
Paul Eggert
3292610bce build: update gnulib submodule to latest 2011-01-11 18:09:42 -08:00
Nadav Har'El
731f957965 rm: ignore errno related to invalid file names
* src/remove.c (nonexistent_file_errno): Also skip EINVAL and
EILSEQ, for at least smbfs rejection of '*' in file names.
* NEWS: Mention the fix.
2011-01-11 11:48:53 -07:00
Jim Meyering
db1034ddaf build: update gnulib submodule to latest 2011-01-10 07:59:00 +01:00
Jim Meyering
1c5987d2ef du: don't abort when a subdir is renamed during traversal
* NEWS (Bug fixes): Mention it.
* src/du.c (prev_level): Move declaration "up" to file-scope global.
(du_files): Reset prev_level to 0 upon abnormal fts_read termination.
Reported by Johathan Nieder in http://bugs.debian.org/609049
Also, improve a diagnostic.
* tests/du/move-dir-while-traversing: Test for the above.
* tests/Makefile.am (TESTS): Add it.
2011-01-10 07:49:55 +01:00
Pádraig Brady
d5d283dbc9 maint: suppress some clang scan-build warnings
* src/pr.c (char_to_clump): Remove a dead store.
* src/remove.c (fts_skip_tree): Likewise.
* src/sort.c (key_warnings): Likewise.
(sort): Suppress an uninitialized pointer warning.
2011-01-07 11:20:48 +00:00
Pádraig Brady
f331653fe8 maint: replace uses of ignore_ptr with ignore_value
* gnulib: Update for enhanced ignore_value()
* src/chcon.c (process_file): Don't use the deprecated ignore_ptr.
* src/chmod.c (process_file): Likewise.
* src/chown-core.c (change_file_owner): Likewise.
2011-01-07 02:09:32 +00:00
Jim Meyering
d6df8901bc post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2011-01-04 12:56:30 +01:00
Jim Meyering
b44b8f2b7d version 8.9
* NEWS: Record release date.
2011-01-04 12:18:32 +01:00
Jim Meyering
e43b19c4c8 build: update gnulib to latest; portability fixes 2011-01-04 12:17:21 +01:00
Jim Meyering
9d6231ef2a maint: update all copyright year number ranges
Run "make update-copyright".
2011-01-01 22:16:47 +01:00
Jim Meyering
257909013e build: update gnulib for version-etc copyright year update
* tests/sample-test: Update copyright to 2011, to appease syntax-check.
2011-01-01 22:16:35 +01:00
Jim Meyering
9a008a9e24 maint: generate much of the THANKS file
Before this change, we had a tendency to manually list each
contributor's name in THANKS.  Now, each commit "Author" is
included in the generated THANKS file automatically, and most
of the old THANKS file is now a template, THANKS.in.
We'll still have to manually list the names of people who report
problems without a usable patch.

* THANKS.in: New file, derived from THANKS, but removing names of
those who are listed as git log 'Author:'s.
* THANKS: Remove file.
* thanks-gen: New file.
* Makefile.am (THANKS): New rule.
(EXTRA_DIST): Add .mailmap, THANKS.in and thanks-gen.
* .gitignore: Add THANKS and THANKS-to-translators.
* .mailmap: Unify on single address and name-spelling per contributor.
2011-01-01 10:56:49 +01:00
Eric Blake
6b3f52e94f maint: update to latest gnulib, for testsuite improvement
* gnulib: Update to latest for init.sh fix.
* bootstrap: Resync from gnulib.
* tests/init.sh: Likewise.
2010-12-31 09:50:46 -07:00
Eric Blake
278491d2cc maint: allow gettext 0.17 again
Commit 041c9c47 traded the 'gettext' module for the lighter 'gettext-h'
module, so as to not require the latest gettext release (we only need
the latest release if we ship gettext as a dependent library, but
coreutils has long preferred to use it as an external library).
But that commit overlooked two places necessary to allow the use of
gettext 0.17.

This does not force you to downgrade (using gettext 0.18.1.1 is still
just fine), nor does it affect tarballs (once a tarball is built
with a given gettext version, it can be built on other machines
regardless of what gettext version is present).

* bootstrap.conf (buildreq): Relax prerequisite.
* configure.ac (AM_GNU_GETTEXT_VERSION): Likewise.
2010-12-30 15:10:09 -07:00
Pádraig Brady
44dbcae6b9 split: fix the suffix length calculation
* src/split.c (set_suffix_length): Only auto-calculate
the suffix length when the number of files is specified.
* tests/misc/split-a: Add a case to trigger the bug,
and exercise the suffix length auto-calculation.
* NEWS: Mention the fix.
Reported by Dmitry V. Levin and Sergey Vlasov at
https://bugzilla.altlinux.org/show_bug.cgi?id=24841
2010-12-30 16:26:20 +00:00
Paul Eggert
b0097f3d21 coreutils: keep lines within 80-column limits
* cfg.mk (LINE_LEN_MAX, FILTER_LONG_LINES): New macros.
(sc_long_lines): New rule.
* HACKING: Use shorter URLs to the same material.
* doc/Makefile.am, doc/coreutils.texi, m4/boottime.m4:
* man/help2man, man/stdbuf.x, src/Makefile.am, src/cat.c, src/copy.c:
* src/cp.c, src/dd.c, src/df.c, src/du.c, src/groups.c, src/install.c:
* src/ls.c, src/md5sum.c, src/mv.c, src/od.c, src/pinky.c, src/ptx.c:
* src/readlink.c, src/remove.c, src/rmdir.c, src/setuidgid.c:
* src/sort.c, src/tail.c, src/touch.c, tests/Coreutils.pm:
* tests/cp/existing-perm-race, tests/cp/perm, tests/cp/preserve-gid:
* tests/du/2g, tests/du/long-from-unreadable, tests/init.sh:
* tests/install/basic-1, tests/ls/nameless-uid:
* tests/ls/readdir-mountpoint-inode, tests/misc/chroot-credentials:
* tests/misc/cut, tests/misc/date, tests/misc/join, tests/misc/md5sum:
* tests/misc/sha1sum, tests/misc/sha224sum, tests/misc/sort:
* tests/misc/sort-continue, tests/misc/sort-files0-from:
* tests/misc/sort-rand, tests/misc/stdbuf, tests/misc/tr:
* tests/misc/uniq, tests/mv/atomic, tests/mv/part-fail:
* tests/mv/part-symlink, tests/mv/sticky-to-xpart, tests/pr/pr-tests:
* tests/rm/fail-2eperm, tests/rm/interactive-always:
Reformat to fit within 80 columns.
* doc/Makefile.am (BAD_POSIX_PERL): New macro.
* doc/coreutils.texi: Reword slightly, to make menus and
index lines shorter.
* src/md5sum.c: Redo --help output so that it fits within 79
columns, since that's a bit more portable and all the other --help
strings fit in 79 columns.
2010-12-28 12:30:42 -08:00
Jim Meyering
01211e9af7 maint: avoid syntax-check failure due to unused #include
* src/getlimits.c: Don't include "c-ctype.h"; no longer used.
2010-12-24 14:59:06 +01:00
Paul Eggert
bc4e77927c csplit: diagnose file counter wraparound
* src/csplit.c (create_output_file): Detect overflow when the
file counter wraps around, and exit with a diagnostic.  Formerly
the code silently wrapped around and wrote to the wrong file,
losing output data.
2010-12-23 00:07:59 -08:00
Paul Eggert
1d0a120377 sort: minor performance tweak with num_processors
* src/sort.c (main): Don't invoke num_processors twice.
2010-12-22 23:30:35 -08:00
Paul Eggert
83e0138480 getlimits: port to hosts with very wide int, or non-ASCII
* src/getlimits.c (decimal_ascii_add): Remove, replacing with ...
(decimal_absval_add_one): New function, with different signature,
which does not assume ASCII.  All callers changed.
(print_int): Remove assumptions that integers fit in 206 bits, and
that characters are ASCII.  These assumptions are portable in
practice but are easy to remove here.
2010-12-22 23:11:40 -08:00
Jim Meyering
8f90efd006 post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2010-12-22 18:19:37 +01:00
863 changed files with 36330 additions and 15804 deletions

97
.gitignore vendored
View File

@@ -1,8 +1,10 @@
*.I[12]
*.[EIOX]
*.bak
*.gcda
*.gcno
*.o
*/.deps
*/.deps/
*~
._bootmp
.gdb-history
@@ -18,11 +20,14 @@
/build-aux/.gitignore
/build-aux/compile
/build-aux/config.guess
/build-aux/config.rpath
/build-aux/config.sub
/build-aux/depcomp
/build-aux/install-sh
/build-aux/mdate-sh
/build-aux/missing
/build-aux/snippet/
/build-aux/test-driver
/build-aux/texinfo.tex
/build-aux/ylwrap
/config.cache
@@ -33,9 +38,11 @@
/coreutils-*.tar.gz.sig
/coreutils-*.tar.xz
/coreutils-*.tar.xz.sig
/doc/manual
/gnulib-tests
/lib/.cvsignore
/lib/.dirstamp
/lib/.gitignore
/lib/alloca.h
/lib/arg-nonnull.h
/lib/arpa
/lib/binary-io.h
@@ -44,20 +51,87 @@
/lib/config.h
/lib/config.hin
/lib/configmake.h
/lib/ctype.h
/lib/dirent.h
/lib/fcntl.h
/lib/getopt.h
/lib/glthread
/lib/iconv.h
/lib/iconv_open-aix.h
/lib/iconv_open-hpux.h
/lib/iconv_open-irix.h
/lib/iconv_open-osf.h
/lib/iconv_open-solaris.h
/lib/inttypes.h
/lib/langinfo.h
/lib/libcoreutils.a
/lib/link-warning.h
/lib/locale.h
/lib/math.h
/lib/netdb.h
/lib/parse-datetime.c
/lib/printf.c
/lib/progname.c
/lib/progname.h
/lib/ref-add.sed
/lib/ref-del.sed
/lib/selinux
/lib/signal.h
/lib/spawn.h
/lib/stamp-h1
/lib/stdalign.h
/lib/stdio.h
/lib/stdlib.h
/lib/string.h
/lib/strings.h
/lib/sys/
/lib/termios.h
/lib/time.h
/lib/unistd.h
/lib/unistr
/lib/unistr.h
/lib/unitypes.h
/lib/uniwidth
/lib/uniwidth.h
/lib/unused-parameter.h
/lib/warn-on-use.h
/lib/wchar.h
/lib/wctype.h
/m4/.cvsignore
/m4/.gitignore
/m4/codeset.m4
/m4/cu-progs.m4
/m4/fcntl-o.m4
/m4/gettext.m4
/m4/glibc2.m4
/m4/glibc21.m4
/m4/gnulib-cache.m4
/m4/iconv.m4
/m4/intdiv0.m4
/m4/intl.m4
/m4/intldir.m4
/m4/intlmacosx.m4
/m4/intmax.m4
/m4/inttypes-pri.m4
/m4/inttypes_h.m4
/m4/lcmessage.m4
/m4/lib-ld.m4
/m4/lib-link.m4
/m4/lib-prefix.m4
/m4/lock.m4
/m4/longlong.m4
/m4/nls.m4
/m4/po.m4
/m4/printf-posix.m4
/m4/progtest.m4
/m4/size_max.m4
/m4/stdint_h.m4
/m4/threadlib.m4
/m4/uintmax_t.m4
/m4/visibility.m4
/m4/wchar_t.m4
/m4/wint_t.m4
/m4/xsize.m4
/maint.mk
/man/*.1
/po/*.gmo
@@ -66,18 +140,37 @@
/po/.reference
/po/LINGUAS
/po/Makefile.in
/po/Makefile.in.in
/po/Makevars
/po/Makevars.template
/po/POTFILES
/po/Rules-quot
/po/boldquot.sed
/po/checksums
/po/coreutils.pot
/po/en@boldquot.header
/po/en@quot.header
/po/insert-header.sin
/po/quot.sed
/po/remove-potcdate.sed
/po/remove-potcdate.sin
/po/stamp-po
/src/cu-progs.mk
/src/fs-latest-magic.h
/src/make-prime-list
/src/primes.h
/src/version.c
/src/version.h
/stamp-h1
/tests/*/*.log
/tests/*/*.trs
/tests/.built-programs
/tests/factor/t[0-9][0-9].sh
/tests/t?
/tests/test-suite.log
ID
Makefile
Makefile.in
TAGS
THANKS
THANKS-to-translators

View File

@@ -1,12 +1,35 @@
# Map git author names and email addresses to canonical/preferred form.
<jim@meyering.net> <meyering@fb.com>
<jim@meyering.net> <meyering@iou.iou>
<jim@meyering.net> <meyering@redhat.com>
<jim@meyering.net> <meyering@rho.meyering.net>
<jim@meyering.net> <meyering@vm.meyering.net.localdomain>
Paul R. Eggert <eggert@cs.ucla.edu> <eggert@penguin.cs.ucla.edu>
Paul R. Eggert <eggert@cs.ucla.edu> <eggert@CS.UCLA.EDU>
Paul Eggert <eggert@cs.ucla.edu> <eggert@penguin.cs.ucla.edu>
Paul Eggert <eggert@cs.ucla.edu> <eggert@CS.UCLA.EDU>
<eggert@cs.ucla.edu> <eggert@twinsun.com>
# Evan's two changes listed my email address.
Evan Hunt <ethanol@armory.com> Evan Hunt <jim@meyering.net>
<P@draigBrady.com> <P@draigBrady.com (trivial change)>
Pádraig Brady <p@draigbrady.com> <p@draigBrady.com>
Pádraig Brady <p@draigBrady.com> <P@draigBrady.com>
<chen.guo.0625@gmail.com> <chenguo4@yahoo.com>
<chen.guo.0625@gmail.com> <chenguo4@ucla.edu>
<schwab@linux-m68k.org> <schwab@suse.de>
<aurel32@debian.org> <aurelien@aurel32.net>
<bob@proulx.com> <rwp@fc.hp.com>
<bkorb@gnu.org> <bkorb@veritas.com>
<bruno@clisp.org> <haible@clisp.cons.org>
<eblake@redhat.com> <ebb9@byu.net>
<jrv@debian.org> <jrvz@comcast.net>
<dave.anglin@nrc.ca> <dave@hiauly1.hia.nrc.ca>
<psfales@alcatel-lucent.com> <psfales@lucent.com>
<karl@gnu.org> <karl@freefriends.org>
<stephane.raimbault@gmail.com> <stephane.raimbault@makina-corpus.com>
<jarkko.sakkinen@iki.fi> <jarkko.sakkinen@linux.intel.com>
# Prefer spelled-out middle name and its address.
Arne Henrik Juul <arnej@imf.unit.no> Arne H. Juul <arnej@solan.unit.no>
# Had email as name.
Dan Jacobson <jidanni@jidanni.org> jidanni@jidanni.org <jidanni@jidanni.org>

View File

@@ -1 +1 @@
8.7
8.21

View File

@@ -1,6 +1,6 @@
# Suppress valgrind diagnostics we don't care about.
# Copyright (C) 2003-2004, 2006-2010 Free Software Foundation, Inc.
# Copyright (C) 2003-2013 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

View File

@@ -1 +0,0 @@
^build-aux/check\.mk$

View File

@@ -1,7 +0,0 @@
^gl/lib/randint\.c$
^gl/tests/test-di-set\.c$
^gl/tests/test-fadvise\.c$
^gl/tests/test-ino-map\.c$
^gl/tests/test-mbsalign\.c$
^gl/tests/test-rand-isaac\.c$
^lib/euidaccess-stat\.c$

View File

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

View File

@@ -1,5 +0,0 @@
ChangeLog
NEWS
src/df.c
src/stat.c
tests/misc/df-P

View File

@@ -1 +0,0 @@
ChangeLog

View File

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

View File

@@ -1,3 +0,0 @@
gl/lib/randint.c
lib/euidaccess-stat.c
gl/tests/.*\.c

View File

@@ -1 +0,0 @@
src/seq.c

View File

@@ -1,2 +0,0 @@
^m4/stat-prog\.m4$
ChangeLog

View File

@@ -1 +0,0 @@
^lib/euidaccess-stat\.c$

View File

@@ -1 +0,0 @@
^tests/pr/

View File

@@ -1,4 +0,0 @@
\.mk$
/Makefile\.am$
^tests/init\.sh$
^tests/test-lib\.sh$

View File

@@ -1,2 +0,0 @@
configure.ac
ChangeLog*

View File

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

View File

@@ -1 +0,0 @@
ChangeLog

View File

@@ -1,7 +0,0 @@
^GNUMakefile$
Makefile\.am$
\.mk$
^tests/pr/
ChangeLog.*
^man/help2man$
^gl/lib/.*\.c\.diff$

View File

@@ -1,9 +0,0 @@
^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$

View File

@@ -1,9 +0,0 @@
^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$

View File

@@ -1,12 +0,0 @@
config(ure|\.(guess|sub))
tests/pr
lib/regex.c
config-log
tests/misc/nl
po/de.po
m4/lib-ld.m4
m4/lib-prefix.m4
m4/po.m4
aclocal.m4
src/c99-to-c89.diff
^gl/lib/.*\.c\.diff$

View File

@@ -1,2 +0,0 @@
config-log
build-aux/config.guess

View File

@@ -1,3 +0,0 @@
^src/libstdbuf\.c$
^src/system\.h$
^src/copy\.h$

View File

@@ -1 +0,0 @@
^tests/pr/

View File

@@ -1,2 +0,0 @@
^lib/xstrtol\.h$
^build-aux/cvsu$

View File

@@ -1,13 +0,0 @@
^build-aux/config.guess
^configure
^lib/alloca.c
^lib/fts.c
^lib/getdate.c
^lib/getloadavg.c
^lib/gettext.h
^lib/getusershell.c
^lib/mbswidth.c
^lib/strtod.c
^lib/xstrtol.c
^m4/
^tests/misc/pwd-unreadable-parent

2
.x-update-copyright Normal file
View File

@@ -0,0 +1,2 @@
COPYING
man/help2man

View File

@@ -26,7 +26,7 @@ echo: Brian Fox, Chet Ramey
env: Richard Mlynarik, David MacKenzie
expand: David MacKenzie
expr: Mike Parker, James Youngman, Paul Eggert
factor: Paul Rubin
factor: Paul Rubin, Torbjörn Granlund, Niels Möller
false: Jim Meyering
fmt: Ross Paterson
fold: David MacKenzie
@@ -52,6 +52,7 @@ nice: David MacKenzie
nl: Scott Bartram, David MacKenzie
nohup: Jim Meyering
nproc: Giuseppe Scrivano
numfmt: Assaf Gordon
od: Jim Meyering
paste: David M. Ihnat, David MacKenzie
pathchk: Paul Eggert, David MacKenzie, Jim Meyering
@@ -62,6 +63,7 @@ printf: David MacKenzie
ptx: François Pinard
pwd: Jim Meyering
readlink: Dmitry V. Levin
realpath: Pádraig Brady
rm: Paul Rubin, David MacKenzie, Richard M. Stallman, Jim Meyering
rmdir: David MacKenzie
runcon: Russell Coker
@@ -79,7 +81,6 @@ split: Torbjörn Granlund, Richard M. Stallman
stat: Michael Meskes
stdbuf: Pádraig Brady
stty: David MacKenzie
su: David MacKenzie
sum: Kayvan Aghaiepour, David MacKenzie
sync: Jim Meyering
tac: Jay Lepreau, David MacKenzie

View File

@@ -1206,7 +1206,7 @@
* tests/Coreutils.pm: New keywords, ENV and ENV_DEL, to support
tests/misc/date.
With todays additions, the generated shell script,
With today's additions, the generated shell script,
tests/date/date-tests had becoming far too large (over 350KB),
so use the superior-but-perl-requiring framework instead.
* tests/date/Test.pm: Move all tests from here...
@@ -9086,7 +9086,7 @@
split's --verbose option did nothing [broken in 4.5.10 and 5.0]
* src/split.c (longopts): Use `1', not `0' as the value for
for &verbose. Reported by Keith Thompson.
&verbose. Reported by Keith Thompson.
Test for the above fix.
* tests/misc/split-a: Also use --verbose and compare stderr
@@ -11609,7 +11609,7 @@
-----
Copyright (C) 2002-2005, 2009-2010 Free Software Foundation, Inc.
Copyright (C) 2002-2013 Free Software Foundation, Inc.
Copying and distribution of this file, with or without
modification, are permitted provided the copyright notice

View File

@@ -4033,7 +4033,7 @@
-----
Copyright (C) 2006, 2009-2010 Free Software Foundation, Inc.
Copyright (C) 2006-2013 Free Software Foundation, Inc.
Copying and distribution of this file, with or without
modification, are permitted provided the copyright notice

View File

@@ -3262,7 +3262,7 @@
rm without -f: give a better diagnostic when euidaccess fails.
* src/remove.c (write_protected_non_symlink): Return int, not bool,
so that we can indicate failure too (as a postive error number).
so that we can indicate failure too (as a positive error number).
(prompt): If write_protected_non_symlink fails, report that error
number and fail rather than charging ahead and removing the dubious
entry. Redo the logic of printing a diagnostic so that we need to
@@ -4015,7 +4015,7 @@
-----
Copyright (C) 2007, 2009-2010 Free Software Foundation, Inc.
Copyright (C) 2007-2013 Free Software Foundation, Inc.
Copying and distribution of this file, with or without
modification, are permitted provided the copyright notice

View File

@@ -104,7 +104,7 @@
(errno_may_be_empty, ignorable_failure): New functions.
* src/remove.c (is_empty_dir): Move function to ...
* src/system.h (is_empty_dir): ...here, and make it inline.
Suggested by Josselin Mouette in <http://bugs.debian.org/363011>
Suggested by Josselin Mouette in <http://bugs.debian.org/350541>
via Bob Proulx.
* NEWS: Mention the improvement.
@@ -372,7 +372,7 @@
-----
Copyright (C) 2008-2010 Free Software Foundation, Inc.
Copyright (C) 2008-2013 Free Software Foundation, Inc.
Copying and distribution of this file, with or without
modification, are permitted provided the copyright notice

77
HACKING
View File

@@ -21,6 +21,7 @@ Base any changes you make on the latest upstream sources.
You can get a copy of the latest with this command:
git clone git://git.sv.gnu.org/coreutils
cd coreutils
That downloads the entire repository, including revision control history
dating back to 1991. The repository (the part you download, and which
@@ -119,6 +120,8 @@ Note 2:
sometimes the checkout will fail, telling you that your local
modifications conflict with changes required to switch branches.
However, in any case, you will *not* lose your uncommitted changes.
Run "git stash" to temporarily hide uncommitted changes in your
local directory, restoring a clean working directory.
Anyhow, get back onto your just-created branch:
@@ -232,6 +235,17 @@ Try to make the summary line fit one of the following forms:
build: change-description
maint: change-description
If your commit fixes a bug, try to find the commit that introduced that
bug. If you do that, add a note in your new commit log saying something
like "Introduced by commit v8.12-103-g54cbe6e." and add something like
[bug introduced in coreutils-8.13] in the corresponding NEWS blurb.
Assuming you found the bug in commit 54cbe6e6, "git describe 54cbe6e6"
will print the longer tag-relative string that you'll need.
Note that we used to use an 8-byte SHA1 prefix like "54cbe6e6", because
that was automatically rendered as a clickable link by "gitk", but with
git-1.7.10, the more descriptive version-containing "git describe" format
that we now require is also highlighted.
Curly braces: use judiciously
=============================
@@ -349,10 +363,25 @@ this code enables the right mode:
(not (string-equal mode-name "Makefile")))
(setq indent-tabs-mode nil))))
[*] Makefile and ChangeLog files are exempt, of course.
If you use vim (7+ compiled with autocommands), and coreutils working
directory name also matches, add the following in ~/.vimrc:
[FIXME: suggest vim syntax to do same thing, if it can be done safely.
Most distros now "set nomodeline" by default for a good reason. ]
" Set GNU style indentation, spaces instead of TABs
function! CoreutilsIndent()
" Check if 'coreutils' is part of the current working directory
if match(getcwd(), "coreutils") > 0
" The next 3 lines below set the GNU indentation
setlocal cinoptions=>4,n-2,{2,^-2,:2,=2,g0,h2,p5,t0,+2,(0,u0,w1,m1
setlocal shiftwidth=2
setlocal tabstop=8
" Coreutils specific, expand TABs with spaces
setlocal expandtab
endif
endfunction
autocmd BufEnter *.c,*.h call CoreutilsIndent()
[*] Makefile and ChangeLog files are exempt, of course.
Send patches to the address listed in --help output
@@ -411,9 +440,21 @@ 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. Note to run tests/misc/new-test in isolation you can do:
as possible. If you add a new test file (as opposed to adding a test to
an existing test file) add the new test file to 'tests/local.mk'.
Note to run tests/misc/new-test in isolation you can do:
(cd tests && make check TESTS=misc/new-test VERBOSE=yes)
make TESTS=tests/misc/new-test SUBDIRS=. VERBOSE=yes
Variables that are significant for tests with their default values are:
VERBOSE=yes
RUN_EXPENSIVE_TESTS=no
RUN_VERY_EXPENSIVE_TESTS=no
SHELL=/bin/sh
NON_ROOT_USERNAME=nobody
NON_ROOT_GROUP=$(id -g $NON_ROOT_USERNAME)
COREUTILS_GROUPS=$(id -G)
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
@@ -439,12 +480,12 @@ The forms to choose from are in gnulib's doc/Copyright/ directory.
If you want to assign a single change, you should use the file,
doc/Copyright/request-assign.changes:
http://git.sv.gnu.org/gitweb/?p=gnulib.git;a=blob;f=doc/Copyright/request-assign.changes;hb=HEAD
http://www.gnu.org/software/gnulib/Copyright/request-assign.changes
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
http://www.gnu.org/software/gnulib/Copyright/request-assign.future
You may make assignments for up to four projects at a time.
@@ -468,10 +509,8 @@ versions of gcc and the linux kernel, and modern GNU tools.
Ensure that your changes are indented properly.
===============================================
Format the code the way GNU indent does.
In a file with the "indent-tabs-mode: nil" directive at the end,
running "indent --no-tabs" should induce no change.
With other files, there will be some existing differences.
Try not to add any more.
Filtering most source files through "indent --no-tabs" should
induce no change in indentation. Try not to add any more.
Avoid trailing white space
@@ -484,13 +523,11 @@ 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:
files you edit. If you use Emacs, customize its font-lock mode
or use its WhiteSpace mode:
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
@@ -573,8 +610,8 @@ to generate HTML coverage reports. Follow these steps:
# 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
lcov -t coreutils -q -d lib -b `pwd` -o lib.lcov -c
lcov -t coreutils -q -d src -b `pwd` -o src.lcov -c
# generate HTML from the output
genhtml -p `pwd` -t coreutils -q --output-directory lcov-html *.lcov
@@ -582,11 +619,11 @@ Then just open the index.html file (in the generated lcov-html directory)
in your favorite web browser.
========================================================================
Copyright (C) 2009-2010 Free Software Foundation, Inc.
Copyright (C) 2009-2013 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.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
Documentation License'' file as part of this distribution.
Texts. A copy of the license is included in the "GNU Free
Documentation License" file as part of this distribution.

View File

@@ -1,6 +1,6 @@
# Make coreutils. -*-Makefile-*-
# Copyright (C) 1990, 1993-2010 Free Software Foundation, Inc.
# Copyright (C) 1990-2013 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 @@
ALL_RECURSIVE_TARGETS =
SUBDIRS = lib src doc man po tests gnulib-tests
SUBDIRS = po . gnulib-tests
changelog_etc = \
ChangeLog-2005 \
@@ -25,7 +25,6 @@ changelog_etc = \
ChangeLog-2007 \
ChangeLog-2008 \
build-aux/ChangeLog-2007 \
build-aux/update-copyright \
doc/ChangeLog-2007 \
lib/ChangeLog-2007 \
m4/ChangeLog-2007 \
@@ -39,64 +38,52 @@ changelog_etc = \
old/textutils/NEWS \
po/ChangeLog-2007
syntax_check_exceptions = \
.x-sc_GPL_version \
.x-sc_bindtextdomain \
.x-sc_error_message_uppercase \
.x-sc_file_system \
.x-sc_obsolete_symbols \
.x-sc_po_check \
.x-sc_program_name \
.x-sc_prohibit_always-defined_macros \
.x-sc_prohibit_atoi_atof \
.x-sc_prohibit_empty_lines_at_EOF \
.x-sc_prohibit_fail_0 \
.x-sc_prohibit_magic_number_exit \
.x-sc_prohibit_stat_st_blocks \
.x-sc_prohibit_strcmp \
.x-sc_prohibit_tab_based_indentation \
.x-sc_require_config_h \
.x-sc_require_config_h_first \
.x-sc_space_tab \
.x-sc_sun_os_names \
.x-sc_system_h_headers \
.x-sc_trailing_blank \
.x-sc_prohibit_always_true_header_tests \
.x-sc_unmarked_diagnostics \
.x-sc_useless_cpp_parens
EXTRA_DIST = \
$(changelog_etc) \
$(syntax_check_exceptions) \
.mailmap \
.prev-version \
.version \
.vg-suppressions \
THANKS.in \
THANKS-to-translators \
THANKStt.in \
bootstrap \
bootstrap.conf \
build-aux/cvsu \
build-aux/gen-lists-of-programs.sh \
cfg.mk \
dist-check.mk \
gl/modules/getloadavg.diff \
maint.mk
maint.mk \
tests/GNUmakefile \
thanks-gen
ALL_RECURSIVE_TARGETS += install-root
install-root:
cd src && $(MAKE) $@
gen_progs_lists = $(top_srcdir)/build-aux/gen-lists-of-programs.sh
# Keep these in sync with bootstrap.conf:bootstrap_post_import_hook().
# Use '$(top_srcdir)/m4' and '$(srcdir)/src' for the benefit of non-GNU
# makes: it is with those directories that 'cu-progs.m4' and 'cu-progs.mk'
# appear in our dependencies.
$(top_srcdir)/m4/cu-progs.m4: $(gen_progs_lists)
$(AM_V_GEN)rm -f $@ $@-t \
&& $(SHELL) $(gen_progs_lists) --autoconf >$@-t \
&& chmod a-w $@-t && mv -f $@-t $@
$(srcdir)/src/cu-progs.mk: $(gen_progs_lists)
$(AM_V_GEN)rm -f $@ $@-t \
&& $(SHELL) $(gen_progs_lists) --automake >$@-t \
&& chmod a-w $@-t && mv -f $@-t $@
ACLOCAL_AMFLAGS = -I m4
# Some tests always need root privileges, others need them only sometimes.
ALL_RECURSIVE_TARGETS += check-root
check-root:
cd tests && $(MAKE) $@ SUBDIRS=
# Shortcut targets to make it easier to run (very) expensive tests.
check-expensive:
$(MAKE) check RUN_EXPENSIVE_TESTS=yes
check-very-expensive:
$(MAKE) check-expensive RUN_VERY_EXPENSIVE_TESTS=yes
# Just prior to distribution, ...
# transform the automake-generated rule that runs `rm -f rm'.
# transform the automake-generated rule that runs 'rm -f rm'.
# On some systems, that command would fail with a diagnostic like
# `rm: cannot unlink `rm': Text file busy' when `.' appears so early
# in the shell's search path that running `rm' would run the `rm'
# "rm: cannot unlink 'rm': Text file busy" when '.' appears so early
# in the shell's search path that running 'rm' would run the 'rm'
# executable in the current directory.
# Similarly, adjust the clean-binPROGRAMS rule.
rm_subst = \
@@ -112,13 +99,14 @@ BUILT_SOURCES = .version
# See the rm_subst comment for details.
dist-hook: gen-ChangeLog
$(AM_V_GEN)echo $(VERSION) > $(distdir)/.tarball-version
$(AM_V_at)perl -pi -e '$(rm_subst)' $(distdir)/src/Makefile.in
$(AM_V_at)perl -pi -e '$(rm_subst)' $(distdir)/Makefile.in
gen_start_date = 2008-02-08
.PHONY: gen-ChangeLog
gen-ChangeLog:
$(AM_V_GEN)if test -d .git; then \
$(top_srcdir)/build-aux/gitlog-to-changelog \
--amend=$(srcdir)/build-aux/git-log-fix \
--since=$(gen_start_date) > $(distdir)/cl-t; \
rm -f $(distdir)/ChangeLog; \
mv $(distdir)/cl-t $(distdir)/ChangeLog; \
@@ -152,3 +140,52 @@ check-ls-dircolors:
|sed -n '/^ *"/p'|tr , '\n'|sed 's/^ *//' \
|sed -n 's/^"\(..\)"/\1/p'|sort -u); \
test "$$dc" = "$$ls"
# Sort in traditional ASCII order, regardless of the current locale;
# otherwise we may get into trouble with distinct strings that the
# current locale considers to be equal.
ASSORT = LC_ALL=C sort
# Extract all lines up to the first one starting with "##".
prologue = perl -ne '/^\#\#/ and exit; print' $(srcdir)/THANKS.in
THANKS: THANKS.in Makefile.am .mailmap thanks-gen .version
$(AM_V_GEN)rm -f $@-t $@; \
{ \
$(prologue); echo; \
{ perl -ne '/^$$/.../^$$/ and print' $(srcdir)/THANKS.in \
| grep -v '^$$' | perl -pe 's/ +/\0/'; \
git log --pretty=format:'%aN%x00%aE' \
| $(ASSORT) -u; \
} | $(srcdir)/thanks-gen \
| LC_ALL=en_US.UTF-8 sort -f; \
echo; \
printf ';; %s\n' 'Local Variables:' 'coding: utf-8' End:; \
} > $@-t && chmod a-w $@-t && mv $@-t $@
# Some of our git hook scripts are supposed to be identical to git's samples.
# See if they are still in sync.
.PHONY: check-git-hook-script-sync
check-git-hook-script-sync:
@fail=0; \
t=$$(mktemp -d) \
&& cd $$t && git init -q && cd .git/hooks \
&& for i in pre-commit pre-applypatch applypatch-msg; do \
diff $(abs_top_srcdir)/scripts/git-hooks/$$i $$i.sample \
|| fail=1; \
done; \
rm -rf $$t; \
test $$fail = 0
noinst_LIBRARIES =
MOSTLYCLEANFILES =
CLEANFILES =
MOSTLYCLEANDIRS =
AM_CPPFLAGS = -Ilib -I$(top_srcdir)/lib -Isrc -I$(top_srcdir)/src
include $(top_srcdir)/lib/local.mk
include $(top_srcdir)/src/local.mk
include $(top_srcdir)/doc/local.mk
include $(top_srcdir)/man/local.mk
include $(top_srcdir)/tests/local.mk

1193
NEWS

File diff suppressed because it is too large Load Diff

44
README
View File

@@ -11,11 +11,11 @@ The programs that can be built with this package are:
csplit cut date dd df dir dircolors dirname du echo env expand expr
factor false fmt fold groups head hostid hostname id install join kill
link ln logname ls md5sum mkdir mkfifo mknod mktemp mv nice nl nohup
nproc 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 stdbuf 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
nproc numfmt od paste pathchk pinky pr printenv printf ptx pwd readlink
realpath rm rmdir runcon seq sha1sum sha224sum sha256sum sha384sum sha512sum
shred shuf sleep sort split stat stdbuf stty 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.
@@ -134,17 +134,25 @@ the best solution is to use GNU make. Otherwise, simply remove
all mention of "[$(EXEEXT)" from src/Makefile.
*************************************************
"make check" failure on IRIX 6.5 and Solaris <= 9
-------------------------------------------------
Using the vendor make program to run "make check" fails on these two systems.
If you want to run all of the tests there, use GNU make.
**********************
Running tests as root:
----------------------
If you run the tests as root, note that a few of them create files
and/or run programs as a non-root user, `nobody' by default.
and/or run programs as a non-root user, 'nobody' by default.
If you want to use some other non-root username, specify it via
the NON_ROOT_USERNAME environment variable. Depending on the
permissions with which the working directories have been created,
using `nobody' may fail, because that user won't have the required
using 'nobody' may fail, because that user won't have the required
read and write access to the build and test directories.
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
@@ -163,15 +171,15 @@ Reporting bugs:
---------------
IMPORTANT: if you take the time to report a test failure,
please be sure to include the output of running `make check'
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/misc/df, then you would
if the test that fails is tests/df/df-P.sh, then you would
run this command:
(cd tests && make check TESTS=misc/df VERBOSE=yes) >> log 2>&1
make check TESTS=tests/df/df-P.sh VERBOSE=yes SUBDIRS=. >> log 2>&1
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.
Then include the contents of the file 'log' in your bug report.
Send bug reports, questions, comments, etc. to bug-coreutils@gnu.org.
If you would like to suggest a patch, see the files README-hacking
@@ -199,9 +207,11 @@ Here are instructions for checking out the latest development sources:
If your patch adds a new feature, please try to get some sort of consensus
that it is a worthwhile change. One way to do that is to send mail to
bug-coreutils@gnu.org including as much description and justification
coreutils@gnu.org including as much description and justification
as you can. Based on the feedback that generates, you may be able to
convince us that it's worth adding.
convince us that it's worth adding. Please also consult the list of
previously discussed but ultimately rejected feature requests at:
http://www.gnu.org/software/coreutils/rejected_requests.html
WARNING: Now that we use the ./bootstrap script, you should not run
@@ -215,7 +225,7 @@ or any Makefile.am, then don't be surprised if what gets regenerated no
longer works. To make things work, you'll have to be using appropriate
versions of the tools listed in bootstrap.conf's buildreq string.
All of these programs except `test' recognize the `--version' option.
All of these programs except 'test' recognize the '--version' option.
When reporting bugs, please include in the subject line both the package
name/version and the name of the program for which you found a problem.
@@ -232,11 +242,11 @@ the address on the last line of --help output.
========================================================================
Copyright (C) 1998, 2002-2010 Free Software Foundation, Inc.
Copyright (C) 1998-2013 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.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
Documentation License'' file as part of this distribution.
Texts. A copy of the license is included in the "GNU Free
Documentation License" file as part of this distribution.

View File

@@ -2,7 +2,7 @@
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 guidelines.
See also HACKING for more detailed contribution guidelines.
* Requirements
@@ -19,7 +19,7 @@ Valgrind <http://valgrind.org/> is also highly recommended, if
Valgrind supports your architecture. See also README-valgrind.
While building from a just-cloned source tree may require installing a
few prerequisites, later, a plain `git pull && make' should be sufficient.
few prerequisites, later, a plain 'git pull && make' should be sufficient.
* First GIT checkout
@@ -29,8 +29,8 @@ You can get a copy of the source repository like this:
$ cd coreutils
As an optional step, if you already have a copy of the gnulib git
repository on your hard drive, then you can use it as a reference to
reduce download time and disk space requirements:
repository, then you can use it as a reference to reduce download
time and disk space requirements:
$ export GNULIB_SRCDIR=/path/to/gnulib
@@ -78,11 +78,14 @@ each program. One way to do this is to use vc-dwim
"git-changelog-symlink-init" function into your shell, and then run
this function at the top-level directory of the package.
Edit the ChangeLog file that this command creates, creating a
Edit the (empty) ChangeLog file that this command creates, creating a
properly-formatted entry according to the GNU coding standards
<http://www.gnu.org/prep/standards/html_node/Change-Logs.html>.
Run the command "vc-dwim" and make sure its output looks good.
Make your changes.
Run the command "vc-dwim" and make sure its output (the diff of all
your changes) looks good.
Run "vc-dwim --commit".
@@ -91,7 +94,7 @@ each program. One way to do this is to use vc-dwim
-----
Copyright (C) 2002-2010 Free Software Foundation, Inc.
Copyright (C) 2002-2013 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@@ -29,9 +29,12 @@ set correctly by running this command:
* autoconf *
# Note Autoconf 2.62 or newer is needed to build automake-1.11.1
# Note Autoconf 2.62 or newer is needed to build automake-1.11.2
# but we specify 2.64 here as that's what coreutils requires.
# Please use the latest stable release version as indicated by git tags.
git clone --depth=1 git://git.sv.gnu.org/autoconf.git
git checkout v2.62
cd autoconf
git checkout v2.64
autoreconf -vi
./configure --prefix=$prefix
make install
@@ -41,7 +44,7 @@ set correctly by running this command:
# Note help2man is required to build automake fully
git clone git://git.sv.gnu.org/automake.git
cd automake
git checkout v1.11.1
git checkout v1.11.2
./bootstrap
./configure --prefix=$prefix
make install

View File

@@ -24,18 +24,35 @@ Here are most of the steps we (maintainers) follow when making a release.
FIXME: enable excluded programs like arch? to get their manual pages?
* Check for new file system types by running the following command on
a system with the most recent kernel possible, or with the latest
upstream include/uapi/linux/magic.h made available at src/fs-latest-magic.h
make src/fs-magic-compare
If it reports new file system magic numbers, add them to src/stat.c.
If it is a remote file system, add the new S_MAGIC_* name you created
in stat.c to the list of remote file system types in src/tail.c's
fremote function.
* Pre-release testing:
Run the following on at least one SELinux-enabled (enforcing) and
one non-SELinux system:
make distcheck
make -j1 check RUN_VERY_EXPENSIVE_TESTS=yes RUN_EXPENSIVE_TESTS=yes
sudo env PATH="$PATH" NON_ROOT_USERNAME=$USER make -k check-root
n=$(( ($(nproc) + 1) / 2 ))
sudo env PATH="$PATH" NON_ROOT_USERNAME=$USER make -k -j$(nproc) check-root\
&& make distcheck \
&& make -j$n check RUN_VERY_EXPENSIVE_TESTS=yes RUN_EXPENSIVE_TESTS=yes
Note the -j1 above. If you use -jN, for larger N, some of the expensive
tests are likely to interfere with concurrent performance-measuring or
timing-sensitive tests, resulting in spurious failures.
If testing on systems with a non standard default shell, spurious failures
may occur. Often there are other shells available, and you can select
those by using for example, SHELL=bash in the commands above.
Note that the use of -j$n tells make to use approximately half of the
available processing units. If you use -jN, for larger N, some of the
expensive tests are likely to interfere with concurrent performance-measuring
or timing-sensitive tests, resulting in spurious failures.
If "make distcheck" doesn't run "make syntax-check" for you, then run
it manually:

View File

@@ -1,7 +1,7 @@
#! /bin/bash
# Convert this package for use with valgrind.
# Copyright (C) 2002-2006, 2009-2010 Free Software Foundation, Inc.
# Copyright (C) 2002-2013 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

View File

@@ -1,14 +1,20 @@
These people have contributed to the GNU coreutils (formerly, the fileutils,
textutils, and/or sh-utils packages). Some have reported problems, others
have contributed improvements to the documentation, actual code, and even
complete programs. Those contributions are described in the ChangeLog
files. If your name has been left out, if you'd rather not be listed,
or if you'd prefer a different address be used, please send a note to
the bug-report mailing list (as seen on last line of e.g., cp --help).
complete programs. Those contributions are described in the version control
logs and ChangeLog files. If your name has been left out, if you'd rather
not be listed, or if you'd prefer a different address be used, please send a
note to the bug-report mailing list (as seen at end of e.g., cp --help).
##
## There is no need to list here any name that appears as an Author in
## "git log" output. Those are automatically added when this template
## is used to generate the THANKS file. Note that numerous people listed
## here would have been listed as commit authors if we had been using git
## for version control when they contributed.
??? kytek@cybercomm.net
A Costa agcosta@gis.net
Aaron Burgemeister dajoker@gmail.com
Aaron Davies aaron.davies@gmail.com
Aaron Hawley ashawley@uvm.edu
Achim Blumensath blume@corona.oche.de
Adam Jimerson vendion@charter.net
@@ -18,8 +24,8 @@ Adrian Bunk bunk@stusta.de
AIDA Shinra shinra@j10n.org
Akim Demaille demaille@inf.enst.fr
Alain Magloire alain@qnx.com
Alan Curry pacman@kosh.dhis.org
Alan Iwi iwi@atm.ox.ac.uk
Alan Jenkins alan-jenkins@tuffmail.co.uk
Albert Chin-A-Young china@thewrittenword.com
Albert Hopkins ahopkins@dynacare.com
Alberto Accomazzi alberto@cfa0.harvard.edu
@@ -33,18 +39,19 @@ Alexandre Duret-Lutz duret_g@epita.fr
Alexey Solovyov alekso@math.uu.se
Alexey Vyskubov alexey@pippuri.mawhrin.net
Alfred M. Szmidt ams@kemisten.nu
Ambrose Feinstein ambrose@google.com
Amr Ali amr.ali.cc@gmail.com
Anders Kaseorg andersk@mit.edu
Andi Kleen freitag@alancoxonachip.com
Andre Novaes Cunha Andre.Cunha@br.global-one.net
Andreas Frische andreasfrische@gmail.com
Andreas Gruenbacher ag@bestbits.at
Andreas Jaeger jaeger@gnu.org
Andreas Luik luik@isa.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
@@ -52,28 +59,27 @@ Andrew Tridgell tridge@samba.org
Andrey Borzenkov arvidjaar@mail.ru
Andries Brouwer Andries.Brouwer@cwi.nl
Andy Longton alongton@metamark.com
Anoop Sharma sendtoanoop@gmail.com
Anthony Thyssen anthony@griffith.edu.au
Antonio Rendas ajrendas@yahoo.com
Ariel Faigon ariel@cthulhu.engr.sgi.com
Arjan Opmeer arjan.opmeer@gmail.com
Arne H. Juul arnej@solan.unit.no
Arkadiusz Miśkiewicz arekm@maven.pl
Arne Henrik Juul arnej@imf.unit.no
Arnold Robbins arnold@skeeve.com
Arthur Pool pool@commerce.uq.edu.au
Arun Sharma arun.sharma@intel.com
Arvind Autar Autar022@planet.nl
Assaf Gordon assafgordon@gmail.com
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
Ben Walton bwalton@artsci.utoronto.ca
Bengt Martensson bengt@mathematik.uni-Bremen.de
Benjamin Cutler cutlerbc@simla.colostate.edu
Benno Schulenberg bensberg@justemail.net
Bernard Giroud bernard.giroud@creditlyonnais.ch
Bernd Eckenfels ecki@debian.org
Bernd Leibing bernd.leibing@rz.uni-ulm.de
@@ -81,24 +87,21 @@ Bernd Melchers melchers@cis.fu-berlin.de
Bernhard Baehr bernhard.baehr@gmx.de
Bernhard Gabler bernhard@uni-koblenz.de
Bernhard Rosenkraenzer bero@redhat.de
Bernhard Voelker bernhard.voelker@siemens-enterprise.com
Bert Deknuydt Bert.Deknuydt@esat.kuleuven.ac.be
Bert Wesarg bert.wesarg@googlemail.com
Bill Brelsford wb@k2di.net
Bill Peters peters@gaffel.as.arizona.edu
Bjorn Helgaas helgaas@rsn.hp.com
Bob McCracken kerouac@ravenet.com
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
Britton Leo Kerin fsblk@aurora.uaf.edu
Bruce Robertson brucer@theodolite.dyndns.org
Bruno Haible haible@clisp.cons.org
C de-Avillez hggdh2@gmail.com
Brynnen Owen owen@illinois.edu
Carl Johnson carlj@cjlinux.home.org
Carl Lowenstein cdl@mpl.UCSD.EDU
Carl Roth roth@urs.us
@@ -106,7 +109,6 @@ Carlos Canau Carlos.Canau@relay.puug.pt
Charles Karney karney@pppl.gov
Charles Randall crandall@matchlogic.com
Chas. Owens chas.owens@gmail.com
Chen Guo chen.guo.0625@gmail.com
Chip Salzenberg chip@valinux.com
Chris Clayton chris2553@googlemail.com
Chris Faylor cgf@cygnus.com
@@ -117,16 +119,16 @@ Chris Sylvain csylvain@umm.edu
Chris Yeo cyeo@biking.org
Christi Alice Scarborough christi@chiark.greenend.org.uk
Christian Harkort christian.harkort@web.de
Christian Jullien eligis@orange.fr
Christian Krackowizer ckrackowiz@std.schuler-ag.com
Christian Rose menthos@menthos.com
Christian von Roques roques@pond.sub.org
Christophe LYON christophe.lyon@st.com
Chuck Hedrick hedrick@klinzhai.rutgers.edu
Chusslove Illich caslav.ilic@gmx.net
Clark Morgan cmorgan@aracnet.com
Clement Wang clem.wang@overture.com
Cliff Miller cbm@whatexit.org
Colin Plumb colin@nyx.net
Colin Watson cjw44@riva.ucam.org
Collin Rogowski collin@rogowski.de
Cray-Cyber Project http://www.cray-cyber.org
Cristian Cadar cristic@stanford.edu
@@ -134,26 +136,28 @@ Cyril Bouthors cyril@bouthors.org
Dale Scheetz dwarf@polaris.net
Dameon G. Rogers dgr03@uark.edu
Dan Hagerty hag@gnu.ai.it.edu
Dan Hipschman dsh@linux.ucla.edu
Dan Jacobson jidanni@jidanni.org
Dan Pascu dan@services.iiruc.ro
Daniel Bergstrom noa@melody.se
Daniel Dunbar ddunbar@stanford.edu
Daniel Mach dmach@redhat.com
Daniel P. Berrangé berrange@redhat.com
Daniel Stavrovski d@stavrovski.net
Daniel Tschinder daniel.tschinder@project-a.com
Dániel Varga danielv@axelero.hu
Danny Levinson danny.levinson@overture.com
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 Diggles david.diggles@dnrm.qld.gov.au
David Dyck dcd@tc.fluke.COM
David Eisner cradle@umd.edu
David Flynn dav@chess.plus.com
David Gast dgast@csulb.edu
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
David Matei matei@cs.toronto.edu
Davide Canova kc.canova@gmail.com
Dawson Engler engler@stanford.edu
Dean Gaudet dean-savannah@arctic.org
@@ -161,20 +165,20 @@ Deepak Goel deego@gnufans.org
Denis Excoffier denis.excoffier@airbus.com
Denis McKeon dmckeon@swcp.com
Dennis Henriksen opus@flamingo.osrl.dk
Dennis Clarke dclarke@blastwave.org
Dennis Smit ds@nerds-incorporated.org
Derek Clegg dclegg@next.com
Dick Streefland dick_streefland@tasking.com
Dirk Lattermann dlatt@t-online.de
Dirk-Jan Faber djfaber@snow.nl
Dmitry Rutsky rutsky@school.ioffe.rssi.ru
Dmitry V. Levin ldv@altlinux.org
Don Parsons dparsons@synapse.kent.edu
Donni Erpel donald@appc11.gsi.de
Doug Coleman coleman@iarc1.ece.utexas.edu
Doug McLaren dougmc@comco.com
Dragos Harabor dharabor@us.oracle.com
Duncan Roe duncanr@optimation.com.au
Ed Avis ed@membled.com
Edward Schwartz edmcman@cmu.edu
Edward Welbourne eddy@opera.com
Edzer Pebesma Edzer.Pebesma@rivm.nl
Egmont Koblinger egmont@uhulinux.hu
@@ -182,22 +186,17 @@ Eirik Fuller eirik@hackrat.com
Eivind eivindt@multinet.no
Elbert Pol elbert.pol@gmail.com
Eli Zaretskii eliz@is.elta.co.il
Elias Pipping pipping@gentoo.org
Emile LeBlanc leblanc@math.toronto.edu
Emmanuel Lacour elacour@home-dn.net
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
Eric Pemente pemente@northpark.edu
Eric S. Raymond esr@snark.thyrsus.com
Erik Bennett bennett@cvo.oneworld.com
Erik Corry erik@kroete2.freinet.de
Evan Hunt ethanol@armory.com
Felix Lee flee@teleport.com
Felix Rauch Valenti frauch@cse.unsw.edu.au
Ferdinand fw@scenic.mine.nu
Filipus Klutiero chealer@gmail.com
Fletcher Mattox fletcher@cs.utexas.edu
Florent Bayle florent@sarcelle.net
Florian Schlichting fschlich@cis.fu-berlin.de
@@ -223,7 +222,6 @@ 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
Gilles Espinasse g.esp@free.fr
Glen Lenker glen.lenker@gmail.com
Göran Uddeborg goeran@uddeborg.se
Guochun Shi gshi@ncsa.uiuc.edu
@@ -268,10 +266,8 @@ James Antill jmanti%essex.ac.uk@seralph21.essex.ac.uk
James Lemley James.Lemley@acxiom.com
James Hunt jamesodhunt@hotmail.com
James Ralston ralston@pobox.com
James R. Van Zandt jrvz@comcast.net
James Sneeringer jvs@ocslink.com
James Tanis jtt@soscorp.com
James Youngman jay@gnu.org
Jamie Lokier jamie@imbolc.ucc.ie
Jamie McClelland jm@mayfirst.org
Jan Engelhardt jengelh@medozas.de
@@ -280,15 +276,18 @@ Jan Moringen jan.moringen@uni-bielefeld.de
Jan Nieuwenhuizen janneke@gnu.org
Jan-Pawel Wrozstinski jpwroz@gmail.com
Janos Farkas chexum@shadow.banki.hu
Jari Aalto jari.aalto@cante.net
Jarkko Hietaniemi jhi@epsilon.hut.fi
Jarod Wilson jwilson@redhat.com
Jean Charles Delepine delepine@u-picardie.fr
Jean-Pierre Tosoni jpt.7196@gmail.com
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
Jérémy Magrin jeremy.magrin@epitech.eu
Jerome Abela abela@hsc.fr
Jérôme Zago bug-coreutils-ml@agt-the-walker.net
Jesse Kornblum kornblum@usna.edu
@@ -299,13 +298,11 @@ Jim Dennis jimd@starshine.org
Joakim Rosqvist dvljrt@cs.umu.se
Jochen Hein jochen@jochen.org
Joe Orton joe@manyfish.co.uk
Joel E. Denny jdenny@clemson.edu
Joerg Sonnenberger joerg@britannica.bec.de
Joey Hess joeyh@debian.org
Johan Boule bohan@bohan.dyndns.org
Johan Danielsson joda@pdc.kth.se
John Bley jbb6@acpub.duke.edu
John David Anglin dave.anglin@nrc.ca
John Gatewood Ham zappaman@alphabox.compsci.buu.ac.th
John Gotts jgotts@umich.edu
John Kendall kendall@capps.com
@@ -317,7 +314,9 @@ John Stanley johnstops@verizon.net
John Summerfield summer@OS2.ami.com.au
Jon Peatfield J.S.Peatfield@damtp.cam.ac.uk
Joost van Baal joostvb@xs4all.nl
Jordi Pujol jordipujolp@gmail.com
Jorge Stolfi stolfi@ic.unicamp.br
Joseph D. Wagner joe@josephdwagner.info
Joseph S. Myers jsm28@cam.ac.uk
Josh Triplett josh@freedesktop.org
Joshua Hudson joshudson@gmail.com
@@ -327,6 +326,7 @@ Juan M. Guerrero st001906@hrz1.hrz.tu-darmstadt.de
Julian Bradfield jcb@inf.ed.ac.uk
Jungshik Shin jshin@pantheon.yale.edu
Jürgen Fluk louis@dachau.marco.de
Juraj Marko jmarko@redhat.com
Jurriaan thunder7@xs4all.nl
Justin Pryzby justinpryzby@users.sourceforge.net
jvogel jvogel@linkny.com
@@ -335,7 +335,6 @@ Kai-Uwe Rommel rommel@informatik.tu-muenchen.de
Kalle Olavi Niemitalo kon@iki.fi
Kamal Paul Nigam Kamal_Paul_Nigam@gs35.sp.cs.cmu.edu
Karl Eichwalder keichwa@gmx.net
Karl Heuer kwzh@gnu.org
Karl-Michael Schneider schneide@phil.uni-passau.de
Karsten Thygesen karthy@kom.auc.dk
Kaveh R. Ghazi ghazi@caip.rutgers.edu
@@ -344,8 +343,8 @@ Keith Owens kaos@audio.apana.org.au
Keith Thompson kst@cts.com
Ken Pizzini kenp@halcyon.com
Kevin Mudrick kmudrick@healthmarketscience.com
Kim Hansen kim@i9.dk
Kirk Kelsey kirk.kelsey@0x4b.net
Konrad Wróblewski coni@o2.pl
Kristin E Thomas kristint@us.ibm.com
Kjetil Torgrim Homme kjetilho@ifi.uio.no
Kristoffer Rose kris@diku.dk
@@ -367,8 +366,10 @@ Manfred Hollstein manfred@s-direktnet.de
Марк Коренберг socketpair@gmail.com
Marc Boucher marc@mbsi.ca
Marc Haber mh+debian-bugs@zugschlus.de
Marc Mengel mengel@fnal.gov
Marc Lehman schmorp@schmorp.de
Marc Olzheim marcolz@stack.nl
Marcel Böhme http://www.comp.nus.edu.sg/~mboehme
Marco Franzen Marco.Franzen@Thyron.com
Marcus Brinkmann http://www.marcus-brinkmann.de
Marcus Daniels marcus@ee.pdx.edu
@@ -399,6 +400,7 @@ Mate Wierdl mw@moni.msci.memphis.edu
Matej Vela mvela@public.srce.hr
Matias A. Fonzo selk@dragora.org
Matt Kraai kraai@ftbfs.org
Matt McCutchen matt@mattmccutchen.net
Matt Perry matt@primefactor.com
Matt Pham mattvpham@gmail.com
Matt Schalit mschalit@pacbell.net
@@ -410,7 +412,6 @@ Matthew Clarke Matthew_Clarke@mindlink.bc.ca
Matthew S. Levine mslevine@theory.lcs.mit.edu
Matthew Smith matts@bluesguitar.org
Matthew Swift swift@alum.mit.edu
Matthew Woehlke mw_triad@users.sourceforge.net
Matthias Urlichs smurf@noris.de
Matti Aarnio matti.aarnio@zmailer.org
Mathias Brodala info@noctus.net
@@ -426,12 +427,14 @@ Michael Gaughen mgaughen@polyserve.com
Michael Hasselberg mikelh@zonta.ping.de
Michael Hohn hohn@math.utah.edu
Michael J. Croghan mcroghan@usatoday.com
Michael J. Daniel michael.j.daniel@comcast.net
Michael McFarland sidlon@yahoo.com
Michael McLagan mmclagan@invlogic.com
Michael Mol mikemol@gmail.com
Michael Piefel piefel@informatik.hu-berlin.de
Michael Speer knomenet@gmail.com
Michael Price mprice@atl.lmco.com
Michael Steffens michael.steffens@s.netic.de
Michael Stone mstone@debian.org
Michael Stummvoll michael@stummi.org
Michael Stutz stutz@dsl.org
Michael van Elst mlelstv@dev.de.cw.net
Michael Veksler mveksler@techunix.technion.ac.il
@@ -440,18 +443,17 @@ 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
Mike Frysinger vapier@gentoo.org
Mikko Tuumanen m@sorvankyla.yok.utu.fi
Mikulas Patocka mikulas@artax.karlin.mff.cuni.cz
Miles Bader miles@gnu.ai.mit.edu
Minh Tran-Le tranle@intellicorp.com
Morten Welinder terra@diku.dk
Nao Nishijima nao.nishijima.xt@hitachi.com
Neal H Walfield neal@cs.uml.edu
Neil Brown neilb@cse.unsw.edu.au
Neil F. Brown neilb@suse.de
Nelson H. F. Beebe beebe@math.utah.edu
Nick Estes debian@nickstoys.com
Nick Graham nick.d.graham@gmail.com
@@ -460,6 +462,7 @@ 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
Nikolaus Rath Nikolaus@rath.org
Nima Nikzad nnikzad@ucla.edu
Noah Friedman friedman@splode.com
Noel Cragg noel@red-bean.com
@@ -472,52 +475,54 @@ Olivier Fourdan ofourdan@redhat.com
Ørn E. Hansen oehansen@daimi.aau.dk
Oskar Liljeblad osk@hem.passagen.se
Otavio Salvador otavio@ossystems.com.br
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
Paul Marinescu paul.marinescu@imperial.ac.uk
Paul Nevai nevai@ops.mps.ohio-state.edu
Paul Sauer paul@alexa.com
Paul Slootman paul@debian.org
Paul Townsend aab@purdue.edu
Paul Worrall paul@basilisk.uklinux.net
Pawel Prokop pablo@wizard.ae.krakow.pl
Peng Yu pengyu.ut@gmail.com
Per Cederqvist ceder@lysator.liu.se
Per Kristian Hove perhov@math.ntnu.no
Per Starbäck starback@stp.lingfil.uu.se
Peter Breitenlohner peb@mppmu.mpg.de
Peter Dyballa peter_dyballa@web.de
Peter Eriksson peter@ifm.liu.se
Peter Fales psfales@lucent.com
Peter Evans peter@ixp.jp
Peter Horst peter@ointment.org
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 Pisar petr.pisar@atlas.cz
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
Philipp Gortan gortan@gmail.com
Philipp Thomas pth@suse.de
Piergiorgio Sartor sartor@sony.de
Pieter Bowman bowman@math.utah.edu
Piotr Gackiewicz gacek@intertele.pl
Piotr Kwapulinski kwap@univ.gda.pl
Prashant TR tr@eth.net
Priit Jõerüüt jemm4jemm@yahoo.com
Primoz PETERLIN primozz.peterlin@gmail.com
Raimonds Miltins raimonds@pro-9.com
Rainer Orth ro@TechFak.Uni-Bielefeld.DE
Ralf W. Stephan stephan@tmt.de
Ralf Wildenhues Ralf.Wildenhues@gmx.de
Ralph Loader loader@maths.ox.ac.uk
Rasmus Borup Hansen rbh@intomics.com
Raul Miller moth@magenta.com
Raúl Núñez de Arenas Coronado raul@pleyades.net
Reuben Thomas rrt@sc3d.org
Yang Ren ryang@redhat.com
Rich Burridge rich.burridge@oracle.com
Richard A Downing richard.downing@bcs.org.uk
Richard Braakman dark@xs4all.nl
Richard Dawe rich@phekda.freeserve.co.uk
@@ -525,6 +530,7 @@ Richard J. Rauenzahn rrauenza@hairball.cup.hp.com
Richard Neill rn214@hermes.cam.ac.uk
Richard Sharman rsharman@magmacom.com
Rick Sladkey jrs@world.std.com
Rick Stanley rstanley@rsiny.com
Rik Faith faith@cs.unc.edu
Risto Kankkunen kankkune@lingsoft.fi
Rob Wortman wyrm@haell.com
@@ -553,13 +559,14 @@ Scott Harrison scott.gnu.2009@scottrix.co.uk
Scott Lurndal slurn@griffin.engr.sgi.com
Sébastien Maret smaret@umich.edu
Sergei Steshenko sergstesh@yahoo.com
Sergey Vlasov vsu@altlinux.org
Shing-Shong Shei shei@cs.indiana.edu
Soeren Sonnenburg sonnenburg@informatik.hu-berlin.de
Solar Designer solar@owl.openwall.com
Stanislav Ievlev inger@altlinux.ru
Stavros Passas stabat@ics.forth.gr
Stefan Vargyas stvar@yahoo.com
Stéphane Chazelas Stephane_CHAZELAS@yahoo.fr
Stéphane Raimbault stephane.raimbault@makina-corpus.com
Stephen Depooter sbdep@myrealbox.com
Stephen Eglen eglen@pcg.wustl.edu
Stephen Gildea gildea@stop.mail-abuse.org
@@ -576,13 +583,12 @@ Steven P Watson steven@magelico.net
Stuart Citrin ctrn3e8@gmail.com
Stuart Kemp skemp@peter.bmc.com
Stuart Shelton stuart@shelton.me
Sven Joachim svenjoac@gmx.de
Sven Breuner sven.breuner@itwm.fraunhofer.de
Szakacsits Szabolcs szaka@sienet.hu
Tadayoshi Funaba tadf@kt.rim.or.jp
TAKAI Kousuke takai@vlsi.kuee.kyoto-u.ac.jp
Theodore Ts'o tytso@rsts-11.mit.edu
The Wanderer inverseparadox@comcast.net
Theodoros V. Kalamatianos nyb@users.sourceforge.net
Thomas Bushnell thomas@gnu.ai.mit.edu
Thomas Goerlich thomas@schnappmatik.de
Thomas Hood jdthood@yahoo.co.uk
@@ -595,9 +601,8 @@ 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 Underwood timunderwood@gmail.com
Tim Waugh twaugh@redhat
Tobias Quathamer toddy@debian.org
Tobias Stoeckmann tobias@bugol.de
Toby Peterson toby@opendarwin.org
Todd A. Jacobs tjacobs@codegnome.org
Tom Fitzhenry tom@tom-fitzhenry.me.uk
@@ -610,10 +615,11 @@ Ton Nijkes ton@murphy.nl
Tony Kocurko akocurko@mun.ca
Tony Leneis tony@plaza.ds.adp.com
Tony Robinson ajr@eng.cam.ac.uk
Toomas Soome Toomas.Soome@Elion.ee
Toralf Förster toralf.foerster@gmx.de
Torbjorn Granlund tege@nada.kth.se
Torbjorn Lindgren tl@funcom.no
Torsten Landschoff torsten@pclab.ifg.uni-kiel.de
Travis Gummels tgummels@redhat.com
Tristan Miller psychonaut@nothingisreal.com
Tzvi Rotshtein tzvi.ro@gmail.com
Ulrich Drepper drepper@gnu.org
@@ -621,7 +627,9 @@ Ulrich Hermisson ulrich_hermisson@hotmail.com
Urs Thuermann urs@isnogud.escape.de
Uwe H. Steinfeld usteinfeld@gmx.net
Vesselin Atanasov vesselin@bgnet.bg
Ville Skyttä ville.skytta@iki.fi
Vin Shelton acs@alumni.princeton.edu
Vincent Lefevre vincent@vinc17.org
Vineet Chadha chadha@acis.ufl.edu
Vitali Lovich vlovich@gmail.com
Vitaly A. Ostanin vyt@altlinux.org
@@ -643,10 +651,11 @@ Wis Macomson wis.macomson@intel.com
Wojciech Purczynski cliph@isec.pl
Wolfram Kleff kleff@cs.uni-bonn.de
Won-kyu Park wkpark@chem.skku.ac.kr
Xu Zhongxing xu_zhong_xing@163.com
Yang Ren ryang@redhat.com
Yanko Kaneti yaneti@declera.com
Yann Dirson dirson@debian.org
Yutaka Amanai yasai-itame1942@jade.plala.or.jp
Zvi Har'El rl@math.technion.ac.il
;; Local Variables:
;; coding: utf-8

28
TODO
View File

@@ -37,21 +37,14 @@ printf:
consider adding some implementation of the "col" utility
Suggested by Karl Berry.
renice: POSIX utility, needs implementing.
suggestion from Karl Berry (among others).
Bob Proulx is working on this.
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.
ls: add --format=FORMAT option that controls how each line is printed.
cp --no-preserve=X should not attempt to preserve attribute X
reported by Andreas Schwab
copy.c: Address the FIXME-maybe comment in copy_internal.
And once that's done, add an exclusion so that `cp --link'
And once that's done, add an exclusion so that 'cp --link'
no longer incurs the overhead of saving src. dev/ino and dest. filename
in the hash table.
@@ -78,9 +71,6 @@ unexpand: [http://www.opengroup.org/onlinepubs/007908799/xcu/unexpand.html]
printf 'x\t \t y\n'|unexpand -t 8,9 should print its input, unmodified.
printf 'x\t \t y\n'|unexpand -t 5,8 should print "x\ty\n"
Let GNU su use the `wheel' group if appropriate.
(there are a couple patches, already)
sort: Investigate better sorting algorithms; see Knuth vol. 3.
We tried list merge sort, but it was about 50% slower than the
@@ -125,10 +115,6 @@ Changes expected to go in, someday.
an implicit --NO-dereference-command-line-symlink-to-dir meaning.
Pointed out by Karl Berry.
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
Pending copyright papers:
------------------------
getpwnam from Bruce Korb
@@ -138,17 +124,13 @@ Changes expected to go in, someday.
------------------------------
Remove long-deprecated options. Search case-insensitive for
`deprecated' and `remove in '. Automate this.
'deprecated' and 'remove in '. Automate this.
Add a distcheck-time test to ensure that every distributed
file is either read-only(indicating generated) or is
version-controlled and up to date.
remove `%s' notation (now that they're all gone, add a maint.mk sc_
rule to ensure no new ones are added):
grep -E "\`%.{,4}s'" src/*.c
remove all uses of the `register' keyword: Done. add a maint.mk rule
remove all uses of the 'register' keyword: Done. add a maint.mk rule
for this, too.
remove or adjust chown's --changes option, since it
@@ -162,13 +144,13 @@ 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
(preferably `no') cost when operating in single-byte mode.
(preferably 'no') cost when operating in single-byte mode.
pr's use of nstrftime can make it malloc a very large (up to SIZE_MAX) buffer
-----
Copyright (C) 2002-2010 Free Software Foundation, Inc.
Copyright (C) 2002-2013 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

708
bootstrap

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
# Bootstrap configuration.
# Copyright (C) 2006-2010 Free Software Foundation, Inc.
# Copyright (C) 2006-2013 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -25,7 +25,6 @@ avoided_gnulib_modules='
# gnulib modules used by this package.
gnulib_modules="
$avoided_gnulib_modules
$obsolete_gnulib_modules
acl
alignof
alloca
@@ -37,6 +36,7 @@ gnulib_modules="
autobuild
backupfile
base64
buffer-lcm
c-strcase
c-strtod
c-strtold
@@ -61,6 +61,7 @@ gnulib_modules="
dirfd
dirname
do-release-commit-and-tag
dtoastr
dup2
environ
error
@@ -70,9 +71,15 @@ gnulib_modules="
faccessat
fadvise
fchdir
fchmodat
fchownat
fclose
fcntl
fcntl-safer
fd-reopen
fdatasync
fdl
fdopen
fdutimensat
file-type
fileblocks
@@ -85,15 +92,20 @@ gnulib_modules="
freopen
freopen-safer
fseeko
fstatat
fsusage
fsync
ftello
ftoastr
ftruncate
fts
full-read
full-write
getgroups
gethrxtime
getline
getloadavg
getlogin
getndelim2
getopt-gnu
getpagesize
@@ -121,9 +133,12 @@ gnulib_modules="
inttostr
inttypes
isapipe
isatty
isblank
largefile
lchmod
lchown
ldtoastr
lib-ignore
linebuffer
link
@@ -134,6 +149,7 @@ gnulib_modules="
maintainer-makefile
malloc-gnu
manywarnings
mbrlen
mbrtowc
mbsalign
mbswidth
@@ -146,18 +162,22 @@ gnulib_modules="
mkancesdirs
mkdir
mkdir-p
mkfifo
mknod
mkstemp
mktime
modechange
mountlist
mpsort
netinet_in
non-recursive-gnulib-prefix-hack
nproc
obstack
parse-datetime
pathmax
perl
physmem
pipe
posix-shell
posixtm
posixver
@@ -170,6 +190,7 @@ gnulib_modules="
quotearg
randint
randperm
read-file
readlink
readtokens
readtokens0
@@ -190,8 +211,11 @@ gnulib_modules="
settime
sig2str
sigaction
smack
ssize_t
statat
stat-macros
stat-size
stat-time
stdbool
stdlib-safer
@@ -199,22 +223,27 @@ gnulib_modules="
stpncpy
strdup-posix
strftime
strncat
strnumcmp
strpbrk
strsignal
strtod
strtoimax
strtol
strtoumax
symlink
sys_ioctl
sys_resource
sys_stat
sys_wait
termios
timer-time
timespec
tzset
uname
unicodeio
unistd-safer
unlink-busy
unlinkat
unlocked-io
unsetenv
update-copyright
@@ -228,13 +257,16 @@ gnulib_modules="
verify
verror
version-etc-fsf
wcswidth
wcwidth
winsz-ioctl
winsz-termios
write-any-file
xalloc
xfreopen
xfts
xgetcwd
xgetgroups
xgethostname
xmemcoll
xnanosleep
@@ -277,45 +309,21 @@ XGETTEXT_OPTIONS=$XGETTEXT_OPTIONS'\\\
--keyword=proper_name_utf8:1,'"$see_manual"'\\\
'
# If "AM_GNU_GETTEXT(external" or "AM_GNU_GETTEXT([external]"
# appears in configure.ac, exclude some unnecessary files.
# Without grep's -E option (not portable enough, pre-configure),
# the following test is ugly. Also, this depends on the existence
# of configure.ac, not the obsolescent-named configure.in. But if
# you're using this infrastructure, you should care about such things.
gettext_external=0
grep '^[ ]*AM_GNU_GETTEXT(external\>' configure.ac > /dev/null &&
gettext_external=1
grep '^[ ]*AM_GNU_GETTEXT(\[external\]' configure.ac > /dev/null &&
gettext_external=1
if test $gettext_external = 1; then
# Gettext supplies these files, but we don't need them since
# we don't have an intl subdirectory.
excluded_files='
m4/glibc2.m4
m4/intdiv0.m4
m4/lcmessage.m4
m4/uintmax_t.m4
m4/ulonglong.m4
m4/visibility.m4
'
fi
gnulib_tool_option_extras="--tests-base=$bt/gnulib-tests --with-tests"
gnulib_tool_option_extras="--tests-base=gnulib-tests --with-tests --symlink\
--makefile-name=gnulib.mk
"
# Build prerequisites
buildreq="\
autoconf 2.62
automake 1.11.1
autoconf 2.64
automake 1.11.2
autopoint -
bison -
gettext 0.18
gettext 0.18.1
git 1.4.4
gperf -
gzip -
makeinfo -
makeinfo 4.13
patch -
perl 5.5
rsync -
@@ -323,16 +331,26 @@ tar -
xz -
"
# Automake requires that ChangeLog exist.
touch ChangeLog || exit 1
bootstrap_post_import_hook ()
{
# Automake requires that ChangeLog exist.
touch ChangeLog || return 1
# List of coreutils programs. See heading comments in the invoked
# script for more info. Keep this in sync with the rules in
(m4f=m4/cu-progs.m4 mkf=src/cu-progs.mk tmp=cu-progs.tmp \
&& rm -f $m4f $mkf $tmp-1 $tmp-2 \
&& build-aux/gen-lists-of-programs.sh --autoconf >$tmp-1 \
&& build-aux/gen-lists-of-programs.sh --automake >$tmp-2 \
&& chmod a-w $tmp-1 $tmp-2 \
&& mv -f $tmp-1 $m4f && mv -f $tmp-2 $mkf)
# Massage lib/gnulib.mk before using it later in the bootstrapping process.
build-aux/prefix-gnulib-mk --lib-name=$gnulib_name lib/$gnulib_mk
}
bootstrap_epilogue()
{
# Change paths in gnulib-tests/gnulib.mk from "../.." to "..".
m=gnulib-tests/gnulib.mk
sed 's,\.\./\.\.,..,g' $m > $m-t
mv -f $m-t $m
# Since this is a "GNU" package, replace this line
# if LC_ALL=C grep 'GNU @PACKAGE@' $(top_srcdir)/* 2>/dev/null \
# | grep -v 'libtool:' >/dev/null; then
@@ -343,4 +361,18 @@ bootstrap_epilogue()
# first grep may well run out of memory.
perl -pi -e 's/if LC_ALL=C grep .GNU .PACKAGE.*; then/if true; then/' \
po/Makefile.in.in
# Install our git hooks, as long as "cp" accepts the --backup option,
# so that we can back up any existing files.
case $(cp --help) in *--backup*) backup=1;; *) backup=0;; esac
if test $backup = 1; then
hooks=$(cd scripts/git-hooks && git ls-files)
for f in $hooks; do
# If it is identical, skip it.
cmp scripts/git-hooks/$f .git/hooks/$f > /dev/null \
&& continue
cp --backup=numbered scripts/git-hooks/$f .git/hooks
chmod a-w .git/hooks/$f
done
fi
}

View File

@@ -234,7 +234,7 @@
-----
Copyright (C) 2002-2010 Free Software Foundation, Inc.
Copyright (C) 2002-2013 Free Software Foundation, Inc.
Copying and distribution of this file, with or without
modification, are permitted provided the copyright notice

View File

@@ -1,512 +0,0 @@
#! /usr/bin/perl -w
# cvsu - do a quick check to see what files are out of date.
#
# Copyright (C) 2000-2005 Pavel Roskin <proski@gnu.org>
# Initially written by Tom Tromey <tromey@cygnus.com>
# Completely rewritten by Pavel Roskin <proski@gnu.org>
#
# 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/>.
require 5.004;
use Getopt::Long;
use File::Basename;
use Time::Local;
use strict;
use vars qw($list_types %messages %options @batch_list $batch_cmd
$no_recurse $explain_type $find_mode $short_print
$no_cvsignore $nolinks $file $single_filename $curr_dir
@common_ignores $ignore_rx %entries %subdirs %removed);
use constant SUBDIR_FOUND => 1;
use constant SUBDIR_CVS => 2;
# This list comes from the CVS manual.
use constant STANDARD_IGNORES =>
('RCS', 'SCCS', 'CVS', 'CVS.adm', 'RCSLOG', 'cvslog.*', 'tags',
'TAGS', '.make.state', '.nse_depinfo', '*~', '#*', '.#*', ',*',
"_\$*", "*\$", '*.old', '*.bak', '*.BAK', '*.orig', '*.rej',
'.del-*', '*.a', '*.olb', '*.o', '*.obj', '*.so', '*.exe',
'*.Z', '*.elc', '*.ln', 'core');
# 3-letter month names in POSIX locale, for fast date decoding
my %months = (
"Jan" => 0,
"Feb" => 1,
"Mar" => 2,
"Apr" => 3,
"May" => 4,
"Jun" => 5,
"Jul" => 6,
"Aug" => 7,
"Sep" => 8,
"Oct" => 9,
"Nov" => 10,
"Dec" => 11
);
# print usage information and exit
sub usage ()
{
print "Usage:\n" .
" cvsu [OPTIONS] [FILE] ...\n" .
"Options:\n" .
" --local Disable recursion\n" .
" --explain Verbosely print status of files\n" .
" --find Emulate find - filenames only\n" .
" --short Don't print paths\n" .
" --ignore Don't read .cvsignore\n" .
" --messages List known file types and long messages\n" .
" --nolinks Disable recognizing hard and soft links\n" .
" --types=[^]LIST Print only file types [not] from LIST\n" .
" --batch=COMMAND Execute this command on files\n" .
" --help Print this usage information\n" .
" --version Print version number\n" .
"Abbreviations and short options are supported\n";
exit 0;
}
# print version information and exit
sub version ()
{
print "cvsu - CVS offline examiner, version 0.2.3\n";
exit 0;
}
# If types begin with '^', make inversion
sub adjust_types ()
{
if ($list_types =~ m{^\^(.*)$}) {
$list_types = "";
foreach (keys %messages) {
$list_types .= $_
if (index ($1, $_) < 0);
}
}
}
# list known messages and exit
sub list_messages ()
{
my $default_mark;
print "Recognizable file types are:\n";
foreach (sort keys %messages) {
if (index($list_types, $_) >= 0) {
$default_mark = "*";
} else {
$default_mark = " ";
}
print " $default_mark $_ $messages{$_}\n";
}
print "* indicates file types listed by default\n";
exit 0;
}
# Initialize @common_ignores
# Also read $HOME/.cvsignore and append it to @common_ignores
sub init_ignores ()
{
my $HOME = $ENV{"HOME"};
push @common_ignores, STANDARD_IGNORES;
unless (defined($HOME)) {
return;
}
my $home_cvsignore = "${HOME}/.cvsignore";
if (-f "$home_cvsignore") {
unless (open (CVSIGNORE, "< $home_cvsignore")) {
error ("couldn't open $home_cvsignore: $!");
}
while (<CVSIGNORE>) {
push (@common_ignores, split);
}
close (CVSIGNORE);
}
my $CVSIGNOREENV = $ENV{"CVSIGNORE"};
unless (defined($CVSIGNOREENV)) {
return;
}
my @ignores_var = split (/ /, $CVSIGNOREENV);
push (@common_ignores, @ignores_var);
}
# Print message and exit (like "die", but without raising an exception).
# Newline is added at the end.
sub error ($)
{
print STDERR "cvsu: ERROR: " . shift(@_) . "\n";
exit 1;
}
# execute commands from @exec_list with $exec_cmd
sub do_batch ()
{
my @cmd_list = split (' ', $batch_cmd);
system (@cmd_list, @batch_list);
}
# print files status
# Parameter 1: status in one-letter representation
sub file_status ($)
{
my $type = shift (@_);
my $item;
my $pathfile;
return
if $ignore_rx ne '' && $type =~ /[?SLD]/ && $file =~ /$ignore_rx/;
return
if (index($list_types, $type) < 0);
$pathfile = $curr_dir . $file;
if (defined($batch_cmd)) {
push (@batch_list, $pathfile);
# 1000 items in the command line might be too much for HP-UX
if ($#batch_list > 1000) {
do_batch();
undef @batch_list;
}
}
if ($short_print) {
$item = $file;
} else {
$item = $pathfile;
}
if ($find_mode) {
print "$item\n";
} else {
$type = $messages{$type}
if ($explain_type);
print "$type $item\n";
}
}
# load entries from CVS/Entries and CVS/Entries.Log
# Parameter 1: file name for CVS/Entries
# Return: list of entries in the format used in CVS/Entries
sub load_entries ($);
sub load_entries ($)
{
my $entries_file = shift (@_);
my $entries_log_file = "$entries_file.Log";
my %ent = ();
unless (open (ENTRIES, "< $entries_file")) {
error ("couldn't open $entries_file: $!");
}
while (<ENTRIES>) {
chomp;
$ent{$_} = 1;
}
close (ENTRIES);
if (open (ENTRIES, "< $entries_log_file")) {
while (<ENTRIES>) {
chomp;
if ( m{^A (.+)} ) {
$ent{$1} = 1;
} elsif ( m{^R (.+)} ) {
delete $ent{$1};
} else {
# Note: "cvs commit" helps even when you are offline
error ("$entries_log_file:$.: unrecognizable line, " .
"try \"cvs commit\"");
}
}
close (ENTRIES);
}
return keys %ent;
}
# process one directory
# Parameter 1: directory name
sub process_arg ($);
sub process_arg ($)
{
my $arg = shift (@_);
my %found_files = ();
# $file, $curr_dir, and $ignore_rx must be seen in file_status
local $file = "";
local $ignore_rx = "";
local $single_filename = 0;
if ( $arg eq "" or -d $arg ) {
$curr_dir = $arg;
my $real_curr_dir = $curr_dir eq "" ? "." : $curr_dir;
error ("$real_curr_dir is not a directory")
unless ( -d $real_curr_dir );
# Scan present files.
file_status (".");
opendir (DIR, $real_curr_dir) ||
error ("couldn't open directory $real_curr_dir: $!");
foreach (readdir (DIR)) {
$found_files {$_} = 1;
}
closedir (DIR);
} else {
$single_filename = basename $arg;
$curr_dir = dirname $arg;
$found_files{$single_filename} = 1 if lstat $arg;
}
$curr_dir .= "/"
unless ( $curr_dir eq "" || $curr_dir =~ m{/$} );
# Scan CVS/Entries.
my %entries = ();
my %subdirs = ();
my %removed = ();
foreach ( load_entries ("${curr_dir}CVS/Entries") ) {
if ( m{^D/([^/]+)/} ) {
$subdirs{$1} = SUBDIR_FOUND if !$single_filename;
} elsif ( m{^/([^/]+)/([^/])[^/]*/([^/]*)/} ) {
if ( !$single_filename or $single_filename eq $1 ) {
$entries{$1} = $3;
$removed{$1} = 1
if $2 eq '-';
}
} elsif ( m{^D$} ) {
next;
} else {
error ("${curr_dir}CVS/Entries: unrecognizable line");
}
}
if ( $single_filename && !$entries{$single_filename} &&
!$found_files{$single_filename} ) {
error ("nothing known about $arg");
}
# Scan .cvsignore if any
unless ($no_cvsignore) {
my (@ignore_list) = ();
if (-f "${curr_dir}.cvsignore") {
open (CVSIGNORE, "< ${curr_dir}.cvsignore")
|| error ("couldn't open ${curr_dir}.cvsignore: $!");
while (<CVSIGNORE>) {
push (@ignore_list, split);
}
close (CVSIGNORE);
}
my ($iter);
foreach $iter (@ignore_list, @common_ignores) {
if ($iter eq '!') {
$ignore_rx = ''
} else {
if ($ignore_rx eq '') {
$ignore_rx = '^(';
} else {
$ignore_rx .= '|';
}
$ignore_rx .= glob_to_rx ($iter);
}
}
$ignore_rx .= ')$'
if $ignore_rx ne '';
}
# File is missing
foreach $file (sort keys %entries) {
unless ($found_files{$file}) {
if ($removed{$file}) {
file_status("R");
} else {
file_status("U");
}
}
}
foreach $file (sort keys %found_files) {
next if ($file eq '.' || $file eq '..');
lstat ($curr_dir . $file) ||
error ("lstat() failed on $curr_dir . $file");
if (! $nolinks && -l _) {
file_status ("L");
} elsif (-d _) {
if ($file eq 'CVS') {
file_status ("C");
} elsif ($subdirs{$file}) {
$subdirs{$file} = SUBDIR_CVS;
} else {
file_status ("D"); # Unknown directory
}
} elsif (! (-f _) && ! (-l _)) {
file_status ("S"); # This must be something very special
} elsif (! $nolinks && (stat _) [3] > 1 ) {
file_status ("H"); # Hard link
} elsif (! $entries{$file}) {
file_status ("?");
} elsif ($entries{$file} =~ /^Initial |^dummy /) {
file_status ("A");
} elsif ($entries{$file} =~ /^Result of merge/) {
file_status ("G");
} elsif ($entries{$file} !~
/^(...) (...) (..) (..):(..):(..) (....)$/) {
error ("Invalid timestamp for $curr_dir$file: $entries{$file}");
} else {
my $cvtime = timegm($6, $5, $4, $3, $months{$2}, $7 - 1900);
my $mtime = (stat _) [9];
if ($cvtime == $mtime) {
file_status ("F");
} elsif ($cvtime < $mtime) {
file_status ("M");
} else {
file_status ("O");
}
}
}
# Now do directories.
unless ($no_recurse) {
my $save_curr_dir = $curr_dir;
foreach $file (sort keys %subdirs) {
if ($subdirs{$file} == SUBDIR_FOUND) {
$curr_dir = $save_curr_dir;
file_status ("X");
} elsif ($subdirs{$file} == SUBDIR_CVS) {
process_arg ($save_curr_dir . $file)
}
}
}
}
# Turn a glob into a regexp without recognizing square brackets.
sub glob_to_rx_simple ($)
{
my ($expr) = @_;
# Quote all non-word characters, convert ? to . and * to .*
$expr =~ s/(\W)/\\$1/g;
$expr =~ s/\\\*/.*/g;
$expr =~ s/\\\?/./g;
return $expr;
}
# Turn a glob into a regexp
sub glob_to_rx ($)
{
my $result = '';
my ($expr) = @_;
# Find parts in square brackets and copy them literally
# Text outside brackets is processed by glob_to_rx_simple()
while ($expr ne '') {
if ($expr =~ /^(.*?)(\[.*?\])(.*)/) {
$expr = $3;
$result .= glob_to_rx_simple ($1) . $2;
} else {
$result .= glob_to_rx_simple ($expr);
last;
}
}
return $result;
}
sub Main ()
{
# types of files to be listed
$list_types = "^.FCL";
# long status messages
%messages = (
"?" => "Unlisted file",
"." => "Known directory",
"F" => "Up-to-date file",
"C" => "CVS admin directory",
"M" => "Modified file",
"S" => "Special file",
"D" => "Unlisted directory",
"L" => "Symbolic link",
"H" => "Hard link",
"U" => "Lost file",
"X" => "Lost directory",
"A" => "Newly added",
"O" => "Older copy",
"G" => "Result of merge",
"R" => "Removed file"
);
undef @batch_list; # List of files for batch processing
undef $batch_cmd; # Command to be executed on files
$no_recurse = 0; # If this is set, do only local files
$explain_type = 0; # Verbosely print status of files
$find_mode = 0; # Don't print status at all
$short_print = 0; # Print only filenames without path
$no_cvsignore = 0; # Ignore .cvsignore
$nolinks = 0; # Do not test for soft- or hard-links
my $want_msg = 0; # List possible filetypes and exit
my $want_help = 0; # Print help and exit
my $want_ver = 0; # Print version and exit
my %options = (
"types=s" => \$list_types,
"batch=s" => \$batch_cmd,
"local" => \$no_recurse,
"explain" => \$explain_type,
"find" => \$find_mode,
"short" => \$short_print,
"ignore" => \$no_cvsignore,
"messages" => \$want_msg,
"nolinks" => \$nolinks,
"help" => \$want_help,
"version" => \$want_ver
);
GetOptions(%options);
adjust_types();
list_messages() if $want_msg;
usage() if $want_help;
version() if $want_ver;
unless ($no_cvsignore) {
init_ignores();
}
if ($#ARGV < 0) {
@ARGV = ("");
}
foreach (@ARGV) {
process_arg ($_);
}
if ($#batch_list >= 0) {
do_batch();
}
}
Main();

View File

@@ -0,0 +1,186 @@
#!/bin/sh
# Generate lists of all coreutils programs, to be fed both to Autoconf
# and Automake, and with further distinctions about how and when these
# programs should be built. This is useful to avoid duplicating these
# list definitions among several files ('configure.ac' and
# 'src/local.mk' at least); such duplication had proved a source of
# inconsistencies and bugs in the past.
set -u
set -e
# These are the names of programs that are neither built nor installed
# by default. This list is *not* intended for programs like 'who',
# 'nice', 'chroot', etc., that are built only when certain requisite
# system features are detected.
# If you would like to install programs from this list anyway, say A and B,
# use "--enable-install-program=A,B" when invoking configure.
disabled_by_default_progs='
arch
hostname
'
# Programs that can be built only when certain requisite system
# features are detected at configure time.
build_if_possible_progs='
chroot
df
hostid
libstdbuf.so
nice
pinky
stdbuf
stty
uptime
users
who
'
# All the other programs, to be built by default, and that should
# be buildable without problems on any target system.
normal_progs='
[
base64
basename
cat
chcon
chgrp
chmod
chown
cksum
comm
cp
csplit
cut
date
dd
dir
dircolors
dirname
du
echo
env
expand
expr
factor
false
fmt
fold
ginstall
groups
head
id
join
kill
link
ln
logname
ls
md5sum
mkdir
mkfifo
mknod
mktemp
mv
nl
nproc
nohup
numfmt
od
paste
pathchk
pr
printenv
printf
ptx
pwd
readlink
realpath
rm
rmdir
runcon
seq
sha1sum
sha224sum
sha256sum
sha384sum
sha512sum
shred
shuf
sleep
sort
split
stat
sum
sync
tac
tail
tee
test
timeout
touch
tr
true
truncate
tsort
tty
uname
unexpand
uniq
unlink
vdir
wc
whoami
yes
'
me=`echo "$0" | sed 's,.*/,,'`
msg="Automatically generated by $me. DO NOT EDIT BY HAND!"
case $#,$1 in
1,--autoconf|1,--for-autoconf)
echo "dnl $msg"
for p in $normal_progs; do
test x"$p" = x"[" && p='@<:@'
echo "gl_ADD_PROG([optional_bin_progs], [$p])"
done
# Extra 'echo' to normalize whitespace.
echo "no_install_progs_default='`echo $disabled_by_default_progs`'"
sed 's/^ *//' <<END
# Given the name of a variable containing a space-separated
# list of install-by-default programs and the actual list of
# do-not-install-by-default programs, modify the former variable
# to reflect any "do-install" and "don't-install" requests.
# That is, add any program specified via --enable-install-program,
# and remove any program specified via --enable-no-install-program.
# Note how the second argument below is a literal, with ","
# separators. That is required due to the way the macro works,
# and since the corresponding ./configure option argument is
# comma-separated on input.
gl_INCLUDE_EXCLUDE_PROG([optional_bin_progs], [`\
echo $disabled_by_default_progs \
| sed 's/ /,/g'`])
END
;;
1,--automake|1,--for-automake)
echo "## $msg"
progsdir=src
echo no_install__progs =
for p in $disabled_by_default_progs; do
echo no_install__progs += $progsdir/$p
done
echo build_if_possible__progs =
for p in $build_if_possible_progs; do
echo build_if_possible__progs += $progsdir/$p
done
echo default__progs =
for p in $normal_progs; do
echo default__progs += $progsdir/$p
done
;;
*)
echo "$0: invalid usage" >&2; exit 2
;;
esac
exit 0

57
build-aux/git-log-fix Normal file
View File

@@ -0,0 +1,57 @@
# This file is expected to be used via gitlog-to-changelog's --amend=FILE
# option. It specifies what changes to make to each given SHA1's commit
# log and metadata, using Perl-eval'able expressions.
3a169f4c5d9159283548178668d2fae6fced3030
# fix title:
s/all tile types/all file types/
e181802521d4e19e367dbe8cfa877296bb5dafb2
# fix the title!
s,seq:,factor:,
3ece0355d52e41a1b079c0c46477a32250278c11
# correct the URL
s,<http.+?>,<http://bugs.debian.org/412688>,
# This is wrong now only in the git log. The ChangeLog-2008
# entry was also erroneous, but has been corrected.
# ed5c4e770a27862813c0182be8680abeb005d15b
# # Wrong bug ID:
# s,/363011,/350541,
# # in this:
# # Suggested by Josselin Mouette in <http://bugs.debian.org/363011>
# This was wrong only in the git log. The ChangeLog entry was
# is from 2007, and so was recorded (correctly) in ChangeLog-2007.
# 1379ed974f1fa39b12e2ffab18b3f7a607082202
# # Due to a bug in vc-dwim, I mis-attributed a patch by Paul to myself.
# # Change the author to be Paul. Note the escaped "@":
# s,Jim .*>,Paul Eggert <eggert\@cs.ucla.edu>,
209850fd7e1e89cf8937310878bd22d70e3588a5
s/isspace/isblank/
# in this:
# * tests/misc/uniq: New file. Test for the above, but only
# when isspace(0240).
760bc6f7e73014e934a744a9d46ea8dbf5ba25c8
s/Now, each/Now, the/;
s!(elicits.*)\.!first $1, and the second works properly.!
# change the log from this:
# 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.
# to this:
# Without this, `truncate -s '> -1' F` would truncate F to length 0,
# and `truncate -s " +1" F` would truncate F to 1 byte. Now, the
# first elicits a diagnostic, and the second works properly.
# Credit initial reporter of a related issue, now that the BZ is public.
1e18d8416f9ef43bf08982cabe54220587061a08
s,by ,by Nao Nishijima in http://bugzilla.redhat.com/766461\nand by ,
# I was unable to apply the c-set using normal methods, so
# applied it with patch and then forgot to reset the Author.
51a4b04954ad5ad12de1d1b82a3603fc350a3bfa
s,Jim .*>,Ondrej Oprala <ooprala\@redhat.com>,

460
cfg.mk
View File

@@ -1,5 +1,5 @@
# Customize maint.mk -*- makefile -*-
# Copyright (C) 2003-2010 Free Software Foundation, Inc.
# Copyright (C) 2003-2013 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,9 +17,13 @@
# Used in maint.mk's web-manual rule
manual_title = Core GNU utilities
# Use the direct link. This is guaranteed to work immediately, while
# it can take a while for the faster mirror links to become usable.
url_dir_list = http://ftp.gnu.org/gnu/$(PACKAGE)
# Tests not to run as part of "make distcheck".
local-checks-to-skip = \
sc_texinfo_acronym
sc_proper_name_utf8_requires_ICONV
# Tools used to bootstrap this package, used for "announcement".
bootstrap-tools = autoconf,automake,gnulib,bison
@@ -27,7 +31,21 @@ bootstrap-tools = autoconf,automake,gnulib,bison
# Now that we have better tests, make this the default.
export VERBOSE = yes
old_NEWS_hash = e2a254a0d4c81397994ea10a15663ac3
# Comparing tarball sizes compressed using different xz presets, we see that
# an -8e-compressed tarball is only 9KiB larger than the -9e-compressed one.
# Using -8e is preferred, since that lets the decompression process use half
# the memory (32MiB rather than 64MiB).
# $ for i in {7,8,9}{e,}; do \
# (n=$(xz -$i < coreutils-8.15*.tar|wc -c);echo $n $i) & done |sort -nr
# 5129388 7
# 5036524 7e
# 5017476 8
# 5010604 9
# 4923016 8e
# 4914152 9e
export XZ_OPT = -8e
old_NEWS_hash = 6ae04dc3907ea1290f12e6b1507cc42c
# Add an exemption for sc_makefile_at_at_check.
_makefile_at_at_check_exceptions = ' && !/^cu_install_program =/'
@@ -39,8 +57,8 @@ _hv_file ?= $(srcdir)/tests/misc/help-version
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_FULLBLOCK; echo O_NOCACHE; \
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=; \
@@ -66,7 +84,7 @@ ifneq ($(wildcard $(dd_c)),)
fi
endif
# Many m4 macros names once began with `jm_'.
# 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:
@@ -77,34 +95,33 @@ sc_prohibit_jm_in_m4:
# 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=; \
@t1=sc-root.expected; t2=sc-root.actual; \
grep -nl '^ *require_root_$$' `$(VC_LIST) tests` | sort > $$t1; \
for t in $(all_root_tests); do echo $$t; done | sort > $$t2; \
st=0; diff -u $$t1 $$t2 || st=1; \
rm -f $$t1 $$t2; \
test "$$diff" \
&& { echo 'tests/Makefile.am: missing check-root action'>&2; \
exit 1; } || :; \
fi
exit $$st
# Ensure that the syntax_check_exceptions file list in Makefile.am
# stays in sync with corresponding files in the repository.
sce = syntax_check_exceptions
sc_x_sc_dist_check:
@test "$$( ($(VC_LIST) | sed -n '/\.x-sc_/p' \
| sed 's|^$(_dot_escaped_srcdir)/||'; \
sed -n '/^$(sce) =[ ]*\\$$/,/[^\]$$/p' \
$(srcdir)/Makefile.am \
| sed 's/^ *//;/^$(sce) =/d' \
| tr -s '\012\\' ' ' | fmt -1 \
) | sort | uniq -u)" \
&& { echo 'Makefile.am: $(sce) mismatch' >&2; exit 1; } || :;
# Ensure that all version-controlled test cases are listed in $(all_tests).
sc_tests_list_consistency:
@bs="\\"; \
test_extensions_rx=`echo $(TEST_EXTENSIONS) \
| sed -e "s/ /|/g" -e "s/$$bs./$$bs$$bs./g"`; \
{ \
for t in $(all_tests); do echo $$t; done; \
cd $(top_srcdir); \
$(SHELL) build-aux/vc-list-files tests \
| grep -Ev '^tests/(factor/(run|create-test)|init)\.sh$$' \
| $(EGREP) "$$test_extensions_rx\$$"; \
} | sort | uniq -u | grep . && exit 1; :
# Ensure that all version-controlled test scripts are executable.
sc_tests_executable:
@test_extensions_rx=`echo $(TEST_EXTENSIONS) \
| sed -e "s/ / -o -name */g" -e "s/^/-name */"`; \
find tests/ \( $$test_extensions_rx \) \! -perm -111 -print \
| sed -e "s/^/$(ME): Please make test executable: /" | grep . \
&& exit 1; :
# Create a list of regular expressions matching the names
# of files included from system.h. Exclude a couple.
@@ -134,6 +151,14 @@ sc_system_h_headers: .re-list
1>&2; exit 1; } || :; \
fi
# Files in src/ should not use '%s' notation in format strings,
# i.e., single quotes around %s (or similar) should be avoided.
sc_prohibit_quotes_notation:
@cd $(srcdir)/src && GIT_PAGER= git grep -n "\".*[\`']%s'.*\"" *.c \
&& { echo '$(ME): '"Use quote() to avoid quoted '%s' notation" 1>&2; \
exit 1; } \
|| :
sc_sun_os_names:
@grep -nEi \
'solaris[^[:alnum:]]*2\.(7|8|9|[1-9][0-9])|sunos[^[:alnum:]][6-9]' \
@@ -141,46 +166,148 @@ sc_sun_os_names:
{ echo '$(ME): found misuse of Sun OS version numbers' 1>&2; \
exit 1; } || :
ALL_RECURSIVE_TARGETS += sc_tight_scope
sc_tight_scope:
@$(MAKE) -s -C src $@
# Ensure that the list of programs and author names is accurate.
# We need a UTF8 locale. If a lack of locale support or a missing
# translation inhibits printing of UTF-8 names, just skip this test.
au_dotdot = authors-dotdot
au_actual = authors-actual
sc_check-AUTHORS: $(all_programs)
@locale=en_US.UTF-8; \
LC_ALL=$$locale ./src/cat --version \
| grep ' Torbjorn ' > /dev/null \
&& { echo "$@: skipping this check"; exit 0; }; \
rm -f $(au_actual) $(au_dotdot); \
for i in `ls $(all_programs) \
| sed -e 's,^src/,,' -e 's,$(EXEEXT)$$,,' \
| sed /libstdbuf/d \
| $(ASSORT) -u`; do \
test "$$i" = '[' && continue; \
exe=$$i; \
if test "$$i" = install; then \
exe=ginstall; \
elif test "$$i" = test; then \
exe='['; \
fi; \
LC_ALL=$$locale ./src/$$exe --version \
| perl -0 -p -e 's/,\n/, /gm' \
| sed -n -e '/Written by /{ s//'"$$i"': /;' \
-e 's/,* and /, /; s/\.$$//; p; }'; \
done > $(au_actual) && \
sed -n '/^[^ ][^ ]*:/p' $(srcdir)/AUTHORS > $(au_dotdot) \
&& diff $(au_actual) $(au_dotdot) \
&& rm -f $(au_actual) $(au_dotdot)
ALL_RECURSIVE_TARGETS += sc_check-AUTHORS
sc_check-AUTHORS:
@$(MAKE) -s -C src $@
# Each program with a non-ASCII author name must link with LIBICONV.
sc_check-I18N-AUTHORS:
@cd $(srcdir)/src && \
for i in $$(git grep -l -w proper_name_utf8 *.c|sed 's/\.c//'); do \
grep -E "^src_$${i}_LDADD"' .?= .*\$$\(LIBICONV\)' local.mk \
> /dev/null \
|| { echo "$(ME): link rules for $$i do not include" \
'$$(LIBICONV)' 1>&2; exit 1; }; \
done
# Option descriptions should not start with a capital letter
# Ensure %j is not used for intmax_t as it's not universally supported.
# There are issues on HPUX for example. But note that %ju was used between
# coreutils 8.13 (2011-10) and 8.20 (2012-10) without any reported issue,
# and the particular issue this check is associated with was for %*jx.
# So we may be able to relax this restriction soon.
sc_prohibit-j-printf-format:
@cd $(srcdir)/src && GIT_PAGER= git grep -n '%[0*]*j[udx]' *.c \
&& { echo '$(ME): Use PRI*MAX instead of %j' 1>&2; exit 1; } \
|| :
# Ensure the alternative __attribute (keyword) form isn't used as
# that form is not elided where required. Also ensure that we don't
# directly use attributes already defined by gnulib.
# TODO: move the check for _GL... attributes to gnulib.
sc_prohibit-gl-attributes:
@cd $(srcdir) && GIT_PAGER= git grep -En \
"__attribute |__(unused|pure|const)__" src gl/lib/*.[ch] \
&& { echo '$(ME): Use _GL... attribute macros' 1>&2; exit 1; } \
|| :
# Look for lines longer than 80 characters, except omit:
# - program-generated long lines in diff headers,
# - the help2man script copied from upstream,
# - tests involving long checksum lines, and
# - the 'pr' test cases.
LINE_LEN_MAX = 80
FILTER_LONG_LINES = \
/^[^:]*\.diff:[^:]*:@@ / d; \
\|^[^:]*man/help2man:| d; \
\|^[^:]*tests/misc/sha[0-9]*sum.*\.pl[-:]| d; \
\|^[^:]*tests/pr/|{ \|^[^:]*tests/pr/pr-tests:| !d; };
sc_long_lines:
@files=$$($(VC_LIST_EXCEPT)) \
halt='line(s) with more than $(LINE_LEN_MAX) characters; reindent'; \
for file in $$files; do \
expand $$file | grep -nE '^.{$(LINE_LEN_MAX)}.' | \
sed -e "s|^|$$file:|" -e '$(FILTER_LONG_LINES)'; \
done | grep . && { msg="$$halt" $(_sc_say_and_exit) } || :
# Option descriptions should not start with a capital letter.
# One could grep source directly as follows:
# grep -E " {2,6}-.*[^.] [A-Z][a-z]" $$($(VC_LIST_EXCEPT) | grep '\.c$$')
# but that would miss descriptions not on the same line as the -option.
ALL_RECURSIVE_TARGETS += sc_option_desc_uppercase
sc_option_desc_uppercase:
@$(MAKE) -s -C src all_programs
@$(MAKE) -s -C man $@
sc_option_desc_uppercase: $(ALL_MANS)
@grep '^\\fB\\-' -A1 man/*.1 | LC_ALL=C grep '\.1.[A-Z][a-z]' \
&& { echo 1>&2 '$@: found initial capitals in --help'; exit 1; } || :
# Ensure all man/*.[1x] files are present
ALL_RECURSIVE_TARGETS += sc_man_file_correlation
sc_man_file_correlation:
@$(MAKE) -s -C src all_programs
@$(MAKE) -s -C man $@
# Ensure all man/*.[1x] files are present.
sc_man_file_correlation: check-x-vs-1 check-programs-vs-x
# Ensure that for each .x file in the 'man/' subdirectory, there is a
# corresponding .1 file in the definition of $(EXTRA_MANS).
# But since that expansion usually lacks programs like arch and hostname,
# add them here manually.
.PHONY: check-x-vs-1
check-x-vs-1:
@PATH=./src$(PATH_SEPARATOR)$$PATH; export PATH; \
t=$@-t; \
(cd $(srcdir)/man && ls -1 *.x) \
| sed 's/\.x$$//' | $(ASSORT) > $$t; \
(echo $(patsubst man/%,%,$(ALL_MANS)) \
| tr -s ' ' '\n' | sed 's/\.1$$//') \
| $(ASSORT) -u | diff - $$t || { rm $$t; exit 1; }; \
rm $$t
# Writing a portable rule to generate a manpage like '[.1' would be
# a nightmare, so filter that out.
all-progs-but-lbracket = $(filter-out [,$(patsubst src/%,%,$(all_programs)))
# Ensure that for each coreutils program there is a corresponding
# '.x' file in the 'man/' subdirectory.
.PHONY: check-programs-vs-x
check-programs-vs-x:
@status=0; \
for p in dummy $(all-progs-but-lbracket); do \
case $$p in *.so) continue;; esac; \
test $$p = dummy && continue; \
test $$p = ginstall && p=install || : ; \
test -f $(srcdir)/man/$$p.x \
|| { echo missing $$p.x 1>&2; status=1; }; \
done; \
exit $$status
# Ensure that the end of each release's section is marked by two empty lines.
sc_NEWS_two_empty_lines:
@sed -n 4,/Noteworthy/p $(srcdir)/NEWS \
| perl -n0e '/(^|\n)\n\n\* Noteworthy/ or exit 1' \
|| { echo '$(ME): use two empty lines to separate NEWS sections' \
1>&2; exit 1; } || :; \
1>&2; exit 1; } || :
# 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
# With split lines, don't leave an operator at end of line.
# Instead, put it on the following line, where it is more apparent.
# Don't bother checking for "*" at end of line, since it provokes
# far too many false positives, matching constructs like "TYPE *".
# Similarly, omit "=" (initializers).
binop_re_ ?= [-/+^!<>]|[-/+*^!<>=]=|&&?|\|\|?|<<=?|>>=?
sc_prohibit_operator_at_end_of_line:
@prohibit='. ($(binop_re_))$$' \
in_vc_files='\.[chly]$$' \
halt='found operator at end of line' \
$(_sc_search_regexp)
# Don't use "readlink" or "readlinkat" directly
sc_prohibit_readlink:
@@ -205,7 +332,11 @@ sc_strftime_check:
{ echo N; \
info libc date calendar format 2>/dev/null|grep '^ `%.'\'\
| $(extract_char); } | sort > $@-info; \
diff -u $@-src $@-info || exit 1; \
if test $$(stat --format %s $@-info) != 2; then \
diff -u $@-src $@-info || exit 1; \
else \
echo '$(ME): skipping $@: libc info not installed' 1>&2; \
fi; \
rm -f $@-src $@-info; \
fi
@@ -215,19 +346,35 @@ sc_prohibit_tab_based_indentation:
halt='TAB in indentation; use only spaces' \
$(_sc_search_regexp)
# The SEE ALSO section of a man page should not be terminated with
# a period. Check the first line after each "SEE ALSO" line in man/*.x:
sc_prohibit_man_see_also_period:
@grep -nB1 '\.$$' $$($(VC_LIST_EXCEPT) | grep 'man/.*\.x$$') \
| grep -A1 -e '-\[SEE ALSO\]' | grep '\.$$' && \
{ echo '$(ME): do not end "SEE ALSO" section with a period' \
1>&2; exit 1; } || :
# Don't use "indent-tabs-mode: nil" anymore. No longer needed.
sc_prohibit_emacs__indent_tabs_mode__setting:
@prohibit='^( *[*#] *)?indent-tabs-mode:' \
halt='use of emacs indent-tabs-mode: setting' \
$(_sc_search_regexp)
# Ensure that each file that contains fail=1 also contains fail=0.
# Otherwise, setting file=1 in the environment would make tests fail unexpectedly.
# Ensure that tests don't include a redundant fail=0.
sc_prohibit_fail_0:
@prohibit='\<fail=0\>' \
halt='fail=0 initialization' \
$(_sc_search_regexp)
# The mode part of a setfacl -m option argument must be three bytes long.
# I.e., an argument of user:bin:rw or user:bin:r will make Solaris 10's
# setfacl reject it with: "Unrecognized character found in mode field".
# Use hyphens to give it a length of 3: "...:rw-" or "...:r--".
sc_prohibit_short_facl_mode_spec:
@prohibit='\<setfacl .*-m.*:.*:[rwx-]{1,2} ' \
halt='setfacl mode string length < 3; extend with hyphen(s)' \
$(_sc_search_regexp)
# Ensure that "stdio--.h" is used where appropriate.
sc_require_stdio_safer:
@if $(VC_LIST_EXCEPT) | grep -l '\.[ch]$$' > /dev/null; then \
@@ -257,6 +404,73 @@ sc_prohibit_verbose_version:
halt='use the print_ver_ function instead...' \
$(_sc_search_regexp)
# Use framework_failure_, not the old name without the trailing underscore.
sc_prohibit_framework_failure:
@prohibit='\<framework_''failure\>' \
halt='use framework_failure_ instead' \
$(_sc_search_regexp)
# Prohibit the use of `...` in tests/. Use $(...) instead.
sc_prohibit_test_backticks:
@prohibit='`' in_vc_files='^tests/' \
halt='use $$(...), not `...` in tests/' \
$(_sc_search_regexp)
# Programs like sort, ls, expr use PROG_FAILURE in place of EXIT_FAILURE.
# Others, use the EXIT_CANCELED, EXIT_ENOENT, etc. macros defined in system.h.
# In those programs, ensure that EXIT_FAILURE is not used by mistake.
sc_some_programs_must_avoid_exit_failure:
@grep -nw EXIT_FAILURE \
$$(git grep -El '[^T]_FAILURE|EXIT_CANCELED' src) \
| grep -vE '= EXIT_FAILURE|exit \(.* \?' | grep . \
&& { echo '$(ME): do not use EXIT_FAILURE in the above' \
1>&2; exit 1; } || :
# Ensure that tests call the require_ulimit_v_ function if using ulimit -v
sc_prohibit_test_ulimit_without_require_:
@(git grep -l require_ulimit_v_ tests; \
git grep -l 'ulimit -v' tests) \
| sort | uniq -u | grep . && { echo "$(ME): the above test(s)"\
" should match require_ulimit_v_ with ulimit -v" 1>&2; exit 1; } || :
# Ensure that tests call the print_ver_ function for programs which are
# actually used in that test.
sc_prohibit_test_calls_print_ver_with_irrelevant_argument:
@git grep -w print_ver_ tests \
| sed 's#:print_ver_##' \
| { fail=0; \
while read file name; do \
for i in $$name; do \
case "$$i" in install) i=ginstall;; esac; \
grep -w "$$i" $$file|grep -vw print_ver_|grep -q . \
|| { fail=1; \
echo "*** Test: $$file, offending: $$i." 1>&2; };\
done; \
done; \
test $$fail = 0 || exit 1; \
} || { echo "$(ME): the above test(s) call print_ver_ for" \
"program(s) they don't use" 1>&2; exit 1; }
# Exempt the contents of any usage function from the following.
_continued_string_col_1 = \
s/^usage .*?\n}//ms;/\\\n\w/ and print ("$$ARGV\n"),$$e=1;END{$$e||=0;exit $$e}
# Ding any source file that has a continued string with an alphabetic in the
# first column of the following line. We prohibit them because they usually
# trigger false positives in tools that try to map an arbitrary line number
# to the enclosing function name. Of course, very many strings do precisely
# this, *when they are part of the usage function*. That is why we exempt
# the contents of any function named "usage".
sc_prohibit_continued_string_alpha_in_column_1:
@perl -0777 -ne '$(_continued_string_col_1)' \
$$($(VC_LIST_EXCEPT) | grep '\.[ch]$$') \
|| { echo '$(ME): continued string with word in first column' \
1>&2; exit 1; } || :
# Use this to list offending lines:
# git ls-files |grep '\.[ch]$' | xargs \
# perl -n -0777 -e 's/^usage.*?\n}//ms;/\\\n\w/ and print "$ARGV\n"' \
# | xargs grep -A1 '\\$'|grep '\.[ch][:-][_a-zA-Z]'
###########################################################
_p0 = \([^"'/]\|"\([^\"]\|[\].\)*"\|'\([^\']\|[\].\)*'
_pre = $(_p0)\|[/][^"'/*]\|[/]"\([^\"]\|[\].\)*"\|[/]'\([^\']\|[\].\)*'\)*
@@ -310,12 +524,130 @@ sc_space_before_open_paren:
else :; \
fi
# Similar to the gnulib maint.mk rule for sc_prohibit_strcmp
# Use STREQ_LEN or STRPREFIX rather than comparing strncmp == 0, or != 0.
sc_prohibit_strncmp:
@grep -nE '! *str''ncmp *\(|\<str''ncmp *\(.+\) *[!=]=' \
$$($(VC_LIST_EXCEPT)) \
| grep -vE ':# *define STR(N?EQ_LEN|PREFIX)\(' && \
{ echo '$(ME): use STREQ_LEN or STRPREFIX instead of str''ncmp' \
1>&2; exit 1; } || :
# Enforce recommended preprocessor indentation style.
sc_preprocessor_indentation:
@if cppi --version >/dev/null 2>&1; then \
$(VC_LIST_EXCEPT) | grep '\.[ch]$$' | xargs cppi -a -c \
|| { echo '$(ME): incorrect preprocessor indentation' 1>&2; \
exit 1; }; \
else \
echo '$(ME): skipping test $@: cppi not installed' 1>&2; \
fi
# THANKS.in is a list of name/email pairs for people who are mentioned in
# commit logs (and generated ChangeLog), but who are not also listed as an
# author of a commit. Name/email pairs of commit authors are automatically
# extracted from the repository. As a very minor factorization, when
# someone who was initially listed only in THANKS.in later authors a commit,
# this rule detects that their pair may now be removed from THANKS.in.
sc_THANKS_in_duplicates:
@{ git log --pretty=format:%aN | sort -u; \
cut -b-36 THANKS.in | sed '/^$$/d;s/ *$$//'; } \
| sort | uniq -d | grep . \
&& { echo '$(ME): remove the above names from THANKS.in' \
1>&2; exit 1; } || :
# Look for developer diagnostics that are marked for translation.
# This won't find any for which devmsg's format string is on a separate line.
sc_marked_devdiagnostics:
@prohibit='\<devmsg *\(.*_\(' \
halt='found marked developer diagnostic(s)' \
$(_sc_search_regexp)
# Override the default Cc: used in generating an announcement.
announcement_Cc_ = $(translation_project_), \
coreutils@gnu.org, coreutils-announce@gnu.org
include $(srcdir)/dist-check.mk
-include $(srcdir)/dist-check.mk
update-copyright-env = \
UPDATE_COPYRIGHT_USE_INTERVALS=1 \
UPDATE_COPYRIGHT_FORCE=1 \
UPDATE_COPYRIGHT_USE_INTERVALS=2 \
UPDATE_COPYRIGHT_MAX_LINE_LENGTH=79
# List syntax-check exemptions.
exclude_file_name_regexp--sc_space_tab = \
^(tests/pr/|tests/misc/nl\.sh$$|gl/.*\.diff$$|man/help2man$$)
exclude_file_name_regexp--sc_bindtextdomain = \
^(gl/.*|lib/euidaccess-stat|src/make-prime-list)\.c$$
exclude_file_name_regexp--sc_trailing_blank = ^(tests/pr/|man/help2man)
exclude_file_name_regexp--sc_system_h_headers = \
^src/((system|copy)\.h|libstdbuf\.c|make-prime-list\.c)$$
_src = (false|lbracket|ls-(dir|ls|vdir)|tac-pipe|uname-(arch|uname))
exclude_file_name_regexp--sc_require_config_h_first = \
(^lib/buffer-lcm\.c|src/$(_src)\.c)$$
exclude_file_name_regexp--sc_require_config_h = \
$(exclude_file_name_regexp--sc_require_config_h_first)
exclude_file_name_regexp--sc_po_check = ^(gl/|man/help2man)
exclude_file_name_regexp--sc_prohibit_always-defined_macros = \
^src/(seq|remove)\.c$$
exclude_file_name_regexp--sc_prohibit_empty_lines_at_EOF = ^tests/pr/
exclude_file_name_regexp--sc_program_name = \
^(gl/.*|lib/euidaccess-stat|src/make-prime-list)\.c$$
exclude_file_name_regexp--sc_file_system = \
NEWS|^(init\.cfg|src/df\.c|tests/df/df-P\.sh|tests/df/df-output\.sh)$$
exclude_file_name_regexp--sc_prohibit_always_true_header_tests = \
^m4/stat-prog\.m4$$
exclude_file_name_regexp--sc_prohibit_fail_0 = \
(^.*/git-hooks/commit-msg|^tests/init\.sh|Makefile\.am|\.mk|.*\.texi)$$
exclude_file_name_regexp--sc_prohibit_atoi_atof = ^lib/euidaccess-stat\.c$$
# longlong.h is maintained elsewhere.
_ll = ^src/longlong\.h$$
exclude_file_name_regexp--sc_useless_cpp_parens = $(_ll)
exclude_file_name_regexp--sc_long_lines = $(_ll)
exclude_file_name_regexp--sc_space_before_open_paren = $(_ll)
tbi_1 = ^tests/pr/|(^gl/lib/reg.*\.c\.diff|\.mk|^man/help2man)$$
tbi_2 = ^scripts/git-hooks/(pre-commit|pre-applypatch|applypatch-msg)$$
tbi_3 = (GNU)?[Mm]akefile(\.am)?$$|$(_ll)
exclude_file_name_regexp--sc_prohibit_tab_based_indentation = \
$(tbi_1)|$(tbi_2)|$(tbi_3)
exclude_file_name_regexp--sc_preprocessor_indentation = \
^(gl/lib/rand-isaac\.[ch]|gl/tests/test-rand-isaac\.c)$$|$(_ll)
exclude_file_name_regexp--sc_prohibit_stat_st_blocks = \
^(src/system\.h|tests/du/2g\.sh)$$
exclude_file_name_regexp--sc_prohibit_continued_string_alpha_in_column_1 = \
^src/(system\.h|od\.c|printf\.c|getlimits\.c)$$
exclude_file_name_regexp--sc_prohibit_test_backticks = \
^tests/(local\.mk|(init|misc/stdbuf|factor/create-test)\.sh)$$
# Exempt test.c, since it's nominally shared, and relatively static.
exclude_file_name_regexp--sc_prohibit_operator_at_end_of_line = \
^src/(ptx|test|head)\.c$$
exclude_file_name_regexp--sc_error_message_uppercase = ^src/factor\.c$$
exclude_file_name_regexp--sc_prohibit_atoi_atof = ^src/make-prime-list\.c$$
# Augment AM_CFLAGS to include our per-directory options:
AM_CFLAGS += $($(@D)_CFLAGS)
src_CFLAGS = $(WARN_CFLAGS)
lib_CFLAGS = $(GNULIB_WARN_CFLAGS)
gnulib-tests_CFLAGS = $(GNULIB_TEST_WARN_CFLAGS)
# Configuration to make the tight-scope syntax-check rule work with
# non-recursive make.
export _gl_TS_headers = $(srcdir)/cfg.mk
_gl_TS_dir = .
_gl_TS_obj_files = src/*.$(OBJEXT)
_gl_TS_other_headers = src/*.h
# Tell the tight_scope rule about an exceptional "extern" variable.
# Normally, the rule would detect its declaration, but that uses a
# different name, __clz_tab.
_gl_TS_unmarked_extern_vars = factor_clz_tab

View File

@@ -1,7 +1,7 @@
# -*- autoconf -*-
# Process this file with autoconf to produce a configure script.
# Copyright (C) 1991, 1993-2010 Free Software Foundation, Inc.
# Copyright (C) 1991-2013 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.62])
AC_PREREQ([2.64])
# 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)
@@ -32,9 +32,24 @@ AC_CONFIG_SRCDIR([src/ls.c])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_HEADERS([lib/config.h:lib/config.hin])
AM_INIT_AUTOMAKE([1.11.1 dist-xz color-tests parallel-tests])
AM_INIT_AUTOMAKE([1.11.2 no-dist-gzip dist-xz color-tests parallel-tests
subdir-objects])
AM_SILENT_RULES([yes]) # make --enable-silent-rules the default.
dnl POSIXCHECK is worthwhile for maintainers, but adds several seconds
dnl (more than 10% execution time) to ./configure, with no benefit for
dnl most users. Using it to look for bugs requires:
dnl GNULIB_POSIXCHECK=1 autoreconf -f
dnl ./configure
dnl make
dnl make -C src clean
dnl make CFLAGS=-DGNULIB_POSIXCHECK=1
dnl FIXME: Once we figure out how to avoid false positives, we should
dnl have 'make my-distcheck' in dist-check.mk exercise this.
m4_syscmd([test "${GNULIB_POSIXCHECK+set}" = set])
m4_if(m4_sysval, [0], [], [dnl
gl_ASSERT_NO_GNULIB_POSIXCHECK])
AC_PROG_CC_STDC
AM_PROG_CC_C_O
AC_PROG_CPP
@@ -45,15 +60,47 @@ gl_EARLY
gl_INIT
coreutils_MACROS
# The test suite needs to know if we have a working perl.
# FIXME: this is suboptimal. Ideally, we would be able to call gl_PERL
# with an ACTION-IF-NOT-FOUND argument ...
cu_have_perl=yes
case $PERL in *"/missing "*) cu_have_perl=no;; esac
AM_CONDITIONAL([HAVE_PERL], [test $cu_have_perl = yes])
# gl_GCC_VERSION_IFELSE([major], [minor], [run-if-found], [run-if-not-found])
# ------------------------------------------------
# If $CPP is gcc-MAJOR.MINOR or newer, then run RUN-IF-FOUND.
# Otherwise, run RUN-IF-NOT-FOUND.
AC_DEFUN([gl_GCC_VERSION_IFELSE],
[AC_PREPROC_IFELSE(
[AC_LANG_PROGRAM(
[[
#if ($1) < __GNUC__ || (($1) == __GNUC__ && ($2) <= __GNUC_MINOR__)
/* ok */
#else
# error "your version of gcc is older than $1.$2"
#endif
]]),
], [$3], [$4])
]
)
AC_ARG_ENABLE([gcc-warnings],
[AS_HELP_STRING([--enable-gcc-warnings],
[turn on lots of GCC warnings (for developers)])],
[turn on many GCC warnings (for developers; best with GNU make)])],
[case $enableval in
yes|no) ;;
*) AC_MSG_ERROR([bad value $enableval for gcc-warnings option]) ;;
esac
gl_gcc_warnings=$enableval],
[gl_gcc_warnings=no]
[
# GCC provides fine-grained control over diagnostics which
# is used in gnulib for example to suppress warnings from
# certain sections of code. So if this is available and
# we're running from a git repo, then auto enable the warnings.
gl_gcc_warnings=no
gl_GCC_VERSION_IFELSE([4], [6],
[test -d "$srcdir"/.git && gl_gcc_warnings=yes])]
)
if test "$gl_gcc_warnings" = yes; then
@@ -88,45 +135,85 @@ if test "$gl_gcc_warnings" = yes; then
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
nw="$nw -Wsuggest-attribute=format" # warns about copy.c and factor.c
# Using -Wstrict-overflow is a pain, but the alternative is worse.
# For an example, see the code that provoked this report:
# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33498
# Code like that still infloops with gcc-4.6.0 and -O2. Scary indeed.
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-unused-parameter]) # Too many warnings for now
gl_WARN_ADD([-Wsuggest-attribute=const])
gl_WARN_ADD([-Wsuggest-attribute=noreturn])
gl_WARN_ADD([-Wno-format-nonliteral])
# Enable this warning only with gcc-4.7 and newer. With 4.6.2 20111027,
# it suggests test.c's advance function may be pure, even though it
# increments a global variable. Oops.
# Normally we'd write code to test for the precise failure, but that
# requires a relatively large input to make gcc exhibit the failure.
gl_GCC_VERSION_IFELSE([4], [7], [gl_WARN_ADD([-Wsuggest-attribute=pure])])
# In spite of excluding -Wlogical-op above, it is enabled, as of
# gcc 4.5.0 20090517, and it provokes warnings in cat.c, dd.c, truncate.c
gl_WARN_ADD([-Wno-logical-op])
# clang is unduly picky about some things.
AC_CACHE_CHECK([whether the compiler is clang], [utils_cv_clang],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[
#ifndef __clang__
#error "not clang"
#endif
]])],
[utils_cv_clang=yes],
[utils_cv_clang=no])])
if test $utils_cv_clang = yes; then
gl_WARN_ADD([-Wno-format-extra-args])
gl_WARN_ADD([-Wno-tautological-constant-out-of-range-compare])
fi
gl_WARN_ADD([-fdiagnostics-show-option])
gl_WARN_ADD([-funit-at-a-time])
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])
AH_VERBATIM([FORTIFY_SOURCE],
[/* Enable compile-time and run-time bounds-checking, and some warnings,
without upsetting glibc 2.15+. */
#if !defined _FORTIFY_SOURCE && defined __OPTIMIZE__ && __OPTIMIZE__
# define _FORTIFY_SOURCE 2
#endif
])
AC_DEFINE([GNULIB_PORTCHECK], [1], [enable some gnulib portability checks])
# We use a slightly smaller set of warning options for lib/.
# Remove the following and save the result in GNULIB_WARN_CFLAGS.
nw=
nw="$nw -Wstrict-overflow"
nw="$nw -Wuninitialized"
nw="$nw -Wunused-macros"
nw="$nw -Wmissing-prototypes"
nw="$nw -Wold-style-definition"
# FIXME: it may be easy to remove this, since it affects only one file:
# the snprintf call at ftoastr.c:132.
nw="$nw -Wdouble-promotion"
gl_MANYWARN_COMPLEMENT([GNULIB_WARN_CFLAGS], [$WARN_CFLAGS], [$nw])
AC_SUBST([GNULIB_WARN_CFLAGS])
# For gnulib-tests, the set is slightly smaller still.
nw=
nw="$nw -Wstrict-prototypes"
# It's not worth being this picky about test programs.
nw="$nw -Wsuggest-attribute=const"
nw="$nw -Wsuggest-attribute=pure"
gl_MANYWARN_COMPLEMENT([GNULIB_TEST_WARN_CFLAGS],
[$GNULIB_WARN_CFLAGS], [$nw])
AC_SUBST([GNULIB_TEST_WARN_CFLAGS])
@@ -162,18 +249,18 @@ int main()
time_t now = time ((time_t *) 0);
int hour_GMT0, hour_unset;
if (putenv ("TZ=GMT0") != 0)
exit (1);
return 1;
hour_GMT0 = localtime (&now)->tm_hour;
unset_TZ ();
hour_unset = localtime (&now)->tm_hour;
if (putenv ("TZ=PST8") != 0)
exit (1);
return 1;
if (localtime (&now)->tm_hour == hour_GMT0)
exit (1);
return 1;
unset_TZ ();
if (localtime (&now)->tm_hour != hour_unset)
exit (1);
exit (0);
return 1;
return 0;
}]])],
[utils_cv_localtime_cache=no],
[utils_cv_localtime_cache=yes],
@@ -329,7 +416,6 @@ AC_CHECK_DECLS([strsignal, sys_siglist, _sys_siglist, __sys_siglist], , ,
[AC_INCLUDES_DEFAULT
#include <signal.h>])
cu_LIB_CHECK
cu_GMP
# Build df only if there's a point to it.
@@ -349,113 +435,72 @@ if test "$elf_sys" = "yes" && \
fi
############################################################################
mk="$srcdir/src/Makefile.am"
# Extract all literal names from the definition of $(EXTRA_PROGRAMS)
# in $mk but don't expand the variable references.
# Append each literal name to $optional_bin_progs.
v=EXTRA_PROGRAMS
for gl_i in `sed -n '/^'$v' =/,/[[^\]]$/p' $mk \
| sed 's/^ *//;/^\$.*/d;/^'$v' =/d' \
| tr -s '\\015\\012\\\\' ' '`; do
gl_ADD_PROG([optional_bin_progs], $gl_i)
done
# As above, extract literal names from the definition of $(no_install__progs)
# in $mk but don't expand the variable references.
v=no_install__progs
t=`sed -n '/^'$v' =/,/[[^\]]$/p' $mk \
| sed 's/^ *//;/^\$.*/d;/^'$v' =/d' \
| tr -s '\\015\\012\\\\' ' '`
# Remove any trailing space.
no_install_progs_default=`echo "$t"|sed 's/ $//'`
dnl Autogenerated by the 'gen-lists-of-programs.sh' auxiliary script.
dnl Issue proper calls to the macros gl_INCLUDE_EXCLUDE_PROG and
dnl gl_ADD_PROG (updating $optional_bin_progs), and generate the list
dnl of coreutils programs to be built only upon explicit user request,
dnl saving that list in the $no_install_progs_default shell variable.
m4_include([m4/cu-progs.m4])
# Unfortunately, due to the way autoconf's AS_HELP_STRING works, the list
# of default-not-installed programs, "arch hostname su", must appear in two
# places: in this file below, and in $mk. Using "$no_install_progs_default"
# below cannot work. And we can't substitute the names into $mk because
# automake needs the literals, too.
# The compromise is to ensure that the space-separated list extracted
# above matches the literal 2nd argument below.
c="$srcdir/configure.ac"
re='^g''l_INCLUDE_EXCLUDE_PROG(.* [\[\(.*\)\]])'
t=`sed -n '/'"$re"'/{s/'"$re"'/\1/;s/,/ /gp
}' $c`
case $t in
$no_install_progs_default) ;;
*) AC_MSG_ERROR([[internal error: g'l_INCLUDE_EXCLUDE_PROG's 2nd arg, $t,
does not match the list of default-not-installed programs
($no_install_progs_default) also recorded in $mk]],
1) ;;
esac
# Given the name of a variable containing a space-separated list of
# install-by-default programs and the actual list do-not-install-by-default
# programs, modify the former variable to reflect any "do-install" and
# "don't-install" requests.
# I.e., add any program name specified via --enable-install-program=..., and
# remove any program name specified via --enable-no-install-program=...
# Note how the second argument below is a literal, with "," separators.
# That is required due to the way the macro works, and since the
# corresponding ./configure option argument is comma-separated on input.
gl_INCLUDE_EXCLUDE_PROG([optional_bin_progs], [arch,hostname,su])
# Now that we know which programs will actually be built up, figure out
# Now that we know which programs will actually be built, determine
# which optional helper progs should be compiled.
optional_pkglib_progs=
case " $optional_bin_progs " in
*' stdbuf '*) gl_ADD_PROG([optional_pkglib_progs], [libstdbuf.so]) ;;
*' stdbuf '*) pkglibexec_PROGRAMS='src/libstdbuf.so';;
*) pkglibexec_PROGRAMS='';;
esac
# Set INSTALL_SU if su installation has been requested via
# --enable-install-program=su.
AC_SUBST([INSTALL_SU])
case " $optional_bin_progs " in
*' su '*) INSTALL_SU=yes ;;
*) INSTALL_SU=no ;;
esac
man1_MANS=`
for p in $optional_bin_progs; do
# Change "ginstall.1" to "install.1".
test $p = ginstall && p=install
# Ignore the "[" program, since writing a portable make rule to
# generate its manpage is not practical.
dnl Use the autoconf-provided quadrigraph to represent "[",
dnl otherwise we will incur in dreadful quoting issues.
test x$p = x'@<:@' && continue
echo "man/$p.1"
done`
MAN=`echo "$optional_bin_progs "|sed 's/ /.1 /g;s/ $//'|tr -d '\\015\\012'`
# Not installed by "make install", but must be built when creating
# a distribution tarball.
EXTRA_MANS=`for p in $no_install_progs_default; do echo man/$p.1; done`
# 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 '\015\012' ' '; echo`
# The programs built and installed by "make && make install".
# Since this is AC_SUBST'd, Automake won't be able to perform rewrite
# with $(EXEEXT) appending on it, so we have to do it ourselves -- in
# this case, only for $(bin_PROGRAMS).
bin_PROGRAMS=`
for p in $optional_bin_progs; do echo src/"$p"'$(EXEEXT)'; done`
# Remove [.1, since writing a portable rule for it in man/Makefile.am
# is not practical. The sed LHS below uses the autoconf quadrigraph
# representing '['.
MAN=`echo "$MAN"|sed 's/\@<:@\.1//'`
# Normalize whitespace.
man1_MANS=`echo $man1_MANS`
EXTRA_MANS=`echo $EXTRA_MANS`
bin_PROGRAMS=`echo $bin_PROGRAMS`
pkglibexec_PROGS=`echo $pkglibexec_PROGRAMS`
OPTIONAL_BIN_PROGS=`echo "$optional_bin_progs "|sed 's/ /\$(EXEEXT) /g;s/ $//'`
AC_SUBST([OPTIONAL_BIN_PROGS])
OPTIONAL_PKGLIB_PROGS=`echo "$optional_pkglib_progs " | sed 's/ $//'`
AC_SUBST([OPTIONAL_PKGLIB_PROGS])
NO_INSTALL_PROGS_DEFAULT=$no_install_progs_default
AC_SUBST([NO_INSTALL_PROGS_DEFAULT])
AC_SUBST([bin_PROGRAMS]) AM_SUBST_NOTMAKE([bin_PROGRAMS])
AC_SUBST([pkglibexec_PROGRAMS]) AM_SUBST_NOTMAKE([pkglibexec_PROGRAMS])
AC_SUBST([man1_MANS]) AM_SUBST_NOTMAKE([man1_MANS])
AC_SUBST([EXTRA_MANS]) AM_SUBST_NOTMAKE([EXTRA_MANS])
AC_SUBST([built_programs], [$optional_bin_progs])
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'
AC_SUBST([CONFIG_STATUS_DEPENDENCIES])
############################################################################
# As long as "grep 'PRI[diouxX]' po/*.pot" reports matches in
# translatable strings, we must use need-formatstring-macros here.
AM_GNU_GETTEXT([external], [need-formatstring-macros])
AM_GNU_GETTEXT_VERSION([0.18])
AM_GNU_GETTEXT_VERSION([0.18.1])
# For a test of uniq: it uses the $LOCALE_FR envvar.
gt_LOCALE_FR
AC_CONFIG_FILES(
Makefile
doc/Makefile
lib/Makefile
man/Makefile
po/Makefile.in
src/Makefile
tests/Makefile
gnulib-tests/Makefile
)
AC_OUTPUT

View File

@@ -9,10 +9,7 @@ tmpdir = $(abs_top_builddir)/tests/torture
t=$(tmpdir)/$(PACKAGE)/test
pfx=$(t)/i
built_programs = \
$$(echo 'spy:;@echo $$(bin_PROGRAMS)' \
| MAKEFLAGS= $(MAKE) -s -C src -f Makefile -f - spy \
| fmt -1 | sed 's,$(EXEEXT)$$,,' | sort -u)
built_programs := $(sort $(patsubst src/%$(EXEEXT),%,$(bin_PROGRAMS)))
# More than once, tainted build and source directory names would
# have caused at least one "make check" test to apply "chmod 700"
@@ -96,43 +93,6 @@ define my-instcheck
}
endef
# 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.
define coreutils-path-check
{ \
echo running 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);; \
*) ln $(bin)/loser $(bin)/$$i;; \
esac; \
done \
&& ln -sf ../src/true $(bin)/false \
&& 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 this to make sure we don't run these programs when building
# from a virgin compressed tarball file, below.
null_AM_MAKEFLAGS ?= \
@@ -156,7 +116,6 @@ my-distcheck: $(DIST_ARCHIVES) $(local-check)
$(MAKE) dvi; \
$(install-transform-check); \
$(my-instcheck); \
$(coreutils-path-check); \
$(MAKE) distclean \
)
(cd $(t) && mv $(distdir) $(distdir).old \

1
doc/.gitignore vendored
View File

@@ -20,3 +20,4 @@
/parse-datetime.texi
/stamp-vti
/version.texi
/.dirstamp

View File

@@ -2002,7 +2002,7 @@
-----
Copyright (C) 2001-2010 Free Software Foundation, Inc.
Copyright (C) 2001-2013 Free Software Foundation, Inc.
Copying and distribution of this file, with or without
modification, are permitted provided the copyright notice

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,7 @@
# Make coreutils documentation. -*-Makefile-*-
# This is included by the top-level Makefile.am.
# Copyright (C) 1995-1998, 2001-2010 Free Software Foundation, Inc.
# Copyright (C) 1995-2013 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
@@ -15,9 +16,13 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
info_TEXINFOS = coreutils.texi
info_TEXINFOS = doc/coreutils.texi
EXTRA_DIST = perm.texi parse-datetime.texi constants.texi fdl.texi
doc_coreutils_TEXINFOS = \
doc/perm.texi \
doc/parse-datetime.texi \
doc/constants.texi \
doc/fdl.texi
# The following is necessary if the package name is 8 characters or longer.
# If the info documentation would be split into 10 or more separate files,
@@ -29,18 +34,17 @@ EXTRA_DIST = perm.texi parse-datetime.texi constants.texi fdl.texi
# old systems.
AM_MAKEINFOFLAGS = --no-split
constants.texi: $(top_srcdir)/src/tail.c $(top_srcdir)/src/shred.c
doc/constants.texi: $(top_srcdir)/src/tail.c $(top_srcdir)/src/shred.c
$(AM_V_GEN)LC_ALL=C; export LC_ALL; \
$(MKDIR_P) doc && \
{ sed -n -e 's/^#define \(DEFAULT_MAX[_A-Z]*\) \(.*\)/@set \1 \2/p' \
$(top_srcdir)/src/tail.c && \
sed -n -e 's/.*\(DEFAULT_PASSES\)[ =]* \([0-9]*\).*/@set SHRED_\1 \2/p'\
$(top_srcdir)/src/shred.c; } > t-$@ \
&& mv t-$@ $@
sed -n -e \
's/.*\(DEFAULT_PASSES\)[ =]* \([0-9]*\).*/@set SHRED_\1 \2/p'\
$(top_srcdir)/src/shred.c; } > $@-t \
&& mv $@-t $@
MAINTAINERCLEANFILES = constants.texi
$(DVIS): $(EXTRA_DIST)
$(INFO_DEPS): $(EXTRA_DIST)
MAINTAINERCLEANFILES += doc/constants.texi
# Extended regular expressions to match word starts and ends.
_W = (^|[^A-Za-z0-9_])
@@ -54,64 +58,56 @@ syntax_checks = \
sc-avoid-timezone \
sc-avoid-zeroes \
sc-exponent-grouping \
sc-lower-case-var \
sc-use-small-caps-NUL
sc-lower-case-var
texi_files = $(srcdir)/doc/*.texi
.PHONY: $(syntax_checks) check-texinfo
# List words/regexps here that should not appear in the texinfo documentation.
check-texinfo: $(syntax_checks)
$(AM_V_GEN)fail=0; \
grep '@url{' $(srcdir)/*.texi && fail=1; \
grep '\$$@"' $(srcdir)/*.texi && fail=1; \
grep -n '[^[:punct:]]@footnote' $(srcdir)/*.texi && fail=1; \
grep -n filename $(srcdir)/*.texi \
grep '@url{' $(texi_files) && fail=1; \
grep '\$$@"' $(texi_files) && fail=1; \
grep -n '[^[:punct:]]@footnote' $(texi_files) && fail=1; \
grep -n filename $(texi_files) \
| $(EGREP) -v 'setfilename|[{]filename[}]' \
&& fail=1; \
$(PERL) -e 1 2> /dev/null && { $(PERL) -ne \
'/\bPOSIX\b/ && !/\@acronym{POSIX}/ && !/^\* / || /{posix}/ and print,exit 1' \
$(srcdir)/*.texi 2> /dev/null || fail=1; }; \
exit $$fail
sc-avoid-builtin:
$(AM_V_GEN)$(EGREP) -i '$(_W)builtins?$(W_)' $(srcdir)/*.texi \
$(AM_V_GEN)$(EGREP) -i '$(_W)builtins?$(W_)' $(texi_files) \
&& exit 1 || :
sc-avoid-path:
$(AM_V_GEN)fail=0; \
$(EGREP) -i '$(_W)path(name)?s?$(W_)' $(srcdir)/*.texi \
$(EGREP) -i '$(_W)path(name)?s?$(W_)' $(texi_files) \
| $(EGREP) -v \
'PATH=|path search|search path|@vindex PATH$$|@env[{]PATH[}]' \
&& fail=1; \
exit $$fail
# Use `time zone', not `timezone'.
# Use "time zone", not "timezone".
sc-avoid-timezone:
$(AM_V_GEN)$(EGREP) timezone $(srcdir)/*.texi && exit 1 || :
$(AM_V_GEN)$(EGREP) timezone $(texi_files) && exit 1 || :
# Check for insufficient exponent grouping, e.g.,
# @math{2^64} should be @math{2^{64}}.
sc-exponent-grouping:
$(AM_V_GEN)$(EGREP) '\{.*\^[0-9][0-9]' $(srcdir)/*.texi && exit 1 || :
# E.g., use @sc{nul}, not NUL.
sc-use-small-caps-NUL:
$(AM_V_GEN)$(EGREP) '$(_W)NUL$(W_)' $(srcdir)/*.texi && exit 1 || :
$(AM_V_GEN)$(EGREP) '\{.*\^[0-9][0-9]' $(texi_files) && exit 1 || :
# Say I/O, not IO.
sc-avoid-io:
$(AM_V_GEN)$(EGREP) '$(_W)IO$(W_)' $(srcdir)/*.texi && exit 1 || :
$(AM_V_GEN)$(EGREP) '$(_W)IO$(W_)' $(texi_files) && exit 1 || :
# I prefer nonzero over non-zero.
sc-avoid-non-zero:
$(AM_V_GEN)$(EGREP) non-zero $(srcdir)/*.texi && exit 1 || :
$(AM_V_GEN)$(EGREP) non-zero $(texi_files) && exit 1 || :
# Use `zeros', not `zeroes' (nothing wrong with `zeroes'. just be consistent).
# Use "zeros", not "zeroes" (nothing wrong with "zeroes"; just be consistent).
sc-avoid-zeroes:
$(AM_V_GEN)$(EGREP) -i '$(_W)zeroes$(W_)' $(srcdir)/*.texi && exit 1 || :
# ME = $(subdir)/$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
ME = doc/Makefile
$(AM_V_GEN)$(EGREP) -i '$(_W)zeroes$(W_)' $(texi_files) \
&& exit 1 || :
# The quantity inside @var{...} should not contain upper case letters.
# The leading backslash exemption is to permit in-macro uses like
@@ -123,9 +119,9 @@ find_upper_case_var = \
$$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}'
END {$$m and (warn "$@: do not use upper case in \@var{...}\n"), exit 1}'
sc-lower-case-var:
$(AM_V_GEN)$(PERL) -e 1 \
&& $(PERL) -lne $(find_upper_case_var) $(srcdir)/*.texi
$(AM_V_GEN)$(PERL) -e 1 || { echo $@: skipping test; exit 0; }; \
$(PERL) -lne $(find_upper_case_var) $(texi_files)
check: check-texinfo
check-local: check-texinfo

View File

@@ -1,7 +1,6 @@
@c File mode bits
@c Copyright (C) 1994, 1996, 1999-2001, 2003-2006, 2008-2010 Free Software
@c Foundation, Inc.
@c Copyright (C) 1994-2013 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.3 or
@@ -18,6 +17,7 @@ symbolic form or as an octal number.
* Mode Structure:: Structure of file mode bits.
* Symbolic Modes:: Mnemonic representation of file mode bits.
* Numeric Modes:: File mode bits as octal numbers.
* Operator Numeric Modes:: ANDing, ORing, and setting modes octally.
* Directory Setuid and Setgid:: Set-user-ID and set-group-ID on directories.
@end menu
@@ -112,7 +112,7 @@ specific to the file system. For example:
@table @asis
@item ext2
On @acronym{GNU} and @acronym{GNU}/Linux the file attributes specific to
On GNU and GNU/Linux the file attributes specific to
the ext2 file system are set using @command{chattr}.
@item FFS
@@ -345,7 +345,7 @@ the mode:
+t
@end example
The combination @samp{o+s} has no effect. On @acronym{GNU} systems
The combination @samp{o+s} has no effect. On GNU systems
the combinations @samp{u+t} and @samp{g+t} have no effect, and
@samp{o+t} acts like plain @samp{+t}.
@@ -496,13 +496,16 @@ alternative to giving a symbolic mode, you can give an octal (base 8)
number that represents the mode.
This number is always interpreted in octal; you do not have to add a
leading @samp{0}, as you do in C. Mode @samp{0055} is the same as
mode @samp{55}.
mode @samp{55}. (However, modes of five digits or more, such as
@samp{00055}, are sometimes special. @xref{Directory Setuid and Setgid}.)
A numeric mode is usually shorter than the corresponding symbolic
mode, but it is limited in that normally it cannot take into account the
previous file mode bits; it can only set them absolutely.
(As discussed in the next section, the set-user-ID and set-group-ID
bits of directories are an exception to this general limitation.)
The set-user-ID and set-group-ID bits of directories are an exception
to this general limitation. @xref{Directory Setuid and Setgid}.
Also, operator numeric modes can take previous file mode bits into
account. @xref{Operator Numeric Modes}.
The permissions granted to the user,
to other users in the file's group,
@@ -542,6 +545,26 @@ For example, numeric mode @samp{4755} corresponds to symbolic mode
@samp{ug=rw,o=r}. Numeric mode @samp{0} corresponds to symbolic mode
@samp{a=}.
@node Operator Numeric Modes
@section Operator Numeric Modes
An operator numeric mode is a numeric mode that is prefixed by a
@samp{-}, @samp{+}, or @samp{=} operator, which has the same
interpretation as in symbolic modes. For example, @samp{+440} enables
read permission for the file's owner and group, @samp{-1} disables
execute permission for other users, and @samp{=600} clears all
permissions except for enabling read-write permissions for the file's
owner. Operator numeric modes can be combined with symbolic modes by
separating them with a comma; for example, @samp{=0,u+r} clears all
permissions except for enabling read permission for the file's owner.
The commands @samp{chmod =755 @var{dir}} and @samp{chmod 755
@var{dir}} differ in that the former clears the directory @var{dir}'s
setuid and setgid bits, whereas the latter preserves them.
@xref{Directory Setuid and Setgid}.
Operator numeric modes are a GNU extension.
@node Directory Setuid and Setgid
@section Directories and the Set-User-ID and Set-Group-ID Bits
@@ -560,8 +583,10 @@ bits of directories. If commands like @command{chmod} and
mechanisms would be less convenient and it would be harder to share
files. Therefore, a command like @command{chmod} does not affect the
set-user-ID or set-group-ID bits of a directory unless the user
specifically mentions them in a symbolic mode, or sets them in
a numeric mode. For example, on systems that support
specifically mentions them in a symbolic mode, or uses an operator
numeric mode such as @samp{=755}, or sets them in a numeric mode, or
clears them in a numeric mode that has five or more octal digits.
For example, on systems that support
set-group-ID inheritance:
@example
@@ -583,22 +608,32 @@ explicitly in the symbolic or numeric modes, e.g.:
@example
# These commands try to set the set-user-ID
# and set-group-ID bits of the subdirectories.
mkdir G H
mkdir G
chmod 6755 G
chmod u=rwx,go=rx,a+s H
mkdir -m 6755 I
chmod +6000 G
chmod u=rwx,go=rx,a+s G
mkdir -m 6755 H
mkdir -m +6000 I
mkdir -m u=rwx,go=rx,a+s J
@end example
If you want to try to clear these bits, you must mention them
explicitly in a symbolic mode, e.g.:
explicitly in a symbolic mode, or use an operator numeric mode, or
specify a numeric mode with five or more octal digits, e.g.:
@example
# This command tries to clear the set-user-ID
# These commands try to clear the set-user-ID
# and set-group-ID bits of the directory D.
chmod a-s D
chmod -6000 D
chmod =755 D
chmod 00755 D
@end example
This behavior is a @acronym{GNU} extension. Portable scripts should
This behavior is a GNU extension. Portable scripts should
not rely on requests to set or clear these bits on directories, as
@acronym{POSIX} allows implementations to ignore these requests.
POSIX allows implementations to ignore these requests.
The GNU behavior with numeric modes of four or fewer digits
is intended for scripts portable to systems that preserve these bits;
the behavior with numeric modes of five or more digits is for scripts
portable to systems that do not preserve the bits.

View File

@@ -1,6 +1,6 @@
/* buffer-lcm.c - compute a good buffer size for dealing with two files
Copyright (C) 2002, 2005, 2009-2010 Free Software Foundation, Inc.
Copyright (C) 2002-2013 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,6 +17,7 @@
/* Written by Paul Eggert. */
#include <config.h>
#include "buffer-lcm.h"
/* Return a buffer size suitable for doing I/O with files whose block

2
gl/lib/buffer-lcm.h Normal file
View File

@@ -0,0 +1,2 @@
#include <stddef.h>
size_t buffer_lcm (size_t, size_t, size_t) _GL_ATTRIBUTE_CONST;

View File

@@ -1,237 +0,0 @@
/* Set operations for device-inode pairs stored in a space-efficient manner.
Copyright 2009-2010 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 and Jim Meyering */
#include <config.h>
#include "di-set.h"
#include "hash.h"
#include "ino-map.h"
#include <limits.h>
#include <stdlib.h>
/* The hash package hashes "void *", but this package wants to hash
integers. Use integers that are as large as possible, but no
larger than void *, so that they can be cast to void * and back
without losing information. */
typedef size_t hashint;
#define HASHINT_MAX ((hashint) -1)
/* Integers represent inode numbers. Integers in the range
1..(LARGE_INO_MIN-1) represent inode numbers directly. (The hash
package does not work with null pointers, so inode 0 cannot be used
as a key.) To find the representations of other inode numbers, map
them through INO_MAP. */
#define LARGE_INO_MIN (HASHINT_MAX / 2)
/* Set operations for device-inode pairs stored in a space-efficient
manner. Use a two-level hash table. The top level hashes by
device number, as there are typically a small number of devices.
The lower level hashes by mapped inode numbers. In the typical
case where the inode number is positive and small, the inode number
maps to itself, masquerading as a void * value; otherwise, its
value is the result of hashing the inode value through INO_MAP. */
/* A pair that maps a device number to a set of inode numbers. */
struct di_ent
{
dev_t dev;
struct hash_table *ino_set;
};
/* A two-level hash table that manages and indexes these pairs. */
struct di_set
{
/* Map device numbers to sets of inode number representatives. */
struct hash_table *dev_map;
/* If nonnull, map large inode numbers to their small
representatives. If null, there are no large inode numbers in
this set. */
struct ino_map *ino_map;
/* Cache of the most recently allocated and otherwise-unused storage
for probing this table. */
struct di_ent *probe;
};
/* Hash a device-inode-set entry. */
static size_t
di_ent_hash (void const *x, size_t table_size)
{
struct di_ent const *p = x;
dev_t dev = p->dev;
/* When DEV is wider than size_t, exclusive-OR the words of DEV into H.
This avoids loss of info, without applying % to the wider type,
which could be quite slow on some systems. */
size_t h = dev;
unsigned int i;
unsigned int n_words = sizeof dev / sizeof h + (sizeof dev % sizeof h != 0);
for (i = 1; i < n_words; i++)
h ^= dev >> CHAR_BIT * sizeof h * i;
return h % table_size;
}
/* Return true if two device-inode-set entries are the same. */
static bool
di_ent_compare (void const *x, void const *y)
{
struct di_ent const *a = x;
struct di_ent const *b = y;
return a->dev == b->dev;
}
/* Free a device-inode-set entry. */
static void
di_ent_free (void *v)
{
struct di_ent *a = v;
hash_free (a->ino_set);
free (a);
}
/* Create a set of device-inode pairs. Return NULL on allocation failure. */
struct di_set *
di_set_alloc (void)
{
struct di_set *dis = malloc (sizeof *dis);
if (dis)
{
enum { INITIAL_DEV_MAP_SIZE = 11 };
dis->dev_map = hash_initialize (INITIAL_DEV_MAP_SIZE, NULL,
di_ent_hash, di_ent_compare,
di_ent_free);
if (! dis->dev_map)
{
free (dis);
return NULL;
}
dis->ino_map = NULL;
dis->probe = NULL;
}
return dis;
}
/* Free a set of device-inode pairs. */
void
di_set_free (struct di_set *dis)
{
hash_free (dis->dev_map);
free (dis->ino_map);
free (dis->probe);
free (dis);
}
/* Hash an encoded inode number I. */
static size_t
di_ino_hash (void const *i, size_t table_size)
{
return (hashint) i % table_size;
}
/* Using the DIS table, map a device to a hash table that represents
a set of inode numbers. Return NULL on error. */
static struct hash_table *
map_device (struct di_set *dis, dev_t dev)
{
/* Find space for the probe, reusing the cache if available. */
struct di_ent *ent;
struct di_ent *probe = dis->probe;
if (probe)
{
/* If repeating a recent query, return the cached result. */
if (probe->dev == dev)
return probe->ino_set;
}
else
{
dis->probe = probe = malloc (sizeof *probe);
if (! probe)
return NULL;
}
/* Probe for the device. */
probe->dev = dev;
ent = hash_insert (dis->dev_map, probe);
if (! ent)
return NULL;
if (ent != probe)
{
/* Use the existing entry. */
probe->ino_set = ent->ino_set;
}
else
{
enum { INITIAL_INO_SET_SIZE = 1021 };
/* Prepare to allocate a new probe next time; this one is in use. */
dis->probe = NULL;
/* DEV is new; allocate an inode set for it. */
probe->ino_set = hash_initialize (INITIAL_INO_SET_SIZE, NULL,
di_ino_hash, NULL, NULL);
}
return probe->ino_set;
}
/* Using the DIS table, map an inode number to a mapped value.
Return INO_MAP_INSERT_FAILURE on error. */
static hashint
map_inode_number (struct di_set *dis, ino_t ino)
{
if (0 < ino && ino < LARGE_INO_MIN)
return ino;
if (! dis->ino_map)
{
dis->ino_map = ino_map_alloc (LARGE_INO_MIN);
if (! dis->ino_map)
return INO_MAP_INSERT_FAILURE;
}
return ino_map_insert (dis->ino_map, ino);
}
/* Attempt to insert the DEV,INO pair into the set DIS.
If it matches a pair already in DIS, keep that pair and return 0.
Otherwise, if insertion is successful, return 1.
Upon any failure return -1. */
int
di_set_insert (struct di_set *dis, dev_t dev, ino_t ino)
{
hashint i;
/* Map the device number to a set of inodes. */
struct hash_table *ino_set = map_device (dis, dev);
if (! ino_set)
return -1;
/* Map the inode number to a small representative I. */
i = map_inode_number (dis, ino);
if (i == INO_MAP_INSERT_FAILURE)
return -1;
/* Put I into the inode set. */
return hash_insert0 (ino_set, (void *) i, NULL);
}

View File

@@ -1,12 +0,0 @@
#include <sys/types.h>
#undef _ATTRIBUTE_NONNULL_
#if __GNUC__ == 3 && __GNUC_MINOR__ >= 3 || 3 < __GNUC__
# define _ATTRIBUTE_NONNULL_(m) __attribute__ ((__nonnull__ (m)))
#else
# define _ATTRIBUTE_NONNULL_(m)
#endif
struct di_set *di_set_alloc (void);
int di_set_insert (struct di_set *, dev_t, ino_t) _ATTRIBUTE_NONNULL_ (1);
void di_set_free (struct di_set *) _ATTRIBUTE_NONNULL_ (1);

View File

@@ -1,5 +1,5 @@
/* Declare an access pattern hint for files.
Copyright (C) 2010 Free Software Foundation, Inc.
Copyright (C) 2010-2013 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@@ -1,5 +1,5 @@
/* Declare an access pattern hint for files.
Copyright (C) 2010 Free Software Foundation, Inc.
Copyright (C) 2010-2013 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@@ -1,6 +1,6 @@
/* Invoke open, but return either a desired file descriptor or -1.
Copyright (C) 2005-2006, 2008-2010 Free Software Foundation, Inc.
Copyright (C) 2005-2013 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@
#include <unistd.h>
/* Open a file to a particular file descriptor. This is like standard
`open', except it always returns DESIRED_FD if successful. */
'open', except it always returns DESIRED_FD if successful. */
int
fd_reopen (int desired_fd, char const *file, int flags, mode_t mode)

View File

@@ -1,6 +1,6 @@
/* Invoke open, but return either a desired file descriptor or -1.
Copyright (C) 2005, 2009-2010 Free Software Foundation, Inc.
Copyright (C) 2005-2013 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@@ -1,6 +1,6 @@
/* Barebones heap implementation supporting only insert and pop.
Copyright (C) 2010 Free Software Foundation, Inc.
Copyright (C) 2010-2013 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
@@ -93,10 +93,12 @@ heap_insert (struct heap *heap, void *item)
void *
heap_remove_top (struct heap *heap)
{
void *top;
if (heap->count == 0)
return NULL;
void *top = heap->array[1];
top = heap->array[1];
heap->array[1] = heap->array[heap->count--];
heapify_down (heap->array, heap->count, 1, heap->compare);

View File

@@ -1,6 +1,6 @@
/* Barebones heap implementation supporting only insert and pop.
Copyright (C) 2010 Free Software Foundation, Inc.
Copyright (C) 2010-2013 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@@ -1,164 +0,0 @@
/* Map an ino_t inode number to a small integer.
Copyright 2009, 2010 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 and Jim Meyering */
#include <config.h>
#include "ino-map.h"
#include "hash.h"
#include "verify.h"
#include <limits.h>
#include <stdlib.h>
/* A pair that maps an inode number to a mapped inode number; the
latter is a small unique ID for the former. */
struct ino_map_ent
{
ino_t ino;
size_t mapped_ino;
};
/* A table that manages and indexes these pairs. */
struct ino_map
{
/* A table of KEY,VAL pairs, where KEY is the raw ino_t value and
VAL is the small number that it maps to. */
struct hash_table *map;
/* The next mapped inode number to hand out. */
size_t next_mapped_ino;
/* Cache of the most recently allocated and otherwise-unused storage
for probing the table. */
struct ino_map_ent *probe;
};
/* Hash an inode map entry. */
static size_t
ino_hash (void const *x, size_t table_size)
{
struct ino_map_ent const *p = x;
ino_t ino = p->ino;
/* When INO is wider than size_t, exclusive-OR the words of INO into H.
This avoids loss of info, without applying % to the wider type,
which could be quite slow on some systems. */
size_t h = ino;
unsigned int i;
unsigned int n_words = sizeof ino / sizeof h + (sizeof ino % sizeof h != 0);
for (i = 1; i < n_words; i++)
h ^= ino >> CHAR_BIT * sizeof h * i;
return h % table_size;
}
/* Return true if two inode map entries are the same. */
static bool
ino_compare (void const *x, void const *y)
{
struct ino_map_ent const *a = x;
struct ino_map_ent const *b = y;
return a->ino == b->ino;
}
/* Allocate an inode map that will hand out integers starting with
NEXT_MAPPED_INO. Return NULL if memory is exhausted. */
struct ino_map *
ino_map_alloc (size_t next_mapped_ino)
{
struct ino_map *im = malloc (sizeof *im);
if (im)
{
enum { INITIAL_INO_MAP_TABLE_SIZE = 1021 };
im->map = hash_initialize (INITIAL_INO_MAP_TABLE_SIZE, NULL,
ino_hash, ino_compare, free);
if (! im->map)
{
free (im);
return NULL;
}
im->next_mapped_ino = next_mapped_ino;
im->probe = NULL;
}
return im;
}
/* Free an inode map. */
void
ino_map_free (struct ino_map *map)
{
hash_free (map->map);
free (map->probe);
free (map);
}
/* Insert into MAP the inode number INO if it's not there already,
and return its nonnegative mapped inode number.
If INO is already in MAP, return the existing mapped inode number.
Return INO_MAP_INSERT_FAILURE on memory or counter exhaustion. */
size_t
ino_map_insert (struct ino_map *im, ino_t ino)
{
struct ino_map_ent *ent;
/* Find space for the probe, reusing the cache if available. */
struct ino_map_ent *probe = im->probe;
if (probe)
{
/* If repeating a recent query, return the cached result. */
if (probe->ino == ino)
return probe->mapped_ino;
}
else
{
im->probe = probe = malloc (sizeof *probe);
if (! probe)
return INO_MAP_INSERT_FAILURE;
}
probe->ino = ino;
ent = hash_insert (im->map, probe);
if (! ent)
return INO_MAP_INSERT_FAILURE;
if (ent != probe)
{
/* Use the existing entry. */
probe->mapped_ino = ent->mapped_ino;
}
else
{
/* If adding 1 to map->next_mapped_ino would cause it to
overflow to zero, then it must equal INO_MAP_INSERT_FAILURE,
which is the value that should be returned in that case.
Verify that this works. */
verify (INO_MAP_INSERT_FAILURE + 1 == 0);
/* Prepare to allocate a new probe next time; this one is in use. */
im->probe = NULL;
/* INO is new; allocate a mapped inode number for it. */
probe->mapped_ino = im->next_mapped_ino++;
}
return probe->mapped_ino;
}

View File

@@ -1,14 +0,0 @@
#include <sys/types.h>
#undef _ATTRIBUTE_NONNULL_
#if __GNUC__ == 3 && __GNUC_MINOR__ >= 3 || 3 < __GNUC__
# define _ATTRIBUTE_NONNULL_(m) __attribute__ ((__nonnull__ (m)))
#else
# define _ATTRIBUTE_NONNULL_(m)
#endif
#define INO_MAP_INSERT_FAILURE ((size_t) -1)
struct ino_map *ino_map_alloc (size_t);
void ino_map_free (struct ino_map *) _ATTRIBUTE_NONNULL_ (1);
size_t ino_map_insert (struct ino_map *, ino_t) _ATTRIBUTE_NONNULL_ (1);

View File

@@ -1,5 +1,5 @@
/* Align/Truncate a string in a given screen width
Copyright (C) 2009-2010 Free Software Foundation, Inc.
Copyright (C) 2009-2013 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
@@ -79,27 +79,6 @@ wc_truncate (wchar_t *wc, size_t width)
return cells;
}
/* FIXME: move this function to gnulib as it's missing on:
OpenBSD 3.8, IRIX 5.3, Solaris 2.5.1, mingw, BeOS */
static int
rpl_wcswidth (const wchar_t *s, size_t n)
{
int ret = 0;
while (n-- > 0 && *s != L'\0')
{
int nwidth = wcwidth (*s++);
if (nwidth == -1) /* non printable */
return -1;
if (ret > (INT_MAX - nwidth)) /* overflow */
return -1;
ret += nwidth;
}
return ret;
}
/* Write N_SPACES space characters to DEST while ensuring
nothing is written beyond DEST_END. A terminating NUL
is always added to DEST.
@@ -147,7 +126,7 @@ mbsalign (const char *src, char *dest, size_t dest_size,
/* In multi-byte locales convert to wide characters
to allow easy truncation. Also determine number
of screen columns used. */
if (MB_CUR_MAX > 1)
if (!(flags & MBA_UNIBYTE_ONLY) && MB_CUR_MAX > 1)
{
size_t src_chars = mbstowcs (NULL, src, 0);
if (src_chars == SIZE_MAX)
@@ -171,7 +150,7 @@ mbsalign (const char *src, char *dest, size_t dest_size,
str_wc[src_chars - 1] = L'\0';
wc_enabled = true;
conversion = wc_ensure_printable (str_wc);
n_cols = rpl_wcswidth (str_wc, src_chars);
n_cols = wcswidth (str_wc, src_chars);
}
}
@@ -212,37 +191,46 @@ mbsalign_unibyte:
/* indicate to caller how many cells needed (not including padding). */
*width = n_cols;
/* indicate to caller how many bytes needed (not including NUL). */
ret = n_used_bytes + (n_spaces * 1);
{
size_t start_spaces, end_spaces;
/* Write as much NUL terminated output to DEST as possible. */
if (dest_size != 0)
{
size_t start_spaces, end_spaces, space_left;
char *dest_end = dest + dest_size - 1;
switch (align)
{
case MBS_ALIGN_LEFT:
start_spaces = 0;
end_spaces = n_spaces;
break;
case MBS_ALIGN_RIGHT:
start_spaces = n_spaces;
end_spaces = 0;
break;
case MBS_ALIGN_CENTER:
default:
start_spaces = n_spaces / 2 + n_spaces % 2;
end_spaces = n_spaces / 2;
break;
}
switch (align)
if (flags & MBA_NO_LEFT_PAD)
start_spaces = 0;
if (flags & MBA_NO_RIGHT_PAD)
end_spaces = 0;
/* Write as much NUL terminated output to DEST as possible. */
if (dest_size != 0)
{
case MBS_ALIGN_LEFT:
start_spaces = 0;
end_spaces = n_spaces;
break;
case MBS_ALIGN_RIGHT:
start_spaces = n_spaces;
end_spaces = 0;
break;
case MBS_ALIGN_CENTER:
default:
start_spaces = n_spaces / 2 + n_spaces % 2;
end_spaces = n_spaces / 2;
break;
size_t space_left;
char *dest_end = dest + dest_size - 1;
dest = mbs_align_pad (dest, dest_end, start_spaces);
space_left = dest_end - dest;
dest = mempcpy (dest, str_to_print, MIN (n_used_bytes, space_left));
mbs_align_pad (dest, dest_end, end_spaces);
}
dest = mbs_align_pad (dest, dest_end, start_spaces);
space_left = dest_end - dest;
dest = mempcpy (dest, str_to_print, MIN (n_used_bytes, space_left));
mbs_align_pad (dest, dest_end, end_spaces);
}
/* indicate to caller how many bytes needed (not including NUL). */
ret = n_used_bytes + ((start_spaces + end_spaces) * 1);
}
mbsalign_cleanup:

View File

@@ -1,5 +1,5 @@
/* Align/Truncate a string in a given screen width
Copyright (C) 2009-2010 Free Software Foundation, Inc.
Copyright (C) 2009-2013 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -19,22 +19,35 @@
typedef enum { MBS_ALIGN_LEFT, MBS_ALIGN_RIGHT, MBS_ALIGN_CENTER } mbs_align_t;
enum {
/* Use unibyte mode for invalid multibyte strings or
/* Use unibyte mode for invalid multibyte strings
or when heap memory is exhausted. */
MBA_UNIBYTE_FALLBACK = 0x0001
MBA_UNIBYTE_FALLBACK = 0x0001,
/* As an optimization, don't do multibyte processing
when we know no multibyte characters are present. */
MBA_UNIBYTE_ONLY = 0x0002,
/* Don't add leading padding. */
MBA_NO_LEFT_PAD = 0x0004,
/* Don't add trailing padding. */
MBA_NO_RIGHT_PAD = 0x0008
#if 0 /* Other possible options. */
/* Skip invalid multibyte chars rather than failing */
MBA_IGNORE_INVALID = 0x0002,
/* Skip invalid multibyte chars rather than failing. */
MBA_IGNORE_INVALID
/* Align multibyte strings using "figure space" (\u2007) */
MBA_USE_FIGURE_SPACE = 0x0004,
/* Align multibyte strings using "figure space" (\u2007). */
MBA_USE_FIGURE_SPACE
/* Don't add any padding */
MBA_TRUNCATE_ONLY = 0x0008,
/* Don't truncate. */
MBA_NO_TRUNCATE
/* Don't truncate */
MBA_PAD_ONLY = 0x0010,
/* Ensure no leading whitespace. */
MBA_LSTRIP
/* Ensure no trailing whitespace. */
MBA_RSTRIP
#endif
};

View File

@@ -1,6 +1,6 @@
/* Bob Jenkins's cryptographic random number generators, ISAAC and ISAAC64.
Copyright (C) 1999-2006, 2009-2010 Free Software Foundation, Inc.
Copyright (C) 1999-2013 Free Software Foundation, Inc.
Copyright (C) 1997, 1998, 1999 Colin Plumb.
This program is free software: you can redistribute it and/or modify
@@ -58,16 +58,26 @@ just (isaac_word a)
return a & desired_bits;
}
/* The index operation. On typical machines whose words are exactly
the right size, this is optimized to a mask, an addition, and an
indirect load. Atypical machines need more work. */
/* The index operation. */
static inline isaac_word
ind (isaac_word const *m, isaac_word x)
{
return (sizeof *m * CHAR_BIT == ISAAC_BITS
? (* (isaac_word *) ((char *) m
+ (x & ((ISAAC_WORDS - 1) * sizeof *m))))
: m[(x / (ISAAC_BITS / CHAR_BIT)) & (ISAAC_WORDS - 1)]);
if (sizeof *m * CHAR_BIT == ISAAC_BITS)
{
/* The typical case, where words are exactly the right size.
Optimize this to a mask, an addition, and an indirect
load. */
void const *void_m = m;
char const *base_p = void_m;
void const *word_p = base_p + (x & ((ISAAC_WORDS - 1) * sizeof *m));
isaac_word const *p = word_p;
return *p;
}
else
{
/* Atypical machines need more work. */
return m[(x / (ISAAC_BITS / CHAR_BIT)) & (ISAAC_WORDS - 1)];
}
}
/* Use and update *S to generate random data to fill RESULT. */

View File

@@ -1,6 +1,6 @@
/* Bob Jenkins's cryptographic random number generators, ISAAC and ISAAC64.
Copyright (C) 1999-2005, 2009-2010 Free Software Foundation, Inc.
Copyright (C) 1999-2013 Free Software Foundation, Inc.
Copyright (C) 1997, 1998, 1999 Colin Plumb.
This program is free software: you can redistribute it and/or modify

View File

@@ -1,6 +1,6 @@
/* Generate random integers.
Copyright (C) 2006, 2009-2010 Free Software Foundation, Inc.
Copyright (C) 2006-2013 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@@ -1,6 +1,6 @@
/* Generate random integers.
Copyright (C) 2006, 2009-2010 Free Software Foundation, Inc.
Copyright (C) 2006-2013 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,8 @@ struct randint_source;
struct randint_source *randint_new (struct randread_source *);
struct randint_source *randint_all_new (char const *, size_t);
struct randread_source *randint_get_source (struct randint_source const *);
struct randread_source *randint_get_source (struct randint_source const *)
_GL_ATTRIBUTE_PURE;
randint randint_genmax (struct randint_source *, randint genmax);
/* Consume random data from *S to generate a random number in the range

View File

@@ -1,6 +1,6 @@
/* Generate random permutations.
Copyright (C) 2006-2007, 2009-2010 Free Software Foundation, Inc.
Copyright (C) 2006-2013 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -19,16 +19,18 @@
#include <config.h>
#include "hash.h"
#include "randperm.h"
#include <limits.h>
#include <stdlib.h>
#include "xalloc.h"
/* Return the ceiling of the log base 2 of N. If N is zero, return
an unspecified value. */
static size_t
static size_t _GL_ATTRIBUTE_CONST
ceil_lg (size_t n)
{
size_t b = 0;
@@ -57,6 +59,94 @@ randperm_bound (size_t h, size_t n)
return bound;
}
/* Swap elements I and J in array V. */
static void
swap (size_t *v, size_t i, size_t j)
{
size_t t = v[i];
v[i] = v[j];
v[j] = t;
}
/* Structures and functions for a sparse_map abstract data type that's
used to effectively swap elements I and J in array V like swap(),
but in a more memory efficient manner (when the number of permutations
performed is significantly less than the size of the input). */
struct sparse_ent_
{
size_t index;
size_t val;
};
static size_t
sparse_hash_ (void const *x, size_t table_size)
{
struct sparse_ent_ const *ent = x;
return ent->index % table_size;
}
static bool
sparse_cmp_ (void const *x, void const *y)
{
struct sparse_ent_ const *ent1 = x;
struct sparse_ent_ const *ent2 = y;
return ent1->index == ent2->index;
}
typedef Hash_table sparse_map;
/* Initialize the structure for the sparse map,
when a best guess as to the number of entries
specified with SIZE_HINT. */
static sparse_map *
sparse_new (size_t size_hint)
{
return hash_initialize (size_hint, NULL, sparse_hash_, sparse_cmp_, free);
}
/* Swap the values for I and J. If a value is not already present
then assume it's equal to the index. Update the value for
index I in array V. */
static void
sparse_swap (sparse_map *sv, size_t* v, size_t i, size_t j)
{
struct sparse_ent_ *v1 = hash_delete (sv, &(struct sparse_ent_) {i,0});
struct sparse_ent_ *v2 = hash_delete (sv, &(struct sparse_ent_) {j,0});
/* FIXME: reduce the frequency of these mallocs. */
if (!v1)
{
v1 = xmalloc (sizeof *v1);
v1->index = v1->val = i;
}
if (!v2)
{
v2 = xmalloc (sizeof *v2);
v2->index = v2->val = j;
}
size_t t = v1->val;
v1->val = v2->val;
v2->val = t;
if (!hash_insert (sv, v1))
xalloc_die ();
if (!hash_insert (sv, v2))
xalloc_die ();
v[i] = v1->val;
}
static void
sparse_free (sparse_map *sv)
{
hash_free (sv);
}
/* From R, allocate and return a malloc'd array of the first H elements
of a random permutation of N elements. H must not exceed N.
Return NULL if H is zero. */
@@ -79,21 +169,66 @@ randperm_new (struct randint_source *r, size_t h, size_t n)
default:
{
size_t i;
/* The algorithm is essentially the same in both
the sparse and non sparse case. In the sparse case we use
a hash to implement sparse storage for the set of n numbers
we're shuffling. When to use the sparse method was
determined with the help of this script:
v = xnmalloc (n, sizeof *v);
for (i = 0; i < n; i++)
v[i] = i;
#!/bin/sh
for n in $(seq 2 32); do
for h in $(seq 2 32); do
test $h -gt $n && continue
for s in o n; do
test $s = o && shuf=shuf || shuf=./shuf
num=$(env time -f "$s:${h},${n} = %e,%M" \
$shuf -i0-$((2**$n-2)) -n$((2**$h-2)) | wc -l)
test $num = $((2**$h-2)) || echo "$s:${h},${n} = failed" >&2
done
done
done
This showed that if sparseness = n/h, then:
sparseness = 128 => .125 mem used, and about same speed
sparseness = 64 => .25 mem used, but 1.5 times slower
sparseness = 32 => .5 mem used, but 2 times slower
Also the memory usage was only significant when n > 128Ki
*/
bool sparse = (n >= (128 * 1024)) && (n / h >= 32);
size_t i;
sparse_map *sv;
if (sparse)
{
sv = sparse_new (h * 2);
if (sv == NULL)
xalloc_die ();
v = xnmalloc (h, sizeof *v);
}
else
{
sv = NULL; /* To placate GCC's -Wuninitialized. */
v = xnmalloc (n, sizeof *v);
for (i = 0; i < n; i++)
v[i] = i;
}
for (i = 0; i < h; i++)
{
size_t j = i + randint_choose (r, n - i);
size_t t = v[i];
v[i] = v[j];
v[j] = t;
if (sparse)
sparse_swap (sv, v, i, j);
else
swap (v, i, j);
}
v = xnrealloc (v, h, sizeof *v);
if (sparse)
sparse_free (sv);
else
v = xnrealloc (v, h, sizeof *v);
}
break;
}

View File

@@ -1,4 +1,4 @@
#include "randint.h"
#include <stddef.h>
size_t randperm_bound (size_t, size_t);
size_t randperm_bound (size_t, size_t) _GL_ATTRIBUTE_CONST;
size_t *randperm_new (struct randint_source *, size_t, size_t);

View File

@@ -1,6 +1,6 @@
/* Generate buffers of random data.
Copyright (C) 2006, 2008-2010 Free Software Foundation, Inc.
Copyright (C) 2006-2013 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,6 +17,9 @@
/* Written by Paul Eggert. */
/* FIXME: Improve performance by adding support for the RDRAND machine
instruction if available (e.g., Ivy Bridge processors). */
#include <config.h>
#include "randread.h"
@@ -26,6 +29,7 @@
#include <exitfail.h>
#include <fcntl.h>
#include <quotearg.h>
#include <stdalign.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
@@ -59,12 +63,11 @@
#if _STRING_ARCH_unaligned
# define ALIGNED_POINTER(ptr, type) true
#else
# define alignof(type) offsetof (struct { char c; type x; }, x)
# define ALIGNED_POINTER(ptr, type) ((size_t) (ptr) % alignof (type) == 0)
#endif
#ifndef NAME_OF_NONCE_DEVICE
#define NAME_OF_NONCE_DEVICE "/dev/urandom"
# define NAME_OF_NONCE_DEVICE "/dev/urandom"
#endif
/* The maximum buffer size used for reads of random data. Using the
@@ -162,7 +165,7 @@ get_nonce (void *buffer, size_t bufsize, size_t bytes_bound)
/* If there's no nonce device, use a poor approximation
by getting the time of day, etc. */
# define ISAAC_SEED(type, initialize_v) \
#define ISAAC_SEED(type, initialize_v) \
if (seeded < bufsize) \
{ \
type v; \
@@ -272,12 +275,14 @@ readsource (struct randread_source *s, unsigned char *p, size_t size)
the buffered ISAAC generator in ISAAC. */
static void
readisaac (struct isaac *isaac, unsigned char *p, size_t size)
readisaac (struct isaac *isaac, void *p, size_t size)
{
size_t inbytes = isaac->buffered;
while (true)
{
char *char_p = p;
if (size <= inbytes)
{
memcpy (p, isaac->data.b + ISAAC_BYTES - inbytes, size);
@@ -286,14 +291,14 @@ readisaac (struct isaac *isaac, unsigned char *p, size_t size)
}
memcpy (p, isaac->data.b + ISAAC_BYTES - inbytes, inbytes);
p += inbytes;
p = char_p + inbytes;
size -= inbytes;
/* If P is aligned, write to *P directly to avoid the overhead
of copying from the buffer. */
if (ALIGNED_POINTER (p, isaac_word))
{
isaac_word *wp = (isaac_word *) p;
isaac_word *wp = p;
while (ISAAC_BYTES <= size)
{
isaac_refill (&isaac->state, wp);
@@ -305,7 +310,7 @@ readisaac (struct isaac *isaac, unsigned char *p, size_t size)
return;
}
}
p = (unsigned char *) wp;
p = wp;
}
isaac_refill (&isaac->state, isaac->data.w);

View File

@@ -1,6 +1,6 @@
/* Generate buffers of random data.
Copyright (C) 2006, 2009-2010 Free Software Foundation, Inc.
Copyright (C) 2006-2013 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@@ -1,8 +1,8 @@
diff --git a/lib/regcomp.c b/lib/regcomp.c
index d5968bd..4926676 100644
index 6d5525a..c9331d4 100644
--- a/lib/regcomp.c
+++ b/lib/regcomp.c
@@ -541,7 +541,7 @@ regerror (errcode, preg, errbuf, errbuf_size)
@@ -539,7 +539,7 @@ regerror (errcode, preg, errbuf, errbuf_size)
size_t errbuf_size;
#else /* size_t might promote */
size_t
@@ -11,7 +11,7 @@ index d5968bd..4926676 100644
char *_Restrict_ errbuf, size_t errbuf_size)
#endif
{
@@ -1383,7 +1383,7 @@ calc_first (void *extra, bin_tree_t *node)
@@ -1421,7 +1421,7 @@ calc_first (void *extra, bin_tree_t *node)
/* Pass 2: compute NEXT on the tree. Preorder visit. */
static reg_errcode_t
@@ -20,17 +20,20 @@ index d5968bd..4926676 100644
{
switch (node->token.type)
{
@@ -2744,7 +2744,8 @@ static reg_errcode_t
@@ -2807,8 +2807,10 @@ build_range_exp (const reg_syntax_t syntax,
static reg_errcode_t
internal_function
build_collating_symbol (bitset_t sbcset,
# ifdef RE_ENABLE_I18N
- re_charset_t *mbcset, Idx *coll_sym_alloc,
+ re_charset_t *mbcset _UNUSED_PARAMETER_,
-build_collating_symbol (bitset_t sbcset, re_charset_t *mbcset,
- Idx *coll_sym_alloc, const unsigned char *name)
+build_collating_symbol (bitset_t sbcset,
+ re_charset_t *mbcset _UNUSED_PARAMETER_,
+ Idx *coll_sym_alloc _UNUSED_PARAMETER_,
# endif
const unsigned char *name)
{
@@ -3323,7 +3324,8 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token,
+ const unsigned char *name)
# else /* not RE_ENABLE_I18N */
build_collating_symbol (bitset_t sbcset, const unsigned char *name)
# endif /* not RE_ENABLE_I18N */
@@ -3392,7 +3394,8 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token,
static reg_errcode_t
parse_bracket_element (bracket_elem_t *elem, re_string_t *regexp,
@@ -40,19 +43,20 @@ index d5968bd..4926676 100644
reg_syntax_t syntax, bool accept_hyphen)
{
#ifdef RE_ENABLE_I18N
@@ -3410,8 +3412,9 @@ parse_bracket_symbol (bracket_elem_t *elem, re_string_t *regexp,
@@ -3479,8 +3482,10 @@ parse_bracket_symbol (bracket_elem_t *elem, re_string_t *regexp,
static reg_errcode_t
#ifdef RE_ENABLE_I18N
-build_equiv_class (bitset_t sbcset, re_charset_t *mbcset,
- Idx *equiv_class_alloc, const unsigned char *name)
+build_equiv_class (bitset_t sbcset, re_charset_t *mbcset _UNUSED_PARAMETER_,
+build_equiv_class (bitset_t sbcset,
+ re_charset_t *mbcset _UNUSED_PARAMETER_,
+ Idx *equiv_class_alloc _UNUSED_PARAMETER_,
+ const unsigned char *name)
#else /* not RE_ENABLE_I18N */
build_equiv_class (bitset_t sbcset, const unsigned char *name)
#endif /* not RE_ENABLE_I18N */
@@ -3816,7 +3819,7 @@ free_token (re_token_t *node)
@@ -3886,7 +3891,7 @@ free_token (re_token_t *node)
and its children. */
static reg_errcode_t

View File

@@ -1,17 +1,17 @@
diff --git a/lib/regex_internal.c b/lib/regex_internal.c
index 904b88e..61c8d9d 100644
index 7e8c1bc..e68c9da 100644
--- a/lib/regex_internal.c
+++ b/lib/regex_internal.c
@@ -18,6 +18,8 @@
with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
@@ -16,6 +16,8 @@
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 "verify.h"
+#include "intprops.h"
static void re_string_construct_common (const char *str, Idx len,
re_string_t *pstr,
RE_TRANSLATE_TYPE trans, bool icase,
@@ -1390,7 +1392,10 @@ static void
@@ -1393,7 +1395,10 @@ static void
internal_function
re_node_set_remove_at (re_node_set *set, Idx idx)
{

View File

@@ -1,14 +1,14 @@
diff --git i/lib/regex_internal.h w/lib/regex_internal.h
index 859832f..3c7fe06 100644
--- i/lib/regex_internal.h
+++ w/lib/regex_internal.h
@@ -826,7 +826,8 @@ re_string_wchar_at (const re_string_t *pstr, Idx idx)
diff --git a/lib/regex_internal.h b/lib/regex_internal.h
index 439444c..7242084 100644
--- a/lib/regex_internal.h
+++ b/lib/regex_internal.h
@@ -827,7 +827,8 @@ re_string_wchar_at (const re_string_t *pstr, Idx idx)
# ifndef NOT_IN_libc
static int
internal_function __attribute ((pure))
internal_function __attribute__ ((pure, unused))
-re_string_elem_size_at (const re_string_t *pstr, Idx idx)
+re_string_elem_size_at (const re_string_t *pstr _UNUSED_PARAMETER_,
+ Idx idx _UNUSED_PARAMETER_)
{
# ifdef _LIBC
# ifdef _LIBC
const unsigned char *p, *extra;

View File

@@ -1,17 +1,17 @@
diff --git a/lib/regexec.c b/lib/regexec.c
index 21a8166..7762437 100644
index 7d130a0..a58d454 100644
--- a/lib/regexec.c
+++ b/lib/regexec.c
@@ -18,6 +18,8 @@
with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
@@ -16,6 +16,8 @@
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 "verify.h"
+#include "intprops.h"
static reg_errcode_t match_ctx_init (re_match_context_t *cache, int eflags,
Idx n) internal_function;
static void match_ctx_clean (re_match_context_t *mctx) internal_function;
@@ -378,8 +380,11 @@ re_search_2_stub (struct re_pattern_buffer *bufp,
@@ -374,8 +376,11 @@ re_search_2_stub (struct re_pattern_buffer *bufp,
Idx len = length1 + length2;
char *s = NULL;
@@ -25,7 +25,7 @@ index 21a8166..7762437 100644
/* Concatenate the strings. */
if (length2 > 0)
@@ -431,11 +436,14 @@ re_search_stub (struct re_pattern_buffer *bufp,
@@ -426,11 +431,14 @@ re_search_stub (struct re_pattern_buffer *bufp,
Idx last_start = start + range;
/* Check for out-of-range. */

View File

@@ -1,5 +1,5 @@
/* root-dev-ino.c -- get the device and inode numbers for `/'.
Copyright (C) 2003, 2005-2006, 2009-2010 Free Software Foundation, Inc.
/* root-dev-ino.c -- get the device and inode numbers for '/'.
Copyright (C) 2003-2013 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 @@
#include <stdlib.h>
/* Call lstat to get the device and inode numbers for `/'.
/* Call lstat to get the device and inode numbers for '/'.
Upon failure, return NULL. Otherwise, set the members of
*ROOT_D_I accordingly and return ROOT_D_I. */
struct dev_ino *

View File

@@ -1,6 +1,6 @@
/* Root device and inode number checking.
Copyright (C) 2003, 2006, 2009-2010 Free Software Foundation, Inc.
Copyright (C) 2003-2013 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

46
gl/lib/smack.h Normal file
View File

@@ -0,0 +1,46 @@
/* Include and determine availability of smack routines
Copyright (C) 2013 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/>. */
/* Here we replace or wrap the most common smack functions used by coreutils.
Others will need to be protected by HAVE_SMACK. */
#include <config.h>
#ifdef HAVE_SMACK
# include <sys/smack.h>
#else
static inline ssize_t
smack_new_label_from_self (char **label)
{
return -1;
}
static inline int
smack_set_label_for_self (const char *label)
{
return -1;
}
#endif
static inline bool
is_smack_enabled (void)
{
#ifdef HAVE_SMACK
return smack_smackfs_path () != NULL;
#else
return false;
#endif
}

View File

@@ -1,6 +1,6 @@
/* Compare integer strings.
Copyright (C) 2005-2006, 2009-2010 Free Software Foundation, Inc.
Copyright (C) 2005-2013 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@@ -1,7 +1,6 @@
/* Compare numeric strings. This is an internal include file.
Copyright (C) 1988, 1991-1993, 1995-1996, 1998-2000, 2003-2006, 2009-2010
Free Software Foundation, Inc.
Copyright (C) 1988-2013 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 +33,7 @@
- It's typically faster.
POSIX says that only '0' through '9' are digits. Prefer ISDIGIT to
isdigit unless it's important to use the locale's definition
of `digit' even when the host does not conform to POSIX. */
of 'digit' even when the host does not conform to POSIX. */
# define ISDIGIT(c) ((unsigned int) (c) - '0' <= 9)
@@ -71,7 +70,7 @@
if digit return -1, else 0
return 0 */
static inline int
static inline int _GL_ATTRIBUTE_PURE
fraccompare (char const *a, char const *b, char decimal_point)
{
if (*a == decimal_point && *b == decimal_point)
@@ -111,7 +110,7 @@ fraccompare (char const *a, char const *b, char decimal_point)
causes comparisons to act as if there is no decimal point
character, and likewise for THOUSANDS_SEP. */
static inline int
static inline int _GL_ATTRIBUTE_PURE
numcompare (char const *a, char const *b,
int decimal_point, int thousands_sep)
{

View File

@@ -1,6 +1,6 @@
/* Compare numeric strings.
Copyright (C) 2005-2006, 2009-2010 Free Software Foundation, Inc.
Copyright (C) 2005-2013 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@
/* Externally-visible name for numcompare. */
int
int _GL_ATTRIBUTE_PURE
strnumcmp (char const *a, char const *b,
int decimal_point, int thousands_sep)
{

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

@@ -0,0 +1,2 @@
int strintcmp (char const *, char const *) _GL_ATTRIBUTE_PURE;
int strnumcmp (char const *, char const *, int, int);

View File

@@ -1,8 +1,8 @@
diff --git c/lib/tempname.c i/lib/tempname.c
index 2da5afe..562955a 100644
--- c/lib/tempname.c
+++ i/lib/tempname.c
@@ -22,6 +22,7 @@
diff --git a/lib/tempname.c b/lib/tempname.c
index 26a38ce..5944ee0 100644
--- a/lib/tempname.c
+++ b/lib/tempname.c
@@ -20,6 +20,7 @@
#if !_LIBC
# include <config.h>
# include "tempname.h"
@@ -10,7 +10,7 @@ index 2da5afe..562955a 100644
#endif
#include <sys/types.h>
@@ -49,6 +50,7 @@
@@ -47,6 +48,7 @@
# error report this to bug-gnulib@gnu.org
#endif
@@ -18,11 +18,11 @@ index 2da5afe..562955a 100644
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
@@ -179,14 +181,21 @@ __path_search (char *tmpl, size_t tmpl_len, const char *dir, const char *pfx,
@@ -175,14 +177,21 @@ __path_search (char *tmpl, size_t tmpl_len, const char *dir, const char *pfx,
}
#endif /* _LIBC */
+static inline bool
+static inline bool _GL_ATTRIBUTE_PURE
+check_x_suffix (char const *s, size_t len)
+{
+ return len <= strspn (s, "X");
@@ -41,8 +41,8 @@ index 2da5afe..562955a 100644
+ this function. TMPL is overwritten with the result.
KIND may be one of:
__GT_NOCREATE: simply verify that the name does not exist
@@ -197,23 +206,24 @@ static const char letters[] =
__GT_NOCREATE: simply verify that the name does not exist
@@ -193,23 +202,24 @@ static const char letters[] =
We use a clever algorithm to get hard-to-predict names. */
int
@@ -64,7 +64,7 @@ index 2da5afe..562955a 100644
/* A lower bound on the number of temporary files to attempt to
generate. The maximum total number of temporary file names that
can exist for a given template is 62**6. It should never be
necessary to try all these combinations. Instead if a reasonable
necessary to try all of these combinations. Instead if a reasonable
number of names is tried (we define reasonable as 62**3) fail to
- give the system administrator the chance to remove the problems. */
+ give the system administrator the chance to remove the problems.
@@ -72,7 +72,7 @@ index 2da5afe..562955a 100644
#define ATTEMPTS_MIN (62 * 62 * 62)
/* The number of times to attempt to generate a temporary file. To
@@ -225,43 +235,28 @@ __gen_tempname (char *tmpl, int suffixlen, int flags, int kind)
@@ -221,43 +231,28 @@ __gen_tempname (char *tmpl, int suffixlen, int flags, int kind)
#endif
len = strlen (tmpl);
@@ -100,7 +100,7 @@ index 2da5afe..562955a 100644
- }
-#endif
- value += random_time_bits ^ __getpid ();
+ rand_src = randint_all_new (NULL, 8);
+ rand_src = randint_all_new (NULL, x_suffix_len);
+ if (! rand_src)
+ return -1;
@@ -128,7 +128,7 @@ index 2da5afe..562955a 100644
switch (kind)
{
@@ -276,7 +271,7 @@ __gen_tempname (char *tmpl, int suffixlen, int flags, int kind)
@@ -272,7 +267,7 @@ __gen_tempname (char *tmpl, int suffixlen, int flags, int kind)
break;
case __GT_NOCREATE:
@@ -137,7 +137,7 @@ index 2da5afe..562955a 100644
succeeds if __xstat fails because the name does not exist.
Note the continue to bypass the common logic at the bottom
of the loop. */
@@ -285,11 +280,15 @@ __gen_tempname (char *tmpl, int suffixlen, int flags, int kind)
@@ -281,11 +276,15 @@ __gen_tempname (char *tmpl, int suffixlen, int flags, int kind)
if (errno == ENOENT)
{
__set_errno (save_errno);
@@ -156,7 +156,7 @@ index 2da5afe..562955a 100644
}
continue;
@@ -301,13 +300,32 @@ __gen_tempname (char *tmpl, int suffixlen, int flags, int kind)
@@ -297,13 +296,32 @@ __gen_tempname (char *tmpl, int suffixlen, int flags, int kind)
if (fd >= 0)
{
__set_errno (save_errno);

View File

@@ -1,7 +1,7 @@
diff --git c/lib/tempname.h i/lib/tempname.h
index cd69e7d..9757db2 100644
--- c/lib/tempname.h
+++ i/lib/tempname.h
diff --git a/lib/tempname.h b/lib/tempname.h
index 7972562..7ced9a9 100644
--- a/lib/tempname.h
+++ b/lib/tempname.h
@@ -46,5 +46,7 @@
We use a clever algorithm to get hard-to-predict names. */

View File

@@ -1,6 +1,6 @@
/* xfts.c -- a wrapper for fts_open
Copyright (C) 2003, 2005-2007, 2009-2010 Free Software Foundation, Inc.
Copyright (C) 2003-2013 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@@ -6,4 +6,5 @@ xfts_open (char * const *, int options,
int (*) (const FTSENT **, const FTSENT **));
bool
cycle_warning_required (FTS const *fts, FTSENT const *ent);
cycle_warning_required (FTS const *fts, FTSENT const *ent)
_GL_ATTRIBUTE_PURE;

View File

@@ -1,14 +0,0 @@
#serial 3
dnl Copyright (C) 2005-2006, 2009-2010 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_ROOT_DEV_INO],
[
AC_LIBOBJ([root-dev-ino])
dnl Prerequisites
AC_REQUIRE([AC_FUNC_LSTAT])
:
])

23
gl/modules/buffer-lcm Normal file
View File

@@ -0,0 +1,23 @@
Description:
Compute a good buffer size for dealing with two files.
Files:
lib/buffer-lcm.c
lib/buffer-lcm.h
Depends-on:
stddef
configure.ac:
Makefile.am:
lib_SOURCES += buffer-lcm.c buffer-lcm.h
Include:
"buffer-lcm.h"
License:
GPL
Maintainer:
Paul Eggert

View File

@@ -1,24 +0,0 @@
Description:
manipulate sets of device-inode pairs efficiently
Files:
lib/di-set.c
lib/di-set.h
Depends-on:
ino-map
hash
configure.ac:
Makefile.am:
lib_SOURCES += di-set.c di-set.h
Include:
"di-set.h"
License
GPL
Maintainer:
Jim Meyering

View File

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

23
gl/modules/fd-reopen Normal file
View File

@@ -0,0 +1,23 @@
Description:
Open a file to a particular file descriptor.
Files:
lib/fd-reopen.c
lib/fd-reopen.h
Depends-on:
fcntl-h
configure.ac:
Makefile.am:
lib_SOURCES += fd-reopen.c fd-reopen.h
Include:
"fd-reopen.h"
License:
GPL
Maintainer:
Paul Eggert

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