Commit Graph

472 Commits

Author SHA1 Message Date
Eric Blake
46a811b9e7 od: align multiple -t specs
* src/od.c (struct tspec): Add pad_width field, and adjust
print_function prototype.
(decode_one_format): Rewrite all fmt_string values to account for
pad width.
(FMT_BYTES_ALLOCATED): Adjust to new format style.
(main): Compute pad width per spec.
(write_block): Account for pad width.
(dump): Don't print padding-only fields.
(PRINT_TYPE, print_named_ascii, print_ascii): All print functions
adjusted to use variable pad width.
* tests/Makefile.am (TESTS): Add test.
* tests/misc/od-multiple-t: New file.
* THANKS: Update.
* NEWS: Mention the improvement.
Reported by Gary Johnson.
2008-06-13 23:06:03 +02:00
Jim Meyering
6c79825ce9 skip (don't fail) root-only tests for common set-up failures
Address 2 of 4 failures reported by Jarod Wilson in
http://bugzilla.redhat.com/442352.  More details here:
http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/13803
* tests/cp/cp-a-selinux: Skip the test if "mkfs -t ext2" fails.
* tests/rm/fail-2eperm: Skip the test if "rm" is not accessible.
2008-06-13 22:45:50 +02:00
Jim Meyering
5f47278372 fix another unportable use of 'tr'
* configure.ac [EXTRA_PROGRAMS]: Add omitted space in tr's STRING2.
Spotted by Denis Excoffier, upon Solaris 8 build failure.
2008-06-11 14:18:36 +02:00
Eric Blake
74c0bfbc4c improve 'date +%C' documentation
* src/date.c (usage): Use 20, not 21, for current century.
* THANKS: Update.
Reported by Dameon G. Rogers, fix suggested by Philip Rowlands.

Signed-off-by: Eric Blake <ebb9@byu.net>
2008-06-06 08:22:02 +02:00
Jim Meyering
0647f3eb5a accommodate older SELinux which lacks matchpathcon_init_prefix
* m4/jm-macros.m4: Check for matchpathcon_init_prefix.
* src/install.c [!HAVE_MATCHPATHCON_INIT_PREFIX]
(matchpathcon_init_prefix): Define away.
* gl/lib/se-selinux.in.h (matchpathcon_init_prefix): Define.
Reported by Ilya N. Golubev in
<http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/13686>.
2008-06-02 21:34:40 +02:00
Jim Meyering
a6894d063c tests: skip (don't fail) rm/one-file-system when mount --bind fails
* tests/rm/one-file-system: Reported by Allen Hewes.
2008-04-21 14:48:19 +02:00
Sven Joachim
b021f59dfa * THANKS: Update my address, correct encoding for a name. 2008-04-19 13:46:52 +02:00
Jim Meyering
9982e26c12 remove.c: accommodate systems with negative errno values
This is required at least on Haiku and BeOS.
* src/remove.c (write_protected_non_symlink): Return 1 for a write-
protected non-symlink, 0 if we determine it's not, and -1 upon
error (setting errno accordingly only in this final case).
(prompt): Deal with the changed semantics of the above function.
Based on this patch from Axel Dörfler:
http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/13071
2008-04-06 09:26:32 +02:00
Jim Meyering
2741677b28 Accommodate building on OS/2 (www.ecomstation.com Ecs v2 rc4)
* configure.in: Also filter out carriage returns from the value
of $no_install_progs_default.  Reported by Elbert Pol.
2008-04-05 12:13:57 +02: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
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
Jim Meyering
5ae0543737 Fix a typo in description of size suffixes: s/GB/G/.
* doc/coreutils.texi (od invocation, head invocation, tail invocation):
Spotted by Bert Wesarg.
2008-02-07 23:06:28 +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
76c9c9845e Avoid cp/preserve-gid test failure on Mac OS 10.5.1 (Darwin 9.1)
* tests/cp/preserve-gid: Set group as well as owner on ".".
Reported by Elias Pipping.
2008-01-26 17:16:38 +01:00
Jim Meyering
d81716addb Avoid misinterpreting mgetgroups failure in running root-only tests.
* src/setuidgid.c (main): Don't misinterpret as size_t an error
return from mgetgroups.  Reported by Theodoros V. Kalamatianos.
2008-01-26 10:04:17 +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
bad0510aea doc: Put braces around multi-digit exponents.
Reported by Darrel Francis.
2007-12-31 11:24:14 +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
Jim Meyering
af5d0c363a tr: do not reject an unmatched [:lower:] or [:upper:] in SET1.
* NEWS: Mention this.
* src/tr.c (get_next) [RE_CHAR_CLASS]: Don't skip the loop when
processing [:lower:] and [:upper:].
(main): Require [:lower:] or [:upper:] in SET1 only when
when one of those is specified in SET2.
* tests/tr/Test.pm: Add tests for this fix.
Reported by Per Starbäck.

Signed-off-by: Jim Meyering <meyering@redhat.com>
2007-10-21 14:01:28 +02:00
Jim Meyering
1490f2dbf3 od: fix a bug that arises when skipping exact length of file
* NEWS: Document the bug fix.
* src/od.c (skip): Call fseek even when n_skip is exactly the
same as the length of the current file.  Otherwise, the next
iteration would use unadjusted input stream pointer, thus ignoring
the desired "skip".  Report and patch by Paul GHALEB.
2007-08-14 09:47:05 +02:00
Jim Meyering
288524b39b Attempt to copy a regular file, even if stat says it is empty.
* NEWS: Document this bug fix.
* src/copy.c (copy_reg): Read from a regular file, even if it
appears (stat.st_size == 0) to be empty.  This reverts an
optimization introduced on 2005-11-23 for coreutils-6.0.
Otherwise, "cp /proc/cpuinfo /tmp" creates an empty file,
on e.g., linux-2.6.20.
* tests/cp/proc-zero-len: New file.  Test for the above.
* tests/cp/Makefile.am (TESTS): Add proc-zero-len.
Reported by Dan Berrangé.
2007-07-29 12:03:15 +02:00
Jim Meyering
0a744370bb ls --color: Don't stat symlinks when neither ORPHAN nor MISSING attribute has a color.
* src/ls.c (main): Don't set check_symlink_color when C_EXEC is
colored, unless ln=target (aka color_symlink_as_referent) is set.
(gobble_file): Set f->linkok = true also when !check_symlink_color.
http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/10608/focus=10927
Reported by Jeremy Maitin-Shepard.
* tests/strace: New file, contents extracted from...
* tests/mv/atomic: ...here.  Source strace.
* tests/ls/stat-free-symlinks: New file.  Test for the above.
Use strace to ensure that in this corner case, ls does not call stat.
* tests/ls/Makefile.am (TESTS): Add stat-free-symlinks.
* tests/Makefile.am (EXTRA_DIST): Add strace.
2007-07-15 22:13:44 +02:00
Jim Meyering
17cc46a11a THANKS: Add Pádraig Brady.
2007-07-08  Jim Meyering  <jim@meyering.net>
2007-07-08 16:42:50 +02:00
Jim Meyering
c23c89db0f Make chgrp and chown diagnostics consistent.
* src/chown.c (main): Emit the diagnostic before the file name,
not after it, to be consistent with chgrp's diagnostic.
* src/chgrp.c (parse_group): Emit a ":" between the diagnostic
and the file name.
Reported by Egmont Koblinger.
* THANKS: Add Egmont Koblinger.
2007-06-16 12:53:40 +02:00
Jim Meyering
85c3924ce5 rmdir: give better diagnostics
* src/rmdir.c (remove_parents): Give a more descriptive/consistent
diagnostic upon failure.
(main): Likewise.
Suggestion from Joey Hess.
* THANKS: Add Joey Hess.
2007-06-13 15:53:12 +02:00
Jim Meyering
e1afd98589 README: Also mention README-hacking,
for whose who start from
cloned/checked-out sources rather than from a distribution tarball.
Reported by Steve Ward.
* THANKS: Add Steve Ward.

Signed-off-by: Jim Meyering <jim@meyering.net>
2007-06-11 11:10:23 +02:00
Jim Meyering
b1b0f5c556 bug-fix: cp would fail to write through a dangling symlink
* NEWS: Mention the bug fix.
* src/copy.c (copy_reg): When open fails with EEXIST, the destination
is lstat'able, and a symlink, call open again, but now without O_EXCL.
* tests/cp/thru-dangling: New file, to test for the above fix.
* tests/cp/Makefile.am (TESTS): Add thru-dangling.
* THANKS: Add Michael McLagan.
Bug report from Michael McLagan in <http://bugzilla.redhat.com/243588>.
2007-06-10 15:01:18 +02:00
Jim Meyering
ab402c29f9 tr -c: don't abort when translating with S2 larger than complement of S1
* src/tr.c (main): Remove invalid assertion triggered by e.g.,
tr -c a '[b*256]'.  There's nothing wrong with having Set2 larger
than Set1.  Reported by Guntram Blohm.
* tests/tr/Test.pm (no-abort-1): Test for the above.
* NEWS: Mention this bug fix.
* THANKS: Add Guntram Blohm.
2007-05-04 10:03:01 +02:00
Jim Meyering
aa3f52d17b Invoke rm via 'setuidgid ... env PATH="$PATH" ...', as in fail-eperm.
* tests/rm/fail-2eperm: Patch from AIDA Shinra.
Reported by Peter Dyballa.
* THANKS: Add AIDA Shinra and Peter Dyballa.
2007-05-02 23:34:33 +02:00
Jim Meyering
383713e030 * THANKS: Add Andreas Frische.
* NEWS: Mention today's ls --color fix.
* tests/ls-2/tests (sl-dangle): Add a test for today's fix.
2007-04-24 09:20:52 +02:00
Jim Meyering
25b8a7a987 cut synopsis: fix coreutils.texi, too.
* doc/coreutils.texi (cut invocation): Adjust synopsis to show that an
* THANKS: Add Rudolf Kastl.
OPTION is required.  Reported by Rudolf Kastl.
2007-04-16 22:01:46 +02:00
Jim Meyering
4d484fe09f Add a test for, and document, today's fix.
* NEWS: Mention today's ls --color fix.
* tests/ls-2/tests (sl-target): Add a test for today's fix.
* THANKS: Add Kirk Kelsey.
2007-04-07 20:51:13 +02:00
Jim Meyering
553d347d3e Fix a bug in how pr -m -s works.
* NEWS: Describe how the fix affects pr.
* src/pr.c (init_parameters): The --merge (-m) option does
not imply --expand-tabs (-e), so don't set "untabify_input".
Reported by Wis Macomson.
* tests/misc/pr: New file.  Test for the above fix.
* tests/misc/Makefile.am (TESTS): Add pr.
* THANKS: Update.
2007-03-18 16:21:26 +01:00
Jim Meyering
d7226387a9 * src/env.c (main): When invoked with no arguments (i.e. when printing
the environment), use a local variable to iterate through the global
"environ" array, rather than "environ" itself.  This is solely to
avoid changing the environment for an LD_PRELOAD-substituted "puts"
or "exit" function.  Tiny patch by Harvey Eneman.  See
<http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/9735>.
* THANKS: Update.
2007-02-20 17:23:51 +01:00
Evan Hunt
482366105a Document what the ".0" in e.g., "-k 2,3.0" means, and...
* coreutils.texi (sort invocation): ... that it can be applied to the
field-end spec, but not the field-start one.  Patch from Evan Hunt.

Signed-off-by: Jim Meyering <jim@meyering.net>
2007-01-03 12:04:24 +01:00
Jim Meyering
d69fc66d81 "cut -f 2- A B" no longer triggers a double-free bug
* src/cut.c (cut_fields): Set file-scoped global to NULL after
freeing it.  This avoids a double-free (and core dump on some systems)
for this usage: "echo 1>a; echo 2>b; cut -f2- a b".  Reported by
James Hunt in <http://bugzilla.redhat.com/220312>.
* NEWS: List this bug fix.
* THANKS: Mention him.
* tests/misc/cut: New file.
* tests/misc/Makefile.am (TESTS): Add cut.
2006-12-20 14:25:55 +01:00
Jim Meyering
4e48b4ce33 * tests/cp/open-perm-race: Correct the gdb-existence check.
Don't run either subsequent gdb command in a sub-shell.
Reported by Thomas Schwinge.
* THANKS: bring up to date.
2006-12-15 10:43:20 +01:00
Jim Meyering
f594f1fb38 *** empty log message *** 2006-10-17 20:12:05 +00:00
Jim Meyering
d1ea87316f *** empty log message *** 2006-10-17 13:48:27 +00:00
Jim Meyering
779168820b *** empty log message *** 2006-10-14 05:06:38 +00:00
Jim Meyering
509febe18b *** empty log message *** 2006-09-26 09:18:20 +00:00
Jim Meyering
f951057414 *** empty log message *** 2006-09-25 06:22:35 +00:00
Jim Meyering
6e31234fbb *** empty log message *** 2006-07-20 08:33:19 +00:00
Jim Meyering
36a288e41a * src/copy.c (copy_internal): Don't work around old NFS clients like
SunOS-4.1.4 and Irix 5.3 that set errno to values like EIO and
ENOTEMPTY upon failed rename.  Otherwise, we risk misinterpreting
a banal failure as a recursive move-into-self failure.
Reported by Florent Bayle in <http://bugs.debian.org/376749>.
2006-07-05 09:08:42 +00:00
Jim Meyering
593453d7bf *** empty log message *** 2006-06-03 08:29:28 +00:00
Jim Meyering
fe7323d6cf *** empty log message *** 2006-05-28 09:02:42 +00:00
Jim Meyering
58f42eb607 *** empty log message *** 2006-05-15 20:18:49 +00:00
Jim Meyering
6dd69d3281 *** empty log message *** 2006-05-10 13:39:30 +00:00
Jim Meyering
c139c9a58b . 2006-05-03 10:11:25 +00:00