summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2004-06-15(parse_obsolescent_option): Support multiple file operandsJim Meyering
even if POSIXLY_CORRECT, since POSIX does not require a diagnostic.
2004-06-15(print_esc): Support \x, \u, \U even if POSIXLY_CORRECT,Jim Meyering
since POSIX says the behavior is unspecified here. (main): Recognize --help, --version even if POSIXLY_CORRECT. POSIX does not specify any options, but it does not prohibit options either, so "printf" is like "expr" here.
2004-06-15Include "hard-locale.h".Jim Meyering
(main): When in a non-POSIX locale, ignore POSIXLY_CORRECT, since POSIX specifies the behavior only in the POSIX locale.
2004-06-15(decode_switches): Pay attention to TABSIZE even if POSIXLY_CORRECTJim Meyering
is set. POSIX reserves upper-case environment variables to the implementation, so it's OK for ls to depend on TABSIZE.
2004-06-14Remove declaration of euidaccess.Jim Meyering
Instead, include "euidaccess.h".
2004-06-13(PIDSTR_DECL_AND_INIT): Don't assume pid_t fits in int.Jim Meyering
(UT_ID) [!HAVE_STRUCT_XTMP_UT_ID]: Remove bogus comment, as (sizeof "??") reliably returns 3. (print_line): Guard against idle and pid being too long (which is possible when printing headers). (print_user): Allocate enough bytes for idlestr. Use IDLESTR_LEN. Avoid unnecessary cast of sizeof to int. (make_id_equals_comment): Do not assume that UT_ID returns a string; it might return a non-null-terminated array. Use strncat instead. It's not very often where strncat is exactly what you want, but this is one of those rare cases.
2004-06-12(list_entries_who): Don't output a trailing space.Jim Meyering
2004-06-09(usage): Improve wording in description of the --time=WORD option.Jim Meyering
2004-06-09(change_file_owner): Change names of parametersJim Meyering
old_uid and old_gid to required_uid and required_gid respectively.
2004-06-09Adjust chmod and chown to be similar if -c or -v are given. InJim Meyering
particular, a no-op chown is no longer reported as a change; this reverts to previous behavior. Also, fix both commands so that -v report failures even if the failure is not due to the chmod or chown syscalls. * src/chown-core.c (change_file_owner): Return -1 on error, not 1 sometimes and -1 on others. Our caller ORs together our results, and (-1 | 1) == 0 on ones-complement hosts. With -v report all errors verbosely, not just some. Fix bug when chopt->root_dev_ino && !chopt->affect_symlink_referent: file_stats wasn't set properly in that case.
2004-06-09(mode_changed): Return false, not 0, now that the function returns `bool'.Jim Meyering
2004-06-09Adjust chmod and chown to be similar if -c or -v are given. InJim Meyering
particular, a no-op chown is no longer reported as a change; this reverts to previous behavior. Also, fix both commands so that -v report failures even if the failure is not due to the chmod or chown syscalls. * src/chmod.c (CH_NOT_APPLIED): New constant. (describe_change): Handle it. (process_file): Use it, if a symlink wasn't changed. (mode_changed): Return bool, not int. Accept new argument NEW_MODE; all callers changed. This lets us avoid statting the file unless the new mode has unusual bits. (process_file): Return -1 on error. With -v, report all errors verbosely, not just some.
2004-06-08.Jim Meyering
2004-06-08.Jim Meyering
2004-06-08(change_file_owner): Use ent->fts_statp only ifJim Meyering
needed. Chown a directory only after chowning its children; this avoids problems if the new directory ownership doesn't permit access to the children. Dereference symlinks before doing ROOT_DEV_INO_CHECK, not after, so that we catch symlinks to /. Do not optimize away the chown() system call when the file's owner and group already have the desired value. POSIX does not permit this optimization. Rely on chown and lchown to do the right thing with symlinks and/or -1 arguments, now that we have wrappers to do this. Use ENOTSUPP not ENOSYS, and ignore all ENOTSUPP errors, not just command-line errors. (chown_files): Pass FTS_STAT to xfts_open if we don't need file status.
2004-06-08(main): Check for incompatible options. -R --dereferenceJim Meyering
requires either -H or -L, and -R -h requires -P. If -H, specify FTS_PHYSICAL as well as FTS_COMFOLLOW; this is faster. Make this file as much like chown.c as possible.
2004-06-08(main): Check for incompatible options. -R --dereferenceJim Meyering
requires either -H or -L, and -R -h requires -P. If -H, specify FTS_PHYSICAL as well as FTS_COMFOLLOW; this is faster. Make this file as much like chgrp.c as possible.
2004-06-08(ENOTSUP): Remove.Jim Meyering
2004-06-08(main): Fix typo introduced on 2003-05-10 thatJim Meyering
prevented a diagnostic of any operands.
2004-06-08.Jim Meyering
2004-06-08(direct_mode): Turn it on/off with directio, too.Jim Meyering
2004-06-07Enable direct-mode I/O (bypassing the buffer cache), if possible.Jim Meyering
Prompted by a suggestion from Kalle Olavi Niemitalo in http://bugs.debian.org/207035. (direct_mode): New function. (do_wipefd): Turn on direct-mode I/O. (dopass): If a file's first write fails with EINVAL, turn off direct-mode I/O and retry the write.
2004-06-06fix typo in commentJim Meyering
2004-06-06(main): "tr -d a b" is now a fatal error even if POSIXLY_CORRECT is set.Jim Meyering
The POSIX SYNOPSIS does not allow this option combination.
2004-06-04(dopass): Don't subtract 1 from the offset afterJim Meyering
a write error. Problem reported by Jon Peatfield in: http://lists.gnu.org/archive/html/bug-coreutils/2004-06/msg00020.html
2004-06-03Fix bug reported by Buciuman Adrian inJim Meyering
<http://mail.gnu.org/archive/html/bug-coreutils/2003-08/msg00105.html> where 'dd' created a file that was too large. The bug was that dd assumed that the input file offset does not advance after a failed read; but POSIX says that the input file offset is undefined after a failed read. (MAX_BLOCKSIZE): New macro. (input_seekable, input_seek_errno, input_offset, input_offset_overflow): New vars. (scanargs): Reject block sizes greater than MAX_BLOCKSIZE. (advance_input_offset): New function. (skip_via_lseek): Set errno to zero when reporting our failure, so that we don't report based on garbage errno. (skip): If fdesc is standard input, advance the input offset. Do not quit if reading, and if noerror was specified; POSIX seems to require this. If read fails on output file, report the earlier lseek failure instead; this fixes a FIXME in dd_copy. (advance_input_after_read_error): New function. (dd_copy): Use it, instead of assuming that failed reads do not advance the file pointer. Advance input offset after nonfailed reads. Advance only a partial block if the previous read (before the failed read) succeeded, and do not generate an output block of zeros in this case. (main): Determine initial input offset, seekability of input, and error if it wasn't seekable.
2004-06-02rm (without -f) could hang unnecessarily when attempting toJim Meyering
remove a symlink to a file on an off-line NFS-mounted partition. Reported by David Howells in https://bugzilla.redhat.com/124699. (write_protected_non_symlink): New function. Don't invoke euidaccess on symlinks. (prompt): Use write_protected_non_symlink rather than using euidaccess directly, being careful not to call lstat twice for a file.
2004-06-02Fix a bug in how the --output-delimiter=D option works withJim Meyering
abutting byte or character ranges. Reported by David Krider in http://lists.gnu.org/archive/html/bug-coreutils/2004-05/msg00132.html (print_kth): Remove special case for open-ended range. (set_fields): Record the range start index for an interval even when it abuts another interval on its low side. Also record the range start index of the longest right-open-interval.
2004-06-02(posix_pedantic): Remove; no longer needed sinceJim Meyering
we need to test this in just one place now. (usage): Mention -C. (unquote): Note that \055, \n, etc are escaped. Do not worry about POSIXLY_CORRECT when warning about ambiguous escape sequences. \ at end of string stands for itself. Do not diagnose invalid backslash escapes: POSIX says the behavior is unspecified in this case, so we don't need to diagnose it. (main): Add support for -C (currently an alias for -c). Do not diagnose 'tr [:upper:] [:upper:], as POSIX does not require a diagnostic here.
2004-06-01.Jim Meyering
2004-06-01(main): Update use of xreadlink.Jim Meyering
2004-06-01(print_stat): Update use of xreadlink.Jim Meyering
2004-06-01(get_link_name): Update use of xreadlink.Jim Meyering
2004-06-01(copy_internal): Don't use alloca, as it can mess upJim Meyering
royally if the link length is long (e.g., GNU/Hurd). Use xreadlink instead, it's safer. Don't bother to read the link if it's the wrong size. Add a FIXME because this area is a bit murky and undocumented.
2004-06-01(binary_operator, and, or, main):Jim Meyering
Prefer the notation `STREQ (a, b)' over `!strcmp (a, b)' and `STREQ (a, b)' over `strcmp (a, b) == 0'.
2004-06-01(main): Prefer the notation `STREQ (a, b)' over `!strcmp (a, b)'.Jim Meyering
2004-06-01(swallow_file_in_memory, main):Jim Meyering
Prefer the notation `STREQ (a, b)' over `strcmp (a, b) == 0'.
2004-06-01(correct_password, restricted_shell, main):Jim Meyering
Prefer the notation `STREQ (a, b)' over `strcmp (a, b) == 0'.
2004-06-01(main): Prefer the notation `STREQ (a, b)' over `strcmp (a, b) == 0'.Jim Meyering
2004-06-01(batch_convert): Prefer the notation `STREQ (a, b)' over `strcmp (a, b) == 0'.Jim Meyering
2004-06-01(nextarg): Prefer the notation `STREQ (a, b)' over `strcmp (a, b) == 0'.Jim Meyering
2004-06-01(main, sort_buffer_size): Use STREQ (a, b) rather than `strcmp (a, b) == 0'Jim Meyering
2004-06-01(V9_ECHO): Remove; always enabled.Jim Meyering
(DEFAULT_ECHO_TO_XPG): Renamed from V9_DEFAULT, so that we use the same naming convention as bash. Now an enum, not a macro. (usage): Reword to mention -e/-E more accurately. Mention \0NNN (the POSIX syntax) rather than \NNN (nonstandard). (hextobin): New function. (main): Use bool rather than int for local vars when appropriate. Do not allow options if POSIXLY_CORRECT, unless we are using BSD semantics and the first argument is "-n". Don't pass unnecessary extra arg to parse_long_options. do_v9 now defaults to DEFAULT_ECHO_TO_XPG, not to allow_options. Do not look for options if !allow_options. Use size_t rather than int when appropriate. Open-code option test rather than using strrchr. Use faster test for "-". Avoid redundant argc test. Add support for \x, for Bash compatibility. Use e.g. '\a' rather than '\007', for portability to EBCDIC hosts. When '\c' is encountered, stop printing immediately, as POSIX requires. Add support for \xhh syntax. Add support for \0ooo syntax; POSIX requires this.
2004-06-01.Jim Meyering
2004-05-31(set_initialize): Remove unnecessary initialization of the `in_set'Jim Meyering
buffer; that initialization triggered the same compiler bug as above.
2004-05-31tr cleanup, mostly having to do with integer type ranges.Jim Meyering
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.
2004-05-30Work around HPUX /bin/cc compiler bug.Jim Meyering
(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
2004-05-30(dosync): Ignore EBADF errors, as IRIX 6.5Jim Meyering
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
2004-05-29.Jim Meyering
2004-05-29(rm_option_init): Initialize new member,Jim Meyering