summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2007-03-25* src/c99-to-c89.diff: Regenerate.Jim Meyering
2007-03-25Avoid the need for euidaccess and/or lstat on every directory entryPaul Eggert
with 'rm -r dir' (without -f), if we are root, or if we are removing a directory tree that is full of symbolic links. * bootstrap.conf (gnulib_modules): Add write-any-file. * src/copy.c: Include write-any-file.h. (UNWRITABLE): Remove macro, replacing with.... (writable_destination): New function, which uses can_write_any_file to avoid the need for euidaccess when we are privileged. (overwrite_prompt, abandon_move): Use it. * src/remove.c: Include write-any-file.h. (D_TYPE): New macro. (DT_UNKNOWN, DT_DIR, DT_LNK) [!HAVE_STRUCT_DIRENT_D_TYPE]: New macros. (write_protected_non_symlink): Don't bother to stat if we can write any file. (prompt): New arg PDIRENT_TYPE. All callers changed. Use readdir dirent type to avoid the need for 'lstat' on each directory entry in cases like 'rm -r dir', if we are root, or if the tree is full of symbolic links. (DT_IS_KNOWN, DT_MUST_BE): Remove. (remove_entry): New arg DIRENT_TYPE_ARG. All callers changed.
2007-03-23* src/pathchk.c: Don't include euidaccess.h, as we don't callJim Meyering
euidaccess.
2007-03-20* src/Makefile.am (dir_LDADD, ls_LDADD, vdir_LDADD):Paul Eggert
Add $(LIB_ACL_TRIVIAL).
2007-03-18Fix a bug in how pr -m -s works.Jim Meyering
* NEWS: Describe how the fix affects pr. * src/pr.c (init_parameters): The --merge (-m) option does not imply --expand-tabs (-e), so don't set "untabify_input". Reported by Wis Macomson. * tests/misc/pr: New file. Test for the above fix. * tests/misc/Makefile.am (TESTS): Add pr. * THANKS: Update.
2007-03-17Avoid an obscure build failure, prefer waitpid over wait.Jim Meyering
* src/install.c (strip): Use waitpid, not wait. It's equivalent, but feels less obsolescent.
2007-03-16* src/copy.c: Include filemode.h.Paul Eggert
(overwrite_prompt): Say "try to overwrite", not "overwrite", to make it clearer that the attempt may fail. Problem reported by Dan Jacobson in: http://lists.gnu.org/archive/html/bug-coreutils/2007-03/msg00130.html Output symbolic mode as well as numeric. * tests/mv/i-2 (fail): Adjust to new prompt format.
2007-03-10remove trailing blanksJim Meyering
2007-03-09src/fs.h: git-rm a generated but already-ignored fileJim Meyering
2007-03-08* src/c99-to-c89.diff: Reflect the new c99'ism, update offsets.Jim Meyering
2007-03-08rm without -f: give a better diagnostic when euidaccess fails.Jim Meyering
* src/remove.c (write_protected_non_symlink): Return int, not bool, so that we can indicate failure too (as a postive error number). (prompt): If write_protected_non_symlink fails, report that error number and fail rather than charging ahead and removing the dubious entry. Redo the logic of printing a diagnostic so that we need to invoke quote (full_filename (...)) only once. More details at: <http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/9952/focus=9996>
2007-03-03Fix a bug: cp -x would fail to set mount point permissions.Andrew Church
* NEWS: mention cp -x bug fix * src/copy.c (copy_internal): Don't return immediately after copying a mount point that we do not intend to recurse under. Based on a patch by Andrew Church.
2007-03-01* bootstrap.conf (gnulib_modules): Replace xreadlink withBruno Haible
xreadlink-with-size. Add xreadlink. * src/copy.c (copy_internal): Update. * src/ls.c (is_directory): Update. * src/stat.c (print_stat): Update. * src/readlink.c (main): Use the one-argument xreadlink function.
2007-02-27Make df -P immune to effects of e.g., the BLOCK_SIZE envvar.Paul Eggert
* NEWS: With -P, the default block size and output format is not affected by DF_BLOCK_SIZE, BLOCK_SIZE, or BLOCKSIZE. * src/df.c (main): Implement this. * doc/coreutils.texi (df invocation): With -P, the default block size and output format is not affected by DF_BLOCK_SIZE, BLOCK_SIZE, or BLOCKSIZE.
2007-02-24* NEWS: sort no longer compresses temporaries by default.Paul Eggert
* bootstrap.conf: Remove findprog. * doc/coreutils.texi (sort invocation): The default is to not compress. Don't treat "" specially. * src/sort.c: Don't include findprog.h. (create_temp): Compress only if the user specified --compress-program. * tests/misc/sort-compress: Adjusts tests to match new behavior.
2007-02-23* src/date.c (usage): Split a diagnostic that had grown to beJim Meyering
longer than the C89 maximum of 509 bytes.
2007-02-23* src/date.c (usage): Mention that --rfc-3339 uses space, not 'T',Ed Santiago
for a separator. Include sample RFC 2822 and 3339 output.
2007-02-23With -Dlint, make shuf free all heap-allocated storage.Jim Meyering
* src/shuf.c (main): Move declaration of input_lines to function scope, and initialize to NULL, so we can free it. [lint]: Free all malloc'd memory. * tests/misc/shuf: Also test shuf's -e and -i options.
2007-02-22Honor dd's noatime flag if possible, even if not supported on build fsPaul Eggert
* doc/coreutils.texi (dd invocation): Warn that noatime might not be reliable. * src/dd.c (flags, usage): Look at O_NOATIME, not HAVE_WORKING_O_NOATIME, to decide whether to support the noatime flag, so that dd attempts O_NOATIME even if the build file system does not support it. Problem reported by Jim Meyering today in bug-coreutils. * tests/dd/misc: Generate a warning, not a failure, if noatime exists but fails.
2007-02-22Adjust preceding change not to perform an unaligned access.Jim Meyering
* src/copy.c (copy_reg): Undo previous change. Instead, make it clearer that we're using a single-byte sentinel, and [lint]: Initialize uintptr_t-1 bytes after the sentinel. Reported by Andreas Schwab.
2007-02-22Placate valgrind, wrt ./cp --sparse=alwaysJim Meyering
* src/copy.c (copy_reg): Place the sentinel by setting a full word's worth of bits, not just a single byte's worth. This avoids a harmless (but distracting) case of memory being used-uninitialized.
2007-02-21* src/copy.c (cached_umask): Cast -1 to mode_t to avoid a warningPaul Eggert
about out-of-range initializer with Sun C 5.8.
2007-02-20* src/env.c (main): When invoked with no arguments (i.e. when printingJim Meyering
the environment), use a local variable to iterate through the global "environ" array, rather than "environ" itself. This is solely to avoid changing the environment for an LD_PRELOAD-substituted "puts" or "exit" function. Tiny patch by Harvey Eneman. See <http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/9735>. * THANKS: Update.
2007-02-19* NEWS: sort now uses a --compress-program option rather thanPaul Eggert
an environment variable. * doc/coreutils.texi (sort invocation): Document this. * src/sort.c (usage): Likewise. (COMPRESS_PROGRAM_OPTION): New const. (long_options, create_temp, main): Support new option. * tests/misc/sort-compress: Test it.
2007-02-18Rely on gnulib-generated stdlib.h, not exit.h.Jim Meyering
* src/system.h: Don't include exit.h, now that it's subsumed by the gnulib-generated stdlib.h. * lib/xfts.c: Include <stdlib.h> rather than exit.h, now that stdlib.h
2007-02-15* bootstrap.conf (gnulib_modules): Add c-strcase. Remove strcase.Paul Eggert
* src/dircolors.c: Include c-strcase.h. (dc_parse_stream): Use c_strcasecmp rather than strcasecmp to avoid unreliable results in locales like Turkish where strcasecmp is incompatible with the C locale.
2007-02-10Remove excess leading spaces that would make help2man misbehave.Jim Meyering
* src/printf.c (usage): Remove excess spaces on 2nd line of %b desc. * src/nl.c (usage): Remove excess spaces on 2nd line of pBRE desc. * src/dd.c (usage): Remove excess spaces on 2nd line of sync desc. * src/date.c (usage): Use two spaces after each optional flag, not one. Reported by Thomas Huriaux in <http://bugs.debian.org/410407>.
2007-02-10* src/csplit.c (usage): Use two spaces (not one) to separateJim Meyering
each option string from its description, so help2man formats the derived man page properly. Reported by Thomas Huriaux in <http://bugs.debian.org/410407>. * src/df.c (usage): Likewise. * src/du.c (usage): Likewise. * src/install.c (usage): Likewise. * src/ls.c (usage): Likewise.
2007-02-03* NEWS: Document fix for cp --preserve=mode.Paul Eggert
* src/copy.c (copy_internal): Omit the group- or other-writeable permissions when creating a directory, to avoid a race condition if the special mode bits aren't right just after the directory is created. * src/cp.c (make_dir_parents_private): Likewise. * tests/cp/parent-perm-race: Test for the "cp --preserve=mode" race fix in copy.c.
2007-02-03* NEWS: Document fix for cp --parents.Paul Eggert
* src/cp.c (make_dir_parents_private): Report the error sooner with "cp --parents DIR/FILE DEST" when DIR is a non-directory, thus not creating the directory, DEST/DIR. * tests/cp/cp-parents: Test for the non-race-condition bug fixed by the above change.
2007-02-02* src/nl.c (proc_text): Use "NULL", not "(struct re_registers *) 0".Jim Meyering
2007-02-02* src/c99-to-c89.diff: Make shred.c Index: and a/b prefixesJim Meyering
consistent, so this can be applied with patch -p0. Reported by Matthew Woehlke. * Makefile.maint (patch-check): Use patch with its -p2 option, since that makes this check slightly more strict.
2007-01-29Plug a leak in ls.Jim Meyering
* src/ls.c (print_dir): Don't leak a "DIR"+fd upon failure to determine dev/inode or upon detecting a symlink loop.
2007-01-29* src/ls.c: Rename three global variables.Jim Meyering
(cwd_file): Rename from 'files'. (cwd_n_alloc): Rename from 'nfiles'. (cwd_n_used): Rename from 'files_index'.
2007-01-29Shave 8 bytes off the size of "struct fileinfo".Jim Meyering
* src/ls.c (fileinfo): Put all members of type "bool" together.
2007-01-29Modify "ls" to sort its data faster, using the new gnulib mpsortPaul Eggert
module rather than qsort. This is particularly a win in environments where strcoll is slow, since mpsort typically calls strcoll less often than qsort does. * bootstrap.conf (gnulib_modules): Add mpsort. * src/ls.c: Include mpsort.h. (sorted_file, sorted_file_alloc): New vars, for a new vector of pointers to the file info, for speed. (clear_files, extract_dirs_from_files, sort_files, print_current_files): (print_many_per_line, print_horizontal, print_with_commas): (calculate_columns): Set and use new vector. (initialize_ordering_vector): New function.
2007-01-26Adjust to today's change to gnulib, which added a module forPaul Eggert
string.h to replace the little include files like strcase.h. * src/dircolors.c: Don't include strcase.h. * src/system.h: Don't include mempcpy.h, memrchr.h, stpcpy.h, strpbrk.h.
2007-01-26* src/dd.c (advance_input_after_read_error): Change diagnostic toJim Meyering
say "invalid file offset" rather than "screwy file offset".
2007-01-25* src/sort.c (create_temp): Remove superfluous access-X_OKDan Hipschman
check. find_in_path does this for us.
2007-01-24Pass "make distcheck" again.Jim Meyering
* src/sort.c (usage): Split a diagnostic that had grown to be longer than the C89 maximum of 509 bytes. * .x-sc_cast_of_argument_to_free: New file. Allow a cast in sort.c. FIXME: this is just temporary, while we wait to remove the offending access-calling code. * Makefile.am (EXTRA_DIST): Add .x-sc_cast_of_argument_to_free. * Makefile.maint (sc_cast_of_argument_to_free): Use the canonical, $$($(CVS_LIST_EXCEPT)). * m4/.gitignore, m4/.cvsignore, lib/.gitignore, lib/.cvsignore: Update.
2007-01-24* NEWS: New option sort -C, proposed by XCU ERN 127, which looksPaul Eggert
like it will be approved. Also add --check=quiet, --check=silent as long aliases, and --check=diagnose-first as an alias for -c. * doc/coreutils.texi (sort invocation): Document this. Also, mention that sort -c can take at most one file. * src/sort.c: Implement this. Include argmatch.h. (usage): Document the change. (CHECK_OPTION): New constant. (long_options): --check now takes an optional argument, and is now treated differently from 'c'. (check_args, check_types): New constant arrays. (check): New arg CHECKONLY, which suppresses diagnostic if -C. (main): Parse the new options. * tests/sort/Test.pm (02d, 02d, incompat5, incompat6): New tests for -C.
2007-01-24* NEWS: sort temp file compression: tweak wording.Jim Meyering
* src/sort.c (struct sortfile) [name]: Declare member to be const.
2007-01-24* src/sort.c (MAX_FORK_RETRIES_COMPRESS, MAX_FORK_RETRIES_DECOMPRESS):Dan Hipschman
In pipe_fork callers, use these named constants, not "2" and "8". (proctab, nprocs): Declare to be "static". (pipe_fork) [lint]: Initialize local, pid, to avoid unwarranted may-be-used-uninitialized warning. (create_temp): Use the active voice. Describe parameters, too. 2007-01-21 James Youngman <jay@gnu.org> Centralize all the uses of sigprocmask(). Don't restore an invalid saved mask. * src/sort.c (enter_cs, leave_cs): New functions for protecting code sequences against signal delivery. * (exit_cleanup): Use enter_cs and leave_cs instead of calling sigprocmask directly. (create_temp_file, pipe_fork, zaptemp): Likewise 2007-01-21 Dan Hipschman <dsh@linux.ucla.edu> Add compression of temp files to sort. * NEWS: Mention this. * bootstrap.conf: Import findprog. * configure.ac: Add AC_FUNC_FORK. * doc/coreutils.texi: Document GNUSORT_COMPRESSOR environment variable. * src/sort.c (compress_program): New global, holds the name of the external compression program. (struct sortfile): New type used by mergepfs and friends instead of filenames to hold PIDs of compressor processes. (proctab): New global, holds compressor PIDs on which to wait. (enum procstate, struct procnode): New types used by proctab. (proctab_hasher, proctab_comparator): New functions for proctab. (nprocs): New global, number of forked but unreaped children. (reap, reap_some): New function, wait for/cleanup forked processes. (register_proc, update_proc, wait_proc): New functions for adding, modifying and removing proctab entries. (create_temp_file): Change parameter type to pointer to file descriptor, and return type to pointer to struct tempnode. (dup2_or_die): New function used in create_temp and open_temp. (pipe_fork): New function, creates a pipe and child process. (create_temp): Creates a temp file and possibly a compression program to which we filter output. (open_temp): Opens a compressed temp file and creates a decompression process through which to filter the input. (mergefps): Change FILES parameter type to struct sortfile array and update access accordingly. Use open_temp and reap_some. (avoid_trashing_input, merge): Change FILES parameter like mergefps and call create_temp instead of create_temp_file. (sort): Call create_temp instead of create_temp_file. Use reap_some. (avoid_trashing_input, merge, sort, main): Adapt to mergefps.
2007-01-20Standardize on list of signals when an app catches signals.Paul Eggert
* src/csplit.c (main): Also catch SIGALRM, SIGPIPE, SIGPOLL, SIGPROF, SIGVTALRM, SIGXCPU, SIGXFSZ. * src/ls.c (main): Likewise (except SIGPIPE was already caught). Note that ls.c is special, as it also catches SIGTSTP. * src/sort.c (main): Likewise. Also catch SIGQUIT. More details in <http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/9510>.
2007-01-19* src/sort.c (cleanup): Clear temphead at the end.Dan Hipschman
(exit_cleanup): New function. (main): Don't invoke atexit until we're ready. Invoke it with exit_cleanup, not with cleanup and close_stdout, to avoid a race condition with cleanup and signal handling. More details: http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/9508
2007-01-18* src/c99-to-c89.diff: Adjust remove.c offsets.Jim Meyering
2007-01-17Make "rm --interactive=never ..." never prompt.Jim Meyering
* NEWS: Mention this. * src/remove.h (enum rm_interactive): New ternary type. (struct rm_options) [interactive]: Use it, here -- rather than bool. * src/remove.c (prompt): Reflect type change. * src/mv.c (rm_option_init): Initialize to RMI_NEVER now. * src/rm.c (main): Add a FIXME comment for '-d' option. Adapt to type change of rm_options.interactive. * tests/rm/i-never: New file. Test for the above fix. * tests/rm/Makefile.am (TESTS): Add i-never.
2007-01-15* src/remove.c (remove_dir): Don't use errno in diagnostic.Jim Meyering
Root-only test failure reported by Alex van Hout and Jon Grosshart in <http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/9415/focus=9415>.
2007-01-11Avoid a leak in expr's implementation of the ":" (match) operator.Jim Meyering
* src/expr.c (docolon): Free the regexp buffer using regfree, rather than doing it manually, being careful to set fastmap to NULL first. Free any re_regs.start and .end members, if necessary.
2007-01-10Don't use fts_statp uninitialized for "chown -RLh --preserve-root ...".Jim Meyering
* src/chown-core.c (FTSENT_IS_DIRECTORY): New macro. (change_file_owner): Perform the ROOT_DEV_INO_CHECK only for a directory. Non-directory entries lack fts_statp data when using the FTS_NOSTAT option.