Commit Graph

583 Commits

Author SHA1 Message Date
Pádraig Brady
265c4b83a8 new program: timeout
* AUTHORS: Register as the author.
* NEWS: Mention this change.
* README: Add timeout command to list.
* src/timeout.c: New file.
* src/kill.c (operand2sig): Move function to its own file,
now that timeout.c will also use it.
* src/operand2sig.c (operand2sig): New file, extracted from kill.c.
* src/operand2sig.h (operand2sig): Declare.
* src/Makefile.am (EXTRA_PROGRAMS): Add timeout.
* src/.gitignore: Add timeout binary to list to ignore.
* doc/coreutils.texi (timeout invocation): Add timeout info.
(Signal specifications): New section, also referenced by kill.
* man/Makefile.am (timeout.1): Add dependency.
* man/timeout.x: New file.
* po/POTFILES.in: Add timeout.c and operand2sig.c to list to translate.
* tests/Makefile.am (TESTS): Add the two new tests.
* tests/misc/help-version: Add support for new timeout command.
* tests/misc/invalid-opt: Add support for new timeout command.
* tests/misc/timeout: New file: check basic timeout operation.
* tests/misc/timeout-parameters: New file: check invalid parameter
combinations.
2008-06-02 14:40:26 +02:00
Erik Auerswald
86535835fe md5sum: new option, --quiet, to suppress OK messages
sha1sum, sha224sum, sha384sum, and sha512sum accept it, too.
* src/md5sum.c: add option --quiet to suppress OK messages
* doc/coreutils.texi: document option --quiet
* tests/misc/md5sum: add test for option --quiet
* NEWS: mention new option --quiet for md5sum+sha*sum in "New
  features" section
2008-06-01 16:55:11 +02:00
Jim Meyering
dd3612a12b * NEWS: add header line for next release 2008-06-01 11:00:51 +02:00
Jim Meyering
d81d2e0ba6 Version 6.12.
* NEWS: Record release date.
2008-05-31 23:20:56 +02:00
Jim Meyering
eba365275b install: reenable matchpathcon-related code
The underlying performance problem is being dealt with in Automake
by limiting the number of install invocations, and in SELinux with
incremental changes as well as a potential new implementation.
* src/Makefile.am (ginstall_CPPFLAGS) [ENABLE_MATCHPATHCON]: Define.
* src/install.c [ENABLE_WHEN_MATCHPATHCON_IS_MORE_EFFICIENT]:
Rename to ENABLE_MATCHPATHCON.
* NEWS: mention this change
2008-05-31 22:42:20 +02:00
Jim Meyering
6c9b505329 NEWS: mention that cp -p copies permissions more portably
Based on wording suggested by Bruno Haible.
2008-05-30 09:08:51 +02:00
Jim Meyering
209850fd7e avoid problems with sign-extended "char" operand to is* functions
* src/cut.c (set_fields): Apply to_uchar to isblank operands.
* src/uniq.c (find_field): Likewise.
* src/seq.c (scan_arg): Likewise, for isspace.
* tests/misc/uniq: New file.  Test for the above, but only
when isspace(0240).
* tests/Makefile.am (TESTS): Add misc/uniq.
* configure.ac: Use gt_LOCALE_FR.
* tests/check.mk (TESTS_ENVIRONMENT): Propagate LOCALE_FR to scripts.
* NEWS: Mention the bug fixes.

Before this patch, on FreeBSD 6:

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

With the patch:

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

This also affected many other locales:
for i in $(locale -a); do test $(LC_ALL=$i ./uniq -f1 in|wc -l)
  = $(LC_ALL=$i uniq -f1 in|wc -l) || echo $i ; done
