1 2004-08-11 Paul Eggert <eggert@cs.ucla.edu>
3 * tests/install/basic-1: Test for the -d regression.
5 2004-08-11 Dmitry V. Levin <ldv@altlinux.org>
7 * src/install.c (main): Fix -d regression introduced with
8 --target-directory support at 2004-06-25.
10 2004-08-11 Paul Eggert <eggert@cs.ucla.edu>
12 * src/copy.c (copy_internal): When preserving links, unlink
13 a destination with link count greater than one. This is so
14 that commands like "cp -a" don't get confused when copying into
15 a destination that already contains many hard links. Problem
16 reported by Tim Waugh in:
17 http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00053.html
19 2004-08-10 Paul Eggert <eggert@cs.ucla.edu>
21 Convert all files to UTF-8.
22 * tests/fmt/basic (8-bit-pfx): Use UTF-8, not Latin-1.
23 * tests/sort/Test.pm (16a): Likewise.
24 * tests/uniq/Test.pm (8): Likewise.
25 * tests/misc/printf-hex: Use ASCII, not Latin-1.
27 * NEWS: Document "sort -o -" and "tee -" POSIX-conformance fixes.
28 * src/shred.c (usage): "-" is an operand, not an option.
29 * src/sort.c (die, xfopen, mergefps, first_same_file, merge):
30 A null file arg means standard output.
31 (main): "-o -" means to write to a file named "-",
32 not to standard output.
33 * src/tee.c (usage, tee): "tee -" writes to standard output, not
36 2004-08-10 Dmitry V. Levin <ldv@altlinux.org>
38 * src/install.c (change_timestamps): Fix int->bool conversion
39 bugs introduced on 2004-07-29.
41 2004-08-09 Paul Eggert <eggert@cs.ucla.edu>
43 * src/shred.c (wipename): Work even if the directory is writeable
44 and not readable. Prefer write access, since this should work
45 better with fdatasync.
47 * src/csplit.c (xalloc_die): New function.
48 (main): Remove now-obsolete initialization of xalloc_fail_func.
50 * src/md5sum.c: Adjust to sha->sha1 renaming.
52 2004-08-08 Dmitry V. Levin <ldv@altlinux.org>
55 * src/readlink.c (canonicalize_fname): Remove unneeded proxy function.
56 (can_mode): Make variable local.
58 2004-08-07 Paul Eggert <eggert@cs.ucla.edu>
60 * src/system.h (O_BINARY) [!O_BINARY && defined O_BINARY]:
61 Do not define, to avoid annoying compiler messages on QNX 6.3.
62 Problem reported by Johan in:
63 http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00050.html
65 2004-08-04 Paul Eggert <eggert@cs.ucla.edu>
67 * src/system.h (PRIdMAX, PRIoMAX, PRIuMAX, PRIxMAX):
68 Define to a concatenation of string literals, not to an expression;
69 needed for concatenation contexts.
70 (INTMAX_MAX, INTMAX_MIN): New macros.
72 * src/stat.c (print_stat): Don't assume st_ino / st_dev fits in
73 unsigned long; this isn't true for st_ino on Solaris 9.
75 2004-08-03 Paul Eggert <eggert@cs.ucla.edu>
77 * src/uname.c: Do not depend on HAVE_SYSCTL when deciding
78 whether to include files. Include <sys/param.h> if
79 HAVE_SYS_PARAM_H (not HAVE_SYSCTL).
80 (main) [defined __POWERPC__]: Add a kludge to work around a
81 Mac OS X bug, so that uname -p defaults to "powerpc" if
82 sysctl ((int[]) {CTL_HW, HW_MACHINE_ARCH}, 2, buffer, &bufsize, 0, 0)
83 fails. Problem reported by Petter Reinholdtsen in:
84 http://lists.gnu.org/archive/html/bug-gnu-utils/2003-02/msg00201.html
86 * src/uniq.c (hard_LC_COLLATE, ignore_case, different, check_file,
87 main): Use bool for booleans.
88 (writeline, check_file): Use uintmax_t for line counts.
89 (check_file): Check for and report line number overflow,
91 * src/wc.c (iswspace, wc): Use to_uchar rather than a cast.
92 (print_lines, print_words, print_chars, print_bytes, print_linelength,
93 have_read_stdin, wc, wc_file, main):
94 Use bool for booleans.
95 (exit_status): Remove.
96 (wc, wc_file): Return bool status. All callers changed.
97 * src/who.c (scan_entries): 0 -> STDIN_FILENO.
98 * src/whoami.c (main): Print uids using unsigned long int, not
101 * src/unexpand.c: Int cleanup and minor reorganization to be more
103 Include quote.h, xstrndup.h.
104 (TAB_STOP_SENTINEL): Increase from INT_MAX to INTMAX_MAX.
105 (convert_entire_line, have_read_stdin, parse_tabstops, next_file,
107 Use bool for booleans.
108 (tab_size, tab_list, add_tabstop, validate_tabstops, unexpand):
109 Use uintmax_t for column counts.
110 (first_free_tab, validate_tabstops, unexpand): Use size_t for sizes.
111 (add_tabstop, parse_tabstops, main): Don't reserve UINTMAX_MAX
113 (parse_tabstops): Don't use ISBLANK on possibly-signed char.
114 Detect overflow in tab stop string.
115 (next_file, main): Use EXIT_FAILURE/EXIT_SUCCESS instead of 1/0.
116 (unexpand): Concatenate input files the same way expand does.
118 * src/touch.c (no_create, use_ref, posix_date, amtime_now,
119 touch, main): Use bool for booleans.
120 (main): Avoid integer overflow when given more than INT_MAX
122 * src/tsort.c (struct item, n_strings): Use size_t for sizes.
123 (have_read_stdin, count_items, scan_zeros, detect_loop,
124 recurse_tree, walk_tree, tsort, main):
125 Use bool for booleans.
126 (exit_status): Remove.
127 (tsort): Return a success flag instead of storing into a global.
129 * src/tty.c (silent, main): Use bool for booleans.
130 (main): 0 -> STDIN_FILENO.
131 * src/uname.c (print_element): Use bool for booleans.
133 * src/test.c (TRUE, FALSE, SHELL_BOOLEAN, TRUTH_OR, TRUTH_AND):
134 Remove. All uses replaced by C99 boolean primitives.
135 (TEST_TRUE, TEST_FALSE): New constants, for readability.
136 (test_unop, binop, unary_operator, binary_operator, two_arguments,
137 three_arguments, posixtest, expr, term, and, or, is_int, age_of,
138 one_argument, main): Use bool for booleans.
139 (advance, unary_advance): Now inline procedures rather than a macros.
140 (is_int): Renamed from isint, to avoid namespace clash with ctype.h.
141 (term, and, or): When it's easy, loop instead of recursing.
142 (term): Avoid integer overflow if there are INT_MAX-3 args (!).
143 (binary_operator, unary_operator): Simplify by systematically rewriting
144 true==FOO to FOO (where FOO is a boolean).
145 (unary_operator): Don't consider a file to be a regular file
146 merely because its mode&S_IFMT is zero. Just use S_ISREG.
147 Remove unnecessary casts. Remove ifdefs for things like
148 S_ISSOCK that are no longer needed, since stat-macros.h always
151 * src/tac-pipe.c (buf_init_from_stdin, find_bol, tac_mem):
152 Use bool for booleans.
153 (buf_init_from_stdin, buf_free, find_bol, print_line):
154 Use size_t for sizes.
155 * src/tac.c (separator_ends_record, tac_seekable, tac_file,
156 tac_stdin, tac_stdin_to_mem, main): Use bool for booleans.
157 (match_length, G_buffer_size, tac_seekable, main): Use size_t for sizes.
158 (tac_seekable): Use ptrdiff_t for pointer subtraction.
159 Report an error if the result is out of range.
160 (tac_seekable, main): Check for integer overflow in buffer size
162 (main): Remove unnecessary casts.
164 * src/su.c (run_shell): Pass a new n_additional_args arg, so that
165 the callee doesn't have to count 'em. All callers changed.
166 Don't allocate more space for the arg vector than we'll need.
167 Use memcpy to copy the args rather than rolling our own loop.
168 Use size_t for sizes.
169 (fast_startup, simulate_login, change_environment, log_su,
170 correct_password, restricted_shell, main): Use bool for booleans.
171 (longopts): Don't assume change_environment is an int.
172 Use NULL, not 0, for pointers.
173 (xsetenv): New function, replacing xputenv and concat.
175 (elements): Remove; no longer needed.
176 (log_su, correct_passwd, main): Prefer !x to x==NULL.
177 (log_su): 2 -> STDERR_FILENO.
178 (modify_environment, main): Don't assume that getenv's returned value
179 has an indefinite lifetime.
180 (modify_environment): Allocate a larger environ.
181 (main): Remove an impossible 'case 0'; if it happens now, it'll
182 get diagnosed. Don't assume getpwnam results outlive endpwent.
183 Check for null or empty pw_name, pw_dir and for null pw_passwd.
185 * src/stty.c (VA_START): Remove. All callers now use va_start.
186 (_POSIX_VDISABLE): Remove unnecessary cast.
187 (struct control_info, visible): Use cc_t for control chars.
188 (struct control_info): Use size_t for sizes.
189 (recover_mode, set_mode, display_speed, display_window_size,
190 valid_options, main, display_changed):
191 Use bool for booleans.
192 (integer_arg): Return unsigned long int, not long int.
193 Accept new max arg; all callers changed, to specify a maximum
194 value for integer parameters instead of silently overflowing.
195 (wrap): Do not overrun the stack buffer if the output contains
196 more than 1024 bytes. Instead, malloc a buffer.
197 (main): Remove a "what is this?!?" FIXME. Nobody knows what it is.
198 Remove unnecessary casts.
199 (set_control_char): Allow int values only up to cc_t range.
200 (screen_columns): Don't reject INT_MAX.
201 (display_changed, display_all, display_speed, recover_mode):
202 Don't assume cc_t fits in int.
204 * src/remove.h: Add copyright notice.
205 (struct rm_options): Use bool for booleans.
206 * src/rmdir.c (empty_paths, ignore_fail_on_non_empty, verbose,
207 errno_rmdir_non_empty, remove_parents, main): Likewise.
208 * src/sum.c (have_read_stdin, bsd_sum_file, sysv_sum_file,
210 (main): Don't dump core if invoked with argv[0]==NULL.
211 * src/tee.c (tee, append, ignore_interrupts, main, tee):
212 Use bool for booleans.
213 (tee): Use ssize_t for read returns.
215 * src/ptx.c: Add a FIXME mentioning that there are many
216 unchecked integer overflows in this file.
217 (gnu_extensions, auto_reference, input_reference, right_reference,
218 ignore_case, initialize_regex, fix_output_parameters,
219 output_one_roff_line, output_one_text_line, output_one_dumb_line, main):
220 Use bool for booleans.
221 (SKIP_SOMETHING, compare_words, digest_break_file,
222 find_occurs_in_text, fix_output_parameters):
223 Use to_uchar instead of a caset.
224 (print_field): Rewrite to avoid cast.
226 * src/printf.c (posixly_correct): Use bool for booleans.
227 (verify, main): Use EXIT_FAILURE/EXIT_SUCCESS instead of 1/0.
228 (STRTOX): Rewrite to avoid casts.
229 (print_esc_char): Arg is char, not int.
230 * src/readlink.c (canonicalize): Remove. All uses now merely inspect
232 (no_newline, verbose): Use bool for booleans.
233 (can_mode): Now of type int; use -1 to denote otherwise-uninitialized.
234 * src/shred.c (struct Options, main): Use bool for booleans.
235 (isaac_seed_data, fillpattern, wipefile): Rewrite to avoid casts.
236 * src/split.c (cwrite, bytes_split, lines_split, line_bytes_split):
237 Use bool for booleans.
238 * src/stat.c (G_fail): Remove.
239 (print_statfs): Print various gotta-be-nonnegative values using
240 unsigned long int, not long int or int.
241 (do_statfs, do_stat): Return a boolean success flag.
242 (do_stat, main): Use bool for booleans.
244 * src/pr.c: Add a FIXME mentioning that there are many
245 unchecked integer overflows in this file.
246 (TRUE, FALSE): Remove. All uses replaced by true and false.
247 (struct COLUMN, read_line, print_page, print_stored, open_file,
248 skip_to_page, init_fps, parallel_files, align_empty_cols,
249 empty_line, FF_only, explicit_columns, extremities, keep_FF,
250 print_a_FF, print_a_header, use_form_feed, have_read_stdin,
251 print_across_flag, storing_columns, balance_columns,
252 truncate_lines, join_lines, untabify_input, failed_opens,
253 numbered_lines, skip_count, use_esc_sequence, use_cntrl_prefix,
254 double_space, ignore_failed_opens, use_col_separator,
255 pad_vertically, last_line, main, init_parameters, skip_read,
256 read_line, print_stored):
257 Use bool for booleans.
258 (struct COLUMN, char_to_clump, store_char, print_char):
260 (clump_buff, print_clump): Use char[], not int[], for an array whose
261 elements are always chars.
262 (first_last_page, main, getoptarg, balance, add_line_number,
263 char_to_uclump): Remove unnecessary casts.
264 (init_parameters): Allocate chars, not ints, for clump_buff.
265 (print_char): Use to_uchar before invoking ISPRINT.
266 (char_to_clump): Convert to unsigned char before invoking ISPRINT.
268 * src/nohup.c (main): Use bool for booleans.
269 * src/paste.c (paste_parallel, paste_serial, main): Likewise.
270 * src/pathchk.c (validate-path, main, portable_chars_only): Likewise.
271 (portable_chars_only): Use to_uchar rather than a cast.
272 * src/printenv.c (main): Use bool for booleans.
273 Do not assume that the environ has at most one matching entry
274 for each option (integer overflow was possible otherwise).
276 * src/od.c (FMT_BYTES_ALLOCATED): Now an enum, not a decimal
277 constant. Do not assume PRIdMAX etc. are strings of length 3 or
279 (struct tspec): Use it. fmt_string is now an array, not
280 a pointer, as there's little point to the indirection here.
281 (struct tspec, flag_dump_strings,
282 traditional, flag_pseudo_start, limit_bytes_to_format,
283 abbreviate_duplicate_blocks, have_read_stdin, simple_strtoul,
284 decode_one_format, open_next_file, check_and_close,
285 decode_format_string, skip, write_block, read_char, read_block,
286 parse_old_offset, dump, dump_strings, main):
287 Use bool for booleans.
288 (struct tspec): Use void *, not char *, for generic pointers.
289 (bytes_to_oct_digits, bytes_to_signed_dec_digits,
290 bytes_to_unsigned_dec_digits, bytes_to_hex_digits):
291 Use char, not unsigned int, since char suffices.
292 (print_s_char, print_char, print_s_short, print_short,
293 print_int, print_long, print_long_long, print_float,
294 print_double, print_long_double): Rewrite to avoid casts.
295 These now take void * arguments, instead of char *.
296 Use the same body for all functions, except for the choice
297 of type. Assume C89 to simplify handling of signed char.
298 (dump_hexl_mode_trailer, print_named_ascii, print_ascii):
299 Rewrite to avoid casts.
300 (print_named_ascii, print_ascii): Now takes void *, not char *.
301 (decode_one_format): Use int for printf field widths, not
302 unsigned int. Pass void * to subsidiary printers,
303 not char *. Simplify handling of floating-point formats
304 by factoring out common code dealing with precision and field width.
305 (decode_format_string): Avoid need for temporary copy of
306 each decoded struct tspec.
307 (get_lcm): Remove unnecessary cast.
308 (main): Fix bug where more than INT_MAX failed decodes were ignored.
310 2004-08-02 Paul Eggert <eggert@cs.ucla.edu>
312 * src/nl.c (TRUE, FALSE): Remove; all uses changed to true, false.
313 (enum number_format): Remove.
314 (FORMAT_RIGHT_NOLZ, FORMAT_RIGHT_LZ, FORMAT_LEFT): Now strings,
316 (DEFAULT_SECTION_DELIMITERS): Now an array constant, not a macro.
317 (section_del): Now const.
319 (starting_line_number, page_incr, blank_join, line_no,
320 print_lineno, proc_text, main):
321 Use intmax_t for line numbers.
322 (reset_numbers, have_read_stdin, build_type_arg, nl_file, main):
323 Use bool for booleans.
324 (lineno_format): Now a string, not an enum value.
325 (build_print_fmt): Remove. All calls removed. This work is
326 now done within print_lineno.
327 (build_type_arg): Use size_t for sizes.
328 (print_lineno): Check for line number overflow.
329 (proc_text, main): Remove unnecessary cast.
331 * src/ln.c (symbolic_link, interactive, remove_existing_files,
332 verbose, hard_dir_link, dereference_dest_dir_symlinks,
333 do_link, main): Use bool for booleans.
335 * src/ls.c (struct fileinfo, file_interesting,
336 extract_dirs_from_files, color_symlink_as_referent,
337 FILE_OR_LINK_MODE, sort_reverse, print_owner, print_group,
338 numeric_ids, print_block_size, dired, print_with_color,
339 check_symlink_color, print_inode, recursive, immediate_dirs,
340 all_files, really_all_files, qmark_funny_chars,
341 print_dir_name, format_needs_stat, format_needs_type, visit_dir,
342 main, decode_switches, parse_ls_color, print_dir, file_interesting,
343 gobble_file, make_link_path, basename_is_dot_or_dotdot,
344 extract_dirs_from_files, print_long_format):
345 Use bool for booleans.
346 (dir_defaulted): Remove; no longer needed.
347 (main): Use int to count files, since it suffices for argv.
348 Rewrite to avoid need for dir_defaulted.
349 (main, print_dir, gobble_file, get_link_name,
351 Set exit status to EXIT_SUCCES/EXIT_FAILURE rather than 0/1.
352 (decode_switches): Put back check for ws.ws_col <= SIZE_MAX.
353 Remove unnecessary cast to int. Use int instead of unsigned
354 int to count from 0 to 1.
355 (get_funky_string, print_type_indicator): Use char for bytes, not int.
356 (make_link_path): Use NULL for null pointers.
357 (quote_name): Use to_uchar instead of cast.
359 * src/id.c (use_name, main, print_user, xgetgroups, print_group_list,
360 print_full_info): Use bool for booleans.
361 (problems): Remove, replacing with....
362 (ok): New var (inverted from old sense).
363 (print_user, print_group, print_full_info):
364 Print uids/gids with %lu, not %u.
365 (xgetgroups): Don't run out of memory if getgroups or getugroups
367 * src/setuidgid.c (main): Print uids/gids with %lu, not %ld.
369 * src/factor.c (wheel_tab): Use unsigned char instead of unsigned
370 int, since it suffices.
371 (factor, print_factors): Use size_t for sizes.
372 (print_factors, do_stdin, main): Use bool for booleans.
373 * src/fold.c (TAB_WIDTH): New macro; use it instead of "8".
374 (fold_file, main): Use bool for booleans.
375 (fold_file, main): Use size_t for sizes.
376 (main): Allow -w options up to SIZE_MAX - TAB_WIDTH - 1, instead
377 of prohibiting widths greater than INT_MAX.
378 * src/head.c (presume_input_pipe, print_headers, have_read_stdin,
379 write_header, elide_tail_bytes_pipe, elide_tail_bytes_file,
380 elide_tail_lines_pipe, elide_tail_lines_seekable,
381 elide_tail_lines_file, head_bytes, head_lines, head, head_file,
382 string_to_integer, main):
383 Use bool for booleans.
384 (main): Rewrite to avoid cast.
386 * src/csplit.c (struct line): Use size_t for sizes.
387 (main): Remove unnecessary cast.
388 * src/cut.c (cut_fields): Use to_uchar rather than a cast.
389 * src/cut.c (cut_file, main): Use bool for booleans.
390 * src/date.c (show_date, rfc_format, batch_convert, main): Likewise.
391 * src/env.c (main): Likewise.
392 * src/expr.c (nextarg): Likewise.
393 * src/env.c (main): Remove unused and nonstandard envp arg.
395 * src/fmt.c (COST, MAXWORDS): Add a comment describing some of
396 fmt's arbitrary limits.
397 (TRUE, FALSE): Remove; all uses changed to (true, false).
398 (main): Use bool for booleans.
399 Limit maximum width to MAXCHARS / 2. Use xstrtoul, not xstrtol,
401 (copy_rest): Remove unnecessary cast.
402 (get_prefix): Rewrite to avoid cast.
403 (check_punctuation): Use char *, not unsigned char *; C89 requires
404 this. Avoid off-by-one buffer read overrun when line is empty.
405 (flush_paragraph): Don't assume wptr-parabuf is <= INT_MAX.
406 Remove unnecessary casts.
407 * tests/fmt/basic (wide-1, wide-2, bad-suffix): Adjust to above
410 * src/expand.c (convert_entire_line, have_read_stdin, parse_tabstops,
411 next_file, expand, main):
412 Use bool for booleans.
413 (tab_size, tab_list, add_tabstop, parse_tabstops, validate_tabstops,
415 Use uintmax_t for column counts.
416 (add_tabstop): Don't reserve -1 (now UINTMAX_MAX) as a special value.
418 (parse_tabstops): Don't pass a negative char to isblank.
419 Avoid memory leak with large tab stops.
420 (validate_tabstops, expand): Don't assume number of tab stops is
422 (next_file, main): Use EXIT_SUCCESS/EXIT_FAILURE rather than 0/1 when
423 storing values into exit_status.
424 (expand): Use same pattern as unexpand for reading chars.
425 Report an error when input line is too long, instead of silently
426 screwing up. Do not mishandle tab stops when backspacing left
429 * src/dircolors.c (have_read_stdin, append_quoted,
430 dc_parse_stream, dc_parse_file, main): Use bool for booleans.
431 (dc_parse_stream): Use enum for state, rather than int.
432 Use ssize_t to store getline result.
434 * src/dd.c (translation_needed, parse_integer, scanargs,
435 apply_translations, char_is_saved, swab_buffer, skip_via_lseek):
436 Use bool for booleans.
437 (translate_buffer): Use to_uchar rather than a cast.
438 (swab_buffer, copy_simple, copy_with_unblock):
439 Use size_t for sizes.
441 * src/seq.c (equal_width, valid_format, main): Use bool for booleans.
442 * src/sleep.c (apply_suffix): Likewise.
443 * src/tail.c (struct File_spec, reopen_inaccessible_files, count_lines,
444 forever, from_start, print_headers, have_read_stdin, valid_file_spec,
445 write_header, file_lines, pipe_lines, pipe_bytes, recheck,
446 tail_forever, tail_bytes, tail_lines, tail, tail_file,
447 parse_obsolescent_option, parse_options, main): Likewise.
448 * src/sleep.c (apply_suffix): Invert sense of result.
449 Use int (not unsigned int) for multiplier, as this generates better
450 code with some compilers. Simplify code a bit.
451 * src/tail.c (struct File_spec, max_n_unchanged_stats_between_opens,
452 parse_options): Use uintmax_t, not unsigned int or unsigned long int,
454 (tail_bytes, tail_lines): Redo test of return value (-1, 0, 1) to
455 make it a bit clearer.
457 * src/hostname.c: Include "xgethostname.h".
458 (xgethostname): Remove decl; xgethostname.h has it.
459 (sethostname) [!defined(HAVE_SETHOSTNAME) && defined(HAVE_SYSINFO)
460 && defined (HAVE_SYS_SYSTEMINFO_H) && defined(HAVE_LIMITS_H)]: Use
461 prototypes rather than K&R form. Assume any negative value from
462 sysinfo denotes failure, not just -1.
463 (main): Simplify use of sethostname.
465 * src/pinky.c (include_idle, include_heading, include_fullname,
466 include_project, include_plan, include_home_and_shell, do_short_format,
467 include_where, main): Use bool for booleans.
468 (count_ampersands, create_fullname, scan_entries, short_pinky):
469 Use size_t for sizes.
470 (create_fullname): Check for overflow in size calculations.
471 (idle_string): Don't assume that the number of idle days
472 is less than 10**8 and/or INT_MAX/(24*60*60).
473 (main): No need to pass a non-NULL last arg to getopt_long.
474 * src/uptime.c (print_uptime, uptime): Use size_t for sizes.
475 (print_uptime): Remove unused local variable.
476 (main): No need to pass a non-NULL last arg to getopt_long.
477 * src/users.c (list_entries_users, users): Use size_t for sizes.
478 (list_entries_users): Use char for bytes.
479 (main): No need to pass a non-NULL last arg to getopt_long.
480 * src/who.c (do_lookup, short_list, short_output, include_idle,
481 include_heading, include_mesg, include_exit, need_boottime,
482 need_deadprocs, need_login, need_initspawn, need_clockchange,
483 need_runlevel, need_users, my_line_only, main): Use bool for booleans.
484 (print_runlevel): Use unsigned char for bytes.
485 (list_entries_who, scan_entries, who): Use size_t for sizes.
486 (main): No need to pass a non-NULL last arg to getopt_long.
488 * src/install.c (isdir): Remove decl.
489 (install_file_to_path): Rely on make_path to fail if the destination
490 is not a directory, by passing preserve_existing==true to it.
491 Hence we no longer need to call isdir.
492 Free dest_dir immediately when it's no longer needed, rather than
493 waiting until the end of the function.
494 (copy_file): Don't bother calling isdir, as copy will do the
495 right thing if the destination is a directory.
497 * src/du.c (fts_debug, opt_all, apparent_size, opt_count_all,
498 print_grand_total, opt_separate_dirs, hash_ins, process_file, main):
499 Use bool for booleans.
500 (max_depth): Now size_t, not int, to avoid an arbitrary limit
502 (G_fail): Remove: no longer needed, now that the relevant
503 functions return bool.
504 (process_file): Use return value to signal success rather than
505 setting a global. Remove first_call static var; not needed, since
506 we can look at n_alloc. Use size_t for depths. Remove FIXME
507 about size_t casts, as it's now fixed. Use xnrealloc rather
508 than the obsolescent XREALLOC. Don't bother to check whether
509 reallocation is needed unless level > prev_level.
510 (du_files): Invert sense of result, for consistency with
511 other coreutils code. All callers changed.
512 (main): Allow --max-depth values up to SIZE_MAX.
514 * src/df.c (inode_format, show_all_fs, show_local_fs,
515 show_listed_fs, posix_format, require_sync, print_type,
516 selected_fstype, excluded_fstype, show_dev, show_point, main):
517 Use bool for booleans.
518 (df_readable, show_dev): Use UINTMAX_MAX instead of -1.
519 (show_dev, show_point, main):
520 Use EXIT_SUCCESS/EXIT_FAILURE instead of 0/1.
521 Don't assume disk name lengths are <= INT_MAX.
522 Rewrite pct calculation to avoid cast.
523 (show_point): Don't assume resolved length is <= SSIZE_MAX.
525 * src/cut.c (hash_int) [!defined UINTPTR_MAX]: Use size_t
526 instead of uintptr_t.
527 * src/shred.c (UINT_MAX_32_BITS): Remove.
528 (word32): Remove. All uses changed to uint32_t.
529 (isaac_seed_data): Remove unnecessary cast.
530 * src/system.h (ptr_align): Use size_t; in practice, this is just as
531 good as uintptr_t in checking for alignments, and has fewer
532 configuration hassles.
534 * src/Makefile.am (localedir.h): Make it readonly; this
535 undoes part of the 2004-07-27 patch.
537 2004-07-30 Paul Eggert <eggert@cs.ucla.edu>
539 * src/sort.c (UCHAR): Remove; all uses changed to to_uchar.
540 (IS_THOUSANDS_SEP): Use bool when appropriate.
541 (numcompare, main): Use char, not int, when the value is always a char.
542 (numcompare): Remove "register"; compilers are smart enough these days.
543 * src/system.h (errno, CHAR_BIT): Remove decls;
544 no longer needed now we assume C89 or better.
545 Include <inttypes.h> before <stdint.h>, as it's the
546 Autoconf-recommended pattern.
547 (to_uchar): New inline function, moved here from tr.c.
548 Use full names for int types, e.g. "long int" rather than "long".
549 * src/tr.c (to_uchar): Remove; now in system.h.
550 (is_char_class_member): Use bool when appropriate.
552 * src/mkdir.c (create_parents, main): Use bool when appropriate.
553 (main): Use EXIT_SUCCESS/EXIT_FAILURE instead of 0/1.
555 2004-07-29 Paul Eggert <eggert@cs.ucla.edu>
557 * src/mkfifo.c (main): Use EXIT_SUCCESS and EXIT_FAILURE, not 0 and 1.
559 * src/chmod.c (recurse, force_silent, process_file, process_files,
560 main): Use bool when appropriate.
561 * src/cksum.c (cksum, main): Likewise.
562 * src/comm.c (hard_LC_COLLATE, only_file_1, only_file_2, both,
563 compare_files, main): Likewise.
565 * src/copy.h (struct cp_options): Likewise.
566 * src/copy.c (copy_internal, is_ancestor, copy_dir, copy_reg,
567 same_file_ok, seen_file, copy_internal, valid_options, copy): Likewise.
568 * src/cp-hash.h (remember_created): Likewise.
569 * src/cp-hash.c (remember_created): Likewise.
570 * src/cp.c (struct dir_attr, flag_path, remove_trailing_slashes,
571 re_protect, make_path_private, target_directory_operand, do_copy,
572 cp_option_init, decode_preserve_arg, main): Likewise.
573 * src/install.c (isdir, change_timestamps, change_attributes,
574 copy_file, install_file_to_path, install_file_in_dir,
575 install_file_in_file, strip_files, dir_arg, cp_option_init, main,
576 change_attributes, change_timestamps): Likewise.
577 * src/mv.c (remove_trailing_slashes, rm_option_init,
578 cp_option_init, do_move, movefile, main): Likewise.
579 * src/remove.c (right_justify), full_filename_, AD_pop_and_chdir,
580 AD_push, prompt, remove_dir): Likewise.
581 * src/rm.c (rm_option_init, main): Likewise.
583 * src/remove.c (top_dir, pop_dir, full_filename_):
584 Use size_t for sizes.
585 * src/cp.c (target_directory_operand): Do not clear *NEW_DST if stat
586 succeeds. It's not necessary in that case, as *NEW_DST is always
588 (do_copy): Rewrite slightly to avoid need for "unreachable" comment.
589 (main): Use EXIT_SUCCESS, EXIT_FAILURE instead of 0, 1.
590 * src/rm.c (main): Likewise.
592 md5sum, sha1sum integer cleanups.
594 * src/checksum.h: Don't include config.h, sys/types.h, stdio.h:
596 (ALG_UNSPECIFIED): Remove.
597 (ALG_MDT): Don't make it equal to CHAR_MAX + 1; this isn't necessary.
598 * src/md5.c: Don't include any files other than checksum.h.
599 * src/sha1sum.c: Likewise.
600 * src/md5sum.c (OPENOPTS, have_read_stdin, status_only, warn,
601 bsd_split_3, split_3, hex_digits, digest_file, digest_check, main):
602 Use bool when appropriate.
603 (digest_check): Increase limit of number of input lines to
604 UINTMAX_MAX from INT_MAX. Diagnose any overflows of this counter.
605 Use ngettext instead of hard-to-i18nize hardcoded stuff for plurals.
607 2004-07-28 Paul Eggert <eggert@cs.ucla.edu>
609 * src/cat.c (exit_status): Remove. Now done by passing a boolean
611 (simple_cat, cat): Return true if successful. All callers changed.
612 (simple_cat, cat, main): Use bool for booleans.
613 (simple_cat): Use size_t for sizes.
614 (cat, main): Use the same names for parameters that we use for
615 long options, to avoid confusion. This inverts the sense of the
616 show_tabs (formerly output_tabs) and number_nonblank
617 (formerly numbers_at_empty_lines) variables.
618 (main): Don't mess up (due to integer overflow) if we are given
619 INT_MAX - INT_MIN + 1 options.
620 [O_BINARY]: Don't invoke isatty unless the other options require it.
621 (main): When deciding whether to use simple_cat, don't worry
622 about binary option; it's irrelevant.
624 * src/dcgen: Remove comments, trailing white space, and empty
625 lines from the output strings, to save space.
626 Use a narrower type like 'unsigned char' for line lengths, if
628 Make the output variables static, not extern.
630 * src/chgrp.c (parse_group): Require base 10 when parsing
632 (main): int -> bool when appropriate.
633 * src/chown.c (main): Likewise.
634 * src/chown-core.c: Include inttostr.h.
635 (UINT_MAX_DECIMAL_DIGITS, uint_to_string): Remove.
636 (gid_to_name, uid_to_name): Use imaxtostr/umaxtostr
637 instead of uint_to_string).
638 (describe_change): Instead of an int flag, use a char *
639 auxiliary; this avoids the need for casts.
640 Assume free (NULL) works.
641 (change_file_owner): Return true/false, not 0/-1, since
642 we don't set errno. All callers changed.
643 Use bool when appropriate.
644 (chown_files): Likewise.
645 * src/chown-core.h (chown_files): Likewise.
647 * tests/chown/basic: Test for proper handling of uids like
648 "010", which must be parsed as decimal.
650 * tests/misc/pwd: Don't assume that Perl's getpwd agrees with our
651 pwd when there are multiple names for the working directory
652 (which can happen with an automounter, sigh).
654 * src/Makefile.am ($(SCRIPTS)): Don't depend on Makefile;
655 this causes Solaris 8 'make' to refuse to build "groups".
656 (localedir.h): Don't depend on Makefile: this causes Solaris
657 8 'make' to build localedir.h unnecessarily. The dependence
658 on Makefile is ineffective anyway, since $(localedir) might
659 change even if Makefile hasn't.
661 * src/remove.c (remove_dir): If we can't save the state of the
662 working directory, pretend we started from "/", not ".".
663 This avoids a bug on hosts like Solaris that don't let you
664 remove the working directory.
666 2004-07-27 Paul Eggert <eggert@cs.ucla.edu>
668 * src/printf.c (strtiomax, strtoumax): Declare if not already
669 declared: this fixes a portability bug with Solaris 8 + GCC.
670 (STRTOX): Parenthesize use of macro arg as expression.
671 (vstrtoimax, vstrtoumax, vstrtold): Remove now-unnecessary
673 * configure.ac: Check for declaration of strtoumax, for
676 * src/Makefile.am (cp_LDADD, ginstall_LDADD, mv_LDADD,
677 pathchk_LDADD, rm_LDADD, test_LDADD): New vars, for eaccess.
679 * tests/readlink/can-e: Don't assume that we can remove the
680 working directory: this isn't possible under Solaris 8, say.
681 * tests/readlink/can-f: Likewise.
682 * tests/readlink/can-m: Likewise.
684 * src/copy.c (copy_internal): find_backup_file_name no longer
685 returns NULL, so don't bother to check for this.
686 * src/cp.c (do_copy): Likewise.
687 * src/ln.c (do_link): Likewise.
689 2004-07-25 Paul Eggert <eggert@cs.ucla.edu>
691 * src/nice.c (GET_NICE_VALUE): Renamed from GET_PRIORITY.
693 (NZERO): New macro, if system doesn't define it already.
694 (usage): Distinguish priorities from nice values.
695 Don't assume NZERO is 20.
696 (main): Use bool instead of int where appropriate.
697 If user specifies an adjustment out of range, always truncate it
698 to an inrange value instead of sometimes giving an error message
700 Do not assume that -1 is an error return from "nice" or
701 "getpriority", as it might be the current nice value minus NZERO.
702 If nice/setpriority fails with errno == EPERM, go ahead and run
703 the command anyway; POSIX requires this.
705 * src/pathchk.c: Include euidaccess.h.
706 (dir_ok): Use euidaccess, not access.
707 * src/test.c (R_OK, W_OK, X_OK, FOK): Remove; system.h defines them.
708 (eaccess): Remove. All users changed to use euidaccess instead.
710 2004-07-24 Paul Eggert <eggert@cs.ucla.edu>
712 * src/uptime.c (print_uptime) [defined BOOT_MSG]:
713 Don't assume ut_line is null-terminated.
714 * src/who.c (print_line): New arguments USERLEN and LINELEN,
715 since USER and LINE might not be null terminated. All callers
718 2004-07-23 Paul Eggert <eggert@cs.ucla.edu>
720 Fix bug with "tail -f" reported by Rob Holland in
721 <http://lists.gnu.org/archive/html/bug-coreutils/2004-07/msg00054.html>.
722 Also, remove the undocumented and unsupported-since-2000
723 --max-consecutive-size-changes options. Fix another related bug:
724 "tail" got confused if stdin, stdout, or stderr were closed.
725 Also, use output buffering even with "tail -f".
727 * NEWS: Document this, plus yesterday's patch.
728 * doc/coreutils.texi (tail invocation): "size has remained the same"
729 -> "file has not changed", which is more accurate for fifos.
730 * src/tail.c: Include fcntl-safer.h.
731 (COPY_TO_EOF): Set to UINTMAX_MAX, not OFF_T_MAX (which was wrong).
732 (COPY_A_BUFFER): New macro.
733 (struct File_spec): New members mtime, mode, blocking.
734 Remove member n_consecutive_size_changes.
735 (DEFAULT_MAX_N_CONSECUTIVE_SIZE_CHANGES,
736 max_n_consecutive_size_changes_between_opens,
737 MAX_CONSECUTIVE_SIZE_CHANGES_OPTION): Remove.
738 (long_options, tail_forever, parse_options):
739 Remove (non-)support for --max-consecutive-size-changes.
740 (record_open_fd): New function.
741 (recheck, tail_file): Use it. Don't assume that stdin is open.
742 (dump_remainder): Add support for new COPY_A_BUFFER special value.
743 Treat errno==EAGAIN like EOF, since it might be a nonblocking read.
744 (recheck): New arg BLOCKING, specifying whether to use blocking reads.
746 (n_live_files): Remove, replacing with...
747 (any_live_files): New function. All uses changed.
748 (tail_forever): Use nonblocking I/O unless we know that blocking I/O
749 is safe; this avoids some hangs when reading from a fifo.
750 Avoid invoking fstat or sleep when using blocking I/O.
751 Do not check for changes to size if the file is not a regular file,
752 as the size is undefined in that case.
753 Check for changes to mtime or mode, too; this works for non-regular
755 (tail_forever, main): Redo fflush strategy to work even when input
756 is nonblocking. Don't use unbuffered output; just flush when needed.
758 2004-07-22 Paul Eggert <eggert@cs.ucla.edu>
760 * src/tail.c (main): Ignore -f if no file operand is specified
761 and standard input is a pipe.
762 * doc/coreutils.texi (tail invocation): Do not ignore -f for
763 all pipes, just for when standard input is a pipe and no
764 file operand is specified.
765 * tests/tail/Test.pm: Reinstate f-1 test, since we now pass.
766 Add a new commented-out f-2 test, which we still fail.
767 (test_vector): All f-* tests are special cases, not just f-1.
769 2004-07-12 Paul Eggert <eggert@cs.ucla.edu>
771 * src/uptime.c: Include c-strtod.h.
772 (print_uptime): Use c_strtod instead of setlocale and sscanf.
773 Use long int rather than int to count days (for 64-bit hosts),
774 and check for arithmetic overflow when converting double to time_t.
776 2004-07-11 Paul Eggert <eggert@cs.ucla.edu>
778 * src/printf.c (vstrtold): Renamed from vstrtod.
779 Now returns long double. All uses changed.
780 (print_direc): Use "L" length modifier when printing floating point
781 numbers, since we're now printing long double.
783 2004-07-06 Paul Eggert <eggert@cs.ucla.edu>
787 printf cleanup, to avoid undefined behavior, to add support for
788 formats that Bash supports, and to support wide integers like
791 * NEWS: Document this.
792 * src/printf.c (UNSPECIFIED): Remove. All uses now replaced by
793 booleans, so that we don't reserve any values for precision or
795 (STRTOX): Use prototype, not K&R-style definition.
796 (vstrtoimax): Renamed from xstrtol (to avoid confusion with xstrtol
797 in ../lib), with type change to intmax_t.
799 (vstrtoumax): Renamed from xstrtoul, with type change to uintmax_t.
801 (vstrtod): Renamed from xstrtod. All uses changed.
802 (print_direc): Use boolean arg instead of special value to indicate
803 a missing precision or width. LENGTH no longer includes
804 length modifiers or conversion character. New arg CONVERSION
805 now specifies conversion character.
806 Use intmax_t-width formatting for integers (like Bash).
807 Add support for C99 %a, %A, %F (like Bash).
808 Add support for field width with %c (POSIX requires this).
809 Add a FIXME for lack of support for field width and precision
811 Add support for '\'', '0' flags.
812 Check for invalid combinations of flags, field width, precision,
813 and conversion, to prevent use of undefined behavior.
814 Allow multiple length modifiers, for formats like "%lld" (like Bash).
815 Add support for C99 'j', 't', 'z' length modifiers (like Bash).
816 In error message, output entire invalid conversion specification,
817 instead of merely outputting % followed by the conversion char.
818 * tests/misc/printf: Add tests for the above.
820 2004-04-03 Dmitry V. Levin <ldv@altlinux.org>
822 Change "readlink -f" to be more compatible with prior implementations.
823 Add more canonicalize options, -e and -m.
824 Add comprehensive tests for all readlink modes.
826 * m4/canonicalize.m4 (AC_FUNC_CANONICALIZE_FILE_NAME):
827 Do not add canonicalize.c here.
829 * src/readlink.c (longopts): Add new options.
830 (usage): Document them.
831 (canonicalize_fname): New proxy function.
832 (main): Handle new options.
833 * doc/coreutils.texi (readlink invocation): Document new
834 "readlink -f" behaviour and new canonicalize options, -e and -m.
836 * configure.ac (AC_CONFIG_FILES): Add tests/readlink/Makefile.
837 * tests/Makefile.am (SUBDIRS): Add readlink.
838 * tests/readlink/Makefile.am: New file.
839 * tests/readlink/{rl-1,can-e,can-f,can-m}: New readlink tests.
840 * tests/misc/Makefile.am (TESTS): Remove basic readlink test.
841 * tests/misc/readlink: Remove file.
843 2004-07-04 Jim Meyering <jim@meyering.net>
845 * src/copy.c (copy_internal): Add a FIXME comment.
847 2004-07-02 Paul Eggert <eggert@cs.ucla.edu>
849 * src/copy.c (copy_dir): Assume path_concat returns non-NULL.
850 * src/cp.c (do_copy): Likewise.
851 * src/mv.c (movefile): Likewise.
853 * src/cp.c (make_path_private): 2nd arg is now size_t, not int,
854 to avoid problem when path_concat dir name is longer than 2 GiB (!).
856 * src/nohup.c (main): Don't pass NULL first argument to path_concat.
857 This cleans up the semantics a bit, as we no longer try to open the
860 2004-07-01 Paul Eggert <eggert@cs.ucla.edu>
862 * NEWS: Add short names -t and -T for --target-directory
863 and --no-target-directory options, respectively.
865 * src/cp.c (NO_TARGET_DIRECTORY_OPTION, TARGET_DIRECTORY_OPTION):
866 Remove. All uses changed to 'T' and 't', respectively.
867 * src/install.c, src/ln.c, src/mv.c: Likewise.
869 * src/cp.c (long_opts, usage, do_copy, main): Add -t and -T as
870 aliases for --target-directory and --no-target-directory,
872 * src/install.c (long_options, main, usage): Likewise.
873 * src/ln.c, src/mv.c: Likewise.
875 2004-07-01 Jim Meyering <jim@meyering.net>
877 * Makefile.maint (sc_file_system): New target.
878 (syntax-check-rules): Add it.
879 .x-sc_file_system: New file.
880 * Makefile.am (EXTRA_DIST): Add it.
882 * man/sync.x: Use "file system" rather than "filesystem".
883 * man/stat.x, man/df.x: Likewise.
885 2004-06-30 Paul Eggert <eggert@cs.ucla.edu>
887 * src/df.c (usage, main): Output "file system" rather than
889 * src/du.c (usage): Likewise.
890 * src/shred.c (usage): Likewise.
891 * src/stat.c (usage): Likewise.
892 * src/stat.c (long_options, usage): Rename "--filesystem" to
893 "--file-system". But keep the old name around, for compatibility
896 2004-06-29 Paul Eggert <eggert@cs.ucla.edu>
898 Add support for --no-target-directory option.
901 * doc/coreutils.texi (Common options, Target directory, cp
902 invocation, install invocation, mv invocation, ln invocation):
904 (link invocation): Explain how to rewrite link using ln now
905 that we have --no-target-directory.
906 (ln invocation): Explain that --no-target-directory subsumes
908 (unlink invocation): Modify wording to match new wording in
911 * src/cp.c (NO_TARGET_DIRECTORY_OPTION): New constant.
912 (long_opts, usage, do_copy, main): Add support for
913 --no-target-directory,
914 * src/install.c (NO_TARGET_DIRECTORY_OPTION, long_options, main,
916 * src/ln.c (NO_TARGET_DIRECTORY_OPTION, long_options, usage,
918 * src/mv.c (NO_TARGET_DIRECTORY_OPTION, long_options, usage,
920 * src/mv.c (enum): Sort values.
922 2004-06-29 Jim Meyering <jim@meyering.net>
924 Don't let verbose-mode output from a subshell obscure actual differences.
925 * tests/rm/inaccessible: Turn off command-echoing just before
926 invoking subshell, then turn it back on if VERBOSE=yes afterward.
928 2004-06-25 Paul Eggert <eggert@cs.ucla.edu>
930 Add support for 'install --target-directory', an option
931 that has been documented for years but not implemented (!).
932 * doc/coreutils.texi (install invocation): Document
933 --target-directory in synopsis, too.
934 * src/install.c (TARGET_DIRECTORY_OPTION): New var.
935 (long_options, main, usage): Add --target-directory.
936 (target_directory_operand): New function, stolen from mv.c.
937 (main): Use it. Check for -d and --target-directory.
938 Alter wording of diagnostics to match other programs.
940 2004-06-28 Jim Meyering <jim@meyering.net>
942 * src/cp.c (usage): Fix copy+paste error in description of
943 --target-directory: s/move/copy/. From Paul Jarc.
945 2004-06-27 Paul Eggert <eggert@cs.ucla.edu>
947 Use more-consistent rules among cp, ln, and mv when dealing with
948 last operands that are (or look like) directories.
950 * src/cp.c (target_directory_operand): New, nearly-common function,
951 It reports an error if the destination appears to be a directory
952 (e.g., because it has a trailing slash) but is not.
953 * src/ln.c, src/mv.c: Likewise.
954 * src/cp.c (do_copy): Use it.
955 * src/ln.c (main): Likewise.
956 * src/mv.c (main): Likewise.
958 * src/cp.c (do_copy): Don't assume argc is positive.
959 Don't bother to lstat dest, since copy() will do that for us.
960 Use "const" to avoid the need for cast.
962 * src/cp.c (do_copy): Don't output a usage message because of file
963 problems (e.g., an operand is not a directory). Use it only for
964 syntax. Standardize on "target %s is not a directory" for the
966 * src/ln.c (main): Likewise.
967 * src/mv.c (main): Likewise.
969 * src/cp.c (do_copy): Remove test for trailing slash, since
970 target_directory_operand now does this.
971 * src/ln.c (main): Likewise.
972 * src/mv.c (movefile): Likewise.
974 * src/cp.c (main): Reject multiple target directories.
975 Check whether a specified target is a directory when parsing the
976 options, using stat. This gives more-accurate diagnostics.
977 * src/ln.c (main): Likewise.
979 * src/ln.c (isdir): Remove decl; no longer needed.
980 * src/mv.c (isdir, lstat): Likewise.
982 * src/ln.c (do_link): New arg dest_is_dir. All uses changed.
983 Don't check the destination ourself; rely on dest_is_dir.
984 This way we can avoid lstatting the destination in the
985 usual case, and in the worst case we lstat 1, not 3 times.
986 Don't bother to unlink unless link failed; this saves a syscall.
987 Remove unnecessary backup_succeeded flag;
988 it was identical to "dest_backup != NULL".
990 * src/ln.c (main): Use int to count to argc, not unsigned int.
991 This handles negative operand counts.
992 * src/mv.c (main): Likewise.
994 * src/mv.c (do_move): Don't call hash_init; expect the caller to
995 do it, for consistency with cp.c and ln.c. All callers changed.
996 (movefile): dest_is_dir parameter is now bool, not int.
997 (main): Standardize on "missing destination file operand after %s"
998 for the diagnostic, for consistency with cp.c.
1000 * tests/mv/diag: Don't assume "mv --target=nonexistentdir"
1001 will complain about the arg count.
1002 Adjust to new (briefer) diagnostics.
1003 * tests/cp/fail-perm: Add a test to verify that we get the new
1004 diagnostic when failing to copy through a symlink-to-inaccessible-dir.
1006 2004-06-27 Paul Eggert <eggert@cs.ucla.edu>
1008 Fix a bug: formerly, if d/x was a directory and x a file, "ln x
1009 d/" incorrectly created a link d/x/x. It also saves some system
1012 * NEWS: Document the fix.
1014 * src/ln.c (main): Don't append basename to dest if this
1015 results in an existing directory name.
1016 * tests/ln/misc: See whether a trailing slash is followed too far.
1018 2004-06-26 Jim Meyering <jim@meyering.net>
1020 * src/printf.c (main): When given no arguments, print the standard
1021 "missing operand\nTry printf --help..." message -- to be consistent.
1023 2004-06-26 Jim Meyering <jim@meyering.net>
1025 * src/mknod.c (main): Add \n at the end of message output via fprintf.
1027 2004-06-25 Jim Meyering <jim@meyering.net>
1029 * tests/ln/misc: Add test for ln subscript error.
1031 2004-06-23 Paul Eggert <eggert@cs.ucla.edu>
1033 * src/ln.c (do_link): Remove unnecessary call to lstat.
1034 (main): Avoid subscript error when the destination is "".
1036 2004-06-23 Jim Meyering <jim@meyering.net>
1038 * tests/*: Replace all occurrences of `(exit N); exit' with
1039 `(exit N); exit N'. Otherwise, those many tests could exit with
1040 improper exit status when exiting via e.g., a trapped interrupt.
1041 Thanks to a report from Bob Proulx.
1043 2004-06-22 Paul Eggert <eggert@cs.ucla.edu>
1045 * src/who.c (idle_string, print_user): New arg boottime,
1046 specifying the most recent boot time. All uses changed.
1047 (idle_string) Consider a line to be "old" if it hasn't been used
1048 since the last boot time. Watch out for overflow when computing
1049 times, and for times in the future.
1050 (idle_string): Record latest boot time.
1052 2004-06-22 Jim Meyering <jim@meyering.net>
1054 * src/test.c (usage): Correct description of `-t FD'. The file
1055 descriptor, FD, is no longer optional. Reported by Ton Nijkes.
1057 2004-06-21 Paul Eggert <eggert@cs.ucla.edu>
1059 The 2004-06-19 fix for who and pinky was incomplete, as ctime
1060 has undefined behavior if the year precedes -999 or follows 9999.
1061 Since we have to stop using ctime anyway, we might as well use
1062 strftime and fix the FIXME, and support internationalized dates.
1064 * NEWS: Document the new behavior.
1065 * src/who.c: Include "hard-locale.h".
1066 (time_format, time_format_width): New vars.
1067 (time_string, print_line): Use them.
1069 (time_string): Use localtime + strftime instead of
1070 ctime, to avoid problems with years before -999 or after 9999.
1071 * src/pinky.c: Likewise.
1073 2004-06-21 Paul Eggert <eggert@cs.ucla.edu>
1075 Fix bug: GNU 'ls' didn't count columns correctly if user or group
1076 names contained multibyte characters where the column count
1077 differed from the byte count. This patch also corrects
1080 * src/ls.c (format_user_or_group): New function, which counts
1082 (format_user, format_group): Use it.
1083 (format_user_or_group_width): New function, which counts columns
1085 (format_user_width, format_group_width): Use it.
1087 2004-06-21 Jim Meyering <jim@meyering.net>
1089 * tests/priv-check: Quote "$PATH" in PATH=$PATH.
1090 Suggestion from Andreas Schwab.
1092 * tests/priv-check: When running as root, be sure to propagate
1093 PATH through to the process we exec as non-root.
1094 Reported by michael@aplatform.com.
1096 * src/mknod.c (main): Don't segfault when calculating the
1097 expected number of operands for `mknod NAME'.
1099 2004-06-20 Jim Meyering <jim@meyering.net>
1101 * src/dd.c (input_seek_errno): Declare file-scoped variable as static.
1103 2004-06-20 Paul Eggert <eggert@cs.ucla.edu>
1105 * src/basename.c (main):
1106 Standardize on the diagnostics given when someone gives
1107 too few operands ("missing operand after `xxx'") or
1108 too many operands ("extra operand `xxx'").
1109 Include "quote.h" and/or "error.h" if it wasn't already being included.
1110 * src/chgrp.c (main): Likewise.
1111 * src/chmod.c (main): Likewise.
1112 * src/chown.c (main): Likewise.
1113 * src/chroot.c (main): Likewise.
1114 * src/comm.c (main): Likewise.
1115 * src/cp.c (do_copy): Likewise.
1116 * src/csplit.c (main): Likewise.
1117 * src/date.c (main): Likewise.
1118 * src/dircolors.c (main): Likewise.
1119 * src/dirname.c (main): Likewise.
1120 * src/du.c (main): Likewise.
1121 * src/expr.c (main): Likewise.
1122 * src/hostid.c (main): Likewise.
1123 * src/hostname.c (main): Likewise.
1124 * src/id.c (main): Likewise.
1125 * src/install.c (main): Likewise.
1126 * src/join.c (add_file_name, main): Likewise.
1127 * src/link.c (main): Likewise.
1128 * src/ln.c (main): Likewise.
1129 * src/logname.c (main): Likewise.
1130 * src/md5sum.c (main): Likewise.
1131 * src/mkdir.c (main): Likewise.
1132 * src/mkfifo.c (main): Likewise.
1133 * src/mknod.c (main): Likewise.
1134 * src/mv.c (main): Likewise.
1135 * src/nohup.c (main): Likewise.
1136 * src/od.c (main): Likewise.
1137 * src/pathchk.c (main): Likewise.
1138 * src/ptx.c (main): Likewise.
1139 * src/readlink.c (main): Likewise.
1140 * src/rm.c (main): Likewise.
1141 * src/rmdir.c (main): Likewise.
1142 * src/seq.c (main): Likewise.
1143 * src/setuidgid.c (main): Likewise.
1144 * src/shred.c (main): Likewise.
1145 * src/sleep.c (main): Likewise.
1146 * src/sort.c (main): Likewise.
1147 * src/split.c (main): Likewise.
1148 * src/stat.c (main): Likewise.
1149 * src/test.c (beyond, main): Likewise.
1150 * src/touch.c (main): Likewise.
1151 * src/tr.c (main): Likewise.
1152 * src/tsort.c (main): Likewise.
1153 * src/tty.c (main): Likewise.
1154 * src/uname.c (main): Likewise.
1155 * src/uniq.c (main): Likewise.
1156 * src/unlink.c (main): Likewise.
1157 * src/uptime.c (main): Likewise.
1158 * src/users.c (main): Likewise.
1159 * src/who.c (main): Likewise.
1160 * src/whoami.c (main): Likewise.
1162 * tests/basename/basic: Adjust to new diagnostics.
1163 * tests/du/files0-from: Likewise.
1164 * tests/expr/basic: Likewise.
1165 * tests/mv/diag: Likewise.
1166 * tests/tsort/basic-1: Likewise.
1168 2004-06-20 Jim Meyering <jim@meyering.net>
1170 * src/ln.c: Remove declaration of yesno.
1171 Instead, include yesno.h.
1172 * src/copy.c: Likewise.
1174 * src/remove.c: Remove declaration of yesno.
1175 Instead, include yesno.h.
1176 (top_dir): Remove now-unnecessary cast of obstack_base.
1177 (pop_dir): Likewise.
1178 (full_filename_): Likewise.
1180 2004-06-19 Paul Eggert <eggert@cs.ucla.edu>
1182 Don't dump core if ctime returns NULL; this is possible on
1183 hosts with 64-bit time_t and 32-bit int.
1184 * src/who.c: Include "inttostr.h".
1185 (time_string): If ctime fails, print the raw time as an integer
1186 instead of dumping core.
1187 * src/pinky.c: Likewise, as follows:
1188 Include "inttostr.h".
1189 (time_string): New function, copied from who.c.
1190 (print_entry): Use it.
1192 2004-06-19 Paul Eggert <eggert@cs.ucla.edu>
1194 * src/who.c (print_line): Don't truncate user names at 8 bytes.
1195 Problem reported by Guido Leenders in:
1196 http://lists.gnu.org/archive/html/bug-coreutils/2004-06/msg00056.html
1197 * NEWS: document this.
1199 2004-06-19 Jim Meyering <jim@meyering.net>
1201 * src/system.h (case_GETOPT_VERSION_CHAR): Switch back to
1202 using GNU_PACKAGE (from PACKAGE) once again. This restores
1203 `GNU' to the parenthesized package name in --version output.
1204 Before, the first argument from AC_INIT, `GNU coreutils', would
1205 be propagated to the PACKAGE variable. Now, `GNU ' is trimmed.
1206 Reported by Richard Stallman.
1208 2004-06-17 Jim Meyering <jim@meyering.net>
1210 * src/tr.c (to_uchar): Rename function from `uchar'. The latter
1211 would clash with a typedef in Tru64's <sys/types.h>. From Albert Chin.
1213 2004-06-15 Paul Eggert <eggert@cs.ucla.edu>
1215 * NEWS: Remove more special cases for POSIXLY_CORRECT when POSIX
1216 allows the GNU behavior. "--" is now supported by chroot, hostid,
1217 hosname, pwd, sync, yes.
1218 * doc/coreutils.texi (yes invocation, false invocation,
1219 true invocation): Document this.
1220 * src/chroot.c (main): Handle "--".
1221 * src/hostid.c (main): Likewise.
1222 * src/hostname.c (main): Likewise.
1223 * src/pwd.c (main): Likewise.
1224 * src/sync.c (main): Likewise.
1225 * src/yes.c (main): Likewise.
1226 * src/true.c (main): Recognize --help and --version even if
1227 POSIXLY_CORRECT is set.
1228 * src/yes.c (main): Likewise.
1230 2004-06-09 Paul Eggert <eggert@cs.ucla.edu>
1232 * NEWS: Remove special cases for POSIXLY_CORRECT when POSIX allows
1234 * doc/coreutils.texi (pr invocation, unlink invocation): Document this.
1235 * src/ls.c (decode_switches): Pay attention to TABSIZE even if
1236 POSIXLY_CORRECT is set. POSIX reserves upper-case environment
1237 variables to the implementation, so it's OK for ls to depend on
1239 * src/pr.c: Include "hard-locale.h".
1240 (main): When in a non-POSIX locale, ignore POSIXLY_CORRECT, since
1241 POSIX specifies the behavior only in the POSIX locale.
1242 * src/printf.c (print_esc): Support \x, \u, \U even if POSIXLY_CORRECT,
1243 since POSIX says the behavior is unspecified here.
1244 * src/tail.c (parse_obsolescent_option): Support multiple file operands
1245 even if POSIXLY_CORRECT, since POSIX does not require a diagnostic.
1246 * src/printf.c (main): Recognize --help, --version even if
1247 POSIXLY_CORRECT. POSIX does not specify any options, but it
1248 does not prohibit options either, so "printf" is like "expr" here.
1249 * src/unlink.c (main): Likewise.
1250 * tests/misc/printf: Adjust to the new semantics for \x if
1253 2004-06-14 Jim Meyering <jim@meyering.net>
1255 * tests/misc/pwd: New test, for fix of 2004-04-19.
1256 * tests/misc/Makefile.am (TESTS): Add pwd.
1257 (BUILD_SRC_DIR): Define BUILD_SRC_DIR.
1259 * src/copy.c: Remove declaration of euidaccess.
1260 Instead, include "euidaccess.h".
1262 2004-06-13 Paul Eggert <eggert@cs.ucla.edu>
1264 * src/who.c (PIDSTR_DECL_AND_INIT): Don't assume pid_t fits in int.
1265 (UT_ID) [!HAVE_STRUCT_XTMP_UT_ID]: Remove bogus comment,
1266 as (sizeof "??") reliably returns 3.
1267 (print_line): Guard against idle and pid being too long
1268 (which is possible when printing headers).
1269 (print_user): Allocate enough bytes for idlestr. Use IDLESTR_LEN.
1270 Avoid unnecessary cast of sizeof to int.
1271 (make_id_equals_comment): Do not assume that UT_ID returns
1272 a string; it might return a non-null-terminated array.
1273 Use strncat instead. It's not very often where strncat is
1274 exactly what you want, but this is one of those rare cases.
1276 2004-06-11 Paul Eggert <eggert@cs.ucla.edu>
1278 * src/who.c (list_entries_who): Don't output a trailing space.
1280 2004-06-09 Jim Meyering <jim@meyering.net>
1282 * src/touch.c (usage): Improve wording in description of the
1283 --time=WORD option. Reported by Dan Jacobson.
1285 * src/chown-core.c (change_file_owner): Change names of parameters
1286 old_uid and old_gid to required_uid and required_gid respectively.
1288 * src/chmod.c (mode_changed): Return false, not 0, now that the
1289 function returns `bool'.
1291 2004-06-08 Paul Eggert <eggert@cs.ucla.edu>
1293 Adjust chmod and chown to be similar if -c or -v are given. In
1294 particular, a no-op chown is no longer reported as a change; this
1295 reverts to previous behavior. Also, fix both commands so that -v
1296 report failures even if the failure is not due to the chmod or
1299 * src/chmod.c (CH_NOT_APPLIED): New constant.
1300 (describe_change): Handle it.
1301 (process_file): Use it, if a symlink wasn't changed.
1302 (mode_changed): Return bool, not int. Accept new argument
1303 NEW_MODE; all callers changed. This lets us avoid statting the
1304 file unless the new mode has unusual bits.
1305 (process_file): Return -1 on error. With -v, report all errors
1306 verbosely, not just some.
1308 * src/chown-core.c (change_file_owner): Return -1 on error, not
1309 1 sometimes and -1 on others. Our caller ORs together our results,
1310 and (-1 | 1) == 0 on ones-complement hosts.
1311 With -v report all errors verbosely, not just some.
1312 Fix bug when chopt->root_dev_ino && !chopt->affect_symlink_referent:
1313 file_stats wasn't set properly in that case.
1315 * tests/chgrp/basic: Adjust to above changes.
1317 2004-05-20 Paul Eggert <eggert@cs.ucla.edu>
1319 * tests/chgrp/basic: Test that chgrp -h does not fail on
1320 symlinks, even on hosts where that's not supported.
1321 Test that if -R is specified without -H or L, -h is assumed.
1322 Test that chown() is not optimized away.
1324 2004-05-18 Paul Eggert <eggert@cs.ucla.edu>
1326 Several fixes to chgrp and chown for compatibility with POSIX and BSD:
1328 Check for incompatible options. When -R and --dereference are
1329 both used, then either -H or -L must also be used. When -R and -h
1330 are both used, then -P must be in effect.
1332 -H, -L, and -P have no effect unless -R is also specified.
1333 If -P and -R are both specified, -h is assumed.
1335 Do not optimize away the chown() system call when the file's owner
1336 and group already have the desired value. This optimization was
1337 incorrect, as it failed to updated the last-changed time and reset
1338 special permission bits, as POSIX requires.
1340 Do not report an error if the owner or group of a
1341 recursively-encountered symbolic link cannot be updated because
1342 the file system does not support it.
1344 * NEWS: Document the above.
1346 * src/chgrp.c (main): Check for incompatible options. -R --dereference
1347 requires either -H or -L, and -R -h requires -P. If -H, specify
1348 FTS_PHYSICAL as well as FTS_COMFOLLOW; this is faster. Make this
1349 file as much like chown.c as possible.
1350 * src/chown.c (main): Likewise.
1352 * src/chown-core.c (change_file_owner): Use ent->fts_statp only if
1353 needed. Chown a directory only after chowning its children; this
1354 avoids problems if the new directory ownership doesn't permit
1355 access to the children. Dereference symlinks before doing
1356 ROOT_DEV_INO_CHECK, not after, so that we catch symlinks to /.
1357 Do not optimize away the chown() system call when the file's owner
1358 and group already have the desired value. POSIX does not permit
1359 this optimization. Rely on chown and lchown to do the right
1360 thing with symlinks and/or -1 arguments, now that we have wrappers
1361 to do this. Use ENOTSUPP not ENOSYS, and ignore all ENOTSUPP
1362 errors, not just command-line errors.
1363 (chown_files): Pass FTS_NOSTAT to xfts_open if we don't need file status.
1365 * src/system.h (ENOTSUP): Remove.
1367 * tests/chgrp/basic: Use chown --from to discover whether the
1368 group changed, since chgrp now changes unconditionally. This
1369 complicates the sed script a bit. Do not specify --dereference,
1370 since it's the default (and we want to test this). Adjust output
1371 to match the fact that chgrp no longer optimizes the case of
1372 changing a file's group to the same value as before.
1373 * tests/chgrp/posix-H: Do not attempt to combine -h and -H; these
1374 options are incompatible, and their behavior is undefined with POSIX.
1375 (changed, not_changed): Adjust to match the fact that -h is no longer
1376 specified. Sort names.
1377 * tests/chown/deref: Adjust error-diagnostic spelling to match new
1380 2004-06-07 Paul Eggert <eggert@cs.ucla.edu>
1382 * src/uname.c (main): Fix typo introduced on 2003-05-10 that
1383 prevented a diagnostic of any operands.
1385 2004-06-08 Jim Meyering <jim@meyering.net>
1387 * src/shred.c (direct_mode): Turn it on/off with directio, too.
1389 2004-06-07 Jim Meyering <jim@meyering.net>
1391 Enable direct-mode I/O (bypassing the buffer cache), if possible.
1392 Prompted by a suggestion from Kalle Olavi Niemitalo
1393 in http://bugs.debian.org/207035.
1394 * src/shred.c (direct_mode): New function.
1395 (do_wipefd): Turn on direct-mode I/O.
1396 (dopass): If a file's first write fails with EINVAL,
1397 turn off direct-mode I/O and retry the write.
1399 2004-06-05 Paul Eggert <eggert@cs.ucla.edu>
1401 * src/tr.c (main): "tr -d a b" is now a fatal error even if
1402 POSIXLY_CORRECT is set. The POSIX SYNOPSIS does not allow this
1405 2004-06-04 Paul Eggert <eggert@cs.ucla.edu>
1407 * src/shred.c (dopass): Don't subtract 1 from the offset after
1408 a write error. Problem reported by Jon Peatfield in:
1409 http://lists.gnu.org/archive/html/bug-coreutils/2004-06/msg00020.html
1411 2004-06-02 Paul Eggert <eggert@cs.ucla.edu>
1413 Fix bug reported by Buciuman Adrian in
1414 <http://mail.gnu.org/archive/html/bug-coreutils/2003-08/msg00105.html>
1415 where 'dd' created a file that was too large. The bug was that dd
1416 assumed that the input file offset does not advance after a failed
1417 read; but POSIX says that the input file offset is undefined after
1420 * src/dd.c (MAX_BLOCKSIZE): New macro.
1421 (input_seekable, input_seek_errno, input_offset,
1422 input_offset_overflow): New vars.
1423 (scanargs): Reject block sizes greater than MAX_BLOCKSIZE.
1424 (advance_input_offset): New function.
1425 (skip_via_lseek): Set errno to zero when reporting our failure,
1426 so that we don't report based on garbage errno.
1427 (skip): If fdesc is standard input, advance the input offset.
1428 Do not quit if reading, and if noerror was specified;
1429 POSIX seems to require this.
1430 If read fails on output file, report the earlier lseek failure
1431 instead; this fixes a FIXME in dd_copy.
1432 (advance_input_after_read_error): New function.
1433 (dd_copy): Use it, instead of assuming that failed reads
1434 do not advance the file pointer. Advance input offset
1435 after nonfailed reads. Advance only a partial block if
1436 the previous read (before the failed read) succeeded, and
1437 do not generate an output block of zeros in this case.
1438 (main): Determine initial input offset, seekability of input,
1439 and error if it wasn't seekable.
1441 2004-06-02 Jim Meyering <jim@meyering.net>
1443 rm (without -f) could hang unnecessarily when attempting to
1444 remove a symlink to a file on an off-line NFS-mounted partition.
1445 Reported by David Howells in https://bugzilla.redhat.com/124699.
1446 * src/remove.c (write_protected_non_symlink): New function.
1447 Don't invoke euidaccess on symlinks.
1448 (prompt): Use write_protected_non_symlink rather than using
1449 euidaccess directly, being careful not to call lstat twice for a file.
1451 Fix a bug in how the --output-delimiter=D option works with
1452 abutting byte or character ranges. Reported by David Krider in
1453 http://lists.gnu.org/archive/html/bug-coreutils/2004-05/msg00132.html
1454 * src/cut.c (print_kth): Remove special case for open-ended range.
1455 (set_fields): Record the range start index for an interval even
1456 when it abuts another interval on its low side.
1457 Also record the range start index of the longest right-open-interval.
1458 * tests/cut/Test.pm: Add tests of --output-delimiter=S with
1459 abutting and overlapping byte ranges.
1461 2004-06-01 Paul Eggert <eggert@cs.ucla.edu>
1463 Some POSIX-conformance cleanups for tr.
1465 * src/tr.c (posix_pedantic): Remove; no longer needed since
1466 we need to test this in just one place now.
1467 (usage): Mention -C.
1468 (unquote): Note that \055, \n, etc are escaped.
1469 Do not worry about POSIXLY_CORRECT when warning about ambiguous
1471 \ at end of string stands for itself.
1472 Do not diagnose invalid backslash escapes: POSIX says the behavior
1473 is unspecified in this case, so we don't need to diagnose it.
1474 (main): Add support for -C (currently an alias for -c).
1475 Do not diagnose 'tr [:upper:] [:upper:], as POSIX does not require
1477 * tests/tr/Test.pm: New tests bs-055, bs-at-end, repeat-Compl.
1478 Fix comment for range-a-a.
1480 2004-05-25 Paul Eggert <eggert@cs.ucla.edu>
1482 Improve the efficiency (and in one case, correctness) of code
1483 that reads symlinks.
1485 * src/copy.c (copy_internal): Don't use alloca, as it can mess up
1486 royally if the link length is long (e.g., GNU/Hurd). Use
1487 xreadlink instead, it's safer. Don't bother to read the link if
1488 it's the wrong size. Add a FIXME because this area is a bit murky
1490 * src/ls.c (get_link_name): Update use of xreadlink.
1491 * src/readlink.c (main): Likewise.
1492 * src/stat.c (print_stat): Likewise.
1494 2004-06-01 Jim Meyering <jim@meyering.net>
1496 * src/env.c (main): Prefer the notation `STREQ (a, b)'
1497 over `!strcmp (a, b)'.
1498 * src/sort.c (main, sort_buffer_size): Prefer the notation
1499 `STREQ (a, b)' over `strcmp (a, b) == 0'.
1500 * src/date.c (batch_convert): Likewise.
1501 * src/expr.c (nextarg): Likewise.
1502 * src/su.c (correct_password, restricted_shell, main): Likewise.
1503 * src/ptx.c (swallow_file_in_memory, main): Likewise.
1504 * src/test.c (binary_operator, and, or, main): Likewise.
1506 2004-05-13 Paul Eggert <eggert@cs.ucla.edu>
1508 * NEWS: echo compatibility cleanup.
1509 * doc/coreutils.texi (echo invocation): Document the changes.
1510 * src/echo.c (V9_ECHO): Remove; always enabled.
1511 (DEFAULT_ECHO_TO_XPG): Renamed from V9_DEFAULT, so that
1512 we use the same naming convention as bash. Now an enum,
1514 (usage): Reword to mention -e/-E more accurately.
1515 Mention \0NNN (the POSIX syntax) rather than \NNN (nonstandard).
1516 (hextobin): New function.
1517 (main): Use bool rather than int for local vars when appropriate.
1518 Do not allow options if POSIXLY_CORRECT, unless we are using
1519 BSD semantics and the first argument is "-n".
1520 Don't pass unnecessary extra arg to parse_long_options.
1521 do_v9 now defaults to DEFAULT_ECHO_TO_XPG, not to allow_options.
1522 Do not look for options if !allow_options.
1523 Use size_t rather than int when appropriate.
1524 Open-code option test rather than using strrchr.
1525 Use faster test for "-".
1526 Avoid redundant argc test.
1527 Add support for \x, for Bash compatibility.
1528 Use e.g. '\a' rather than '\007', for portability to EBCDIC hosts.
1529 When '\c' is encountered, stop printing immediately, as POSIX
1531 Add support for \xhh syntax.
1532 Add support for \0ooo syntax; POSIX requires this.
1534 2004-06-01 Jim Meyering <jim@meyering.net>
1536 * Use automake-1.8b. Regenerate dependent files.
1538 2004-05-31 Jim Meyering <jim@meyering.net>
1540 * tests/Makefile.am.in (TESTS_ENVIRONMENT): Define PATH to include
1541 the build src/ directory -- at the front.
1542 ($(srcdir)/$x-tests): Depend on Makefile.am.
1543 Use $x as the program name, except when it would be `test' (test is
1544 the sole program tested via mk-script that is also a shell built-in).
1545 In that case, use the old ../../src/$x.
1547 2004-05-30 Jim Meyering <jim@meyering.net>
1549 Work around HPUX /bin/cc compiler bug that is exposed, now that
1550 sets are arrays of type `bool'. More details here:
1551 http://lists.gnu.org/archive/html/bug-gnulib/2004-05/msg00094.html
1552 FIXME: verify that the above URL points to the right message
1554 * src/tr.c (card_of_complement): Use cleaner `sizeof in_set'
1555 rather than `N_CHARS * sizeof(in_set[0])'. Using HPUX's /bin/cc
1556 (aC++/ANSI C B3910B A.05.55 [Dec 04 2003]) on an ia64-hp-hpux11.22
1557 system, those two expressions are not the same (256 vs. 1024).
1558 The effect of this problem was that `tr -c x y' would fail:
1559 tr: when not truncating set1, string2 must be non-empty
1560 (set_initialize): Remove unnecessary initialization of the `in_set'
1561 buffer; that initialization triggered the same compiler bug as above.
1563 2004-05-29 Paul Eggert <eggert@cs.ucla.edu>
1565 tr cleanup, mostly having to do with integer type ranges.
1568 * tests/tr/Test.pm: Add a few tests for the below. Alas, most of
1569 the test cases wouldn't be portable, or would take too much CPU
1572 * src/tr.c (N_CHARS, N_CHAR_CLASSES): Now an enum, not a macro.
1573 This is safe since the code already assumes N_CHARS fits in int.
1574 (Filter): Remove: we want to prototype everything.
1575 (ORD, CHR): Remove. All uses removed. Some replaced with:
1576 (uchar): New function. All places where a char must be converted
1577 to an unsigned char are now done this way, not by ad-hoc methods.
1578 (count): New type. Use it whenever counts or states are needed.
1579 (BEGIN_STATE): Increase from INT_MAX - 1 (which was bogus, anyway,
1580 since we used it in an unsigned int context) to UINTMAX_MAX - 1.
1581 (REPEAT_COUNT_MAXIMUM): New macro. Use it in place of BEGIN_STATE
1582 whenever appropriate.
1583 (NOT_A_CHAR): Remove global macro; now a local enum.
1584 (UL_LOWER, UL_UPPER, UL_NONE): No longer specify values, since
1585 the rest of the code no longer depends on them.
1586 (class_ok): Remove; all uses changed to use inline comparisons.
1587 (RE_NO_TYPE): Remove; wasn't used or needed.
1588 (struct List_element): normal_char and equiv_code are now unsigned
1590 first_char, last_char, and the_repeated_char are now unsigned char,
1591 not unsigned int. repeat_count is now count, not size_t.
1593 (struct Spec_list): state is now count, not unsigned int.
1594 lengthis now count, not size_t.
1595 n_indefinite_repeats is now size_t, not int.
1596 has_equiv_class, has_char_class, and has_restricted_char_class
1597 are now bool, not int. All uses changed.
1598 (struct E_string): s is now char *, not unsigned char *.
1599 escaped is now bool *, not int *. All uses changed.
1600 (ES_MATCH): Remove macro, replacing with:
1601 (es_match): New inline function. All uses changed.
1602 (squeeze_repeats, complement, posix_pedantic, truncate_set1,
1603 translating): Now bool, not int.
1604 (io_buf): Now char array, not unsigned char.
1605 (SET_TYPE): Remove. All uses replaced with bool.
1606 (is_equiv_class_member, unquote, append_range, append_char_class,
1607 append_equiv_class, find_closing_delim, star_digits_closebracket,
1608 build_spec_list, parse_str, homogeneous_spec_list):
1609 Now returns bool, not int. All uses changed.
1610 (is_equiv_class_member): Now inline.
1611 (is_equiv_class_member, is_char_class_member, make_printable_str,
1612 append_normal_char, append_range, append_repeated_char,
1614 Args are now of proper integer type.
1615 (unquote, look_up_char_class, make_printable_str,
1616 append_equiv_class, build_spec_list, squeeze_filter):
1617 Avoid unsigned char *p; gently convert *p to unsigned char instead.
1618 (unquote, get_spec_stats): Do not jump past declarations and then
1619 use them; C doesn't allow this in portable programs.
1620 (make_printable_str): Check for overflow in size calculations.
1621 (xmemdup): Remove. All uses rewritten.
1622 (find_bracketed_repeat): Args are now of proper pointer-to-integer
1623 type. Do not reject [c*0]. Use xstrtoumax, not xstrtoul.
1624 (find_bracketed_repeat, star_digits_closebracket): Check that the
1625 digits are not escaped.
1626 (build_spec_list): Don't bother to copy opnd_str; not needed.
1627 (build_spec_list, get_next): Simplify internal logic a bit.
1628 (card_of_complement): Fix bug due to char overflow.
1629 (get_spec_stats): Don't assume len fits into int.
1630 Check for integer overflow. Use abort() rather than assert(0).
1631 (string2_extend): Fix subscript error: is_char_class_member (..., 255)
1633 (squeeze_filter): READER is never null now; simplify code.
1634 READER arg now has a simpler type. Remove unnecessary casts.
1635 (squeeze_filter, main): Calls to fwrite improperly checked result
1636 against zero, rather than against requested size.
1637 (plain_read): New function.
1638 (read_and_delete, read_and_xlate):
1639 Remove unused filter arg, and don't worry about hit_eof.
1640 Simplify by using plain_read.
1641 (set_initialize): Args are bool and bool *, not int and SET_TYPE *.
1642 (main): Always pass a non-null procedure to squeeze_filter.
1643 Rewrite so that class_ok isn't needed.
1645 2004-05-29 Paul Eggert <eggert@cs.ucla.edu>
1647 * src/shred.c (dosync): Ignore EBADF errors, as IRIX 6.5
1648 fdatasync reports EBADF when syncing (unwritable) directories.
1649 Problem reported by Albert Chin-A-Young in:
1650 http://lists.gnu.org/archive/html/bug-coreutils/2004-05/msg00165.html
1652 2004-05-29 Jim Meyering <jim@meyering.net>
1654 * tests/chown/deref: Fix typo: use ls -ldo, not ls -ldg.
1655 Patch from Albert Chin.
1657 * src/ptx.c (text_buffer_maxend): Remove declaration of unused variable.
1659 * src/remove.c (push_dir): Merge declaration and adjacent assignment
1660 into a single statement.
1662 2004-05-28 Jim Meyering <jim@meyering.net>
1664 * src/remove.c (AD_mark_helper): Eliminate an unnecessary comparison.
1666 2004-05-22 Jim Meyering <jim@meyering.net>
1668 rm -r would get a failed assertion when run from an inaccessible
1669 directory and with two or more command line arguments including an
1670 absolute-named directory followed by a relative-named directory.
1672 * src/remove.h (struct rm_options) [require_restore_cwd]: New member.
1673 * src/remove.c (struct cwd_state): Define.
1674 (AD_pop_and_chdir): Redesign interface so that a restore_cwd failure
1675 can be detected by the caller. Instead of returning a malloc'd
1676 directory name, communicate it to caller via a new parameter, and
1677 return an indication of whether restore_cwd failed. Update caller.
1678 Eliminate an unnecessary call to AC_stack_top.
1679 (remove_dir): Change type of cwd_state parameter to `struct cwd_state'
1680 so we can now communicate to caller whether/how functions like
1681 restore_cwd have failed. Update caller.
1682 (rm_1): Fail if we've failed to restore the working directory
1683 and the name of the next file to remove is `.'-relative.
1684 (rm): Fail if the require_restore_cwd flag is true and we've
1685 failed to restore the working directory.
1686 * src/mv.c (rm_option_init): Initialize new member,
1687 x->require_restore_cwd.
1688 * src/rm.c (rm_option_init): Likewise.
1690 2004-05-21 Jim Meyering <jim@meyering.net>
1692 * tests/rm/inaccessible: New test for the above fix.
1693 * tests/rm/Makefile.am (TESTS): Add inaccessible.
1695 * src/remove.c (rm): Use free rather than XFREE.
1696 (remove_dir): Use xmalloc, not XMALLOC.
1697 (ds_init): Likewise.
1699 2004-05-20 Jim Meyering <jim@meyering.net>
1701 * Makefile.maint (sc_unmarked_diagnostics): Now that the unmarked
1702 diagnostics in shred.c have been fixed, don't exempt shred.c from
1705 * src/shred.c: Use translatable diagnostics, e.g.
1706 change "%s: remove" to _("%s: failed to remove") and
1707 change "%s: close" to _("%s: failed to close").
1709 2004-05-17 Paul Eggert <eggert@cs.ucla.edu>
1711 * src/shred.c (names): Bring back lower-case letters, "_", and
1712 ".". But continue to omit +, =, %, @, #, as they're either
1713 shell metacharacters (for some shells) or are not in some
1714 character sets, or (in the case of '%') must be a
1715 metacharacter somewhere.
1717 2004-05-16 Paul Eggert <eggert@cs.ucla.edu>
1719 * src/cut.c (cut_fields): Adjust to new signature of getndelim2.
1721 2004-05-17 Jim Meyering <jim@meyering.net>
1723 * src/shred.c (incname): Decrement `len' only once per loop iteration.
1725 chgrp and chown now dereference symlinks by default, per POSIX.
1726 Reported by Michal Politowski as http://bugs.debian.org/249177.
1728 * src/chown-core.c (chopt_init): Affect each symlink referent by default.
1729 * src/chown.c (usage): Update to reflect this.
1730 * src/chgrp.c (usage): Likewise.
1731 * NEWS: Describe the change.
1732 Adapt tests accordingly.
1733 * tests/chgrp/basic: Use -h where necessary to retain semantics.
1734 * tests/chgrp/deref: Likewise.
1735 * tests/chgrp/posix-H: Likewise.
1737 2004-05-15 Paul Eggert <eggert@cs.ucla.edu>
1739 In shred, check for errors from fdatasync more carefully. If
1740 fdatasync fails with errno==EINVAL, it means this implementation
1741 does not support synchronized I/O for this file. Do not report
1742 this as an error, as (for example) AIX 5.2 fdatasync reports it
1743 for raw disk devices. Problem reported by Albert Chin in
1744 <http://mail.gnu.org/archive/html/bug-gnu-utils/2004-05/msg00028.html>.
1746 Check for write errors, though: the old code ignored them.
1747 Improve error checking in a few other cases, too (e.g., close of a
1750 Also, change several 'int' values to 'bool', so that the error
1751 checking is a bit clearer. Similarly, change unsigned values
1752 to size_t where appropriate.
1754 * src/shred.c: Include "dirname.h".
1755 (datasync) [!HAVE_FDATASYNC]: Remove.
1756 (dosync): New function.
1757 (dopass): Use it. Return 1 on write error, -1 on other error.
1758 All callers changed. Report write error if dosync does.
1759 (do_wipefd, wipefd, wipename, wipefile): Return bool (true/false),
1760 not int (0/-1). All callers changed. Return false if there's a
1762 (incname): Return bool (true/false), not int (0/1). Accept
1763 size_t length, not unsigned. All callers changed. Do not
1764 bother checking for non-digits; it can't happen. Replace
1765 recursion with iteration.
1766 (wipename): Use dir_name, base_name, etc. instead of assuming
1767 Unix file names. Use size_t for length, not unsigned.
1768 Report error if unlink or close fails.
1769 (wipename, main): Use bool for booleans.
1771 (names): Use only digits and uppercase letters, for greater
1774 2004-05-16 Jim Meyering <jim@meyering.net>
1776 * tests/chown/deref: New test for the yesterday's change.
1777 * tests/chown/Makefile.am (TESTS): Add deref.
1779 2004-05-15 Jim Meyering <jim@meyering.net>
1781 chown --dereference did nothing when the owner/group of a
1782 symlink matched the desired owner/group. Reported by David Malone.
1783 Also reported in 1999 as http://bugs.debian.org/39642.
1785 * src/chown-core.c (change_file_owner): When --dereference has
1786 been specified, and when processing a symlink, stat it to get the
1787 owner and group of the referent.
1789 2004-05-14 Jim Meyering <jim@meyering.net>
1791 * man/pwd.x, man/echo.x, man/printf.x: Fix typo:
1792 s/supercede/supersede/ reported by Andrew Fabbro.
1794 2004-05-13 Paul Eggert <eggert@cs.ucla.edu>
1796 Improve performance of `sort -m' on large files, at the cost of
1797 making some contrived examples unsafe. POSIX allows this
1798 optimization. Performance problem reported by Jonathan Baker in
1799 <http://mail.gnu.org/archive/html/bug-coreutils/2004-05/msg00071.html>.
1801 * src/sort.c (first_same_file): Do not treat input pipes
1802 differently from other files.
1803 * doc/coreutils.texi (sort invocation): Document that "sort -m -o F"
1804 might write F before reading all the input.
1807 2004-05-12 Paul Eggert <eggert@cs.ucla.edu>
1809 * src/od.c (print_ascii, dump_strings): Use e.g. '\a' rather than
1810 '\007', for portability to EBCDIC hosts.
1811 * src/printf.c (print_esc_char): Likewise.
1812 * src/tr.c (unquote, make_printable_str): Likewise.
1814 2004-05-12 Jim Meyering <jim@meyering.net>
1816 * src/remove.c (AD_pop_and_chdir): Move lstat-`.' into if-block
1817 where the result is used. This avoids one unnecessary lstat call
1818 per command line argument.
1820 2004-05-12 Paul Eggert <eggert@cs.ucla.edu>
1822 Don't assume that "make -C" works; Solaris "make" doesn't have -C.
1824 * src/Makefile.am (all_programs.list): New rule, copied from
1825 man/Makefile.am and tests/Makefile.am, except that we use the
1826 system tr rather than ./tr and we don't use tr -s.
1827 * tests/Makefile.am (all_programs): Use it.
1828 * man/Makefile.am (all_programs): Likewise. Renamed from programs,
1829 for consistency. All uses changed.
1831 2004-05-11 Jim Meyering <jim@meyering.net>
1833 * tests/rm/unread3: New test, for the above fix and today's
1834 lib/save-cwd.c improvement.
1835 * tests/rm/Makefile.am (TESTS): Add unread3.
1837 * src/rm.c: Don't include "save-cwd.h". It's no longer used.
1839 2004-05-10 Jim Meyering <jim@meyering.net>
1841 * tests/install/trap: New file. Test for bug fix of 2004-04-18.
1842 * tests/install/Makefile.am (TESTS): Add trap.
1844 * src/remove.c (AD_push): Don't use errno in diagnostic about
1847 Remove these generated files from CVS.
1848 * tests/cut/cut-tests, tests/date/date-tests, tests/join/join-tests:
1849 * tests/ls/ls-tests, tests/pr/pr-tests, tests/tac/tac-tests:
1850 * tests/tail/tail-tests, tests/test/test-tests, tests/tr/range-tests:
1851 * tests/tr/tr-tests, tests/wc/wc-tests:
1853 2004-05-09 Jim Meyering <jim@meyering.net>
1855 * src/tr.c (unquote): Use xcalloc rather than xmalloc and
1856 a loop initializing the just-allocated memory to zero.
1858 2004-05-08 Jim Meyering <jim@meyering.net>
1860 * tests/rm/no-give-up: New file; check for today's fix.
1861 * tests/rm/Makefile.am (TESTS): Add no-give-up.
1863 2004-05-08 Paul Eggert <eggert@cs.ucla.edu>
1865 Fix bug where "rm" gave up too easily, reported by Dan Jacobsen in
1866 <http://mail.gnu.org/archive/html/bug-coreutils/2004-05/msg00013.html>.
1868 * src/remove.c (remove_entry): Check for errno values like ENOENT
1869 that show the file cannot be directory, instead of for errno
1870 values like EPERM that show the file might be a directory. This
1871 is necessary because, when a single unlink() call has multiple
1872 reasons to fail, it can set errno to any of those reasons; it's
1873 only the rare errno value like ENOENT that excludes all the other
1874 possible reasons to fail even when the file is a directory.
1875 (remove_cwd_entries): Don't attempt chdir if the file is known
1876 to not be a directory.
1877 (remove_dir): Use the same method that remove_cwd_entries uses
1878 (for some reason they differed). Don't assert that saved_errno
1879 must be EPERM; it might be just about anything.
1881 2004-05-06 Jim Meyering <jim@meyering.net>
1883 * src/id.c (xgetgroups): Use xnmalloc, rather than xmalloc.
1884 Don't add `1' to the buffer size (it was to protect against malloc
1885 implementations that fail to allocate a buffer of size zero).
1886 That is no longer necessary, since we use a malloc wrapper
1889 * src/wc.c (get_input_fstatus): Use xnmalloc, rather than xmalloc.
1890 * src/head.c (elide_tail_bytes_pipe): Likewise.
1891 * src/df.c (main): Likewise.
1892 * src/shred.c (do_wipefd): Likewise.
1893 * src/users.c (list_entries_users): Likewise.
1894 * src/tail.c (main): Likewise.
1895 * src/md5sum.c (main): Likewise.
1897 2004-04-29 Paul Eggert <eggert@cs.ucla.edu>
1899 * src/df.c (show_disk, show_point): If several filesystems are
1900 mounted on the same mount point, prefer the last one, not the first.
1901 Problem reported by Christian Jones in
1902 <http://mail.gnu.org/archive/html/bug-coreutils/2004-04/msg00200.html>.
1903 (show_disk): Remove unused statp arg. Return bool, not int.
1904 (show_point): Rewrite to avoid gotos. Use the same algorithm
1905 for lofs and dummies for each pass through the mount table,
1906 rather than subtly different algorithms (which are probably
1909 2004-05-03 Jim Meyering <jim@meyering.net>
1911 * Makefile.am (EXTRA_DIST): Add m4/ChangeLog, now that we no longer
1914 2004-05-01 Jim Meyering <jim@meyering.net>
1916 When chown or chgrp is modifying the referent of a symlink,
1917 use the chown(2) function, if possible.
1918 * src/chown-core.c (change_file_owner): Don't hard-code the
1919 open/fchown/close kludge here. Use `chown' instead.
1920 The chown function works just fine on conforming systems.
1921 Other systems now go through the new chown wrapper that
1922 resorts to the old kludge.
1924 * src/chown-core.c (change_file_owner): Add a comment.
1926 2004-04-27 Jim Meyering <jim@meyering.net>
1928 * src/ptx.c: Make over 40 global extern variables `static'.
1929 (syntax_table, re_syntax_table): Remove declarations of two unused
1930 variables (they were exposed by the above change).
1932 * src/du.c (G_fail, opt_nul_terminate_output): Declare `static'.
1933 * src/ln.c (backup_type): Likewise.
1935 * src/remove.c (rm): Add `extern' keyword.
1936 * src/cp-hash.c (forget_created, remember_created)
1937 (src_to_dest_lookup, remember_copied, hash_init, forget_all): Likewise.
1938 * src/copy.c (dest_info_init, src_info_init, copy): Likewise.
1939 * src/chown-core.c (chopt_init, chopt_free, gid_to_name)
1940 (uid_to_name, chown_files): Likewise.
1942 * src/Makefile.am (sc_tight_scope): New rule.
1943 * Makefile.maint (sc_tight_scope): New rule.
1944 (syntax-check-rules): Add it.
1946 2004-04-26 Jim Meyering <jim@meyering.net>
1948 * Use automake-1.8.4. Regenerate dependent files.
1950 * src/sort.c (limfield): Make a comment clearer.
1952 2004-04-25 Paul Eggert <eggert@twinsun.com>
1954 Fix POSIX-conformance bug: "sort -k 3,3.5b" is supposed to skip
1955 leading blanks when computing the location of the field end;
1956 it is not supposed to skip trailing blanks. Solaris 8 "sort"
1957 does conform to POSIX. Also fix the documentation to clarify
1958 this and related issues.
1960 * doc/coreutils.texi (sort invocation): Mention -k earlier, so
1961 that the options are in alphabetical order. Describe how -b works
1962 more-accurately; this involves fixing some examples, too. Mention
1963 what happens if the start field falls after an end field or after
1964 a line end. Warn about using -k without -b, -g, -M, -n, or -t.
1965 Add an example of how to sort IPv4 addresses and Apache Common
1966 Log Format dates. Remove a duplicate example.
1967 (Putting the tools together): Use separate options rather
1968 than agglomerating them.
1969 * src/sort.c (limfield): Use skipeblanks, not skipsblanks, to
1970 decode whether to skip leading blanks.
1971 (trailing_blanks): Remove.
1972 (fillbuf, getmonth, keycompare): Don't trim trailing blanks.
1974 * tests/pr/Test.pm: Fix typo in env_default comment.
1975 * tests/sort/Test.pm: Likewise.
1976 (18c, 18d): Reverse the order of output lines, so that the
1977 test cases conform to POSIX.
1979 2004-04-22 Paul Eggert <eggert@twinsun.com>
1981 More signal-handling cleanup for ls.c. Do not allow signals to
1982 happen between arbitrary output bytes, as the
1983 restore-default-color sequence can bollix up multibyte chars or
1984 color-change sequences in the ordinary output. Instead, process
1985 signals only between printing a file name and changing the color
1986 back to non_filename_text color. That way, if the signal handler
1987 changes the color (to the default), 'ls' will change it back when
1988 'ls' continues (after being suspended).
1990 Also, do not bother with signal-handling unless stdout is a
1991 controlling terminal; this lets stdio buffer better when "ls
1992 --color" is piped or sent to a file.
1994 * src/ls.c (sigprocmask, sigset_t) [!defined SA_NOCLDSTOP]: New macros.
1995 Do not include "full-write.h"; no longer needed.
1996 (tcgetpgrp) [! HAVE_TCGETPGRP]: New macro.
1997 (put_indicator_direct): Remove. All callers changed to use
1999 (caught_signals, interrupt_signal, stop_signal_count): New vars.
2000 (restore_default_color): Don't bother checking for put_indicator
2002 (sighandler): Don't handle SIGTSTP; that's another handler now.
2003 Simply set interrupt_signal to the signal, then exit.
2004 (stophandler, process_signals): New functions.
2005 (main): Don't output any color changes until _after_ the signal
2006 handlers are set up. This fixes a race condition where 'ls'
2007 could be interrupted while initializing colors, and leaving the
2008 terminal in an undesirable state.
2009 Don't mess with signal-handling if standard output is not a
2010 controlling terminal.
2011 When exiting, restore the default color, then restore the
2012 default signal handling, then act on any signals that weren't
2014 Do not print //DIRED// etc. in colors; this avoids the need
2015 to catch signals when printing them.
2016 (print_name_with_quoting): Process signals just before switching
2017 color back to non_filename_text.
2019 2004-04-23 Jim Meyering <jim@meyering.net>
2021 Avoid segfault on systems for which SIZE_MAX != (size_t) -1.
2022 * src/ls.c (quote_name): Use SIZE_MAX, not -1, in calls
2023 of quotearg_buffer. Patch by Mikulas Patocka.
2025 2004-04-18 Paul Eggert <eggert@twinsun.com>
2027 tee ignored SIGPIPE, but POSIX doesn't allow this.
2029 * src/tee.c (main): Do not ignore SIGPIPE, as POSIX 1003.1-2001
2030 does not allow this. This undoes the 1996-10-24 patch.
2032 2004-04-18 Paul Eggert <eggert@twinsun.com>
2034 Signal-handling cleanup for coreutils. Here are the highlights:
2036 - csplit sometimes failed to remove files when interrupted.
2037 - csplit didn't clean up if two signals arrived nearly simultaneously.
2038 - install -s would infloop on System V if SIGCHLD was ignored.
2039 - ls could incorrectly restore color if multiple signals
2040 arrived nearly simultaneously.
2042 * src/csplit.c (sigprocmask, sigset_t) [!defined SA_NOCLDSTOP]:
2044 (filename_space, prefix, suffix, digits, files_created, remove_files):
2046 (caught_signals): New var.
2047 (cleanup): Block signals while deleting all files.
2048 (cleanup_fatal, handle_line_error, regexp_error):
2049 Mark with ATTRIBUTE_NORETURN.
2050 (create_output_file, close_output_file, interrupt_handler):
2051 Block signals while changing the number of output files,
2052 to fix some race conditions.
2053 (delete_all_files): Do nothing if remove_files is zero.
2054 Clear files_created.
2055 (main): Don't mess with signals until after argument processing
2058 * src/csplit.c (main): Rewrite signal-catching code to make it
2059 similar to other coreutils programs. When processing signals,
2060 block all signals that we catch, but do not block signals that we
2061 don't catch. Avoid problems with unsigned int warnings.
2062 * src/ls.c (main): Likewise.
2063 * src/sort.c (main): Likewise.
2065 * src/csplit.c (interrupt_handler):
2066 Use void, not (obsolete) RETSIGTYPE.
2067 * src/shred.c (sigill_handler, isaac_seed_machdep): Likewise.
2069 * src/csplit.c (interrupt_handler) [defined SA_NOCLDSTOP]:
2070 Use simpler "signal (sig, SIG_DFL)" rather than sigaction equivalent.
2071 * src/ls.c (sighandler) [defined SA_NOCLDSTOP]: Likewise.
2072 * src/sort.c (sighandler) [defined SA_NOCLDSTOP]: Likewise.
2073 * src/nohup.c (main) [!defined _POSIX_SOURCE]: Likewise, except
2075 * src/tee.c (main) [!defined _POSIX_SOURCE]: Likewise.
2077 * src/install.c: Include <signal.h>.
2078 (main) [defined SIGCHLD]: Set SIGCHLD handler to the default, if -s is
2079 given, since System V fork+wait does not work if SIGCHLD is ignored.
2081 * src/ls.c (sighandler) [!defined SA_NOCLDSTOP]: Reset signal
2082 handler to self, not to SIG_IGN, since SIGTSTP can be received
2084 (main): Use SA_RESTART, as that is simpler than checking for EINTR
2085 failures all over the place.
2087 2004-04-20 Jim Meyering <jim@meyering.net>
2089 * src/remove.c (is_empty_dir): Clarify comment.
2091 * man/help2man: Accept new option: --program-name=NAME, so that we
2092 can override the one in --version output. This is needed solely
2093 so that test.1 doesn't refer to `[' as the program name.
2094 Reported by Benjamin Cutler as http://bugs.debian.org/205251.
2095 * man/Makefile.am (.x.1): Use help2man's new --program-name option.
2097 * src/pwd.c: Don't include pathmax.h; system.h already does it.
2099 * src/cut.c (cut_fields): Free buffer upon getndelim2 failure.
2101 2004-04-19 Jim Meyering <jim@meyering.net>
2103 * src/shred.c (isaac_seed_start) [AVOID_USED_UNINITIALIZED_WARNINGS]:
2104 Initialize a buffer to avoid warnings from tools like valgrind.
2106 * Makefile.maint (sc_trailing_blank): New rule.
2107 (syntax-check-rules): Add it.
2108 * .x-sc_trailing_blank: New file.
2110 Make pwd work even if the resulting name is so long that getcwd fails.
2111 * src/pwd.c: (path_free, path_init, path_prepend): New functions.
2112 (nth_parent, find_dir_entry, robust_getcwd): New functions.
2113 (main): First try getcwd, then, upon failure, robust_getcwd.
2115 2004-04-18 Jim Meyering <jim@meyering.net>
2117 * src/who.c (print_user): Use xrealloc here, rather than
2118 unchecked realloc. Remove anachronistic casts.
2120 * src/remove.c (full_filename_): Don't leak upon failed realloc.
2122 * src/system.h (readdir_ignoring_dot_and_dotdot): New inline function,
2124 * src/remove.c (readdir_ignoring_dotdirs): Move function to system.h,
2125 renaming it. Update uses.
2127 2004-04-17 Jim Meyering <jim@meyering.net>
2129 * configure.ac: Depend on automake-1.8.3.
2131 * src/join.c (add_file_name): Declare function to be `static'.
2132 (string_to_join_field): Likewise.
2133 * src/remove.c (ds_init, ds_free): Likewise.
2135 * Makefile.maint (sc_prohibit_jm_in_m4): New rule.
2136 (syntax-check-rules): Add to the list.
2138 2004-04-13 Paul Eggert <eggert@twinsun.com>
2140 Use page-aligned buffers whenever we bother to do I/O using buffer
2141 sizes that are tailored for the files.
2143 * src/cat.c: Include getpagesize.h.
2144 * src/copy.c: Likewise.
2145 * src/shred.c: Likewise.
2146 * src/split.c: Likewise.
2147 * src/cat.c (main): Align I/O buffers to page boundaries.
2148 * src/copy.c (copy_reg): Likewise.
2149 * src/shred.c (dopass): Likewise.
2150 * src/split.c (main): Likewise.
2151 * src/dd.c (ROUND_UP_OFFSET, PTR_ALIGN): Remove.
2152 All uses replaced by ptr_align.
2153 * src/od.c (gcd, lcm): Remove; now in system.h.
2154 * src/system.h (gcd, lcm, ptr_align): New functions, moved from od.c.
2156 2004-04-14 Jim Meyering <jim@meyering.net>
2158 Remove m4/Makefile.am: it's no longer needed, with newer automake
2159 * configure.ac (AC_CONFIG_FILES): Remove m4/Makefile.in from the list.
2160 * Makefile.am (SUBDIRS): Remove `m4' from the list.
2162 2004-04-13 Jim Meyering <jim@meyering.net>
2164 * configure.ac: Change `jm_' in AC_DEFINE'd names to `gl_'.
2166 2004-03-27 Paul Eggert <eggert@twinsun.com>
2168 * NEWS: cp -pu and mv -u (when copying) now take the destination
2169 file system time stamp resolution into account.
2170 * doc/coreutils.texi (mv invocation): Document this.
2171 (cp invocation): Document -u (it was missing!) with new behavior.
2173 * src/copy.c: Include "utimecmp.h".
2174 (copy_internal): Compare time stamps using utimecmp rather than
2177 2004-04-09 Jim Meyering <jim@meyering.net>
2179 * Makefile.maint (.re-list): New rule/file, to replace
2180 hard-coded list of header file names.
2181 (sc_system_h_headers): Use the new file.
2182 Don't look for sys2.h anymore.
2184 * src/system.h: Include new "stat-macros.h" rather than hard-coding
2185 all of its macro definitions -- the list was slightly out of date.
2186 Suggestion from Dmitry V. Levin.
2188 2004-04-08 Paul Eggert <eggert@cs.ucla.edu>
2190 * NEWS: Remove noctty flag from dd. Suggested by Philippe Troin.
2191 * doc/coreutils.texi (dd invocation): Likewise.
2192 * src/shred.c (O_NOCTTY): Remove redundant decl.
2193 * src/dd.c (flags, usage): Remove noctty flag.
2194 (main): Always use O_NOCTTY when opening files.
2196 2004-04-08 Jim Meyering <jim@meyering.net>
2198 * src/dd.c (dd_copy): Mark two diagnostics for translations.
2199 (set_fd_flags): Undo part of today's change: it's a little
2200 cleaner -- and more efficient in the common case -- to go
2201 ahead and OR in the -1 when fcntl fails.
2203 * Makefile.maint (sc_dd_max_sym_length): New target.
2204 (syntax-check-rules): Add it.
2206 * src/md5sum.c (PROGRAM_NAME) [algorithm == ALG_SHA1]:
2207 Correct spelling: s/shasum/sha1sum. Reported by Jesse Kornblum.
2209 * src/dd.c (set_fd_flags): Don't OR in -1 when fcntl fails.
2210 Rename parameter, flags, to avoid shadowing global.
2211 (LONGEST_SYMBOL): Tweak comment.
2213 2004-04-07 Paul Eggert <eggert@twinsun.com>
2215 * NEWS: New dd conv= symbols nocreat, excl, fdatasync, fsync,
2216 and new dd options iflag= and oflag=.
2217 * src/dd.c (usage): Likewise.
2218 * src/Makefile.am (dd_LDADD, shred_LDADD): Add fdatasync's lib.
2219 * src/dd.c (fdatasync) [!HAVE_FDATASYNC]: New macro.
2220 (C_NOCREAT, C_EXCL, C_FDATASYNC, C_FSYNC): New macros.
2221 (input_flags, output_flags): New vars.
2222 (LONGEST_SYMBOL): New macro.
2223 (struct symbol_value): Renamed from struct conversion. Members
2224 symbol and value renamed from convname and conversion. The
2225 symbol value is now an array instead of a pointer; this saves
2226 a bit of space and time in practice. All uses changed.
2227 (conversions): Add nocreat, excl, fdatasync, fsync. Now const.
2228 (flags): New constant array.
2229 (iflag_error_msgid, oflag_error_msgid): New constants.
2230 (parse_symbols): Renamed from parse_conversion and generalized
2231 to handle either conversion or flag symbols.
2232 (scanargs): Adjust uses of parse_symbols accodingly. Add
2233 support for iflag= and oflag=. Reject attempts to use
2234 both excl and nocreat.
2235 (set_fd_flags): New function.
2236 (dd_copy): Just return X rather than calling quit (X), since our
2237 caller invokes quit with the returned value. Add support for
2238 fdatasync and fsync.
2239 (main): Add support for iflag=, oflag=, and new conv= symbols.
2240 * src/system.h (O_DIRECT, O_DSYNC, O_NDELAY, O_NOFOLLOW,
2241 O_RSYNC, O_SYNC): Define to 0 if not already defined.
2243 * NEWS: Remove duplicate mention of BLOCKSIZE.
2245 2004-04-02 Andreas Schwab <schwab@suse.de>
2247 * src/stty.c: Add support for IUTF8 input flag.
2249 2004-04-06 Jim Meyering <jim@meyering.net>
2251 * src/system.h (makedev) [mkdev && !makedev]: Define in terms of mkdev.
2252 Interix spells it `mkdev'. Reported by Mark Funkenhauser.
2254 2004-04-04 Jim Meyering <jim@meyering.net>
2256 A specified format is no longer automatically newline terminated.
2257 If you want a newline at the end of your format, use `\n'.
2258 * src/stat.c (print_it): Don't print a newline at the end of
2260 (do_statfs): Add a newline at end of each default format string.
2262 2004-03-30 Paul Eggert <eggert@twinsun.com>
2264 * src/nohup.c (main): Adjust to new calling convention
2265 for set_cloexec_flag.
2267 2004-03-31 Jim Meyering <jim@meyering.net>
2269 * tests/Fetish.pm (run_tests): Remove `.orig' file.
2270 Remove debugging diagnostic.
2272 Specifying an invalid --width=N (-w) or --gap-size=N (-g)
2273 would not elicit an error.
2274 * src/ptx.c: Include "xstrtol.h" and "quotearg.h".
2275 (main): Don't use atoi. Use xstrtoul instead.
2277 2004-03-30 Jim Meyering <jim@meyering.net>
2279 * Makefile.maint (sc_prohibit_atoi_atof): New rule.
2280 (syntax-check-rules): Add it.
2281 * .x-sc_prohibit_atoi_atof: New file.
2283 2004-03-29 Jim Meyering <jim@meyering.net>
2285 * tests/du/files0-from: Use new OUT_SUBST directive, so that this
2286 test is not sensitive to system-dependent block size differences.
2287 Prompted by a report of Solaris 8 differences from Paul Eggert.
2289 * tests/Fetish.pm: Accept new directives: OUT_SUBST, ERR_SUBST.
2290 Rename `%tmp' to `%actual'. Reverse order of last two args to
2291 _compare_files (to $actual, $expected) so as to match declaration.
2293 2004-03-28 Paul Eggert <eggert@twinsun.com>
2295 Fix some gotchas encountered when porting to Solaris 8, using
2296 the Forte 6u2 compiler.
2298 * src/hostname.c [HAVE_SETHOSTNAME && !defined sethostname]:
2299 Declare sethostname, since no Solaris header does it.
2300 * src/who.c: Include "vasprintf.h", for asprintf.
2302 2004-03-28 Jim Meyering <jim@meyering.net>
2305 * src/du.c (process_file): Don't record dev/inode for directories.
2307 Under some circumstances, without -c, du would mistakenly count the
2308 space of hard-linked files, not just the first one it encountered.
2309 Reported by Anthony Thyssen.
2310 * src/du.c (du_files): Don't ever clear the set of `seen' dev/inodes.
2312 * src/du.c: Rename global `print_totals' to `print_grand_total'.
2314 * src/du.c (main): Rearrange filtering loop to be a tiny bit
2317 * src/chown-core.c: Don't include savedir.h -- no longer needed.
2318 * src/chmod.c: Likewise.
2320 2004-03-25 Jim Meyering <jim@meyering.net>
2322 * src/du.c (main): Remove now-unused declaration of `i'.
2324 2004-03-24 Paul Eggert <eggert@twinsun.com>
2326 * src/du.c (main): Filter out file names of length zero before
2327 invoking fts, so that they don't cause fatal errors.
2329 2004-03-25 Jim Meyering <jim@meyering.net>
2331 * tests/du/files0-from (zero-len): Add a test for the above.
2333 2004-02-25 Paul Eggert <eggert@twinsun.com>
2335 * NEWS: New environment var BLOCKSIZE.
2336 * lib/human.c (humblock): Support BLOCKSIZE as well as BLOCK_SIZE.
2337 * tests/envvar-check: Test for it. Factor the code to simplify it.
2339 2004-03-23 Paul Eggert <eggert@twinsun.com>
2341 * NEWS: Shorten the du --files0-from announcement, and say
2342 "NUL-terminated" rather than "NUL-separated".
2343 * src/du.c (EXPECTED_BYTES_PER_FILE_NAME, DEFAULT_PROJECTED_N_FILES):
2345 (usage): Say "NUL-terminated", not "NUL-separated".
2346 (main): Check for I/O error when istream is closed.
2347 Allow --files0-from=F even if F is empty; this specifies no files.
2348 (du_files): Now that we allow the list of files to be empty,
2350 * tests/du/files0-from: Adjust to above changes to src/du.c.
2352 2004-03-24 Jim Meyering <jim@meyering.net>
2354 * tests/tail-2/assert: Avoid race condition that could cause
2355 spurious failure. Based on a patch from Andreas Schwab.
2357 2004-03-23 Jim Meyering <jim@meyering.net>
2359 * src/du.c (main): Free the hash table, too.
2361 2004-03-22 Jim Meyering <jim@meyering.net>
2363 * man/Makefile.am (.x.1): Remove --info-page= option, reverting
2364 the change of 2004-01-22. I can no longer reproduce the problem
2365 that prompted that change, and `info coreutils pr' would display the
2366 `printing text' section of the manual, not the one on `pr invocation'.
2368 * tests/du/files0-from (nul-1, nul-2): Adjust expected diagnostics
2369 to match corrected output.
2371 * src/du.c: Include "readtokens0.h" rather than "readtokens.h".
2372 (main): Use readtoken0 functions rather than readtokens.
2373 Don't use errno when diagnosing readtokens0 failure.
2374 Fix off-by-one error in the token number reported in a diagnostic.
2375 (du_files): Return bool, rather than int.
2376 (main): Call readtokens0_free.
2378 2004-03-21 Jim Meyering <jim@meyering.net>
2380 * src/remove.c (ds_free): Plug a small leak.
2382 * tests/Fetish.pm: Fix typo in comment.
2384 2004-03-07 Jim Meyering <jim@meyering.net>
2386 * NEWS: du accepts a new option --files0-from=FILE, where FILE
2387 contains a list of NUL-separated file names.
2389 * src/du.c: Include "readtokens.h".
2390 (usage): Describe the new option, and adjust the `Usage':
2391 with this option, no FILE may be specified on the command line.
2392 (main): Handle the new option.
2394 * tests/du/files0-from: New tests, for the above.
2395 * tests/du/Makefile.am (TESTS): Add files0-from.
2397 * src/factor.c (do_stdin): Reflect changes in use of readtoken.
2398 * src/tsort.c (tsort): Likewise.
2400 2004-02-29 Paul Eggert <eggert@twinsun.com>
2402 * NEWS: Add support for a new notation @N to get_date to represent
2403 the time stamp with numeric value N. Improve support for
2404 fractional time stamps. date's -d and -f options now accept them.
2405 Likewise for touch -t. date has a new option --iso-8601=ns.
2407 * doc/coreutils.texi (touch invocation):
2408 Describe use of fractional seconds.
2409 (date invocation, Options for date): Likewise.
2410 * doc/getdate.texi (General date syntax, Time of day items): Likewise.
2411 * doc/coreutils.texi (date invocation): Mention effect of LC_TIME.
2412 (Options for date): Describe new --iso-8601=ns option.
2414 * doc/getdate.texi: Add copyright notice. Change getdate to
2415 get_date when talking about the function name.
2416 (Seconds since the Epoch): New section, containing the time_t
2417 info moved from Date input formats section, along with new
2418 info about the @ syntax. Mention negative time stamps,
2419 fractional time stamps, and leap seconds.
2420 (General date syntax): Modernize examples a bit to reflect new
2422 (General date syntax, Relative items in date strings):
2423 Use ' rather than " to quote formats.
2424 (Time of day items): Add an example with fractional seconds.
2425 Describe fractional-second syntax.
2427 * src/Makefile.am (touch_LDADD): New macro, since `touch' now
2428 needs clock_gettime.
2430 * src/date.c (enum Time_spec): New enum TIME_SPEC_NS.
2431 (time_spec_string, time_spec, show_date): Support it.
2432 (usage): Remove description of -ITIMESPEC, as it's obsolete and
2433 confusing. Mention --iso-8601=ns.
2434 (batch_convert): getline returns ssize_t, not int.
2436 * src/touch.c (newtime): Now an array of two timespecs, one
2437 for access and one for modification.
2438 (ref_stats): Remove.
2439 (get_reldate): Use get_date's parameter profile.
2440 (touch, main): Adjust to above changes.
2441 (main): Work even if tm_year == INT_MAX (so long as long int is wider).
2442 Use gettime instead of gettimeofday, for new get_date signature.
2444 * tests/date/Test.pm (test_vector): New tests epoch, ns-10, ns-max32,
2447 2004-03-15 Jim Meyering <jim@meyering.net>
2449 * Makefile.maint (alpha beta major): `Make' the emit_upload_commands
2450 target before updating $(prev_version_file).
2452 * tests/misc/date-sec: New file, to test for just-fixed bug in date.
2453 See today's change in lib/getdate.y.
2454 * tests/misc/Makefile.am (TESTS): Add date-sec.
2456 2004-03-14 Jim Meyering <jim@meyering.net>
2458 * announce-gen (print_changelog_deltas): Use `.sig' suffix for
2459 signature files, not `.asc'. Reported by angico@yahoo.com.
2461 2004-03-13 Jim Meyering <jim@meyering.net>
2463 * src/cp.c (do_copy): Tweak wording in a diagnostic.
2464 Suggestion from Karl Berry.
2465 Include "quoatearg.h".
2466 (do_copy): Use quotearg_colon (not quote) for diagnostics
2467 that begin with `"%s:'.
2469 * src/nl.c (usage): Specify that nl uses _basic_ regular expressions.
2470 Suggestion from Dan Jacobson.
2472 2004-03-12 Jim Meyering <jim@meyering.net>
2476 Sometimes, when source and destination partition are different,
2477 mv mistakenly fails to preserve a hard link. Reported by IIDA Yosiaki.
2479 * src/copy.c: When moving a set of N hard-linked files between
2480 partitions, via two or more command line arguments where the
2481 command line argument containing the Nth link contains no other
2482 link to that same file, mv would mistakenly copy the file, rather
2483 than hard-linking it to the other(s). That happens because when the
2484 final link is processed, its link count has been reduced to 1 since
2485 the other links have been `copied' to the destination partition
2486 and the source links have been removed.
2487 (copy_internal): When in move mode, use the source dev/inode
2488 pair to look up destination name even when st_nlink == 1.
2489 * src/cp-hash.c (src_to_dest_lookup): New function.
2490 * src/cp-hash.h (src_to_dest_lookup): Add prototype.
2491 * tests/mv/part-hardlink: New file. Test for the above fix.
2492 * tests/mv/Makefile.am (TESTS): Add part-hardlink.
2494 * announce-gen: Sync with autoconf.
2496 * tests/ls/time-1: Exit 77 (not 1) if we can't set up for the test.
2497 This was triggered on a Linux-2.2.19 system using a file system
2498 NFS-mounted from some sort of Sun.
2500 2004-03-11 Jim Meyering <jim@meyering.net>
2502 * Use automake-1.8.3. Regenerate dependent files.
2504 2004-03-10 Jim Meyering <jim@meyering.net>
2506 * tests/du/deref-args: Also convert sizes in the 70-79 kB range,
2507 so that this test works with SELinux-enabled systems.
2508 Based on a patch from Tim Waugh.
2510 `join -1 x' would give a misleading diagnostic
2511 * src/join.c (string_to_join_field): Report that a non-numeric field
2512 number is invalid, rather than `so large that it is not representable'.
2513 * tests/join/Test.pm (invalid-j): New partial test for the above fix.
2515 2004-03-06 Jim Meyering <jim@meyering.net>
2517 cp --sparse=always sparse-image-file.img /dev/hda1 could
2518 produce an invalid copy on the destination device.
2520 * src/copy.c (copy_reg): Even with --sparse=always, try to
2521 make `holes' only if the destination is a regular file.
2522 Reported by Szakacsits Szabolcs.
2524 2004-03-03 Paul Eggert <eggert@twinsun.com>
2526 * src/nohup.c (main): Don't invoke set_cloexec_flag with
2527 a file descriptor of -1.
2529 2004-03-02 Dmitry V. Levin <ldv@altlinux.org>
2531 * src/nohup.c: Include "cloexec.h".
2532 (main): Set the copy of stderr to close on exec.
2534 2004-03-01 Paul Eggert <eggert@twinsun.com>
2536 * configure.ac: Include <signal.h> when checking for strsignal,
2537 sys_siglist, and friends. Problem reported by Tony Leneis in
2538 <http://mail.gnu.org/archive/html/bug-coreutils/2004-02/msg00136.html>.
2540 2004-02-25 Paul Eggert <eggert@twinsun.com>
2542 * tests/du/deref-args, tests/du/exclude, tests/du/slash:
2543 * tests/du/trailing-slash: Run envvar-check in case BLOCK_SIZE
2546 2004-02-23 Paul Eggert <eggert@twinsun.com>
2548 * NEWS: Document how chown's USER.GROUP argument is now parsed.
2550 2004-02-23 Jim Meyering <jim@meyering.net>
2552 * src/seq.c (usage): Remove stray space after \n in --help output.
2554 2004-02-22 Jim Meyering <jim@meyering.net>
2556 * src/du.c (usage): Separate -H and --si. Say that the meaning
2557 of -H will soon change to that of --dereference-args (-D).
2559 2004-02-21 Jim Meyering <jim@meyering.net>
2561 * src/comm.c (usage): Tell what comm does when there are no options.
2562 Reword in terms of FILE1 and FILE2 rather than `left file' and
2563 `right file'. Suggestion from Dan Jacobson.
2565 2004-02-15 Paul Eggert <eggert@twinsun.com>
2567 Fix some POSIX-conformance bugs in expr.
2569 * NEWS: document the following changes to src/expr.c.
2570 * doc/coreutils.texi (expr invocation): Likewise.
2571 Document what forms integers may take, and say "integer"
2572 consistently instead of "number". Warn about operands
2573 that "expr" can misinterpret, and how to work around the
2575 * src/expr.c (eval, eval7, eval6, eval5, eval4, eval3, eval2, eval1):
2576 Accept a bool argument specifying whether to evaluate the
2577 expression. This is to allow short-circuit evaluation. All
2579 (null): Report that a string is zero even if it has
2580 a form like "-0" or "00".
2581 (eval1, eval): Use short-circuit evaluation for | and &.
2582 (eval): Return 0 if both arguments are null or zero, instead
2583 of returning the first argument.
2584 * tests/expr/basic: Add some tests for the above.
2586 2004-02-17 Jim Meyering <jim@meyering.net>
2590 `make check' from a build inside a chroot environment would fail
2591 * tests/help-version: Specify an argument (`/') for df, in the
2592 unusual event that there is no valid entry in /etc/mtab.
2593 Likewise for id: add the -u option, so we don't get spurious
2594 failures when there are no user or group names.
2597 * src/sort.c (usage) [-u]: Add punctuation so that the description in
2598 the help2man-generated (line-joined) man page is more readable.
2599 Reported by Tim Waugh.
2600 [-T]: Add a semicolon, for the same reason.
2602 2004-02-15 Jim Meyering <jim@meyering.net>
2604 * Makefile.am (dist-hook): Qualify target with $(srcdir)/ prefix.
2606 2004-02-11 Jim Meyering <jim@meyering.net>
2608 * tests/Makefile.am.in ($(srcdir)/Makefile.am): Use more portable
2609 $(srcdir)/../Makefile.am.in, rather than $<.
2610 Suggestion from Michael Elizabeth Chastain.
2612 2004-02-10 Jim Meyering <jim@meyering.net>
2614 * config/install-sh: Make this script executable.
2615 * Makefile.am (dist-hook): New target, to ensure that config/install-sh
2616 is executable. Otherwise, on systems that lack a suitable install
2617 binary, `make install' would fail, because of the way this script
2618 is invoked (without `$SHELL ' prefix).
2619 Reported by Bob Proulx.
2621 2004-02-08 Jim Meyering <jim@meyering.net>
2625 * tests/rm/rm5: Avoid triggering a bug in OSF/Tru64's sed
2626 that would cause an unwarranted test failure.
2627 * tests/rm/rm3: Likewise.
2629 2004-02-07 Jim Meyering <jim@meyering.net>
2631 Remove xstat function pointer member. The way it was used was not
2632 portable, since some systems (OSF V5.1, Solaris 2.5.1) provide static
2633 inline `stat' and `lstat' functions, thus making the tests of
2634 `xstat == lstat' in copy.c always fail.
2635 * src/copy.h (struct cp_options) [xstat]: Remove member.
2637 * src/copy.c (copy_dir): Set `.dereference' member, not .xstat.
2638 (copy_internal): Use `XSTAT (x, ...)' in place of `*(x->xstat) (...)'.
2639 Use `x->dereference == DEREF_NEVER' in place of `x->xstat == lstat'.
2640 (valid_options): Remove now-obsolete FIXME comments.
2642 * src/cp.c (re_protect): Use `XSTAT (x, ...)' in place of
2643 `*(x->xstat) (...)'.
2644 (do_copy): Declare/use local xstat rather than x->xstat.
2645 (main): Remove code that set x.xstat.
2646 * src/mv.c (cp_option_init): Don't initialize xstat member.
2647 * src/install.c (cp_option_init): Likewise.
2649 * Makefile.cfg (gnu_ftp_host-alpha, etc.): Un-factor .gnu.org suffix,
2650 so that emit_upload_commands can use these variables, too.
2652 2004-02-06 Jim Meyering <jim@meyering.net>
2654 * tests/rm/deep-1: Remove `du' stack space test.
2655 Apparently, `ulimit -s N' isn't portable enough.
2656 This test will be restored (with a guard against losing ulimit)
2657 in its own file later.
2659 * tests/rm/deep-1 (deep): Remove progress-style diagnostics,
2660 since this test doesn't take long enough to merit them.
2661 Run du on $tmp (the containing dir), not $deep, the full path to leaf.
2663 * Makefile.maint (signatures): Remove definition.
2664 Now, automake's gnupload handles this.
2665 (%.sig: %): Remove now-unused rule.
2666 (rel-files): Use automake's $(DIST_ARCHIVES), rather than
2667 `$(distdir).tar.bz2 $(distdir).tar.gz'.
2668 (emit-upload-commands): Adjust to use gnupload.
2670 2004-02-05 Jim Meyering <jim@meyering.net>
2672 * src/system.h (ST_TIME_CMP_NS, ST_TIME_CMP): Remove definitions.
2673 (ATIME_CMP, CTIME_CMP, MTIME_CMP, TIMESPEC_NS): Likewise.
2674 Now, those are all defined in timespec.h.
2677 * src/date.c: Don't include timespec.h, now that system.h does it.
2679 2004-02-02 Paul Eggert <eggert@twinsun.com>
2681 Don't dump core if localtime returns NULL (possible on
2682 hosts with 64-bit time_t and 32-bit int).
2683 * src/date.c: Include "inttostr.h".
2684 (batch_convert, main):
2685 If time conversion fails, exit with nonzero status.
2686 (show_date): Return int to report conversion failure.
2687 Print the time as an int if localtime fails.
2688 * src/uptime.c: Print "??" if the current clock can't
2689 be converted by localtime. This won't happen until the year
2690 2*31 + 1900, but we don't want to dump core even if the current
2691 clock has the wrong value.
2693 * src/stat.c: Include "inttostr.h".
2694 (human_time): Print the date/time as a number of seconds since the
2695 epoch if it can't be converted by localtime. This is better than
2696 just saying "invalid", and is consistent with what "ls" does.
2697 Don't dump core if the year has more than 48 digits; this isn't
2698 possible on any contemporary host, but we might as well do it right.
2700 2004-01-31 Paul Eggert <eggert@twinsun.com>
2702 * src/stat.c (human_time): Accept time rather than
2703 pointer-to-const-time parameter, for clarity. All callers changed.
2705 2004-02-02 Jim Meyering <jim@meyering.net>
2707 * src/stat.c (do_stat): Remove extra trailing newline from
2708 default formats. Reported by Nelson H. F. Beebe.
2710 Print actual fractional seconds in time stamps, not just `.00000000'.
2711 * src/stat.c (human_time): Add and use new parameter, t_ns.
2712 (print_stat): Update callers.
2713 * src/ls.c (TIMESPEC_NS): Remove definition.
2714 * src/system.h (TIMESPEC_NS): Define here, instead, now that stat.c
2715 also uses this macro.
2716 Nelson H. F. Beebe noticed that ls --full-time printed nonzero
2717 fractional seconds for files on an XFS file system, but that stat's
2718 fractional seconds were always zero.
2720 2004-01-28 Paul Eggert <eggert@twinsun.com>
2722 * src/seq.c (print_numbers): Use 'double' for loop index, not
2723 'int', to avoid problems with integer overflow. On almost all
2724 machines 'double' works in every case where 'int' works, and
2725 it works on other cases besides.
2727 2004-01-27 Jim Meyering <jim@meyering.net>
2729 * src/seq.c (usage): Mention that if INCREMENT is omitted,
2730 it defaults to 1, even when FIRST is larger than LAST.
2731 Reword so as not to exclude the possibility that INCREMENT be zero.
2733 2004-01-25 Jim Meyering <jim@meyering.net>
2737 * Makefile.maint (signatures): Comment out definition.
2739 2004-01-23 Jim Meyering <jim@meyering.net>
2741 * Makefile.maint (header_regexp): Add exitfail.
2743 * man/Makefile.am (EXTRA_DIST): Add help2man.
2744 Reported by Nelson H. F. Beebe.
2746 * man/Makefile.am (.x.1): Prefix help2man invocation with `$(PERL) --'
2747 so it works on systems with Perl installed somewhere other than in
2750 * src/paste.c (paste_parallel): Declare local, chr, to be of type
2751 `int', not `char', since it must hold EOF. This bug would make
2752 paste infloop on some systems. Test failures reported by
2753 Nelson H. F. Beebe and Christian Krackowizer.
2755 2004-01-22 Jim Meyering <jim@meyering.net>
2757 * tests/rmdir/fail-perm: New file. Test for just-fixed rmdir bug.
2758 * tests/rmdir/Makefile.am (TESTS): Add fail-perm.
2760 * man/help2man: Fix it so using --info-page='coreutils PROG' works.
2761 * man/Makefile.am (.x.1): Invoke our own (tweaked) copy of help2man.
2762 Use --info-page='coreutils PROG' option.
2763 Now, readlink.1 refers the user to `info coreutils readlink'
2764 rather than to `info readlink'. Reported by Matt Swift.
2766 2004-01-21 Paul Eggert <eggert@twinsun.com>
2768 Exit status cleanup.
2770 * src/basename.c (usage): Use EXIT_SUCCESS, not 0, for clarity.
2771 * src/cat.c, src/chgrp.c, src/chmod.c, src/chown.c, src/chroot.c,
2772 * src/cksum.c, src/comm.c, src/cp.c, src/csplit.c, src/cut.c,
2773 * src/date.c, src/dd.c, src/df.c, src/dircolors.c, src/dirname.c,
2774 * src/du.c, src/echo.c, src/env.c, src/expand.c, src/expr.c,
2775 * src/factor.c, src/fmt.c, src/fold.c, src/head.c, src/hostid.c,
2776 * src/hostname.c, src/id.c, src/install.c, src/join.c, src/kill.c,
2777 * src/link.c, src/ln.c, src/logname.c, src/ls.c, src/md5sum.c,
2778 * src/mkdir.c, src/mkfifo.c, src/mknod.c, src/mv.c, src/nice.c,
2779 * src/nl.c, src/nohup.c, src/od.c, src/paste.c, src/pathchk.c,
2780 * src/pinky.c, src/pr.c, src/printenv.c, src/printf.c, src/pwd.c,
2781 * src/rm.c, src/rmdir.c, src/seq.c, src/setuidgid.c, src/shred.c,
2782 * src/sleep.c, src/sort.c, src/split.c, src/stat.c, src/stty.c,
2783 * src/su.c, src/sum.c, src/sync.c, src/tac.c, src/tail.c, src/tee.c,
2784 * src/test.c, src/touch.c, src/tr.c, src/tsort.c, src/tty.c,
2785 * src/uname.c, src/unexpand.c, src/uniq.c, src/unlink.c, src/uptime.c,
2786 * src/users.c, src/wc.c, src/who.c, src/whoami.c, src/yes.c: Likewise.
2788 * src/cat.c (usage): Don't bother normalizing exit status
2789 since the arg is already the correct exit status now.
2790 * src/cksum.c, src/comm.c, src/csplit.c, src/cut.c,
2791 * src/dircolors.c, src/expand.c, src/fmt.c, src/fold.c, src/head.c,
2792 * src/join.c, src/md5sum.c, src/nl.c, src/od.c, src/paste.c,
2793 * src/pr.c, src/split.c, src/sum.c, src/tac.c, src/tail.c, src/tr.c,
2794 * src/tsort.c, unexpand.c, src/src/uniq.c, src/src/wc.c: Likewise.
2796 * src/chown.c (main): Removed unused local 'fail'.
2798 * src/chroot.c (CHROOT_FOUND_BUT_CANNOT_INVOKE, CHROOT_FAILURE):
2801 * src/chroot.c (main): Initialize exit_failure to EXIT_FAIL.
2802 * src/env.c, src/nice.c, src/su.c: Likewise.
2803 * src/nohup.c (main): Likewise, to NOHUP_FAILURE.
2804 * src/setuidgid.c (main): Likewise, to SETUIDGID_FAILURE.
2805 * src/expr.c (main): Use initialize_exit_failure rather than
2806 setting exit_failure directly; this optimizes away redundant
2808 * src/printenv.c, src/sort.c, src/test.c, src/tty.c: Likewise.
2810 * src/chroot.c (main): Exit with status 1 rather than 127
2811 if chroot itself fails, as per documentation.
2813 * src/chroot.c (main): Use EXIT_ENOENT and EXIT_CANNOT_INVOKE
2814 rather than roll-your-own symbols or integers.
2815 * src/env.c (main): Likewise.
2816 * src/nohup.c (main): Likewise.
2817 * src/su.c (run_shell): Likewise.
2819 * src/cp.c (exit_status): Remove static var....
2820 (main): Making it local here instead. Use =, not |=, to set it.
2822 * src/cut.c (FATAL_ERROR, main): Exit with status EXIT_FAILURE,
2824 * src/date.c (batch_convert, main): Likewise.
2825 * src/dd.c (dd_copy): Likewise.
2826 * src/pr.c (first_last_page, main, getoptarg): Likewise.
2827 * src/tr.c (main): Likewise.
2828 * src/date.c (main): Don't assume EXIT_FAILURE == 1, as
2829 POSIX doesn't require it.
2830 * src/dd.c (write_output, skip, dd_copy): Likewise.
2831 * src/df.c (main): Likewise.
2832 * src/id.c (main): Likewise.
2833 * src/install.c (main): Likewise.
2834 * src/ln.c (main): Likewise.
2835 * src/ls.c (main): Likewise.
2836 * src/mv.c (main): Likewise.
2837 * src/shred.c (main): Likewise.
2839 * src/env.c (main): Exit with status 1, not 2, on errors detected
2841 * src/hostname.c (main): Likewise.
2842 * src/nl.c (main): Likewise.
2843 * src/stty.c (main): Likewise.
2845 * src/expr.c (EXPR_FAILURE): Renamed from EXPR_ERROR, for
2846 consistency with the other programs' naming conventions.
2849 * src/factor.c (main): Do not report a usage error simply
2850 because stdin has bad numbers.
2852 * src/id.c (problems): Now a boolean int, not a counter,
2853 so that we don't have to worry about int overflow. All uses changed.
2854 * src/touch.c (err): Likewise.
2856 * src/md5sum.c (main): Use int, not size_t, to store boolean int.
2858 * src/mkfifo.c (main): Exit with status 1, not 4, if not implemented.
2859 * src/mknod.c: Likewise.
2861 * src/nice.c (main): Exit with status EXIT_FAIL, not EXIT_FAILURE,
2862 on error; this is in case EXIT_FAILURE is unusual.
2863 * src/su.c (main): Likewise.
2865 * src/nohup.c (NOHUP_FOUND_BUT_CANNOT_INVOKE): Remove; all uses
2866 changed to EXIT_CANNOT_INVOKE.
2868 * src/printenv.c (PRINTENV_FAILURE): New constant.
2869 (main): Exit with status PRINTENV_FAILURE, not EXIT_FAILURE, on
2870 command-line syntax problems.
2872 * src/rmdir.c (remove_parents): Don't set 'fail' to a negative number.
2873 (main): Avoid integer overflow when seeing whether errors occurred.
2875 * src/seq.c (print_numbers): Now returns void, not (zero) int.
2876 All callers changed.
2877 (main): Remove unused local variable 'errs'. Always exit successfully
2878 if we reach the end.
2880 * src/setuidgid.c (SETUIDGID_FAILURE): Renamed from FAIL_STATUS,
2881 for consistency with other programs here. All uses changed.
2882 (main): Use 'error' to exit rather than invoking 'exit' here.
2884 * src/sort.c: Don't include <assert.h>.
2885 (SORT_OUT_OF_ORDER, SORT_FAILURE): Now enums, not macros.
2886 (usage): Don't use 'assert'.
2887 (main): Remove redundant assignment to exit_failure.
2889 * src/system.h (EXIT_FAIL, EXIT_CANNOT_INVOKE, EXIT_ENOENT):
2891 (initialize_exit_failure): New inline function.
2892 Include exitfail.h here, since we refer to exit_failure.
2893 All callers changed to not include exitfail.h.
2895 * src/tty.c (TTY_FAILURE, TTY_WRITE_ERROR): New enum values;
2896 substitute them for the corresponding integer constants.
2898 * tests/help-version (expected_failure_status_date): Remove, as
2899 'date' is now normal.
2900 (expected_failure_status_nohup): New var.
2902 2004-01-21 Jim Meyering <jim@meyering.net>
2904 * tests/touch/relative: Remove `command' syntax.
2905 Thanks to Nelson H. F. Beebe and Paul Eggert.
2907 * tests/touch/relative: Test only year/month/day, not hours/min/sec,
2908 so as to avoid problems with systems using TAI clocks.
2909 Although it's no longer necessary, set TZ=UTC0 also for the
2910 initial touch command. Reported by Paul Jarc here:
2911 http://article.gmane.org/gmane.comp.gnu.core-utils.bugs/1504
2913 2004-01-20 Diego Biurrun <diego@biurrun.de>
2915 * src/dircolors.hin: Add .mov to the list of media files.
2917 2004-01-19 Paul Eggert <eggert@twinsun.com>
2919 * tests/touch/relative: Use TZ=UTC0, not TZ=utc (which isn't
2920 portable). Problem reported by Christian Krackowizer. Also, use
2921 +0000 rather than +0 to specify a time zone, as the documentation
2922 requires four digits.
2924 2004-01-19 Jim Meyering <jim@meyering.net>
2926 * tests/mv/hard-4: Run envvar-check in case SIMPLE_BACKUP_SUFFIX is set.
2927 * tests/mv/backup-is-src: Likewise.
2928 Problem reported by Peter Horst
2930 2004-01-17 Jim Meyering <jim@meyering.net>
2932 * announce-gen (print_changelog_deltas): Use .sig suffix, not .asc.
2936 2003-12-15 Paul Eggert <eggert@twinsun.com>
2938 * NEWS, doc/coreutils.texi: touch -r and -d can now both be specified,
2939 with -r specifying the origin for -d.
2940 * src/touch.c (flexible_date): Remove static var.
2941 (get_reldate): New function.
2942 (main): Use it, to implement this new behavior.
2944 2004-01-16 Jim Meyering <jim@meyering.net>
2946 * tests/touch/relative: New test for the above.
2947 * tests/touch/Makefile.am (TESTS): Add relative.
2949 2004-01-13 Jim Meyering <jim@meyering.net>
2951 * src/system.h: Include contents of sys2.h.
2952 * src/sys2.h: Remove file.
2953 * src/Makefile.am (noinst_HEADERS): Remove sys2.h.
2955 * Use automake-1.8.2. Regenerate dependent files.
2957 * Update to gettext-0.13.1.
2958 * configure.ac: Use gettext-0.13.1.
2959 * .x-sc_space_tab: Add m4/po.m4 to the list of exceptions.
2961 2004-01-12 Jim Meyering <jim@meyering.net>
2963 * Makefile.maint (%.sig): Use .sig suffix rather than .asc.
2965 * Makefile.maint (po-check): Ensure that cvsu works before using it.
2966 Reported by Alexandre Duret-Lutz.
2968 * src/tail.c (main): Warn about following stdin only when it's a tty.
2970 * configure.ac: Use gl_DEFAULT_POSIX2_VERSION.
2972 2004-01-10 Jim Meyering <jim@meyering.net>
2974 * tests/misc/stat-fmt: Use backticks, not `$()' notation.
2976 2004-01-09 Jim Meyering <jim@meyering.net>
2978 * configure.ac: Quote underquoted `jm_DUMMY_1' to avoid new warning.
2980 2004-01-08 Jim Meyering <jim@meyering.net>
2982 * src/stat.c (human_fstype): Use %lx, not %x format for `unsigned long'.
2983 From Andreas Schwab.
2985 * tests/Makefile.am (TESTS_ENVIRONMENT): Remove `/vg' (prerelease test
2986 remnant) from PATH component. That would cause tests in this directory
2987 not to run the just-built binaries, but rather whatever happened
2988 to be in one's PATH. Reported by Christian Krackowizer.
2990 2004-01-04 Jim Meyering <jim@meyering.net>
2992 * src/csplit.c (new_control_record): Use x2nrealloc
2993 rather than xrealloc.
2995 * src/cp.c (re_protect): Use ASSIGN_STRDUPA rather than
2997 (make_path_private): Likewise.
2999 2004-01-03 Jim Meyering <jim@meyering.net>
3001 * src/paste.c: Use `bool' (not int) as the type for a few
3003 (collapse_escapes): Rewrite to set globals rather than modifying
3005 Use size_t (not int) for all counters and related index variables.
3006 (paste_parallel): Remove needless complexity of
3007 using xrealloc in the loop; just allocate the buffers up front.
3008 Free the two temporary buffers.
3009 Move declarations of locals `down' into scope where used.
3010 (paste_serial): Remove `register' attributes.
3011 (main): Simplify delim-related code.
3012 Free `delims', now that it's malloc'd.
3014 2004-01-02 Jim Meyering <jim@meyering.net>
3016 * src/chroot.c: Include "quote.h".
3017 (CHROOT_FOUND_BUT_CANNOT_INVOKE, CHROOT_FAILURE): Define.
3018 (main): Exit with status of 127, not 1, for too-few-args,
3019 chroot failure, or chdir failure.
3020 Give a better diagnostic upon execvp failure.
3022 * src/du.c (usage): Mention that, with its current meaning,
3025 * src/tail.c (main): Warn about following stdin when it's a tty.
3026 Fail when following by name but no names are specified.
3028 2003-12-30 Jim Meyering <jim@meyering.net>
3030 * src/fold.c (main): Use memcpy, not strcpy.
3032 * src/copy.c (copy_internal): Use ASSIGN_STRDUPA rather than
3035 2003-12-28 Jim Meyering <jim@meyering.net>
3037 * src/unexpand.c (n_tabs_allocated): New global.
3038 (add_tabstop): Use x2nrealloc rather than xrealloc.
3039 * src/expand.c: Likewise.
3041 * tests/misc/expand: New file.
3042 * tests/misc/Makefile.am (TESTS): Add expand.
3044 * src/sort.c (add_temp_dir): Use x2nrealloc rather than xrealloc.
3045 (fillbuf): Use x2nrealloc rather than xrealloc.
3046 (sort): Use xnmalloc rather than xmalloc.
3049 2003-12-27 Jim Meyering <jim@meyering.net>
3051 * src/tee.c (tee): Use xnmalloc rather than xmalloc.
3053 2003-12-29 Paul Eggert <eggert@twinsun.com>
3055 * NEWS: Remove support for join -j1 FIELD, -j2 FIELD, and -o LIST1
3056 LIST2 in POSIX 1003.1-2001 hosts, as required by POSIX.
3058 * doc/coreutils.texi (join invocation): Remove documentation
3059 accordingly. Document that -t makes all separators significant.
3061 * src/join.c: Include posixver.h.
3062 (obsolete_usage): New var.
3063 (longopts): Put obsolete options first.
3064 (OBSOLETE_LONG_OPTIONS): New constant.
3065 (get_option, add_file_name): New functions.
3066 (main): Use them to support new behavior.
3067 (usage): Remove documentation for -j1 FIELD and -j2 FIELD.
3068 Do not mark -j FIELD as obsolescent; it is longstanding
3069 UNIX tradition and is a valid extension to POSIX.
3071 * tests/join/Test.pm (tv): Avoid obsolete -o usage.
3073 2003-12-28 Paul Eggert <eggert@twinsun.com>
3075 * src/join.c (add_field_list): Don't use alloca with unbounded
3076 size; just modify the argument, which is no longer const *.
3078 Various other minor cleanups, mostly to avoid the need for casts.
3080 (extract_field): Renamed from ADD_FIELD, as it's now a function.
3082 (struct field.beg): Now char *, not unsigned char const *. All
3083 uses changed. It shouldn't be const since xmemcoll writes on its
3085 (extract_field): Likewise, for 2nd arg.
3086 (keycmp): Remove now-unnecessary cast of xmemcoll args.
3088 (is_blank): New function, to avoid need to cast arg to unsigned char.
3089 (extract_field): Use it.
3091 (xfields): Rewrite pretty much from scratch.
3093 (hard_LC_COLLATE): Now bool, not int.
3094 (get_line, getseq, add_field_list): Now returns bool, not int.
3095 (decode_field_spec, add_field_list): Return true on success (not
3096 false), for consistency with the rest of the code. All uses changed.
3098 (tab): Now char, not unsigned char. This wasn't 100% necessary
3099 but is slightly cleaner.
3100 (prjoin): Hoist (tab ? tab : ' ') expression, to help the compiler.
3102 (empty_filler): Now const *.
3104 (make_blank): Remove; wasn't needed. Remove all calls.
3105 (main): Don't set uni_blank.nfields; zero is fine.
3107 2003-12-27 Jim Meyering <jim@meyering.net>
3109 * src/join.c: Include "quote.h".
3110 (min, max): Remove definitions.
3111 Make a few function parameters and corresponding
3112 locals `const'. Use bool for boolean variables.
3113 Use size_t (not int) for all counters and related index variables.
3114 (prjoin): Remove now-useless assertion.
3115 (string_to_join_field): New function.
3116 (main): Accept join fields as large as SIZE_MAX.
3117 (keycmp): Rename `min' to MIN and max to MAX.
3119 2003-12-26 Jim Meyering <jim@meyering.net>
3121 fold -s didn't work on e.g., alpha-based systems.
3122 * src/fold.c (fold_file): Adjust types (int->size_t) so that using
3123 x2nrealloc works properly on systems with differing sizes for int
3124 and size_t. Reported by Nelson Beebe.
3126 * src/fold.c: Use `bool' (not int) as the type for a few
3129 2003-12-23 Paul Eggert <eggert@twinsun.com>
3131 * src/ls.c (length_of_file_names_and_frills):
3132 Remove forward decl; not needed.
3133 (print_file_name_and_frills, length_of_file_name_and_frills):
3134 With -m, don't output spaces before inum or size.
3135 (print_with_commas): Don't output space just before newline.
3137 2003-12-24 Jim Meyering <jim@meyering.net>
3139 * tests/ls/Makefile.am (TESTS): Add m-option.
3140 * tests/ls/m-option: New file. Test for above fixes.
3142 2003-12-20 Jim Meyering <jim@meyering.net>
3146 * src/pr.c: Change type of global, buff_allocated, to size_t.
3148 * src/join.c [struct seq]: Change types of members count and alloc
3149 from `int' to `size_t'.
3151 * tests/Makefile.am (root-hint): Tweak wording.
3153 * src/du.c: Accept new option (-0, --null) that makes it so each
3154 output line is NUL-terminated rather than newline-terminated.
3156 * src/dd.c (apply_translations): Don't prohibit conv=unblock,sync.
3157 Reported by Volker Paul.
3158 * tests/dd/Makefile.am (TESTS): Add unblock-sync.
3159 * tests/dd/unblock-sync: New test for the above.
3161 2003-12-19 Jim Meyering <jim@meyering.net>
3163 * tests/misc/nohup: Double quote back-ticked expression,
3164 in case it ends up having an unexpected value.
3166 * tests/ls/no-arg: Use ls's -1 option in both runs.
3168 * src/du.c (fts_debug): New global.
3169 (FTS_CROSS_CHECK, DEBUG_OPT): Define.
3170 (main): Make fts use FTS_TIGHT_CYCLE_CHECK.
3171 (main) [DU_DEBUG]: Accept -d option.
3173 2003-12-18 Jim Meyering <jim@meyering.net>
3175 * src/ls.c (format_user): Increment dired_pos via two statements,
3176 `dired_pos += width; dired_pos++;' rather than one,
3177 `dired_pos += width + 1;' since the latter could conceivably overflow.
3178 (format_group): Likewise.
3181 * configure.ac: Require automake-1.8.
3183 2003-12-12 Jim Meyering <jim@meyering.net>
3185 * Use automake-1.8. Regenerate dependent files.
3187 2003-12-08 Jim Meyering <jim@meyering.net>
3189 * Makefile.maint (news-date-check): New rule.
3190 (alpha beta major): Depend on it.
3192 2003-12-03 Paul Eggert <eggert@twinsun.com>
3194 * NEWS: ls -l (and similar options) now adjust all columns to
3195 fit the data. Generalized from a suggestion by Leah Q for file sizes.
3196 * src/ls.c (INODE_DIGITS, LOGIN_NAME_MAX, ID_LENGTH_MAX): Remove.
3197 (format_user_width, format_group_width, unsigned_file_size,
3198 format_group): New functions.
3199 (block_size_width): Renamed from block_size_size.
3200 (inode_number_width, nlink_width, owner_width, group_width,
3201 author_width, major_device_number_width, minor_device_number_width,
3202 file_size_width): New vars.
3203 (clear_files): Initialize them.
3204 (gobble_file): Set them. Don't ceiling block_size_width to 7.
3205 (print_long_file): Use them.
3206 (gobble_file): Use a new local variable 'f' to make the code
3207 smaller and more consistent with other functions.
3208 (format_user): Output to stdout, not to a buffer, so that we
3209 don't have to worry about buffer overrun. Update dired_pos.
3210 (print_long_file): Don't put owner, group, author into buffer;
3211 just print them directly. Don't assume link counts and
3212 major and minor numbers fit into unsigned long int.
3213 * tests/cp/same-file, tests/mv/part-symlink: Don't assume that
3214 'ls' output is fixed-width.
3216 2003-12-02 Jim Meyering <jim@meyering.net>
3218 * src/md5sum.c: Include sha1.h (reflect renaming: sha.h -> sha1.h.
3220 2003-11-27 Jim Meyering <jim@meyering.net>
3222 * Use automake-1.7f. Regenerate dependent files.
3224 2003-11-24 Paul Eggert <eggert@twinsun.com>
3226 Parse floating-point operands and options in the C locale.
3227 POSIX requires this for printf, and we might as well be
3228 consistent elsewhere (tail, sleep, seq).
3230 * src/printf.c: Remove decls of strtod, strtol, strtoul; no longer
3231 needed now that we assume C89. Include "c-strtod.h".
3232 (xstrtod): Call c_strtod, not strtod.
3233 * src/sleep.c: Include "c-strtod.h".
3234 (main): Update xstrtod call to include new argument, c_strtod.
3235 * src/seq.c (scan_double_arg): Likewise.
3236 * src/tail.c (parse_options): Likewise.
3238 2003-11-24 Jim Meyering <jim@meyering.net>
3240 * tests/rm/fail-2eperm: Handle another errno variant (HPUX, EPERM).
3241 Reported by Mark Conty.
3243 2003-11-22 Jim Meyering <jim@meyering.net>
3245 * Makefile.maint (sc_xalloc_h_in_src): Remove rule. Subsumed by...
3246 (sc_system_h_headers): Do this test only if sys2.h exists.
3248 2003-11-20 Jim Meyering <jim@meyering.net>
3250 * tests/help-version: Ensure that the bug-reporting address is
3251 included in the --help output for every program.
3252 * tests/Makefile.am (TESTS_ENVIRONMENT): Add $PACKAGE_BUGREPORT.
3254 * src/ptx.c (usage): Output bug-reporting address.
3255 Reported by Dan Jacobson.
3257 2003-11-19 Jim Meyering <jim@meyering.net>
3259 * src/join.c (usage): Mention that FILE1 and FILE2 must be sorted
3260 on the join fields. Suggestion from Bruce Robertson.
3262 2003-11-18 Jim Meyering <jim@meyering.net>
3264 `od -c -w9999999' could segfault
3265 * src/od.c (dump): Use xnmalloc/free, not alloca.
3267 2003-11-16 Jim Meyering <jim@meyering.net>
3269 * Use autoconf-2.59. Regenerate dependent files.
3271 * tests/du/hard-link: Minor tweak: use mkdir -p.
3273 Fix read-from-free'd-buffer error detected by valgrind.
3274 * src/csplit.c (remove_line): Don't return a pointer to data in
3275 a freed buffer. Instead, arrange to free the buffer on the
3278 * tests/misc/csplit: New test for above fix.
3280 2003-11-11 Jim Meyering <jim@meyering.net>
3282 * src/ls.c (extract_dirs_from_files): Avoid useless copy operations.
3283 This avoids a warning from valgrind about memcpy with overlapping
3284 source and destination.
3286 * configure.ac: Require automake-1.7.8.
3288 2003-11-09 Jim Meyering <jim@meyering.net>
3290 * Use automake-1.7.9. Regenerate dependent files.
3292 * src/rm.c: Support new options: --preserve-root and --no-preserve-root.
3293 * src/chown.c: Likewise.
3295 * src/chown-core.c: Include "root-dev-ino.h".
3296 (chopt_init): Initialize new member.
3297 (change_file_owner): Support rm's new --preserve-root option.
3299 * src/remove.c: Include "root-dev-ino.h".
3300 (remove_cwd_entries): Remove now-obsolete FIXME comment.
3301 (remove_dir): Support rm's new --preserve-root option.
3303 * src/chown.c: Include "root-dev-ino.h".
3304 Add new options: --preserve-root and --no-preserve-root.
3306 * src/chmod.c: Include "root-dev-ino.h".
3307 (process_file): Use newly-factored-out ROOT_DEV_INO_CHECK and
3308 ROOT_DEV_INO_WARN macros.
3309 (get_root_dev_ino): Remove function definition, now that it's
3310 been moved to a separate file.
3311 (usage): Describe new options.
3313 * src/mv.c (rm_option_init): Initialized new member.
3315 * src/remove.h: Include "dev-ino.h".
3316 (struct rm_options): Add new member: root_dev_ino.
3317 * src/chown-core.h: Include "dev-ino.h".
3318 (struct Chown_option): Add new member: root_dev_ino.
3320 2003-11-06 Jim Meyering <jim@meyering.net>
3322 * src/paste.c (paste_parallel): Use `sizeof *var' rather than
3323 hard-coding `sizeof FILE*'.
3325 2003-11-05 Dennis Smit <ds@nerds-incorporated.org>
3327 * src/wc.c (main): Free `fstatus' so there is no confusion about
3328 whether it's leaked or not.
3329 * src/who.c (who): Likewise for `utmp_buf'.
3331 2003-11-05 Paul Eggert <eggert@twinsun.com>
3333 Fix 'cut' problems with size_t overflow and unsigned int.
3334 More generally, resize integer variables to fit use more precisely.
3335 * src/cut.c (ADD_RANGE_PAIR): Remove unnecessary parens.
3336 (struct range_pair): Make members to be of type size_t, not unsigned.
3337 (max_range_endpoint, eol_range_start): Now size_t, not unsigned.
3338 (suppress_non_delimited, output_delimiter_specified,
3339 have_read_stdin, print_kth, set_fields): Now bool, nt int.
3340 (delim): Now unsigned char, not int.
3341 (mark_printable_field, is_printable_field, is_range_start_index,
3342 set_fields, set_fields, cut_bytes, cut_fields):
3343 Use size_t, not unsigned, for field and byte counts.
3344 (hash_int): Use uintptr_t, not unsigned, for pointers converted
3345 to integers. This squeezes more info out of them.
3346 (set_fields, cut_bytes, cut_fields, main):
3347 Use bool, not int, for booleans.
3348 (set_fields): Allocate zeroed byte array with xzalloc, not xcalloc.
3350 2003-11-05 Paul Eggert <eggert@twinsun.com>
3352 * man/Makefile.am (check-programs-vs-x):
3353 Work even if $(programs) contains '$'.
3354 Work even if 'missing=1' in environment.
3355 Don't report an error simply because $(programs) outputs nothing.
3357 2003-11-05 Jim Meyering <jim@meyering.net>
3359 * Use autoconf-2.58. Regenerate dependent files.
3361 * src/tr.c (spec_init): Fix typo in last change.
3363 * src/sys2.h (case_GETOPT_VERSION_CHAR): Cast NULL to `(char *)' in
3364 call to variadic version_etc function, so that it works even on systems
3365 for which sizeof char* != sizeof int.
3366 * src/true.c (main): Likewise.
3367 * basename.c, chroot.c, cksum.c, dd.c, dirname.c, echo.c, expr.c:
3368 * factor.c, hostid.c, hostname.c, link.c, logname.c, nice.c, nohup.c:
3369 * pathchk.c, printenv.c, printf.c, pwd.c, setuidgid.c, sleep.c, stty.c:
3370 * sync.c, test.c, tsort.c, unlink.c, uptime.c, users.c, whoami.c, yes.c:
3371 Similarly, cast NULL to `(char *)' in call to variadic function,
3372 parse_long_options, so that it works even on systems for which
3373 sizeof char* != sizeof int.
3374 A similar problem was reported by Harti Brandt in
3375 http://mail.gnu.org/archive/html/bug-gnu-utils/2003-10/msg00320.html.
3377 * src/users.c (users): Free `utmp_buf' explicitly so that people
3378 don't mistake this for a real leak.
3379 Patch by Dennis Smit <ds@nerds-incorporated.org.
3381 2003-11-04 Paul Eggert <eggert@twinsun.com>
3383 * README: Document _POSIX2_VERSION.
3385 2003-11-04 Jim Meyering <jim@meyering.net>
3387 * src/tac.c (memrchr): Remove #if-0'd function.
3388 (tac_stdin_to_mem): Clean up #if-0'd code.
3390 * src/od.c (decode_format_string): Remove unnecessary casts.
3391 Use more maintainable `sizeof *var'.
3392 (main): Call decode_format_string rather than decode_one_format,
3393 now that `spec' may be NULL.
3395 * src/chmod.c (AUTHORS): Add my name.
3397 * src/split.c (next_file_name): Use `sizeof *var' rather than
3398 hard-coding `sizeof size_t'.
3400 * src/sort.c (new_key): Use xzalloc, not xcalloc (1, ...).
3402 * src/cut.c (ADD_RANGE_PAIR): Use x2nrealloc rather than xrealloc,
3403 to avoid potential overflow in pointer arithmetic.
3404 (set_fields): Use not `1', but rather `sizeof *printable_field' as
3405 second argument to xcalloc.
3406 * src/od.c (decode_format_string, dump_strings): Use x2nrealloc
3407 rather than xrealloc.
3408 * src/date.c (show_date): Likewise.
3409 * src/join.c (ADD_FIELD, initseq, getseq): Likewise.
3410 * src/pr.c (store_char): Likewise.
3411 * src/fold.c (fold_file): Likewise.
3413 * src/copy.c (triple_hash, triple_hash_no_name): Adjust to reflect
3414 type changes (unsigned int -> size_t) in hash.c.
3415 * src/cp-hash.c (src_to_dest_hash): Likewise.
3416 * src/du.c (entry_hash): Likewise.
3417 * src/ls.c (dev_ino_hash): Likewise.
3418 * src/cut.c (hash_int): Likewise. Declare function as static.
3420 2003-11-03 Jim Meyering <jim@meyering.net>
3422 * tests/misc/Makefile.am (TESTS_ENVIRONMENT): Define PACKAGE_VERSION.
3423 * tests/misc/fold: Fail the test immediately if we're not running
3424 the expected version of fold.
3426 2003-11-02 Jim Meyering <jim@meyering.net>
3428 * src/tr.c (append_normal_char, append_range, append_char_class)
3429 (append_repeated_char, append_equiv_class, spec_init): Use `sizeof *var'
3430 rather than `sizeof EXPLICIT_TYPE'. The former is more maintainable
3431 and usually shorter.
3432 * src/copy.c (copy_internal): Likewise.
3433 * src/join.c (initseq, add_field, make_blank): Likewise.
3434 * src/od.c (main): Likewise.
3435 * src/cp.c (make_path_private): Likewise.
3436 * src/tsort.c (new_item, record_relation): Likewise.
3438 * src/df.c (add_fs_type, add_excluded_fs_type, main): Likewise.
3439 (main): Also remove anachronistic cast of xmalloc return value.
3440 * src/ptx.c (alloc_and_compile_regex, main): Likewise.
3441 (main): Also remove anachronistic cast of xmalloc return value.
3442 * src/sort.c (inittables): Likewise.
3443 (sort): Also Split a long line.
3445 2003-10-25 Jim Meyering <jim@meyering.net>
3447 * src/copy.c (triple_hash, triple_hash_no_name): Adjust to reflect
3448 type changes (unsigned int -> size_t) in hash.c.
3449 * src/cp-hash.c (src_to_dest_hash): Likewise.
3450 * src/du.c (entry_hash): Likewise.
3451 * src/ls.c (dev_ino_hash): Likewise.
3452 * src/cut.c (hash_int): Likewise. Declare function as static.
3454 2003-10-21 Jim Meyering <jim@meyering.net>
3456 Don't fail when run with VERBOSE=yes.
3457 * tests/chgrp/basic: Do `set +x' before starting the subshell
3458 from which we invoke chgrp. Otherwise, the output from the
3459 VERBOSE=yes-induced `set -x' would result in spurious differences.
3460 Reported by Russel Coker via Michael Stone.
3462 2003-10-19 Jim Meyering <jim@meyering.net>
3464 chmod now uses fts to perform a directory traversal when -R is
3465 specified. Before, it operated on full path names, and as such
3466 would encounter the PATH_MAX (often 4096) limit.
3468 * src/chmod.c: Include "xfts.h".
3469 (process_file): Rename from change_file_mode.
3470 Adapt to be used with fts.
3471 (process_files): New function.
3473 2003-10-18 Jim Meyering <jim@meyering.net>
3475 * tests/du/deref-args: Ensure that du -D now dereferences all
3476 symlinks specified on the command line, not just those that
3477 reference directories.
3479 * basename.c, cat.c, chroot.c, cksum.c, comm.c, cp.c, csplit.c, cut.c:
3480 * dd.c, df.c, dirname.c, du.c, echo.c, env.c, expr.c, factor.c, head.c:
3481 * hostid.c, hostname.c, id.c, link.c, ln.c, logname.c, ls.c, md5sum.c:
3482 * mv.c, nice.c, nl.c, nohup.c, paste.c, pathchk.c, pinky.c, pr.c:
3483 * printenv.c, printf.c, pwd.c, rm.c, setuidgid.c, sleep.c, sort.c:
3484 * split.c, stty.c, sum.c, sync.c, tac.c, tail.c, tee.c, test.c:
3485 * touch.c, tsort.c, uniq.c, unlink.c, uptime.c, users.c, wc.c:
3486 * who.c, whoami.c, yes.c (AUTHORS): Revert the WRITTEN_BY/AUTHORS change
3487 of 2003-09-19. Now, AUTHORS is a comma-separated list of strings.
3488 Update the call to parse_long_options so that `AUTHORS, NULL' are the
3490 * src/true.c (main): Append NULL to version_etc argument list.
3491 * src/sys2.h (case_GETOPT_VERSION_CHAR): Likewise.
3493 2003-10-17 Andreas Schwab <schwab@suse.de>
3495 * tests/mk-script: Get $srcdir from first parameter instead of
3497 (main): Update usage.
3499 * tests/Makefile.am.in ($(srcdir)/$x-tests): Pass $(srcdir) as
3500 first argument of mk-script.
3501 ($(srcdir)/Makefile.am): Likewise. Prepend $(srcdir) to target.
3503 2003-10-17 Jim Meyering <jim@meyering.net>
3505 * src/mv.c (usage): Tweak descriptions of -i and -f so that the
3506 generated `man' page is more readable. Suggestion from Dan Jacobson.
3508 * src/chown-core.c (change_file_owner): Handle the cases in
3509 which fts_info indicates an error with the given entry.
3511 * src/du.c (main): Simply assign to bit_flags.
3512 Don't bother with bit arithmetic.
3514 * tests/chmod/no-x: New file.
3515 * tests/chgrp/no-x: New file.
3516 * tests/chmod/Makefile.am (TESTS): Add no-x.
3517 * tests/chgrp/Makefile.am (TESTS): Likewise.
3519 * src/du.c: Include "xfts.h".
3520 (du_files): Use xfts_open, rather than fts_open.
3521 * src/chown-core.c (chown_files): Likewise.
3523 2003-10-16 Jim Meyering <jim@meyering.net>
3525 * src/chgrp.c (main): Simply assign to bit_flags.
3526 Don't bother with bit arithmetic.
3527 * src/chown.c (main): Likewise.
3528 Rename a couple of local variables.
3529 Remove unnecessary casts.
3531 * src/tail.c (start_bytes): Rename local, remainder, to avoid
3532 gcc's warning about shadowing a global.
3534 2003-10-15 Jim Meyering <jim@meyering.net>
3536 chown and chgrp now accept POSIX-mandated -H, -L, -P options and
3537 use fts to perform a directory traversal when -R is specified.
3538 Before, they operated on full path names, and as such would
3539 encounter the PATH_MAX (often 4096) limit.
3540 They are more efficient. For example, before, chgrp -R would
3541 take almost 5 seconds to change about 2000 directories and fail
3542 (with `File name too long'), while now it succeeds on a hierarchy
3543 of depth 20,000 in 1/10 the time.
3545 * src/chown.c: Include "userspec.h" and "fts_.h".
3546 (WRITTEN_BY): Add my name.
3547 (getpwnam, getgrnam, getgrgid): Remove declarations.
3548 (endpwent): Remove definition.
3550 (main): Handle new options.
3551 Call new function, chown_files rather than change_file_owner.
3553 * src/chgrp.c: Include "fts_.h".
3554 (WRITTEN_BY): Add my name.
3555 (MAXUID, MAXGID): Remove definitions. Use GID_T_MAX instead of
3558 (main): Handle new options.
3559 Call new function, chown_files rather than change_file_owner.
3561 Rewrite to iterate through hierarchies using fts rather than
3562 via explicit recursion.
3563 * src/chown-core.c: Include "fts_.h"
3564 (change_file_owner): Rewrite to use FTS* and FTSENT* and to operate
3565 on a single file at a time.
3566 (chown_files): New function.
3567 * src/chown-core.h [enum Dereference_symlink]: Remove declaration.
3568 [struct Chown_option] (recurse, force_silent): Change type to `bool'.
3569 [struct Chown_option] (dereference): Remove member with ambiguous name.
3570 [struct Chown_option] (affect_symlink_referent): New member.
3571 (chown_files): New prototype.
3573 * tests/chgrp/recurse: Update tests accordingly.
3574 * tests/chgrp/posix-H: New tests for the above.
3575 * tests/chgrp/Makefile.am (TESTS): Add posix-H.
3577 * src/ln.c (usage): Clarify that --directory, -d, -F probably won't
3578 work even for superuser. Suggestion from Dan Jacobson.
3580 2003-10-14 Paul Eggert <eggert@twinsun.com>
3582 Fix some number-parsing bugs, e.g., "head -n 100k@" wasn't
3584 * lib/human.c, lib/xstrtoimax.c, lib/xstrtol.c, lib/xstrtol.h,
3585 lib/xstrtoul.c, lib/xstrtoumax.c: Sync with gnulib.
3586 * src/sort.c (parse_field_count): Handle the case where overflow
3587 and invalid suffix char are both reported.
3589 2003-10-14 Jim Meyering <jim@meyering.net>
3591 * src/ls.c (decode_switches) [TIOCGWINSZ]: Comment out the
3592 warning-inducing test, ws.ws_col <= SIZE_MAX, since it was always
3595 2003-10-13 Paul Eggert <eggert@twinsun.com>
3597 Fix to avoid a denial-of-service attack if the display width is
3598 enormous. Also, clean up the code a bit by removing duplicate code.
3600 * src/ls.c (init_column_info): Remove forward decl; no longer needed.
3601 (calculate_columns): New function, that contains code that used
3602 to be common to print_many_per_line and print_horizontal.
3603 (print_many_per_line, print_horizontal): Use it.
3604 (decode_switches): Set max_idx here, not in calculate_columns.
3605 (print_current_files): Don't call init_column_info; calculate_columns
3607 (init_column_info): Don't allocate a lot more space than is needed
3608 to represent the current set of files. Allocate all the new
3609 size_t cells in one call to xnmalloc, rather than a row at a time.
3611 2003-10-13 Jim Meyering <jim@meyering.net>
3613 * src/ls.c (init_column_info): Add another FIXME comment.
3615 2003-10-13 Paul Eggert <eggert@twinsun.com>
3617 Fix address-arithmetic bug in 'ls', reported by Georgi Guninski.
3618 Remove several arbitrary limits on hosts where int cannot represent
3621 * src/ls.c (struct bin_str.len, length_of_file_name_and_frills, indent,
3622 nfiles, files_index, tabsize, line_length, struct column_info.line_len,
3623 struct column_info.col_arr[0], max_idx):
3624 Now size_t, not int.
3625 (get_funky_string): Return bool indicating success, instead of
3626 a negative count to indicate failure. Store number of columns
3627 through new parameter OUTPUT_COUNT; that way, they can never
3628 go negative. Change equals_end from int to bool. All uses
3630 (struct column_info.valid_len): Now bool, not int. All uses changed.
3631 (dired_dump_obstack, get_funky_string, clear_files,
3632 extract_dirs_from_files, print_current_files,
3633 print_many_per_line, print_horizontal, init_column_info,
3634 put_indicator, length_of_file_name_and_frills,
3635 print_with_commas): Use size_t, not int, for local variables
3637 (decode_switches): Decode sizes using xstrtoul, not xstrtol.
3638 Check for TIOCGWINSZ returing negative values (or values greater
3640 (visit_dir, main, parse_ls_color, queue_directory, add_ignore_pattern,
3642 Use xmalloc and xnmalloc, not XMALLOC.
3643 (gobble_file): Use xnrealloc, not XREALLOC.
3644 (print_color_indicator): Remove now-unnecessary cast to size_t.
3646 2003-10-12 Paul Eggert <eggert@twinsun.com>
3648 * tests/du/no-x: Change wording of diagnostic to match latest du.c.
3649 * tests/sort/sort-tests: Remove from CVS; assume that people
3650 brave enough to check coreutils out from CVS can rebuild it.
3652 2003-10-12 Jim Meyering <jim@meyering.net>
3654 New options: --preserve-root and --no-preserve-root.
3655 * src/chmod.c (change_file_mode): Honor new option.
3656 (change_file_mode): Strip trailing slashes on directory
3657 argument passed to change_dir_mode.
3658 (get_root_dev_ino): New function.
3659 (main): Initialize global, root_dev_ino.
3661 * src/copy.c (copy_internal): Don't #ifdef-out simple uses of
3662 S_ISLNK or S_ISSOCK. The S_IS* macros are guaranteed to be defined
3664 * src/chmod.c (change_file_mode): Likewise.
3666 2003-10-08 Jim Meyering <jim@meyering.net>
3668 * src/csplit.c (main): Remove obsolete FIXME.
3670 2003-10-07 Jim Meyering <jim@meyering.net>
3672 * Use automake-1.7.8. Regenerate dependent files.
3674 2003-09-29 Paul Eggert <eggert@twinsun.com>
3678 * doc/coreutils.texi (csplit invocation):
3679 The regexp offset need not have a sign; POSIX requires support
3680 for signless offets.
3682 Be more careful about int widths. For example, remove some
3683 arbitrary limits by replacing 'unsigned' with 'size_t',
3684 'uintmax_t', etc. Use standard bool rather than a homegrown type.
3685 * lib/Makefile.am (libfetish_a_SOURCES): Add xstrtoimax.c.
3686 * src/csplit.c (FALSE, TRUE, boolean): Remove. All uses changed
3687 to <stdbool.h> usage.
3688 (struct control): offset is now intmax_t, not int.
3689 repeat_forever is now bool, not int.
3690 (struct cstring): len is now size_t, not unsigned int.
3691 (struct buffer_record): bytes_alloc, bytes_used, num_lines are now
3692 size_t, not unsigned. start_line, first_available are now
3693 uintmax_t, not unsigned.
3694 (hold_count, control_used): Now size_t, not unsigned.
3695 (last_line_number, current_line, bytes_written):
3696 Now uintmax_t, not unsigned.
3697 (save_to_hold_area, red_input, keep_new_line, record_line_starts,
3698 create_new_buffer, get_new_buffer, load_buffer, find_line,
3699 process_regexp, split_file, new_control_record, extract_regexp,
3700 get_format_width, get_format_prec, max_out):
3701 size args, locals, and returned values are now size_t, not unsigned
3703 (get_first_line_in_buffer, find_line, write_to_file,
3704 handle_line_error, process_line_count, regexp_error, process_regexp,
3706 File line, byte, and repetition counts are now uintmax_t, not unsigned.
3707 (check_for_offset): Don't require a sign before the offset.
3708 Use xstrtoimax to do the real work.
3709 (extract_regexp): Remove harmful cast of size to unsigned.
3710 256 -> 1<<CHAR_BIT, for clarity.
3711 (get_format_flags): Return at most 3, to avoid worries about overflow.
3713 (bytes_to_octal_digits): Remove.
3715 (cleanup): Don't check whether output_stream is NULL, since
3716 close_output_file does that for us.
3718 (new_line_control, create_new_buffer): Use "foo *p = xmalloc
3719 (sizeof *p);" instead of the more long-winded alternatives.
3721 (get_new_buffer): Use O(1) algorithm for resizing a buffer
3722 to a much larger size, instead of an O(N) algorithm.
3724 (process_regexp): Use plain NULL rather than casted 0.
3726 (make_filename): Use %u, not %d, to format unsigned file number.
3728 (new_control_record): Use xrealloc exclusively, since it handles
3731 (extract_regexp): Change misspelled word in diagnostic.
3733 (get_format_width): Even if a minimum field width is specified,
3734 allow room for enough octal digits to represent the value of
3735 the maximum representible integer. This fixes a potential
3736 buffer overrun. Calculate this room at compile-time, not
3737 at run-time; this removes the need for bytes_to_octal_digits.
3738 Check for overflow; this removes a FIXME.
3740 (get_format_prec): Don't allow precision to be signed; it's
3741 not ANSI. Check for overflow. Remove hardcoded "11" as
3742 default precision; this fixes a potential buffer overrun
3743 on hosts with wider size_t.
3745 (get_format_conv_type): Change local variable to be of type
3746 unsigned char, not int; this removes a potential subscript
3747 violation on hosts where char is signed.
3749 (max_out): Replace "for (;*p;)" with more-standard "while (*p)".
3750 Allow "%%" in format. Don't overflow when
3751 counting lots of percents.
3753 (usage): Default sprintf format is %02u, not %d.
3755 2003-10-05 Jim Meyering <jim@meyering.net>
3757 * src/chown-core.c (change_file_owner): Remove set-but-not-used local.
3759 * src/du.c (du_files): Mark diagnostic for translation.
3761 2003-10-04 Jim Meyering <jim@meyering.net>
3763 * src/du.c (du_files): Ignore any failure of fts_close.
3764 Give better diagnostics for failed fts_open.
3766 * src/du.c (MAX_N_DESCRIPTORS): Remove now-unused definition.
3768 Deprecate existing use of -H (aka --si).
3769 * src/du.c (enum) [HUMAN_SI_OPTION]: New member.
3770 [long_options]: Use HUMAN_SI_OPTION, not 'H'.
3771 (main): Warn that the meaning of -H will soon change to be
3774 2003-10-03 Jim Meyering <jim@meyering.net>
3776 * src/du.c: Accept --no-dereference (-P).
3778 2003-10-02 Jim Meyering <jim@meyering.net>
3780 * tests/du/trailing-slash: Adjust for slightly different output.
3782 Rewrite du.c to use fts.
3783 * src/du.c: Include "fts_.h", not ftw.h.
3784 (opt_dereference_arguments, arg_length, suffix_length): Remove globals.
3785 (IS_FTW_DIR_TYPE): Remove definition.
3786 (IS_DIR_TYPE): Define.
3787 (is_symlink_to_dir): Remove now-unnecessary function.
3788 (process_file, du_files): Rewrite to use fts.
3790 * tests/du/inaccessible-cwd: Ensure that even when run from an
3791 inaccessible directory, du can still operate on accessible
3792 directories elsewhere.
3793 * tests/du/Makefile.am (TESTS): Add inaccessible-cwd.
3795 * tests/rm/deep-1: Ensure that du can process a hierarchy
3796 of depth 400 while using no more than 50KB of stack space.
3798 2003-10-01 Akim Demaille <akim@epita.fr>
3800 * announce-gen (print_news_deltas): New function, extracted from main.
3801 (main): Make `news_file' an array.
3802 Use '...=s' => \@var for --news and --url-directory specs.
3803 Before there were a couple of portability problems.
3805 2003-09-28 Jim Meyering <jim@meyering.net>
3807 * Makefile.maint (sc_cast_of_alloca_return_value): New rule.
3808 (syntax-check-rules): Add it.
3810 * src/copy.c: Remove unnecessary cast of alloca, since now it's
3811 guaranteed to be (void *).
3812 * src/cp.c: Likewise.
3813 * src/join.c: Likewise.
3814 * src/ln.c: Likewise.
3815 * src/ls.c: Likewise.
3816 * src/od.c: Likewise.
3817 * src/sys2.h (ASSIGN_STRDUPA): Likewise.
3819 2003-09-27 Jim Meyering <jim@meyering.net>
3821 Don't exhaust virtual memory when processing large inputs.
3822 Fix this by removing csplit's internal free-list management;
3823 instead rely on malloc for that.
3825 * src/csplit.c (free_list): Remove global.
3826 (clear_all_line_control): Remove function.
3827 (get_new_buffer): Always use create_new_buffer to obtain a
3828 new buffer, rather than searching free_list.
3829 (free_buffer): Just call free.
3830 Reported by Nikola Milutinovic.
3832 2003-09-26 Jim Meyering <jim@meyering.net>
3834 * man/rm.x: Also list `chattr' in SEE ALSO section.
3835 Suggestion from Mark Hubbart.
3837 2003-09-25 Jim Meyering <jim@meyering.net>
3839 * configure.ac: Don't invoke AC_AIX or AC_MINIX explicitly, now
3840 that we use gl_USE_SYSTEM_EXTENSIONS, since it AC_REQUIREs them.
3842 * Use autoconf-2.57d. Regenerate dependent files.
3844 2003-09-24 Jim Meyering <jim@meyering.net>
3846 Minor efficiency tweak.
3847 * src/ln.c (PATH_BASENAME_CONCAT): Use memcpy rather than strcpy.
3848 (do_link): Likewise.
3850 2003-09-23 Jim Meyering <jim@meyering.net>
3852 * src/paste.c (paste_serial): Save errno after input error,
3853 to report proper errno value.
3854 Based on a patch from Paul Eggert.
3856 * src/tee.c (tee): Adjust fwrite arguments so that the return
3857 value is the number of bytes written.
3859 2003-09-16 Paul Eggert <eggert@twinsun.com>
3861 Don't assume ferror sets errno. Bug reported by Bruno Haible.
3863 * src/comm.c (compare_files): Save errno after input error,
3864 to report proper errno value.
3865 * src/fold.c (fold_file): Likewise.
3866 * src/od.c (check_and_close, skip, read_char, read_block): Likewise.
3867 * src/unexpand.c (unexpand): Likewise.
3869 * src/csplit.c (close_output_file): Don't report bogus errno value
3870 after ferror discovers an output error. We don't know the proper
3871 errno value, since it might have been caused by any of a whole
3872 bunch of calls, and it might have been trashed in the meantime.
3873 Fixing this problem will require much more extensive changes;
3874 in the meantime just say "write error".
3875 * src/od.c (check_and_close, dump, dump_strings): Likewise.
3876 * src/uniq.c (check_file): Likewise.
3878 * src/join.c (get_line): Report error right away if I/O fails,
3879 so that the proper errno value is used.
3880 * src/tac.c (tac_seekable, tac_file, save_stdin): Likewise.
3881 * src/tee.c (tee): Likewise.
3882 * src/uniq.c (check_file): Likewise.
3884 * src/od.c (skip): If a read fails, don't retry it later, so
3885 that we report the proper errno.
3887 * src/tac.c (tac_mem): Don't return a value; nobody uses it.
3889 * src/tee.c (tee): Once a write failure has occurred, don't bother
3890 writing anything more to that stream.
3892 * src/uniq.c (check_file): Check for ferror (stdout) even if
3895 * src/yes.c (UNROLL): Remove.
3896 (main): Exit immediately when write failure is detected.
3897 Simplify code by assigning to argv when argc == 1.
3899 2003-09-21 Paul Eggert <eggert@twinsun.com>
3901 * src/ptx.c: Switch encoding from Latin-1 to UTF-8.
3902 (WRITTEN_BY): Change "Franc,ois" (actually using
3903 c-with-cedilla in Latin-1) to "F.", so that it's ASCII, as
3906 2003-09-19 Jim Meyering <jim@meyering.net>
3908 `du -D symlink-to-dir' would mistakenly omit the slash in
3909 lines like this: 24 symlink-to-dir/subdir
3910 * src/du.c (process_file): Fix offset calculation.
3911 Reported by Jeff Sheinberg as Debian bug #211591;
3912 http://bugs.debian.org/205251
3914 * tests/du/deref-args: New file/test for the above.
3915 * tests/du/Makefile.am (TESTS): Add deref-args.
3917 * src/du.c (process_file): Remove useless disjunct.
3919 * src/sys2.h (case_GETOPT_VERSION_CHAR): Rename parameter, Authors,
3921 * nearly all src/*.c files (WRITTEN_BY): Rename from AUTHORS.
3922 Begin each WRITTEN_BY string with `Written by ' and end it with `.'.
3923 Mark each WRITTEN_BY string as translatable.
3925 * basename.c, cat.c, chroot.c, cksum.c, comm.c, cp.c, csplit.c, cut.c:
3926 * dd.c, df.c, dirname.c, du.c, echo.c, env.c, expr.c, factor.c, head.c:
3927 * hostid.c, hostname.c, id.c, link.c, ln.c, logname.c, ls.c, md5sum.c:
3928 * mv.c, nice.c, nl.c, nohup.c, paste.c, pathchk.c, pinky.c, pr.c:
3929 * printenv.c, printf.c, pwd.c, rm.c, setuidgid.c, sleep.c, sort.c:
3930 * split.c, stty.c, sum.c, sync.c, tac.c, tail.c, tee.c, test.c:
3931 * touch.c, tsort.c, uniq.c, unlink.c, uptime.c, users.c, wc.c:
3932 * who.c, whoami.c, yes.c: Revert yesterday's changes.
3933 Instead, a subsequent change will embed `Written by ' in
3934 each string along with the author names.
3936 * src/true.c: Revert yesterday's changes.
3937 * src/sys2.h: Likewise.
3939 2003-09-18 Jim Meyering <jim@meyering.net>
3941 * basename.c, cat.c, chroot.c, cksum.c, comm.c, cp.c, csplit.c, cut.c:
3942 * dd.c, df.c, dirname.c, du.c, echo.c, env.c, expr.c, factor.c, head.c:
3943 * hostid.c, hostname.c, id.c, link.c, ln.c, logname.c, ls.c, md5sum.c:
3944 * mv.c, nice.c, nl.c, nohup.c, paste.c, pathchk.c, pinky.c, pr.c:
3945 * printenv.c, printf.c, pwd.c, rm.c, setuidgid.c, sleep.c, sort.c:
3946 * split.c, stty.c, sum.c, sync.c, tac.c, tail.c, tee.c, test.c:
3947 * touch.c, tsort.c, uniq.c, unlink.c, uptime.c, users.c, wc.c:
3948 * who.c, whoami.c, yes.c: Update AUTHORS definition to be a
3949 comma-separated list of strings and/or update the call to
3950 parse_long_options so that `AUTHORS, NULL' are the last parameters.
3951 * src/true.c (main): Append NULL to version_etc argument list.
3952 * src/sys2.h (case_GETOPT_VERSION_CHAR): Likewise.
3954 * src/sort.c (numcompare): Rename local, logb, to log_b to avoid
3955 shadowing the math function name. Also rename loga to log_a.
3957 2003-09-14 Jim Meyering <jim@meyering.net>
3959 * src/factor.c (print_factors): Give a separate diagnostic
3960 for numbers that are too large, but otherwise valid.
3961 Reported by Dániel Varga.
3963 2003-09-10 Jim Meyering <jim@meyering.net>
3965 * Use automake-1.7.7. Regenerate dependent files.
3967 * tests/Makefile.am (all_programs): Use ../src/tr -s ' ' '\n' in place
3968 of `fmt -1'. Using the just-built tr is a little cleaner.
3969 Christian Krackowizer reported that HPUX 10.20 doesn't have fmt.
3970 * man/Makefile.am (programs, check-x-vs-1): Likewise.
3972 2003-09-09 Jim Meyering <jim@meyering.net>
3974 * src/copy.c: Alphabetize includes.
3975 Remove duplicate inclusion of "same.h".
3977 2003-09-08 Jim Meyering <jim@meyering.net>
3979 * Makefile.maint (GZIP_ENV): Remove --rsyncable.
3980 Didn't give enough of a benefit, mainly because it's not yet
3985 * man/Makefile.am (programs): Use ../src, not $(srcdir)/../src.
3986 (check-programs-vs-x): Fail if $(programs) is empty.
3988 * src/remove.c: Add a comment.
3990 2003-09-07 Jim Meyering <jim@meyering.net>
3992 * src/remove.c (D_INO, ENABLE_CYCLE_CHECK) [D_INO_IN_DIRENT]:
3993 Don't define. These symbols are no longer used.
3995 * tests/misc/tty-eof: Write ^D as \cD.
3996 Complete the change of 2003-08-02.
3998 * Makefile.maint (po-check): Use cvsu, so that a temporary source
3999 file in lib/ or src/ doesn't induce an unwarranted failure.
4000 Add a kludge to filter out the sole generated source file that
4001 also has translatable messages: src/false.c.
4003 2003-09-06 Jim Meyering <jim@meyering.net>
4005 * src/tail.c (enum): Add ALLOW_MISSING_OPTION.
4006 (parse_options): Give a diagnostic for (but still accept) the
4007 deprecated --allow-missing option.
4009 2003-09-04 Paul Eggert <eggert@twinsun.com>
4011 Don't ignore -S if input is a pipe. Bug report by Michael McFarland in
4012 <http://mail.gnu.org/archive/html/bug-coreutils/2003-09/msg00008.html>.
4014 * src/sort.c (sort_buffer_size): Omit SIZE_BOUND arg. Compute the
4015 size_bound ourselves. if an input file is a pipe and the user
4016 specified a size, use that size instead of trying to guess the
4017 pipe size. This has the beneficial side effect of avoiding the
4018 overhead of default_sort_size in that case. All callers changed.
4019 (sort): Remove static var size; now done by sort_buffer_size.
4021 2003-09-05 Jim Meyering <jim@meyering.net>
4023 * Use automake-1.7.6b and autoconf-2.57b. Regenerate dependent files.
4025 * tests/tail-2/tail-n0f: Wait .5 seconds for backgrounded process
4026 to start, rather than just .1. Upon failure, print unexpected state.
4028 2003-09-04 Paul Eggert <eggert@twinsun.com>
4030 * src/head.c (elide_tail_lines_pipe): Don't assign 0 or
4031 SAFE_READ_ERROR to tmp->nbytes.
4032 * src/tail.c (pipe_lines, pipe_bytes): Likewise.
4034 * src/head.c (struct linebuffer): Change nbytes and nlines
4035 from unsigned int to size_t. unsigned int is safe (after the
4036 2003-09-03 patch) but size_t is cleaner.
4037 * src/tail.c (struct linebuffer, struct charbuffer): Likewise.
4038 (pipe_bytes): Likewise for local variable 'i', which was 'int'.
4040 Standardize on BUFSIZ as opposed to other macro names and values.
4041 * src/head.c (BUFSIZE): Remove. All uses changed to BUFSIZ.
4042 * src/tail.c (BUFSIZ) [!defined BUFSIZ]: Remove.
4043 stdio.h has always defined it,
4044 and other code already assumes it's defined.
4045 * src/tr.c (BUFSIZ) [!defined BUFSIZ]: Likewise.
4046 (IO_BUF_SIZE): Remove; replace all uses with sizeof io_buf.
4047 (io_buf): IO_BUF_SIZE -> BUFSIZ.
4049 2003-09-04 Paul Eggert <eggert@twinsun.com>
4051 * src/seq.c (step): Default to 1.
4052 (print_numbers): Allow the output to be empty.
4053 (main): The default step is 1, even if LAST < FIRST;
4054 as per documentation.
4055 * tests/seq/basic (onearg-2): Output should be empty.
4057 2003-09-05 Jim Meyering <jim@meyering.net>
4059 * Makefile.cfg (wget_files): Temporarily disable, until master
4060 versions are restored to ftp.gnu.org.
4062 * configure.ac (AM_INIT_AUTOMAKE): Specify automake-1.7.6.
4064 Make seq's --width (-w) option work properly even when the
4065 endpoint requiring the larger width is negative and smaller than
4067 * src/seq.c (get_width_format): Include `-' in the set of bytes
4068 allowed in a `simple' number (no decimal point, no exponent).
4069 Reported by Patrick Mauritz.
4071 2003-09-02 Paul Eggert <eggert@twinsun.com>
4073 * NEWS: sort -t '\0' now uses a NUL tab.
4074 sort option order no longer matters, unless POSIX requires it.
4075 * src/sort.c (usage): Say "blanks" instead of "whitespace",
4076 Similar fixes for many comments.
4077 (TAB_DEFAULT): New constant, so that we can support NUL as
4078 the field separator.
4079 (tab): Now int, not char. Initialize to TAB_DEFAULT.
4080 (specify_sort_size): If multiple sizes are specified, use the largest.
4081 (begfield, limfield): Support NUL tab char.
4082 (set_ordering): Do not let -i override -d.
4083 (main): Report an error if incompatible -o or -t options are given.
4084 Report an error for "-t ''". Allow "-t '\0'" to specify a NUL tab.
4086 2003-09-05 Jim Meyering <jim@meyering.net>
4088 * tests/sort/Test.pm [o2, nul-tab]: New tests for the above.
4090 2003-09-03 Andreas Schwab <schwab@suse.de>
4092 Bug report and patch here:
4093 <http://mail.gnu.org/archive/html/bug-coreutils/2003-09/msg00009.html>
4094 * src/tail.c (pipe_lines): Don't truncate return value from safe_read.
4095 * src/head.c (elide_tail_lines_pipe): Likewise.
4097 2003-09-03 Jim Meyering <jim@meyering.net>
4099 * src/du.c (AUTHORS): Remove Larry McVoy's name, since the relatively
4100 small amount of code from him was first moved to lib/human.c, and was
4101 subsequently rewritten entirely.
4102 * src/df.c (AUTHORS): Likewise.
4104 2003-08-22 Lawrence Teo <lcteo@uncc.edu>
4106 * src/md5sum.c (split_3): Accept the BSD format for generic
4107 message digest modes. Currently works with BSD's MD5 and SHA1
4108 formats since these are the two algorithms presently used in
4109 coreutils. Updated comments to reflect this change.
4110 (bsd_split_3): Updated comments.
4112 * tests/md5sum/basic-1: New test to make sure that
4113 `md5sum --check' doesn't accept the BSD SHA1 format (adapted
4114 from `check-bsd' test in tests/sha1sum/basic-1).
4116 * tests/sha1sum/basic-1 (check-bsd2, check-bsd3): New tests for
4117 --check exit status and BSD SHA1 format (adapted from tests
4118 in tests/md5sum/basic-1).
4120 2003-08-30 Jim Meyering <jim@meyering.net>
4122 * src/ln.c (do_link): Use SAME_INODE rather than open-coding it.
4124 When source and destination arguments refer to the same file, reside
4125 on a partition (e.g. VFAT) on which distinct names may refer to the
4126 same directory entry (often due to variations in case), and when the
4127 link count for the file is 1, mv no longer unlinks the file. Instead,
4128 it gives the expected diagnostic that the source and destination are
4129 the same. WARNING: this is an incomplete fix. If the file happens
4130 to have a link count of 2 or greater, such an erroneous mv command
4131 will still unlink it.
4132 Although that is not possible on vfat or umsdos, it is possible on
4133 other file system types, e.g., ntfs, and hpfs.
4134 * src/copy.c (same_file_ok): Invoke same_name (which might still
4135 return false for names that refer to the same directory entry)
4136 only if the link count is 2 or more.
4137 * tests/mv/vfat: Show how to demonstrate the above problem.
4138 This test is not run.
4139 * tests/mv/Makefile.am (EXTRA_DIST): Add vfat.
4141 2003-08-27 Jim Meyering <jim@meyering.net>
4143 * src/who.c: Change meaning of -l from --lookup to --login, per POSIX.
4144 who's -l option has been eliciting an unconditional warning about
4145 this impending change since sh-utils-2.0.12 (April 2002).
4147 * src/paste.c (paste_parallel): Don't output `EOF' (aka -1) as a `char'.
4148 This would happen for nonempty files not ending with a newline.
4149 Reported by Dan Jacobson.
4150 * tests/misc/paste-no-nl: New file. Test for above-fixed bug.
4151 * tests/misc/Makefile.am (TESTS): Add paste-no-nl.
4153 * src/stat.c (print_it): Avoid buffer overrun that would
4154 occur when the user-specified format string ends with `%'.
4155 Patch by Tommi Kyntola.
4156 * tests/misc/stat-fmt: New file. Test for above-fixed bug.
4157 * tests/misc/Makefile.am (TESTS): Add stat-fmt.
4159 2003-08-26 Jim Meyering <jim@meyering.net>
4161 Apply changes from bison.
4162 * GNUmakefile (SHELL): Define to `sh', if necessary.
4164 * Makefile.maint (WGETFLAGS): Define to `-C off'.
4165 Update all uses of $(WGET).
4167 2003-08-22 Akim Demaille <akim@epita.fr>
4169 * Makefile.cfg (local-checks-to-skip): New.
4170 * Makefile.maint (local-check): Rename as...
4171 (local-checks-available): this.
4174 2003-08-26 Akim Demaille <akim@epita.fr>
4176 * announce-gen (print_changelog_deltas): Neutralize "<#" as
4177 "<\#" to avoid magic from Gnus when posting parts of this script.
4179 2003-08-25 Jim Meyering <jim@meyering.net>
4181 * src/stat.c (main): Warn about use of deprecated `-l' option.
4183 2003-08-22 Jim Meyering <jim@meyering.net>
4185 * src/stat.c (do_stat): For link count at end of line, use %h format,
4186 instead of %-5h. The latter would make stat emit trailing spaces.
4187 Reported by Dan Jacobson.
4189 2003-08-20 Jim Meyering <jim@meyering.net>
4191 * Makefile.am (EXTRA_DIST): Add .x-sc_space_tab .x-sc_sun_os_names
4193 2003-08-19 Jim Meyering <jim@meyering.net>
4195 * src/system.h: Include stdlib.h unconditionally,
4196 as we're now assuming that part of hosted C89.
4198 2003-08-18 Jim Meyering <jim@meyering.net>
4200 * src/sys2.h (textdomain, bindtextdomain) [! ENABLE_NLS]: Define away,
4201 to avoid warnings from gcc.
4203 2003-08-17 Jim Meyering <jim@meyering.net>
4205 Avoid unnecessary and sometimes time-consuming hostname lookups.
4206 * src/who.c (print_user): Use strchr, not strrchr.
4207 * src/pinky.c (print_entry): Likewise.
4208 Patch by Michael Stone.
4209 This fixes a typo I introduced in who-users.c on 1996-02-23.
4211 * Makefile.maint (makefile-check): Add 0-9 to the range of characters
4212 disallowed between `@...@'.
4214 2003-08-16 Paul Eggert <eggert@twinsun.com>
4216 * configure.ac (fu_cv_sys_truncating_statfs): Remove; now
4217 done by gnulib .m4 files.
4218 (jm_DUMMY_1): Require gl_READUTMP, not jm_PREREQ_READUTMP.
4219 * src/sys2.h (strtoull): Remove unused declaration.
4221 2003-08-16 Jim Meyering <jim@meyering.net>
4223 * man/Makefile.am (.x.1): Ensure that generated PROGRAM.1 files
4226 * src/tail.c (tail_lines): Fix a potential (but very hard to exercise)
4227 race condition bug. The bug would be triggered when tailing a file
4228 with file pointer not at beginning of file, and where the file was
4229 truncated to have a length of less than the initial offset at just
4230 the right moment (between the two lseek calls in this function).
4232 An invalid initial value for *read_pos would result in
4233 `tail -n0 -f FILE' and `tail -c0 -f FILE' doing what amounted to a
4234 busy-wait rather than sleeping between iterations. The bug manifests
4235 itself only when tailing regular files that are initially nonempty.
4236 * src/tail.c (tail_bytes): Set *read_pos to new file offset after
4238 (tail_lines): Likewise, after lseek calls.
4239 Reported by Nick Estes. See http://bugs.debian.org/205251 for details.
4240 * tests/tail-2/tail-n0f: New file. Test for above fix.
4241 * tests/tail-2/Makefile.am (TESTS): Add tail-n0f.
4243 2003-08-15 Jim Meyering <jim@meyering.net>
4245 * Makefile.maint (sc_space_tab): Use exclusion list in separate file.
4246 (sc_sun_os_names): Likewise.
4247 * .x-sc_space_tab, .x-sc_sun_os_names: New files.
4249 * man/help2man: Remove some SPACEs before TAB.
4251 2003-08-14 Paul Eggert <eggert@twinsun.com>
4253 * Makefile.maint (LC_ALL): Set to C.
4254 * man/Makefile.am (ASSORT): New var.
4255 (check-x-vs-1, programs): Use it.
4256 * src/Makefile.am (ASSORT, check-README, ../AUTHORS): Likewise.
4257 * tests/Makefile.am (ASSORT, all_programs): Likewise.
4259 2003-08-11 Jim Meyering <jim@meyering.net>
4261 fold -s -wN would infloop for N < 8 with TABs in the input.
4262 E.g., this would not terminate: printf 'a\tb' | fold -w2 -s
4263 * src/fold.c (fold_file): Move contents of `else'-block
4264 out of conditional so it's used also for --spaces (-s).
4265 * tests/misc/fold: Test for the above fix.
4266 * tests/misc/Makefile.am (TESTS): Add fold.
4268 2003-08-10 Jim Meyering <jim@meyering.net>
4270 * src/nice.c [!NICE_PRIORITY]: Include <sys/resource.h> after
4271 system.h so the types from time.h and sys/time.h are available.
4272 It appears that this is necessary for OpenBSD, NetBSD, and
4273 Darwin 6.5 (MacOS 10.2.5). Reported by Nelson Beebe.
4275 2003-08-06 Paul Eggert <eggert@twinsun.com>
4277 * NEWS: Add support for setting file timestamps to microsecond
4278 resolution, on hosts that support this.
4279 * src/copy.c, src/cp.c, src/install.c, src/touch.c: Include utimens.h.
4280 * src/copy.c (copy_internal):
4281 Set file timestamps with utimens, not utime.
4282 * src/cp.c (re_protect): Likewise.
4283 * src/install.c (change_timestamps): Likewise.
4284 * src/touch.c (newtime, touch, main): Likewise.
4286 2003-08-09 Jim Meyering <jim@meyering.net>
4288 * Makefile.maint (sc_sun_os_names): New rule based on a regexp
4290 (syntax-check-rules): Add it.
4292 * src/tail.c (main): Tweak Solaris OS version number in comment.
4293 * src/wc.c (wc): Likewise
4294 * tests/tail-2/fflush: Likewise.
4296 * src/tail.c: Add new undocumented option, --presume-input-pipe.
4297 (pipe_lines): Use memchr to skip lines, rather than an explicit loop.
4299 2003-08-08 Paul Eggert <eggert@twinsun.com>
4301 Use new gnulib 'extensions' module.
4302 * configure.ac: Invoke gl_USE_SYSTEM_EXTENSIONS instead of
4305 2003-08-08 Paul Eggert <eggert@twinsun.com>
4307 * tests/du/basic: Ensure that a/b/F has at least 65 bytes too.
4309 2003-08-09 Jim Meyering <jim@meyering.net>
4311 * tests/misc/split-fail: Reflect that `split -a 0' is now accepted.
4312 For tests of obsolete behavior, don't presume that unsetting
4313 _POSIX2_VERSION is equivalent to _POSIX2_VERSION=199209.
4315 2003-08-07 Paul Eggert <eggert@twinsun.com>
4317 * doc/coreutils.texi (split invocation):
4318 Add -d or --numeric-suffixes option to 'split'.
4319 From a suggestion by Jesse Kornblum.
4320 * src/split.c (suffix_alphabet): New var.
4321 (longopts, usage, next_file_name, main): Support -d.
4322 (next_file_name, main): Allow -a0, as POSIX requires.
4323 (next_file_name): Don't assume ASCII-like encoding;
4324 'a' through 'z' are not contiguous in EBCDIC.
4326 2003-08-05 Paul Eggert <eggert@twinsun.com>
4328 Merge getline from gnulib.
4329 * lib/getline.h, lib/getline.c, m4/getline.m4: Merge from gnulib.
4330 * lib/getndelim2.h, lib/getndelim2.c, m4/getndelim2.m4, m4/ssize_t.m4:
4331 New files, from gnulib.
4332 * lib/getdelim2.c, lib/getdelim2.h: Remove.
4333 * lib/Makefile.am (libfetish_a_SOURCES): Change getdelim2.c and
4334 getdelim2.h to getndelim2.c and getndelim2.h.
4335 * m4/jm-macros.m4 (jm_MACROS): Use gl_GETNDELIM2 rather than
4336 checking for getdelim.
4337 (jm_CHECK_ALL_TYPES): Use gt_TYPE_SSIZE_T for ssize_t rather
4338 than rolling our own.
4339 * src/cut.c: Include getndelim2.h rather than getdelim2.h.
4340 (cut_fields): Invoke getndelim2 rather than getdelim2.
4342 2003-08-04 Jim Meyering <jim@meyering.net>
4344 * src/sort.c (main): Use unsigned int instead of int for `nsigs'
4345 and for the indices to iterate through nsigs.
4347 2003-08-02 Paul Eggert <eggert@twinsun.com>
4349 * src/sort.c: Minor code cleanups, mostly to use more accurate
4350 types and to remove unnecessary casts.
4351 (min, max): Remove. All uses changed to MIN and MAX.
4352 (hard_lc_collate, hard_LC_TIME, struct buffer.eof, struct
4353 keyfield.skipsblanks, struct keyfield.skipeblanks, struct
4354 keyfield.numeric, struct keyfield.general_numeric, struct
4355 keyfield.month, struct keyfield.reverse, reverse, unique,
4356 have_read_stdin): Now bool, not int. All uses changed.
4357 (eolchar): Now char, not int.
4358 (struct keyfield.ignore): Now bool const *, not int *.
4359 (struct keyfield.translate): Now char const *, not char *.
4360 (struct month.name): Likewise.
4361 (blanks, nonprinting, nondictionary): Now bool[], not int[].
4362 (cleanup, inittables, keycompare, check, mergefps, first_same_file,
4363 check, sort, main): Use const * pointers when possible.
4364 (month_cmp): Rewrite to avoid casts.
4365 (inittables): Initialize tables unconditionally, to avoid branches.
4366 (fillbuf): Return bool, not int. All uses changed.
4367 (fillbuf, keycompare, new_key, main):
4368 Use SIZE_MAX rather than (size_t) -1.
4369 (trailing_blanks): Renamed from trim_trailing_blanks.
4370 Return the number of blanks to trim. All uses changed.
4371 (getmonth): Use trailing_blanks rather than open code.
4372 (keycompare): Do not cast char * to unsigned char *; not needed.
4373 CMP_WITH_IGNORE converts args to UCHAR, so no need to convert it
4375 (compare, main): Use | rather than || to avoid jumps.
4376 Replace "diff = NONZERO (alen)" with "diff = 1", since alen must
4378 (check, first_same_file, sort, main):
4379 Use bool instead of int local vars when possible.
4380 (check): Merge the old 'checkfp' and 'check' into a single function,
4381 that returns a boolean (true if the file was ordered).
4383 (main): Use int instead of unsigned for iterating through nsigs.
4384 Rename local var "posix_pedantic" to "posixly_correct".
4386 2003-08-02 Jim Meyering <jim@meyering.net>
4388 * src/nice.c [!NICE_PRIORITY]: Include <time.h> before <sys/resource.h>
4389 to avoid compilation error on Ultrix. Reported by Christian Krackowizer.
4391 * src/cut.c (cut_fields): Don't read again after encountering an
4392 initial EOF. E.g., `cut -f2' would do so.
4393 * tests/misc/tty-eof: Add a test for the above fix.
4395 * src/sort.c (sortlines): Add description and references.
4398 * tests/Makefile.am (TESTS_ENVIRONMENT): Set PATH so that
4399 the tests in help-version will use the just-built binaries.
4400 Reported by Christian Krackowizer.
4402 2003-07-31 Paul Eggert <eggert@twinsun.com>
4404 * NEWS: Add --rfc-2822 option to GNU date.
4405 * doc/coreutils.texi (Time directives, Options for date, Examples
4407 * src/date.c (long_options, usage, main): Likewise.
4408 * doc/getdate.texi (General date syntax): Likewise.
4409 * doc/coreutils.texi (Options for date): Fix a typo in format:
4410 it's now %d not %_d. Add URLs.
4412 2003-08-01 Jim Meyering <jim@meyering.net>
4414 * tests/shred/remove: Ensure that $? is 0 for the final `exit 0'.
4415 Otherwise, with at least the /bin/sh from HPUX 10.20,
4416 the trap code would end up converting that to exit 1 and thus an
4417 unexpected test failure. Reported by Christian Krackowizer.
4419 2003-07-31 Paul Eggert <eggert@twinsun.com>
4421 * src/ptx.c: Do not include bumpalloc.h.
4422 (WORD_TABLE): New member alloc.
4423 (ALLOC_NEW_WORD): Remove.
4424 (occurs_alloc): New var.
4425 (digest_word_file, find_occurs_in_text): Check for arithmetic
4426 overflow when computing table size. Use xrealloc rather than
4427 bumpalloc primitives.
4429 2003-07-29 Jim Meyering <jim@meyering.net>
4433 * README: When running tests as root, suggest using
4434 sudo with NON_ROOT_USERNAME=$USER.
4436 * tests/Makefile.am (all_programs): Makefile is in ../src, not
4439 2003-07-28 Jim Meyering <jim@meyering.net>
4441 * Makefile.maint (GZIP_ENV): Try Debian/gzip's new --rsyncable option.
4443 2003-07-28 Paul Eggert <eggert@twinsun.com>
4445 * lib/stdbool.hin (_Bool): Make it signed char, instead of
4446 an enum type, so that it's guaranteed to promote to int.
4447 * src/sort.c (sortlines_temp): Undo previous change.
4449 2003-07-28 Jim Meyering <jim@meyering.net>
4451 * src/sort.c (sortlines_temp): Declare local `swap' to be `int', not
4452 `bool'. Otherwise, at least one buggy compiler (alpha gcc-2.95.4)
4453 would cause lines[-1 - swap] (with swap = false) to evaluate to
4456 2003-07-27 Jim Meyering <jim@meyering.net>
4458 * tests/priv-check (my_uid): Use `!', not `^' in case pattern `[!0-9]',
4459 since /bin/sh of at least NetBSD 1.6 and OpenBSD 3.2 don't accept `^'.
4461 * src/remove.c (prompt) [! recursive]: Don't prompt about unwritable
4462 directories, as required by POSIX. Reported by Karl Berry.
4463 * tests/rm/dir-no-w: New file. Test for the above fix.
4464 * tests/rm/Makefile.am (TESTS): Add dir-no-w.
4466 * tests/mk-script: Emit `$xx', not its expansion.
4468 2003-07-27 Paul Eggert <eggert@twinsun.com>
4470 This change was inspired by a similar proposal by Stepan Kasal.
4471 * src/sort.c (mergelines, sortlines_temp): New functions.
4472 (sortlines): Use them, to reduce the number of times that
4473 we need to copy 'struct line' values. This improved CPU
4474 performance by about 30% on one 18 MB test.
4475 (sort): Don't invoke sortlines unless we have 2 or more lines.
4477 2003-07-26 Stepan Kasal <kasal@ucw.cz>
4479 * src/sort.c (sort): Don't require two `struct line's per text line,
4480 the new sort algorithm requires just 1.5.
4482 2003-07-27 Jim Meyering <jim@meyering.net>
4484 * src/pathchk.c (validate_path): Use %lu, not %ld.
4486 * src/cut.c (is_printable_field): Simplify bit arithmetic.
4488 * src/ls.c (sort_files): Put `volatile' in the right place.
4491 2003-07-26 Jim Meyering <jim@meyering.net>
4493 Use only one bit per field/offset in array, not one `int'.
4494 * src/cut.c (printable_field): Change type to `unsigned char'.
4495 (mark_printable_field, is_printable_field): New functions.
4496 Use them in place of all direct accesses of `printable_field'.
4498 * src/expand.c (parse_tabstops): Detect overflow properly.
4499 * src/cut.c (set_fields): Likewise.
4501 * src/rm.c: Include "dirname.h".
4502 (usage): Use base_name (program_name) in body of --help output.
4504 * man/Makefile.am (.x.1): ...back out the kludge of 2003-07-22.
4505 Idea from Brendan O'Dea, who suggested using
4506 `program_name = basename (argv[0]);' everywhere --
4507 can't do that, but using base_name works just fine here.
4509 * src/Makefile.am (AM_INSTALLCHECK_STD_OPTIONS_EXEMPT): Exempt test.
4511 2003-07-24 Paul Eggert <eggert@twinsun.com>
4513 Fix some POSIX-compliance problems with 'test'. This makes
4514 'test' more compatible with Bash.
4516 * NEWS, doc/coreutils.texi: Document the following.
4517 * src/test.c: Include exitfail.h.
4518 (TEST_FAILURE): New constant, used for exit status if 'test' fails.
4519 (test-syntax_error): Use it.
4520 (binary_operator): Now takes bool arg specifying whether left operand
4521 is -l ARG, so that caller determines this rather than us.
4523 (term): Use posixtest to evaluate parenthesized subexpressions.
4524 (unary_operator, one_argument): Remove support for -t without operand.
4525 (one_argument): Take argument from argv[pos].
4526 (one_argument, two_arguments, three_arguments): Advance pos.
4527 All callers changed.
4528 (three_arguments): Look for binary ops before "!". Then look
4529 for parenthesized one_argument expressions, instead of trusting
4530 expr () to do the right thing.
4531 (posixtest): Now takes number of args. All callers changed.
4532 Treat "( A B )" like "A B".
4533 (main): Set exit_failure to TEST_FAILURE. Don't depend on
4534 POSIXLY_CORRECT, as we now conform to POSIX by default.
4535 (main) [!LBRACKET]: Do not recognize "--help" or "--verbose" unless.
4536 * tests/test/Test.pm (test_vector): Add several tests to check
4537 the above. Syntax errors now exit with status 2, not 1.
4538 * man/Makefile.am (mapped_name): Use `../src/[' binary to create test.1.
4540 2003-07-26 Jim Meyering <jim@meyering.net>
4542 * tests/help-version: Adjust for above change in test behavior:
4543 `[' exits with 2, not 1, and test doesn't accept --help or --version.
4545 * Makefile.maint (ME): Don't use trick suggested in Make manual.
4546 It doesn't work for make-3.79.1. Reported by Christian Krackowizer.
4548 * Makefile.maint (sc_system_h_headers): Another syntax check.
4549 (syntax-check-rules): Add it to the list.
4551 * src/pathchk.c (validate_path): Cast strlen value to `unsigned long'
4552 so it matches `%ld' format even on 32-bit systems.
4554 * src/fmt.c (flush_paragraph): Cast field width to `int' to
4555 avoid warning on 64-bit systems.
4557 * src/ls.c (sort_files): Make `func' volatile, so it can't be
4558 clobbered by a `longjmp' into this function.
4560 2003-07-25 Jim Meyering <jim@meyering.net>
4562 * src/pathchk.c (validate_path): Use %ld format (not %d) for size_t
4565 * tests/misc/split-fail: Disable the --line-bytes=$_4gb test,
4566 because it'd evoke spurious failure on 64-bit systems.
4568 2003-07-24 Jim Meyering <jim@meyering.net>
4570 * src/dd.c (usage): Document the fact that SIGUSR1 makes dd
4571 output its current record counts. Reported by Jurriaan.
4573 * tests/wc/Test.pm (test_vector): Disable the `PIPE' tests when running
4574 `wc' with no options. This goes along with the change of 2003-07-20.
4576 2003-07-23 Jim Meyering <jim@meyering.net>
4578 Don't include headers already included by system.h:
4579 * src/tr.c: Don't include errno.h.
4580 * src/true.c: Don't include version-etc.h.
4581 * src/test.c: Don't include limits.h or error.h.
4582 * src/stat.c: Don't include unistd.h or time.h.
4583 * src/readlink.c: Don't include stdlib.h, unistd.h, or limits.h.
4584 * src/pr.c: Don't include time.h.
4585 * src/pathchk.c: Don't include errno.h.
4586 * src/nice.c: Don't include sys/time.h.
4587 * src/ls.c: Don't include stdlib.h.
4589 * basename.c, cat.c, chroot.c, cksum.c, comm.c, csplit.c, cut.c, date.c:
4590 * dd.c, dirname.c, echo.c, env.c, expand.c, expr.c, factor.c, fmt.c:
4591 * fold.c, head.c, hostid.c, hostname.c, id.c, join.c, kill.c, logname.c:
4592 * md5sum.c, nice.c, nl.c, nohup.c, od.c, paste.c, pathchk.c, pinky.c:
4593 * pr.c, printenv.c, printf.c, ptx.c, pwd.c, seq.c, setuidgid.c, shred.c:
4594 * sleep.c, sort.c, split.c, stat.c, stty.c, su.c, sum.c, tac.c, tail.c:
4595 * tee.c, test.c, tr.c, true.c, tsort.c, tty.c, uname.c, unexpand.c:
4596 * uniq.c, uptime.c, users.c, wc.c, who.c, whoami.c, yes.c:
4597 Don't include closeout.h.
4599 * tests/rm/fail-2eperm: Add a check for whether $NON_ROOT_USERNAME
4600 can access the required version of rm.
4601 * tests/rm/Makefile.am (TESTS_ENVIRONMENT): Define PACKAGE_VERSION.
4603 * tests/cut/Test.pm (out-delim3a): New test.
4605 * man/help2man: Update to version 1.33.
4607 * src/expand.c (parse_tabstops): Detect overflow in tabstop sizes.
4609 * src/dircolors.c: Include xstrndup.h.
4610 (xstrndup): Remove function, now that it's been factored out into
4613 2003-07-22 Paul Eggert <eggert@twinsun.com>
4615 * src/wc.c (wc): Fix typo in computation of file from file_x,
4616 which caused the former to be used uninitialized if file_x was
4619 2003-07-22 Jim Meyering <jim@meyering.net>
4621 * src/cut.c (set_fields): Use xcalloc in place of xmalloc+memset.
4623 * man/Makefile.am (.x.1): Substitute 's,$t/$*,$*,' on output of
4624 help2man, to avoid having `rm.td/rm' appear in rm.1. Reported by
4625 Thomas Luzat. See http://bugs.debian.org/202413 for details.
4627 * src/cut.c (main) [lint]: Initialize spec_list_string to avoid warning.
4629 * src/hostid.c: Don't include <unistd.h>. system.h already does that.
4631 * src/cut.c (set_fields): Mark all selected indices before trying to
4632 determine range endpoints.
4633 * tests/cut/Test.pm: New test for the above fix.
4635 Begin to address this comment: What if someone wants to
4636 extract the 1,000,000-th field of some huge input file?
4637 The first step is to rearrange things so that the values
4638 in the printable_field array are all 0/1 rather than 0/1/2.
4639 * src/cut.c (RANGE_START_SENTINEL): Remove.
4640 Store range-start indices in a hash table, rather than
4641 overloading the `printable_field' array.
4642 (range_start_ht): New global.
4643 (hash_int, hash_compare_ints, is_range_start_index): New functions.
4644 (print_kth): Use is_range_start_index; don't test printable_field.
4645 (set_fields): Detect overflow.
4646 (set_fields): Insert each range-start index into range_start_ht.
4647 (main): Call set_fields only once, and only after
4648 output_delimiter_specified and (if required) range_start_ht have
4651 2003-07-20 Paul Eggert <eggert@twinsun.com>
4653 * src/wc.c (get_input_fstatus): Fix typo: `stat' was being
4654 invoked with a null pointer when there were no file arguments.
4656 2003-07-20 Jim Meyering <jim@meyering.net>
4658 * Makefile.maint (sc_changelog): Add another nit-picky check.
4660 * src/wc.c (write_counts): Add a comment.
4661 (wc): Rename `file' parameter.
4662 Set new local, `file', to be the file name, or (when it's NULL)
4663 _("standard output") so that all uses of `file' use the proper value.
4664 Use STREQ, not strcmp.
4666 2003-07-20 Paul Eggert <eggert@twinsun.com>
4668 wc count field widths now are heuristically adjusted depending
4669 on the input size, if known. If only one count is printed, it
4670 is guaranteed to be printed without leading spaces.
4672 Previously, wc did not align the count fields if
4673 POSIXLY_CORRECT was set, but POSIX did not actually require
4674 this undesirable behavior, so it has been removed.
4676 * NEWS: Document this.
4677 * doc/coreutils.texi (wc invocation): Likewise.
4679 * src/wc.c (number_width): New var.
4680 (posixly_correct): Remove.
4681 (struct fstatus): New struct.
4682 (write_counts): Output fields of width number_width.
4683 Do not worry about POSIXLY_CORRECT.
4684 Use null file, not empty-string file, to denote stdin,
4685 since "" is a valid file name on some hosts.
4686 (wc, wc_file): New arg fstatus. Use it to avoid invoking fstat
4688 (wc): Avoid problems if end_pos - current_pos overflows.
4689 Do not print odd message if stdin has a read error.
4690 (get_input_fstatus, compute_number_width): New functions.
4691 (main): Use them to implement the new behavior.
4692 Ignore POSIXLY_CORRECT.
4694 * tests/wc/Test.pm: Adjust to the new output widths.
4696 2003-07-19 Jim Meyering <jim@meyering.net>
4698 * tests/rm/fail-eperm: Don't create temporary directory --
4701 * tests/shred/remove: Don't open-code test for UID != 0.
4702 Use priv-check's require-non-root instead.
4703 Update to use newer framework.
4705 * tests/help-version (expected_failure_status_expr): Record that
4706 expr exits with status of 3 for e.g., a write error.
4708 * tests/priv-check: Use `id -u' to see if we're running as root,
4709 rather than trying go write to an write-protected file.
4710 When running as root, ensure $NON_ROOT_USERNAME is valid.
4711 When running as root with `require-non-root', ensure that `.'
4712 is writable by $NON_ROOT_USERNAME, then reinvoke $0 set-user-ID
4713 to $NON_ROOT_USERNAME. If `.' is not writable, then skip the test.
4715 * src/printenv.c: Include "exitfail.h".
4716 (main): Set exit_failure rather than calling close_stdout_set_status.
4717 * src/date.c: Likewise.
4718 * src/sort.c: Likewise.
4719 * src/tty.c: Likewise.
4721 2003-07-18 Jim Meyering <jim@meyering.net>
4723 * tests/touch/not-owner: Update to use newer framework.
4725 * tests/rm/fail-eperm: Use $srcdir/../priv-check, create a temporary
4726 directory, and remove Perl-coded `you may not run as root' test.
4727 * tests/cp/fail-perm: Use $srcdir/../priv-check, rather than
4728 hard-coding something not quite equivalent.
4729 Paul Jarc reported the inconsistent diagnostics.
4731 * src/sort.c (main): Use close_stdout via atexit.
4732 Now `sort --version' and `sort --help' fail, as they should
4733 when their output is redirected to /dev/full.
4735 * src/su.c (usage): Don't call close_stdout here.
4736 (main): Use close_stdout via atexit.
4737 Now `su --version > /dev/full' fails, as it should.
4738 Somehow, the change of 2000-05-07 that purports to fix this
4741 * tests/help-version (--help/--version vs. /dev/full): Special-case
4742 `[' to protect it from expected_failure_status-`eval'.
4744 * src/uniq.c (writeline): Use a SPACE, not a TAB between the
4745 count and the corresponding line, as required by POSIX.
4746 Reported by Clement Wang.
4747 * tests/uniq/Test.pm (101, 102): Update tests of -c accordingly.
4749 * tests/expr/basic: Add tests for when exit status is 2.
4751 * src/nohup.c (NOHUP_FOUND_BUT_CANNOT_INVOKE, NOHUP_FAILURE):
4752 Use an anonymous `enum', rather than #define.
4754 2003-07-17 Paul Eggert <eggert@twinsun.com>
4756 * src/expr.c: Include "exitfail.h", "quotearg.h".
4757 (EXPR_INVALID, EXPR_ERROR): New constants.
4758 (nomoreargs, null, toarith, nextarg): Return bool, not int.
4759 (syntax_error): New function, exiting with status 2. Use it
4760 insteading of printing "syntax error" ourselves.
4761 (main): Initialize exit_failure to EXPR_ERROR.
4762 Exit with EXPR_INVALID on syntax error (too few arguments).
4763 (nextarg): Use strcmp, not strcoll; strcoll might return
4764 an undesirable 0, or might fail.
4765 (docolon, eval4, eval3): Exit with status 3 on invalid argument type
4766 or other such error.
4767 (eval2): Report an error if strcoll fails in a string comparison.
4768 * src/sort.c: Include "exitfail.h".
4769 (main): Set exit_failure, not xalloc_exit_failure and
4770 xmemcoll_exit_failure.
4771 * tests/expr/basic: Invalid value exits with status 3, not 2.
4773 2003-07-16 Jim Meyering <jim@meyering.net>
4775 * configure.ac (AC_INIT): Use 5.0.90 as the version, rather than 5.0.2,
4776 per GNU maintainer guidelines. The next non-beta release will be 5.1.
4778 This script would have caught at least two recent bugs:
4779 those in [ and kill.
4780 * tests/help-version: Revive this script.
4781 It wasn't doing anything useful, since $all_programs wasn't being
4782 defined by the invoking Makefile.am.
4783 Reflect that nohup is no longer a script, so don't exclude it.
4784 Add framework to handle the programs added since it was last run:
4785 kill, stat, unlink, [, link, readlink.
4786 Fix path-related problems deriving from the move of this script
4787 from src/ to its present location.
4788 * tests/Makefile.am (all_programs): Define.
4789 (TESTS_ENVIRONMENT): Use it.
4791 * src/kill.c (main): Fix bug introduced on 2003-05-10 (for 5.0.1)
4792 whereby kill would always attempt to operate on argv[0] and fail.
4794 * src/test.c (integer_expected_error): Improve diagnostic -- now,
4795 it also matches the one from bash's builtin test.
4796 (binary_operator): Add \n at end of diagnostic.
4798 * tests/rm/fail-2eperm: Remove setuidgid-related code. Move it to ...
4799 * tests/priv-check: Move setuidgid-related and
4800 NON_ROOT_USERNAME-checking code to this file.
4802 * README: Update section on testing as `root'.
4803 Suggestion from Paul Jarc.
4805 * src/test.c (AUTHORS): Replace 3-letter usernames with the actual
4806 names of authors that I just found in bash's builtins/test.def.
4808 Running `[' with no arguments would evoke a segfault.
4809 * src/test.c (main) [LBRACKET]: Move initialization of argv to
4810 precede potential use via test_syntax_error.
4812 * src/Makefile.am (AM_CPPFLAGS): Rename from `INCLUDES', to avoid
4813 warning from automake -Wall.
4815 2003-07-15 Jim Meyering <jim@meyering.net>
4819 * Makefile.maint (%.asc): Remove target first, so gpg doesn't
4822 * announce-gen (print_changelog_deltas): Relax tests for matching
4823 version-number line in NEWS.
4824 Change the .sig suffix to .asc here, too.
4826 2003-07-14 Jim Meyering <jim@meyering.net>
4828 * Makefile.maint (%.asc): Renamed from %.sig.
4829 Generate and use ascii-armored signatures.
4830 Use gpg's -o option.
4832 2003-07-13 Jim Meyering <jim@meyering.net>
4834 * src/nohup.c (NOHUP_FAILURE, NOHUP_FOUND_BUT_CANNOT_INVOKE): Define.
4837 * Makefile.maint (syntax-check): Move each individual check into
4839 (syntax-check-rules): This is the list of syntax-check targets.
4840 (sc_unmarked_diagnostics, sc_cast_of_argument_to_free):
4841 (sc_cast_of_x_alloc_return_value, sc_space_tab):
4842 (sc_error_exit_success, sc_xalloc_h_in_src): New targets.
4844 2003-07-12 Jim Meyering <jim@meyering.net>
4846 * configure.ac: Remove uses of OPTIONAL_BIN_ZCRIPTS and last
4847 traces of the nohup script.
4849 * src/Makefile.am (bin_SCRIPTS): Remove use of just-removed
4850 $(OPTIONAL_BIN_ZCRIPTS).
4852 * src/Makefile.am (localedir.h): Put the `2>&1' after the redirect
4853 target, not before the `>'.
4855 * src/remove.c (remove_dir): Give a diagnostic upon failed save_cwd,
4856 now that that function no longer calls `error'.
4858 * src/df.c (find_mount_point): Emit a diagnostic for each
4859 failed syscall, rather than relying on caller to do that.
4860 The caller couldn't do a good job, anyhow -- too many different
4861 ways to fail (each with a different referent).
4862 Give a diagnostic upon failed save_cwd, now that that function
4863 no longer calls `error'.
4864 (show_point): Don't diagnose find_mount_point's errors, now that
4865 it handles them itself.
4867 * src/df.c (find_mount_point): Don't let free clobber errno upon
4870 * src/sys2.h: Remove alloca-related block.
4871 * src/system.h: Include <alloca.h> here, instead.
4873 It appears that the `#pragma alloca' included via "system.h" is
4874 adequate, since join.c uses alloca, yet lacked an in-file #pragma.
4875 * src/copy.c, src/cp.c, src/df.c, src/install.c, src/ln.c:
4876 * src/ls.c, src/mv.c, src/remove.c: Remove `#pragma alloca'.
4878 * src/chown-core.c (change_file_owner): Do not restore any special
4879 permission bits (e.g., set-user-ID, set-group-ID) that are reset
4880 by chown(2) on some systems. Suggestion and insistence :-) from
4883 * tests/input-tty: Also check `test -t 1'.
4884 This is necessary on linux-2.4.21. Otherwise, the stty/basic-1
4885 test would block when run in the background.
4887 2003-07-11 Jim Meyering <jim@meyering.net>
4889 * tests/sample-test: Also fail if cat-to-create-expected-output
4890 fails. Otherwise, if both `exp' and `out' were to end up empty
4891 because of e.g., a full disk, they would mistakenly compare equal.
4893 * src/nohup.c: New file. Rewrite of nohup.sh in C.
4894 This solves a portability problem: on at least Solaris systems,
4895 when nohup.sh used the vendor /bin/sh, it would exit with status
4896 of `1' rather than the required 126 or 127 upon failure to exec
4897 the specified program.
4899 * src/Makefile.am (EXTRA_SCRIPTS): Remove definition.
4900 (bin_PROGRAMS): Add nohup.
4901 (EXTRA_DIST): Remove nohup.sh.
4902 (all_programs): Remove use of $(EXTRA_SCRIPTS).
4903 * src/nohup.sh: Remove file.
4904 * man/Makefile.am (nohup.1): Depend on nohup.c, rather than nohup.sh.
4906 * tests/misc/nohup: Tests for the above.
4907 * tests/misc/Makefile.am (TESTS): Add nohup.
4909 * src/head.c (diagnose_copy_fd_failure): New function, renamed from
4910 the macro, COPY_FD_DIAGNOSE.
4911 (diagnose_copy_fd_failure): Enclose diagnostic in _(...).
4912 (head_file): Likewise.
4914 * src/date.c: Include "quote.h".
4915 (batch_convert): Use the quote function rather than using literal `...'
4918 * src/setuidgid.c (main): Enclose diagnostic in _(...).
4919 * src/fmt.c (main): Likewise.
4920 * src/mknod.c (main): Likewise.
4921 * src/tac.c (tac_seekable): Likewise.
4922 * src/yes.c (main): Likewise.
4923 * src/od.c (main): Likewise.
4924 * src/install.c (change_attributes): Likewise.
4926 2003-07-10 Jim Meyering <jim@meyering.net>
4928 * src/head.c (usage): Use 1024*1024 in place of 1048576.
4929 * src/tail.c (usage): Likewise.
4931 * tests/rm/fail-2eperm: Now that we have setuidgid, use it in
4932 place of the kludge in this test. Suggestion from Paul Jarc.
4934 * src/Makefile.am (noinst_PROGRAMS): Define to setuidgid.
4935 * src/setuidgid.c: New program, solely for testing (not installed).
4937 * src/chown-core.c (change_file_owner): Don't leak file descriptors
4938 when dereferencing symlinks.
4940 2003-07-09 Jim Meyering <jim@meyering.net>
4942 * tests/du/slash: New file/test for today's lib/ftw.c fix.
4943 * tests/du/Makefile.am (TESTS): Add slash
4945 * src/tail.c (xlseek): Avoid warning about ``return without value
4946 from function returning non-void''.
4948 2003-07-08 Jim Meyering <jim@meyering.net>
4950 * man/help2man: Update to version 1.29.
4952 * man/help2man: Add END handler to close STDOUT and check for errors.
4954 2003-06-30 Paul Eggert <eggert@twinsun.com>
4956 Add support for a "[" that conforms to the GNU coding standards,
4957 i.e., that does not depend on its name.
4958 * src/lbracket.c: New file.
4960 * man/Makefile.am (programs): Ignore "[", since it doesn't have
4961 a separate man page.
4962 * src/Makefile.am (bin_PROGRAMS): Add "[".
4963 (__SOURCES): New var.
4964 * src/test.c (LBRACKET): Define to 0 if not defined.
4965 (main): Use LBRACKET rather than argv[0].
4967 * src/test.c (one_argument): Do not check for -t if POSIXLY_CORRECT.
4968 Reported by Paul Jarc and Dan Jacobson.
4970 * src/test.c (main): Do not recognize --help or --version if
4971 POSIXLY_CORRECT, when invoked as "test". Handle "[ ]" correctly.
4972 Do not bother testing that margv[margc] is non-null.
4974 2003-07-04 Jim Meyering <jim@meyering.net>
4976 * src/who.c (print_line): Rewrite to use asprintf, in order to be
4977 able to avoid emitting trailing spaces. Reported by Dan Jacobson.
4979 * tests/misc/head-elide-tail: Add tests of head's new --lines=-N
4980 option, and perform the +1600 invocations of head IFF the envvar
4981 RUN_EXPENSIVE_TESTS is set.
4983 2003-07-03 Jim Meyering <jim@meyering.net>
4985 * src/cp.c (do_copy): Give a better diagnostic when failing due
4986 to nonexistent destination directory. Reported by Dmitry Rutsky.
4987 See http://bugs.debian.org/199730 for details.
4989 2003-06-27 Jim Meyering <jim@meyering.net>
4991 split's --verbose option did nothing [broken in 4.5.10 and 5.0]
4992 * src/split.c (longopts): Use `1', not `0' as the value for
4993 for &verbose. Reported by Keith Thompson.
4995 Test for the above fix.
4996 * tests/misc/split-a: Also use --verbose and compare stderr
4997 output with what we'd expect.
4999 2003-06-20 Jim Meyering <jim@meyering.net>
5001 * src/copy.c (copy_internal) [HAVE_STRUCT_STAT_ST_AUTHOR]:
5002 Use `error_t' (rather than int) as type for local `err'.
5003 From Alfred M. Szmidt.
5005 2003-06-19 Marcus Brinkmann <marcus@gnu.org>
5007 * src/copy.c (copy_internal) [HAVE_STRUCT_STAT_ST_AUTHOR]:
5008 Fix author preservation code.
5010 2003-06-19 Jim Meyering <jim@meyering.net>
5012 * src/ln.c (ENABLE_HARD_LINK_TO_SYMLINK_WARNING): Define to 0.
5013 (do_link): Don't warn about hard link to symlink.
5015 2003-06-18 Jim Meyering <jim@meyering.net>
5017 * src/cut.c: Include "getdelim2.h", not "getstr.h".
5018 Reflect renaming: getstr -> getdelim2.
5020 * src/comm.c, src/join.c, src/nl.c, src/uniq.c: Reflect renaming:
5021 readline -> readlinebuffer.
5023 2003-06-09 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
5025 * src/readlink.c: Include <sys/types.h> before system.h (because
5026 the latter includes <sys/stat.h>). Required on Ultrix 4.3.
5028 2003-06-17 Jim Meyering <jim@meyering.net>
5030 * src/system.h (initialize_main): Define.
5031 Use it in every `main'. Applied via this:
5032 p='initialize_main (&argc, &argv);'
5033 perl -ni -e '/program_name.=.argv.0/ and print " '"$p"'\n"; print' \
5034 $(grep -l program_name.=.argv.0 *.c)
5035 test.c uses margc/margv, so I made the change manually for that file.
5036 Based on a patch from Bernard Giroud.
5038 2003-06-09 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
5040 Fix for build failure on Ultrix 4.3.
5041 * src/stat.c: Include sys/statvfs.h in preference to sys/vfs.h.
5042 Include sys/param.h and sys/mount.h on ultrix.
5044 2003-06-16 Jim Meyering <jim@meyering.net>
5046 * src/touch.c (O_NDELAY, O_NONBLOCK, O_NOCTTY, EISDIR): Remove
5048 * src/system.h (O_NDELAY, O_NONBLOCK, O_NOCTTY, EISDIR): Define
5049 them here instead, but with one change: define EISDIR to -1, not 0.
5051 * src/cat.c (cat): Remove `#ifndef ENOSYS', now that it's
5052 guaranteed to be defined.
5053 * src/system.h (ENOSYS, ENOTSUP): Define to -1 if not defined.
5055 * README: Mention the CVS repository.
5056 Encourage addition of test cases.
5058 2003-06-12 Jim Meyering <jim@meyering.net>
5060 * src/touch.c (touch): Call close only if necessary.
5063 * src/wc.c (usage): Correct wording: wc prints counts in the order
5064 `newline, word, byte'. Reported by Keith M. Briggs.
5065 * man/wc.x: Fix it here, too. And change `lines' to `newlines'.
5067 2003-06-10 Jim Meyering <jim@meyering.net>
5069 * tests/date/Test.pm: Add a test for the new format, e.g., May-23-2003.
5071 2003-06-07 Jim Meyering <jim@meyering.net>
5073 * Makefile.maint (syntax-check): Add commented-out (over-aggressive)
5076 2003-06-06 Jim Meyering <jim@meyering.net>
5078 * src/extract-magic (main): Avoid newer 3-arg form of open,
5079 so this script works also with e.g., perl5.005_03.
5080 Patch by John David Anglin.
5082 2003-06-04 Paul Eggert <eggert@twinsun.com>
5084 * src/system.h: Include <stdbool.h> unconditionally.
5086 2003-06-04 Jim Meyering <jim@meyering.net>
5088 * man/Makefile.am (check-programs-vs-x): Rename target
5089 from check-programs-vs-1. Adjust rule to check for the
5090 primary (.x) file, not the generated one (.1).
5092 2003-06-03 Tim Mooney <mooney@dogbert.cc.ndsu.NoDak.edu>
5094 * man/kill.x: New file.
5095 * man/Makefile.am (dist_man_MANS): Add kill.1.
5098 2003-06-04 Jim Meyering <jim@meyering.net>
5100 Ensure that the .x file for a new program is never forgotten again.
5101 * man/Makefile.am (programs): Define.
5102 (check-programs-vs-1): New phony target.
5103 (check-local): Depend on it.
5105 2003-06-03 Jim Meyering <jim@meyering.net>
5107 Avoid unnecessary copying of environment.
5108 * src/env.c (main): Rather than clearing the environment and --
5109 unless told to ignore environment -- copying all settings from
5110 the saved, original environment, clear the environment only when
5111 that is requested. Suggested by Jens Elkner.
5113 2003-06-02 Jim Meyering <jim@meyering.net>
5115 * src/system.h: Always include <string.h>, since we assume C89.
5116 Include <limits.h> without checking for HAVE_LIMITS_H.
5118 * src/test.c [!TEST_STANDALONE]: Remove #if-0'd block.
5119 (STREQ, S_IXUGO): Remove redundant (in system.h) definitions.
5121 2003-06-01 Jim Meyering <jim@meyering.net>
5123 Avoid a race condition in `tail -f' described by Ken Raeburn in
5124 http://mail.gnu.org/archive/html/bug-textutils/2003-05/msg00007.html
5125 * src/tail.c (file_lines): Add new parameter, *read_pos, and set it.
5126 (pipe_lines, pipe_bytes, start_bytes, start_lines): Likewise.
5127 (tail_bytes, tail_lines, tail): Likewise.
5128 (tail_file): Use the new `read_pos' value as the size,
5129 rather than stats.st_size from the fstat call.
5131 2003-05-28 Jim Meyering <jim@meyering.net>
5133 * src/extract-magic: Allow expansion of `$file' in the here-
5134 document corresponding to the comment at the top of fs.h.
5136 2003-05-26 Jim Meyering <jim@meyering.net>
5138 * src/stat.c: Fix portability problem on FreeBSD5.0: don't include
5139 <sys/statvfs.h> on systems without HAVE_STRUCT_STATVFS_F_BASETYPE.
5140 Use #if/#elif/... cascade so we get only one set of include files.
5141 Reported by Nelson Beebe.
5143 2003-05-24 Jim Meyering <jim@meyering.net>
5145 * src/md5sum.c (split_3): Accept the BSD format only when in MD5 mode.
5146 * tests/sha1sum/basic-1: Make sure `sha1sum --check' doesn't
5147 accept the BSD format.
5149 2003-03-28 Joe Orton <jorton@redhat.com>
5151 * src/md5sum.c (bsd_split_3): New function.
5152 (split_3): Detect checksums from BSD 'md5' command and handle them
5155 * tests/md5sum/basic-1: New tests for --check exit status, and for
5156 BSD-style checksum files.
5158 2003-05-21 Jim Meyering <jim@meyering.net>
5160 * src/head.c (elide_tail_lines_pipe): Fix a thinko.
5161 This sort of thing is why it'd be *Really Good* to factor
5162 out the common code used here and in tail.c.
5164 2003-05-14 Jim Meyering <jim@meyering.net>
5166 * src/head.c (usage): Document new feature: --bytes=-N and --lines=-N.
5168 * tests/du/slink: Skip this test if `.' is on an XFS file system.
5170 * tests/du/fd-leak: New file. Test for the bug in du that
5171 was fixed by the 2003-05-12 change to lib/ftw.c.
5172 * tests/du/Makefile.am (TESTS): Add fd-leak.
5174 * src/head.c (AUTHORS): Enclose string in N_(...), now that it
5175 includes a translatable word, `and'.
5177 * src/dd.c (usage): Don't use `,' as the thousands separator
5178 in e.g. 1,000,000 and 1,048,576. Instead, do this:
5179 `SIZE may be ..., MB 1000*1000, M 1024*1024 and so on...'
5180 * src/df.c (usage): Likewise.
5181 * src/du.c (usage): Likewise.
5182 * src/ls.c (usage): Likewise.
5184 * Makefile.maint (syntax-check): Add another check.
5186 2003-05-13 Paul Eggert <eggert@twinsun.com>
5188 Fix uniq to conform to POSIX, which requires that "uniq -d -u"
5189 must output nothing. Problem reported by Josh Hyman.
5191 * src/uniq.c (enum output_mode, mode): Remove, replacing with:
5192 (output_unique, output_first_repeated, output_later_repeated):
5193 New vars. All uses of "mode" changed to use these variables,
5194 which are not mutually exclusive as "mode" was.
5195 (writeline): New arg "match", used to control whether to
5196 obey output_first_repeated or output_later_repeated.
5197 All callers changed.
5198 (check_file, main): Adjust to above changes.
5200 * tests/uniq/Test.pm: Test that 'uniq -d -u' outputs nothing.
5202 2003-05-14 Jim Meyering <jim@meyering.net>
5204 * tests/rm/rm3: Use tr's \n notation rather than \012.
5205 This package can afford to do that, since its tests are guaranteed use
5206 GNU tr, which has accepted the more modern notation for 10 years.
5207 * tests/rm/rm5: Likewise.
5208 * tests/cp/same-file: Likewise.
5209 * tests/stty/row-col-1: Likewise.
5210 * tests/stty/basic-1: Likewise.
5211 * tests/rm/deep-1: Likewise.
5212 * tests/mv/part-symlink: Likewise.
5213 * tests/mkdir/perm: Likewise.
5214 * tests/misc/nice: Likewise.
5216 2003-05-13 Jim Meyering <jim@meyering.net>
5218 * src/copy.c (struct F_triple) [name]: Remove const attribute.
5219 (triple_free): Don't apply cast to argument of free.
5220 (seen_file): Add cast here instead.
5222 * src/cp-hash.c (struct Src_to_dest) [name]: Remove const attribute.
5223 (src_to_dest_free): Don't apply cast to argument of free.
5225 * src/sort.c (zaptemp): Don't apply cast to argument of free.
5226 * src/pr.c (init_fps, init_store_cols): Likewise.
5227 * src/join.c (delseq, freeline): Likewise.
5228 * src/expr.c (OLD): Likewise.
5229 * src/sort.c (sort): Likewise.
5230 * src/head.c (elide_tail_lines_pipe): Likewise.
5232 * src/tail.c: Include "quote.h".
5233 Use quote in diagnostics. Change many error format strings
5234 from just `%s' to e.g., `error reading %s'.
5235 (pipe_lines): Change type of parameter, n_lines, to uintmax_t.
5236 Rewrite newline-counting loop to use memchr.
5238 * src/head.c (elide_tail_lines_pipe): Use `if', not assert.
5239 Now that assert is no longer used, don't include <assert.h>.
5241 2003-05-12 Jim Meyering <jim@meyering.net>
5243 * src/head.c: Include <assert.h>.
5244 (AUTHORS): Add my name.
5245 (elide_tail_lines_pipe): New function.
5247 2003-05-10 Jim Meyering <jim@meyering.net>
5249 * Makefile.maint (syntax-check): Check for `error (EXIT_SUCCESS,'.
5251 * src/readlink.c (main): Set program_name before first use.
5252 Remove that (redundant) first use.
5253 Don't exit successfully just because --verbose was specified.
5254 Pass 0, not EXIT_SUCCESS, as first argument to error; when that
5255 parameter is 0, error does not exit.
5257 * src/uname.c (main): When failing due to too many arguments, also say
5258 that, rather than just "Try `uname --help' for more information.".
5259 * src/comm.c (main): Likewise, but for too few arguments.
5260 * src/logname.c: Include error.h.
5261 (main): Say why we're failing.
5263 * src/uniq.c (main): Don't segfault when argc < optind.
5264 * src/who.c (main): Handle argc < optind.
5265 * src/df.c (main): Likewise.
5266 * src/install.c (main): Likewise.
5267 * src/mv.c (main): Likewise.
5268 * src/pwd.c (main): Likewise.
5269 * src/tty.c (main): Likewise.
5270 * src/chroot.c (main): Likewise.
5271 * src/hostname.c: Likewise.
5272 * src/du.c (main): Likewise.
5273 * src/expand.c (main): Likewise.
5274 * src/env.c (main): Likewise.
5275 * src/unexpand.c (main): Likewise.
5276 * src/printenv.c (main): Likewise.
5277 * src/sync.c (main): Handle argc == 0.
5278 * src/expr.c (main): Likewise.
5279 * src/printf.c (main): Likewise.
5280 * src/basename.c (main): Likewise.
5281 * src/ln.c (main): Test for `missing argument' before computing n_files.
5282 * src/tail.c (main): Test for the case of no arguments before
5285 * src/kill.c (send_signals): Don't check command line arguments here.
5286 (main): Check them here instead. Handle argc < optind.
5288 * src/logname.c (main): Use error, rather than fprintf, for the sake
5291 * src/rm.c (main): Don't overrun array bound if argc is 0.
5293 2003-05-09 Jim Meyering <jim@meyering.net>
5295 * src/sort.c (main): Don't overrun array bound if argc is 0.
5296 That would happen when invoked via: execl ("/usr/bin/sort", NULL);
5297 Reported by Wartan Hachaturow.
5299 2003-05-07 Jim Meyering <jim@meyering.net>
5301 Implement support so that `head --lines=-N' works on seekable files.
5302 * src/head.c (enum Copy_fd_status): Define.
5303 (COPY_FD_DIAGNOSE): New macro.
5304 (elide_tail_lines_seekable): New funtion.
5305 (elide_tail_lines_file): Call it here.
5307 2003-05-06 Jim Meyering <jim@meyering.net>
5309 * src/sys2.h (CHAR_BIT): Remove duplicate definition.
5311 2003-05-04 Jim Meyering <jim@meyering.net>
5313 * tests/head/Test.pm: Remove tests of --bytes=-N; using that framework
5314 caused the addition of thousands of small files to the tar archive.
5315 * tests/misc/head-elide-tail: New file. Add them here instead.
5316 * tests/misc/Makefile.am (TESTS): Add head-elide-tail.
5318 2003-05-04 Paul Eggert <eggert@twinsun.com>
5320 * src/remove.c (HAVE_WORKING_READDIR): Define to 0 if not defined.
5321 (IF_READDIR_NEEDS_REWINDDIR): Remove.
5322 (remove_cwd_entries): Rewrite to avoid IF_READDIR_NEEDS_REWINDDIR,
5323 which was a bit weird because it couldn't be emulated by a function.
5325 2003-05-03 Jim Meyering <jim@meyering.net>
5327 Extend head to accept --lines=-N (--bytes=-N) and to print all
5328 but the N lines (bytes) at the end of the file.
5329 * src/head.c: Include full-write.h, full-read.h, inttostr.h, quote.h.
5330 Use quote() in diagnostics, rather than literal `' marks.
5331 (copy_fd, elide_tail_bytes_pipe, elide_tail_bytes_file):
5333 (elide_tail_lines_pipe, elide_tail_lines_file): New functions.
5334 (head_file): Reorganize so as to call head from only one place.
5335 (main): Likewise, for head_file.
5336 Handle new, undocumented option, --presume-input-pipe.
5337 Handle negative line and byte counts.
5338 * tests/head/Test.pm: Add lots of tests to exercise --bytes=-N.
5340 * tests/du/8gb: Skip test if the file system of `.' doesn't support
5341 sparse files -- otherwise it'd create a file of size 8GB.
5343 2003-05-02 Jim Meyering <jim@meyering.net>
5345 * src/fmt.c (usage): Don't mention obsolescent -WIDTH option.
5346 Instead explain about `-' and standard input.
5347 (main): Give a proper diagnostic for e.g., `fmt -c -72'.
5348 Reported by Keith Thompson.
5349 * tests/fmt/basic: Add test for the above fix.
5351 * src/fmt.c: Include "quote.h".
5352 Use quote() in diagnostics, rather than literal `' marks.
5353 (main): Exit nonzero when unable to open an input file.
5354 * tests/fmt/basic: Add test for the above fix.
5356 * src/fmt.c (main): Diagnose invalid suffix on obsolescent width
5357 specifications like `-72x'.
5358 * tests/fmt/basic: Add test for the above fix.
5360 Work around nasty readdir bug on Darwin6.5.
5361 * src/remove.c (IF_READDIR_NEEDS_REWINDDIR): Define.
5362 [! HAVE_WORKING_READDIR] (remove_cwd_entries): If readdir has just
5363 returned NULL and there has been at least one successful unlink or
5364 rmdir call since the opendir or previous rewinddir, then call
5365 rewinddir and reiterate the loop.
5367 Factor out common code.
5368 * src/remove.c (readdir_ignoring_dotdirs): New function.
5369 (is_empty_dir): Use it here.
5370 (remove_cwd_entries): Use it here.
5372 2003-05-01 Jim Meyering <jim@meyering.net>
5374 * tests/rm/r-3: Create 500 rather than just 300 files.
5375 There's a bug in Darwin6.5's readdir that shows up only with
5377 Fix a bug in this test: `cd $pwd' (not to `..'), now that $tmp
5381 Change type of n_units, n_bytes, n_lines to be `uintmax_t'.
5382 (dump_remainder): Move two declarations `down' into the scope
5383 where they are used.
5384 (xlseek): Return the resulting offset.
5385 (file_lines): Rename parameter, file_length, to end_pos.
5386 (pipe_lines): Don't coerce safe_read return value to `int'.
5387 Adapt tests accordingly.
5388 (pipe_bytes) [struct charbuffer] (nbytes): Change type from `int'
5390 Change type of `total_bytes' from `int' to `size_t',
5391 since the former wouldn't always be wide enough.
5392 Don't coerce safe_read return value to `int',
5393 and adapt tests accordingly.
5394 Now that testing for a read error no longer involves
5395 using `tmp', handle that case *after* freeing `tmp'.
5396 (start_bytes): Clean up.
5397 (tail_bytes): Now that `n_bytes' may be larger than
5398 OFF_T_MAX, test for that condition and, if it's true, don't
5399 use lseek optimizations.
5400 (parse_options): Don't fail just because N_UNITS is larger than
5401 the maximum size of a file -- tail may be applied to an input
5402 stream (e.g., a pipe) with more data than that.
5404 * Makefile.maint (syntax-check): Rename from alloc-check.
5405 Also check for SPACE-TAB sequences.
5406 Also check for malloc/calloc/realloc casts.
5408 2003-05-01 Jim Meyering <jim@meyering.net>
5410 * src/tail.c (start_lines): Rewrite to use memchr. Clean up.
5412 2003-04-28 Jim Meyering <jim@meyering.net>
5414 * tests/misc/tty-eof: Send two tokens, not just one, so we don't
5415 make the now-more-picky tsort fail.
5417 2003-04-24 Jim Meyering <jim@meyering.net>
5419 * src/tsort.c (tsort): Remove unnecessary test of have_read_stdin.
5420 (main): Minor syntactic clean-up.
5422 * src/tsort.c (tsort): Fail if the input contains an odd number of
5423 tokens. Reported by junkio@cox.net.
5425 * tests/tsort/basic-1: Test for the above fix.
5427 2003-04-21 Jim Meyering <jim@meyering.net>
5429 * tests/misc/printf: Add tests for the printf fixes below.
5431 * Makefile.cfg (cvs_files): Add $(srcdir)/config/depcomp to the list.
5433 2003-04-20 Paul Eggert <eggert@twinsun.com>
5435 Fix printf POSIX compatibility bug reported by Ben Harris in
5436 <http://mail.gnu.org/archive/html/bug-coreutils/2003-04/msg00070.html>.
5437 * doc/coreutils.texi (printf invocation): It's \NNN in the format,
5438 \0NNN in the %b operand.
5439 * src/printf.c (usage): Likewise.
5440 (print_esc): New arg OCTAL0 to specify whether \0NNN or \NNN
5441 is desired. All uses changed. Behave like Bash printf if %b
5442 operand uses \NNN where the initial N is not 0.
5444 2003-04-17 Jim Meyering <jim@meyering.net>
5446 * src/stty.c: Remove uses of PROTOTYPE macro.
5448 2003-04-15 Jim Meyering <jim@meyering.net>
5450 * Makefile.maint: Remove (or replace-with-TAB(s) to retain alignment)
5451 each sequence of spaces before a TAB character.
5453 2003-04-13 Jim Meyering <jim@meyering.net>
5455 * src/remove.c (is_empty_dir): Don't closedir (NULL).
5457 2003-04-12 Jim Meyering <jim@meyering.net>
5459 Giving nl an invalid STYLE argument (in --header-numbering=STYLE (-h),
5460 --body-numbering=STYLE (-b), or --footer-numbering=STYLE (-f)) or
5461 FORMAT (--number-format=FORMAT (-n)) would not give a useful diagnostic.
5462 * src/nl.c (main): Fix those problems and remove literal quote marks
5463 (e.g., "`%s'") from format string; instead use "%s" in each format
5464 string and `quote (optarg)' as the corresponding argument.
5465 Also, diagnose all invalid command line options before failing.
5467 * src/nl.c (proc_text): Fix a bug that would make nl output extra
5468 newlines in some cases. Details here: http://bugs.debian.org/177256.
5469 This bug was introduced on 2001-11-10 for textutils-2.0.17.
5470 * tests/misc/nl: Add test for the above-fixed bug.
5472 * tests/misc/readlink: New file. Test the --canonicalize option.
5473 * tests/misc/Makefile.am (TESTS): Add readlink.
5475 2003-04-11 Jim Meyering <jim@meyering.net>
5478 * src/chown.c, src/cp.c, src/dircolors.hin, src/du.c, src/ln.c:
5479 * src/mkfifo.c, src/ptx.c, src/spline.c, src/stty.c, src/tail.c:
5480 * src/test.c, src/unexpand.c: Remove (or replace-with-TAB(s) to
5481 retain alignment) each sequence of spaces before a TAB character.
5483 * src/ls.c: Include <stdlib.h> unconditionally.
5485 * Makefile.maint (xalloc-check): Rename from header-check.
5487 * src/yes.c: Include error.h after system.h, not before.
5490 * src/copy.c, src/cp-hash.c, src/cp.c, src/csplit.c, src/cut.c:
5491 * src/date.c, src/df.c, src/du.c, src/expand.c, src/expr.c, src/id.c:
5492 * src/join.c, src/md5sum.c, src/nl.c, src/od.c, src/paste.c, src/pr.c:
5493 * src/ptx.c, src/sort.c, src/split.c, src/su.c, src/tail.c, src/tee.c:
5494 * src/tr.c: * src/unexpand.c, src/users.c:
5495 Remove anachronistic casts of xmalloc, xrealloc, and xcalloc
5496 return values and of xrealloc's first argument.
5497 Fix the former with this:
5498 perl -pi -e 's/\([^(]*?\*\) *(x(m|c|re)alloc)\b/$1/'
5500 2003-04-10 Jim Meyering <jim@meyering.net>
5502 * src/stty.c (wrapf): Declare with format attribute.
5504 The S_MAGIC_... names shouldn't be maintained in two places (prior
5505 to this change, one would have to keep stat.c and fs.h in sync).
5506 This change makes it so those names and the corresponding
5507 hexadecimal constants all reside in stat.c. fs.h is now generated.
5508 * src/Makefile.am (fs.h): New rule to generate fs.h from stat.c.
5509 (BUILT_SOURCES): Add fs.h, now that it's generated.
5510 (EXTRA_DIST): Add extract-magic.
5511 * src/extract-magic: New script to extract fs.h definitions from stat.c.
5512 * src/stat.c (human_fstype) [__linux__]: Append each hex constant from
5513 fs.h in a comment after the corresponding `case S_MAGIC_...:' statement.
5515 * tests/tail-2/big-4gb: Skip this test (don't fail) if creating a
5516 file with nominal length > 4GB fails. Reported by Michael Deutschmann.
5518 * man/unexpand.x: Add `SEE ALSO' reference to expand.
5519 * man/expand.x: Add `SEE ALSO' reference to unexpand.
5520 Suggestion from Dan Jacobson.
5522 2003-04-10 Maciej W. Rozycki <macro@ds2.pg.gda.pl>
5524 * src/fs.h (S_MAGIC_DEVPTS): New magic for Linux's devpts.
5525 * src/stat.c (human_fstype): Handle Linux's devpts.
5527 2003-04-09 Paul Eggert <eggert@twinsun.com>
5529 * src/split.c (line_bytes_split): Arg is of type size_t, since
5530 that's all that is supported for now.
5531 (main): Check for overflow in obsolescent line count option.
5533 2003-04-09 Jim Meyering <jim@meyering.net>
5535 * tests/misc/split-fail: Add a new test for the above fix.
5537 * src/split.c (bytes_split): Use size_t temporary (rather than
5538 uintmax_t original) in remaining computations. From Paul Eggert.
5540 Handle command line option arguments larger than 2^31.
5541 This allows e.g., splitting into files of size 2GB and larger,
5542 and running split --lines=N with N=2^31 or more.
5543 But for --line-bytes=N, the restriction that N <= SIZE_MAX
5544 remains (for now), due to the way it is implemented.
5546 * src/split.c: Include "inttostr.h".
5547 (bytes_split, lines_split, line_bytes_split, main):
5548 Use uintmax_t, not size_t, for file sizes.
5549 (main): Give a better diagnostic for option arguments == 0.
5550 Use umaxtostr to print file sizes.
5551 Reported by Luke Hassell.
5553 2003-04-08 Jim Meyering <jim@meyering.net>
5555 * src/rm.c (usage): Mention that --directory (-d) works only
5556 on some systems. Suggestion from Samuel Tardieu.
5558 * tests/basename/basic: Run $PERL to see if it is available,
5559 rather than testing its value.
5560 * tests/sum/sysv, tests/tsort/basic-1, tests/unexpand/basic-1:
5561 * tests/basename/basic, tests/dd/skip-seek, tests/dircolors/simple:
5562 * tests/expr/basic, tests/factor/basic, tests/fmt/basic:
5563 * tests/ls-2/tests, tests/md5sum/basic-1, tests/md5sum/newline-1:
5564 * tests/misc/sort, tests/misc/tty-eof, tests/mv/i-1:
5565 * tests/rm/empty-name, tests/rm/fail-eperm, tests/rm/unreadable:
5566 * tests/seq/basic, tests/sha1sum/basic-1, tests/sha1sum/sample-vec:
5567 * tests/sum/basic-1, tests/seq/basic: Likewise.
5569 * tests/misc/Makefile.am (TESTS): Add split-fail.
5570 * tests/misc/split-fail: New file.
5572 * src/split.c: Rename local variables: nchars -> n_bytes.
5573 (lines_split): Rename local, nlines -> n_lines.
5574 (main): Rename local variable: s/accum/n_units/.
5575 (main): Use STDIN_FILENO, not literal `0'.
5577 2003-04-07 Jim Meyering <jim@meyering.net>
5579 * src/stat.c: Add #include directives for Ultrix 4.4.
5580 Based on a suggested change from Bert Deknuydt.
5582 2003-04-06 Jim Meyering <jim@meyering.net>
5584 * Makefile.maint (makefile-check): New rule.
5585 (local-check): Add it.
5587 2003-04-05 Jim Meyering <jim@meyering.net>
5589 * Makefile.am (nearly all of them):
5590 Use $(VAR) rather than @VAR@, now that we can rely on automake to
5591 emit a definition for each substituted variable.
5592 * tests/Makefile.am.in: Likewise.
5594 * tests/rm/rm5: Add a comment explaining why this test fails when
5595 using Tru64's broken sed.
5596 * tests/rm/rm3: Likewise.
5598 Make `kill -t' output signal descriptions (not `?') on Tru64.
5599 * src/kill.c (sys_siglist): Also check for __sys_siglist.
5600 Patch by Tony Leneis.
5601 * configure.ac: Also check for declaration of __sys_siglist.
5602 Required for Tru64 4.0D, 4.0F, and 5.1.
5603 Reported by Tony Leneis.
5605 2003-04-04 Jim Meyering <jim@meyering.net>
5607 * src/Makefile.am (PERL): Remove unnecessary definition.
5609 Because of inappropriate (but POSIX-mandated) behavior of rename,
5610 `mv a b' would not remove `a' in some unusual cases. Work around
5611 this by unlinking `a' when necessary.
5613 * src/copy.c (same_file_ok): Add an output parameter.
5614 Set it in the offending case.
5615 (copy_internal): When necessary, unlink SRC_PATH and inform caller.
5616 Reported by Ed Avis.
5617 * tests/mv/hard-4: New test for the above.
5618 * tests/mv/Makefile.am (TESTS): Add hard-4.
5620 Clean up rules for automatically generated sources:
5621 * src/Makefile.am (dircolors.h, wheel-size.h, wheel.h, false.c):
5622 Make each generated file be read-only.
5623 Add each file name to BUILT_SOURCES separately.
5624 (MAINTAINERCLEANFILES): Set to $(BUILT_SOURCES).
5626 Put LOCALEDIR macro definition in new file: localedir.h.
5627 * src/Makefile.am (DEFS): Remove definition.
5628 (localedir.h): New rule.
5629 (BUILT_SOURCES, DISTCLEANFILES): Add localedir.h.
5630 * src/system.h: Include "localedir.h".
5632 2003-04-02 Jim Meyering <jim@meyering.net>
5636 * tests/misc/Makefile.am (TESTS): Add false.
5638 * Makefile.maint (TMPDIR): Make sure it's defined.
5639 (my-distcheck): Build in $(TMPDIR), not `.'.
5641 * src/Makefile.am (false.c): Change all occurrences of
5642 `(EXIT_SUCCESS)' to `(EXIT_FAILURE)' so that false exits
5643 unsuccessfully also with --help. Reported by Paul Jarc,
5644 * tests/misc/false: New test for the above.
5646 2003-03-30 Jim Meyering <jim@meyering.net>
5648 * NEWS: Note the location of older NEWS files.
5650 * src/remove.c (is_empty_dir): Don't let a failing closedir
5651 clobber errno. Spotted by Arnold Robbins.
5653 * src/env.c: Fix typo in comment. From Arnold Robbins.
5655 2003-03-29 Jim Meyering <jim@meyering.net>
5659 * README: Note to expect build problems for stat.c on Ultrix 4.3.
5660 Note that there are some harmless test failures when running
5661 `make check' as root on some systems.
5663 2003-03-28 Jim Meyering <jim@meyering.net>
5665 * tests/stty/row-col-1: Skip this test if stty can't get window size.
5666 This happens when connecting to sparc-solaris5.7 via ssh from within
5667 emacs. Reported by Karl Berry.
5669 * tests/du/basic: Use seq, not `yes' to generate 4KB of data.
5670 Otherwise, on systems (DJGPP) that emulate pipes using files,
5671 this test would never complete, waiting for `yes' to terminate.
5672 * tests/du/slink: As above, use seq, not `yes' to generate link target.
5673 * tests/rm/hash: As above, use seq, not `yes' to generate dir name.
5674 Reported by Rich Dawe.
5676 2003-03-27 Jim Meyering <jim@meyering.net>
5678 * src/id.c: Remove Arnold Robbins' obsolete e-mail address
5679 from `written by...' comment, at his request.
5681 2003-03-24 Paul Eggert <eggert@twinsun.com>
5683 Fix buffer overrun problem reported by TAKAI Kousuke, along
5684 with some other POSIX incompatibilities.
5686 * src/printf.c (print_esc): Do not treat \x specially if
5687 POSIXLY_CORRECT. Avoid buffer overrun if the format ends
5688 in backslash. Treat incomplete escape sequences as strings
5689 of characters, as POSIX requires.
5690 (print_formatted): Allow multiple flags. Avoid buffer overrun
5691 if the format is incomplete.
5693 2003-03-24 Jim Meyering <jim@meyering.net>
5695 * tests/misc/printf: Add tests for the above fixes and changes.
5697 2003-03-26 Jim Meyering <jim@meyering.net>
5699 * src/copy.h (struct cp_options): Add a comment.
5701 2003-03-23 Jim Meyering <jim@meyering.net>
5703 * README: Describe problem with 64-bit mode on HPUX 11.x,
5704 with patch for /usr/include/inttypes.h.
5705 * TODO: Plan to add an autoconf test to work around the bug.
5707 2003-03-22 Jim Meyering <jim@meyering.net>
5709 * src/stat.c: Don't include <sys/sysmacros.h>.
5710 That is already done via system.h. Otherwise, the multiple
5711 inclusion would evoke redefinition warnings from Cray's /bin/cc,
5712 aka Cray Standard C Version 4.0.3 (057126) Mar 22 2003 22:02:28.
5713 (human_fstype): Factor some directives `up', out of this function.
5714 Cast away `const' to avoid error from Cray's /bin/cc.
5716 2003-03-20 Jim Meyering <jim@meyering.net>
5718 * announce-gen (print_changelog_deltas): Ensure that a newline
5719 precedes each row of `*'s.
5721 2003-03-20 Jim Meyering <jim@meyering.net>
5725 * src/seq.c (valid_format): Also accept ` ' and `'' as valid
5726 format flag characters.
5727 Do not require that a field width be specified.
5728 Do not fail when given a field width of `0'.
5729 Reported by Dan Jacobson.
5730 * tests/seq/basic: Add new tests for the above-fixed bug.
5732 * src/Makefile.am (all-local): Append $(EXEEXT) to use of `su'
5733 (install-root): Likewise.
5734 (install-exec-local): Likewise.
5735 Based on a patch from Richard Dawe.
5737 2003-03-19 Jim Meyering <jim@meyering.net>
5739 * man/Makefile.am (.x.1): Use $(LN_S) instead of 'ln -s',
5740 because the DJGPP 2.03 port of 'ln -s' doesn't work.
5741 Include $(EXEEXT) in program names.
5742 Since $(LN_S) may degenerate to `cp -p', be careful
5743 to invoke it from the destination directory.
5744 Mostly from Richard Dawe.
5745 * configure.ac: Use AC_PROG_LN_S.
5747 * tests/mv/part-symlink: Unset CDPATH. Otherwise, having the
5748 CDPATH shell variable set could cause this test to fail.
5749 Reported by Karl Berry.
5751 2003-03-18 Jim Meyering <jim@meyering.net>
5753 * src/fmt.c [struct Word] (paren, period, punct, final): Change the
5754 type of each member from bool <MEMBER>:1 to unsigned int <MEMBER>:1.
5755 AIX 5.1's xlc could not compile the former.
5756 Patch by Petter Reinholdtsen. Also reported by Mike Jetzer.
5758 2003-03-17 Richard Dawe <rich@phekda.freeserve.co.uk>
5760 * configure.ac: Include $(EXEEXT) in OPTIONAL_BIN_PROGS'
5761 program names, since automake only adds $(EXEEXT) to programs
5764 2003-03-16 Jim Meyering <jim@meyering.net>
5766 * src/remove.c (rm): Put two local variables in static storage,
5767 so they can't be clobbered by the potential longjmp.
5769 2003-03-15 Jim Meyering <jim@meyering.net>
5771 * Makefile.cfg (gnu_rel_host): Fix code to match the comment
5772 so that a version number with a two-digit component can still count
5773 as an alpha release. Reported by Richard A Downing.
5774 (gnu_rel_host): Define in terms of $(RELEASE_TYPE) instead.
5776 2003-03-14 Jim Meyering <jim@meyering.net>
5778 * src/ansi2knr.c: Remove no-longer-used file.
5779 * src/ansi2knr.1: Likewise.
5781 * Makefile.maint (prev_version_file): Don't use ?= for this particular
5782 assignment, since it causes trouble with old versions of GNU make
5783 (e.g. 3.76.1). The other uses of `?=' are inoffensive. Details here.
5784 http://mail.gnu.org/archive/html/bug-coreutils/2003-03/msg00028.html
5785 Patch from Alexandre Duret-Lutz.
5787 * Use patched automake-1.7.3. Regenerate Makefile.in files in
5788 subdirectories so that each includes a definition of ACLOCAL_M4.
5790 * announce-gen (main): Label the compressed source URLs.
5794 * tests/du/slink: Relax the test for the `local'ness of a file system,
5795 so that now it works also for tmpfs.
5797 * tests/du/hard-link: Transform output from first du, so that this
5798 test doesn't fail on file systems like tmpfs that order directory
5799 entries differently.
5801 2003-03-13 Jim Meyering <jim@meyering.net>
5803 * tests/du/8gb: Work around what appears to be an NFS failure that
5804 would make this test fail on some systems.
5806 2003-03-11 Jim Meyering <jim@meyering.net>
5808 * tests/du/basic: Make the test file exactly 4k bytes long.
5810 * src/split.c (longopts): Don't hard-code `2' here.
5811 Instead, just specify `&verbose', and ...
5812 (main): ... remove the `case 2:' block for --verbose.
5814 * tests/du/basic: Make the test file larger than 64 bytes, so that
5815 we don't immediately disqualify file systems (e.g., NetApp) on which
5816 smaller files take up zero disk blocks. Reported by Vin Shelton.
5818 2003-03-10 Jim Meyering <jim@meyering.net>
5820 Don't segfault for a negative field width or precision in format string.
5821 Note that this is just a stopgap fix. The longer term solution may
5822 involve adapting bash's builtins/printf.def.
5824 * src/printf.c: (UNSPECIFIED): Define.
5825 (print_direc): Use the special value, UNSPECIFIED, to indicate
5826 that field_width or precision has not been specified.
5827 (print_formatted): Fail if field_width or precision is the
5828 special value, UNSPECIFIED.
5829 Reported by Oliver Kiddle <okiddle@yahoo.co.uk>
5831 * src/sys2.h (INT_MIN): Define, if necessary.
5832 * tests/misc/printf: Add a test for the above-fixed bug.
5834 2003-03-09 Jim Meyering <jim@meyering.net>
5836 * src/remove.c (AD_stack_pop): Cast sizeof... to int before
5837 changing its sign. This avoids a warning from gcc on 64-bit systems.
5838 Reported by Bob Proulx.
5839 (pop_dir): Reverse order of sign change and cast, to be consistent
5842 2003-03-08 Jim Meyering <jim@meyering.net>
5844 * tests/Makefile.am (evar-check): Check for POSIXLY_CORRECT not as a
5845 shell variable, but only in the environment. With /bin/sh->bash, the
5846 shell variable is set to `y', and that would cause a spurious warning.
5847 Reported by Bob Proulx.
5849 * tests/Makefile.am (check-root): Remove touch/fifo.
5850 It doesn't appear to have to be run as root.
5852 * tests/rm/fail-2eperm: Rather than simply using the first non-root
5853 user name, make sure that the selected user name has a usable shell.
5854 Reported by Paul Jarc.
5856 Before, when using shred on a device, one had to specify --exact,
5857 or be careful to choose a size that would not be rounded up and
5858 exceed the maximum value; that could result in a failure of
5860 * src/shred.c (do_wipefd): --exact is now the default for non-regular
5861 files. Suggestion from Ben Elliston.
5864 * tests/misc/tty-eof: Require at least version 1.11 of Expect.pm.
5865 Old versions of Expect.pm (e.g., 1.07) lack the log_user function.
5866 Patch by Bob Proulx.
5868 * src/Makefile.am (check-misc): Check for use of `defined' in
5870 Change to $(srcdir) before running grep.
5872 * src/sleep.c: Remove now-unused #include and #define directives.
5874 * src/du.c (process_file): If a file's size is not being counted
5875 e.g., because it's a hard link to a file we've already counted,
5876 then don't print a line for it.
5878 * tests/du/hard-link: New test for the above-fixed bug.
5879 * tests/du/Makefile.am (TESTS): Add hard-link.
5882 * src/du.c: Revert most of the `reorganization' change of 2003-02-20,
5883 and make the two-array approach work.
5885 * tests/du/basic: Correct/add tests for the above fix.
5886 Set LC_ALL, etc., now that we use sort.
5887 Check the block/size of a small file, too.
5888 Correct expected results for simple dir1/dir2/file case.
5889 Add another test of du -S.
5891 2003-03-07 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
5893 Avoid build failure with gcc on hppa1.1-hp-hpux10.20 (see GCC PR
5894 middle-end/9986). As one of GCC's optimizations, it transforms a
5895 fputs_unlocked call to a fputc_unlocked call when the string is
5896 one character long. However, hpux doesn't have fputc_unlocked.
5898 * expr.c (usage): Use putchar, not fputs, to output a single character.
5899 * ls.c (dired_dump_obstack): Likewise.
5900 * ptx.c (output_one_tex_line, output_one_dumb_line): Likewise.
5901 * stat.c (print_it): Likewise.
5903 2003-03-07 Jim Meyering <jim@meyering.net>
5905 * src/cp.c: Remove everything associated with mmap-stack.c.
5906 This reverts the two changes of 2003-02-21.
5907 * src/du.c: Remove everything associated with mmap-stack.c.
5908 This reverts the change of 2003-02-19.
5910 2003-03-06 Jim Meyering <jim@meyering.net>
5912 * tests/cp/same-file: Unset CDPATH. Otherwise, having the
5913 CDPATH shell variable set could cause this test to fail.
5914 Reported by Karl Berry.
5916 2003-03-05 Jim Meyering <jim@meyering.net>
5920 * src/printf.c (print_esc): Remove pointless comparison of unsigned
5921 integer with zero, to avoid a warning from Intel's ecc.
5922 Reported by Nelson Beebe.
5924 * src/du.c (process_file): Sizes must all be of type uintmax_t.
5925 Otherwise, for files or totals that are too big, numbers would
5926 be truncated. Patch mostly by Michael Stone.
5927 Reported by Ingo Saitz as Debian bug #183210.
5929 * tests/du/8gb: New test for the above-fixed bug.
5930 * tests/du/Makefile.am (TESTS): Add 8gb.
5932 * src/du.c (MAX_N_DESCRIPTORS): Use 3 * UTILS_OPEN_MAX / 4
5933 rather than UTILS_OPEN_MAX - 10.
5935 2003-03-04 Jim Meyering <jim@meyering.net>
5937 * README: Refer new feature discussion to bug-coreutils@gnu.org,
5938 rather than bug-gnu-utils, now that the former is better known.
5939 Suggestion from Göran Uddeborg.
5941 * src/stat.c (usage): Capitalize consistently.
5942 Reported by Göran Uddeborg.
5944 * Makefile.maint (rel-files): Include $(signatures), so that
5945 those files are also copied into $(release_archive_dir).
5947 * src/df.c (find_mount_point): Call error here, now that restore_cwd
5949 * src/remove.c (AD_pop_and_chdir): Likewise.
5951 * tests/Makefile.am (check-root): Add fail-2eperm.
5953 2003-03-03 Jim Meyering <jim@meyering.net>
5955 * src/remove.c (remove_cwd_entries): Include the full filename of
5956 the offending file, not just the basename.
5958 * tests/misc/tty-eof: Set $ME properly.
5960 * Makefile.maint (THIS_VERSION_REGEXP, PREV_VERSION_REGEXP):
5961 Remove now-unused variables.
5962 (tag-prev-version, prev-cvs-tag): Likewise.
5964 * src/remove.c (remove_cwd_entries) [!ROOT_CAN_UNLINK_DIRS]: Give an
5965 accurate diagnostic when failing to remove a file owned by some other
5966 user. Reported by Ivo Timmermans via Michael Stone.
5967 This fixes Debian bug# 178471.
5969 * tests/rm/Makefile.am (TESTS): Add fail-2eperm.
5970 * tests/rm/fail-2eperm: New test, for the above-fixed bug.
5971 Based on a report from Ivo Timmermans.
5973 2003-03-02 Jim Meyering <jim@meyering.net>
5975 * src/copy.c (copy_internal) [un_backup]: When recovering from a
5976 failure to create a hard link, do not remove the entry associating
5977 the source dev/ino with the destination file name.
5978 * tests/mv/Makefile.am (TESTS): Add hard-3.
5979 * tests/mv/hard-3: New test, for the above-fixed bug.
5980 Inspired by a report from Iida Yosiaki.
5982 2003-03-01 Jim Meyering <jim@meyering.net>
5984 * src/df.c (print_header): Don't embed spaces in a separate `Type'
5985 header string. Instead, put `Filesystem' and `Type' headers in the
5986 same string, so translators can use horizontal space as needed.
5987 Reported by Jean Charles Delepine.
5989 2003-02-28 Jim Meyering <jim@meyering.net>
5991 * src/copy.c (copy_internal): When link fails because of an
5992 existing destination file, unlink that file and try again.
5993 Reported by Iida Yosiaki.
5995 * tests/mv/Makefile.am (TESTS): Add hard-2.
5996 * tests/mv/hard-2: New test for the above-fixed bug.
5997 Based on a test case from Iida Yosiaki.
5999 2003-02-26 Jim Meyering <jim@meyering.net>
6001 * tests/du/basic: Don't test du's -b option here. Directory byte
6002 counts are smaller (512 rather than 4096) on at least OSF/1 5.1
6003 and IBM AIX 4.2. Reported by Nelson Beebe.
6005 2003-02-25 Jim Meyering <jim@meyering.net>
6007 * Makefile.maint (announcement): Now that ChangeLog entries
6008 are output by announce-gen, don't do it here.
6009 * announce-gen (print_changelog_deltas): New function.
6012 2003-02-22 Jim Meyering <jim@meyering.net>
6014 * announce-gen: New option: --release-type=TYPE
6015 * Makefile.maint (beta, major): New targets. Remove `release'.
6016 Put them all together on a line.
6017 Pass the release type (via RELEASE_TYPE envvar) to the MAKE
6018 invocation of `announcement'.
6019 (announcement): Invoke announce-gen with --release-type=$RELEASE_TYPE.
6021 * announce-gen: New option: --news=NEWS_FILE.
6022 Extract NEWS entries here, not via rules in Makefile.maint.
6023 * Makefile.maint (announcement): Now that NEWS entries are
6024 extracted by announce-gen, don't do it here.
6025 (news-r1, news-r2): Remove now-unused definitions.
6027 2003-02-21 Jim Meyering <jim@meyering.net>
6031 Merge in changes from autoconf's version of this file.
6032 * Makefile.maint (www-gnu): Define.
6033 (standards.texi-url_prefix): Use $(www-gnu).
6034 (make-stds.texi-url_prefix): Likewise.
6036 * src/cp.c: Include "mmap-stack.h".
6037 (main): Invoke `run' through a macro that (when possible) runs it
6038 with a large, mmap'd stack.
6040 * src/cp.c (run): New function, preparing for the above.
6041 Exit from this function, not from main
6044 * src/du.c: New option: --apparent-size.
6045 (enum) [APPARENT_SIZE_OPTION]: New member.
6046 (long_options): Add it.
6047 (usage): Describe it.
6049 ['b']: Set apparent_size.
6050 David Eisner reported that the behavior of --bytes had changed.
6051 Paul Eggert proposed the use of a new option, --apparent-size.
6053 * src/du.c (apparent_size): New global.
6054 (print_only_size): Reflect the fact that we're printing byte counts,
6055 not ST_NBLOCKSIZE-byte-block counts.
6056 (print_size): Call print_only_size rather than duplicating its code.
6057 (process_file): Accumulate byte counts, rather than block counts.
6059 * src/du.c (process_file): Always reset size_to_propagate_to_parent
6060 for --separate-dirs (-S).
6062 2003-02-20 Jim Meyering <jim@meyering.net>
6064 * Use automake-1.7.3. Regenerate dependent files.
6066 * src/stat.c (print_stat): New format: %B (to print ST_NBLOCKSIZE).
6067 This makes %b (number of ST_NBLOCKSIZE-byte blocks) more useful.
6068 (usage) [%B]: Describe it.
6071 * src/du.c (process_file): Reorganize the code to use only
6072 one `sum' array, and change how -S works back to the way it was
6073 before 2003-01-31. Patch by Bruno Haible.
6075 * tests/du/basic: New test.
6076 * tests/du/Makefile.am (TESTS): Add basic.
6078 * tests/envvar-check: Add checks for the following:
6079 BLOCK_SIZE, DU_BLOCK_SIZE, DF_BLOCK_SIZE, LS_BLOCK_SIZE.
6081 * tests/Makefile.am: Rename phony target envvar-check to evar-check
6082 so as not to conflict with the distributed file by the same name.
6084 * src/du.c (process_file): Set info->skip before any possible return.
6086 Report correct usage for directories, not 0.
6087 * src/du.c (process_file): Return for `file_type == FTW_DPRE'
6088 _before_ recording the dev/ino of a directory.
6089 Reported by Bruno Haible.
6091 Now, df always displays the device file name corresponding to the
6092 listed mount point under `Filesystem'. Before, for an unmounted
6093 block- or character-special file argument, it would display the
6094 command-line argument instead.
6095 * src/df.c (show_disk): Return a value indicating whether
6096 there was a match. Don't try to find a mount point here.
6097 (show_entry): If show_disk doesn't find a match, call show_point.
6099 2003-02-19 Jim Meyering <jim@meyering.net>
6101 * src/du.c: Include "mmap-stack.h".
6102 (du_files): Add prototype with ATTRIBUTE_NORETURN.
6103 Exit from this function, not from...
6105 Instead, if possible, invoke du_files through a macro that
6106 runs it with a large, mmap'd stack.
6108 * src/join.c (usage): Change wording in --help output:
6109 use FILENUM instead of `SIDE' and say what FILENUM means.
6110 Reported by Bernhard Gabler.
6112 * src/df.c (print_header): Rather than using a hard-coded literal
6113 string of spaces matching the length of the English `...Type' header,
6114 output the right number of spaces to match the selected translation.
6115 Reported by Yann Dirson and Jean Charles Delepine as Debian bug 131113.
6117 * src/split.c (bytes_split): Remove unnecessary `else' after break.
6118 (lines_split): Likewise. and correct misleading indentation.
6120 * src/split.c: Include "full-read.h".
6121 (bytes_split, lines_split, line_bytes_split): Use full_read,
6122 not safe_read. The way split was using the latter, a short read
6123 could cause split to terminate before EOF.
6125 * tests/misc/tty-eof: Test all programs that can read stdin,
6126 requiring no arguments and that write to standard output.
6128 * tests/misc/tty-eof: New file. Renamed from ...
6129 * tests/misc/cat-tty-eof: Remove file. Rename to tty-eof.
6130 * tests/misc/Makefile.am (TESTS): Reflect renaming.
6132 2003-02-18 Jim Meyering <jim@meyering.net>
6134 cksum would perform an extra read after encountering EOF
6135 * src/cksum.c (cksum): Exit the loop upon EOF, too.
6136 Patch by Michael Bacarella.
6138 Test for the bug fixed today in cksum, md5sum, and sha1sum.
6139 * tests/misc/cat-tty-eof: Generalize, clean-up, and test for
6140 cat, cksum, md5sum, and sha1sum all in the same loop.
6142 2003-02-14 Jim Meyering <jim@meyering.net>
6144 * src/remove.c: Include "euidaccess.h".
6145 Remove declaration of euidaccess.
6147 2003-02-12 Jim Meyering <jim@meyering.net>
6149 * src/pathchk.c (portable_chars_only): Remove unnecessary `const'
6150 in cast to avoid warning from icc. Reported by Alexandre Duret-Lutz.
6152 2003-02-10 Jim Meyering <jim@meyering.net>
6154 * src/test.c: Don't include group-member.h.
6155 Include euidaccess.h.
6156 (eaccess): Rewrite function to set the real uid and gid temporarily
6157 to the effective uid and gid, then invoke 'access', and then set the
6158 real uid and gid back. On systems that lack setreuid or setregid,
6159 fall back on the kludges in euidaccess. Before, it would not work
6160 for e.g., files with ACLs, files that were marked immutable,
6161 or on file systems mounted read-only. Nelson Beebe raised the issue.
6162 Paul Eggert suggested the new implementation.
6164 2003-02-09 Jim Meyering <jim@meyering.net>
6166 * src/test.c (test_stat): Remove function. It's job is done (only
6167 when necessary) by the wrapper in lib/stat.c. Adjust all uses.
6169 2003-02-08 Jim Meyering <jim@meyering.net>
6173 * tests/mv/part-symlink: Don't assume that the file owner username
6174 length is less than 9 in ls output: instead, omit that field
6175 altogether. Reported by, and suggested fix from, Ferdinand.
6177 * tests/du/restore-wd: New test for just-fixed bug in ftw.c.
6178 * tests/du/Makefile.am (TESTS): Add restore-wd.
6180 * src/rm.c: Correct now-invalid comment about cycle-detection.
6182 2003-02-06 Jim Meyering <jim@meyering.net>
6184 * NEWS: Add entries from old/*/NEWS
6185 from fileutils-4.1 through 4.1.11 and
6186 from sh-utils-2.0 through 2.0.15. Suggestion from Karl Berry.
6190 * src/du.c (process_file): Don't return early for excluded files
6191 or for files whose dev/inode we've already seen.
6193 2003-02-05 Jim Meyering <jim@meyering.net>
6195 * tests/du/exclude: New file.
6196 * tests/du/Makefile.am (TESTS): Add exclude.
6198 2003-02-04 Dmitry V. Levin <ldv@altlinux.org>
6200 * src/who.c (print_boottime, print_deadprocs, print_runlevel):
6201 Fix memory allocation arithmetic.
6203 2003-02-04 Jim Meyering <jim@meyering.net>
6205 `df /dev/block-or-char-device-file--not-mounted' now reports
6206 the name of the file system on which the file resides, usually `/'.
6207 Before, it would leave the `Mounted on' field blank.
6208 * src/df.c (show_disk): Move function to precede find_mount_point.
6209 (show_disk): Add parameter: STATP.
6210 If we don't find a matching device name, then resort to calling
6211 find_mount_point. Reported by Bob Proulx.
6213 2003-02-03 Andreas Schwab <schwab@suse.de>
6215 * tests/rm/cycle: Require non-root.
6216 * tests/rm/isatty: Likewise.
6218 2003-02-02 Jim Meyering <jim@meyering.net>
6222 * man/Makefile.am (check-x-vs-1): Use @PATH_SEPARATOR@, not `:'.
6224 Ensure that there are no offending uses of `:'.
6225 * Makefile.maint (makefile_path_separator_check): New rule.
6226 (local-check): Add it to the list.
6228 2003-02-01 Jim Meyering <jim@meyering.net>
6230 * src/du.c (MAX_N_DESCRIPTORS): Define.
6232 * src/stat.c (G_fail): New global.
6233 (human_time): Diagnose failed localtime, not failed nstrftime.
6234 (main): Fail if G_fail is set.
6236 2003-01-31 Richard Dawe <rich@phekda.freeserve.co.uk>
6238 * tests/basename/Makefile.am: Use @PATH_SEPARATOR@ instead of
6239 hard-coding the path-separator. Also double-quote the new PATH,
6240 to avoid problems when the path-separator is a semi-colon or when
6241 `pwd` contains e.g. a space.
6242 * tests/chgrp/Makefile.am: Likewise.
6243 * tests/chmod/Makefile.am: Likewise.
6244 * tests/chown/Makefile.am: Likewise.
6245 * tests/cp/Makefile.am: Likewise.
6246 * tests/dd/Makefile.am: Likewise.
6247 * tests/dircolors/Makefile.am: Likewise.
6248 * tests/du/Makefile.am: Likewise.
6249 * tests/expr/Makefile.am: Likewise.
6250 * tests/factor/Makefile.am: Likewise.
6251 * tests/fmt/Makefile.am: Likewise.
6252 * tests/install/Makefile.am: Likewise.
6253 * tests/ln/Makefile.am: Likewise.
6254 * tests/ls/Makefile.am: Likewise.
6255 * tests/ls-2/Makefile.am: Likewise.
6256 * tests/md5sum/Makefile.am: Likewise.
6257 * tests/misc/Makefile.am: Likewise.
6258 * tests/mkdir/Makefile.am: Likewise.
6259 * tests/mv/Makefile.am: Likewise.
6260 * tests/od/Makefile.am: Likewise.
6261 * tests/rm/Makefile.am: Likewise.
6262 * tests/rmdir/Makefile.am: Likewise.
6263 * tests/seq/Makefile.am: Likewise.
6264 * tests/sha1sum/Makefile.am: Likewise.
6265 * tests/shred/Makefile.am: Likewise.
6266 * tests/stty/Makefile.am: Likewise.
6267 * tests/sum/Makefile.am: Likewise.
6268 * tests/tail-2/Makefile.am: Likewise.
6269 * tests/touch/Makefile.am: Likewise.
6270 * tests/tsort/Makefile.am: Likewise.
6271 * tests/unexpand/Makefile.am: Likewise.
6273 2003-01-31 Jim Meyering <jim@meyering.net>
6275 * src/stat.c: Include "file-type.h"
6276 (print_human_type): Remove function.
6277 (human_access): Rename from print_human_access. Return a string.
6278 (human_time): Rename from print_human_time. Return a string.
6279 (print_stat): Arrange so that field width and an alignment specifier
6280 are honored for the %A, %F, %x, %y, and %z formats.
6281 [%F]: Use file_type; this gives slightly different file type strings,
6282 e.g., `directory' instead of `Directory' and `regular file' or
6283 `regular empty file' instead of `Regular file'.
6284 Prompted by a report from Richard Dawe that the uses of
6285 S_IFSOCK and S_IFIFO in print_human_time were not portable
6286 to systems using e.g., DJGPP.
6288 2003-01-31 Richard Dawe <rich@phekda.freeserve.co.uk>
6290 * src/stat.c (print_stat): Use S_ISLNK rather than an explicit
6291 test using S_IFMT and S_IFLNK. S_IFLNK may not be defined.
6293 2003-01-31 Jim Meyering <jim@meyering.net>
6295 * src/du.c (main): Upon processing an invalid option or an invalid
6296 --exclude-from or --max-depth option argument, don't exit right away,
6297 in case there are others. Rather record the failure and exit after
6298 processing other options.
6300 * GNUmakefile (TAR_OPTIONS): Set and export, in order to make
6301 tar archive easier to reproduce.
6303 Rewrite to perform directory traversal using nftw.
6305 * src/du.c: Include "dirname.h", "ftw.h", and "quotearg.h".
6306 (AUTHORS): Add self.
6307 (opt_one_file_system): Move global into `main'.
6308 (path, xstat, exit_status): Remove declarations.
6309 (arg_length, suffix_length): New globals.
6310 (G_fail): New global, sort of like the old `exit_status'.
6311 (IS_FTW_DIR_TYPE): Define.
6312 (print_only_size): New function.
6313 (process_file): New function.
6314 (str_init, ensure_space, str_copyc, str_concatc): Remove functions.
6315 (str_trunc, pop_dir, count_entry): Likewise.
6316 (du_files): Rewrite to use nftw.
6318 2003-01-30 Jim Meyering <jim@meyering.net>
6320 * tests/du/trailing-slash: Ensure that du/ftw follows a command-line
6321 symlink-to-directory with -L, even without the trailing slash.
6323 2003-01-27 Jim Meyering <jim@meyering.net>
6325 * src/Makefile.am (check-misc): Check for st_blocks, too.
6327 * src/stat.c (print_stat): Use ST_NBLOCKS rather than `->st_blocks'.
6328 Reported by Richard Dawe.
6330 2003-01-27 Andreas Schwab <schwab@suse.de>
6332 * src/ls.c (quote_name): Add fourth parameter, width, into which to
6333 store the screen columns, and return the number of bytes instead.
6334 (print_dir): Pass NULL as fourth parameter of quote_name.
6335 (print_name_with_quoting): Likewise.
6336 (length_of_file_name_and_frills): Get the width from the fourth
6337 parameter of quote_name instead of return value.
6339 2003-01-27 Jim Meyering <jim@meyering.net>
6341 * src/ls.c (decode_switches): If `dired' is set without
6342 `format == long_format', then silently reset dired. This doesn't
6343 change the behavior of ls (all prior uses of dired were protected
6344 by `&& format == long_format'), and lets us...
6345 (DIRED_INDENT): ... remove the `format == long_format' conjunct.
6346 (PUSH_CURRENT_DIRED_POS): Likewise.
6349 2003-01-22 Jim Meyering <jim@meyering.net>
6351 * tests/du/no-x: New test, for functionality added to lib/ftw.c.
6352 * tests/du/Makefile.am (TESTS): Add no-x.
6354 2003-01-21 Jim Meyering <jim@meyering.net>
6356 * src/remove.c (remove_entry) [ROOT_CAN_UNLINK_DIRS
6357 && HAVE_STRUCT_DIRENT_D_TYPE]: If a file has d_type == DT_UNKNOWN
6358 it may still be a directory -- or not (e.g., with FreeBSD on an
6359 NFS-mounted file system), so resort to calling lstat to find out.
6360 Based on a patch by Michael van Elst.
6362 * tests/cp/same-file: Don't assume that the file owner username
6363 length is less than 9 in ls output: instead, omit that field
6364 altogether. Reported by, and suggested fix from, Ferdinand.
6366 2003-01-20 Jim Meyering <jim@meyering.net>
6368 * tests/date/Test.pm (wide-fmt): New test to demonstrate that
6369 large format widths no longer cause strftime to infloop.
6371 * Makefile.maint (mail_gpg_sign_cookie): Remove now-unused definition.
6373 2003-01-19 Jim Meyering <jim@meyering.net>
6375 * src/readlink.c: Include "canonicalize.h".
6377 2003-01-18 Jim Meyering <jim@meyering.net>
6379 * src/ls.c (Dereference_symlink) [DEREF_COMMAND_LINE_SYMLINK_TO_DIR]:
6381 (enum) [DEREFERENCE_COMMAND_LINE_SYMLINK_TO_DIR_OPTION]: New member.
6382 (long_options): Add option --dereference-command-line-symlink-to-dir.
6383 (main): Make DEREF_COMMAND_LINE_SYMLINK_TO_DIR be the default,
6384 rather than DEREF_COMMAND_LINE_ARGUMENTS, when none of the
6385 -d, -F, -l options is specified.
6386 (decode_switches): Handle --dereference-command-line-symlink-to-dir.
6387 (gobble_file): Honor DEREF_COMMAND_LINE_SYMLINK_TO_DIR.
6388 Change --dereference-command-line (-H) to dereference *all*
6389 command line arguments, including broken symlinks.
6391 2003-01-15 Paul Eggert <eggert@twinsun.com>
6393 Change ls -H back to the way it was yesterday, since this is
6394 compatible with FreeBSD and the POSIX spec is confusing
6395 and somewhat contradictory.
6397 * src/ls.c (DEREF_COMMAND_LINE_ARGUMENTS): Change name back
6398 from DEREF_COMMAND_LINE_SYMLINK_TO_DIR, updating all uses.
6399 (long_options): Change the long option name back.
6400 (usage): Change the usage back.
6401 (gobble_file): When -H is specified, dereference a top-level
6402 arg even if it points to a non-directory.
6404 2003-01-15 Jim Meyering <jim@meyering.net>
6406 * src/ls.c (gobble_file): Fall back on using lstat when required:
6407 when --dereference (-L) is not specified, and
6408 - when operating on a dangling symlink
6409 - when operating on command-line-symlink-to-directories
6410 This fixes numerous problems. Here are examples:
6411 - `ls dangling-symlink' would fail with `no such file...'
6412 Now it prints `dangling-symlink'.
6413 - `ls -i symlink' would mistakenly print the inode of the referent.
6414 Now it prints the inode of the symlink. Likewise for --size (-s).
6415 Based on a patch from Michael Stone.
6416 Reported by Deepak Goel as Debian bug #173793.
6418 Rename ls's --dereference-command-line (-H)
6419 option to --dereference-command-line-symlink-to-dir.
6420 * src/ls.c [enum Dereference_symlink]
6421 (DEREF_COMMAND_LINE_SYMLINK_TO_DIR): Rename from
6422 DEREF_COMMAND_LINE_ARGUMENTS. Update all uses.
6423 (long_options): Rename the long option.
6424 (usage): Say that --dereference-... changes how ls treats
6425 only symlinks to directories specified on the command line.
6427 2003-01-14 Jim Meyering <jim@meyering.net>
6429 * tests/ls/dangle: New file/test, for the above fix.
6430 * tests/ls/inode: Another new file/test, for the above fix.
6431 * tests/ls/Makefile.am (TESTS): Add dangle and inode.
6433 * src/ls.c (gobble_file): Fix a bug introduced in 4.5.4 that made it
6434 so that ls --color would no longer highlight the names of files with
6435 the execute bit set when not specified on the command line.
6436 Patch by Michael Stone. Reported by Stephen Depooter as
6439 * tests/ls-2/tests (color-exe): New test, for the above fix.
6441 2003-01-13 Jim Meyering <jim@meyering.net>
6443 * tests/shred/exact: Also test for just fixed bug with --zero.
6445 * src/shred.c (long_opts): --zero does not require an argument.
6446 Patch by Michael Stone. Reported by Roland Turner as Debian bug 172019.
6448 2003-01-12 Jim Meyering <jim@meyering.net>
6450 * Makefile.maint (cvs-update): Skip any file with local modifications.
6452 * src/unexpand.c (usage): Document --first-only and mention that
6453 --tabs=N (-t) enables --all (-a). Reported by wiregauze@yahoo.com.
6455 2002-12-01 Dmitry V. Levin <ldv@altlinux.org>
6457 * src/df.c: Include "canonicalize.h".
6458 Use canonicalize_file_name unconditionally.
6460 2003-01-09 Jim Meyering <jim@meyering.net>
6462 * README: Add readlink.
6464 2002-11-30 Dmitry V. Levin <ldv@altlinux.org>
6466 * src/df.c: Include "xgetcwd.h".
6467 * src/pwd.c: Likewise.
6469 2002-11-30 Dmitry V. Levin <ldv@altlinux.org>
6471 * src/shred.c: Remove declaration of xstrdup.
6472 We already get it via xalloc.h which is included via system.h.
6474 2002-08-27 Dmitry V. Levin <ldv@altlinux.org>
6476 New program: readlink.
6478 * src/Makefile.am (bin_PROGRAMS): Add readlink.
6479 * src/readlink.c: New file.
6481 * man/readlink.x: New file.
6482 * man/Makefile.am (dist_man_MANS): Add readlink.1.
6483 (readlink.1): New rule.
6485 2003-01-09 Jim Meyering <jim@meyering.net>
6487 When selecting ranges of byte offsets (as opposed to ranges of fields)
6488 and when --output-delimiter=STRING is specified, output STRING between
6489 ranges of selected bytes.
6490 * src/cut.c (RANGE_START_SENTINEL): Define.
6491 (output_delimiter_specified): New global.
6492 (print_kth): Add parameter. Adjust all callers.
6493 (set_fields): Mark each range-start index with RANGE_START_SENTINEL.
6494 (cut_bytes): When requested, output STRING between ranges of
6496 (main): Make a diagnostic a little clearer.
6497 Based on a patch from Jan Nieuwenhuizen.
6499 * tests/cut/Test.pm: New tests for the above.
6501 * src/cut.c (set_fields): Make code agree with comment:
6502 Don't merge abutting ranges like 4- and 2-3. This makes no
6503 difference currently, but is required to support an upcoming change.
6505 2003-01-07 Jim Meyering <jim@meyering.net>
6507 * src/cut.c (set_fields): Fix typo in comment.
6509 * tests/touch/not-owner: New test, mostly extracted from fail-diag.
6510 * tests/touch/Makefile.am (TESTS): Add not-owner.
6511 * tests/touch/fail-diag: Remove the test for non-owner diagnostic.
6512 Now, this tests only the nonexistent-directory diagnostic.
6513 Suggestion from Michael Stone.
6515 * tests/touch/fail-diag: Fix typo: s/ld/ls/.
6517 2003-01-04 Jim Meyering <jim@meyering.net>
6519 * src/copy.h: Remove use of PARAMS.
6520 * src/remove.h: Likewise.
6521 * src/chown-core.h: Likewise.
6523 rm could be tricked into mistakenly reporting a cycle.
6524 * src/remove.c: [cycle_check_state]: New global.
6525 (remove_cwd_entries): Adapt to new semantics of cycle_check.
6526 (rm): Call cycle_check_init and cycle_check_free for each file.
6527 * tests/rm/cycle (rm): New test, for the above fix.
6528 * tests/rm/Makefile.am (TESTS): Add cycle.
6530 When rm detects a cycle, don't abort the entire command,
6531 but rather just the affected command line argument.
6532 * src/remove.c: Include <setjmp.h>
6533 (struct dirstack_state) [current_arg_jumpbuf]: New member.
6534 (remove_cwd_entries): Call longjmp if we detect a cycle.
6535 (rm): Call setjmp here.
6537 * src/remove.c (cycle_check, is_power_of_two): Remove functions.
6538 Instead, include cycle-check.h and use it.
6540 * src/remove.h (struct dev_ino): Remove declaration.
6542 * src/remove.c (remove_cwd_entries): Fix typos in comment.
6544 Don't include trailing /. in diagnostics about directories.
6545 * src/remove.c (full_filename_): When FILENAME is just `.'
6546 and there is a nonempty directory-name part, don't append `/.'.
6547 * tests/rm/unread2: Remove trailing /. from diagnostic.
6548 * tests/rm/rm2: Likewise.
6550 * src/remove.c (struct dirstack_state): Define.
6551 To be used in place of these file-scoped globals ...
6552 (dir_stack, len_stack, Active_dir): Remove globals.
6553 (ds_init, ds_free): New functions.
6554 (full_filename): Define.
6555 (full_filename_): Rename from full_filename.
6557 Begin to make AD_* functions more generic.
6558 * src/remove.c (AD_push_initial): Don't set status to RM_OK here.
6559 (AD_push): Likewise.
6560 (AD_INIT_OTHER_MEMBERS): Define.
6561 (remove_dir): Define the `status' member manually after each
6562 call to AD_push or AD_push_initial.
6564 * src/Makefile.am (check-misc): New rule, to ensure that no more
6565 S_IS* macro definitions sneak into the code.
6566 (check): Depend on check-misc.
6568 * src/remove.c [S_ISLNK]: Don't define. It's already defined in sys2.h.
6569 * src/du.c (count_entry) [S_ISLNK]: Don't define.
6570 * src/shred.c [S_ISLNK, S_ISFIFO, S_ISSOCK]: Don't define.
6572 2003-01-03 Jim Meyering <jim@meyering.net>
6574 * src/true.c: Add copyright.
6575 (AUTHORS): I suppose I've written it.
6577 * src/Makefile.am (false.c): Make the generated file be read-only.
6579 2003-01-04 Jim Meyering <jim@meyering.net>
6581 * src/ls.c: Include "dev-ino.h".
6582 [struct dev_ino]: Remove declaration.
6584 2003-01-02 Jim Meyering <jim@meyering.net>
6586 * src/cp.c (do_copy): Tweak diagnostic to be consistent with the one
6587 from mv: s/missing file arguments/missing file argument/.
6588 With --target-directory=DIR, cp and mv work with a single file argument.
6589 Reported by Karl Berry.
6591 * tests/rm/isatty: Enable this test.
6593 2002-12-31 Jim Meyering <jim@meyering.net>
6595 * src/remove.c (AD_push_initial): Don't set status to RM_OK here.
6596 (AD_push): Likewise.
6597 (AD_INIT_OTHER_MEMBERS): Define.
6598 (remove_dir): Define the `status' member manually after each
6599 call to AD_push or AD_push_initial.
6601 * src/ls.c [struct dev_ino]: Remove definition.
6602 Include "dev-ino.h" instead.
6604 2002-12-28 Jim Meyering <jim@meyering.net>
6606 * tests/du/Makefile.am (TESTS): Add no-deref.
6607 * tests/du/no-deref: New script.
6609 2002-12-23 Jim Meyering <jim@meyering.net>
6611 * src/remove.c (remove_cwd_entries): Fix typo in comment.
6613 2002-12-21 Jim Meyering <jim@meyering.net>
6615 * announce-gen: Generate MML-formatted announcement.
6616 This makes it a *lot* harder to send stale MD5/SHA1 signatures.
6618 2002-12-20 Jim Meyering <jim@meyering.net>
6620 * src/touch.c (touch): Change the wording of a diagnostic so
6621 that it makes sense both when the file exists and when it doesn't.
6622 Suggestion from Michael Stone.
6624 2002-12-18 Jim Meyering <jim@meyering.net>
6626 * src/stty.c (valid_options): Declare to be static.
6628 2002-12-15 Jim Meyering <jim@meyering.net>
6630 * Makefile.cfg: Remove rules related to generating m4/jm-glibc-io.m4.
6632 * src/chmod.c, src/copy.c, src/copy.h, src/cp-hash.h, src/csplit.c:
6633 * src/date.c, src/expr.c, src/fmt.c, src/id.c, src/install.c:
6634 * src/ls.c, src/od.c, src/pathchk.c, src/pr.c, src/remove.c:
6635 * src/shred.c, src/sort.c, src/stat.c, src/stty.c, src/sum.c:
6636 * src/tee.c, src/test.c: Remove all uses of `PARAMS'.
6638 * src/remove.c (PARAMS): Remove definition.
6639 * src/sys2.h: Likewise.
6641 * src/ls.c, src/stat.c, src/date.c: Remove declaration of nstrftime.
6642 Include strftime.h instead.
6644 2002-12-14 Jim Meyering <jim@meyering.net>
6646 * Makefile.cfg ($(url_dir_list)): Use .../coreutils, not .../fetish.
6648 * src/system.h [! HAVE_DECL_MEMRCHR]: Declare memrchr.
6649 This is necessary at least for Irix6.5 when using c89.
6650 Reported by Nelson Beebe.
6652 * tests/misc/Makefile.am (TESTS): Add cat-tty-eof.
6654 * tests/misc/cat-tty-eof: New test.
6656 * src/mknod.c (usage): Specify how major and minor mode numbers
6657 are interpreted. Report forwarded by Kristin E Thomas.
6658 * src/mknod.c: Remove now-redundant usage-specifying comment.
6660 2002-12-13 Jim Meyering <jim@meyering.net>
6664 * tests/du/trailing-slash: Allow for a directory of size `0'.
6665 That happens at least on file systems of type tmpfs on linux-2.4.18.
6667 * announce-gen: New script to begin replacing the commands
6668 associated with the rule here...
6669 * Makefile.maint (announcement): Invoke announce-gen.
6670 * Makefile.am (EXTRA_DIST): Add announce-gen.
6672 * tests/cp/preserve-2: New file/test, for latest fix.
6673 * tests/cp/Makefile.am (TESTS): Add preserve-2.
6675 2002-12-11 TAKAI Kousuke <takai@vlsi.kuee.kyoto-u.ac.jp>
6677 Fix a bug whereby cp would fail to parse an option like
6678 --preserve=mode,ownership.
6679 * src/cp.c (decode_preserve_arg): Advance `comma' to
6680 point the character following the comma.
6682 2002-12-11 Jim Meyering <jim@meyering.net>
6684 * src/pathchk.c (NEED_PATHCONF_WRAPPER): Undefine before defining,
6685 in case it's already defined.
6687 2002-12-09 Jim Meyering <jim@meyering.net>
6689 * tests/touch/fail-diag: Don't get a test failure if /no exists.
6690 Instead, evoke a framework failure if /no-$$ exists.
6691 Reported by Michael Stone.
6693 2002-12-08 Jim Meyering <jim@meyering.net>
6695 * src/du.c (lstat) [! LSTAT_FOLLOWS_SLASHED_SYMLINK]:
6696 Define to rpl_lstat, so that even on systems like Solaris 5.8,
6697 du honors (per POSIX) the trailing slash on an argument referring
6698 to a symlink-to-directory.
6700 2002-12-06 Jim Meyering <jim@meyering.net>
6702 * Use autoconf-2.57. Regenerate dependent files.
6703 * Use automake-1.7.2. Regenerate dependent files.
6705 * src/ls.c (gobble_file): Also stat the file if it's a
6706 regular file and --indicator-style=classify (aka -F).
6707 Thanks to Ed Santiago for opening my eyes.
6709 * tests/ls/file-type: New file. Test for the above.
6710 A test to contrast ls -F and ls --indicator-style=file-type.
6711 * tests/ls/Makefile.am (TESTS): Add file-type.
6713 2002-12-04 Jim Meyering <jim@meyering.net>
6715 * tests/ls/follow-slink: Make sure the symlink was created.
6716 Richard Dawe reported that `ln -s link link' succeeds, but creates
6717 no file on systems running some version of the DJGPP libc.
6719 2002-12-03 Jim Meyering <jim@meyering.net>
6721 * src/Makefile.am (AUTOMAKE_OPTIONS): Remove definition (to ansi2knr)
6722 since this package no longer panders to K&R compilers.
6724 2002-12-02 Jim Meyering <jim@meyering.net>
6726 * tests/du/slink: Skip this test if `.' is on a non-local file system.
6728 * tests/Fetish.pm (_at_replace): Do the substitution only if there's
6729 something to replace.
6731 2002-12-01 Jim Meyering <jim@meyering.net>
6733 * src/stat.c: Don't include <string.h> or <ctype.h>.
6734 That's already done via system.h.
6735 * src/dircolors.c: Don't include <ctype.h>.
6737 2002-11-30 Jim Meyering <jim@meyering.net>
6739 * ls.c (gobble_file): Remove the block of code that caused
6740 `ls --color -F symlink-to-dir' to list the files in
6741 `symlink-to-dir/.'. Now, it prints `symlink-to-dir@', (just
6742 like `ls -F symlink-to-dir') but with the addition of highlighting.
6743 Similarly, `ls --color -dF symlink-to-dir' would print
6744 `symlink-to-dir/'; now it prints `symlink-to-dir@'.
6745 Reported by Jeff Sheinberg as Debian bug #168203.
6746 * tests/ls-2/tests (sl-F-color, sl-dF-color): New tests for the above.
6748 ls is now more efficient: with certain options, it no longer needs
6749 to stat each directory entry on systems with valid dirent.d_type.
6750 * src/ls.c (print_dir): Add DT_LNK and DT_REG.
6751 (main): Make --recursive set format_needs_type, not format_needs_stat.
6752 (gobble_file): Remove a FIXME comment, now that it's fixed.
6754 2002-11-24 Jim Meyering <jim@meyering.net>
6756 * src/du.c (du_files): Don't strip any trailing slash.
6757 Rewrite so that `/' is no longer represented internally as
6759 (count_entry): When appending a file name component,
6760 account for the fact that the current path may end in `/'.
6761 François Pinard reported that `du symlink-to-dir/' was not
6762 equivalent to `du symlink-to-dir/.'. Now it is.
6763 * tests/du/trailing-slash: New file/test, for the above fix.
6764 * tests/du/Makefile.am (TESTS): Add trailing-slash.
6766 2002-11-23 Jim Meyering <jim@meyering.net>
6768 * src/tac.c (output): Declare some local variables to be of type size_t,
6769 rather than `int' to avoid warnings from gcc.
6771 2002-11-21 Paul Eggert <eggert@twinsun.com>
6773 * src/ls.c (decode_switches): Use case-sensitive matching to
6774 decode the QUOTING_STYLE environment variable. This is more
6775 consistent with the documentation, and with --quoting-style.
6777 2002-11-21 Martin Buck <martin.buck@ascom.ch
6779 * src/stty.c (struct speeds): Add support for all baud rates defined
6782 2002-11-19 Jim Meyering <jim@meyering.net>
6784 * tests/sum/sysv: Export LC_ALL=C, to avoid failure when
6785 run in a UTF locale. Report and suggested fix by Bruno Haible.
6786 * tests/fmt/basic: Likewise.
6788 2002-11-17 Jim Meyering <jim@meyering.net>
6790 * configure.ac: Update via autoupdate.
6791 Add `AM_GNU_GETTEXT_VERSION(0.11.5)'.
6793 * src/mv.c (movefile): Don't remove trailing slashes from SOURCE.
6794 Reported by Hans Ginzel.
6796 2002-11-15 Jim Meyering <jim@meyering.net>
6798 * Makefile.cfg (gnu_rel_host): Define.
6799 (url_dir_list): Choose from (alpha|ftp).gnu.org depending
6800 on whether $(VERSION) looks like a major release number.
6802 * Makefile.maint (mail_gpg_sign_cookie): Backslash-escape `#'.
6803 (release): Rename from `alpha'.
6804 (alpha): Depend on release.
6806 * Makefile.maint (signatures): Define with ?=, so it's easy to override.
6808 2002-11-14 Jim Meyering <jim@meyering.net>
6810 * Makefile.maint (mail_gpg_sign_cookie): Make optional.
6811 (announcement): Use the new variable.
6813 * Makefile.maint: Sync with Bison, i.e.:
6814 (po-check): Scan .l and .y files instead of the
6815 .c and the .h files that they generate. This fixes the bug
6816 reported by Tim Van Holder in:
6817 <http://mail.gnu.org/pipermail/bison-patches/2002-November/001352.html>
6818 Look for N_ as well as for _. Try to avoid matching #define for
6822 2002-11-12 Jim Meyering <jim@meyering.net>
6824 * src/ls.c (HAVE_SYMLINKS): Remove unnecessary macro definition.
6825 Replace sole use with equivalent `#ifdef S_ISLNK'.
6826 Inconsistency reported by Dmitry V. Levin.
6828 2002-11-11 Jim Meyering <jim@meyering.net>
6830 * src/stat.c (usage): Transform --help items output via s/ - / /,
6831 so that help2man produces properly formatted man pages.
6832 Reported by Herbert Xu as Debian bug #168400.
6834 2002-11-10 Jim Meyering <jim@meyering.net>
6836 * src/ls.c (sighandler): Handle SIGTSTP specially.
6837 Based on suggestions from Solar Designer and Dmitry V. Levin.
6840 * Makefile.cfg (cvs_files): Define. From autoconf.
6841 (local_updates): Likewise.
6843 * src/ls.c (restore_default_color_handler, sigtstp_handler):
6845 (sighandler): New function, based on the one in sort.c.
6846 (main): Use sigaction, if possible; otherwise signal.
6847 Handle these signals:
6848 SIGHUP, SIGINT, SIGPIPE, SIGQUIT, SIGTERM, SIGTSTP.
6849 Don't register our handler if the signal is already being ignored.
6851 * src/dd.c (interrupt_handler): Use raise, rather than kill+getpid.
6852 * src/csplit.c (interrupt_handler): Likewise.
6853 * src/sort.c (sighandler): Likewise.
6854 (main): Declare `i' and `nsigs' to be unsigned, not int.
6856 2002-11-09 Jim Meyering <jim@meyering.net>
6858 ls --color: restore terminal text color upon signal.
6859 * src/ls.c: Include "full-write.h" and <signal.h>.
6860 (restore_default_color, restore_default_color_handler): New functions.
6861 (sigtstp_handler, put_indicator_direct): New functions.
6862 (main) [print_with_color]: Register signal handlers.
6863 Patch mostly by Solar Designer and Stanislav Ievlev.
6865 Update from autoconf.
6866 * Makefile.maint (AMTAR): Remove definition.
6867 (update, cvs-update, po-update, do-po-update): New rules.
6868 (wget-update): Update (thus renaming to cvs-update).
6869 (automake_repo): Use anoncvs@sources.redhat.com.
6871 2002-11-06 Jim Meyering <jim@meyering.net>
6873 * tests/misc/Makefile.am (TESTS): Add printf-hex.
6875 * tests/misc/printf: Be careful to test the code in this package,
6876 not the shell built-in function.
6878 * src/printf.c (print_esc): A hexadecimal escape sequence has
6879 at most two hex. digits, not three. Reported by Padraig Brady.
6880 (usage): Update description.
6881 * tests/misc/printf-hex: New file/test, for the above fix.
6883 2002-10-07 Paul Eggert <eggert@twinsun.com>
6885 Add support for locale-specific size indications (e.g.,
6886 thousands-separators) and for explicit size suffixes on output.
6888 * doc/coreutils.texi (Block size): Say that:
6889 This affects display format as well as block size.
6890 Fractional block counts are rounded up.
6891 ls file size blocksize defaults to 1.
6892 A block size spec preceded by ' generates thousands separators.
6893 A suffix without a preceding integer generates suffixes.
6894 (tail invocation): 32k -> 32 KiB.
6895 (What information is listed): ls -h is now equivalent to
6896 ls --block-size=human, and ls -H is now equivalent to
6897 ls --block-size=si. Displayed file size is now always affected by
6900 * lib/inttostr.c, lib/inttostr.h, lib/imaxtostr.c, lib/offtostr.c,
6901 lib/umaxtostr.c: New files, taken from GNU tar.
6903 * lib/Makefile.am (libfetish_a_SOURCES): Add imaxtostr.c, offtostr.c,
6905 (EXTRA_DIST): Add inttostr.c.
6907 * lib/human.c, lib/human.h: Rewrite to support locale-specific
6908 notations like thousands separators.
6909 Specify what includer of include.h must include beforehand.
6910 (human_group_digits, human_suppress_point_zero, human_autoscale,
6911 human_base_1024, human_SI, human_B): New enum values.
6912 (human_readable): Rename from human_readable_inexact; put the
6913 options before the sizes. All uses changed. The old human_readable
6914 function has been removed; use inttostr.h instead.
6915 (human_options): Renamed from human_block_size, with new signature
6916 that allows block sizes up to UINTMAX_MAX. All callers changed.
6918 * m4/prereq.m4 (jm_PREREQ_HUMAN): Check for locale.h, localeconv,
6919 AC_HEADER_STDBOOL. No need to check for limits.h since it's in
6920 freestanding C89. No need to check for stdlib.h or string.h since
6921 autoconf does this now.
6923 * src/cksum.c (cksum): Use primitives from inttostr.h, not
6924 human.h, to print large numbers simply.
6925 * src/csplit.c (handle_line_error, parse_patterns): Likewise.
6926 * src/dd.c (print_stats, main): Likewise.
6927 * src/df.c (print_header): Likewise.
6928 * src/factor.c (print_factors): Likewise.
6929 * src/ls.c (print_long_format, print_file_name_and_frills): Likewise.
6930 * src/shred.c (dopass): Likewise.
6931 * src/sort.c (checkfp): Likewise.
6932 * src/sum.c (bsd_sum_file, sysv_sym_file): Likewise.
6933 * src/tail.c (xlseek): Likewise.
6934 * src/wc.c (write_counts, wc): Likewise.
6936 * src/df.c (human_output_opts): New var.
6937 (output_block_size): Now uintmax_t, not int, to handle larger
6938 block sizes. All uses changed.
6939 * src/du.c: Likewise.
6940 * src/ls.c: Likewise.
6942 * src/df.c (print_header): In the header line, prefer SI to human
6943 representation if it's shorter; if neither is shorter, try to
6944 intuit what the user would prefer.
6946 * src/expr.c (inttostr): Remove; use new imaxtostr library
6949 * src/ls.c (file_output_block_size): New var, to distinguish
6950 file sizes from other sizes.
6951 (decode_switches): Set it.
6953 * src/shred.c (OUTPUT_BLOCK_SIZE): remove.
6954 (dopass): When printing progress, use floor for what has been done
6955 so far (since we should be conservative there), and ceiling for
6956 what needs to be done (since that's what other programs use).
6958 2002-10-19 Jim Meyering <jim@meyering.net>
6960 * src/pinky.c (print_heading): Align TTY and Name headings.
6961 Reported by Karl Eichwalder.
6963 2002-10-18 Jim Meyering <jim@meyering.net>
6965 * src/split.c (cwrite): Change type of `bytes' parameter to size_t
6966 Remove now-useless cast.
6967 (stdread): Remove function.
6968 (bytes_split): Use size_t instead of int.
6969 Use safe_read, not stdread.
6970 (lines_split): Likewise.
6971 Use memchr rather than a `while' loop.
6972 (line_bytes_split): Use size_t instead of int.
6973 Use safe_read, not stdread.
6974 (main): Add some FIXME comments to remind me to remove casts.
6976 * src/system.h (ST_BLKSIZE): Correct comment describing how to
6977 reproduce HPUX-11 cat failure. From Petter Reinholdtsen.
6979 2002-10-17 Jim Meyering <jim@meyering.net>
6981 Fix a problem that could make e.g., `cat' misbehave on systems which
6982 give invalid (unreasonably large) values for stat.st_blksize.
6983 * src/system.h (ST_BLKSIZE): Ensure that the result is in [1..4MB].
6984 Reported by Petter Reinholdtsen.
6986 2002-10-14 Jim Meyering <jim@meyering.net>
6988 Specifying a printf conversion specifer as nl's separator string
6989 could cause nl to segfault.
6990 * src/nl.c (build_print_fmt): Don't include separator string
6991 in the printf format; it might contain `%'.
6992 Use a better bound on the length of the print_fmt buffer.
6993 (print_lineno): Print the separator here instead.
6994 Reported by Doug Coleman.
6996 * tests/misc/nl: New file/tests, including a test for the above.
6997 * tests/misc/Makefile.am (TESTS): Add nl.
6999 * tests/misc/split-l: New test, to make sure `split --lines=N' works.
7000 * tests/misc/Makefile.am (TESTS): Add split-l.
7002 2002-10-13 Jim Meyering <jim@meyering.net>
7006 * src/du.c (usage): Tweak description of --dereference-args/-D.
7008 * src/du.c (count_entry): Also save cwd when dereferencing (via
7009 --dereference-args, -D) a command-line argument.
7010 Reported by Michal Svec. Based on a patch by Andreas Schwab.
7012 * src/Makefile.am (../AUTHORS): New target/rule.
7014 2002-10-12 Jim Meyering <jim@meyering.net>
7016 * src/paste.c (paste_parallel): Declare local, `delims_saved', to be
7017 of type size_t, since that's the way it's used and avoids a warning.
7019 * src/csplit.c (struct cstring) [len]: Declare to be unsigned int,
7020 since that's how it's always used and avoids a new warning from gcc.
7021 (read_input): Adapt to new safe_read ABI.
7023 * src/cut.c (cut_fields): Add a temporary size_t variable, n_bytes,
7026 * src/pinky.c (print_long_entry): fread returns size_t.
7027 Declare local `bytes' accordingly, to avoid warning.
7029 tail -c +N would perform an extra read after encountering EOF
7030 [this change is analogous (bytes vs. lines) to the one of 2002-01-27]
7031 * src/tail.c (start_bytes): Detect EOF, inform caller.
7032 (tail_bytes): Upon EOF in start_bytes, return immediately.
7033 (file_lines): Reorganize to use memrchr rather than an explicit loop.
7034 Adapt to new safe_read ABI.
7036 2002-10-11 Jim Meyering <jim@meyering.net>
7038 * tests/du/deref: New file/test, for the above fix.
7039 * tests/du/Makefile.am (TESTS): Add deref.
7041 2002-10-10 Jim Meyering <jim@meyering.net>
7043 * tests/ln/Makefile.am (TESTS): Add target-1.
7044 * tests/ln/target-1: New file/test, for the fix on 2002-10-08.
7046 2002-10-09 Jim Meyering <jim@meyering.net>
7048 * tests/cp/backup-is-src: Ensure that certain environment variables
7049 are not set (e.g., SIMPLE_BACKUP_SUFFIX). Reported by Duncan Roe.
7051 * tests/tail-2/big-4gb: Mark this as an expensive test; it would
7052 consume 4GB of disk space on systems without support for sparse files.
7053 Fix a logic error that'd make it `cat err' even though dd didn't fail.
7055 * src/dircolors.hin (.jar): Fix typo: s/;3$/;31/.
7056 Patch by steven@magelico.net, forwarded by Michael Stone.
7058 * tests/ls/dired: Ensure that ls produces English messages.
7059 Patch by Alexey Vyskubov, forwarded by Michael Stone.
7061 2002-10-08 Dmitry V. Levin <ldv@altlinux.org>
7063 * src/ln.c (main): Fix target_directory parsing when n_files == 1.
7065 2002-10-08 Jim Meyering <jim@meyering.net>
7067 * tests/tail-2/big-4gb: Use double quotes around diagnostic.
7068 Fix syntax in test: use =, not ==.
7069 Reported by Bob Proulx.
7070 Change all the rest like this: grep -lR "testing framework'" .\
7071 |xargs perl -pi -e 's/'\''(\$0: failure in testing framework)'\''/"$1"/'
7073 * src/sum.c (sysv_sum_file): Adapt to new safe_read ABI.
7074 * src/tr.c (squeeze_filter, read_and_delete, read_and_xlate): Likewise.
7075 * src/tac.c (save_stdin, tac_stdin_to_mem): Likewise.
7076 * src/wc.c (wc): Likewise.
7078 2002-10-07 Paul Eggert <eggert@twinsun.com>
7081 Don't advance the write pointer past the end of the write buffer.
7082 * src/sort.c (begfield, limfield): Likewise.
7084 2002-10-07 Jim Meyering <jim@meyering.net>
7086 * src/cat.c (simple_cat, cat): Adapt to new safe_read ABI.
7087 * src/head.c (head_bytes, head_lines): Likewise.
7089 2002-10-06 Jim Meyering <jim@meyering.net>
7091 * src/dd.c (scanargs): Ensure that specified block sizes (specified
7092 via ibs=N, obs=N, and bs=N) are no larger than SSIZE_MAX.
7093 (skip, dd_copy): Adapt to new safe_read ABI.
7095 * Makefile.maint (signatures): Define.
7097 (announcement): Depend on $(signatures).
7099 * Makefile.maint (announcement): Output all URLs for detached
7100 signatures, not just the last one from the previous loop.
7102 2002-10-05 Jim Meyering <jim@meyering.net>
7106 * src/remove.c (remove_entry) [ROOT_CAN_UNLINK_DIRS]: With `rm -i DIR',
7107 don't recurse into directory, DIR. Prompted by a report from
7110 * tests/rm/i-no-r: New file/test, for the above fix.
7111 * tests/rm/Makefile.am (TESTS): Add i-no-r.
7113 * tests/tail-2/big-4gb: New file/test, for the fix of 2002-09-27.
7114 * tests/tail-2/Makefile.am (TESTS): Add big-4gb.
7116 2002-10-03 Jim Meyering <jim@meyering.net>
7118 * src/rm.c (AUTHORS): Mark translatable string with `N_ (...)'.
7119 * src/df.c (AUTHORS): Likewise.
7120 * src/du.c (AUTHORS): Likewise.
7121 * src/tail.c (AUTHORS): Likewise.
7122 * src/touch.c (AUTHORS): Likewise.
7124 2002-10-02 Jim Meyering <jim@meyering.net>
7126 * Makefile.am (SUBDIRS): Remove `old'.
7127 (EXTRA_DIST): List the files in old/.
7128 * configure.ac (AC_CONFIG_FILES): Remove old/* names.
7129 Suggestion from Akim Demaille.
7131 2002-10-01 Jim Meyering <jim@meyering.net>
7133 * src/sys2.h (SSIZE_MAX): Define.
7135 2002-09-30 Jim Meyering <jim@meyering.net>
7137 * src/csplit.c: Don't include stdlib.h here. It's already included
7140 2002-09-29 Jim Meyering <jim@meyering.net>
7142 * src/tr.c (find_bracketed_repeat): Rearrange pointer/integer
7143 expression to avoid bogus warning from gcc.
7145 * src/cat.c (simple_cat): Use a temporary to avoid bogus warnings.
7146 (cat): Declare insize and outsize to be of type size_t, not int.
7147 Rearrange pointer/integer expressions to avoid bogus warnings.
7148 (main): Declare insize and outsize to be of type size_t, not int.
7150 * src/tail.c (parse_options): Give a sensible diagnostic for
7151 an invalid byte or line count. Reported by Mikko Tuumanen.
7153 * src/touch.c (main): Split a long line.
7155 * tests/du/Makefile.am (TESTS): Add slink.
7156 * tests/du/slink: New test for system.h change of 2002-08-31.
7158 In move mode, always first try to rename. Before, upon failure to
7159 rename a directory, this code would never attempt to rename any
7160 other file in that directory, but would thenceforth always copy.
7161 On some systems (e.g., NetApp's OnTap-6.4), renaming a directory
7162 may fail with EXDEV, yet renaming files within that directory to
7163 a newly-created destination directory succeeds.
7164 * src/copy.c (copy_internal): Remove local, move_mode;
7165 use x->move_mode instead. Based on a patch from Tom Haynes.
7167 2002-09-28 Jim Meyering <jim@meyering.net>
7169 * src/split.c (FAIL_ONLY_ONE_WAY): New macro.
7170 Factor out some duplication.
7172 [case 'a']: Use strtoul rather than strtol to avoid compiler warnings.
7174 * src/sort.c (begfield, limfield): Rearrange comparisons to avoid
7176 (fillbuf, keycompare): Cast literal `-1' to size_t in comparisons,
7177 to avoid compiler warnings.
7179 * src/shred.c (dopass): Use a uintmax_t temporary to avoid bogus
7182 Fix things so `mkdir -p' can create very deep directories, e.g.,
7183 mkdir -p $(perl -e 'print "a/" x 40000') now works.
7184 * src/mkdir.c (main): For --parents (-p), call make_path with the
7185 entire directory name, so we don't ever require that file operations
7186 like stat or chmod be performed on the entire command line argument.
7187 * makepath.c (make_path): Restore umask *before* creating the final
7190 2002-09-27 Andreas Schwab <schwab@suse.de>
7192 * src/tail.c (tail_bytes): Change type of bytes_remaining to off_t
7193 to avoid overflow. Reported by Hans Lermen.
7195 2002-09-26 Jim Meyering <jim@meyering.net>
7197 * src/install.c (get_ids): Use strtoul, not strtol. Remove some casts.
7199 2002-09-25 Jim Meyering <jim@meyering.net>
7201 * src/test.c (eaccess): Change type of local `euid' from int to uid_t
7202 and add a cast, to avoid a warning about `signed and unsigned type in
7203 conditional expression'.
7205 2002-09-22 Jim Meyering <jim@meyering.net>
7207 * src/rmdir.c: Include "dirname.h", for declaration of
7208 strip_trailing_slashes.
7210 * src/stat.c (PRIdMAX, PRIuMAX): Remove definitions.
7211 Now they're defined through system.h.
7213 * src/cp-hash.c, src/dd.c, src/df.c, src/du.c, src/ls.c,
7214 * src/stat.c, src/wc.c: Remove all inclusions of inttypes.h,
7215 since it's already included from sys2.h via system.h.
7217 * Use automake-1.6f. Regenerate dependent files.
7219 * src/Makefile.am (PERL): Remove duplicate definition.
7221 fmt's -s, -t, -c options didn't work properly for long lines.
7222 Since get_line may end up calling put_paragraph (for long lines),
7223 be sure to set global, `other_indent', before it is used there.
7225 * src/fmt.c (set_other_indent): New function, factored out of...
7226 (get_paragraph): ... here. Call it.
7227 (get_line): Call set_other_indent before calling flush_paragraph,
7228 which calls fmt_paragraph, which in turn calls put_paragraph,
7229 which uses other_indent.
7231 * tests/fmt/Makefile.am (TESTS): Add long-line.
7232 * tests/fmt/long-line: New file/test, for the above fix.
7234 2002-09-21 Jim Meyering <jim@meyering.net>
7236 * src/od.c: No longer include deprecated <values.h>.
7237 It was required solely for now-removed reference to BITSPERBYTE.
7238 * src/install.c: Likewise.
7239 Suggestion from Bruno Haible.
7241 2002-09-06 Andreas Schwab <schwab@suse.de>
7243 `rmdir -p dir-specified-with-trailing-slash/' would fail.
7244 * src/rmdir.c (remove_parents): Strip trailing slashes.
7246 2002-09-20 Jim Meyering <jim@meyering.net>
7248 * tests/rmdir/t-slash: New file/test, for the above fix.
7249 * tests/rmdir/Makefile.am (TESTS): Add t-slash.
7251 * Makefile.maint (announcement): Arrange to gpg-sign the message.
7252 Add a URL for each detached signature file.
7254 2002-09-07 Bruno Haible <bruno@clisp.org>
7256 * configure.ac: Add need-ngettext to AM_GNU_GETTEXT invocation.
7258 2002-09-18 Jim Meyering <jim@meyering.net>
7260 `od -t x8' used the wrong (`l'-prefixed) printf format.
7261 Likewise for the o8 and u8 formats.
7262 * src/od.c (ISPEC_TO_FORMAT): Define macro.
7263 (decode_one_format): Use PRIdMAX, PRIoMAX, etc. for LONG_LONG.
7264 Reported by Arun Sharma.
7266 2002-09-17 Jim Meyering <jim@meyering.net>
7268 * src/sys2.h (PRIdMAX, PRIoMAX, PRIuMAX, PRIxMAX): Define if necessary.
7269 From gettext's intl/loadmsgcat.c.
7271 * tests/od/x8: New file/test, for the above fix.
7272 * tests/od/Makefile.am (TESTS): Add x8.
7274 2002-09-15 Jim Meyering <jim@meyering.net>
7276 * Use autoconf-2.54. Regenerate dependent files.
7278 * src/csplit.c (get_format_width): Add cast to avoid
7279 warning about `signed and unsigned type in conditional expression'.
7281 2002-09-14 Jim Meyering <jim@meyering.net>
7283 * src/who.c (print_user): Change type of local to size_t
7284 to avoid warnings about `comparison between signed and unsigned'.
7285 * src/ptx.c (generate_all_output): Likewise.
7287 * src/dd.c (main, skip): Add casts to avoid warnings about
7288 `comparison between signed and unsigned'.
7290 * src/id.c (print_full_info, print_group_list): Add casts to avoid
7291 warnings about `signed and unsigned type in conditional expression'.
7293 * src/md5sum.c: Change type of global, digest_hex_bytes, to size_t
7294 to avoid warnings about `comparison between signed and unsigned'.
7295 (split_3): Change parameter names to be readable and add comment.
7296 Clean up the test for whether a line may be ignored.
7298 2002-09-13 Jim Meyering <jim@meyering.net>
7300 * src/printf.c (main): Handle leading command line argument of `--'.
7301 Reported by Raul: DervishD <raul@pleyades.net>
7302 * tests/misc/printf: New file: test for the above.
7303 * tests/misc/Makefile.am (TESTS): Add printf.
7305 * src/date.c (usage): Explain that %S's range of [0..60] is required --
7306 rather than 0..59 -- to accommodate the occasional positive leap second.
7307 Reported by Richard Neill.
7309 2002-09-12 Jim Meyering <jim@meyering.net>
7311 * src/Makefile.am (nanosec_libs): Define.
7312 (sleep_LDADD, tail_LDADD): Use it here.
7314 Factor nanosleep-related code into ../lib/xnanosleep.c.
7315 * src/sleep.c: Include xnanosleep.h.
7316 Factor out fenv.h-related code.
7317 (timespec_subtract): Remove function.
7318 (main): Remove code that deals with computing start and stop times
7319 as well as the loop around nanosleep. Now that's in xnanosleep.c.
7321 Allow S (in --sleep-interval=S) to be a floating point value.
7322 * src/tail.c: Include xnanosleep.h and xstrtod.h.
7323 Move declaration of global variable, sleep_interval, to ...
7325 (usage): Update description of --sleep-interval option.
7326 (tail_forever): New parameter, sleep_interval. Update caller.
7327 Use xnanosleep, rather than sleep.
7328 (parse_options): New parameter, sleep_interval. Update caller.
7329 Use xstrtod, now that we accept floating point values.
7330 Prompted by a patch from Augey Mikus.
7332 2002-09-06 Jim Meyering <jim@meyering.net>
7334 * src/remove.c (prompt): Change comment to give a better note to
7335 translators. From Michael Piefel.
7337 2002-09-02 Jim Meyering <jim@meyering.net>
7339 * README: A good problem report/patch includes diffs against
7340 the most recent test release.
7342 * src/pathchk.c (NEED_PATHCONF_WRAPPER): Define.
7343 (pathconf_wrapper): Define only if NEED_PATHCONF_WRAPPER is set.
7345 * src/kill.c (print_table_row): Use an unsigned type for widths
7346 to avoid warning about comparison between signed and unsigned.
7347 (list_signals): Likewise.
7349 * src/od.c (skip): Add a cast to avoid warning about comparison
7350 between signed and unsigned.
7351 * src/install.c (get_ids): Likewise. Also rearrange range-checking
7352 comparisons to make them more readable.
7354 2002-09-01 Jim Meyering <jim@meyering.net>
7358 2002-08-31 Jim Meyering <jim@meyering.net>
7360 Symlinks were always reported as using 0 blocks.
7361 * src/system.h (ST_NBLOCKS): Don't depend on file type.
7362 This reverts the change of 2000-01-30.
7363 Based on a report and patch from Neil Brown via Michael Stone.
7364 This fixes Debian Bug#156358.
7366 * Most files: Change `exit (0)' to `exit (EXIT_SUCCESS)',
7367 `exit (1)' to `exit (EXIT_FAILURE)', and
7368 `usage (1)' to `usage (EXIT_FAILURE)'.
7370 * chgrp.c, chmod.c, chown.c, chroot.c, cp.c, date.c, dd.c, du.c,
7371 * hostname.c, id.c, install.c, ln.c, mkdir.c, mkfifo.c, mknod.c,
7372 * nice.c, pinky.c, printf.c, pwd.c, shred.c, sleep.c, stty.c,
7373 * su.c, tac-pipe.c, tail.c, tee.c, touch.c, uname.c, uptime.c,
7374 * users.c, who.c: Change `error (1, ...' to `error (EXIT_FAILURE, ...'.
7375 But don't change `error (0, ...' to `error (EXIT_SUCCESS, ...', since
7376 error never exits successfully.
7378 2002-08-29 Jim Meyering <jim@meyering.net>
7380 * src/remove.c (remove_cwd_entries): Use closedir (not CLOSEDIR)
7381 when ignoring any return value.
7383 * src/remove.c (remove_cwd_entries): Detect and diagnose readdir
7384 failures. On some systems (at least EMC Celerra and Solaris5.8),
7385 this appears to be necessary.
7386 (is_empty_dir): Likewise. Also, always close directory handle.
7387 * src/ls.c (print_dir): Likewise.
7388 (print_dir): Rename local variable: reading -> dirp.
7389 Reported by Mike Coleman.
7391 2002-08-28 Jim Meyering <jim@meyering.net>
7393 * src/remove.c (remove_cwd_entries): Use CLOSEDIR, not closedir.
7394 Give a diagnostic and fail if closedir fails.
7396 2002-08-26 Jim Meyering <jim@meyering.net>
7398 * Makefile.am (THANKS-to-translators): New rule.
7399 (EXTRA_DIST): Add both THANKS-to-translators and THANKStt.in.
7400 * THANKStt.in: New file.
7402 * src/cat.c (close_stdout_wrapper): New, kludgey, function and
7404 (main): Register it with atexit.
7405 Close STDOUT_FILENO, to avoid a problem when writing to
7406 /dev/audio on at least Solaris 5.7 and 5.8 systems.
7407 Reported by Shing-Shong Shei.
7409 2002-08-25 Jim Meyering <jim@meyering.net>
7411 * src/cat.c (main): Close STDIN_FILENO rather than a literal `0'.
7412 * src/tac.c (main): Likewise.
7413 * src/tail.c (main): Likewise.
7414 * src/tee.c (main): Likewise.
7415 * src/tr.c (main): Likewise.
7416 * src/wc.c (main): Likewise.
7418 2002-08-20 Jim Meyering <jim@meyering.net>
7420 * tests/mv/setup: Rewrite not to use `: ${VAR=not_set}' paradigm.
7422 2002-08-10 Paul Eggert <eggert@twinsun.com>
7424 * src/nohup.sh: Don't use "exec --"; it's not portable and
7425 shouldn't be needed.
7427 2002-08-09 Jim Meyering <jim@meyering.net>
7429 * src/pr.c (main): Don't ignore -COLUMN if it's the last option.
7430 (usage): Clarify help text for the -COLUMN option.
7431 Patch by Padraig Brady.
7432 * tests/pr/Test.pm [col-last]: New test for the above.
7434 * configure.ac: Start with version 4.5.1, chosen so that it's larger
7435 than the latest version numbers of the component packages.
7437 * man/Makefile.am (check-x-vs-1): Set and export PATH so we use
7440 2002-08-08 Jim Meyering <jim@meyering.net>
7442 * src/date.c: Guard inclusion of <langinfo.h> with
7443 `#if HAVE_LANGINFO_CODESET', not `#if HAVE_LANGINFO_H'.
7444 * src/sort.c: Likewise.
7445 Patch by GOTO Masanori.
7447 2002-08-05 Paul Eggert <eggert@twinsun.com>
7449 Fix some minor time-related bugs with POSIX time arguments.
7450 Some valid time stamps were being rejected (notably -1, and
7451 time stamps before 1900 on 64-bit hosts). And some invalid
7452 time stamps were being accepted, e.g. September 31.
7454 * src/date.c (main): Adjust to posixtime signature change.
7455 * src/touch.c (main): Likewise. Remove unnecessary initialization.
7456 Use localtime, not posixtm, to warn about obsolete "touch".
7458 2002-08-05 Jim Meyering <jim@meyering.net>
7460 * tests/misc/Makefile.am (TESTS): Add nice and pathchk1.
7462 2002-08-04 Jim Meyering <jim@meyering.net>
7464 * src/Makefile.am (check-README): New target/rule.
7465 (check): Depend on it.
7467 * configure.ac (AC_CONFIG_FILES): Add old/Makefile and old/*/Makefile.
7469 2002-08-03 Jim Meyering <jim@meyering.net>
7471 * Makefile.am (SUBDIRS): Add old.
7472 * old/: New directory, containing legacy ChangeLog* and NEWS files
7473 from the fileutils, sh-utils, and textutils packages.
7475 * src/Makefile.am (AM_INSTALLCHECK_STD_OPTIONS_EXEMPT): Set to false.
7477 2002-08-02 Paul Eggert <eggert@twinsun.com>
7479 * NEWS, doc/coreutils.texi: uniq now obeys LC_COLLATE.
7481 * src/uniq.c: Include hard-locale.h, xmemcoll.h.
7482 (hard_LC_COLLATE): New var.
7483 (different): Args are now char *, not const char *.
7484 Use xmemcoll instead of memcmp to compare lines, so that
7485 LC_COLLATE has effect. However, use memcmp if it is an
7487 (check_file): Do not include newline in comparison, so that
7488 xmemcoll has a byte to stomp on temporarily.
7489 (main): Set hard_LC_COLLATE.
7491 2002-07-29 Jim Meyering <jim@meyering.net>
7493 * Makefile.am (SUBDIRS): Remove djgpp, for now.
7495 2002-07-20 Jim Meyering <jim@meyering.net>
7497 * Makefile.am (false.c): Convert only the final EXIT_SUCCESS
7498 into EXIT_FAILURE. Otherwise, false --help and false --version
7501 2002-07-08 Jim Meyering <jim@meyering.net>
7503 * src/Makefile.am (uninstall-local): Search for @GNU_PACKAGE@,
7504 rather than the hard-coded `sh-utils'.
7506 2002-07-01 Jim Meyering <jim@meyering.net>
7508 * configure.ac: Merge the three files from fileutils,
7509 textutils, and sh-utils.
7510 * Makefile.am: Likewise.
7511 * src/Makefile.am: Likewise.