summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2007-11-24setuidgid.c: Normalize leading white space: no more TABsJim Meyering
2007-11-24setuidgid: accept numeric UID, and new option -g GID,GID1,GID2,...Lasse Collin
* src/setuidgid.c: Add functionality for the new test above.
2007-11-24"cp -p" tries to preserve GID even if preserving the UID fails.Lasse Collin
* NEWS: Mention this new feature. * src/copy.c (set_owner): Try to preserve just the GID, when initial fchown/lchown fails. * src/cp.c (re_protect): Likewise.
2007-11-23* src/runcon.c (main): Remove unused parameter, "envp".Jim Meyering
2007-11-22Quiet warnings about unused parameters.Jim Meyering
* src/copy.c (set_author) [!HAVE_STRUCT_STAT_ST_AUTHOR]: "Use" each of the parameters.
2007-11-22cp: by default, refuse to copy through a dangling destination symlinkJim Meyering
* NEWS: Mention this change. * doc/coreutils.texi (cp invocation): Describe the new behavior. * src/copy.c: No longer include "canonicalize.h". (copy_reg): Upon failure to open a dangling destination symlink, don't canonicalize the name, but rather fail (default) or, with POSIXLY_CORRECT, repeat the open call without O_EXCL (potentially dangerous). * src/copy.h (struct cp_options) [open_dangling_dest_symlink]: New member. Reorder the others, grouping "bool" and "enum" members together. * tests/cp/thru-dangling: Test for changed and new behavior. * src/cp.c (cp_option_init): Initialize new member. * src/install.c (cp_option_init): Likewise. * src/mv.c (cp_option_init): Likewise. Signed-off-by: Jim Meyering <meyering@redhat.com>
2007-11-21* src/c99-to-c89.diff: Adjust seq.c offsets.Jim Meyering
2007-11-21* src/seq.c (print_numbers): Rewrite in an attempt to avoid thePaul Eggert
more-general rounding issues exposed by the previous patch.
2007-11-18* src/c99-to-c89.diff: Adjust seq.c offsets.Jim Meyering
2007-11-18Remove unused parameter in remove.c.Jim Meyering
* src/remove.c (fd_to_subdirp): Remove unused parameter. (remove_cwd_entries, remove_dir): Update callers.
2007-11-17Correct preceding patch.Jim Meyering
* src/seq.c (print_numbers): Also handle first < last && step < 0. * tests/misc/seq [empty-rev]: New test for this case.
2007-11-17"seq .1 .1" would mistakenly generate no output on some systemsJim Meyering
* NEWS: Say this. * src/seq.c (print_numbers): Handle another floating point corner case. This avoids failure of seq's eq-wid-7 test on FreeBSD 6.1.
2007-11-16Port to Solaris 'make' and use a Posixish shell on Solaris.Jim Meyering
* bootstrap.conf (gnulib_modules): Add gnu-make, posix-shell. * build-aux/check.mk (SHELL): Set to $(PREFERABLY_POSIX_SHELL), so that commands can assume Posix syntax. (ENABLE_HARD_ERRORS, TEST_LOGS): Don't use GNU Make's "?=" syntax. (SH_E_WORKAROUND): New macro. (am__check_pre, $(TEST_SUITE_LOG)): Use it. (am__check_pre): Fail if "mkdir" fails. Use $(SHELL) rather than relying on the "#!/bin/sh" in the file, so that tests can use Posix syntax. (am__check_pre, am__tty_colors): Use $$src rather than $$<, to support the Posix-make $(TEST_LOGS) rule. (%.log: %.test, %.log: %$(EXEEXT)): Remove unused inference rules that rely on a GNU Make extension and cause Solaris 'make' to fail. (SUFFIXES): New macro, so that we can use Posix style inference rules. (%.log: %): Use this rule only if GNU_MAKE. Set $$src so that macros can use $$src rather than $$<. (CHECK-FORCE, DEPENDENCY, $(TEST_LOGS)): New macros and rules, which rely only on Posix 'make' semantics, and are used only with non-GNU 'make' implementations. $(TEST_LOGS) invokes 'make' recursively (and a bit inefficiently) to simulate the GNU 'make' rules. (.log.html): Renamed from "%.html: %.log", so that it relies only on Posix 'make' semantics. (check-clean, .PHONY): Do not depend on check-clean-local, since Solaris 'make' complains about nonexistent rules like that. * src/Makefile.am (SUFFIXES): Remove; no longer needed. (groups): Use a specific rule rather than an inference rule that is only instantiated once. The inference-rule approach does not work with Solaris 'make', which gets confused by the "groups: Makefile" line. It's not clear from the Posix spec that Solaris 'make' is buggy here, so instead of worrying about it, rewrite the makefile so that it clearly conforms to Posix. * tests/check.mk (TESTS_ENVIRONMENT): Export PACKAGE_BUGREPORT. GNU 'make' does this automatically for us, but Solaris 'make' doesn't. 2007-11-15 Paul Eggert <eggert@cs.ucla.edu>
2007-11-15Avoid misbehavior of a cross-device "mv" or "install".Jim Meyering
Those programs must not dereference a destination symlink. * src/copy.c (copy_reg): Don't treat a dangling destination symlink differently in move mode. In move mode, the only way the added O_EXCL can cause failure is when some other process has recreated the file this code unlinked a few instructions before.
2007-11-14src/install.c (setdefaultfilecon): Stub-out the entire function.Jim Meyering
2007-11-14#ifdef-out matchpathcon-related code, for now.Jim Meyering
* src/install.c (setdefaultfilecon): #ifdef-out all of the matchpathcon-related code, until it's more efficient.
2007-11-12Clarify description of cp's -a option.Benno Schulenberg
* src/cp.c (usage) [-a]: Remove unnecessary 'P'. Since option -d of 'cp' includes the function of -P, mentioning the latter in the description of option -a is redundant and therefore slightly confusing, as the reader tries to figure out what it adds.
2007-11-10install+SELinux: reduce a 12x performance hit to ~1.5xJim Meyering
* src/install.c (setdefaultfilecon): Call matchpathcon_init_prefix, to mitigate what would otherwise be a large performance hit due to the use of matchpathcon. Dan Walsh suggested the use of matchpathcon_init_prefix. * gl/lib/se-selinux.in.h (matchpathcon_init_prefix): Define. Signed-off-by: Jim Meyering <meyering@redhat.com>
2007-11-05* src/c99-to-c89.diff: Adjust offsets.Jim Meyering
2007-11-03Fix bug with "seq 10.8 0.1 10.95", plus another bug with %% in format.Paul Eggert
* NEWS: Mention the %%-in-format bug fix. * src/seq.c (struct layout): New type. (long_double_format): New arg LAYOUT. Fill it in. Fix mishandling of %% in formats. (print_numbers): New arg LAYOUT. Don't convert LAST to output format when deciding whether to go slightly past LAST. Instead, convert X to output format and back. This fixes a bug reported by Andreas Schwab in <http://lists.gnu.org/archive/html/bug-coreutils/2007-10/msg00237.html> where "seq 10.8 0.1 10.95" would output 11.0 on platforms where 10.95 rounds to a value that prints as 11.0 when only one digit past the decimal point is asked for. (main): Compute layout, for benefit of print_numbers. * tests/misc/seq (float-3): Undo previous change, since the bug should be fixed now. (fmt-b): New test, for the %% bug.
2007-10-28Define ENODATA, for FreeBSD 5.0 and 6.1.Jim Meyering
* src/system.h (ENODATA): Define, if missing.
2007-10-27Adjust format string so msgfmt doesn't object.Jim Meyering
* src/df.c (main): Use "%s%s" (not %smsg) to print "msg" with or without a "Warning: " prefix. Reported by Clytie Siddall.
2007-10-25Tell xgettext that "ARG1 % ARG2" is not a C format string.Micah Cowan
* src/expr.c (usage): Add a comment to override xgettext's default behavior, which would classify "ARG1 % ARG2" as a fprintf-style format string.
2007-10-21tr: do not reject an unmatched [:lower:] or [:upper:] in SET1.Jim Meyering
* NEWS: Mention this. * src/tr.c (get_next) [RE_CHAR_CLASS]: Don't skip the loop when processing [:lower:] and [:upper:]. (main): Require [:lower:] or [:upper:] in SET1 only when when one of those is specified in SET2. * tests/tr/Test.pm: Add tests for this fix. Reported by Per Starbäck. Signed-off-by: Jim Meyering <meyering@redhat.com>
2007-10-21Detect printf(3) failure due to ENOMEM.Jim Meyering
* src/printf.c: Include "xprintf.h" (print_direc): Use xprintf, rather than printf. * bootstrap.conf (gnulib_modules): Add xprintf. * po/POTFILES.in: Add lib/xprintf.c. Signed-off-by: Jim Meyering <meyering@redhat.com>
2007-10-09* src/dircolors.hin: Recognize .lzma as a compressed-file suffix.Jim Meyering
2007-10-09Now that we don't install su, don't make misleading suggestions.Jim Meyering
* src/Makefile.am (install-exec-local) [$(INSTALL_SU) != yes]: Don't suggest running "make install-root". (uninstall-local) [$(INSTALL_SU) != yes]: Don't even check the installed binary.
2007-10-08When forming a truncated name, use the "[...]" prefix even forJim Meyering
an extremely long name in the current directory. * src/remove.c (full_filename_): Rename a local variable. Use two separate "truncated" variables, in case the second call to right_justify does not indicate any truncation -- which would happen only if the single component FILENAME were longer than 511 bytes and DIR_NAME were empty.
2007-10-08rm could malfunction under unusual circumstances:Jim Meyering
When operating on a relative name longer than 511 bytes, and (when either processing a directory that is neither writable nor readable (but still searchable) or when determining whether to prompt), and encountering an ENOMEM error while forming the file name, rm would operate on a truncated-to-511-byte name starting with "[...]" rather than the intended one. * NEWS: Describe the bugs. * src/remove.c: Correct two misuses of full_filename: (full_filename0, xfull_filename): New functions. (full_filename_): Rewrite to use full_filename0. (AD_pop_and_chdir): Use xfull_filename, not full_filename. (write_protected_non_symlink): Likewise.
2007-10-07Don't let a helper function modify errno.Jim Meyering
* src/remove.c (full_filename_): Save and restore errno. Spotted by Bruno Haible.
2007-10-07New program: mktemp.Jim Meyering
* NEWS: Mention this. * README: Add mktemp to the list. * AUTHORS: Add this: mktemp: Jim Meyering * src/mktemp.c: New file. * src/Makefile.am (bin_PROGRAMS): Add mktemp. (mktemp_LDADD): Add $(LIB_GETHRXTIME). * man/mktemp.x: New file. * man/Makefile.am (dist_man_MANS): Add mktemp.1. (mktemp.1): New dependency. * man/.cvsignore: Add mktemp.1. * man/.gitignore: New file. * src/.cvsignore, src/.gitignore: Add mktemp. * tests/misc/mktemp: New file. * tests/misc/Makefile.am (TESTS): Add mktemp. * tests/Coreutils.pm (run_tests): Give the POST-test function access to stdout and stderr contents, so it can verify that the named-on-stdout file/dir does indeed exist and has proper permissions, etc. [po/ChangeLog] * POTFILES.in: Add src/mktemp.c.
2007-10-07Avoid a pseudo-leak in sort.Jim Meyering
* src/sort.c (main) [lint]: Avoid a nominal leak.
2007-10-07Use puts, rather than printf ("%s\n". Slightly cleaner.Jim Meyering
* src/tsort.c (tsort): ...and more efficient.
2007-10-07Avoid a used-uninitialized error.Jim Meyering
* src/copy.c (copy_internal): Don't overload "use_stat".
2007-10-05Make a failing cross-partition mv give a sensible diagnostic.Jim Meyering
A cross-partition move of a file in a sticky tmpdir and owned by another user would evoke an invalid diagnostic after copying it: mv: cannot remove `x': Operation not permitted Either of the following (mv.c, remove.c) changes would fix the bug by itself. I think it's slightly better to use both; the added cost is minimal: mv: an extra lstat-per-mv-cmdline-arg-that-goes-cross-partition, rm: an extra lstat-per-unlink-that-fails-w/EPERM. * src/remove.c (remove_entry): Also lstat the file upon EPERM. * src/mv.c (rm_option_init): Initialize root_dev_ino just as is done in rm, so that a cross-partition invoked remove.c:rm call works the same way as one invoked from the command-line use of "rm". That setting of root_dev_ino makes rm() do the equivalent of an additional lstat for each argument, which in turn gives rm enough information to issue the right diagnostic. * tests/mv/sticky-to-xpart (version): New file. Test for the above. * tests/mv/Makefile.am (TESTS): Add sticky-to-xpart. Arrange for "make check-root" to run the new root-only test. * tests/Makefile.am (tb): New target, to run the new root-only test. (all_t): Add tb. * src/c99-to-c89.diff: Adjust offsets.
2007-10-02Never copy through a symlink that cp has just created.Jim Meyering
* src/copy.c (copy_internal): When same-file detection requires 'stat'ing the destination file, also 'lstat' it and ensure that it wasn't the destination of a preceding copy operation. This bug was introduced on 2007-06-18. * tests/cp/abuse: New test for the above. * tests/cp/Makefile.am (TESTS): Add abuse.
2007-09-30cp: do not abbreviate in --help output.Jim Meyering
* src/cp.c (usage): Don't abbreviate: s/=link/=links/. Reported by Géraud Meyer in <http://bugs.debian.org/444137>. Signed-off-by: Jim Meyering <jim@meyering.net>
2007-09-29* src/groups.sh: Don't ignore first argument if later argument is --.Eric Blake
Signed-off-by: Eric Blake <ebb9@byu.net>
2007-09-24copy.c: Remove definitions of factored-out functions.Jim Meyering
* src/copy.c: Include "file-set.h". (seen_file, record_file): Remove functions that I factored out on 2007-08-23.
2007-09-22rm: give a sensible diagnostic when failing to remove a symlinkJim Meyering
On some systems (those with openat et al), when rm would fail to remove a symlink, it would fail with the misleading diagnostic, "Too many levels of symbolic links". * NEWS: Mention the bug fix. * src/remove.c (is_nondir_lstat): New function. (remove_entry): Use it to catch failed-to-remove symlink (and any other non-dir) here so that we don't fall through and try to treat it as directory, which -- with a symlink -- would provoke the bogus ELOOP failure. * tests/rm/fail-eacces: Add a test for the above. * src/c99-to-c89.diff: Adjust offsets.
2007-09-22rm: fix a tiny, nearly inconsequential bug.Jim Meyering
Don't perform a "."-relative lstat, when the file in question may well not be in ".". Although this is a bug, a few attempts to exercise it on a linux-2.6.22 system failed. You probably need a pre-openat system to trigger the failure. The consequence of this bug would be a lower-quality diagnostic upon failed dir removal. * src/remove.c (is_dir_lstat): Add a parameter, fd_cwd. Use it instead of hard-coding AT_FDCWD. (remove_entry): Call is_dir_lstat with fd_cwd. Signed-off-by: Jim Meyering <jim@meyering.net>
2007-09-07chmod: don't ignore a dangling symlinkJim Meyering
* NEWS: Mention the bug fix. * src/chmod.c (process_file): Handle the case of FTS_SLNONE, i.e., give a diagnostic saying we cannot operate on such a file. * tests/chmod/thru-dangling: Compare new stderr output with expected.
2007-09-05Adapt to new SELinux behavior: "?" vs. new "unlabeled"Jim Meyering
* src/ls.c (gobble_file): Interpret the new "unlabeled" indicator from getfilecon/lgetfilecon the same way we interpret a negative return value: no security context. So we don't print the "+". * tests/selinux: Recognize that "unlabeled" means insufficient support for SELinux, just like "?".
2007-09-01Ensure that snapshot version changes make it to groups, too.Jim Meyering
* src/Makefile.am (groups): Depend on Makefile.
2007-08-30* src/.gitignore: Ignore *.exe for platforms with non-empty $(EXEEXT).Eric Blake
2007-08-30Use PACKAGE_NAME instead of GNU_PACKAGE.Eric Blake
* src/Makefile.am (.sh, uninstall-local): Adjust all users of hand-rolled GNU_PACKAGE to instead use autoconf-provided PACKAGE_NAME. * src/basename.c (main): Likewise. * src/chroot.c (main): Likewise. * src/dirname.c (main): Likewise. * src/echo.c (main): Likewise. * src/expr.c (main): Likewise. * src/factor.c (main): Likewise. * src/groups.sh (version): Likewise. Also, reflect change in --version output due to GPLv3. * src/hostid.c (main): Likewise. * src/hostname.c (main): Likewise. * src/link.c (main): Likewise. * src/logname.c (main): Likewise. * src/nice.c (main): Likewise. * src/nohup.c (main): Likewise. * src/printenv.c (main): Likewise. * src/printf.c (main): Likewise. * src/pwd.c (main): Likewise. * src/setuidgid.c (main): Likewise. * src/sleep.c (main): Likewise. * src/system.h (case_GETOPT_VERSION_CHAR): Likewise. * src/test.c (main): Likewise. * src/true.c (main): Likewise. * src/unlink.c (main): Likewise. * src/uptime.c (main): Likewise. * src/users.c (main): Likewise. * src/whoami.c (main): Likewise. * src/yes.c (main): Likewise. * configure.ac (AC_CHECK_DECLS): No need to check strtoimax, strtoumax, since gnulib does this.
2007-08-29Use EXIT_FAILURE, not EXIT_FAIL, now that EXIT_FAILURE is always 1.Jim Meyering
* src/system.h (EXIT_FAIL): Remove definition. * src/chroot.c (main): EXIT_FAIL -> EXIT_FAILURE. * src/env.c (main): Likewise. * src/nice.c (main): Likewise. * src/su.c (change_identity, main): Likewise. * src/tty.c (main): Likewise. Suggestion from Eric Blake.
2007-08-28* src/test.c (usage): Say that [ honors --help and --version, but test does not.Jim Meyering
2007-08-28By default, do not install hostname anymore; no kidding, this time.Jim Meyering
* src/Makefile.am (EXTRA_PROGRAMS): Remove hostname from this list, now that it's no longer being installed by default. This should have been part of the 2007-08-21 change. (check-duplicate-no-install): New rule to ensure this doesn't happen again. (check): Depend on it.
2007-08-28Reflect renaming: mreadlink-with-size -> areadlink-with-size.Jim Meyering
* bootstrap.conf: Update module name. * src/copy.c (copy_internal): Update header and function names. * src/ls.c (get_link_name): Likewise. * src/readlink.c (main): Likewise. * src/stat.c (print_stat): Likewise.