...
en_GB.ISO8859-1
en_GB.ISO8859-15
en_GB.UTF-8
en_IE.UTF-8
en_NZ.ISO8859-1
en_NZ.ISO8859-15
en_NZ.UTF-8
en_US.ISO8859-1
en_US.ISO8859-15
en_US.UTF-8
...
2008-05-06 08:21:28 +02:00
Jim Meyering
d701f6abb7 tac: avoid segfault for e.g., "echo > x; tac -r x x"
* src/tac.c (tac_seekable): Move local "regs" declaration out
to file scope, so its values aren't clobbered between calls.
Discovered by Cristian Cadar, Daniel Dunbar and Dawson Engler,
reported in http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/13501
* NEWS: Mention the bug fix.
* tests/Makefile.am (TESTS): Add misc/tac.
* tests/misc/tac: New file.  Test for the above.
2008-05-05 13:15:32 +02:00
Jim Meyering
bbc0cb0f37 chcon, runcon: make --help print the bug-reporting address
* src/chcon.c (usage): Use emit_bug_reporting_address.
* src/runcon.c (usage): Likewise.
* tests/misc/help-version: Don't exempt chcon and runcon.
* NEWS: Mention this.
2008-04-29 14:55:38 +02:00
Ondřej Vašík
1a5b6e3a50 id: do not print SELinux context when invoked with a USERNAME argument
* NEWS: Mention new behaviour.
* src/id.c (main): Do not print SELinux context when user is specified.
* tests/Makefile.am: Add the new test.
* tests/misc/id-context: New file.  Test for the fix.
Problem reported by Ronny Buchmann in http://bugzilla.redhat.com/443485.
2008-04-23 17:51:44 +02:00
Jim Meyering
0a4a938b6b id: do print the AFS-specific nameless group ID (called a PAG)
In 6.11, we mistakenly suppressed the printing of certain group IDs,
thinking they were useless AFS-specific artifacts.
This change reverts that, so now they are printed once again.
http://thread.gmane.org/gmane.org.fsf.announce/867/focus=13345
This also reverts the bug-fix that applied solely to the new code
used to avoid printing those IDs

Revert "id bug fix: don't point to potentially clobbered static storage"
This reverts commit f7d1c59c22.
Revert "Work around AFS bug: id and groups would print invalid group number."
This reverts commit b7a836c0a3.
Revert "* src/c99-to-c89.diff: Accommodate a C99-ism in id.c."
This reverts commit d44893c5db.
2008-04-23 15:29:11 +02:00
Jim Meyering
e347e9d722 Version 6.11.
* NEWS: Record release date.

