summaryrefslogtreecommitdiff
path: root/tests/misc/tee.sh
AgeCommit message (Collapse)Author
2015-03-04tee: generalize the --write-error option to --output-errorPádraig Brady
Adjust commit v8.23-140-gfdd6ebf to add the --output-error option instead of --write-error, and treat open() errors like write() errors. * doc/coreutils.texi (tee invocation): s/write-error/output-error/. * src/tee.c (main): Exit on open() error if appropriate. * tests/misc/tee.sh: Add a case to test open() errors. * NEWS: Adjust for the more general output error behavior. Suggested by Bernhard Voelker.
2015-02-24tee: add --write-error to control handling of closed pipesPádraig Brady
tee is very often used with pipes and this gives better control when writing to them. There are 3 classes of file descriptors that tee can write to: files(1), pipes(2), and early close pipes(3). Handling write errors to 1 & 2 is supported at present with the caveat that failure writing to any pipe will terminate tee immediately. Handling write errors to type 3 is not currently supported. To improve the supported combinations we add these options: --write-error=warn Warn if error writing any output including pipes. Allows continued writing to still open files/pipes. Exit status is failure if any output had error. --write-error=warn-nopipe, -p Warn if error writing any output except pipes. Allows continued writing to still open files/pipes. Exit status is failure if any non pipe output had error. --write-error=exit Exit if error writing any output including pipes. --write-error=exit-nopipe Exit if error writing any output except pipes. Use the "nopipe" variants when files are of types 1 and 3, otherwise use the standard variants with types 1 and 2. A caveat with the above scheme is that a combination of pipe types (2 & 3) is not supported robustly. I.e. if you use the "nopipe" variants when using both type 2 and 3 pipes, then any "real" errors on type 2 pipes will not be diagnosed. Note also a general issue with type 3 pipes that are not on tee's stdout, is that shell constructs don't allow to distinguish early close from real failures. For example `tee >(head -n1) | grep -m1 ..` can't distinguish between an error or an early close in "head" pipe, while the fail on the grep part of the pipe is distinguished independently from the resulting pipe errors. This is a general issue with the >() construct, rather than with tee itself. * NEWS: Mention the new feature. * doc/coreutils.texi (tee invocation): Describe the new option. * src/tee.c (usage): Likewise. (main): With --write-error ignore SIGPIPE, and handle the various exit, diagnostics combinations. * tests/misc/tee.sh: Tess all the new options. Fixes http://bugs.gnu.org/11540
2015-02-20tee: treat '-' operand as file name as mandated by POSIXBernhard Voelker
Since v5.2.1-1247-g8dafbe5, tee(1) treated '-' as stdout while POSIX explicitly requires to treat this as a file name. Revert this change, as the interleaved output - due to sending another copy of input to stdout - is not considered to be useful. Discussed in http://lists.gnu.org/archive/html/coreutils/2015-02/msg00085.html * src/tee.c (tee_files): Remove the special handling for "-" operands. (usage): Remove the corresponding sentence. * doc/coreutils.texi (common options): Remove the "tee -" example. (tee invocation): Document that tee(1) now treats "-" as a file name. * tests/misc/tee.sh: Add a test case for "tee -". While at it, re-indent the above multi-argument processing case and extend that to 13 operands, as POSIX mandates that, too. * tests/misc/tee-dash.sh: Remove now-obsolete test. * tests/local.mk (all_tests): Remove the above test. * NEWS (Changes in behavior): Mention the change.
2015-02-18tee: exit early if no more writable outputsPádraig Brady
* src/tee.c (main): Don't continue reading if we can't output anywhere. * tests/misc/tee.sh: Ensure we exit when no more outputs. * NEWS: Mention the change in behavior.
2015-01-01maint: update all copyright year number rangesPádraig Brady
Run "make update-copyright" and then... * tests/sample-test: Adjust to use the single most recent year. * tests/du/bind-mount-dir-cycle-v2.sh: Fix case in copyright message, so that year is updated automatically in future.
2014-01-02maint: update all copyright year number rangesBernhard Voelker
Run "make update-copyright", but then also run this, perl -pi -e 's/2\d\d\d-//' tests/sample-test to make that one script use the single most recent year number.
2013-01-01maint: update all copyright year number rangesJim Meyering
Run "make update-copyright", but then also run this, perl -pi -e 's/2\d\d\d-//' tests/sample-test to make that one script use the single most recent year number.
2012-09-05build: don't use recursive make for tests/ subdirectoryStefano Lattarini
* Makefile.am (SUBDIRS): Remove 'tests'. (include): The '$(top_srcdir)/tests/local.mk' file. (check-root): Remove this convenience target, it's no longer needed now that the "real" check-root target once in 'tests/Makefile' will land in the top-level makefile. * configure.ac (AC_CONFIG_FILES): Remove 'tests/Makefile'. * tests/Makefile.am: Rename ... * tests/local.mk: ... like this, with a lot of adjustments. * tests/init.cfg: Move ... * init.cfg: ... here. This is necessary, for a limitation of the gnulib-provided 'tests/init.sh', which unconditionally look for 'init.cfg' in the $(srcdir) directory. * tests/*/*.sh: Adjust: expect init.sh to be in '$srcdir/tests', not in '$srcdir', and extend $PATH with './src', not with '../src'. * tests/Coreutils.pm: Adjust similarly. * tests/pr/pr-tests.pl ($pfx): Likewise.
2012-08-30tests: add .sh and .pl suffixes to shell and perl tests, respectivelyStefano Lattarini
Not only this shrinks the size of the generated Makefile (from > 6300 lines to ~3000), but will allow further simplifications in future changes. * tests/Makefile.am (TEST_EXTENSIONS): Add '.sh' and '.pl'. (PL_LOG_COMPILER, SH_LOG_COMPILER): New, still defined simply to $(LOG_COMPILER) for the time being. (TESTS, root_tests): Adjust as described. * All tests: Rename as described.