Jim Meyering [Tue, 1 Jun 2004 07:49:47 +0000 (07:49 +0000)]
.
Jim Meyering [Mon, 31 May 2004 18:29:48 +0000 (18:29 +0000)]
*** empty log message ***
Jim Meyering [Mon, 31 May 2004 12:20:01 +0000 (12:20 +0000)]
.
Jim Meyering [Mon, 31 May 2004 12:18:55 +0000 (12:18 +0000)]
.
Jim Meyering [Mon, 31 May 2004 12:18:24 +0000 (12:18 +0000)]
regenerate
Jim Meyering [Mon, 31 May 2004 12:17:49 +0000 (12:17 +0000)]
2004-05-29 Paul Eggert <eggert@cs.ucla.edu>
tr cleanup, mostly having to do with integer type ranges.
Remove all casts.
* tests/tr/Test.pm: Add a few tests for the below. Alas, most of
the test cases wouldn't be portable, or would take too much CPU
time, or both.
Jim Meyering [Mon, 31 May 2004 12:16:47 +0000 (12:16 +0000)]
(TESTS_ENVIRONMENT): Define PATH to include
the build src/ directory -- at the front.
($(srcdir)/$x-tests): Depend on Makefile.am.
Use $x as the program name, except when it would be `test' (test is
the sole program tested via mk-script that is also a shell built-in).
In that case, use the old ../../src/$x.
Jim Meyering [Mon, 31 May 2004 12:11:49 +0000 (12:11 +0000)]
.
Jim Meyering [Mon, 31 May 2004 11:41:36 +0000 (11:41 +0000)]
.
Jim Meyering [Mon, 31 May 2004 11:41:13 +0000 (11:41 +0000)]
*** empty log message ***
Jim Meyering [Mon, 31 May 2004 11:41:06 +0000 (11:41 +0000)]
(TESTS_ENVIRONMENT): Set PATH.
Jim Meyering [Mon, 31 May 2004 11:30:30 +0000 (11:30 +0000)]
*** empty log message ***
Jim Meyering [Mon, 31 May 2004 11:30:27 +0000 (11:30 +0000)]
(set_initialize): Remove unnecessary initialization of the `in_set'
buffer; that initialization triggered the same compiler bug as above.
Jim Meyering [Mon, 31 May 2004 10:06:23 +0000 (10:06 +0000)]
tr cleanup, mostly having to do with integer type ranges.
Remove all casts.
Here are examples of the failures:
$ echo a | tr a '[x*][y*
2147483646][y*
2147483646][y*4]'
x
$ echo abcd | tr abc '[b*\9]'
bbbd
$ echo abcd | tr abc '[b*0]'
tr: invalid repeat count `0' in [c*n] construct
$ echo abcd | tr -c '[a*65536]\n' '[b*]'
tr: ../../coreutils-5.2.1/src/tr.c:1942: main: Assertion `get_next (s2, ((void *)0)) == -1 || truncate_set1' failed.
Aborted
(N_CHARS, N_CHAR_CLASSES): Now an enum, not a macro.
This is safe since the code already assumes N_CHARS fits in int.
(Filter): Remove: we want to prototype everything.
(ORD, CHR): Remove. All uses removed. Some replaced with:
(uchar): New function. All places where a char must be converted
to an unsigned char are now done this way, not by ad-hoc methods.
(count): New type. Use it whenever counts or states are needed.
(BEGIN_STATE): Increase from INT_MAX - 1 (which was bogus, anyway,
since we used it in an unsigned int context) to UINTMAX_MAX - 1.
(REPEAT_COUNT_MAXIMUM): New macro. Use it in place of BEGIN_STATE
whenever appropriate.
(NOT_A_CHAR): Remove global macro; now a local enum.
(UL_LOWER, UL_UPPER, UL_NONE): No longer specify values, since
the rest of the code no longer depends on them.
(class_ok): Remove; all uses changed to use inline comparisons.
(RE_NO_TYPE): Remove; wasn't used or needed.
(struct List_element): normal_char and equiv_code are now unsigned
char, not int.
first_char, last_char, and the_repeated_char are now unsigned char,
not unsigned int. repeat_count is now count, not size_t.
All uses changed.
(struct Spec_list): state is now count, not unsigned int.
lengthis now count, not size_t.
n_indefinite_repeats is now size_t, not int.
has_equiv_class, has_char_class, and has_restricted_char_class
are now bool, not int. All uses changed.
(struct E_string): s is now char *, not unsigned char *.
escaped is now bool *, not int *. All uses changed.
(ES_MATCH): Remove macro, replacing with:
(es_match): New inline function. All uses changed.
(squeeze_repeats, complement, posix_pedantic, truncate_set1,
translating): Now bool, not int.
(io_buf): Now char array, not unsigned char.
(SET_TYPE): Remove. All uses replaced with bool.
(is_equiv_class_member, unquote, append_range, append_char_class,
append_equiv_class, find_closing_delim, star_digits_closebracket,
build_spec_list, parse_str, homogeneous_spec_list):
Now returns bool, not int. All uses changed.
(is_equiv_class_member): Now inline.
(is_equiv_class_member, is_char_class_member, make_printable_str,
append_normal_char, append_range, append_repeated_char,
get_s2_spec_stats):
Args are now of proper integer type.
(unquote, look_up_char_class, make_printable_str,
append_equiv_class, build_spec_list, squeeze_filter):
Avoid unsigned char *p; gently convert *p to unsigned char instead.
(unquote, get_spec_stats): Do not jump past declarations and then
use them; C doesn't allow this in portable programs.
(make_printable_str): Check for overflow in size calculations.
(xmemdup): Remove. All uses rewritten.
(find_bracketed_repeat): Args are now of proper pointer-to-integer
type. Do not reject [c*0]. Use xstrtoumax, not xstrtoul.
(find_bracketed_repeat, star_digits_closebracket): Check that the
digits are not escaped.
(build_spec_list): Don't bother to copy opnd_str; not needed.
(build_spec_list, get_next): Simplify internal logic a bit.
(card_of_complement): Fix bug due to char overflow.
(get_spec_stats): Don't assume len fits into int.
Check for integer overflow. Use abort() rather than assert(0).
(string2_extend): Fix subscript error: is_char_class_member (..., 255)
was being invoked.
(squeeze_filter): READER is never null now; simplify code.
READER arg now has a simpler type. Remove unnecessary casts.
(squeeze_filter, main): Calls to fwrite improperly checked result
against zero, rather than against requested size.
(plain_read): New function.
(read_and_delete, read_and_xlate):
Remove unused filter arg, and don't worry about hit_eof.
Simplify by using plain_read.
(set_initialize): Args are bool and bool *, not int and SET_TYPE *.
(main): Always pass a non-null procedure to squeeze_filter.
Rewrite so that class_ok isn't needed.
Jim Meyering [Sun, 30 May 2004 20:09:35 +0000 (20:09 +0000)]
*** empty log message ***
Jim Meyering [Sun, 30 May 2004 20:09:24 +0000 (20:09 +0000)]
Work around HPUX /bin/cc compiler bug.
(card_of_complement): Use cleaner `sizeof in_set'
rather than `N_CHARS * sizeof(in_set[0])'. Using HPUX's /bin/cc
(aC++/ANSI C B3910B A.05.55 [Dec 04 2003]) on an ia64-hp-hpux11.22
system, those two expressions are not the same (256 vs. 1024).
The effect of this problem was that `tr -c x y' would fail:
tr: when not truncating set1, string2 must be non-empty
Jim Meyering [Sun, 30 May 2004 08:43:42 +0000 (08:43 +0000)]
*** empty log message ***
Jim Meyering [Sun, 30 May 2004 08:43:35 +0000 (08:43 +0000)]
(dosync): Ignore EBADF errors, as IRIX 6.5
fdatasync reports EBADF when syncing (unwritable) directories.
Problem reported by Albert Chin-A-Young in:
http://lists.gnu.org/archive/html/bug-coreutils/2004-05/msg00165.html
Jim Meyering [Sat, 29 May 2004 22:23:31 +0000 (22:23 +0000)]
.
Jim Meyering [Sat, 29 May 2004 22:12:32 +0000 (22:12 +0000)]
*** empty log message ***
Jim Meyering [Sat, 29 May 2004 22:12:15 +0000 (22:12 +0000)]
remove trailing blank
Jim Meyering [Sat, 29 May 2004 22:09:00 +0000 (22:09 +0000)]
*** empty log message ***
Jim Meyering [Sat, 29 May 2004 22:07:06 +0000 (22:07 +0000)]
*** empty log message ***
Jim Meyering [Sat, 29 May 2004 22:07:03 +0000 (22:07 +0000)]
(rm_option_init): Initialize new member,
Jim Meyering [Sat, 29 May 2004 22:06:25 +0000 (22:06 +0000)]
(rm_option_init): Initialize new member, x->require_restore_cwd.
Jim Meyering [Sat, 29 May 2004 22:05:26 +0000 (22:05 +0000)]
(struct rm_options) [require_restore_cwd]: New member.
Jim Meyering [Sat, 29 May 2004 22:05:01 +0000 (22:05 +0000)]
*** empty log message ***
Jim Meyering [Sat, 29 May 2004 22:04:55 +0000 (22:04 +0000)]
rm -r would get a failed assertion when run from an inaccessible
directory and with two or more command line arguments including an
absolute-named directory followed by a relative-named directory.
(struct cwd_state): Define.
(AD_pop_and_chdir): Redesign interface so that a restore_cwd failure
can be detected by the caller. Instead of returning a malloc'd
directory name, communicate it to caller via a new parameter, and
return an indication of whether restore_cwd failed. Update caller.
Eliminate an unnecessary call to AC_stack_top.
(remove_dir): Change type of cwd_state parameter to `struct cwd_state'
so we can now communicate to caller whether/how functions like
restore_cwd have failed. Update caller.
(rm_1): Fail if we've failed to restore the working directory
and the name of the next file to remove is `.'-relative.
(rm): Fail if the require_restore_cwd flag is true and we've
failed to restore the working directory.
Jim Meyering [Sat, 29 May 2004 22:00:20 +0000 (22:00 +0000)]
*** empty log message ***
Jim Meyering [Sat, 29 May 2004 21:57:31 +0000 (21:57 +0000)]
*** empty log message ***
Jim Meyering [Sat, 29 May 2004 21:57:27 +0000 (21:57 +0000)]
(IS_ABSOLUTE_FILE_NAME, IS_RELATIVE_FILE_NAME): Define.
Jim Meyering [Sat, 29 May 2004 21:13:17 +0000 (21:13 +0000)]
*** empty log message ***
Jim Meyering [Sat, 29 May 2004 21:13:15 +0000 (21:13 +0000)]
(gl_PREREQ_XMALLOC): Require AC_FUNC_CALLOC.
Jim Meyering [Sat, 29 May 2004 21:12:30 +0000 (21:12 +0000)]
.
Jim Meyering [Sat, 29 May 2004 20:46:43 +0000 (20:46 +0000)]
Fix typo: use ls -ldo, not ls -ldg. Patch from Albert Chin.
Jim Meyering [Sat, 29 May 2004 16:53:50 +0000 (16:53 +0000)]
*** empty log message ***
Jim Meyering [Sat, 29 May 2004 16:53:45 +0000 (16:53 +0000)]
(AC_FUNC_CALLOC, _AC_FUNC_CALLOC_IF): New file/macros.
Jim Meyering [Sat, 29 May 2004 16:47:13 +0000 (16:47 +0000)]
New file.
Jim Meyering [Sat, 29 May 2004 11:33:15 +0000 (11:33 +0000)]
(text_buffer_maxend): Remove declarations unused variable.
Jim Meyering [Fri, 28 May 2004 22:31:38 +0000 (22:31 +0000)]
*** empty log message ***
Jim Meyering [Fri, 28 May 2004 22:31:26 +0000 (22:31 +0000)]
(push_dir): Merge declaration and adjacent assignment into a single statement.
Jim Meyering [Fri, 28 May 2004 22:30:40 +0000 (22:30 +0000)]
tweak a comment
Jim Meyering [Fri, 28 May 2004 21:39:59 +0000 (21:39 +0000)]
*** empty log message ***
Jim Meyering [Fri, 28 May 2004 21:39:55 +0000 (21:39 +0000)]
(AD_mark_helper): Eliminate unnecessary comparison.
Jim Meyering [Fri, 28 May 2004 21:27:16 +0000 (21:27 +0000)]
*** empty log message ***
Jim Meyering [Fri, 28 May 2004 21:04:15 +0000 (21:04 +0000)]
*** empty log message ***
Jim Meyering [Fri, 28 May 2004 21:01:53 +0000 (21:01 +0000)]
*** empty log message ***
Jim Meyering [Sat, 22 May 2004 16:30:11 +0000 (16:30 +0000)]
*** empty log message ***
Jim Meyering [Sat, 22 May 2004 16:29:20 +0000 (16:29 +0000)]
(rm): Use free rather than XFREE.
(remove_dir): Use xmalloc, not XMALLOC.
(ds_init): Likewise.
Jim Meyering [Fri, 21 May 2004 14:32:22 +0000 (14:32 +0000)]
*** empty log message ***
Jim Meyering [Fri, 21 May 2004 14:32:20 +0000 (14:32 +0000)]
(TESTS): Add inaccessible.
Jim Meyering [Fri, 21 May 2004 14:28:45 +0000 (14:28 +0000)]
*** empty log message ***
Jim Meyering [Fri, 21 May 2004 13:59:31 +0000 (13:59 +0000)]
# Ensure that rm works even when run from a directory
# for which the user has no access at all.
Jim Meyering [Fri, 21 May 2004 07:50:53 +0000 (07:50 +0000)]
*** empty log message ***
Jim Meyering [Fri, 21 May 2004 07:50:27 +0000 (07:50 +0000)]
update from gnulib
Jim Meyering [Fri, 21 May 2004 07:49:01 +0000 (07:49 +0000)]
*** empty log message ***
Jim Meyering [Fri, 21 May 2004 07:48:44 +0000 (07:48 +0000)]
update from gnulib
Jim Meyering [Fri, 21 May 2004 07:48:32 +0000 (07:48 +0000)]
*** empty log message ***
Jim Meyering [Fri, 21 May 2004 07:45:45 +0000 (07:45 +0000)]
update from gnulib
Jim Meyering [Fri, 21 May 2004 07:44:35 +0000 (07:44 +0000)]
update from gnulib
Jim Meyering [Fri, 21 May 2004 06:41:51 +0000 (06:41 +0000)]
update from gnulib, again
Jim Meyering [Fri, 21 May 2004 06:40:36 +0000 (06:40 +0000)]
*** empty log message ***
Jim Meyering [Fri, 21 May 2004 06:40:31 +0000 (06:40 +0000)]
Update from gnulib (fix reversed test).
Jim Meyering [Thu, 20 May 2004 11:39:58 +0000 (11:39 +0000)]
.
Jim Meyering [Thu, 20 May 2004 11:39:54 +0000 (11:39 +0000)]
Update from gnulib.
Jim Meyering [Thu, 20 May 2004 11:37:11 +0000 (11:37 +0000)]
*** empty log message ***
Jim Meyering [Thu, 20 May 2004 11:37:07 +0000 (11:37 +0000)]
(sc_unmarked_diagnostics): Now that the unmarked
diagnostics in shred.c have been fixed, don't exempt shred.c from
this check.
Jim Meyering [Thu, 20 May 2004 11:35:47 +0000 (11:35 +0000)]
*** empty log message ***
Jim Meyering [Thu, 20 May 2004 11:35:40 +0000 (11:35 +0000)]
Use translatable diagnostics, e.g.
change "%s: remove" to _("%s: failed to remove") and
change "%s: close" to _("%s: failed to close").
Jim Meyering [Thu, 20 May 2004 06:49:55 +0000 (06:49 +0000)]
*** empty log message ***
Jim Meyering [Thu, 20 May 2004 06:49:52 +0000 (06:49 +0000)]
Update from gnulib.
Jim Meyering [Tue, 18 May 2004 15:28:38 +0000 (15:28 +0000)]
*** empty log message ***
Jim Meyering [Tue, 18 May 2004 15:28:27 +0000 (15:28 +0000)]
(names): Bring back lower-case letters, "_", and
".". But continue to omit +, =, %, @, #, as they're either
shell metacharacters (for some shells) or are not in some
character sets, or (in the case of '%') must be a
metacharacter somewhere.
Jim Meyering [Mon, 17 May 2004 13:39:06 +0000 (13:39 +0000)]
*** empty log message ***
Jim Meyering [Mon, 17 May 2004 13:21:40 +0000 (13:21 +0000)]
.
Jim Meyering [Mon, 17 May 2004 13:20:25 +0000 (13:20 +0000)]
Sync with gnulib.
Jim Meyering [Mon, 17 May 2004 13:18:34 +0000 (13:18 +0000)]
Sync with gnulib.
Jim Meyering [Mon, 17 May 2004 13:17:45 +0000 (13:17 +0000)]
Sync with gnulib.
Jim Meyering [Mon, 17 May 2004 13:16:53 +0000 (13:16 +0000)]
(cut_fields): Adjust to new signature of getndelim2.
Jim Meyering [Mon, 17 May 2004 12:34:36 +0000 (12:34 +0000)]
(incname): Decrement `len' only once per loop iteration.
Jim Meyering [Mon, 17 May 2004 12:29:37 +0000 (12:29 +0000)]
*** empty log message ***
Jim Meyering [Mon, 17 May 2004 12:16:16 +0000 (12:16 +0000)]
*** empty log message ***
Jim Meyering [Mon, 17 May 2004 12:15:45 +0000 (12:15 +0000)]
*** empty log message ***
Jim Meyering [Mon, 17 May 2004 12:11:54 +0000 (12:11 +0000)]
.
Jim Meyering [Mon, 17 May 2004 12:11:19 +0000 (12:11 +0000)]
.
Jim Meyering [Mon, 17 May 2004 12:10:55 +0000 (12:10 +0000)]
*** empty log message ***
Jim Meyering [Mon, 17 May 2004 12:10:43 +0000 (12:10 +0000)]
Use -h where necessary to retain semantics.
Jim Meyering [Mon, 17 May 2004 12:08:24 +0000 (12:08 +0000)]
*** empty log message ***
Jim Meyering [Mon, 17 May 2004 12:08:09 +0000 (12:08 +0000)]
chgrp and chown now dereference symlinks by default, per POSIX.
(usage): Update to reflect this.
Jim Meyering [Mon, 17 May 2004 12:07:48 +0000 (12:07 +0000)]
(chopt_init): Affect each symlink referent by default.
Jim Meyering [Mon, 17 May 2004 12:07:30 +0000 (12:07 +0000)]
*** empty log message ***
Jim Meyering [Mon, 17 May 2004 12:07:25 +0000 (12:07 +0000)]
chgrp and chown now dereference symlinks by default, per POSIX.
(chgrp invocation, chown invocation): Document it.
Jim Meyering [Sun, 16 May 2004 21:39:35 +0000 (21:39 +0000)]
chown --dereference did nothing when the owner/group of a
symlink matched the desired owner/group. Reported by David Malone.
Also reported in 1999 as http://bugs.debian.org/39642.
(change_file_owner): When --dereference has
been specified, and when processing a symlink, stat it to get the
owner and group of the referent.
Jim Meyering [Sun, 16 May 2004 19:32:37 +0000 (19:32 +0000)]
*** empty log message ***
Jim Meyering [Sun, 16 May 2004 19:32:30 +0000 (19:32 +0000)]
In shred, check for errors from fdatasync more carefully. If
fdatasync fails with errno==EINVAL, it means this implementation
does not support synchronized I/O for this file. Do not report
this as an error, as (for example) AIX 5.2 fdatasync reports it
for raw disk devices. Problem reported by Albert Chin in
<http://mail.gnu.org/archive/html/bug-gnu-utils/2004-05/msg00028.html>.
Check for write errors, though: the old code ignored them.
Improve error checking in a few other cases, too (e.g., close of a
directory).
Also, change several 'int' values to 'bool', so that the error
checking is a bit clearer. Similarly, change unsigned values
to size_t where appropriate.
* src/shred.c: Include "dirname.h".
(datasync) [!HAVE_FDATASYNC]: Remove.
(dosync): New function.
(dopass): Use it. Return 1 on write error, -1 on other error.
All callers changed. Report write error if dosync does.
(do_wipefd, wipefd, wipename, wipefile): Return bool (true/false),
not int (0/-1). All callers changed. Return false if there's a
write error.
(incname): Return bool (true/false), not int (0/1). Accept
size_t length, not unsigned. All callers changed. Do not
bother checking for non-digits; it can't happen. Replace
recursion with iteration.
(wipename): Use dir_name, base_name, etc. instead of assuming
Unix file names. Use size_t for length, not unsigned.
Report error if unlink or close fails.
(wipename, main): Use bool for booleans.
(names): Use only digits and uppercase letters, for greater
portability.
Jim Meyering [Sun, 16 May 2004 14:18:50 +0000 (14:18 +0000)]
*** empty log message ***
Jim Meyering [Sun, 16 May 2004 14:17:53 +0000 (14:17 +0000)]
*** empty log message ***
Jim Meyering [Sun, 16 May 2004 14:10:17 +0000 (14:10 +0000)]
(TESTS): Add deref.
Jim Meyering [Sun, 16 May 2004 14:10:10 +0000 (14:10 +0000)]
New test for the yesterday's change.
Jim Meyering [Sat, 15 May 2004 18:27:38 +0000 (18:27 +0000)]
*** empty log message ***