summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2008-02-20join: avoid new leaksJames Youngman
* src/join.c (prevline): Make prevline module-level static, so that the allocated items can be freed at exit. (free_prevline): new atexit function; frees items in prevline[]. Use ARRAY_CARDINALITY, so include "argmatch.h" to get that. (main): Arrange for free_prevline to be called during exit. (get_line): Free prevline[which - 1] also, as that will have been allocated by dup_line.
2008-02-20sort: add --sort=... option.Andreas Schwab
* src/sort.c (SORT_OPTION): New enum. (sort_args, sort_types): Define. (usage, long_options, main): New option --sort. * tests/sort/Test.pm: Test it. * doc/coreutils.texi (sort invocation): Document --sort option. * NEWS: Mention this.
2008-02-19* src/c99-to-c89.diff: Adjust seq.c offsets. Accommodate a new C99-ism.Jim Meyering
2008-02-19seq: give better diagnostics for invalid formats.Steven Schubiger
* src/seq.c: (validate_format): New function. (main): Use it. * tests/misc/seq (fmt-d, fmt-e): Test for expected diagnostics with invalid formats. * NEWS: Mention this change. * TODO: Remove this item. [jm: src/seq.c: make diagnostics more consistent tests/misc/seq (fmt-eos1): adjust the expected diagnostic ]
2008-02-19join: new options: --check-order and --nocheck-order.James Youngman
* src/join.c: Support --check-order and --nocheck-order. New variables check_input_order, seen_unpairable and issued_disorder_warning[]. For --check-order, verify that the input files are in sorted order. For the default case, check the order only if there are unpairable lines. (join): Perform ordering checks after reaching EOF on either input. (usage): Mention --check-order and --nocheck-order. (dupline): Save a copy of the previously-read input line so that we can detect disorder on the input. (get_line): Temporarily save a copy of the previous line (by calling dupline) and check relative ordering (by calling checkorder) before returning the newly-read line. (getseq, join): Tell get_line which file we are reading from. (advance_seq): New function, factoring out some of the code commonly surrounding calls to getseq. (checkorder): New function. Verifies that a pair of consecutive input lines are in sorted order. * doc/coreutils.texi (join invocation): Document the new options --check-order and --nocheck-order. * tests/join/Test.pm (tv): Added tests for --check-order and --nocheck-order. * NEWS: Mention this new feature.
2008-02-18seq: give a proper diagnostic for an invalid --format=% optionJim Meyering
* src/seq.c (long_double_format): Handle '%' at end of string. * tests/misc/seq [fmt-eos1, fmt-eos2]: New tests for the bug. * NEWS: Mention this. Reported by Pádraig Brady.
2008-02-17.gitignore, src/.gitignore: ignore moreJim Meyering
2008-02-17Clean up ls.c.Jim Meyering
* src/ls.c (put_indicator): Use fwrite, not a loop.
2008-02-17Adjust dircolors to match ls.c.Jim Meyering
* src/dircolors.hin: comment out NORMAL and FILE, define RESET. * src/dircolors.c (slack_codes) Add "RESET". (ls_codes): Add "rs".
2008-02-17ls --color no longer outputs unnecessary escape sequencesEd Avis
In --color mode, plain files do not get any color, not even white. When no highlighting is required, ls outputs no escape sequence at all. * src/ls.c (print_with_color): (used_color): New global. (indicator_no) [C_RESET]: New enum value. (indicator_name) ["rs"]: Corresponding new string. (color_indicator): Make the 'normal' and 'file' markers be NULL. Use "rs" (C_RESET) to reset to ordinary colors. (process_signals): Restore default colors only if necessary. (main): Don't call prep_non_filename_text here. (print_name_with_quoting): Call it here, instead. (prep_non_filename_text): Use C_RESET, not C_NORM. (print_color_indicator): Return bool, not void. Print nothing, when possible. (put_indicator): Call prep_non_filename_text the first time. * tests/misc/ls-misc: Test for above. * tests/ls/color-dtype-dir: Adapt: no escapes around regular file name. * TODO: Remove item. * NEWS: Mention this.
2008-02-17ls: Improve description of --group-directories-first.Dan Jacobson
* src/ls.c (usage) [--group-directories-first]: Improve description. * doc/coreutils.texi (Which files are listed): Likewise.
2008-02-16Use the gettime module in ls.c.James Youngman
Implement TODO list item to make ls.c use the gettime module. * TODO (ls): Now that we use gettime, remove the TODO entry. * src/ls.c: Use timespec.h and the gettime module. (current_time): Change type from time_t to struct timespec. (current_time_ns): Removed. (get_current_time): Removed. (print_long_format): Remove when and when_ns, since we have when_timespec anyway. Change type of variable six_months_ago from time_t to struct timespec.
2008-02-14groups: don't test printf and putchar calls for failureJim Meyering
They are unnecessary, since we use gnulib's closeout module. * src/group-list.c (print_group): Remove explicit error tests. * src/groups.c (main): Likewise. (write_error): Remove function.
2008-02-13Replace groups.sh with groups.c.James Youngman
* src/groups.c (main): New file, replacing groups.sh. * src/group-list.c, src/group-list.h: New files, factored out of id.c, implementing the functionality that "id" and "groups" have in common. * src/id.c (print_full_info): Avoid a segfault when trying to print an error message if getgroups fails. (print_group_list): Move to group-list.c. (print_group): Likewise. * man/Makefile.am: When building groups.1, obtain the help text from src/groups.c, not src/groups.sh. (noinst_HEADERS): Add group-list.h. (group): Remove rule. (dist_man_MANS): Remove groups.1. * doc/coreutils.texi (groups: Print group names a user is in): Explain why "groups" and "groups $(id -un)" give different results in existing login sessions after you change the group database. (id: Print user identity): Likewise for "id". * po/POTFILES.in: Add src/group-list.c and src/groups.c. * NEWS: mention this. * AUTHORS: Update.
2008-02-07mkdir, split: write --verbose output to stdout, not stderr.Steven Schubiger
* src/mkdir.c (verbose_output): New function. (announce_mkdir): Use it. * src/split.c (usage): Update. * src/split.c (cwrite): Write to stdout, not stderr. * doc/coreutils.texi (split invocation): Remove the mention of --verbose output being printed to stderr. * tests/mkdir/p-v: Redirect stdout, not stderr. * tests/misc/split-a: Likewise. * NEWS: Mention this change. * TODO: Remove this item.
2008-01-31Don't modify argv in dd due to ',' in arguments.Paul Eggert
* src/dd.c: Include quotearg.h. (operand_matches): New function. (parse_symbols, operand_is): Use it. (parse_symbols): 1st arg is now const pointer. Don't modify it. msgid arg is now just the message, not a format. (scanargs): Add some 'const's to check for problems like the above.
2008-01-30* src/c99-to-c89.diff: Adjust remove.c offsets, again.Jim Meyering
2008-01-30Now that system.h defines is_empty_dir, include "openat.h".Jim Meyering
* src/system.h: Include "openat.h" here, ... * src/chcon.c: ... not here. * src/chmod.c: Likewise. * src/chown-core.c: Likewise. * src/remove.c: Likewise. Signed-off-by: Jim Meyering <meyering@redhat.com>
2008-01-30* src/c99-to-c89.diff: Adjust remove.c offsets.Jim Meyering
2008-01-30Improve "rmdir --ignore-fail-on-non-empty"Jim Meyering
* src/rmdir.c (remove_parents, main): With --ignore-fail-on-non-empty, suppress a diagnostic also for other errno values, which can arise with read-only media or when the parent directory has the immutable attribute (set via chattr +i). (errno_may_be_empty, ignorable_failure): New functions. * src/remove.c (is_empty_dir): Move function to ... * src/system.h (is_empty_dir): ...here, and make it inline. Suggested by Josselin Mouette in <http://bugs.debian.org/363011> via Bob Proulx. * NEWS: Mention the improvement.
2008-01-30Don't modify argv in dd.Paul Eggert
* src/dd.c (operand_is): New function. (scanargs): Use it so that we don't need to modify argv, as a nicety. Problem reported by Adam Goode in <http://lists.gnu.org/archive/html/bug-coreutils/2008-01/msg00264.html>.
2008-01-29ls: don't segfault on files in /proc with an old libselinuxJim Meyering
* src/ls.c (gobble_file): Work around a bug in libselinux1-2.0.15 whereby getfilecon returns 0 yet sets the context to NULL. Reported by Jan Moringen via Michael Stone in http://bugs.debian.org/463043 * tests/ls/Makefile.am (TESTS): Add proc-selinux-segfault. * tests/ls/proc-selinux-segfault: Test for the above fix. * NEWS: Mention the fix.
2008-01-26chcon: correct description of --no-dereference (-h) option.Jim Meyering
* src/chcon.c (usage): Remove invalid reference to lchown. Reported by Göran Uddeborg.
2008-01-26src/dircolors.hin (TERM): Add jfbterm.Mike Frysinger
2008-01-26Add a ";", so "make install" works with --enable-install-program=su.Zvi Har'El
* src/Makefile.am (install_su): Add a semicolon.
2008-01-26Avoid misinterpreting mgetgroups failure in running root-only tests.Jim Meyering
* src/setuidgid.c (main): Don't misinterpret as size_t an error return from mgetgroups. Reported by Theodoros V. Kalamatianos.
2008-01-17Do not define-away __attribute__ when __STRICT_ANSI__ is set.Jim Meyering
* src/system.h (__attribute__): Remove the __STRICT_ANSI__ disjunct. It has been unnecessary since approximately gcc-2.6, and now, leaving it would cause gcc -Werror -ansi to fail to compile csplit.c. * gl/lib/randread.c (__attribute__): Likewise.
2008-01-12* src/dircolors.hin (image formats): Add the .svg suffix.Mike Frysinger
2008-01-09Fix a minor race condition when using cp -p --parents.Paul Eggert
* src/cp.c (make_dir_parents_private): If stat fails on the parent directory, do not add it to the list of directories whose modes might need fixing later. Also, do not bother invoking 'stat' unless the stat results might be needed later.
2008-01-08Remove uses of now-undefined Makefile variable.Jim Meyering
* src/Makefile.am (dir_LDADD, ls_LDADD, vdir_LDADD): Remove uses of no-longer-defined variable, $(LIB_ACL_TRIVIAL).
2008-01-07cp (but not copy.c): plug a small leak.Jim Meyering
* src/cp.c (do_copy) [--parents]: Free the attribute list.
2008-01-07cp --parents: don't use uninitialized memory when restoring permissionsJan Blunck
* src/cp.c (make_dir_parents_private): Always stat each source directory, in case its permissions are required in re_protect, when setting permissions of a just-created destination directory.
2008-01-06touch: ignore "-d now" option, when appropriatePaul Eggert
* src/touch.c (main): Treat "-d now" as if it were absent, if neither -a nor -m is specified. Problem reported by Dan Jacobson in: http://lists.gnu.org/archive/html/bug-coreutils/2008-01/msg00010.html
2008-01-06Avoid tr case-conversion failure in some locales.Jim Meyering
* src/tr.c (skip_construct): New function. (main): When processing a pair of case-converting classes, don't iterate through the elements of each [:upper:] or [:lower:] class. Reported by Gerald Pfeifer in <http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/12218>. * tests/tr/Test.pm [tolower-F]: New test for the above fix. [upcase-xtra, dncase-xtra]: New tests, for a related code path. * NEWS: Mention the tr bug fix.
2007-12-30* src/dircolors.hin (TERM): Add gnome-256color.Mike Frysinger
2007-12-19Improve wording in uniq's --help "Note".Paul Eggert
2007-12-18* src/uniq.c (usage): Say "key-selection", not "field-selection".Jim Meyering
Quote example commands consistently.
2007-12-18Note that sorting uniq's input is often useful.Jim Meyering
Suggested by Eric Blake.
2007-12-11"ls -l" wouldn't output "+" on SELinux hosts unless -Z was also given.Paul Eggert
* src/ls.c (gobble_file): Also get the file context if -l is specified. Treat getfilecon failures like file_has_acl failures. (UNKNOWN_SECURITY_CONTEXT): New constant. (clear_files): Don't free it. (gobble_file): Set unknown security contexts to it; that way, we don't have to have special cases for unknown contexts. (print_long_format, print_file_name_and_frills): Don't worry about scontext being null, since it's always some string now.
2007-12-09"rm" as root would fail to unlink a non-directory on OS X 10.4.xJim Meyering
* src/remove.c (remove_entry) ["can unlink directories"]: Fix a mistakenly reversed condition. * NEWS: Mention this bug fix. Reported by Pieter Bowman.
2007-12-08* src/c99-to-c89.diff: Adjust shred.c offsets.Jim Meyering
2007-12-04Reflect change in gnulib: don't include getpagesize.h,Jim Meyering
now that it's provided by unistd.h. * src/cat.c: Don't include getpagesize.h. * src/copy.c: Likewise. * src/dd.c: Likewise. * src/shred.c: Likewise. * src/split.c: Likewise.
2007-12-02Remove just-installed su, if unable to make it set-UID root.Jim Meyering
Normally, su isn't even installed. However, if you configure with --enable-install-program=su, and then install with insufficient privileges, we now make sure to remove the just-installed binary. * src/Makefile.am (install-exec-hook): Rename from install-exec-local, so that this rule is guaranteed to be run *after* installation. If unable to chown and chmod the installed "su" program, remove it. Reported by Greg Schaefer.
2007-12-01* NEWS: Mention some of the SELinux changes.Jim Meyering
Record release date and new version number. * src/stat.c (main): Adjust a comment.
2007-12-01Add "extern" keyword to declaration of cp_options_default.Jim Meyering
* src/copy.c (cp_options_default): Mark as "extern", so the "sc_tight_scope" part of "make distcheck" passes.
2007-12-01Fix a security race with "cp -p A B" when B already exists.Paul Eggert
* src/copy.h (struct cp_options): New member owner_privileges. * src/copy.c (USE_ACL): Define to 0 if not defined, for convenience. (owner_failure_ok): New function. (set_owner): Avoid a security-related race by doing an extra chmod first if it looks like there might be trouble right after a chown. Accept a source struct stat rather than a uid and gid, and accept a boolean NEW_DST and destination struct stat. All callers changed. * src/copy.h (cp_options_default): New function, replacing the old chown_privileges. * src/copy.c (cp_options_default): Likewise. * src/cp.c (cp_option_init): Use it. * src/install.c (cp_option_init): Likewise. * src/mv.c (cp_option_init): Likewise.
2007-11-29Close a file descriptor leak when cp --preserve=context fails.Paul Eggert
* src/copy.c (copy_reg): Close dest_desc too, if getfscreatecon or fsetfilecon fail.
2007-11-26setuidgid.c: more cleanupJim Meyering
* src/setuidgid.c: Include "mgetgroups.h". (main): Don't presume there's a fixed limit on the maximum number of group IDs. Don't use NGROUPS; it's artificially low. Change the name of a local: s/gids_count/n_gids/. Remove non-portable "const": s/const int tmp =.../int tmp =.../
2007-11-25setuidgid: Update --help output.Jim Meyering
* src/setuidgid.c (usage): Describe -g GID[,GID1...] option. Mention that USER may be a numeric ID or a user name.
2007-11-24setuidgid: minor clean-up.Jim Meyering
* setuidgid.c: Include "xstrtoul.h". (main): Detect overflow in string-to-gid_t and -to-uid_t conversions. Improve diagnostics.