Signed-off-by: Jim Meyering <meyering@redhat.com>
2008-04-19 23:26:54 +02:00
Jim Meyering
6856089f7b pr -e, with a mix of backspaces and TABs, could corrupt the heap
* tests/pr/Test.pm: New tests for the above.
* src/pr.c (char_to_clump): Ensure that "input_position" never
goes below 0.
Also, elide any backspace encountered when input_position is 0,
to be compatible at least with /bin/pr from Solaris 10.
This bug is present in the original version:
b25038ce9a
* NEWS [Bug fixes]: Mention this.
Report and diagnosis by Cristian Cadar, Daniel Dunbar and Dawson Engler
in http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/13272
2008-04-19 13:34:38 +02:00
Jim Meyering
a85752ff4b md5sum -c: ignore a line with a NUL byte among checksum hex digits
* src/md5sum.c (hex_digits): Require that all "digest_hex_bytes"
be hexadecimal digits, not just those before the first NUL byte.
This bug dates back to the original version:
3763a4f24e
* tests/misc/md5sum (nul-in-cksum): Test for the above.
* NEWS [Bug fixes]: Mention this.
Prompted by a report from Flóki Pálsson in
http://bugzilla.redhat.com/439531
2008-04-19 00:24:55 +02:00
Jim Meyering
7cb24684cc md5sum, sha1sum, etc: handle invalid input (i.e., don't segfault)
* src/md5sum.c (bsd_split_3): Return right away if s_len == 0.
* tests/misc/md5sum (bsd-segv): New test for the above.
* tests/misc/sha1sum (bsd-segv): Likewise.
* NEWS: Mention the bug fix.
Reported by Cristian Cadar, Daniel Dunbar and Dawson Engler.
2008-04-15 08:46:48 +02:00
Jim Meyering
c1b6f9458a "touch E; mkfifo F; cp -fR F E" no longer fails due to existing E
* src/copy.c (copy_internal): Revert change of 2005-03-01,
4303f04545
Prompted by Michael Stone, who pointed me to an old bug report from
Ian Jackson: http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/7504
* tests/cp/special-f: New file.  Test for the above.
* tests/cp/Makefile.am (TESTS): Add special-f.
* NEWS: mention this bug fix.
2008-04-02 18:23:04 +02:00
Jim Meyering
f433c3835f "rm -r DIR" would mistakenly prompt about very long names
* src/remove.c (write_protected_non_symlink): Return 0(-1) when
euidaccess_stat pronounces a writable(not-writable) file, not -1(0).
* tests/rm/deep-2: New file.  Test for the above-fixed bug.
* tests/rm/Makefile.am (TESTS): Add deep-2.
Discovered while reviewing this change:
http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/13071
2008-03-31 13:46:34 +02:00
Jim Meyering
0d34887fe9 * NEWS: Note the dd bug fix. The bug was introduced over 8 years ago:
9fca49f67c
2008-03-31 09:11:15 +02:00
Jim Meyering
eb8fa94f2c mknod, mkfifo: don't segfault when diagnosing invalid SELinux context
Identical to the bug fixed by 72d052896a.
* src/mkfifo.c (main): Use "scontext", not NULL optarg in diagnostic.
* src/mknod.c (main): Likewise.
Reported by Cristian Cadar, Daniel Dunbar and Dawson Engler.
* tests/mkdir/selinux: Test for the above fixes.
* NEWS: Mention the fixes.
2008-03-28 23:03:27 +01:00
Jim Meyering
cdb16829a6 Fix typo in old NEWS and ChangeLog: s/commmand/command/.
* ChangeLog-2007: Likewise.
* NEWS: Likewise.
Prompted by http://bugzilla.redhat.com/439410
2008-03-28 20:20:49 +01:00
Jim Meyering
b58a8b4ef5 paste -d\\: avoid heap overrun for backslash at end of delim list
* src/paste.c: Include "quotearg.h".
(collapse_escapes): Handle backslash-escaped backslash explicitly.
Handle unescaped backslash at end of string by returning nonzero,
rather than by overrunning memory.
(main): Diagnose an invalid delimiter list -- carefully.
Reported by Cristian Cadar, Daniel Dunbar and Dawson Engler.
* tests/misc/paste-no-nl (delim-bs): Add a test to demonstrate the
heap-smashing capability.
(delim-bs2): Prior to coreutils-5.1.2, this bug was a little harder
to demonstrate: it would corrupt a first-argument containing e.g., \b
* NEWS: Mention the bug fix.
* tests/misc/Makefile.am (TESTS): Reflect renaming.
* tests/misc/paste: Rename from paste-no-nl.

Signed-off-by: Jim Meyering <meyering@redhat.com>
2008-03-27 13:32:38 +01:00
Daniel Dunbar
72d052896a mkdir -Z x d: don't segfault when diagnosing invalid context "x" (tiny change)
* src/mkdir.c (main): Use "scontext", not NULL optarg in diagnostic.
Reported by Cristian Cadar, Daniel Dunbar and Dawson Engler.
* NEWS: Mention the bug fix.
2008-03-26 00:57:29 +01:00
Jim Meyering
a0851554bd ptx: avoid heap overrun for backslash at end of optarg string
* src/ptx.c (copy_unescaped_string): Ignore a lone backslash
at end of string.  Reported by Cristian Cadar, Daniel Dunbar
and Dawson Engler.  Details here:
<http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/13005>.
* tests/misc/Makefile.am (TESTS): Add ptx-overrun.
* tests/misc/ptx-overrun: New file.  Test for the above fix.
* NEWS: Mention the fix.

Signed-off-by: Jim Meyering <meyering@redhat.com>
2008-03-21 20:58:15 +01:00
Jim Meyering
6e5bbc267a Write NEWS and update c99-to-c89 patch for today's rm improvement.
* NEWS: call this a "portability improvement" ;-)
* src/c99-to-c89.diff: Adjust remove.c offsets.
2008-03-21 16:01:29 +01:00
Jim Meyering
63feb84a2d mv: never unlink a destination file before calling rename
While cp --preserve=links must unlink certain destination files,
mv must never do that.
* src/copy.c (copy_internal): Pull the '! x->move_mode' test "up",
so it affects the entire condition, and not just DEREF_NEVER mode.
Reported by James Ralston in <http://bugzilla.redhat.com/438076>.
* tests/mv/atomic2: New file.  Test for the above fix.
* tests/mv/Makefile.am (TESTS): Add atomic2.
* NEWS: Mention the bug-fix.
[Bug introduced in 367719ba5f]
2008-03-19 13:38:27 +01:00
Ondřej Vašík
9c393fa194 install, rmdir: write --verbose output to stdout, not to stderr.
* src/install.c (announce_mkdir): Write verbose output to stdout,
not to stderr.
* src/mkdir.c (announce mkdir): Use prog_fprintf for verbose output.
* src/prog-fprintf.c (prog_fprintf): New function and file.
* src/prog-fprintf.h: New file.
* src/rmdir.c (main): Write verbose output to stdout, not to stderr.
Quote directory name in a diagnostic.
* src/rmdir.c (remove_parents): Write verbose output to stdout,
not to stderr.
* doc/coreutils.texi: Mention that shred verbose output is to stderr.
* NEWS: Mention the changes.

