summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2008-04-02copy.c: remove an in-function #ifdefJim Meyering
* src/copy.c (rpl_mkfifo) [! HAVE_MKFIFO]: New function. (mkfifo) [! HAVE_MKFIFO]: Define to rpl_mkfifo. (copy_internal): Remove #ifdef. Signed-off-by: Jim Meyering <meyering@redhat.com>
2008-03-31"rm -r DIR" would mistakenly prompt about very long namesJim Meyering
* src/remove.c (write_protected_non_symlink): Return 0(-1) when euidaccess_stat pronounces a writable(not-writable) file, not -1(0). * tests/rm/deep-2: New file. Test for the above-fixed bug. * tests/rm/Makefile.am (TESTS): Add deep-2. Discovered while reviewing this change: http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/13071
2008-03-28mknod, mkfifo: don't segfault when diagnosing invalid SELinux contextJim Meyering
Identical to the bug fixed by 72d052896a9092b811961a8f3e6ca5d151a59be5. * src/mkfifo.c (main): Use "scontext", not NULL optarg in diagnostic. * src/mknod.c (main): Likewise. Reported by Cristian Cadar, Daniel Dunbar and Dawson Engler. * tests/mkdir/selinux: Test for the above fixes. * NEWS: Mention the fixes.
2008-03-27paste -d\\: avoid heap overrun for backslash at end of delim listJim Meyering
* src/paste.c: Include "quotearg.h". (collapse_escapes): Handle backslash-escaped backslash explicitly. Handle unescaped backslash at end of string by returning nonzero, rather than by overrunning memory. (main): Diagnose an invalid delimiter list -- carefully. Reported by Cristian Cadar, Daniel Dunbar and Dawson Engler. * tests/misc/paste-no-nl (delim-bs): Add a test to demonstrate the heap-smashing capability. (delim-bs2): Prior to coreutils-5.1.2, this bug was a little harder to demonstrate: it would corrupt a first-argument containing e.g., \b * NEWS: Mention the bug fix. * tests/misc/Makefile.am (TESTS): Reflect renaming. * tests/misc/paste: Rename from paste-no-nl. Signed-off-by: Jim Meyering <meyering@redhat.com>
2008-03-26* src/join.c (keycmp): Document new parameters.Jim Meyering
2008-03-26mkdir -Z x d: don't segfault when diagnosing invalid context "x" (tiny change)Daniel Dunbar
* src/mkdir.c (main): Use "scontext", not NULL optarg in diagnostic. Reported by Cristian Cadar, Daniel Dunbar and Dawson Engler. * NEWS: Mention the bug fix.
2008-03-25id bug fix: don't point to potentially clobbered static storagePeter Fales
On at least Mac OS, when calling getpwuid twice with the same UID, the static storage containing results from the first call is invalidated by the second call. * src/id.c (main): Point to a copy of the user name string.
2008-03-25join bug fix: adapt keycmp to work with new order-checking featureJim Meyering
* src/join.c (keycmp): Add two join-field parameters. (check_order, join): Update callers. Reported by Dmitry V. Levin in http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/12731/focus=13017 * tests/join/Test.pm (chkodr-7): New test for this fix.
2008-03-23join.c: syntax/style tweaksJim Meyering
* src/join.c (check_order): Rename from checkorder. Move definition to precede first use and remove prototype. Use EXIT_FAILURE, rather than "1". (key_cmp): Move definition to precede first use.
2008-03-21* src/c99-to-c89.diff: Adjust seq.c offsets.Jim Meyering
2008-03-21ptx: avoid heap overrun for backslash at end of optarg stringJim Meyering
* src/ptx.c (copy_unescaped_string): Ignore a lone backslash at end of string. Reported by Cristian Cadar, Daniel Dunbar and Dawson Engler. Details here: <http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/13005>. * tests/misc/Makefile.am (TESTS): Add ptx-overrun. * tests/misc/ptx-overrun: New file. Test for the above fix. * NEWS: Mention the fix. Signed-off-by: Jim Meyering <meyering@redhat.com>
2008-03-21ptx.c readabilityJim Meyering
* src/ptx.c (copy_unescaped_string): Add braces around 80+-line single-stmt while-loop body. Signed-off-by: Jim Meyering <meyering@redhat.com>
2008-03-21Write NEWS and update c99-to-c89 patch for today's rm improvement.Jim Meyering
* NEWS: call this a "portability improvement" ;-) * src/c99-to-c89.diff: Adjust remove.c offsets.
2008-03-21remove.c: Accommodate systems with negative errno values.Ingo Weinhold
* src/remove.c (cache_fstatat): Store errno value directly in the st_ino field, rather than trying to shoehorn it into st_size. This is required at least on BeOS and Haiku.
2008-03-21* src/seq.c (long_double_format): Add a comment.Jim Meyering
2008-03-19Check for -- and remove -- some unnecessarily included header files.Jim Meyering
* Makefile.maint: Add checks for a handful of additional header files. * src/mktemp.c: Don't include "long-options.h". Not used. * src/pr.c: Don't include "inttostr.h". Not used. * src/printenv.c: Don't include "error.h". Not used. * src/test.c: Don't include "error.h". Not used. * src/touch.c: Don't include "safe-read.h". Not used.
2008-03-19mv: never unlink a destination file before calling renameJim Meyering
While cp --preserve=links must unlink certain destination files, mv must never do that. * src/copy.c (copy_internal): Pull the '! x->move_mode' test "up", so it affects the entire condition, and not just DEREF_NEVER mode. Reported by James Ralston in <http://bugzilla.redhat.com/438076>. * tests/mv/atomic2: New file. Test for the above fix. * tests/mv/Makefile.am (TESTS): Add atomic2. * NEWS: Mention the bug-fix. [Bug introduced in 367719ba5f1dbd5e2f7fa2466c441f23f66a7c9e]
2008-03-16Include <getopt.h> only if used.Jim Meyering
* src/group-list.c: Don't include <getopt.h>. * src/printf.c: Likewise.
2008-03-10install, rmdir: write --verbose output to stdout, not to stderr.Ondřej Vašík
* src/install.c (announce_mkdir): Write verbose output to stdout, not to stderr. * src/mkdir.c (announce mkdir): Use prog_fprintf for verbose output. * src/prog-fprintf.c (prog_fprintf): New function and file. * src/prog-fprintf.h: New file. * src/rmdir.c (main): Write verbose output to stdout, not to stderr. Quote directory name in a diagnostic. * src/rmdir.c (remove_parents): Write verbose output to stdout, not to stderr. * doc/coreutils.texi: Mention that shred verbose output is to stderr. * NEWS: Mention the changes. Signed-off-by: Ondřej Vašík <ovasik@redhat.com>
2008-03-10make syntax-check: also check src/*.h files for extern functions,Jim Meyering
* src/Makefile.am (sc_tight_scope): ... now that there is one.
2008-03-07dd: avoid unnecessary, but harmless close_stdout call.Jim Meyering
* src/dd.c (close_stdout_required): New global. (maybe_close_stdout): New function. (main): Set the global. Reported by Ulrich Drepper in http://bugzilla.redhat.com/436368
2008-03-05* src/c99-to-c89.diff: Accommodate a C99-ism in id.c.Jim Meyering
2008-03-05Work around AFS bug: id and groups would print invalid group number.ribalba
* src/id.c (main): Call print_group_list with a user name, if possible. * src/groups.c (main): Likewise. * NEWS: Mention this. For details, see http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/12852 http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/12875 Signed-off-by: ribalba <geerd.dietger.hoffmann@gmail.com>
2008-03-01Don't skip the groups-version test.Jim Meyering
* tests/Makefile.am (built_programs): Remove unused definition. * src/Makefile.am (built_programs.list): Print a space-separated list of program names, not NL-separated, since all clients now expect a space-separated list.
2008-02-28Make copyright comments consistent.Jim Meyering
* src/mktemp.c: Update copyright to use newer form. Make first copyright lines consistent. Some did not end in ", Inc.". Due to that missing ", Inc" at end of line, emacs' copyright-updating code missed some opportunities. This corrects most of those, and adds some mistakenly omitted years. * src/chown-core.c: Adjust. * src/chown-core.h: Likewise. * src/copy.c: Likewise. * src/copy.h: Likewise. * src/cp-hash.c: Likewise. * src/cp.c: Likewise. * src/group-list.h: Likewise. * src/mktemp.c: Likewise. * src/stat.c: Likewise. * tests/chmod/equal-x: Likewise. * tests/dd/skip-seek: Likewise. * tests/envvar-check: Likewise. * tests/mv/into-self-2: Likewise.
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.