summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2007-07-06setuidgid: set all groups, not just the primary one; mgetgroups: new moduleJim Meyering
I wanted to use the xgetgroups function from id.c, so factored it out and made it into a non-exiting function (hence the "m" prefix rather than "x"). * src/setuidgid.c (main): Use mgetgroups. Include "mgetgroups.h". * src/id.c (xgetgroups): Remove function. Include "mgetgroups.h". (print_group_list): Use mgetgroups, not xgetgroups. * gl/modules/mgetgroups: New module. * gl/lib/mgetgroups.c: New file. mgetgroups is derived from id.c's xgetgroups function. * bootstrap.conf (gnulib_modules): Add mgetgroups. * gl/m4/mgetgroups.m4: New file. * gl/lib/mgetgroups.h: New file.
2007-07-05* src/id.c: Include "getugroups.h" rather than declaring manually.Jim Meyering
2007-07-04pr -F no longer suppresses the footer or the first two blank header linesPaul Eggert
Here's a patch along the lines of <http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/10849/focus=10857>. It's a bit large since it changes the test cases to match the behavior, and the test cases' file names depend on the behavior! * NEWS: pr -F no longer suppresses the footer or the first two blank lines in the header. * doc/coreutils.texi (pr invocation): Likewise. Also, a too-short page length implies -t, not -T. * src/pr.c (lines_per_header, lines_per_footer): Now constants. (init_parameters): Don't try to change them. (print_header): Use the same header and footer format regardless of wither form feeds are being used. (usage): Adjust to above change when describing too-short page length. Too-short page length impliesy -t, not -T. * tests/pr/2-S_f-t_notab: Adjust to the fact that -F now affects only formfeed handling; it does not change the header. * tests/pr/2-Sf-t_notab: Likewise. ... * tests/pr/3-5l17f-t: Remove, since it's been renamed to another file whose name has a line count 7 larger, reflecting the new line count needed for this behavior. * tests/pr/3a3l8f-t: Likewise. ... * tests/pr/w72l24f-ll: Likewise. Signed-off-by: Jim Meyering <jim@meyering.net>
2007-06-23Prefer "STREQ (a, b)" over "strcmp (a, b) == 0"; similar for != 0.Jim Meyering
* src/base64.c (main): Likewise. * src/install.c (setdefaultfilecon): Likewise. * src/sort.c (main): Likewise. * Makefile.maint (sc_prohibit_strcmp): New rule. * .x-sc_prohibit_strcmp: New file, to list the few exceptions. * Makefile.am (EXTRA_DIST): Add .x-sc_prohibit_strcmp.
2007-06-23seq no longer mishandles cases like "seq 0 0.000001 0.000003",Paul Eggert
where it would not print the desired last number. * doc/coreutils.texi (seq invocation): Remove advice about workaround for seq off-by-one problem, since the bug is fixed now. Replace it with more-generic advice about rounding errors. * src/seq.c (long_double_format, print_numbers): New arg NUMERIC_FORMAT. All uses changed.
2007-06-22* src/stat.c (long_options): Add a FIXME comment to help ensureJim Meyering
that the deprecated and undocumented "--filesystem" option is removed someday.
2007-06-18A few more symlink-related fixes. Fix a bug triggered by cpPaul Eggert
--parents and symlinks. Close some race conditions possible when the destination replaces a newly-created file with a symlink. * NEWS: Document that 'cp --parents' no longer mishandles symlinks in file name components of source. * src/copy.c (HAVE_LCHOWN): Default to false. (lchown) [!defined HAVE_LCHOWN]: Define to chown, for convenience. * src/cp.c (lchown) [!HAVE_LCHOWN]: Likewise. * src/install.c (lchown [!HAVE_LCHOWN]: Likewise. * src/copy.c (set_owner): Use lchown instead of chown, for safety in case the file got replaced by a symlink in the meantime. * src/cp.c (re_protect): Likewise. * src/install.c (change_attributes): Likewise. * src/copy.c (copy_internal): Use ordinary C rather than an #if. * src/cp.c (lchown) [!HAVE_LCHOWN]: Define to chown, for convenience. (struct dir_attr): Cache the entire struct stat of the directory, rather than just its mode, so that we needn't stat the directory twice (which can lead to races). (re_protect): Don't use XSTAT as that's not appropriate in this context (symlinks should be followed here). Instead, use the cached stat value. (make_dir_parents_private): Save dir's entire struct stat, not just its mode. * tests/cp/cp-parents: Add test to check against bug with cp --parents and symlinks.
2007-06-18Use mreadlink_with_size (doesn't exit), not xreadlink_with_size.Jim Meyering
* bootstrap.conf (gnulib_modules): Add readlink-with-size. Remove xreadlink and xreadlink-with-size. * src/copy.c (copy_internal): Use mreadlink_with_size, not xreadlink_with_size. * src/ls.c (get_link_name): Likewise. * src/readlink.c (main): Likewise. * src/stat.c (print_stat): Likewise.
2007-06-16Make chgrp and chown diagnostics consistent.Jim Meyering
* src/chown.c (main): Emit the diagnostic before the file name, not after it, to be consistent with chgrp's diagnostic. * src/chgrp.c (parse_group): Emit a ":" between the diagnostic and the file name. Reported by Egmont Koblinger. * THANKS: Add Egmont Koblinger.
2007-06-15Correct cp's handling of destination symlinks in some cases.Paul Eggert
* NEWS: "cp" no longer considers a destination symlink to be the same as the referenced file when copying links or making backups. * src/copy.c (copy_reg): When following a symlink, use the followed name in later chown etc. requests, so that the created file is affected, rather than the symlink. Use O_NOFOLLOW on source when not dereferencing symlinks; this avoids a race. Preserve errno correctly when doing multiple open attempts on the destination. (copy_internal): Follow destination symlinks only when copying a regular file and only when we don't intend to remove or rename the destination first, regardless of whether following source symlinks; this is because since POSIX and tradition (e.g., FreeBSD) say we should ordinarily follow destination symlinks if the system calls would ordinarily do so. * src/copy.h (struct cp_options): Add comment that 'dereference' is only for source files. * src/cp.c (usage): Note that --derereference etc. are only for source files. (make_dir_parents_private): Follow symlinks, regardless of whether --dereference is specified, because these are destination symlinks. * tests/cp/same-file: Adjust tests to match revised behavior. Filter out perror output since it might vary from host to host. Use sed alone instead of also using echo. * doc/coreutils.texi (cp invocation): Document the behavior better when the destination is a symlink. Clarify source versus destination symlinks. Describe the new behavior for destination symlinks. 2007-06-15 Jim Meyering <jim@meyering.net> * src/copy.c: Include "canonicalize.h". (copy_reg): Use canonicalize_filename_mode to follow the symlink, so that we can always open with O_EXCL and avoid a race.
2007-06-15Don't include "quote.h" when it is not used.Jim Meyering
* src/md5sum.c: Remove unnecessary inclusion of "quote.h". * src/expr.c: Likewise. * src/shred.c: Likewise. * Makefile.maint (sc_prohibit_quote_without_use): New rule. * src/c99-to-c89.diff: Adjust offsets.
2007-06-15Clarify what "cat" documentation means by "blank" lines.Paul Eggert
* doc/coreutils.texi (cat invocation): "Blank" lines actually mean empty lines. * src/cat.c (usage): Say that "nonblank" means nonempty. Clarify --squeeze-blank.
2007-06-13rmdir: give better diagnosticsJim Meyering
* src/rmdir.c (remove_parents): Give a more descriptive/consistent diagnostic upon failure. (main): Likewise. Suggestion from Joey Hess. * THANKS: Add Joey Hess.
2007-06-13Don't include "quotearg.h" when it is not used.Jim Meyering
* Makefile.maint (sc_prohibit_quotearg_without_use): New rule. * src/cp.c: Don't include "quotearg.h". It wasn't used.
2007-06-10bug-fix: cp would fail to write through a dangling symlinkJim Meyering
* NEWS: Mention the bug fix. * src/copy.c (copy_reg): When open fails with EEXIST, the destination is lstat'able, and a symlink, call open again, but now without O_EXCL. * tests/cp/thru-dangling: New file, to test for the above fix. * tests/cp/Makefile.am (TESTS): Add thru-dangling. * THANKS: Add Michael McLagan. Bug report from Michael McLagan in <http://bugzilla.redhat.com/243588>.
2007-05-31* src/dircolors.hin: Add screen-256color.Jim Meyering
Suggested by sdl.web@gmail.com in <http://bugzilla.redhat.com/239266>.
2007-05-26wc: ignore multibyte-character decoding errorsJames Youngman
* src/wc.c (wc): Don't issue an error message when mbrtowc indicates that we have seen an invalid byte sequence. This makes "wc /bin/sh" bearable (though the word and line counts are likely not to be useful). * NEWS: Mention the change.
2007-05-22cut: diagnose a range starting with 0 (-f 0-2) as invalid, andJim Meyering
give a better diagnostic for a field-number/offset of 0. * NEWS: Mention the fix. * src/cut.c (ADD_RANGE_PAIR): Add an explicit check for 0. Based on a patch from James Youngman. * tests/misc/cut: Add tests for the above.
2007-05-22"cut -f 2-0" now fails; before, it was equivalent to "cut -f 2-"Jim Meyering
Also, diagnose the '-' in "cut -f -" as an invalid range, rather than interpreting it as the unlimited range, "1-". * NEWS: Mention these changes. * src/cut.c (set_fields): Don't interpret an accumulator "value" of 0 as an unspecified range endpoint. Give better diagnostics. Adjust a comment so that it is true also for 64-bit size_t. * tests/cut/Test.pm: Add tests for the above.
2007-05-22stty: fix a harmless syntax nitJim Meyering
* src/stty.c (visible): Use ";" as the statement terminator between two assignments, not ",". (integer_arg): Join an unnecessarily wrapped line.
2007-05-22stty: diagnose an invalid hex value in 35-colon commmand-line argumentJim Meyering
* NEWS: Mention this. * src/stty.c (strtoul_tcflag_t, strtoul_cc_t): New functions. (recover_mode): Use those functions (not sscanf), to parse the string robustly. * tests/stty/invalid: New file. Test for the above. * tests/stty/Makefile.am (TESTS): Add invalid. * .x-sc_prohibit_atoi_atof: Don't exempt stty.c from this check. Add tests/stty/invalid so we don't have to obfuscate the comment about sscanf therein. * Makefile.maint (sc_prohibit_atoi_atof): Mention sscanf in the diagnostic, too.
2007-05-19Rename uses of futimens -> gl_futimens; glibc now declares the former.Jim Meyering
* src/copy.c (copy_reg): Reflect renaming: futimens -> gl_futimens. * src/touch.c (touch): Likewise.
2007-05-13Remove the generated tests/*/Makefile.am files from version control.Jim Meyering
* tests/cut/Makefile.am: git-remove this generated file. * tests/head/Makefile.am: Likewise. * tests/join/Makefile.am: Likewise. * tests/pr/Makefile.am: Likewise. * tests/sort/Makefile.am: Likewise. * tests/tac/Makefile.am: Likewise. * tests/tail/Makefile.am: Likewise. * tests/test/Makefile.am: Likewise. * tests/tr/Makefile.am: Likewise. * tests/uniq/Makefile.am: Likewise. * tests/wc/Makefile.am: Likewise. * .cvsignore, .gitignore: Ignore these generated files. * src/.cvsignore, src/.gitignore: Add chcon here, ... * .cvsignore, .gitignore: ... not here.
2007-05-13Add -z option to uniq. Originally proposed by Egmont Koblinger.James Youngman
* NEWS: Mention uniq's new option: --zero-terminated (-z). * src/uniq.c: Add new option, --zero-terminated (-z), to make uniq use the NUL byte as separator/delimiter rather than newline. (check_file): Add a parameter: delimiter. Update caller. Use readlinebuffer_delim in place of readlinebuffer everywhere. (main): Handle the new option. (usage): Describe new option the same way sort does. * doc/coreutils.texi (uniq invocation): Describe the new option.
2007-05-04tr -c: don't abort when translating with S2 larger than complement of S1Jim Meyering
* src/tr.c (main): Remove invalid assertion triggered by e.g., tr -c a '[b*256]'. There's nothing wrong with having Set2 larger than Set1. Reported by Guntram Blohm. * tests/tr/Test.pm (no-abort-1): Test for the above. * NEWS: Mention this bug fix. * THANKS: Add Guntram Blohm.
2007-05-03The following commands and options now support the standard sizePaul Eggert
suffixes kB, M, MB, G, GB, and so on for T, P, Y, Z, and Y: head -c, head -n, od -j, od -N, od -S, split -b, split -C, tail -c, tail -n. * doc/coreutils.texi (od invocation, head invocation, tail invocation): Document support for new size suffixes. (head invocation, tail invocation): Document that -n uses the same suffixes as -c. (tail invocation): More-clearly document what leading "+" does. * src/head.c (usage, string_to_integer): Support new suffixes. * src/od.c (usage, main): Likewise. * src/split.c (usage, main): Likewise. * src/tail.c (usage, parse_options): Likewise. Prompted by a patch from Evan Hunt.
2007-05-02* src/du.c (usage): Tweak description of --dereference-args (-D) again.Jim Meyering
Prompted by another request for clarification from Justin Pryzby.
2007-04-28* src/nohup.c (usage): Describe how standard input and output are redirected.Paul Eggert
2007-04-25Add "runcon" to .cvsignore and .gitignore files.Jim Meyering
2007-04-25* src/du.c (usage): Clarify description of --dereference-args (-D).Jim Meyering
Prompted by a report from Justin Pryzby.
2007-04-24ls --color once again colors dangling symlinks correctlyEric Blake
* src/ls.c (gobble_file): Much like the 2007-04-07 fix, add a term to the expression that decides whether we need stat and/or lstat calls. Reported by Andreas Frische.
2007-04-16* src/cut.c (usage): Adjust synopsis to show that an OPTION is required.Jim Meyering
Reported by Rudolf Kastl.
2007-04-12split --line-bytes=N (-C N): don't create an empty file.Paul Eggert
* src/split.c (line_bytes_split): Don't create an empty line afterwards if the last buffer happens to be exactly full. * tests/misc/split-fail: Add a test case for this. * NEWS: mention this.
2007-04-10ls: don't form or compute the length of strings that won't be used.Jim Meyering
* src/ls.c (gobble_file): Form and compute length of strings for block size, owner, group, author, major+minor numbers and file size only if they'll actually be used. I.e., don't form most of them when not producing long format output.
2007-04-07Fix a bug in how the LS_COLORS ln=target attribute is handled.Eric Blake
* src/ls.c (gobble_file): Use "stat" (not lstat) also when the ln=target attribute applies. Reported by Kirk Kelsey.
2007-04-02* src/copy.c (copy_reg): Initialize local "con", before callingJim Meyering
getfscreatecon, in case that function (or its inline stub) does not set it.
2007-04-02* src/ls.c (print_horizontal): Fix bug reported by Mike Frysinger:Paul Eggert
ls -x DIR would sometimes output the wrong string in place of the first entry. * NEWS: Mention the bug fix. * tests/ls/x-option: New file. * tests/ls/Makefile.am (TESTS): Add x-option.
2007-03-29* src/runcon.c (main): Don't reorder arguments. Reported byJim Meyering
Ulrich Drepper in <http://bugzilla.redhat.com/232652>. * tests/misc/runcon-no-reorder: New file. Test for the above. * tests/misc/Makefile.am (TESTS): Add runcon-no-reorder.
2007-03-29* src/runcon.c (main): Remove "." at end of a diagnostic.Jim Meyering
2007-03-29* src/runcon.c: New program.Jim Meyering
* src/Makefile.am (bin_PROGRAMS): Add runcon. (runcon_LDADD): Define. * README: Add runcon to the list of programs. * AUTHORS: Add this: runcon: Russell Coker * tests/help-version: Add runcon as an exception. * man/Makefile.am (dist_man_MANS): Add runcon.1. (runcon.1): New dependency. * po/POTFILES.in: Add src/runcon.c.
2007-03-29mkfifo, mknod: Accept new "-Z, --context=C" option.Jim Meyering
* src/mkfifo.c, src/mknod.c: Include <selinux/selinux.h>. (main): Honor it. * src/Makefile.am (mkfifo_LDADD, mknod_LDADD): Use $(LIB_SELINUX).
2007-03-29mkdir: Accept new "-Z, --context=C" option.Jim Meyering
* src/mkdir.c: Include <selinux/selinux.h>. (main): Honor it. * src/Makefile.am (mkdir_LDADD): Use $(LIB_SELINUX).
2007-03-29* tests/cp/cp-a-selinux: New file. Test for the bug reported inJim Meyering
* tests/cp/Makefile.am (TESTS): Add cp-a-selinux. * tests/selinux: New file. * tests/Makefile.am (EXTRA_DIST): Add selinux. * tests/misc/selinux: Source the new script, rather than open coding it. Change how "cp -a" and "cp --preserve=context" work with SELinux. Now, cp -a attempts to preserve context, but failure to do so does not change cp's exit status. However "cp --preserve=context" is similar, but failure *does* cause cp to exit with nonzero status. * src/copy.h (struct cp_options) [require_preserve_context]: New member. * src/copy.c (copy_reg, copy_internal): Implement the above. * src/mv.c (cp_option_init): Initialize the new member. * src/install.c (cp_option_init): Likewise. * src/cp.c (cp_option_init): Likewise. (decode_preserve_arg): Set it or reset it. FIXME: add an on-writable-NFS-only test
2007-03-29* src/system.h (GETOPT_SELINUX_CONTEXT_OPTION_DECL): Define.Jim Meyering
2007-03-29cp, mv, install: add SELinux support, but unlike with the Red HatJim Meyering
patch, mv and cp do not provide the "-Z context" option. * src/copy.c: Include <selinux/selinux.h>. (restore_default_fscreatecon): New function. (copy_reg): Make cp --preserve=context work for existing destination. (copy_internal): Likewise for new destinations. * src/copy.h (cp_options) [preserve_security_context]: New member. * src/cp.c: Include <selinux/selinux.h>. (selinux_enabled): New global. (usage): Mention new --preserve=context option. (PRESERVE_CONTEXT): Define/use. (decode_preserve_arg): Handle PRESERVE_CONTEXT. (main): Remove an obsolete comment. If --preserve=context is specified on a system without SELinux enabled, give a diagnostic and fail. * src/mv.c: Include <selinux/selinux.h>. Set x->preserve_security_context if SELinux is enabled. * src/install.c: Accept new "-Z, --context=C" option. Accept --preserve-context option (but not -P option). Accept alternate spelling: --preserve_context, for now. Include <selinux/selinux.h> and "quotearg.h". (selinux_enabled, use_default_selinux_context): New globals. (PRESERVE_CONTEXT_OPTION): Define. (cp_option_init): Default: do not preserve security context. (setdefaultfilecon): New function. (main): Honor new options. * src/Makefile.am (mv_LDADD, cp_LDADD, ginstall_LDADD): Add $(LIB_SELINUX).
2007-03-29* src/c99-to-c89.diff: Remove the ls.c patch, now that I'veJim Meyering
temporarily removed the offending c99'ism.
2007-03-29* src/chcon.c (usage): Split a string literal that was longer than 509.Jim Meyering
2007-03-29* src/ls.c (gobble_file): Don't call getfilecon unless print_scontext.Jim Meyering
Upon failed getfilecon, accept not just ENOTSUP, but also ENODATA.
2007-03-29* src/c99-to-c89.diff: Adjust offsets.Jim Meyering
2007-03-29* src/c99-to-c89.diff: Remove trailing blanks.Jim Meyering