Signed-off-by: Ondřej Vašík <ovasik@redhat.com>
2008-03-10 19:47:15 +01:00
ribalba
b7a836c0a3 Work around AFS bug: id and groups would print invalid group number.
* src/id.c (main): Call print_group_list with a user name, if possible.
* src/groups.c (main): Likewise.
* NEWS: Mention this.
For details, see
http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/12852
http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/12875

Signed-off-by: ribalba <geerd.dietger.hoffmann@gmail.com>
2008-03-05 11:38:26 +01:00
James Youngman
49f7ebaac4 id: use getgrouplist when possible
* gl/m4/mgetgroups.m4: Check for getgrouplist.
* gl/lib/mgetgroups.c (mgetgroups): Use getgrouplist, if available.
* TODO: Remove the item about switching to getgrouplist.
* NEWS: mention this
2008-02-21 15:02:07 +01:00
Andreas Schwab
cb3147d298 sort: add --sort=... option.
* src/sort.c (SORT_OPTION): New enum.
(sort_args, sort_types): Define.
(usage, long_options, main): New option --sort.
* tests/sort/Test.pm: Test it.
* doc/coreutils.texi (sort invocation): Document --sort option.
* NEWS: Mention this.
2008-02-20 08:41:29 +01:00
Steven Schubiger
4f3ff2e700 seq: give better diagnostics for invalid formats.
* src/seq.c: (validate_format): New function.
(main): Use it.
* tests/misc/seq (fmt-d, fmt-e): Test for expected diagnostics with
invalid formats.
* NEWS: Mention this change.
* TODO: Remove this item.
[jm: src/seq.c: make diagnostics more consistent
 tests/misc/seq (fmt-eos1): adjust the expected diagnostic ]
