summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2009-10-29maint: avoid exiting with magic numberEric Blake
Cope with gnulib's new sc_prohibit_magic_number_exit rule. * .x-sc_prohibit_magic_number_exit: New file, to add exemptions. * Makefile.am (syntax_check_exceptions): Distribute it. * lib/euidaccess-stat.c (main): Fix culprits. * src/chcon.c (main): Likewise. * src/runcon.c (main): Likewise. * src/setuidgid.c (main): Likewise.
2009-10-28nice, nohup, su: detect write failure to stderrEric Blake
These programs can print non-fatal diagnostics to stderr prior to exec'ing a subsidiary program. However, if we thought the situation warranted a diagnostic, we insist that the diagnostic be printed without error, rather than blindly exec, as it may be a security risk. For an example, try 'nice -n -1 nice 2>/dev/full'. Failure to raise priority (by lowering niceness) is not fatal, but failure to inform the user about failure to change priority is dangerous. * src/nice.c (main): Declare failure if writing advisory message to stderr fails. * src/nohup.c (main): Likewise. * src/su.c (main): Likewise. * tests/misc/nice: Test this. * tests/misc/nohup: Likewise. * NEWS: Document this.
2009-10-28doc: improve the echo and printf help on escapesPádraig Brady
* src/printf.c (usage): Merge strings with echo.c to aid translators. Move the description for \NNN beside the other numeric escape codes. Don't mention "character" as that suggests character conversion. * src/echo.c (usage): Likewise. Also mention the \xHH escape sequence.
2009-10-28echo, printf: interpret \e as the Escape characterPádraig Brady
Match gcc, perl, bash, ksh, tcsh, ... in supporting \e. * src/printf.c (print_escape_char): Output \x1B when \e encountered. * src/echo.c (main): Likewise. * src/stat.c (print_escape_char): Likewise. * doc/coreutils.texi (echo invocation): Add \e to the list. * tests/misc/printf: Verify that \e outputs \x1B. * NEWS: Mention the change in behaviour.
2009-10-28printenv: ignore bogus variable namesEric Blake
Exposed by env a=b=c printenv a=b. * src/printenv.c (main): Silently reject = in names. * tests/misc/printenv: Test for it. * NEWS: Document this.
2009-10-28maint: avoid "make syntax-check" failurePádraig Brady
* src/printenv.c: Remove unused "long-options.h"
2009-10-27doc: turn env comments into documentationEric Blake
* src/env.c: Convert introductory comments... * doc/coreutils.texi (env invocation): ...into documentation. Suggested by Jim Meyering.
2009-10-27env, printenv: add -0/--null optionEric Blake
Allows for unambiguous processing when environment values (or even non-portable names!) contain newline. * src/env.c (longopts): Add new option. (usage): Document it. (main): Implement it. * src/printenv.c (longopts): New variable. (usage): Document new option. (main): Implement it. * doc/coreutils.texi (Common options): New macro optNull. (du invocation, env invocation, printenv invocation): Use it. * NEWS: Mention this. * tests/misc/env-null: New test. * tests/Makefile.am (TESTS): Run it.
2009-10-26tests: clean up tests of env -- handlingEric Blake
The comment in env.c about -- handling has not matched the behavior in the code since the initial commit back in 1992. * src/env.c: Fix bogus comment. * tests/misc/env: Further tweaks, avoiding PATH problems inherent in testing -i, and testing program name containing =. * doc/coreutils.texi (env invocation): Mention that intermediate program is needed to invoke program with name containing =.
2009-10-26env: reject bogus -u argumentsEric Blake
* src/env.c (main): Use unsetenv rather than putenv to remove items from environ, and check for failure. * bootstrap.conf (gnulib_modules): Add unsetenv. * tests/misc/env: Test this. * NEWS: Document it.
2009-10-26maint: let gnulib provide environEric Blake
* bootstrap.conf (gnulib_modules): Add environ. * src/env.c (environ): Delete declaration. * src/printenv.c (environ): Likewise. * src/stdbuf.c (environ): Likewise. * src/su.c (environ): Likewise.
2009-10-26nice: execute program even when setpriority fails due to EACCESJim Meyering
* src/nice.c (perm_related_errno): New function. (main): Use it, rather than testing only errno == EPERM. * NEWS (Bug fixes): Mention it.
2009-10-25timeout: don't orphan monitored programs if they ignore specified signalsPádraig Brady
* src/timeout.c (install_signal_handlers): Handle any user specified signal, so that if it does not cause the child to exit then we don't exit and orphan the child. Previously this for example, would leave an orphan dd process running: timeout -sUSR1 1s dd if=/dev/zero of=/dev/null * NEWS: Mention the fix.
2009-10-23nohup: use EXIT_CANCELED if not POSIXLY_CORRECTEric Blake
* src/nohup.c (NOHUP_FAILURE): Rename... (POSIX_NOHUP_FAILURE): ...to this. (main): Pay attention to POSIXLY_CORRECT, to determine whether to use status 125 or 127. * doc/coreutils.texi (nohup invocation): Document this. * NEWS: Likewise. * tests/misc/invalid-opt (exit_status): Adjust expected results. * tests/misc/help-version (expected_failure_status): Likewise. * tests/misc/nohup: Likewise.
2009-10-23chroot, env, nice, su: use EXIT_CANCELED for internal failureEric Blake
* src/chroot.c (main): Use EXIT_CANCELED, not EXIT_FAILURE. * src/env.c (main): Likewise. * src/nice.c (main): Likewise. * src/su.c (change_identity, main): Likewise. * doc/coreutils.texi (chroot invocation, env invocation) (nice invocation, su invocation): Document this. * NEWS: Likewise. * tests/misc/invalid-opt (exit_status): Adjust expected results. * tests/misc/help-version (expected_failure_status): Likewise.
2009-10-23build: prohibit improper use of stat and lstatEric Blake
* cfg.mk (sc_prohibit_stat_macro_address): New rule. * src/ln.c (do_link): Adjust comment to avoid false positive. * src/stat.c (do_stat): Likewise. * src/touch.c (main): Likewise.
2009-10-22tail -f: avoid a race conditionGiuseppe Scrivano
* NEWS (Bug fixes): Mention it. * src/tail.c (check_fspec): New function. (tail_forever_inotify): Ensure there is no new data before entering the inotify events wait loop.
2009-10-21md5sum, sha*sum, sum: line-buffer the printed checksumsPádraig Brady
* src/md5sum.c (main): Set stdout to line buffered mode to ensure parallel running instances don't intersperse their output. This adds 5% to the run time in the worst case of many zero length files, or 2% with standard file sizes. * src/sum.c (main): Likewise. * tests/misc/md5sum-parallel: New test for atomic output. * tests/Makefile.am: Reference it. * NEWS: Mention the fix
2009-10-19build: use gnulib's isblank moduleJim Meyering
* bootstrap.conf (gnulib_modules): Add isblank. * src/system.h (isblank): Don't define. * m4/check-decl.m4: Don't check for isblank declaration. * gnulib: Update submodule to latest.
2009-10-18maint: factor out duplication in currently unused rulesJim Meyering
* src/Makefile.am (fs_normalize_perl_subst): Define. (fs-magic, fs-kernel-magic): Use it.
2009-10-17touch: add -h to change symlink timestamps, where supportedEric Blake
* src/touch.c (no_dereference): New flag variable. (longopts): Add -h/--no-dereference. (touch): Add symlink handling. (usage): Document new option. (main): Accept new option. * NEWS: Document it. * doc/coreutils.texi (touch invocation): Likewise. Also mention birthtime. * tests/touch/no-dereference: New test. * tests/Makefile.am (TESTS): Run it.
2009-10-13tail: add add missing backslash at the end of a line in usageC de-Avillez
* src/tail.c (usage): Add missing backslash at the end of a line.
2009-10-12tail: tweak usage for more clarityEric Blake
* src/tail.c (usage): Spell out -n +K. * THANKS: Update. Reported by Jan-Pawel Wrozstinski.
2009-10-10touch: optimize use of utimensEric Blake
* src/touch.c (main): Use UTIME_NOW rather than calling gettime. (touch): Use UTIME_OMIT rather than stat.
2009-10-10copy: allow symlink timestamp preservation on more systemsEric Blake
* src/copy.c (utimens_symlink): Simplify by using lutimens. * m4/jm-macros.m4 (coreutils_MACROS): Drop utimensat; gnulib does this for us. * tests/cp/preserve-slink-time: Recognize lutimes support.
2009-10-10maint: touch up previous LDADD patchEric Blake
* src/Makefile.am (dir_LDADD): Delete; the ls_LDADD line covers this.
2009-10-10build: build uname(1) unconditionallyJim Meyering
Before, on a system without the uname function, the build system would detect that and not build/install a uname program. Now that gnulib guarantees a uname function, ... * configure.ac: Don't check for the uname function. * src/Makefile.am (build_if_possible__progs): Move uname... (EXTRA_PROGRAMS): ...to this list.
2009-10-10maint: list program names one per lineJim Meyering
* src/Makefile.am (EXTRA_PROGRAMS): List them one per line. (build_if_possible__progs): Likewise.
2009-10-10build: ls: fix link failure due to missing -laclJim Meyering
* src/Makefile.am (ls_LDADD): Re-add $(LIB_ACL). Inadvertently-removed by commit 78c93601.
2009-10-09maint: touch up previous LDADD patchEric Blake
* src/Makefile.am (stdbuf_LDADD): Add missing primer. (hostname_LDADD, uname_LDADD): Add GETHOSTNAME_LIB. * bootstrap.conf (gnulib_modules): Add uname.
2009-10-09maint: improve additional library trackingEric Blake
* src/Makefile.am (LDADD): Refactor, to make per-library additions to individual programs easier to maintain.
2009-10-09chcon: don't disable just because SELinux is disabledJim Meyering
* src/chcon.c (main): Now that gnulib provides getfilecon wrappers, we can revert most of the 2009-10-05 commit 3a97d664, "chcon: exit immediately if SELinux is disabled", since chcon is still useful as long as the file system provides handlers for the security.* name space. gnulib's getfilecon wrappers ensure that an offending context now evokes a return value of -1. Prompted by comments from Stephen Smalley in http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/18378/focus=18394 * NEWS (Bug fixes): Mention it.
2009-10-09ls: remove explicit getfilecon work-aroundJim Meyering
* src/ls.c (gobble_file): Remove l?getfilecon work-around, now that the gnulib wrappers handle it for us.
2009-10-08maint: use X2NREALLOC in more placesEric Blake
* src/chroot.c (set_additional_groups): Use X2NREALLOC rather than x2nrealloc. * src/factor.c (emit_factor): Likewise. * src/setuidgid.c (main): Likewise.
2009-10-08maint: remove unused macros and declarationsEric Blake
* src/system.h (EDQUOT, EISDIR, ENOSYS, EOVERFLOW, F_OK, X_OK) (W_OK, R_OK): Delete; macros provided by gnulib. (includes): Gnulib guarantees both <time.h> and <sys/time.h>, in either order. (free, malloc, memchr, realloc, getenv, lseek): Delete, gnulib guarantees these declarations. * m4/check-decl.m4 (gl_CHECK_DECLS): Delete checks now done by gnulib.
2009-10-08maint: move timeout exit statusesEric Blake
* src/timeout.c (EXIT_TIMEDOUT, EXIT_CANCELED): Remove as macros... * src/system.h (EXIT_TIMEDOUT, EXIT_CANCELED): ...and provide as enum values instead. * src/stdbuf.c (EXIT_CANCELED): Delete.
2009-10-08stdbuf: improve path searchEric Blake
* src/stdbuf.c (set_program_path): Use gnulib methods for better file name handling. * bootstrap.conf (gnulib_modules): Add xreadlink.
2009-10-08stat: work with recent gnulib changesEric Blake
* src/stat.c (do_stat): Don't mask function-like stat macro.
2009-10-08stat: add support for many more file system typesJim Meyering
* src/stat.c (human_fstype): Add the following FS types, from <linux/magic.h>: afs, anon-inode FS, btrfs, cgroupfs, cramfs-wend, debugfs, futexfs, inotifyfs, minux3, securityfs, selinux, xenfs. Also add "nilfs". * src/Makefile.am (fs-kernel-magic): New rule. * NEWS (Bug fixes): Mention this.
2009-10-08stat: recognize CIFS and HFS file system typesJim Meyering
* src/stat.c (human_fstype) [CIFS, HFS]: Add new file system types. Prompted by a report from Stuart Kemp. Normalize the form of a few hexadecimal magic numbers. Alphabetize on S_MAGIC_ case names. * src/Makefile.am (fs-magic-compare, fs-def, fs-magic): New rules, to automate comparison of our list with that in the Linux statfs man page. * NEWS (Bug fixes): Mention it.
2009-10-07md5sum, sha*sum: also accept openssl checksum syntaxGuenter Knauf
* src/md5sum.c (split_3): Accept openssl checksum syntax, which differs only by two spaces from that of the bsd checksum tools: openssl: MD5(f)= d41d8cd98f00b204e9800998ecf8427e bsd: MD5 (f) = d41d8cd98f00b204e9800998ecf8427e
2009-10-06chcon: exit immediately if SELinux is disabledOndřej Vašík
This change happens to avoid an abort in chcon when SELinux is disabled while operating on a file with an "unlabeled" context from back in 2006. However, that same abort can still be triggered by the same file when running chcon with SELinux enabled. This bug in chcon will be fixed in a subsequent commit via a getfilecon wrapper. See http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/18378/focus=18384 for how to correct your disk attributes to avoid triggering this bug. * src/chcon.c (main): Exit immediately if SELinux is disabled. Reported in http://bugzilla.redhat.com/527142 by Yanko Kaneti. * src/runcon.c (main): Do not hardcode program name in error message. * THANKS: Update.
2009-10-02dircolors: highlight .cgm and .emf as imagesJames R. Van Zandt
* src/dircolors.hin: Add .cgm, .emf. * THANKS: Update.
2009-10-02tail: avoid a race where we could miss new data with --pidPádraig Brady
* src/tail.c (tail_forever, tail_forever_inotify): Close a race in tail_forever_inotify where new data written after the file check by a now dead process, but before the pid check, is not output. We use the POSIX guarantee that read() and write() are serialized wrt each other even in separate processes, to assume full file consistency after exit() and so poll for new data _after_ the writer has exited. This also allows us to not redundantly _wait_ for new data if the process is dead. * tests/tail-2/pid: Remove the now partially invalid sub second sleep check as we now don't unconditionally wait, and replace it with a check for the redundant sleep. Also clarify some of the existing comments. * NEWS: Mention the fix.
2009-09-30ls: always print "?" for allocated size of a dereferenced dangling symlinkPádraig Brady
Previously for `ls -Ls` (but not `ls -Lsl`), we referenced the st_blocks returned from the previous failed stat() call. This undefined value was seen to be 0 for dangling symlinks at least. * src/ls.c (print_file_name_and_frills, length_of_file_name_and_frills): Don't use st_blocks if the previous stat() failed * tests/ls/dangle: Add a test case * NEWS: Mention the fix, and roll up related items into a single entry.
2009-09-29stat: interpret "-" as standard inputJim Meyering
* src/stat.c (do_stat): Interpret a command line argument of "-" to mean "standard input", like many other tools do. (do_statfs): Fail upon any attempt to use "-". * NEWS (Changes in behavior): Mention it. * tests/misc/stat-hyphen: New test, to exercise the above. * tests/Makefile.am (TESTS): Add misc/stat-hyphen.
2009-09-29ls: don't use an undefined struct stat after failed stat/lstatJim Meyering
* src/ls.c (format_inode): Access f->stat only if f->stat_ok is set. * NEWS (Bug fixes): Mention it. Improved-by: Pádraig Brady <P@draigBrady.com>
2009-09-29ls: print "?", not "0" as inode of dereferenced dangling symlinkJim Meyering
ls prints inode numbers two ways: for long (-l) listings, and for short ones, e.g., ls -li and ls -i. The code to print long listings properly printed "?" when the inode was unknown, but the code for handling short listings would print 0 instead. Factor out the formatting code into a new function so ls prints the right string ("?") from both places: * NEWS (Bug fixes): Mention it. * src/ls.c (format_inode): New function. (print_long_format): Use it here. (print_file_name_and_frills): Use it here, too. * tests/ls/dangle: Exercise this fix. Reported by Yang Ren in http://bugzilla.redhat.com/525400
2009-09-29ls: with -LR, exit with status 2 upon detecting a cycleJim Meyering
* src/ls.c (print_dir): Diagnosing the cycle is not enough. Also set exit status to 2. This is what Solaris' /bin/ls does, too. * tests/ls/infloop: Rework test: match both expected stdout and stderr. Require an exit status of 2 in this case. * doc/coreutils.texi (ls invocation): Mention that a loop provokes in an exit status of 2. * NEWS (Bug fixes): Mention it. Reported by Yang Ren in http://bugzilla.redhat.com/525402. * THANKS: Correct ordering of Yang Ren's names.
2009-09-25cp, mv: use linkat to guarantee semanticsEric Blake
* src/copy.c (copy_internal): Use linkat, not link.