Paul Eggert [Fri, 9 Jul 2010 18:11:05 +0000 (11:11 -0700)]
chcon, chmod, chown, du: don't translate "%s"
* src/chcon.c (process_file): Replace _("%s") with "%s".
* src/chmod.c (process_file): Likewise.
* src/chown-core.c (change_file_owner): Likewise.
* src/du.c (process_file): Likewise.
Paul Eggert [Tue, 6 Jul 2010 23:16:20 +0000 (16:16 -0700)]
du: avoid spurious warnings with 64-bit gcc -W
Problem reported by Jim Meyering in:
http://debbugs.gnu.org/cgi/bugreport.cgi?bug=6524#74
* gl/lib/di-set.c (di_ent_hash): Rework so that the compiler does
not incorrectly warn about shifting by 64-bits in unreachable code.
* gl/lib/ino-map.c (ino_hash): Likewise.
Paul Eggert [Tue, 6 Jul 2010 21:53:14 +0000 (14:53 -0700)]
du: Hash with a mechanism that's simpler and takes less memory.
* gl/lib/dev-map.c, gl/lib/dev-map.h, gl/modules/dev-map: Remove.
* gl/lib/ino-map.c, gl/lib/ino-map.h, gl/modules/ino-map: New files.
* gl/modules/dev-map-tests, gl/tests/test-dev-map.c: Remove.
* gl/modules/ino-map-tests, gl/tests/test-ino-map.c: New files.
* gl/lib/di-set.h (struct di_set): Renamed from struct di_set_state,
and now private. All uses changed.
(_ATTRIBUTE_NONNULL_): Don't assume C99.
(di_set_alloc): Renamed from di_set_init, with no size arg.
Now allocates the object rather than initializing it.
For now, this no longer takes an initial size; we can put this
back later if it is needed.
* gl/lib/di-set.c: Include hash.h, ino-map.h, and limits.h instead of
stdio.h, assert.h, stdint.h, sys/types.h (di-set.h includes that
now), sys/stat.h, and verify.h.
(N_DEV_BITS_4, N_INO_BITS_4, N_DEV_BITS_8, N_INO_BITS_8): Remove.
(struct dev_ino_4, struct dev_ino_8, struct dev_ino_full): Remove.
(enum di_mode): Remove.
(hashint): New typedef.
(HASHINT_MAX, LARGE_INO_MIN): New macros.
(struct di_ent): Now maps a dev_t to a inode set, instead of
containing a union.
(struct dev_map_ent): Remove.
(struct di_set): New type.
(is_encoded_ptr, decode_ptr, di_ent_create): Remove.
(di_ent_hash, di_ent_compare, di_ent_free, di_set_alloc, di_set_free):
(di_set_insert): Adjust to new representation.
(di_ino_hash, map_device, map_inode_number): New functions.
* gl/modules/di-set (Depends-on): Replace dev-map with ino-map.
Remove 'verify'.
* gl/tests/test-di-set.c: Adjust to the above changes to API.
* src/du.c (INITIAL_DI_SET_SIZE): Remove.
(hash_ins, main): Adjust to new di-set API.
Jim Meyering [Mon, 5 Jul 2010 15:18:29 +0000 (17:18 +0200)]
stat: getfilecon failure now evokes nonzero exit status
Add comments and adjust interfaces to allow low-level failure
to propagate out to callers.
* src/stat.c (out_file_context): Return bool, not void,
so we can tell callers about failure.
(print_statfs, print_stat, print_it): Propagate failure to caller.
(do_statfs): Propagate print_it failure to caller.
(do_stat): Likewise.
I nearly forgot to update do_stat to propagate print_it failure,
and it compiled just fine in spite of that. To prevent possibility
of a repeat, I've marked each function that returns non-void with
ATTRIBUTE_WARN_UNUSED_RESULT.
Jim Meyering [Mon, 5 Jul 2010 15:16:23 +0000 (17:16 +0200)]
system.h: define ATTRIBUTE_WARN_UNUSED_RESULT
* src/system.h (ATTRIBUTE_WARN_UNUSED_RESULT): Define.
Pádraig Brady [Mon, 5 Jul 2010 07:53:10 +0000 (08:53 +0100)]
tests: make tests requiring a delay to pass, more robust
* tests/init.cfg: Introduce a retry_delay_() function to
repeatedly call a test function that requires a delay.
This delay can now be shorter for the common case on fast
systems, but will double until a configurable limit it reached
before failing on slower systems.
* tests/dd/reblock: Use retry_delay_.
* tests/misc/cat-buf: Likewise.
* tests/misc/stdbuf: Likewise.
* tests/tail-2/F-vs-rename: Likewise.
* tests/tail-2/flush-initial: Likewise.
* tests/tail-2/tail-n0f: Likewise.
* tests/tail-2/wait: Likewise.
* test/dd/misc: Comment that delay is needed to trigger failure.
Paul Eggert [Sun, 4 Jul 2010 22:40:49 +0000 (15:40 -0700)]
doc: Add advice about ChangeLogs and synchronizing submodules
* README-hacking: Update accordingly.
Jim Meyering [Fri, 4 Jun 2010 13:30:47 +0000 (15:30 +0200)]
du: increase the initial dev-inode set size
* src/du.c (INITIAL_DI_SET_SIZE): Increase to the prime just under
1024. This gives a speed-up of about 2% when processing a tree
containing 100,000 files, each with a link count greater than 1,
all pointing to files in some other tree.
Jim Meyering [Tue, 9 Dec 2008 07:49:41 +0000 (08:49 +0100)]
du: use less than half as much memory when tracking hard links
When processing a hard-linked file, du must keep track of the file's
device and inode numbers in order to avoid counting its storage
more than once. When du would process many hard linked files --
as are created by some backup tools -- the amount of memory required
for the supporting data structure could become prohibitively large.
This patch takes advantage of the fact that the amount of information
in the numbers of the typical dev,inode pair is far less than even
32 bits, and hence usually fits in the space of a pointer, be it
32 or 64 bits wide. A typical du traversal examines files on no
more than a handful of distinct devices, so the device number can
be encoded in just a few bits. Similarly, few inode numbers use
all of the high bits in an ino_t. Before, we would represent the
dev,inode pair using a naive struct, and allocate space for each.
Thus, an entry in the hash table consisted of a pointer (to that
struct) and a "next" pointer. With this change, we encode the
dev,inode information and put those bits in place of the pointer,
and thus do away with the need to allocate additional space for
each dev,inode pair.
* src/du.c: Include "di-set.h".
Don't include "hash.h"; it's no longer used.
(INITIAL_DI_SET_SIZE): Define.
(di_set): New global, to replace "htab".
(entry_hash, entry_compare, hash_init): Remove functions.
(hash_ins): Use di-set functions, rather than ones from the hash module.
(main): Likewise.
* bootstrap.conf (gnulib_modules): Add the new di-set module.
* NEWS (New features): Mention it.
Jim Meyering [Sun, 27 Jun 2010 21:29:07 +0000 (23:29 +0200)]
di-set: manipulate sets of dev/inode pairs efficiently
* gl/lib/di-set.c: Implementation.
* gl/lib/di-set.h: Declarations.
* gl/modules/di-set: Define module.
* gl/modules/di-set-tests: Define test module.
* gl/tests/test-di-set.c: Likewise.
Jim Meyering [Sun, 27 Jun 2010 21:26:46 +0000 (23:26 +0200)]
dev-map: map device number to small non-negative
* gl/lib/dev-map.c: New file.
* gl/lib/dev-map.h: Declarations.
* gl/modules/dev-map: Define primary modules.
* gl/modules/dev-map-tests: Define test module.
* gl/tests/test-dev-map.c: Test it.
Paul Eggert [Sat, 3 Jul 2010 06:41:08 +0000 (23:41 -0700)]
du: don't miscount duplicate directories or link-count-1 files
* NEWS: Mention this.
* src/du.c (hash_all): New static var.
(process_file): Use it.
(main): Set it.
* tests/du/hard-link: Add a couple of test cases to help make
sure this bug stays squashed.
* tests/du/files0-from: Adjust existing tests to reflect
change in semantics with duplicate arguments.
Jim Meyering [Thu, 1 Jul 2010 21:43:55 +0000 (23:43 +0200)]
build: update gnulib submodule to latest; update bootstrap, too
* gnulib: Update to latest, for hash.c improvement.
* bootstrap: Update from gnulib, too.
Pádraig Brady [Mon, 21 Sep 2009 07:43:03 +0000 (08:43 +0100)]
cp: add an option to only copy the file attributes
* src/copy.c (copy_attr): A new function which merges copy_attr_by_fd
and copy_attr_by_name. Also display all errors when --attributes-only
* src/copy.c (copy_reg): Skip copying the file contents if specified.
Refactor the SELinux error handling code a little and display all
SELinux errors when only copying attributes.
* src/copy.h (struct cp_options): Add a data_copy_required boolean
* src/cp.c (main): Default to copying data but don't if specified
* src/install.c: Default to copying data
* src/mv.c: Likewise
tests/cp/reflink-perm: Add a test to check that --attributes-only
does not copy data
* tests/cp/acl: Likewise. Also refactor to remove redundant
acl manipulation
* doc/coreutils.texi (cp invocation): Describe the new option
* NEWS: Mention the new feature
Pádraig Brady [Mon, 28 Sep 2009 16:32:15 +0000 (17:32 +0100)]
ls: use the POSIX date style when the locale does not specify one
Previously we defaulted to "long-iso" format in locales without
specific format translations, like the en_* locales for example.
This reverts part of commit
6837183d, 08-11-2005, "ls ... acts like
--time-style='posix-long-iso' if the locale settings are messed up"
* src/ls.c (decode_switches): Only use the ISO format when specified.
* NEWS: Mention the change in behavior.
Reported by Daniel Qarras at http://bugzilla.redhat.com/525134
Jim Meyering [Wed, 30 Jun 2010 15:10:07 +0000 (17:10 +0200)]
tests: fail rather than infloop in tail's inotify-rotate test
* tests/tail-2/inotify-rotate: Switch to new init.sh-based framework.
(grep_timeout): New function.
Use it in place of open-coded loops that might infloop.
This was prompted by my encountering an inexplicable, and so far
unreproducible, infloop in the code that was waiting for "b" to
appear in "out".
Jim Meyering [Wed, 30 Jun 2010 15:06:53 +0000 (17:06 +0200)]
tests: move most helper functions from test-lib.sh to new init.cfg
From there, they will be used by both test-lib.sh (as we phase it out)
and the newer init.sh, to which all tests will migrate.
* tests/test-lib.sh: Move most functions from here, ...
* tests/init.cfg: ...to here. New file.
* tests/Makefile.am (EXTRA_DIST): Add init.cfg.
Jim Meyering [Wed, 30 Jun 2010 12:34:23 +0000 (14:34 +0200)]
tests: sync tests/init.sh from gnulib
* tests/init.sh: Update from gnulib.
Jim Meyering [Mon, 28 Jun 2010 11:48:38 +0000 (13:48 +0200)]
doc: df, du, ls: improve --blocksize description in --help
* src/du.c (usage): Print better --blocksize description.
Prompted by Samuel Thibault in <http://bugs.debian.org/353100>.
* src/df.c (usage): Likewise.
* src/ls.c (usage): Likewise.
Pádraig Brady [Tue, 29 Jun 2010 00:20:23 +0000 (01:20 +0100)]
doc: reference POS syntax in --help for sort --key
* src/sort.c (usage): Reference the additional description
of the POS syntax.
Benno Schulenberg [Sat, 26 Jun 2010 10:00:42 +0000 (12:00 +0200)]
ln: print a clearer error message when linking fails
Jim Meyering [Tue, 22 Jun 2010 09:41:22 +0000 (11:41 +0200)]
stat: remove support for deprecated --context (-Z) option
* src/stat.c (main): Remove support for the --context (-Z) option.
In upstream releases this option has always been a no-op. It was
first ignored for compatibility, and since the June 2008 commit,
574f7614 (coreutils-7.0), its use has evoked a warning.
* NEWS (Changes in behavior): Mention it.
Jim Meyering [Mon, 21 Jun 2010 06:55:22 +0000 (08:55 +0200)]
doc: fix comm's --help output so we generate a better man page
* src/comm.c (usage): Don't align example comments in --help output,
since the extra space (sequence of two spaces) there would be
interpreted by help2man and induce an unwanted line break
in the resulting man page. Reported by Jari Aalto.
Eric Blake [Mon, 14 Jun 2010 21:49:46 +0000 (15:49 -0600)]
maint: ignore another gnulib generated file
* .gnulib: Exclude lib/c++defs.h.
Eric Blake [Wed, 9 Jun 2010 17:13:13 +0000 (11:13 -0600)]
cat: improve documentation
* src/cat.c (usage): Clarify that -b overrides -n.
* doc/coreutils.texi (cat invocation): Likewise.
* THANKS: Update.
Suggested by Chas. Owens, in bug 6383.
Jim Meyering [Mon, 14 Jun 2010 08:15:57 +0000 (10:15 +0200)]
doc: dd: discourage use of very large block sizes
* doc/coreutils.texi (dd invocation): Warn against using a very large
block size. Suggested by Imre Péntek.
Jim Meyering [Sun, 13 Jun 2010 15:34:45 +0000 (17:34 +0200)]
dd: print a better diagnostic for an invalid block size
* src/dd.c (dd_copy): Give a better diagnostic than
"dd: memory exhausted" for an over-large bs= block size setting.
Same for ibs= and obs=. Reported by Imre Péntek in
http://bugs.launchpad.net/ubuntu/+source/coreutils/+bug/591969
Jim Meyering [Fri, 11 Jun 2010 09:32:31 +0000 (11:32 +0200)]
build: update gnulib submodule to latest
Jim Meyering [Thu, 10 Jun 2010 21:33:17 +0000 (23:33 +0200)]
build: don't let a large sparse temporary file cause "make dist" to fail
* bootstrap.conf (bootstrap_epilogue): Replace the offending grep
command from po/Makefile.in.in's $(DOMAIN).pot-update rule.
Jim Meyering [Thu, 10 Jun 2010 15:49:30 +0000 (17:49 +0200)]
ls: avoid just-introduced buffer overrun
* src/ls.c (gobble_file): Revert part of my preceding change,
to avoid clobbering stack.
Jim Meyering [Mon, 7 Jun 2010 05:15:15 +0000 (07:15 +0200)]
maint: adjust INT_BUFSIZE_BOUND usage for maintainability
* src/tail.c (xlseek): Give INT_BUFSIZE_BOUND a variable name,
not a type name.
* src/ls.c (gobble_file, format_user_or_group_width): Likewise.
* src/head.c (elide_tail_bytes_pipe): Likewise.
(elide_tail_lines_seekable, main): Likewise.
[This change is not complete -- there are doubtless other uses
that can be updated in the same way.]
Jim Meyering [Sun, 6 Jun 2010 16:51:42 +0000 (18:51 +0200)]
sort: avoid unnecessary use of sprintf
sprintf is relatively heavy-weight.
* src/sort.c (key_warnings): Use umaxtostr and stpcpy rather
than sprintf.
Also, replace each INT_BUFSIZE_BOUND "type_name" argument
with the equivalent variable name. More maintainable that way.
Eric Blake [Mon, 7 Jun 2010 15:42:09 +0000 (09:42 -0600)]
dirname: tweak summary wording
* doc/coreutils.texi (dirname invocation): Reword to be more
precise.
* src/dirname.c (usage): Likewise.
* THANKS: Update.
Reported by Filipus Klutiero, bug 6175.
Jim Meyering [Wed, 2 Jun 2010 15:41:52 +0000 (17:41 +0200)]
doc: mention the new coreutils@ mailing lists
* README-package-renamed-to-coreutils: Mention the new mailing list
and a mirror.
Jim Meyering [Wed, 2 Jun 2010 14:23:41 +0000 (16:23 +0200)]
touch: remove support for --file=REF_FILE option
* src/touch.c (main): Remove support for the deprecated, long-named
--file option, which is an alternate name for --reference (-r).
That option was undocumented with the arrival of --reference, in
the 1995-10-29 commit,
8b92864e1d. Since the 2009-02-09 commit,
ed85df444a, use of --file has elicited a warning. Not only was
this code due for removal, but the long-name-use-detecting code
was buggy in that it would use a stale or uninitialized "long_idx",
as reported by Robin H. Johnson in http://bugs.gentoo.org/322421.
* NEWS (Changes in behavior): Mention it.
Jim Meyering [Sat, 15 May 2010 17:36:56 +0000 (19:36 +0200)]
maint: make spacing around "=" consistent, even in IF_LINT
E.g.,
- size_t desired_width IF_LINT (= 0);
+ size_t desired_width IF_LINT ( = 0);
Use this command:
g grep -l IF_LINT | grep '\.[ch]$' \
| xargs perl -pi -e 's/(IF_LINT \()= /$1 = /'
Jim Meyering [Sat, 1 May 2010 12:24:35 +0000 (14:24 +0200)]
maint: replace each "for (;;)" with "while (true)"
Run this command:
git ls-files | grep '\.[ch]$' \
| xargs perl -pi -e 's/for \(;;\)/while (true)/g'
...except for randint.c, which does not include stdbool.h.
In that case, use "while (1)".
* gl/lib/randint.c (randint_genmax): Use "while (1)" for infloops.
* src/cat.c (simple_cat, cat): Use "while (true)" for infloops.
* gl/lib/randread.c (readsource, readisaac): Likewise.
* src/copy.c (copy_reg): Likewise.
* src/csplit.c (record_line_starts, process_regexp): Likewise.
* src/cut.c (set_fields): Likewise.
* src/dd.c (iread, parse_symbols): Likewise.
* src/df.c (find_mount_point, main): Likewise.
* src/du.c (main): Likewise.
* src/expand.c (expand): Likewise.
* src/factor.c (factor_using_division, do_stdin): Likewise.
* src/fmt.c (get_space): Likewise.
* src/ls.c (decode_switches): Likewise.
* src/od.c (main): Likewise.
* src/pr.c (main, read_line): Likewise.
* src/shred.c (dopass, genpattern): Likewise.
* src/sort.c (initbuf, fillbuf, getmonth, keycompare): Likewise.
* src/split.c (bytes_split, lines_split): Likewise.
* src/tac.c (tac_seekable): Likewise.
* src/test.c (and, or): Likewise.
* src/tr.c (squeeze_filter, main): Likewise.
* src/tsort.c (search_item): Likewise.
* src/unexpand.c (unexpand): Likewise.
* src/uniq.c (main): Likewise.
* src/yes.c (main): Likewise.
Jim Meyering [Sat, 1 May 2010 11:53:46 +0000 (13:53 +0200)]
maint: correct indentation of case_GETOPT_* macro uses
* src/base64.c (main): Correct indentation of syntactically
questionable case_GETOPT_HELP_CHAR and case_GETOPT_VERSION_CHAR macros.
* src/who.c (main): Likewise.
Jim Meyering [Sat, 1 May 2010 09:29:39 +0000 (11:29 +0200)]
stat: use gnulib's alignof module
* src/stat.c (alignof): Remove definition.
Instead, include "alignof.h", and sort the #include directives.
And get its definition from the gnulib module by that name:
* bootstrap.conf (gnulib_modules): Add alignof.
Jim Meyering [Sat, 15 May 2010 15:58:52 +0000 (17:58 +0200)]
tests: remove unnecessary single quotes in perl hash use: ->{'SYM'}
Run this command:
git grep -l "limits->{'" \
| xargs perl -pi -e "s/limits->{'(.*?)'}/limits->{\$1}/g"
* cfg.mk (sc_prohibit_perl_hash_quotes): New rule to match.
* tests/misc/join: Remove quotes.
* tests/misc/sort: Likewise.
* tests/misc/sort-merge: Likewise.
* tests/misc/test: Likewise.
* tests/misc/unexpand: Likewise.
* tests/misc/uniq: Likewise.
Pádraig Brady [Fri, 28 May 2010 18:25:23 +0000 (19:25 +0100)]
truncate: improve handling of non regular files
Previously we copied `dd` and suppressed error messages
when truncating neither regular files or shared mem objects.
This was valid for `dd`, as truncation is ancillary to copying
it may also do, but for `truncate` we should display all errors.
Also we used the st_size from non regular files which is undefined,
so we display an error when the user tries this.
* src/truncate (do_truncate): Error when referencing the size
of non regular files or non shared memory objects. Display all
errors returned by ftruncate().
(main): Error when referencing the size of non regular files or
non shared memory objects. Don't suppress error messages for
any file types that can't be opened for writing.
* tests/misc/truncate-dir-fail: Check that referencing the
size of a directory is not supported.
* tests/misc/truncate-fifo: Ensure the test doesn't hang
by using the `timeout` command. Don't test the return from
running ftruncate on the fifo as it's system dependent as
to whether this fails or not.
NEWS: Mention the change in behavior.
Reported by Jim Meyering.
Pádraig Brady [Wed, 26 May 2010 08:27:53 +0000 (09:27 +0100)]
truncate: support sizes relative to an existing file
* doc/coreutils.texi (truncate invocation): Mention that --reference
bases the --size rather than just setting it.
* src/truncate.c (usage): Likewise. Also remove the clause
describing --size and --reference as being mutually exclusive.
(do_truncate): Add an extra parameter to hold the size
of a referenced file, and use it if positive.
(main): Pass the size of a referenced file to do_truncate().
* tests/misc/truncate-parameters: Adjust for the new combinations.
* NEWS: Mention the change
Suggested by Richard W.M. Jones
Jim Meyering [Wed, 26 May 2010 09:33:53 +0000 (11:33 +0200)]
tests: update help-version to work with parted, too
* tests/misc/help-version: Add init code for GNU Parted.
Jim Meyering [Tue, 25 May 2010 16:05:29 +0000 (18:05 +0200)]
maint: don't emit an extra newline in each of two diagnostics
* src/shuf.c (main): Remove a stray newline in a diagnostic.
* src/od.c (main): Likewise.
Detected via these:
git grep -A1 'error *(.*,$' | grep -C1 '\\n"[,)]'
git grep 'error *(.*;$' | grep '\\n"[,)]'
Jim Meyering [Tue, 25 May 2010 10:32:03 +0000 (12:32 +0200)]
maint: remove unneeded double quotes on RHS of shell assignments
Run this command:
git grep -l 'LC_[A-Z]*="' \
| xargs perl -pi -e 's/(LC_[A-Z]*)="(.*?)"/$1=$2/'
* src/Makefile.am: Write LC_ALL=$$locale, not LC_ALL="$$locale".
* src/date.c (main): Similar, in a comment.
* tests/misc/sort-month: Write LC_ALL=$LOC, not LC_ALL="$LOC".
Pádraig Brady [Mon, 24 May 2010 12:00:35 +0000 (13:00 +0100)]
maint: remove a redundant sort parameter from a test
* tests/misc/sort-month: Remove the -b option which
is redundant and ignored.
Pádraig Brady [Sat, 22 May 2010 13:19:50 +0000 (14:19 +0100)]
sort: adjust the leading blanks --debug warning
* src/sort.c (key_warnings): Always warn about significant leading
blanks when character offsets are specified, unless they key is
possibly a line offset, i.e. of the form -k1.x,1.y. Also suppress
this warning if the user could be sorting right aligned indexes.
Jim Meyering [Sun, 23 May 2010 16:10:28 +0000 (18:10 +0200)]
maint: make copyright comment consistent with all others
* tests/misc/mktemp: Change punctuation to make copyright
paragraph consistent with all of the others.
Jim Meyering [Fri, 21 May 2010 12:55:36 +0000 (14:55 +0200)]
tests: fix cp-a-selinux to skip cleanly upon mkfs failure
* tests/cp/cp-a-selinux: Initialize skip, to avoid a syntax error
in subsequent "test".
Remove redirect-to-/dev/null, now that output is always to a log file.
Jon Ringuette [Tue, 18 May 2010 06:26:11 +0000 (08:26 +0200)]
du: recognize -d N as equivalent to --max-depth=N
* NEWS (New features): Mention it.
* src/du.c (DEBUG_OPT): Remove. Use long-named ---debug instead.
Commented out.
(MAX_DEPTH_OPTION): Remove. Use 'd' instead.
(main): Insert literal "d:"; remove DEBUG_OPT.
* doc/coreutils.texi (du invocation): Add -d to indices.
* tests/du/max-depth: Exercise -d, too.
Jim Meyering [Tue, 18 May 2010 06:39:40 +0000 (08:39 +0200)]
tests: exercise du's --max-depth option
* tests/Makefile.am (TESTS): Add du/max-depth.
* tests/du/max-depth: New file.
Pádraig Brady [Tue, 18 May 2010 22:42:36 +0000 (23:42 +0100)]
tests: fix sort-debug-keys when fr_FR.utf8 not available
* tests/misc/sort-debug-keys: Correctly check for the absence
of the French UTF8 locale.
Jim Meyering [Mon, 17 May 2010 14:10:24 +0000 (16:10 +0200)]
maint: fix the fs-magic-compare rule
* src/Makefile.am (fs-def): Sort definitions.
This is required by fs-magic-compare's use of join.
Jim Meyering [Mon, 17 May 2010 07:12:22 +0000 (09:12 +0200)]
tests: update init.sh from gnulib
* tests/init.sh: Update from gnulib.
Jim Meyering [Mon, 17 May 2010 07:09:28 +0000 (09:09 +0200)]
build: avoid a new -Wformat-induced warning
* src/sort.c (mark_key): Add a cast-to-int of a printf field width,
to placate -Wformat.
Pádraig Brady [Sun, 16 May 2010 00:14:51 +0000 (01:14 +0100)]
doc: fix sort info about version sort skipping blanks
* doc/coreutils.text (sort invocation): leading blanks are
significant for 'V'.
Pádraig Brady [Tue, 11 May 2010 17:46:21 +0000 (18:46 +0100)]
sort: --debug: output data independent warnings and info
* src/sort.c (usage): Mention --debug can output warnings to stderr.
Also split the translatable string to aid translation.
(default_key_compare): A new function refactored from main(),
and now also called from the new key_warnings() function.
(key_to_opts): A new function refactored from incompatible_options(),
and now also called from the new key_warnings() function.
(key_numeric): A new function refactored to test if key is numeric.
(key_warnings): A new function to output warnings to stderr,
about questionable use of various options. Currently it warns
about zero length keys and ineffective global options.
(incompatible_options): Refactor out key_to_opts()
(main): Use key_init() to initialize gkey. Refactor out
default_key_compare(). Call key_warnings() in debug mode.
* doc/coreutils.texi (sort invocation): Mention that warnings
are output by --debug.
* tests/misc/sort-debug-warn: A new test for debug warnings.
* tests/Makefile.am: Reference the new test.
* NEWS: Mention the new feature
Pádraig Brady [Wed, 12 May 2010 13:47:30 +0000 (14:47 +0100)]
tests: fix sort-debug-keys when fr_FR.utf8 not available
* tests/misc/sort-debug-keys: Don't verify (or even run)
the fr_FR tests when that locale is not available on the system.
Pádraig Brady [Tue, 23 Feb 2010 08:43:04 +0000 (08:43 +0000)]
sort: add a --debug option to highlight key extents
* src/sort (usage): Add description for --debug.
(write_bytes): Pass a line structure so it can subsequently
be passed to compare to highlight the keys when in debug mode.
Also transform TAB and NUL characters written to stdout so
that the highlighting in debug mode aligns correctly.
(human_numcompare): Pass an "endptr" so we can record the extent
of the number matched.
(general_numcompare): Likewise.
(find_unit_order): Likewise.
(getmonth): Likewise.
(numcompare): Likewise. Note we reuse find_unit_order() for this,
which is a good enough approximation, and means we don't need to
change the strnumcmp() interface.
(check_mixed_SI_IEC): Return whether iec_present, so that can be
used to set the "endptr" in find_unit_order. Also make the key
parameter optional, which will be the case from numcompare().
(count_tabs): A new function to determine how much to adjust
the mbswidth() values by (TABs don't have a width).
(mark_key): A new function to output the key highlighting to stdout.
(debug_key): A new function to determine the offset and width
of the key highlighting.
(key_compare): Pass the show_debug parameter so the key highlighting
is only displayed when explicitly called. For each key type, set
the length (lena) and whether leading blanks are auto skipped (skipb)
which are then used by debug_key() to highlight the portion of the
key used in the comparison.
(compare): Pass the show_debug parameter so the key highlighting
is only displayed when explicitly called. Call debug_key() to
highlight the last resort comparison.
(check): Output highlighting for disorder line to stdout.
(main): Process the --debug option and make it mutually exlusive
with the -o option as I don't see it useful there, even potentially
harmful if someone left a --debug in by mistake when updating a file.
Also restricting debug output to stdout, simplifies the logic
for dealing with temporary files.
* doc/coreutils.texi (sort invocation): Describe the --debug option,
and reference it from the --key description.
* tests/misc/sort-debug-keys: A new test for highlighting keys.
* tests/Makefile.am: Reference the new test.
* NEWS: Mention the new feature.
Jim Meyering [Tue, 11 May 2010 08:31:21 +0000 (10:31 +0200)]
build: record the gettext-0.18 requirement also in configure.ac
* configure.ac: Require gettext-0.18 here, too.
Jim Meyering [Tue, 11 May 2010 07:50:29 +0000 (09:50 +0200)]
build: update gnulib submodule to latest
* tests/init.sh: Update from gnulib, to fix typo.
Jim Meyering [Mon, 10 May 2010 10:39:37 +0000 (12:39 +0200)]
build: record that when building from git, gettext-0.18 is required
* bootstrap.conf (buildreq): Require gettext-0.18.
Jim Meyering [Mon, 10 May 2010 09:47:00 +0000 (11:47 +0200)]
tests: avoid a new syntax-check failure
* .x-sc_prohibit_fail_0: Exempt tests/init.sh.
Jim Meyering [Mon, 10 May 2010 09:06:37 +0000 (11:06 +0200)]
tests: provide a definition of gl_trap_ in cfg.mk
* cfg.mk (gl_trap_): Define here, now that it's gone from maint.mk.
* gnulib: Update to latest.
Jim Meyering [Mon, 10 May 2010 09:29:27 +0000 (11:29 +0200)]
tests: begin using init.sh
* tests/init.sh: New file.
* tests/Makefile.am (EXTRA_DIST): Add it here.
Jim Meyering [Sun, 9 May 2010 19:22:21 +0000 (21:22 +0200)]
tests: update help-version
* tests/misc/help-version: Use init.sh, rather than test-lib.sh.
Add idutils' setup.
Jim Meyering [Sun, 9 May 2010 16:52:36 +0000 (18:52 +0200)]
tests: move sc_prohibit_always-defined_macros to gnulib's maint.mk
* cfg.mk (sc_prohibit_always-defined_macros): Remove it from here.
* gnulib: Update to latest, for a maint.mk that includes that rule.
Jim Meyering [Sun, 9 May 2010 16:47:34 +0000 (18:47 +0200)]
tests: rename a syntax-check
* cfg.mk (sc_prohibit_always-defined_macros): Rename from
sc_always_defined_macros.
* .x-sc_prohibit_always-defined_macros: New file, renamed from...
* .x-sc_always_defined_macros: ...removed.
* Makefile.am (syntax_check_exceptions): Rename here, too.
Jim Meyering [Sun, 9 May 2010 16:29:22 +0000 (18:29 +0200)]
tests: loosen/tighten the always_defined_macros check
* cfg.mk (.re-defmac): Generate better regexps: allow white space
before the '#', and append a word-boundary requirement.
Without the latter, #define NULL_DEV ... would evoke a false-positive.
Jim Meyering [Sun, 9 May 2010 10:08:21 +0000 (12:08 +0200)]
tests: improve the always_defined_macros check
* cfg.mk (sc_always_defined_macros): Adjust its helpers not to depend
on the existence of ./lib. Instead, extract symbols directly from
gnulib/lib/*.in.h files.
Jim Meyering [Mon, 3 May 2010 20:00:30 +0000 (22:00 +0200)]
doc: factor hard-coded project-specific bits from README-release, ...
using the new --mail-headers option to gnulib's announce-gen, and
the updated maint.mk rules to connect the pieces.
* README-release: Remove hard-coded To:, Cc: etc. parts, now
that they're emitted automatically into the announcement template.
* cfg.mk (announcement_Cc_): Override the default.
* gnulib: Update to latest, to get newer announce-gen and maint.mk.
Jim Meyering [Mon, 3 May 2010 18:37:13 +0000 (20:37 +0200)]
doc: update release procedure
* README-release: Rearrange slightly: post the announcement to
Savannah first, so you can include a link to that post in the email.
Jim Meyering [Mon, 3 May 2010 13:35:56 +0000 (15:35 +0200)]
maint: factor trap-related code out of two syntax-check rules
* cfg.mk (gl_trap_): Define, using a loop and eval'd trap,
rather than repeated "trap" uses. Also handle "13", SIGPIPE.
(sc_always_defined_macros): Use it.
(sc_system_h_headers): Likewise.
Jim Meyering [Mon, 3 May 2010 10:05:14 +0000 (12:05 +0200)]
maint: extend the always_defined_macros syntax-check
* cfg.mk (gl_generated_headers_): Define.
(headers_with_interesting_macro_defs): Remove headers covered
by the above.
(.re-defmac): Extract symbol names from many more files.
(sc_always_defined_macros): Use VC_LIST_EXCEPT, not VC_LIST, so
that we can use the usual exception mechanism.
Test for $(gnulib_dir), not system.h.
* .x-sc_always_defined_macros: New file. Exempt src/seq.c.
* Makefile.am (syntax_check_exceptions): Add it here.
Jim Meyering [Mon, 3 May 2010 08:50:23 +0000 (10:50 +0200)]
maint: remove now-redundant definitions provided by signal.h
* src/dd.c (SA_NODEFER, SA_RESETHAND): Remove definitions,
now that gnulib guarantees they are defined in <signal.h>.
* src/ls.c (SA_RESTART): Likewise.
Jim Meyering [Mon, 3 May 2010 08:45:47 +0000 (10:45 +0200)]
maint: remove now-redundant definitions provided by sys/wait.h
* src/timeout.c (WIFSIGNALED, WTERMSIG): Remove definitions,
now that gnulib guarantees they are defined in <sys/wait.h>.
* src/operand2sig.c: Likewise.
* src/kill.c: Likewise.
Paul Eggert [Fri, 30 Apr 2010 22:23:38 +0000 (23:23 +0100)]
sort: use long doubles only when effective
* src/sort.c (general_numcompare): Don't use long double if strtold
is not available, as it may introduce needless overhead.
Jim Meyering [Fri, 30 Apr 2010 16:27:19 +0000 (18:27 +0200)]
build: update gnulib submodule to latest; bootstrap, too
Pádraig Brady [Wed, 28 Apr 2010 22:54:33 +0000 (23:54 +0100)]
sort: use long doubles for general numeric mode
* src/sort.c (general_numcompare): Use long doubles unconditionally,
and strtold when available, to convert numbers with greater range and
precision. Performance was seen to be on par with standard doubles.
* doc/coreutils.texi (sort invocation): Amend the -g description to
mention long double rather than double, and strtold rather than strtod.
* src/getlimits.c (main): Output floating point limits for use in tests.
* tests/misc/sort-float: A new test to ensure sort is using long
doubles when possible, and that locale specific floats are handled.
* tests/Makefile.am: Reference the new test.
* tests/test-lib.sh (getlimits_): Normalize indenting.
* NEWS: Mention the new behaviour.
Reported by Nelson Beebe.
Jim Meyering [Thu, 29 Apr 2010 10:03:41 +0000 (12:03 +0200)]
build: remove now-duplicate use of AC_SYS_LARGEFILE
* m4/jm-macros.m4 (gl_CHECK_ALL_TYPES): Don't require AC_SYS_LARGEFILE,
now that gnulib does it.
Jim Meyering [Thu, 29 Apr 2010 09:32:37 +0000 (11:32 +0200)]
build: remove now-useless configure-time header checks
* m4/jm-macros.m4 (gl_CHECK_ALL_HEADERS): Don't test for headers
that gnulib now provides: sys/ioctl.h, sys/time.h, sys/wait.h.
Jim Meyering [Sun, 25 Apr 2010 08:35:51 +0000 (10:35 +0200)]
doc: tweak factor-describing wording
* doc/coreutils.texi (factor invocation): Don't say that "factoring
large prime numbers is hard". A pedant might ding you, since it's
trivial to factor a number that is known to be prime. Instead, say
that "factoring large numbers... is hard". Reported by Andreas Eder.
Jim Meyering [Sat, 24 Apr 2010 15:38:13 +0000 (17:38 +0200)]
maint: remove now-unnecessary #if HAVE_header_H tests.
* .x-sc_prohibit_always_true_header_tests: New file.
* Makefile.am (syntax_check_exceptions): Add it.
* src/cat.c: Remove #if HAVE_SYS_IOCTL_H test.
* src/copy.c: Likewise.
* src/ls.c: Likewise.
* src/stty.c: Likewise.
* src/install.c: Remove #if HAVE_SYS_WAIT_H test.
* src/kill.c: Likewise.
* src/operand2sig.c: Likewise.
* src/timeout.c: Likewise.
* src/pathchk.c: Remove #if HAVE_WCHAR_H test.
* src/stat.c: Remove #if HAVE_NETINET_IN_H test.
Jim Meyering [Sat, 24 Apr 2010 15:16:56 +0000 (17:16 +0200)]
build: enable gnulib modules for more replacement headers
* bootstrap.conf (gnulib_modules): Add the following:
netinet_in, sys_ioctl, sys_wait, so that we can eliminate
the #if HAVE_<header>_H tests guarding their header inclusions.
Jim Meyering [Sat, 24 Apr 2010 13:50:41 +0000 (15:50 +0200)]
tests: clean up also upon SIGQUIT
* tests/test-lib.sh: Also trap on SIGQUIT.
Spotted by Dmitry V. Levin.
Jim Meyering [Fri, 23 Apr 2010 16:36:32 +0000 (18:36 +0200)]
post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
Jim Meyering [Fri, 23 Apr 2010 15:18:16 +0000 (17:18 +0200)]
version 8.5
* NEWS: Record release date.
Dmitry V. Levin [Sat, 30 Jan 2010 16:02:36 +0000 (16:02 +0000)]
tests: fix exit status of signal handlers in shell scripts
The value of `$?' on entrance to signal handlers in shell scripts
cannot be relied upon, so set the exit code explicitly.
* cfg.mk (sc_always_defined_macros, sc_system_h_headers): Set
the exit code in signal handler explicitly to 128 + SIG<SIGNAL>.
* src/Makefile.am (sc_tight_scope): Likewise.
* tests/test-lib.sh: Likewise.
Eric Blake [Wed, 21 Apr 2010 14:17:59 +0000 (08:17 -0600)]
base64: always treat input in binary mode
Necessary for cygwin. Technically, this patch is not correct,
in that it clobbers O_APPEND, but it is no different than any
other use of xfreopen to force binary mode, so all such uses
should be fixed at once in a later patch.
* src/base64.c (main): Open input in binary mode.
* THANKS: Update.
Reported by Yutaka Amanai.
Jim Meyering [Wed, 21 Apr 2010 18:05:52 +0000 (20:05 +0200)]
build: update gnulib submodule to latest
Eric Blake [Tue, 20 Apr 2010 22:26:27 +0000 (16:26 -0600)]
docs: document transformation of obsolete sort syntax
* doc/coreutils.texi (sort invocation): Mention the conversion.
Pádraig Brady [Wed, 21 Apr 2010 06:50:39 +0000 (07:50 +0100)]
maint: update a couple of NEWS items for the pending release
* NEWS: Mention that cp and mv from the previous release did
not support preserving extended attributes (fixed in
e489fd04).
Improve the grammar for the "cp capabilities" item.
Pádraig Brady [Tue, 20 Apr 2010 15:25:55 +0000 (16:25 +0100)]
sort: fix parsing of end field in obsolescent key formats
This regression was introduced in commit
224a69b5, 2009-02-24,
"sort: Fix two bugs with determining the end of field".
The specific regression being that we include 1 field too many when
an end field is specified using obsolescent key syntax (+POS -POS).
* src/sort.c (struct keyfield): Clarify the description of the eword
member, as suggested by Alan Curry.
(main): When processing obsolescent format key specifications,
normalize eword to a zero based count when no specific end char is given
for an end field. This matches what's done when keys are specified with -k.
* tests/misc/sort: Add a few more tests for the obsolescent key formats,
with test 07i being the particular failure addressed by this change.
* THANKS: Add Alan Curry who precisely identified the issue.
* NEWS: Mention the fix.
Reported by Santiago Rodríguez
Pádraig Brady [Fri, 16 Apr 2010 07:39:11 +0000 (08:39 +0100)]
cp: preserve "capabilities" when also preserving file ownership
* src/copy.c (copy_reg): Copy xattrs _after_ setting file ownership
so that capabilities are not cleared when setting ownership.
* tests/cp/capability: A new root test.
* tests/Makefile.am (root_tests): Reference the new test.
* NEWS: Mention the fix.
Jim Meyering [Fri, 16 Apr 2010 06:42:47 +0000 (08:42 +0200)]
* HACKING (Add tests): Change example name, "newtest" to "new-test".
Not that anyone would confuse with something newt-related, but just
because it is more readable that way.
doc: tweak HACKING
Jim Meyering [Fri, 16 Apr 2010 06:21:32 +0000 (08:21 +0200)]
doc: tweak HACKING
* HACKING (Curly braces): Tweak a sentence. Filter a few
paragraphs through "fmt".
Pádraig Brady [Thu, 15 Apr 2010 16:34:57 +0000 (17:34 +0100)]
maint: fix build on platforms that replace strsignal
* src/Makefile.am (kill_LDADD): Add $(LIBTHREAD) so that
we link with the appropriate libraries to provide Thread Local Storage
on platforms that replace strsignal (like AIX for example).
Tested-by: Daniel Richard G. <danielg@teragram.com>
Pádraig Brady [Wed, 14 Apr 2010 14:32:27 +0000 (15:32 +0100)]
tests: avoid spurious failure of ls/color-norm test
* tests/ls/color-norm: Use the "time" output by `ls -l`
to check normal style. Previously we used the size from `ls -s`,
but the size of "empty" files can vary depending on whether
SELinux is enabled for example.
Jim Meyering [Thu, 15 Apr 2010 08:17:47 +0000 (10:17 +0200)]
doc: document our code formatting policy regarding curly braces
* HACKING (Curly braces: use judiciously): New section.
Jim Meyering [Wed, 14 Apr 2010 13:48:31 +0000 (15:48 +0200)]
tests: avoid spurious failure of root-only ls/capability test
* tests/ls/capability: Adjust this test not to expect the no-op escape
sequence that was removed from all other tests by 2010-01-30 commit
5d43617e, "ls --color: don't emit a final no-op escape sequence".