2008-02-19 15:41:16 +01:00
James Youngman
a1e715698a join: new options: --check-order and --nocheck-order.
* src/join.c: Support --check-order and --nocheck-order.
New variables check_input_order, seen_unpairable and
issued_disorder_warning[]. For --check-order, verify that the
input files are in sorted order.  For the default case, check the
order only if there are unpairable lines.
(join): Perform ordering checks after reaching EOF on either
input.
(usage): Mention --check-order and --nocheck-order.
(dupline): Save a copy of the previously-read input line so that
we can detect disorder on the input.
(get_line): Temporarily save a copy of the previous line (by
calling dupline) and check relative ordering (by calling
checkorder) before returning the newly-read line.
(getseq, join): Tell get_line which file we are reading from.
(advance_seq): New function, factoring out some of the code
commonly surrounding calls to getseq.
(checkorder): New function.  Verifies that a pair of consecutive
input lines are in sorted order.
* doc/coreutils.texi (join invocation): Document the new options
--check-order and --nocheck-order.
* tests/join/Test.pm (tv): Added tests for --check-order and
--nocheck-order.
* NEWS: Mention this new feature.
2008-02-19 15:17:39 +01:00
Jim Meyering
b8108fd2dd seq: give a proper diagnostic for an invalid --format=% option
* src/seq.c (long_double_format): Handle '%' at end of string.
* tests/misc/seq [fmt-eos1, fmt-eos2]: New tests for the bug.
* NEWS: Mention this.
Reported by Pádraig Brady.
2008-02-18 18:38:52 +01:00
Ed Avis
483297d5dd ls --color no longer outputs unnecessary escape sequences
In --color mode, plain files do not get any color, not even white.
When no highlighting is required, ls outputs no escape sequence at all.
* src/ls.c (print_with_color):
(used_color): New global.
(indicator_no) [C_RESET]: New enum value.
(indicator_name) ["rs"]: Corresponding new string.
(color_indicator): Make the 'normal' and 'file' markers be NULL.
Use "rs" (C_RESET) to reset to ordinary colors.
(process_signals): Restore default colors only if necessary.
(main): Don't call prep_non_filename_text here.
(print_name_with_quoting): Call it here, instead.
(prep_non_filename_text): Use C_RESET, not C_NORM.
(print_color_indicator): Return bool, not void.
Print nothing, when possible.
(put_indicator): Call prep_non_filename_text the first time.
* tests/misc/ls-misc: Test for above.
* tests/ls/color-dtype-dir: Adapt: no escapes around regular file name.
* TODO: Remove item.
* NEWS: Mention this.
2008-02-17 11:16:08 +01:00
James Youngman
167b8025ac Replace groups.sh with groups.c.
* src/groups.c (main): New file, replacing groups.sh.
* src/group-list.c, src/group-list.h: New files, factored out of id.c,
implementing the functionality that "id" and "groups" have in common.
* src/id.c (print_full_info): Avoid a segfault when trying to print
an error message if getgroups fails.
(print_group_list): Move to group-list.c.
(print_group): Likewise.
* man/Makefile.am: When building groups.1, obtain the help text
from src/groups.c, not src/groups.sh.
(noinst_HEADERS): Add group-list.h.
(group): Remove rule.
(dist_man_MANS): Remove groups.1.
* doc/coreutils.texi (groups: Print group names a user is in):
Explain why "groups" and "groups $(id -un)" give different results
in existing login sessions after you change the group database.
(id: Print user identity): Likewise for "id".
* po/POTFILES.in: Add src/group-list.c and src/groups.c.
* NEWS: mention this.
* AUTHORS: Update.
2008-02-13 14:37:22 +01:00
Jim Meyering
dcc6638e46 NEWS [6.9.90]: head, od, split and tail accept the standard size suffixes 2008-02-07 22:58:38 +01:00
Steven Schubiger
a09dadf100 mkdir, split: write --verbose output to stdout, not stderr.
* src/mkdir.c (verbose_output): New function.
(announce_mkdir): Use it.
* src/split.c (usage): Update.
* src/split.c (cwrite): Write to stdout, not stderr.
* doc/coreutils.texi (split invocation): Remove the mention
of --verbose output being printed to stderr.
* tests/mkdir/p-v: Redirect stdout, not stderr.
* tests/misc/split-a: Likewise.
* NEWS: Mention this change.
* TODO: Remove this item.
2008-02-07 08:26:48 +01:00
Jim Meyering
ed5c4e770a Improve "rmdir --ignore-fail-on-non-empty"
* src/rmdir.c (remove_parents, main): With --ignore-fail-on-non-empty,
suppress a diagnostic also for other errno values, which can arise
with read-only media or when the parent directory has the immutable
attribute (set via chattr +i).
(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>
via Bob Proulx.
* NEWS: Mention the improvement.
2008-01-30 13:51:38 +01:00
Jim Meyering
533391a2a7 ls: don't segfault on files in /proc with an old libselinux
* src/ls.c (gobble_file): Work around a bug in libselinux1-2.0.15
whereby getfilecon returns 0 yet sets the context to NULL.
Reported by Jan Moringen via Michael Stone in
http://bugs.debian.org/463043
* tests/ls/Makefile.am (TESTS): Add proc-selinux-segfault.
* tests/ls/proc-selinux-segfault: Test for the above fix.
* NEWS: Mention the fix.
2008-01-29 09:23:51 +01:00
Jim Meyering
9675ed627d * NEWS: Record release date. 2008-01-22 00:30:14 +01:00
Jim Meyering
0702758ca4 NEWS: Mention the configure.ac fix. 2008-01-16 21:20:36 +01:00
Jim Meyering
8ad8aa5322 Version 6.9.92 2008-01-12 00:34:31 +01:00
Jim Meyering
e52a7c28ac tests/tr/Test.pm: Prefer en_US.ISO-8859-1 to en_US.iso88591.
Suggestions from James Youngman and Pádraig Brady in
http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/12218/focus=12227
2008-01-11 10:07:01 +01:00
Jim Meyering
ab1c9b54b1 NEWS: Mention the cp bug fix. 2008-01-07 12:18:00 +01:00
Jim Meyering
9b76bc2b54 touch: add a test for today's change.
* tests/touch/now-owned-by-other: New script.  Test today's change.
* tests/touch/Makefile.am (TESTS): Add now-owned-by-other.
* tests/Makefile.am (all_t): Add td, a new root-only test.
(td): New target.
* NEWS: Mention the improvement.
2008-01-06 12:50:54 +01:00
Jim Meyering
6efd10462d Avoid tr case-conversion failure in some locales.
* src/tr.c (skip_construct): New function.
(main): When processing a pair of case-converting classes, don't
iterate through the elements of each [:upper:] or [:lower:] class.
Reported by Gerald Pfeifer in
<http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/12218>.
* tests/tr/Test.pm [tolower-F]: New test for the above fix.
[upcase-xtra, dncase-xtra]: New tests, for a related code path.
* NEWS: Mention the tr bug fix.
2008-01-06 00:09:29 +01:00
Jim Meyering
e19a5aa428 Note that sorting uniq's input is often useful.
Suggested by Eric Blake.
2007-12-18 11:20:45 +01:00
Jim Meyering
7477cd1662 Version 6.9.91. 2007-12-15 09:44:40 +01:00
Jim Meyering
7407dc042a Add a test to exercise today's bug fix.
* tests/misc/selinux: Test for today's bug fix.
* NEWS: Mention the SELinux "ls -l" fix.
2007-12-11 21:41:52 +01:00
Jim Meyering
291eb90a0a * NEWS: Add the "Bug fixes" heading. 2007-12-11 19:08:03 +01:00
Jim Meyering
de5b055bbf "rm" as root would fail to unlink a non-directory on OS X 10.4.x
* src/remove.c (remove_entry) ["can unlink directories"]: Fix a
mistakenly reversed condition.
* NEWS: Mention this bug fix.
Reported by Pieter Bowman.
2007-12-09 00:57:00 +01:00